summaryrefslogtreecommitdiff
path: root/src/qcommon/vm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/qcommon/vm.c')
-rw-r--r--src/qcommon/vm.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/qcommon/vm.c b/src/qcommon/vm.c
index 876d36d5..5956c89a 100644
--- a/src/qcommon/vm.c
+++ b/src/qcommon/vm.c
@@ -246,7 +246,7 @@ void VM_LoadSymbols( vm_t *vm ) {
return;
}
- numInstructions = vm->instructionPointersLength >> 2;
+ numInstructions = vm->instructionCount;
// parse the symbols
text_p = mapfile.c;
@@ -358,8 +358,6 @@ intptr_t QDECL VM_DllSyscall( intptr_t arg, ... ) {
}
-#define STACK_SIZE 0x20000
-
/*
=================
VM_LoadQVM
@@ -431,7 +429,7 @@ vmHeader_t *VM_LoadQVM( vm_t *vm, qboolean alloc ) {
// round up to next power of 2 so all data operations can
// be mask protected
dataLength = header.h->dataLength + header.h->litLength +
- header.h->bssLength + STACK_SIZE;
+ header.h->bssLength;
for ( i = 0 ; dataLength > ( 1 << i ) ; i++ ) {
}
dataLength = 1 << i;
@@ -577,8 +575,8 @@ vm_t *VM_Create( const char *module, intptr_t (*systemCalls)(intptr_t *),
}
// allocate space for the jump targets, which will be filled in by the compile/prep functions
- vm->instructionPointersLength = header->instructionCount * 4;
- vm->instructionPointers = Hunk_Alloc( vm->instructionPointersLength, h_high );
+ vm->instructionCount = header->instructionCount;
+ vm->instructionPointers = Hunk_Alloc( vm->instructionCount*4, h_high );
// copy or compile the instructions
vm->codeLength = header->codeLength;
@@ -610,7 +608,7 @@ vm_t *VM_Create( const char *module, intptr_t (*systemCalls)(intptr_t *),
// the stack is implicitly at the end of the image
vm->programStack = vm->dataMask + 1;
- vm->stackBottom = vm->programStack - STACK_SIZE;
+ vm->stackBottom = vm->programStack - PROGRAM_STACK_SIZE;
Com_Printf("%s loaded in %d bytes on the hunk\n", module, remaining - Hunk_MemoryRemaining());
@@ -734,8 +732,6 @@ an OP_ENTER instruction, which will subtract space for
locals from sp
==============
*/
-#define MAX_STACK 256
-#define STACK_MASK (MAX_STACK-1)
intptr_t QDECL VM_Call( vm_t *vm, int callnum, ... ) {
vm_t *oldVM;
@@ -896,7 +892,7 @@ void VM_VmInfo_f( void ) {
Com_Printf( "interpreted\n" );
}
Com_Printf( " code length : %7i\n", vm->codeLength );
- Com_Printf( " table length: %7i\n", vm->instructionPointersLength );
+ Com_Printf( " table length: %7i\n", vm->instructionCount*4 );
Com_Printf( " data length : %7i\n", vm->dataMask + 1 );
}
}