Revision: 2776 Author: eliot Date: 2013-08-22 09:54:42 -0700 (Thu, 22 Aug 2013) Log Message: ----------- CogVM source as per VMMaker.oscog-eem.333
Speed-up Newspeak significantly (e.g. -28% in one compile-intensive benchmark) by maintaining unpaired methods (compilations of anonymous accessors) on a linked list instead of searching the entire method zone.
Do this by adding a NewspeakCogMethod and surrogates that add a nextMethod field. Update surrogate accessor generation so that accessors can answer and receive surrogates and nils. Also add a nop before the dynSuperEntry so as to change its alignment now that (in the Newspeak VM) CogMethod has changed size in gaining a field.
Eliminate CogStackPage, collapsing it onto InterpreterStackPage (it only has a class side).
Use temporaryCountOfMethodHader: instead of tempCountOf: in SimpleStackBasedCogit>>compileFrameBuild (header is in hand).
Modified Paths: -------------- branches/Cog/nscogsrc/vm/cogit.c branches/Cog/nscogsrc/vm/cogit.h branches/Cog/nscogsrc/vm/cogmethod.h branches/Cog/nscogsrc/vm/cointerp.c branches/Cog/nscogsrc/vm/cointerp.h branches/Cog/nscogsrc/vm/gcc3x-cointerp.c branches/Cog/nscogsrc/vm/interp.h branches/Cog/nscogsrc/vm/vmCallback.h branches/Cog/src/vm/cogit.c branches/Cog/src/vm/cogit.h branches/Cog/src/vm/cogmethod.h branches/Cog/src/vm/cointerp.c branches/Cog/src/vm/cointerp.h branches/Cog/src/vm/cointerpmt.c branches/Cog/src/vm/cointerpmt.h branches/Cog/src/vm/gcc3x-cointerp.c branches/Cog/src/vm/gcc3x-cointerpmt.c branches/Cog/src/vm/interp.h branches/Cog/src/vm/vmCallback.h
Property Changed: ---------------- branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
Modified: branches/Cog/nscogsrc/vm/cogit.c =================================================================== --- branches/Cog/nscogsrc/vm/cogit.c 2013-08-21 01:28:22 UTC (rev 2775) +++ branches/Cog/nscogsrc/vm/cogit.c 2013-08-22 16:54:42 UTC (rev 2776) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.329 uuid: 5bf1ecce-8cdb-48fd-bc66-b41b4cff2efe + CCodeGenerator VMMaker.oscog-eem.333 uuid: 84da9cb8-7f30-4cb7-b4fb-239a11f63b54 from - StackToRegisterMappingCogit VMMaker.oscog-eem.329 uuid: 5bf1ecce-8cdb-48fd-bc66-b41b4cff2efe + StackToRegisterMappingCogit VMMaker.oscog-eem.333 uuid: 84da9cb8-7f30-4cb7-b4fb-239a11f63b54 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.329 uuid: 5bf1ecce-8cdb-48fd-bc66-b41b4cff2efe " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.333 uuid: 84da9cb8-7f30-4cb7-b4fb-239a11f63b54 " __DATE__ ; char *__cogitBuildInfo = __buildInfo;
@@ -367,6 +367,7 @@ static sqInt addressIsInInstructions(AbstractInstruction *address); static sqInt addressOfEndOfCaseinCPIC(sqInt n, CogMethod *cPIC); static void addToOpenPICList(CogMethod *anOpenPIC); +static void addToUnpairedMethodList(CogMethod *aCogMethod); static void addToYoungReferrers(CogMethod *cogMethod); static sqInt alignUptoRoutineBoundary(sqInt anAddress); static sqInt allMachineCodeObjectReferencesValid(void); @@ -981,6 +982,7 @@ static sqInt remapNSIfObjectRefpchasYoung(sqInt annotation, char *mcpc, sqInt hasYoungPtr); static sqInt remapOop(sqInt oop); static void removeFromOpenPICList(CogMethod *anOpenPIC); +static void removeFromUnpairedMethodList(CogMethod *aCogMethod); static void resolveJumpTarget(AbstractInstruction * self_in_resolveJumpTarget); static sqInt returnRegForStoreCheck(void); static sqInt rewriteCallAttarget(AbstractInstruction * self_in_rewriteCallAttarget, usqInt callSiteReturnAddress, usqInt callTargetAddress); @@ -1951,6 +1953,7 @@ sqInt traceStores; static char *trampolineAddresses[NumTrampolines*2]; static sqInt trampolineTableIndex; +static CogMethod * unpairedMethodList; static usqInt youngReferrers;
@@ -2223,6 +2226,16 @@ }
static void +addToUnpairedMethodList(CogMethod *aCogMethod) +{ + assert(((aCogMethod->cmType)) == CMMethod); + assert((unpairedMethodList == null) + || (((unpairedMethodList->cmType)) == CMMethod)); + (aCogMethod->nextMethod = unpairedMethodList); + unpairedMethodList = aCogMethod; +} + +static void addToYoungReferrers(CogMethod *cogMethod) { assert(youngReferrers <= limitAddress); @@ -3174,6 +3187,8 @@ { CogMethod *cogMethod;
+ unpairedMethodList = null; + cogMethod = ((CogMethod *) baseAddress); while ((((usqInt)cogMethod)) < mzFreeStart) { if (((cogMethod->cmType)) == CMMethod) { @@ -3692,6 +3707,8 @@ source = ((CogMethod *) baseAddress); openPICList = null; methodCount = 0; + unpairedMethodList = null; + while ((source < (limitZony())) && (((source->cmType)) != CMFree)) { assert((cogMethodDoesntLookKosher(source)) == 0); @@ -3699,6 +3716,11 @@ if (((source->cmUsageCount)) > 0) { (source->cmUsageCount = ((sqInt) ((source->cmUsageCount)) >> 1)); } + if ((((sqInt)(rawHeaderOf((source->methodObject))))) != (((sqInt)source))) { + (source->nextMethod = unpairedMethodList); + unpairedMethodList = source; + } + if (((source->cmType)) == CMOpenPIC) { (source->nextOpenPIC = ((usqInt)openPICList)); openPICList = source; @@ -3719,7 +3741,7 @@ (dest->objectHeader = objectHeaderValue); if (((dest->cmType)) == CMMethod) {
- /* For non-Newspeak there should be a one-to-one mapping metween bytecoded and + /* For non-Newspeak there should be a one-to-one mapping between bytecoded and cog methods. For Newspeak not necessarily, but only for anonymous accessors. */ /* Only update the original method's header if it is referring to this CogMethod. */
@@ -3728,6 +3750,9 @@ } else { assert((noAssertMethodClassAssociationOf((dest->methodObject))) == (nilObject())); + (dest->nextMethod = unpairedMethodList); + unpairedMethodList = dest; + } } else { @@ -4351,7 +4376,12 @@ static void compileEntry(void) { + + /* 1st nop differentiates dynSuperEntry from no-check entry if using nextMethod */ + /* begin Nop */ + gen(Nop); + /* begin Nop */ dynSuperEntry = gen(Nop);
/* begin AlignmentNops: */ @@ -4424,7 +4454,7 @@ genoperand(PushR, SendNumArgsReg); /* begin PushR: */ genoperand(PushR, ReceiverResultReg); - for (i = (methodOrBlockNumArgs + 1), iLimiT = (tempCountOf(methodObj)); i <= iLimiT; i += 1) { + for (i = (methodOrBlockNumArgs + 1), iLimiT = (temporaryCountOfMethodHeader(methodHeader)); i <= iLimiT; i += 1) { /* begin PushR: */ genoperand(PushR, SendNumArgsReg); } @@ -8052,6 +8082,8 @@ originalMethod = ((CogMethod *) methodHeader); assert(((originalMethod->blockSize)) == size); methodHeader = (originalMethod->methodHeader); + addToUnpairedMethodList(method); + } else { rawHeaderOfput(methodObj, ((sqInt)method)); @@ -8193,18 +8225,10 @@ method referring directly to only one cog method, which will have a specific selector, not necessarily the right one. It is therefore worth-while searching for a cog - method on this method - that has the right selector. - We could revisit this: - - a send site could have two loads, one for the selector and one for the - class, eliminating the need to store the selector in the header of a cog - method (although it would still be needed in a PIC, because open PICs are - shared) - a set of unpaired cog methods could be maintained to speed up - the search. since - the methodHeader field is effectively unused in an unpaired method the - list could - link through this field (c.f. the openPICList linked through the - methodObject field). */ + method on this bytecoded + method that has the right selector. To speed up the search we maintain all + such unpaired + methods on the unpairedMethodList. */
static CogMethod * findPreviouslyCompiledVersionOfwith(sqInt aMethodObj, sqInt aSelectorOop) @@ -8213,14 +8237,14 @@
if ((methodHasCogMethod(aMethodObj)) && ((methodClassAssociationOf(aMethodObj)) == (nilObject()))) { - cogMethod = ((CogMethod *) baseAddress); - while (cogMethod < (limitZony())) { - if ((((cogMethod->cmType)) == CMMethod) - && ((((cogMethod->selector)) == aSelectorOop) - && (((cogMethod->methodObject)) == aMethodObj))) { + cogMethod = unpairedMethodList; + while (cogMethod != null) { + assert(((cogMethod->cmType)) == CMMethod); + if ((((cogMethod->selector)) == aSelectorOop) + && (((cogMethod->methodObject)) == aMethodObj)) { return cogMethod; } - cogMethod = methodAfter(cogMethod); + cogMethod = (cogMethod->nextMethod); } } return null; @@ -8250,6 +8274,8 @@ } else { assert((noAssertMethodClassAssociationOf((cogMethod->methodObject))) == (nilObject())); + removeFromUnpairedMethodList(cogMethod); + } (cogMethod->cmRefersToYoung = 0); } @@ -14832,6 +14858,8 @@ mzFreeStart = (baseAddress = theStartAddress); youngReferrers = (limitAddress = theLimitAddress); openPICList = null; + unpairedMethodList = null; + methodBytesFreedSinceLastCompaction = 0; methodCount = 0; } @@ -17280,6 +17308,28 @@ }
static void +removeFromUnpairedMethodList(CogMethod *aCogMethod) +{ + CogMethod *prevMethod; + + assert(((aCogMethod->cmType)) == CMMethod); + if (aCogMethod == unpairedMethodList) { + unpairedMethodList = (aCogMethod->nextMethod); + return; + } + prevMethod = unpairedMethodList; + while (prevMethod != null) { + assert((prevMethod != null) + && (((prevMethod->cmType)) == CMMethod)); + if (((prevMethod->nextMethod)) == aCogMethod) { + (prevMethod->nextMethod = (aCogMethod->nextMethod)); + return; + } + prevMethod = (aCogMethod->nextMethod); + } +} + +static void resolveJumpTarget(AbstractInstruction * self_in_resolveJumpTarget) { BytecodeFixup *fixup;
Modified: branches/Cog/nscogsrc/vm/cogit.h =================================================================== --- branches/Cog/nscogsrc/vm/cogit.h 2013-08-21 01:28:22 UTC (rev 2775) +++ branches/Cog/nscogsrc/vm/cogit.h 2013-08-22 16:54:42 UTC (rev 2776) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.329 uuid: 5bf1ecce-8cdb-48fd-bc66-b41b4cff2efe + CCodeGenerator VMMaker.oscog-eem.333 uuid: 84da9cb8-7f30-4cb7-b4fb-239a11f63b54 */
Modified: branches/Cog/nscogsrc/vm/cogmethod.h =================================================================== --- branches/Cog/nscogsrc/vm/cogmethod.h 2013-08-21 01:28:22 UTC (rev 2775) +++ branches/Cog/nscogsrc/vm/cogmethod.h 2013-08-22 16:54:42 UTC (rev 2776) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.329 uuid: 5bf1ecce-8cdb-48fd-bc66-b41b4cff2efe + CCodeGenerator VMMaker.oscog-eem.333 uuid: 84da9cb8-7f30-4cb7-b4fb-239a11f63b54 */
typedef struct { @@ -15,7 +15,7 @@ unsigned stackCheckOffset : 12; } CogBlockMethod;
-typedef struct { +typedef struct _CogMethod { sqInt objectHeader; unsigned cmNumArgs : 8; unsigned cmType : 3; @@ -30,4 +30,7 @@ sqInt methodObject; sqInt methodHeader; sqInt selector; + struct _CogMethod *nextMethod; } CogMethod; + +#define NewspeakCogMethod CogMethod
Modified: branches/Cog/nscogsrc/vm/cointerp.c =================================================================== --- branches/Cog/nscogsrc/vm/cointerp.c 2013-08-21 01:28:22 UTC (rev 2775) +++ branches/Cog/nscogsrc/vm/cointerp.c 2013-08-22 16:54:42 UTC (rev 2776) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.328 uuid: d9a4d11d-3a72-437e-b617-92de227ffdde + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 from - CoInterpreter VMMaker.oscog-eem.328 uuid: d9a4d11d-3a72-437e-b617-92de227ffdde + CoInterpreter VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.328 uuid: d9a4d11d-3a72-437e-b617-92de227ffdde " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 " __DATE__ ; char *__interpBuildInfo = __buildInfo;
@@ -83,7 +83,7 @@ struct _StackPage *prevPage; } StackPage;
-#define CogStackPage StackPage +#define InterpreterStackPage StackPage
@@ -1993,7 +1993,7 @@ /* 575 */ (void (*)(void))0, 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); -const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.328"; +const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.331"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace;
@@ -2068,7 +2068,7 @@ /* begin initStackPagesAndInterpret */ VM_LABEL(0initStackPagesAndInterpret); stackPageBytes = stackPageByteSize(); - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + stackPagesBytes = (GIV(numStackPages) * ((sizeof(InterpreterStackPage)) + (stackPageByteSize()))) + BytesPerWord; theStackMemory = alloca(stackPagesBytes); memset(theStackMemory, 0, stackPagesBytes); sqMakeMemoryNotExecutableFromTo(((usqInt)(startOfMemory())), ((usqInt)GIV(memoryLimit))); @@ -24164,7 +24164,7 @@ sqInt theIndex;
null; - structStackPageSize = sizeof(CogStackPage); + structStackPageSize = sizeof(InterpreterStackPage); GIV(bytesPerPage) = slotsPerPage * BytesPerWord;
/* Because stack pages grow down baseAddress is at the top of a stack page and so to avoid
Modified: branches/Cog/nscogsrc/vm/cointerp.h =================================================================== --- branches/Cog/nscogsrc/vm/cointerp.h 2013-08-21 01:28:22 UTC (rev 2775) +++ branches/Cog/nscogsrc/vm/cointerp.h 2013-08-22 16:54:42 UTC (rev 2776) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.328 uuid: d9a4d11d-3a72-437e-b617-92de227ffdde + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 */
Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c =================================================================== --- branches/Cog/nscogsrc/vm/gcc3x-cointerp.c 2013-08-21 01:28:22 UTC (rev 2775) +++ branches/Cog/nscogsrc/vm/gcc3x-cointerp.c 2013-08-22 16:54:42 UTC (rev 2776) @@ -2,11 +2,11 @@
/* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.328 uuid: d9a4d11d-3a72-437e-b617-92de227ffdde + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 from - CoInterpreter VMMaker.oscog-eem.328 uuid: d9a4d11d-3a72-437e-b617-92de227ffdde + CoInterpreter VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.328 uuid: d9a4d11d-3a72-437e-b617-92de227ffdde " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 " __DATE__ ; char *__interpBuildInfo = __buildInfo;
@@ -86,7 +86,7 @@ struct _StackPage *prevPage; } StackPage;
-#define CogStackPage StackPage +#define InterpreterStackPage StackPage
@@ -1996,7 +1996,7 @@ /* 575 */ (void (*)(void))0, 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); -const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.328"; +const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.331"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace;
@@ -2077,7 +2077,7 @@ /* begin initStackPagesAndInterpret */ VM_LABEL(0initStackPagesAndInterpret); stackPageBytes = stackPageByteSize(); - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + stackPagesBytes = (GIV(numStackPages) * ((sizeof(InterpreterStackPage)) + (stackPageByteSize()))) + BytesPerWord; theStackMemory = alloca(stackPagesBytes); memset(theStackMemory, 0, stackPagesBytes); sqMakeMemoryNotExecutableFromTo(((usqInt)(startOfMemory())), ((usqInt)GIV(memoryLimit))); @@ -24173,7 +24173,7 @@ sqInt theIndex;
null; - structStackPageSize = sizeof(CogStackPage); + structStackPageSize = sizeof(InterpreterStackPage); GIV(bytesPerPage) = slotsPerPage * BytesPerWord;
/* Because stack pages grow down baseAddress is at the top of a stack page and so to avoid
Modified: branches/Cog/nscogsrc/vm/interp.h =================================================================== --- branches/Cog/nscogsrc/vm/interp.h 2013-08-21 01:28:22 UTC (rev 2775) +++ branches/Cog/nscogsrc/vm/interp.h 2013-08-22 16:54:42 UTC (rev 2776) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.328 uuid: d9a4d11d-3a72-437e-b617-92de227ffdde + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 */
#define VM_PROXY_MAJOR 1
Modified: branches/Cog/nscogsrc/vm/vmCallback.h =================================================================== --- branches/Cog/nscogsrc/vm/vmCallback.h 2013-08-21 01:28:22 UTC (rev 2775) +++ branches/Cog/nscogsrc/vm/vmCallback.h 2013-08-22 16:54:42 UTC (rev 2776) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.328 uuid: d9a4d11d-3a72-437e-b617-92de227ffdde + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 */
#define VM_CALLBACK_INC 1
Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h ___________________________________________________________________ Modified: checkindate - Tue Aug 20 18:27:27 PDT 2013 + Thu Aug 22 09:53:05 PDT 2013
Modified: branches/Cog/src/vm/cogit.c =================================================================== --- branches/Cog/src/vm/cogit.c 2013-08-21 01:28:22 UTC (rev 2775) +++ branches/Cog/src/vm/cogit.c 2013-08-22 16:54:42 UTC (rev 2776) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.329 uuid: 5bf1ecce-8cdb-48fd-bc66-b41b4cff2efe + CCodeGenerator VMMaker.oscog-eem.333 uuid: 84da9cb8-7f30-4cb7-b4fb-239a11f63b54 from - StackToRegisterMappingCogit VMMaker.oscog-eem.329 uuid: 5bf1ecce-8cdb-48fd-bc66-b41b4cff2efe + StackToRegisterMappingCogit VMMaker.oscog-eem.333 uuid: 84da9cb8-7f30-4cb7-b4fb-239a11f63b54 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.329 uuid: 5bf1ecce-8cdb-48fd-bc66-b41b4cff2efe " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.333 uuid: 84da9cb8-7f30-4cb7-b4fb-239a11f63b54 " __DATE__ ; char *__cogitBuildInfo = __buildInfo;
@@ -557,7 +557,6 @@ static sqInt findMcpcBcpcMatchingBcpc(char *mcpc, sqInt bcpc, void *targetBcpc); static sqInt findMcpcBcpcMatchingMcpc(char *mcpc, sqInt bcpc, void *targetMcpc); CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod); -static CogMethod * findPreviouslyCompiledVersionOfwith(sqInt aMethodObj, sqInt aSelectorOop); static sqInt frameOffsetOfTemporary(sqInt index); static void freeMethod(CogMethod *cogMethod); static void freeOlderMethodsForCompaction(void); @@ -1638,6 +1637,7 @@ sqInt traceStores; static char *trampolineAddresses[NumTrampolines*2]; static sqInt trampolineTableIndex; +static CogMethod * unpairedMethodList; static usqInt youngReferrers;
@@ -2769,6 +2769,7 @@ { CogMethod *cogMethod;
+ cogMethod = ((CogMethod *) baseAddress); while ((((usqInt)cogMethod)) < mzFreeStart) { if (((cogMethod->cmType)) == CMMethod) { @@ -3275,6 +3276,7 @@ source = ((CogMethod *) baseAddress); openPICList = null; methodCount = 0; + while ((source < (limitZony())) && (((source->cmType)) != CMFree)) { assert((cogMethodDoesntLookKosher(source)) == 0); @@ -3282,6 +3284,7 @@ if (((source->cmUsageCount)) > 0) { (source->cmUsageCount = ((sqInt) ((source->cmUsageCount)) >> 1)); } + if (((source->cmType)) == CMOpenPIC) { (source->nextOpenPIC = ((usqInt)openPICList)); openPICList = source; @@ -3302,7 +3305,7 @@ (dest->objectHeader = objectHeaderValue); if (((dest->cmType)) == CMMethod) {
- /* For non-Newspeak there should be a one-to-one mapping metween bytecoded and + /* For non-Newspeak there should be a one-to-one mapping between bytecoded and cog methods. For Newspeak not necessarily, but only for anonymous accessors. */ /* Only update the original method's header if it is referring to this CogMethod. */
@@ -3311,6 +3314,7 @@ } else { assert((noAssertMethodClassAssociationOf((dest->methodObject))) == (nilObject())); + } } else { @@ -4005,7 +4009,7 @@ genoperand(PushR, SendNumArgsReg); /* begin PushR: */ genoperand(PushR, ReceiverResultReg); - for (i = (methodOrBlockNumArgs + 1), iLimiT = (tempCountOf(methodObj)); i <= iLimiT; i += 1) { + for (i = (methodOrBlockNumArgs + 1), iLimiT = (temporaryCountOfMethodHeader(methodHeader)); i <= iLimiT; i += 1) { /* begin PushR: */ genoperand(PushR, SendNumArgsReg); } @@ -7601,6 +7605,7 @@ originalMethod = ((CogMethod *) methodHeader); assert(((originalMethod->blockSize)) == size); methodHeader = (originalMethod->methodHeader); + } else { rawHeaderOfput(methodObj, ((sqInt)method)); @@ -7729,52 +7734,6 @@ return ((CogBlockMethod *) (blockDispatchTargetsForperformarg(cogMethod, findBlockMethodWithEntrystartBcpc, startbcpc))); }
- -/* Newspeak uses a set of methods to implement accessors, a setter and a - getter for - each inst var offset (e.g. 0 to 255). These accessors are installed under - the relevant - selectors in different method dictionaries as required. These methods - effectively have multiple selectors. The current inline cache design - stores the selector of a - linked send in the header of the target method. So this requires a - one-to-many mapping of bytecoded method to cog method, with the bytecoded - method referring - directly to only one cog method, which will have a specific selector, not - necessarily the right one. It is therefore worth-while searching for a cog - method on this method - that has the right selector. - We could revisit this: - - a send site could have two loads, one for the selector and one for the - class, eliminating the need to store the selector in the header of a cog - method (although it would still be needed in a PIC, because open PICs are - shared) - a set of unpaired cog methods could be maintained to speed up - the search. since - the methodHeader field is effectively unused in an unpaired method the - list could - link through this field (c.f. the openPICList linked through the - methodObject field). */ - -static CogMethod * -findPreviouslyCompiledVersionOfwith(sqInt aMethodObj, sqInt aSelectorOop) -{ - CogMethod *cogMethod; - - if ((methodHasCogMethod(aMethodObj)) - && ((methodClassAssociationOf(aMethodObj)) == (nilObject()))) { - cogMethod = ((CogMethod *) baseAddress); - while (cogMethod < (limitZony())) { - if ((((cogMethod->cmType)) == CMMethod) - && ((((cogMethod->selector)) == aSelectorOop) - && (((cogMethod->methodObject)) == aMethodObj))) { - return cogMethod; - } - cogMethod = methodAfter(cogMethod); - } - } - return null; -} - static sqInt frameOffsetOfTemporary(sqInt index) { @@ -7799,6 +7758,7 @@ } else { assert((noAssertMethodClassAssociationOf((cogMethod->methodObject))) == (nilObject())); + } (cogMethod->cmRefersToYoung = 0); } @@ -13699,6 +13659,7 @@ mzFreeStart = (baseAddress = theStartAddress); youngReferrers = (limitAddress = theLimitAddress); openPICList = null; + methodBytesFreedSinceLastCompaction = 0; methodCount = 0; }
Modified: branches/Cog/src/vm/cogit.h =================================================================== --- branches/Cog/src/vm/cogit.h 2013-08-21 01:28:22 UTC (rev 2775) +++ branches/Cog/src/vm/cogit.h 2013-08-22 16:54:42 UTC (rev 2776) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.329 uuid: 5bf1ecce-8cdb-48fd-bc66-b41b4cff2efe + CCodeGenerator VMMaker.oscog-eem.333 uuid: 84da9cb8-7f30-4cb7-b4fb-239a11f63b54 */
Modified: branches/Cog/src/vm/cogmethod.h =================================================================== --- branches/Cog/src/vm/cogmethod.h 2013-08-21 01:28:22 UTC (rev 2775) +++ branches/Cog/src/vm/cogmethod.h 2013-08-22 16:54:42 UTC (rev 2776) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.329 uuid: 5bf1ecce-8cdb-48fd-bc66-b41b4cff2efe + CCodeGenerator VMMaker.oscog-eem.333 uuid: 84da9cb8-7f30-4cb7-b4fb-239a11f63b54 */
typedef struct {
Modified: branches/Cog/src/vm/cointerp.c =================================================================== --- branches/Cog/src/vm/cointerp.c 2013-08-21 01:28:22 UTC (rev 2775) +++ branches/Cog/src/vm/cointerp.c 2013-08-22 16:54:42 UTC (rev 2776) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.328 uuid: d9a4d11d-3a72-437e-b617-92de227ffdde + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 from - CoInterpreter VMMaker.oscog-eem.328 uuid: d9a4d11d-3a72-437e-b617-92de227ffdde + CoInterpreter VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.328 uuid: d9a4d11d-3a72-437e-b617-92de227ffdde " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 " __DATE__ ; char *__interpBuildInfo = __buildInfo;
@@ -83,7 +83,7 @@ struct _StackPage *prevPage; } StackPage;
-#define CogStackPage StackPage +#define InterpreterStackPage StackPage
@@ -1983,7 +1983,7 @@ /* 575 */ (void (*)(void))0, 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); -const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.328]"; +const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.331]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace;
@@ -2056,7 +2056,7 @@ /* begin initStackPagesAndInterpret */ VM_LABEL(0initStackPagesAndInterpret); stackPageBytes = stackPageByteSize(); - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + stackPagesBytes = (GIV(numStackPages) * ((sizeof(InterpreterStackPage)) + (stackPageByteSize()))) + BytesPerWord; theStackMemory = alloca(stackPagesBytes); memset(theStackMemory, 0, stackPagesBytes); sqMakeMemoryNotExecutableFromTo(((usqInt)(startOfMemory())), ((usqInt)GIV(memoryLimit))); @@ -19778,7 +19778,7 @@ sqInt theIndex;
null; - structStackPageSize = sizeof(CogStackPage); + structStackPageSize = sizeof(InterpreterStackPage); GIV(bytesPerPage) = slotsPerPage * BytesPerWord;
/* Because stack pages grow down baseAddress is at the top of a stack page and so to avoid
Modified: branches/Cog/src/vm/cointerp.h =================================================================== --- branches/Cog/src/vm/cointerp.h 2013-08-21 01:28:22 UTC (rev 2775) +++ branches/Cog/src/vm/cointerp.h 2013-08-22 16:54:42 UTC (rev 2776) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.328 uuid: d9a4d11d-3a72-437e-b617-92de227ffdde + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 */
Modified: branches/Cog/src/vm/cointerpmt.c =================================================================== --- branches/Cog/src/vm/cointerpmt.c 2013-08-21 01:28:22 UTC (rev 2775) +++ branches/Cog/src/vm/cointerpmt.c 2013-08-22 16:54:42 UTC (rev 2776) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.328 uuid: d9a4d11d-3a72-437e-b617-92de227ffdde + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 from - CoInterpreterMT VMMaker.oscog-eem.328 uuid: d9a4d11d-3a72-437e-b617-92de227ffdde + CoInterpreterMT VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 */ -static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.328 uuid: d9a4d11d-3a72-437e-b617-92de227ffdde " __DATE__ ; +static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 " __DATE__ ; char *__interpBuildInfo = __buildInfo;
@@ -84,7 +84,7 @@ struct _StackPage *prevPage; } StackPage;
-#define CogStackPage StackPage +#define InterpreterStackPage StackPage
typedef struct { @@ -2082,7 +2082,7 @@ /* 575 */ (void (*)(void))0, 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); -const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.328]"; +const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.331]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace; sqInt willNotThreadWarnCount; @@ -2157,7 +2157,7 @@ /* begin initStackPagesAndInterpret */ VM_LABEL(0initStackPagesAndInterpret); stackPageBytes = stackPageByteSize(); - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + stackPagesBytes = (GIV(numStackPages) * ((sizeof(InterpreterStackPage)) + (stackPageByteSize()))) + BytesPerWord; theStackMemory = alloca(stackPagesBytes); memset(theStackMemory, 0, stackPagesBytes); sqMakeMemoryNotExecutableFromTo(((usqInt)(startOfMemory())), ((usqInt)GIV(memoryLimit))); @@ -20531,7 +20531,7 @@ sqInt theIndex;
null; - structStackPageSize = sizeof(CogStackPage); + structStackPageSize = sizeof(InterpreterStackPage); GIV(bytesPerPage) = slotsPerPage * BytesPerWord;
/* Because stack pages grow down baseAddress is at the top of a stack page and so to avoid
Modified: branches/Cog/src/vm/cointerpmt.h =================================================================== --- branches/Cog/src/vm/cointerpmt.h 2013-08-21 01:28:22 UTC (rev 2775) +++ branches/Cog/src/vm/cointerpmt.h 2013-08-22 16:54:42 UTC (rev 2776) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.328 uuid: d9a4d11d-3a72-437e-b617-92de227ffdde + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 */
Modified: branches/Cog/src/vm/gcc3x-cointerp.c =================================================================== --- branches/Cog/src/vm/gcc3x-cointerp.c 2013-08-21 01:28:22 UTC (rev 2775) +++ branches/Cog/src/vm/gcc3x-cointerp.c 2013-08-22 16:54:42 UTC (rev 2776) @@ -2,11 +2,11 @@
/* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.328 uuid: d9a4d11d-3a72-437e-b617-92de227ffdde + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 from - CoInterpreter VMMaker.oscog-eem.328 uuid: d9a4d11d-3a72-437e-b617-92de227ffdde + CoInterpreter VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.328 uuid: d9a4d11d-3a72-437e-b617-92de227ffdde " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 " __DATE__ ; char *__interpBuildInfo = __buildInfo;
@@ -86,7 +86,7 @@ struct _StackPage *prevPage; } StackPage;
-#define CogStackPage StackPage +#define InterpreterStackPage StackPage
@@ -1986,7 +1986,7 @@ /* 575 */ (void (*)(void))0, 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); -const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.328]"; +const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.331]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace;
@@ -2065,7 +2065,7 @@ /* begin initStackPagesAndInterpret */ VM_LABEL(0initStackPagesAndInterpret); stackPageBytes = stackPageByteSize(); - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + stackPagesBytes = (GIV(numStackPages) * ((sizeof(InterpreterStackPage)) + (stackPageByteSize()))) + BytesPerWord; theStackMemory = alloca(stackPagesBytes); memset(theStackMemory, 0, stackPagesBytes); sqMakeMemoryNotExecutableFromTo(((usqInt)(startOfMemory())), ((usqInt)GIV(memoryLimit))); @@ -19787,7 +19787,7 @@ sqInt theIndex;
null; - structStackPageSize = sizeof(CogStackPage); + structStackPageSize = sizeof(InterpreterStackPage); GIV(bytesPerPage) = slotsPerPage * BytesPerWord;
/* Because stack pages grow down baseAddress is at the top of a stack page and so to avoid
Modified: branches/Cog/src/vm/gcc3x-cointerpmt.c =================================================================== --- branches/Cog/src/vm/gcc3x-cointerpmt.c 2013-08-21 01:28:22 UTC (rev 2775) +++ branches/Cog/src/vm/gcc3x-cointerpmt.c 2013-08-22 16:54:42 UTC (rev 2776) @@ -2,11 +2,11 @@
/* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.328 uuid: d9a4d11d-3a72-437e-b617-92de227ffdde + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 from - CoInterpreterMT VMMaker.oscog-eem.328 uuid: d9a4d11d-3a72-437e-b617-92de227ffdde + CoInterpreterMT VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 */ -static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.328 uuid: d9a4d11d-3a72-437e-b617-92de227ffdde " __DATE__ ; +static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 " __DATE__ ; char *__interpBuildInfo = __buildInfo;
@@ -87,7 +87,7 @@ struct _StackPage *prevPage; } StackPage;
-#define CogStackPage StackPage +#define InterpreterStackPage StackPage
typedef struct { @@ -2085,7 +2085,7 @@ /* 575 */ (void (*)(void))0, 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); -const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.328]"; +const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.331]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace; sqInt willNotThreadWarnCount; @@ -2166,7 +2166,7 @@ /* begin initStackPagesAndInterpret */ VM_LABEL(0initStackPagesAndInterpret); stackPageBytes = stackPageByteSize(); - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + stackPagesBytes = (GIV(numStackPages) * ((sizeof(InterpreterStackPage)) + (stackPageByteSize()))) + BytesPerWord; theStackMemory = alloca(stackPagesBytes); memset(theStackMemory, 0, stackPagesBytes); sqMakeMemoryNotExecutableFromTo(((usqInt)(startOfMemory())), ((usqInt)GIV(memoryLimit))); @@ -20540,7 +20540,7 @@ sqInt theIndex;
null; - structStackPageSize = sizeof(CogStackPage); + structStackPageSize = sizeof(InterpreterStackPage); GIV(bytesPerPage) = slotsPerPage * BytesPerWord;
/* Because stack pages grow down baseAddress is at the top of a stack page and so to avoid
Modified: branches/Cog/src/vm/interp.h =================================================================== --- branches/Cog/src/vm/interp.h 2013-08-21 01:28:22 UTC (rev 2775) +++ branches/Cog/src/vm/interp.h 2013-08-22 16:54:42 UTC (rev 2776) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.328 uuid: d9a4d11d-3a72-437e-b617-92de227ffdde + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 */
#define VM_PROXY_MAJOR 1
Modified: branches/Cog/src/vm/vmCallback.h =================================================================== --- branches/Cog/src/vm/vmCallback.h 2013-08-21 01:28:22 UTC (rev 2775) +++ branches/Cog/src/vm/vmCallback.h 2013-08-22 16:54:42 UTC (rev 2776) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.328 uuid: d9a4d11d-3a72-437e-b617-92de227ffdde + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 */
#define VM_CALLBACK_INC 1
vm-dev@lists.squeakfoundation.org