[quake3-commits] r1716 - trunk/code/qcommon

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Nov 1 14:58:04 EST 2009


Author: ludwig
Date: 2009-11-01 14:58:03 -0500 (Sun, 01 Nov 2009)
New Revision: 1716

Modified:
   trunk/code/qcommon/vm.c
   trunk/code/qcommon/vm_interpreted.c
   trunk/code/qcommon/vm_local.h
Log:
Define stack sizes at central place

also reverts bug 4282 as stack is included in bss already so nothing that needs fixing

Modified: trunk/code/qcommon/vm.c
===================================================================
--- trunk/code/qcommon/vm.c	2009-10-29 03:09:07 UTC (rev 1715)
+++ trunk/code/qcommon/vm.c	2009-11-01 19:58:03 UTC (rev 1716)
@@ -357,8 +357,6 @@
 }
 
 
-#define	STACK_SIZE	0x20000
-
 /*
 =================
 VM_LoadQVM
@@ -427,7 +425,7 @@
 	// 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;
@@ -606,7 +604,7 @@
 
 	// 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());
 
@@ -730,8 +728,6 @@
 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;

Modified: trunk/code/qcommon/vm_interpreted.c
===================================================================
--- trunk/code/qcommon/vm_interpreted.c	2009-10-29 03:09:07 UTC (rev 1715)
+++ trunk/code/qcommon/vm_interpreted.c	2009-11-01 19:58:03 UTC (rev 1716)
@@ -311,13 +311,11 @@
 locals from sp
 ==============
 */
-#define	MAX_STACK	256
-#define	STACK_MASK	(MAX_STACK-1)
 
 #define	DEBUGSTR va("%s%i", VM_Indent(vm), opStack-stack )
 
 int	VM_CallInterpreted( vm_t *vm, int *args ) {
-	int		stack[MAX_STACK];
+	int		stack[OPSTACK_SIZE];
 	int		*opStack;
 	int		programCounter;
 	int		programStack;
@@ -392,7 +390,7 @@
 		if ( opStack < stack ) {
 			Com_Error( ERR_DROP, "VM opStack underflow" );
 		}
-		if ( opStack >= stack+MAX_STACK ) {
+		if ( opStack >= stack+OPSTACK_SIZE ) {
 			Com_Error( ERR_DROP, "VM opStack overflow" );
 		}
 

Modified: trunk/code/qcommon/vm_local.h
===================================================================
--- trunk/code/qcommon/vm_local.h	2009-10-29 03:09:07 UTC (rev 1715)
+++ trunk/code/qcommon/vm_local.h	2009-11-01 19:58:03 UTC (rev 1716)
@@ -22,6 +22,14 @@
 #include "q_shared.h"
 #include "qcommon.h"
 
+#define	OPSTACK_SIZE	256
+#define	OPSTACK_MASK	(OPSTACK_SIZE-1)
+
+// don't change
+// Hardcoded in q3asm an reserved at end of bss
+#define	PROGRAM_STACK_SIZE	0x10000
+#define	PROGRAM_STACK_MASK	(PROGRAM_STACK_SIZE-1)
+
 typedef enum {
 	OP_UNDEF, 
 
@@ -180,4 +188,3 @@
 int VM_SymbolToValue( vm_t *vm, const char *symbol );
 const char *VM_ValueToSymbol( vm_t *vm, int value );
 void VM_LogSyscalls( int *args );
-



More information about the quake3-commits mailing list