[Vm-dev] [commit][2752] CogVM source as per VMMaker.oscog-eem.305.

commits at squeakvm.org commits at squeakvm.org
Wed Jul 17 21:17:04 UTC 2013


Revision: 2752
Author:   eliot
Date:     2013-07-17 14:17:03 -0700 (Wed, 17 Jul 2013)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.305.

Limit the ammount of space the Cogit will stack allocate when compiling.
This limits the maximum number of bytecodes in a method that the
Cogit will compile.  Currently set at 1.5Mb of stack space from empirical
tests of alloca on Mac OS X 10.6, linux 2.6 & Windows XP.

Merge initializeCompilationWithConstantsOptions: into
initializeMiscConstantsWith:.

Modified Paths:
--------------
    branches/Cog/nscogsrc/vm/cogit.c
    branches/Cog/nscogsrc/vm/cogit.h
    branches/Cog/nscogsrc/vm/cogmethod.h
    branches/Cog/src/vm/cogit.c
    branches/Cog/src/vm/cogit.h
    branches/Cog/src/vm/cogmethod.h

Property Changed:
----------------
    branches/Cog/platforms/Cross/vm/sqSCCSVersion.h

Modified: branches/Cog/nscogsrc/vm/cogit.c
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.c	2013-07-17 20:57:47 UTC (rev 2751)
+++ branches/Cog/nscogsrc/vm/cogit.c	2013-07-17 21:17:03 UTC (rev 2752)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.302 uuid: 2ac39432-ac54-4584-964e-b129c90792f4
+	CCodeGenerator VMMaker.oscog-eem.305 uuid: ca4b6f0d-e113-4cd5-b859-527f897bd29b
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.302 uuid: 2ac39432-ac54-4584-964e-b129c90792f4
+	StackToRegisterMappingCogit VMMaker.oscog-eem.305 uuid: ca4b6f0d-e113-4cd5-b859-527f897bd29b
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.302 uuid: 2ac39432-ac54-4584-964e-b129c90792f4 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.305 uuid: ca4b6f0d-e113-4cd5-b859-527f897bd29b " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -255,6 +255,7 @@
 #define MaxMethodSize 65535
 #define MaxNegativeErrorCode -6
 #define MaxNumArgs 15
+#define MaxStackAllocSize 1572864
 #define MaxStackCheckOffset 0xFFF
 #define MaxUnitDisplacement 31
 #define MaxX2NDisplacement 992
@@ -1962,6 +1963,18 @@
 		annotations = (void *)((char *)fixups + fixupSize); \
 		opcodeIndex = labelCounter = annotationIndex = 0; \
 } while (0)
+#define allocateOpcodesbytecodesifFail(numberOfAbstractOpcodes,numberOfBytecodes,failBlock) do { \
+		int opcodeSize = sizeof(AbstractInstruction) * (numAbstractOpcodes = (numberOfAbstractOpcodes)); \
+		int fixupSize = sizeof(BytecodeFixup) * numAbstractOpcodes; \
+		int annotationSize = sizeof(InstructionAnnotation) * ((numAbstractOpcodes + 3) / 4); \
+		int allocSize = opcodeSize + fixupSize + annotationSize; \
+		if (allocSize > MaxStackAllocSize) failBlock; \
+		abstractOpcodes = alloca(allocSize); \
+		bzero(abstractOpcodes, opcodeSize + fixupSize); \
+		fixups = (void *)((char *)abstractOpcodes + opcodeSize); \
+		annotations = (void *)((char *)fixups + fixupSize); \
+		opcodeIndex = labelCounter = annotationIndex = 0; \
+} while (0)
 #define blockStartAt(index) (&blockStarts[index])
 #define breakOnImplicitReceiver() (traceFlags & 64)
 #define ceBaseFrameReturnPC() ceBaseFrameReturnTrampoline
@@ -4171,7 +4184,7 @@
 		? initialPC - 1
 		: byteLengthOf(methodObj));
 	numBytecodes = (endPC - initialPC) + 1;
-	allocateOpcodesbytecodes((numBytecodes + extra) * 10, numBytecodes);
+	allocateOpcodesbytecodesifFail((numBytecodes + extra) * 10, numBytecodes, return ((CogMethod *) MethodTooBig));
 	if (((numBlocks = scanMethod())) < 0) {
 		return ((CogMethod *) numBlocks);
 	}

Modified: branches/Cog/nscogsrc/vm/cogit.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.h	2013-07-17 20:57:47 UTC (rev 2751)
+++ branches/Cog/nscogsrc/vm/cogit.h	2013-07-17 21:17:03 UTC (rev 2752)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.302 uuid: 2ac39432-ac54-4584-964e-b129c90792f4
+	CCodeGenerator VMMaker.oscog-eem.305 uuid: ca4b6f0d-e113-4cd5-b859-527f897bd29b
  */
 
 

Modified: branches/Cog/nscogsrc/vm/cogmethod.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogmethod.h	2013-07-17 20:57:47 UTC (rev 2751)
+++ branches/Cog/nscogsrc/vm/cogmethod.h	2013-07-17 21:17:03 UTC (rev 2752)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.302 uuid: 2ac39432-ac54-4584-964e-b129c90792f4
+	CCodeGenerator VMMaker.oscog-eem.305 uuid: ca4b6f0d-e113-4cd5-b859-527f897bd29b
  */
 
 typedef struct {


Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
___________________________________________________________________
Modified: checkindate
   - Wed Jul 17 13:57:16 PDT 2013
   + Wed Jul 17 14:15:47 PDT 2013

Modified: branches/Cog/src/vm/cogit.c
===================================================================
--- branches/Cog/src/vm/cogit.c	2013-07-17 20:57:47 UTC (rev 2751)
+++ branches/Cog/src/vm/cogit.c	2013-07-17 21:17:03 UTC (rev 2752)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.302 uuid: 2ac39432-ac54-4584-964e-b129c90792f4
+	CCodeGenerator VMMaker.oscog-eem.305 uuid: ca4b6f0d-e113-4cd5-b859-527f897bd29b
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.302 uuid: 2ac39432-ac54-4584-964e-b129c90792f4
+	StackToRegisterMappingCogit VMMaker.oscog-eem.305 uuid: ca4b6f0d-e113-4cd5-b859-527f897bd29b
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.302 uuid: 2ac39432-ac54-4584-964e-b129c90792f4 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.305 uuid: ca4b6f0d-e113-4cd5-b859-527f897bd29b " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -255,6 +255,7 @@
 #define MaxMethodSize 65535
 #define MaxNegativeErrorCode -6
 #define MaxNumArgs 15
+#define MaxStackAllocSize 1572864
 #define MaxStackCheckOffset 0xFFF
 #define MaxUnitDisplacement 31
 #define MaxX2NDisplacement 992
@@ -1649,6 +1650,18 @@
 		annotations = (void *)((char *)fixups + fixupSize); \
 		opcodeIndex = labelCounter = annotationIndex = 0; \
 } while (0)
+#define allocateOpcodesbytecodesifFail(numberOfAbstractOpcodes,numberOfBytecodes,failBlock) do { \
+		int opcodeSize = sizeof(AbstractInstruction) * (numAbstractOpcodes = (numberOfAbstractOpcodes)); \
+		int fixupSize = sizeof(BytecodeFixup) * numAbstractOpcodes; \
+		int annotationSize = sizeof(InstructionAnnotation) * ((numAbstractOpcodes + 3) / 4); \
+		int allocSize = opcodeSize + fixupSize + annotationSize; \
+		if (allocSize > MaxStackAllocSize) failBlock; \
+		abstractOpcodes = alloca(allocSize); \
+		bzero(abstractOpcodes, opcodeSize + fixupSize); \
+		fixups = (void *)((char *)abstractOpcodes + opcodeSize); \
+		annotations = (void *)((char *)fixups + fixupSize); \
+		opcodeIndex = labelCounter = annotationIndex = 0; \
+} while (0)
 #define blockStartAt(index) (&blockStarts[index])
 #define breakOnImplicitReceiver() (traceFlags & 64)
 #define ceBaseFrameReturnPC() ceBaseFrameReturnTrampoline
@@ -3754,7 +3767,7 @@
 		? initialPC - 1
 		: byteLengthOf(methodObj));
 	numBytecodes = (endPC - initialPC) + 1;
-	allocateOpcodesbytecodes((numBytecodes + extra) * 10, numBytecodes);
+	allocateOpcodesbytecodesifFail((numBytecodes + extra) * 10, numBytecodes, return ((CogMethod *) MethodTooBig));
 	if (((numBlocks = scanMethod())) < 0) {
 		return ((CogMethod *) numBlocks);
 	}

Modified: branches/Cog/src/vm/cogit.h
===================================================================
--- branches/Cog/src/vm/cogit.h	2013-07-17 20:57:47 UTC (rev 2751)
+++ branches/Cog/src/vm/cogit.h	2013-07-17 21:17:03 UTC (rev 2752)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.302 uuid: 2ac39432-ac54-4584-964e-b129c90792f4
+	CCodeGenerator VMMaker.oscog-eem.305 uuid: ca4b6f0d-e113-4cd5-b859-527f897bd29b
  */
 
 

Modified: branches/Cog/src/vm/cogmethod.h
===================================================================
--- branches/Cog/src/vm/cogmethod.h	2013-07-17 20:57:47 UTC (rev 2751)
+++ branches/Cog/src/vm/cogmethod.h	2013-07-17 21:17:03 UTC (rev 2752)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.302 uuid: 2ac39432-ac54-4584-964e-b129c90792f4
+	CCodeGenerator VMMaker.oscog-eem.305 uuid: ca4b6f0d-e113-4cd5-b859-527f897bd29b
  */
 
 typedef struct {



More information about the Vm-dev mailing list