Revision: 3246 Author: eliot Date: 2015-02-04 15:48:12 -0800 (Wed, 04 Feb 2015) Log Message: ----------- CogVM source as per VMMaker.oscog-eem.1041
Allow primitivePerformWithArgs to avoid fetchClassOf: in Spur by making the last arg to primitiveObject:perform:withArguments:lookedUpIn: lookupClassOrNil.
Update Slang constant folding to include nil isNil/notNil.
Eliminate NewspeakV3 support from the Newspeak Spur VMs. Fix commonSendAbsent's comment.
Use numSlotsOfAny: to avoid unnecessary assert fails in some printing & testing code. Fix ... bug in longPrintOop:
Spur: Like V3's, Spur's fetchClassOf: also needs to be inlineable in ifs.
Never inline fetchClassOfNonImm: in Spur; it's a lot of code and should be rare, dynamically.
Spur image segments: Offset class indices in objects in segment to avoid confusion with forwarders etc.
Comment helper methods better.
Add 32-bit byte swapping for 64-bit segment support.
Don't expunge unmarked entries from the class table in the segment storage markObjects: invocation.
Do 32-bit word reversal in 64-bit Spur and hence fix 64-bit image segment load.
Make sure the leak checker is run when image segment leak checking is enabled.
Modified Paths: -------------- branches/Cog/nscogsrc/vm/cogit.c branches/Cog/nscogsrc/vm/cogit.h branches/Cog/nscogsrc/vm/cointerp.c branches/Cog/nscogsrc/vm/cointerp.h branches/Cog/nscogsrc/vm/gcc3x-cointerp.c branches/Cog/nsspursrc/vm/cogit.c branches/Cog/nsspursrc/vm/cogit.h branches/Cog/nsspursrc/vm/cointerp.c branches/Cog/nsspursrc/vm/cointerp.h branches/Cog/nsspursrc/vm/gcc3x-cointerp.c branches/Cog/nsspurstacksrc/vm/gcc3x-interp.c branches/Cog/nsspurstacksrc/vm/interp.c branches/Cog/sistasrc/vm/cogit.c branches/Cog/sistasrc/vm/cogit.h branches/Cog/sistasrc/vm/cointerp.c branches/Cog/sistasrc/vm/cointerp.h branches/Cog/sistasrc/vm/gcc3x-cointerp.c branches/Cog/spursistasrc/vm/cogit.c branches/Cog/spursistasrc/vm/cogit.h branches/Cog/spursistasrc/vm/cointerp.c branches/Cog/spursistasrc/vm/cointerp.h branches/Cog/spursistasrc/vm/gcc3x-cointerp.c branches/Cog/spursrc/vm/cogit.c branches/Cog/spursrc/vm/cogit.h branches/Cog/spursrc/vm/cointerp.c branches/Cog/spursrc/vm/cointerp.h branches/Cog/spursrc/vm/gcc3x-cointerp.c branches/Cog/spurstack64src/vm/gcc3x-interp.c branches/Cog/spurstack64src/vm/interp.c branches/Cog/spurstacksrc/vm/gcc3x-interp.c branches/Cog/spurstacksrc/vm/interp.c branches/Cog/src/vm/cogit.c branches/Cog/src/vm/cogit.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/stacksrc/vm/gcc3x-interp.c branches/Cog/stacksrc/vm/interp.c
Property Changed: ---------------- branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
Modified: branches/Cog/nscogsrc/vm/cogit.c =================================================================== --- branches/Cog/nscogsrc/vm/cogit.c 2015-02-02 02:24:35 UTC (rev 3245) +++ branches/Cog/nscogsrc/vm/cogit.c 2015-02-04 23:48:12 UTC (rev 3246) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.1025 uuid: 1a29f456-a8e2-4312-a391-8e2cdb0430ee + CCodeGenerator VMMaker.oscog-eem.1039 uuid: 931d69b1-7be3-42dd-8833-1ba325d2b5f2 from - StackToRegisterMappingCogit VMMaker.oscog-eem.1025 uuid: 1a29f456-a8e2-4312-a391-8e2cdb0430ee + StackToRegisterMappingCogit VMMaker.oscog-eem.1039 uuid: 931d69b1-7be3-42dd-8833-1ba325d2b5f2 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1025 uuid: 1a29f456-a8e2-4312-a391-8e2cdb0430ee " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1039 uuid: 931d69b1-7be3-42dd-8833-1ba325d2b5f2 " __DATE__ ; char *__cogitBuildInfo = __buildInfo;
Modified: branches/Cog/nscogsrc/vm/cogit.h =================================================================== --- branches/Cog/nscogsrc/vm/cogit.h 2015-02-02 02:24:35 UTC (rev 3245) +++ branches/Cog/nscogsrc/vm/cogit.h 2015-02-04 23:48:12 UTC (rev 3246) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.1025 uuid: 1a29f456-a8e2-4312-a391-8e2cdb0430ee + CCodeGenerator VMMaker.oscog-eem.1039 uuid: 931d69b1-7be3-42dd-8833-1ba325d2b5f2 */
Modified: branches/Cog/nscogsrc/vm/cointerp.c =================================================================== --- branches/Cog/nscogsrc/vm/cointerp.c 2015-02-02 02:24:35 UTC (rev 3245) +++ branches/Cog/nscogsrc/vm/cointerp.c 2015-02-04 23:48:12 UTC (rev 3246) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1035 uuid: 33a34378-0618-40c7-8fbb-c467fb40fc57 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1040 uuid: be108ef5-00a3-425b-b228-16515cc447c7 from - CoInterpreter VMMaker.oscog-eem.1035 uuid: 33a34378-0618-40c7-8fbb-c467fb40fc57 + CoInterpreter VMMaker.oscog-eem.1040 uuid: be108ef5-00a3-425b-b228-16515cc447c7 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1035 uuid: 33a34378-0618-40c7-8fbb-c467fb40fc57 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1040 uuid: be108ef5-00a3-425b-b228-16515cc447c7 " __DATE__ ; char *__interpBuildInfo = __buildInfo;
@@ -1174,7 +1174,6 @@ EXPORT(void) primitiveEventProcessingControl(void); sqInt primitiveIndexOfMethodheader(sqInt theMethod, sqInt methodHeader); sqInt primitiveIndexOf(sqInt methodPointer); -static sqInt primitiveObjectperformwithArgumentslookedUpIn(sqInt actualReceiver, sqInt selector, sqInt argumentArray, sqInt lookupClass) NoDbgRegParms; static void printActivationNameForSelectorstartClass(sqInt aSelector, sqInt startClass) NoDbgRegParms; static void printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObject, sqInt isBlock, sqInt maybeMessage) NoDbgRegParms; void printAllStacks(void); @@ -2098,7 +2097,7 @@ /* 575 */ (void (*)(void))0, 0 }; char expensiveAsserts = 0; -const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1035"; +const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1040"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace;
@@ -30675,10 +30674,26 @@ static void primitivePerformInSuperclass(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt argumentArray; + sqInt arraySize; sqInt ccIndex; + sqInt ccIndex1; + sqInt ccIndex2; sqInt currentClass; + sqInt delta; + sqInt header; + sqInt index; sqInt lookupClass; + sqInt offset; + sqInt performArgCount; sqInt rcvr; + sqInt selector; + sqInt selector1; + char *sp; + char *sp1; + char *sp2; + sqInt sz; + sqInt top;
lookupClass = longAt(GIV(stackPointer)); rcvr = longAt(GIV(stackPointer) + (3 * BytesPerWord)); @@ -30695,24 +30710,206 @@ return; } } - primitiveObjectperformwithArgumentslookedUpIn(rcvr, longAt(GIV(stackPointer) + (2 * BytesPerWord)), longAt(GIV(stackPointer) + (1 * BytesPerWord)), lookupClass); + /* begin primitiveObject:perform:withArguments:lookedUpIn: */ + selector = longAt(GIV(stackPointer) + (2 * BytesPerWord)); + argumentArray = longAt(GIV(stackPointer) + (1 * BytesPerWord)); + if (!(((argumentArray & 1) == 0) + && (((((usqInt) (longAt(argumentArray))) >> (instFormatFieldLSB())) & 15) == 2))) { + GIV(primFailCode) = PrimErrBadArgument; + goto l1; + } + /* begin numSlotsOf: */ + header = longAt(argumentArray); + sz = ((header & TypeMask) == HeaderTypeSizeAndClass + ? (longAt(argumentArray - (BytesPerWord * 2))) & AllButTypeMask + : header & SizeMask); + arraySize = ((usqInt) (sz - BaseHeaderSize)) >> (shiftForWord()); + if (arraySize > LargeContextSlots) { + GIV(primFailCode) = PrimErrBadNumArgs; + goto l1; + } + + /* Push newMethod to save it in case of failure, + then push the actual receiver and args out of the array. */ + + performArgCount = GIV(argumentCount); + /* begin push: */ + longAtput((sp1 = GIV(stackPointer) - BytesPerWord), GIV(newMethod)); + GIV(stackPointer) = sp1; + /* begin push: */ + longAtput((sp2 = GIV(stackPointer) - BytesPerWord), rcvr); + GIV(stackPointer) = sp2; + for (index = 1; index <= arraySize; index += 1) { + /* begin push: */ + longAtput((sp = GIV(stackPointer) - BytesPerWord), longAt((argumentArray + BaseHeaderSize) + ((index - 1) << (shiftForWord())))); + GIV(stackPointer) = sp; + } + GIV(argumentCount) = arraySize; + GIV(messageSelector) = selector; + /* begin sendBreakpoint:receiver: */ + selector1 = GIV(messageSelector); + sendBreakpointreceiver(firstFixedFieldOfMaybeImmediate(selector1), lengthOfMaybeImmediate(selector1), rcvr); + if (printOnTrace()) { + printActivationNameForSelectorstartClass(GIV(messageSelector), (lookupClass == null + ? ((rcvr & 1) + ? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << (shiftForWord()))) + : (((ccIndex2 = (((usqInt) (longAt(rcvr))) >> (compactClassFieldLSB())) & 0x1F)) == 0 + ? (longAt(rcvr - BaseHeaderSize)) & AllButTypeMask + : (/* begin fetchPointer:ofObject: */ + longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex2 - 1) << (shiftForWord())))))) + : lookupClass)); + /* begin cr */ + printf("\n"); + } + findNewMethodInClassTag((lookupClass == null + ? ((rcvr & 1) + ? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << (shiftForWord()))) + : (((ccIndex1 = (((usqInt) (longAt(rcvr))) >> (compactClassFieldLSB())) & 0x1F)) == 0 + ? (longAt(rcvr - BaseHeaderSize)) & AllButTypeMask + : (/* begin fetchPointer:ofObject: */ + longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex1 - 1) << (shiftForWord())))))) + : lookupClass)); + if ((((GIV(newMethod) & 1) == 0) + && (((((usqInt) (longAt(GIV(newMethod)))) >> (instFormatFieldLSB())) & 15) >= 12)) + && ((argumentCountOf(GIV(newMethod))) != GIV(argumentCount))) { + + /* Restore the state by popping all those array entries and pushing back the selector and array, and fail */ + + /* begin pop: */ + GIV(stackPointer) += (arraySize + 1) * BytesPerWord; + null; + /* begin popStack */ + top = longAt(GIV(stackPointer)); + GIV(stackPointer) += BytesPerWord; + GIV(newMethod) = ((sqInt) top); + GIV(primFailCode) = PrimErrBadNumArgs; + goto l1; + } + + /* +2 = receiver + saved newMethod */ + + delta = BytesPerWord * (performArgCount + 2); + for (offset = (GIV(argumentCount) * BytesPerWord); offset >= 0; offset += (-BytesPerWord)) { + longAtput((GIV(stackPointer) + offset) + delta, longAt(GIV(stackPointer) + offset)); + } + /* begin pop: */ + GIV(stackPointer) += (performArgCount + 2) * BytesPerWord; + null; + executeNewMethod(); + /* begin initPrimCall */ + GIV(primFailCode) = 0; + null; +l1: /* end primitiveObject:perform:withArguments:lookedUpIn: */; }
static void primitivePerformWithArgs(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt actualReceiver; + sqInt argumentArray; + sqInt arraySize; sqInt ccIndex; - sqInt lookupClass; - sqInt rcvr; + sqInt ccIndex1; + sqInt delta; + sqInt header; + sqInt index; + sqInt offset; + sqInt performArgCount; + sqInt selector; + sqInt selector1; + char *sp; + char *sp1; + char *sp2; + sqInt sz; + sqInt top;
- rcvr = longAt(GIV(stackPointer) + (2 * BytesPerWord)); - lookupClass = ((rcvr & 1) + /* begin primitiveObject:perform:withArguments:lookedUpIn: */ + actualReceiver = longAt(GIV(stackPointer) + (2 * BytesPerWord)); + selector = longAt(GIV(stackPointer) + (1 * BytesPerWord)); + argumentArray = longAt(GIV(stackPointer)); + if (!(((argumentArray & 1) == 0) + && (((((usqInt) (longAt(argumentArray))) >> (instFormatFieldLSB())) & 15) == 2))) { + GIV(primFailCode) = PrimErrBadArgument; + goto l1; + } + /* begin numSlotsOf: */ + header = longAt(argumentArray); + sz = ((header & TypeMask) == HeaderTypeSizeAndClass + ? (longAt(argumentArray - (BytesPerWord * 2))) & AllButTypeMask + : header & SizeMask); + arraySize = ((usqInt) (sz - BaseHeaderSize)) >> (shiftForWord()); + if (arraySize > LargeContextSlots) { + GIV(primFailCode) = PrimErrBadNumArgs; + goto l1; + } + + /* Push newMethod to save it in case of failure, + then push the actual receiver and args out of the array. */ + + performArgCount = GIV(argumentCount); + /* begin push: */ + longAtput((sp1 = GIV(stackPointer) - BytesPerWord), GIV(newMethod)); + GIV(stackPointer) = sp1; + /* begin push: */ + longAtput((sp2 = GIV(stackPointer) - BytesPerWord), actualReceiver); + GIV(stackPointer) = sp2; + for (index = 1; index <= arraySize; index += 1) { + /* begin push: */ + longAtput((sp = GIV(stackPointer) - BytesPerWord), longAt((argumentArray + BaseHeaderSize) + ((index - 1) << (shiftForWord())))); + GIV(stackPointer) = sp; + } + GIV(argumentCount) = arraySize; + GIV(messageSelector) = selector; + /* begin sendBreakpoint:receiver: */ + selector1 = GIV(messageSelector); + sendBreakpointreceiver(firstFixedFieldOfMaybeImmediate(selector1), lengthOfMaybeImmediate(selector1), actualReceiver); + if (printOnTrace()) { + printActivationNameForSelectorstartClass(GIV(messageSelector), ((actualReceiver & 1) + ? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << (shiftForWord()))) + : (((ccIndex = (((usqInt) (longAt(actualReceiver))) >> (compactClassFieldLSB())) & 0x1F)) == 0 + ? (longAt(actualReceiver - BaseHeaderSize)) & AllButTypeMask + : (/* begin fetchPointer:ofObject: */ + longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex - 1) << (shiftForWord()))))))); + /* begin cr */ + printf("\n"); + } + findNewMethodInClassTag(((actualReceiver & 1) ? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << (shiftForWord()))) - : (((ccIndex = (((usqInt) (longAt(rcvr))) >> (compactClassFieldLSB())) & 0x1F)) == 0 - ? (longAt(rcvr - BaseHeaderSize)) & AllButTypeMask + : (((ccIndex1 = (((usqInt) (longAt(actualReceiver))) >> (compactClassFieldLSB())) & 0x1F)) == 0 + ? (longAt(actualReceiver - BaseHeaderSize)) & AllButTypeMask : (/* begin fetchPointer:ofObject: */ - longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex - 1) << (shiftForWord())))))); - primitiveObjectperformwithArgumentslookedUpIn(rcvr, longAt(GIV(stackPointer) + (1 * BytesPerWord)), longAt(GIV(stackPointer)), lookupClass); + longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex1 - 1) << (shiftForWord()))))))); + if ((((GIV(newMethod) & 1) == 0) + && (((((usqInt) (longAt(GIV(newMethod)))) >> (instFormatFieldLSB())) & 15) >= 12)) + && ((argumentCountOf(GIV(newMethod))) != GIV(argumentCount))) { + + /* Restore the state by popping all those array entries and pushing back the selector and array, and fail */ + + /* begin pop: */ + GIV(stackPointer) += (arraySize + 1) * BytesPerWord; + null; + /* begin popStack */ + top = longAt(GIV(stackPointer)); + GIV(stackPointer) += BytesPerWord; + GIV(newMethod) = ((sqInt) top); + GIV(primFailCode) = PrimErrBadNumArgs; + goto l1; + } + + /* +2 = receiver + saved newMethod */ + + delta = BytesPerWord * (performArgCount + 2); + for (offset = (GIV(argumentCount) * BytesPerWord); offset >= 0; offset += (-BytesPerWord)) { + longAtput((GIV(stackPointer) + offset) + delta, longAt(GIV(stackPointer) + offset)); + } + /* begin pop: */ + GIV(stackPointer) += (performArgCount + 2) * BytesPerWord; + null; + executeNewMethod(); + /* begin initPrimCall */ + GIV(primFailCode) = 0; + null; +l1: /* end primitiveObject:perform:withArguments:lookedUpIn: */; }
@@ -47223,7 +47420,7 @@ } } else { - if (startIP > 64) { + if (startIP > lastIndex) { print("..."); /* begin cr */ printf("\n"); @@ -48679,109 +48876,6 @@ (primBits & 0x1FF) + ((((usqInt) primBits) >> 19) & 512))); }
- -/* Common routine used by perform:withArgs:, perform:withArgs:inSuperclass:, - object:perform:withArgs:inClass: et al. Answer nil on success. - - NOTE: The case of doesNotUnderstand: is not a failure to perform. - The only failures are arg types and consistency of argumentCount. - - Since we're in the stack VM we can assume there is space to push the - arguments provided they are within limits (max argument count is 15). We - can therefore deal - with the arbitrary amount of state to remove from the stack (lookup class, - selector, mirror receiver) and arbitrary argument orders by deferring - popping anything until - we know whether the send has succeeded. So on failure we merely have to - remove the actual receiver and arguments pushed, and on success we have to - slide the actual - receiver and arguments down to replace the original ones. */ - -static sqInt -primitiveObjectperformwithArgumentslookedUpIn(sqInt actualReceiver, sqInt selector, sqInt argumentArray, sqInt lookupClass) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt arraySize; - sqInt delta; - sqInt header; - sqInt index; - sqInt offset; - sqInt performArgCount; - char *sp; - char *sp1; - char *sp2; - sqInt sz; - sqInt top; - - if (!(((argumentArray & 1) == 0) - && (((((usqInt) (longAt(argumentArray))) >> (instFormatFieldLSB())) & 15) == 2))) { - return (GIV(primFailCode) = PrimErrBadArgument); - } - /* begin numSlotsOf: */ - header = longAt(argumentArray); - sz = ((header & TypeMask) == HeaderTypeSizeAndClass - ? (longAt(argumentArray - (BytesPerWord * 2))) & AllButTypeMask - : header & SizeMask); - arraySize = ((usqInt) (sz - BaseHeaderSize)) >> (shiftForWord()); - if (arraySize > LargeContextSlots) { - return (GIV(primFailCode) = PrimErrBadNumArgs); - } - - /* Push newMethod to save it in case of failure, - then push the actual receiver and args out of the array. */ - - performArgCount = GIV(argumentCount); - /* begin push: */ - longAtput((sp1 = GIV(stackPointer) - BytesPerWord), GIV(newMethod)); - GIV(stackPointer) = sp1; - /* begin push: */ - longAtput((sp2 = GIV(stackPointer) - BytesPerWord), actualReceiver); - GIV(stackPointer) = sp2; - for (index = 1; index <= arraySize; index += 1) { - /* begin push: */ - longAtput((sp = GIV(stackPointer) - BytesPerWord), longAt((argumentArray + BaseHeaderSize) + ((index - 1) << (shiftForWord())))); - GIV(stackPointer) = sp; - } - GIV(argumentCount) = arraySize; - GIV(messageSelector) = selector; - /* begin sendBreakpoint:receiver: */ - sendBreakpointreceiver(firstFixedFieldOfMaybeImmediate(GIV(messageSelector)), lengthOfMaybeImmediate(GIV(messageSelector)), actualReceiver); - if (printOnTrace()) { - printActivationNameForSelectorstartClass(GIV(messageSelector), lookupClass); - /* begin cr */ - printf("\n"); - } - findNewMethodInClassTag(lookupClass); - if ((((GIV(newMethod) & 1) == 0) - && (((((usqInt) (longAt(GIV(newMethod)))) >> (instFormatFieldLSB())) & 15) >= 12)) - && ((argumentCountOf(GIV(newMethod))) != GIV(argumentCount))) { - - /* Restore the state by popping all those array entries and pushing back the selector and array, and fail */ - - /* begin pop: */ - GIV(stackPointer) += (arraySize + 1) * BytesPerWord; - null; - /* begin popStack */ - top = longAt(GIV(stackPointer)); - GIV(stackPointer) += BytesPerWord; - GIV(newMethod) = ((sqInt) top); - return (GIV(primFailCode) = PrimErrBadNumArgs); - } - - /* +2 = receiver + saved newMethod */ - - delta = BytesPerWord * (performArgCount + 2); - for (offset = (GIV(argumentCount) * BytesPerWord); offset >= 0; offset += (-BytesPerWord)) { - longAtput((GIV(stackPointer) + offset) + delta, longAt(GIV(stackPointer) + offset)); - } - /* begin pop: */ - GIV(stackPointer) += (performArgCount + 2) * BytesPerWord; - null; - executeNewMethod(); - /* begin initPrimCall */ - GIV(primFailCode) = 0; - return null; -} - static void printActivationNameForSelectorstartClass(sqInt aSelector, sqInt startClass) { DECL_MAYBE_SQ_GLOBAL_STRUCT
Modified: branches/Cog/nscogsrc/vm/cointerp.h =================================================================== --- branches/Cog/nscogsrc/vm/cointerp.h 2015-02-02 02:24:35 UTC (rev 3245) +++ branches/Cog/nscogsrc/vm/cointerp.h 2015-02-04 23:48:12 UTC (rev 3246) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1035 uuid: 33a34378-0618-40c7-8fbb-c467fb40fc57 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1040 uuid: be108ef5-00a3-425b-b228-16515cc447c7 */
Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c =================================================================== --- branches/Cog/nscogsrc/vm/gcc3x-cointerp.c 2015-02-02 02:24:35 UTC (rev 3245) +++ branches/Cog/nscogsrc/vm/gcc3x-cointerp.c 2015-02-04 23:48:12 UTC (rev 3246) @@ -2,11 +2,11 @@
/* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1035 uuid: 33a34378-0618-40c7-8fbb-c467fb40fc57 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1040 uuid: be108ef5-00a3-425b-b228-16515cc447c7 from - CoInterpreter VMMaker.oscog-eem.1035 uuid: 33a34378-0618-40c7-8fbb-c467fb40fc57 + CoInterpreter VMMaker.oscog-eem.1040 uuid: be108ef5-00a3-425b-b228-16515cc447c7 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1035 uuid: 33a34378-0618-40c7-8fbb-c467fb40fc57 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1040 uuid: be108ef5-00a3-425b-b228-16515cc447c7 " __DATE__ ; char *__interpBuildInfo = __buildInfo;
@@ -1177,7 +1177,6 @@ EXPORT(void) primitiveEventProcessingControl(void); sqInt primitiveIndexOfMethodheader(sqInt theMethod, sqInt methodHeader); sqInt primitiveIndexOf(sqInt methodPointer); -static sqInt primitiveObjectperformwithArgumentslookedUpIn(sqInt actualReceiver, sqInt selector, sqInt argumentArray, sqInt lookupClass) NoDbgRegParms; static void printActivationNameForSelectorstartClass(sqInt aSelector, sqInt startClass) NoDbgRegParms; static void printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObject, sqInt isBlock, sqInt maybeMessage) NoDbgRegParms; void printAllStacks(void); @@ -2101,7 +2100,7 @@ /* 575 */ (void (*)(void))0, 0 }; char expensiveAsserts = 0; -const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1035"; +const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1040"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace;
@@ -30684,10 +30683,26 @@ static void primitivePerformInSuperclass(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt argumentArray; + sqInt arraySize; sqInt ccIndex; + sqInt ccIndex1; + sqInt ccIndex2; sqInt currentClass; + sqInt delta; + sqInt header; + sqInt index; sqInt lookupClass; + sqInt offset; + sqInt performArgCount; sqInt rcvr; + sqInt selector; + sqInt selector1; + char *sp; + char *sp1; + char *sp2; + sqInt sz; + sqInt top;
lookupClass = longAt(GIV(stackPointer)); rcvr = longAt(GIV(stackPointer) + (3 * BytesPerWord)); @@ -30704,24 +30719,206 @@ return; } } - primitiveObjectperformwithArgumentslookedUpIn(rcvr, longAt(GIV(stackPointer) + (2 * BytesPerWord)), longAt(GIV(stackPointer) + (1 * BytesPerWord)), lookupClass); + /* begin primitiveObject:perform:withArguments:lookedUpIn: */ + selector = longAt(GIV(stackPointer) + (2 * BytesPerWord)); + argumentArray = longAt(GIV(stackPointer) + (1 * BytesPerWord)); + if (!(((argumentArray & 1) == 0) + && (((((usqInt) (longAt(argumentArray))) >> (instFormatFieldLSB())) & 15) == 2))) { + GIV(primFailCode) = PrimErrBadArgument; + goto l1; + } + /* begin numSlotsOf: */ + header = longAt(argumentArray); + sz = ((header & TypeMask) == HeaderTypeSizeAndClass + ? (longAt(argumentArray - (BytesPerWord * 2))) & AllButTypeMask + : header & SizeMask); + arraySize = ((usqInt) (sz - BaseHeaderSize)) >> (shiftForWord()); + if (arraySize > LargeContextSlots) { + GIV(primFailCode) = PrimErrBadNumArgs; + goto l1; + } + + /* Push newMethod to save it in case of failure, + then push the actual receiver and args out of the array. */ + + performArgCount = GIV(argumentCount); + /* begin push: */ + longAtput((sp1 = GIV(stackPointer) - BytesPerWord), GIV(newMethod)); + GIV(stackPointer) = sp1; + /* begin push: */ + longAtput((sp2 = GIV(stackPointer) - BytesPerWord), rcvr); + GIV(stackPointer) = sp2; + for (index = 1; index <= arraySize; index += 1) { + /* begin push: */ + longAtput((sp = GIV(stackPointer) - BytesPerWord), longAt((argumentArray + BaseHeaderSize) + ((index - 1) << (shiftForWord())))); + GIV(stackPointer) = sp; + } + GIV(argumentCount) = arraySize; + GIV(messageSelector) = selector; + /* begin sendBreakpoint:receiver: */ + selector1 = GIV(messageSelector); + sendBreakpointreceiver(firstFixedFieldOfMaybeImmediate(selector1), lengthOfMaybeImmediate(selector1), rcvr); + if (printOnTrace()) { + printActivationNameForSelectorstartClass(GIV(messageSelector), (lookupClass == null + ? ((rcvr & 1) + ? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << (shiftForWord()))) + : (((ccIndex2 = (((usqInt) (longAt(rcvr))) >> (compactClassFieldLSB())) & 0x1F)) == 0 + ? (longAt(rcvr - BaseHeaderSize)) & AllButTypeMask + : (/* begin fetchPointer:ofObject: */ + longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex2 - 1) << (shiftForWord())))))) + : lookupClass)); + /* begin cr */ + printf("\n"); + } + findNewMethodInClassTag((lookupClass == null + ? ((rcvr & 1) + ? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << (shiftForWord()))) + : (((ccIndex1 = (((usqInt) (longAt(rcvr))) >> (compactClassFieldLSB())) & 0x1F)) == 0 + ? (longAt(rcvr - BaseHeaderSize)) & AllButTypeMask + : (/* begin fetchPointer:ofObject: */ + longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex1 - 1) << (shiftForWord())))))) + : lookupClass)); + if ((((GIV(newMethod) & 1) == 0) + && (((((usqInt) (longAt(GIV(newMethod)))) >> (instFormatFieldLSB())) & 15) >= 12)) + && ((argumentCountOf(GIV(newMethod))) != GIV(argumentCount))) { + + /* Restore the state by popping all those array entries and pushing back the selector and array, and fail */ + + /* begin pop: */ + GIV(stackPointer) += (arraySize + 1) * BytesPerWord; + null; + /* begin popStack */ + top = longAt(GIV(stackPointer)); + GIV(stackPointer) += BytesPerWord; + GIV(newMethod) = ((sqInt) top); + GIV(primFailCode) = PrimErrBadNumArgs; + goto l1; + } + + /* +2 = receiver + saved newMethod */ + + delta = BytesPerWord * (performArgCount + 2); + for (offset = (GIV(argumentCount) * BytesPerWord); offset >= 0; offset += (-BytesPerWord)) { + longAtput((GIV(stackPointer) + offset) + delta, longAt(GIV(stackPointer) + offset)); + } + /* begin pop: */ + GIV(stackPointer) += (performArgCount + 2) * BytesPerWord; + null; + executeNewMethod(); + /* begin initPrimCall */ + GIV(primFailCode) = 0; + null; +l1: /* end primitiveObject:perform:withArguments:lookedUpIn: */; }
static void primitivePerformWithArgs(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt actualReceiver; + sqInt argumentArray; + sqInt arraySize; sqInt ccIndex; - sqInt lookupClass; - sqInt rcvr; + sqInt ccIndex1; + sqInt delta; + sqInt header; + sqInt index; + sqInt offset; + sqInt performArgCount; + sqInt selector; + sqInt selector1; + char *sp; + char *sp1; + char *sp2; + sqInt sz; + sqInt top;
- rcvr = longAt(GIV(stackPointer) + (2 * BytesPerWord)); - lookupClass = ((rcvr & 1) + /* begin primitiveObject:perform:withArguments:lookedUpIn: */ + actualReceiver = longAt(GIV(stackPointer) + (2 * BytesPerWord)); + selector = longAt(GIV(stackPointer) + (1 * BytesPerWord)); + argumentArray = longAt(GIV(stackPointer)); + if (!(((argumentArray & 1) == 0) + && (((((usqInt) (longAt(argumentArray))) >> (instFormatFieldLSB())) & 15) == 2))) { + GIV(primFailCode) = PrimErrBadArgument; + goto l1; + } + /* begin numSlotsOf: */ + header = longAt(argumentArray); + sz = ((header & TypeMask) == HeaderTypeSizeAndClass + ? (longAt(argumentArray - (BytesPerWord * 2))) & AllButTypeMask + : header & SizeMask); + arraySize = ((usqInt) (sz - BaseHeaderSize)) >> (shiftForWord()); + if (arraySize > LargeContextSlots) { + GIV(primFailCode) = PrimErrBadNumArgs; + goto l1; + } + + /* Push newMethod to save it in case of failure, + then push the actual receiver and args out of the array. */ + + performArgCount = GIV(argumentCount); + /* begin push: */ + longAtput((sp1 = GIV(stackPointer) - BytesPerWord), GIV(newMethod)); + GIV(stackPointer) = sp1; + /* begin push: */ + longAtput((sp2 = GIV(stackPointer) - BytesPerWord), actualReceiver); + GIV(stackPointer) = sp2; + for (index = 1; index <= arraySize; index += 1) { + /* begin push: */ + longAtput((sp = GIV(stackPointer) - BytesPerWord), longAt((argumentArray + BaseHeaderSize) + ((index - 1) << (shiftForWord())))); + GIV(stackPointer) = sp; + } + GIV(argumentCount) = arraySize; + GIV(messageSelector) = selector; + /* begin sendBreakpoint:receiver: */ + selector1 = GIV(messageSelector); + sendBreakpointreceiver(firstFixedFieldOfMaybeImmediate(selector1), lengthOfMaybeImmediate(selector1), actualReceiver); + if (printOnTrace()) { + printActivationNameForSelectorstartClass(GIV(messageSelector), ((actualReceiver & 1) + ? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << (shiftForWord()))) + : (((ccIndex = (((usqInt) (longAt(actualReceiver))) >> (compactClassFieldLSB())) & 0x1F)) == 0 + ? (longAt(actualReceiver - BaseHeaderSize)) & AllButTypeMask + : (/* begin fetchPointer:ofObject: */ + longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex - 1) << (shiftForWord()))))))); + /* begin cr */ + printf("\n"); + } + findNewMethodInClassTag(((actualReceiver & 1) ? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << (shiftForWord()))) - : (((ccIndex = (((usqInt) (longAt(rcvr))) >> (compactClassFieldLSB())) & 0x1F)) == 0 - ? (longAt(rcvr - BaseHeaderSize)) & AllButTypeMask + : (((ccIndex1 = (((usqInt) (longAt(actualReceiver))) >> (compactClassFieldLSB())) & 0x1F)) == 0 + ? (longAt(actualReceiver - BaseHeaderSize)) & AllButTypeMask : (/* begin fetchPointer:ofObject: */ - longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex - 1) << (shiftForWord())))))); - primitiveObjectperformwithArgumentslookedUpIn(rcvr, longAt(GIV(stackPointer) + (1 * BytesPerWord)), longAt(GIV(stackPointer)), lookupClass); + longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex1 - 1) << (shiftForWord()))))))); + if ((((GIV(newMethod) & 1) == 0) + && (((((usqInt) (longAt(GIV(newMethod)))) >> (instFormatFieldLSB())) & 15) >= 12)) + && ((argumentCountOf(GIV(newMethod))) != GIV(argumentCount))) { + + /* Restore the state by popping all those array entries and pushing back the selector and array, and fail */ + + /* begin pop: */ + GIV(stackPointer) += (arraySize + 1) * BytesPerWord; + null; + /* begin popStack */ + top = longAt(GIV(stackPointer)); + GIV(stackPointer) += BytesPerWord; + GIV(newMethod) = ((sqInt) top); + GIV(primFailCode) = PrimErrBadNumArgs; + goto l1; + } + + /* +2 = receiver + saved newMethod */ + + delta = BytesPerWord * (performArgCount + 2); + for (offset = (GIV(argumentCount) * BytesPerWord); offset >= 0; offset += (-BytesPerWord)) { + longAtput((GIV(stackPointer) + offset) + delta, longAt(GIV(stackPointer) + offset)); + } + /* begin pop: */ + GIV(stackPointer) += (performArgCount + 2) * BytesPerWord; + null; + executeNewMethod(); + /* begin initPrimCall */ + GIV(primFailCode) = 0; + null; +l1: /* end primitiveObject:perform:withArguments:lookedUpIn: */; }
@@ -47232,7 +47429,7 @@ } } else { - if (startIP > 64) { + if (startIP > lastIndex) { print("..."); /* begin cr */ printf("\n"); @@ -48688,109 +48885,6 @@ (primBits & 0x1FF) + ((((usqInt) primBits) >> 19) & 512))); }
- -/* Common routine used by perform:withArgs:, perform:withArgs:inSuperclass:, - object:perform:withArgs:inClass: et al. Answer nil on success. - - NOTE: The case of doesNotUnderstand: is not a failure to perform. - The only failures are arg types and consistency of argumentCount. - - Since we're in the stack VM we can assume there is space to push the - arguments provided they are within limits (max argument count is 15). We - can therefore deal - with the arbitrary amount of state to remove from the stack (lookup class, - selector, mirror receiver) and arbitrary argument orders by deferring - popping anything until - we know whether the send has succeeded. So on failure we merely have to - remove the actual receiver and arguments pushed, and on success we have to - slide the actual - receiver and arguments down to replace the original ones. */ - -static sqInt -primitiveObjectperformwithArgumentslookedUpIn(sqInt actualReceiver, sqInt selector, sqInt argumentArray, sqInt lookupClass) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt arraySize; - sqInt delta; - sqInt header; - sqInt index; - sqInt offset; - sqInt performArgCount; - char *sp; - char *sp1; - char *sp2; - sqInt sz; - sqInt top; - - if (!(((argumentArray & 1) == 0) - && (((((usqInt) (longAt(argumentArray))) >> (instFormatFieldLSB())) & 15) == 2))) { - return (GIV(primFailCode) = PrimErrBadArgument); - } - /* begin numSlotsOf: */ - header = longAt(argumentArray); - sz = ((header & TypeMask) == HeaderTypeSizeAndClass - ? (longAt(argumentArray - (BytesPerWord * 2))) & AllButTypeMask - : header & SizeMask); - arraySize = ((usqInt) (sz - BaseHeaderSize)) >> (shiftForWord()); - if (arraySize > LargeContextSlots) { - return (GIV(primFailCode) = PrimErrBadNumArgs); - } - - /* Push newMethod to save it in case of failure, - then push the actual receiver and args out of the array. */ - - performArgCount = GIV(argumentCount); - /* begin push: */ - longAtput((sp1 = GIV(stackPointer) - BytesPerWord), GIV(newMethod)); - GIV(stackPointer) = sp1; - /* begin push: */ - longAtput((sp2 = GIV(stackPointer) - BytesPerWord), actualReceiver); - GIV(stackPointer) = sp2; - for (index = 1; index <= arraySize; index += 1) { - /* begin push: */ - longAtput((sp = GIV(stackPointer) - BytesPerWord), longAt((argumentArray + BaseHeaderSize) + ((index - 1) << (shiftForWord())))); - GIV(stackPointer) = sp; - } - GIV(argumentCount) = arraySize; - GIV(messageSelector) = selector; - /* begin sendBreakpoint:receiver: */ - sendBreakpointreceiver(firstFixedFieldOfMaybeImmediate(GIV(messageSelector)), lengthOfMaybeImmediate(GIV(messageSelector)), actualReceiver); - if (printOnTrace()) { - printActivationNameForSelectorstartClass(GIV(messageSelector), lookupClass); - /* begin cr */ - printf("\n"); - } - findNewMethodInClassTag(lookupClass); - if ((((GIV(newMethod) & 1) == 0) - && (((((usqInt) (longAt(GIV(newMethod)))) >> (instFormatFieldLSB())) & 15) >= 12)) - && ((argumentCountOf(GIV(newMethod))) != GIV(argumentCount))) { - - /* Restore the state by popping all those array entries and pushing back the selector and array, and fail */ - - /* begin pop: */ - GIV(stackPointer) += (arraySize + 1) * BytesPerWord; - null; - /* begin popStack */ - top = longAt(GIV(stackPointer)); - GIV(stackPointer) += BytesPerWord; - GIV(newMethod) = ((sqInt) top); - return (GIV(primFailCode) = PrimErrBadNumArgs); - } - - /* +2 = receiver + saved newMethod */ - - delta = BytesPerWord * (performArgCount + 2); - for (offset = (GIV(argumentCount) * BytesPerWord); offset >= 0; offset += (-BytesPerWord)) { - longAtput((GIV(stackPointer) + offset) + delta, longAt(GIV(stackPointer) + offset)); - } - /* begin pop: */ - GIV(stackPointer) += (performArgCount + 2) * BytesPerWord; - null; - executeNewMethod(); - /* begin initPrimCall */ - GIV(primFailCode) = 0; - return null; -} - static void printActivationNameForSelectorstartClass(sqInt aSelector, sqInt startClass) { DECL_MAYBE_SQ_GLOBAL_STRUCT
Modified: branches/Cog/nsspursrc/vm/cogit.c =================================================================== --- branches/Cog/nsspursrc/vm/cogit.c 2015-02-02 02:24:35 UTC (rev 3245) +++ branches/Cog/nsspursrc/vm/cogit.c 2015-02-04 23:48:12 UTC (rev 3246) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.1025 uuid: 1a29f456-a8e2-4312-a391-8e2cdb0430ee + CCodeGenerator VMMaker.oscog-eem.1039 uuid: 931d69b1-7be3-42dd-8833-1ba325d2b5f2 from - StackToRegisterMappingCogit VMMaker.oscog-eem.1025 uuid: 1a29f456-a8e2-4312-a391-8e2cdb0430ee + StackToRegisterMappingCogit VMMaker.oscog-eem.1039 uuid: 931d69b1-7be3-42dd-8833-1ba325d2b5f2 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1025 uuid: 1a29f456-a8e2-4312-a391-8e2cdb0430ee " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1039 uuid: 931d69b1-7be3-42dd-8833-1ba325d2b5f2 " __DATE__ ; char *__cogitBuildInfo = __buildInfo;
@@ -296,7 +296,7 @@ #define NewspeakVM 1 #define Nop 8 #define NotFullyInitialized -1 -#define NSSendIsPCAnnotated 1 +#define NSSendIsPCAnnotated 0 #define NumObjRefsInRuntime 0 #define NumOopsPerIRC 2 #define NumSendTrampolines 4 @@ -929,7 +929,6 @@ static sqInt frameOffsetOfTemporary(sqInt index) NoDbgRegParms; static sqInt genBlockReturn(void); static AbstractInstruction * genDoubleFailIfZeroArgRcvrarg(sqInt rcvrReg, sqInt argReg) NoDbgRegParms; -static sqInt genDynamicSuperSendBytecode(void); static sqInt genExtendedSendBytecode(void); static sqInt genExtendedSuperBytecode(void); static sqInt genExtJumpIfFalse(void); @@ -1094,7 +1093,6 @@ static sqInt genPushActiveContextBytecode(void); static sqInt genPushClosureCopyCopiedValuesBytecode(void); static sqInt genPushEnclosingObjectAt(sqInt level) NoDbgRegParms; -static sqInt genPushImplicitReceiverBytecode(void); static sqInt genPushLiteralVariable(sqInt literalIndex) NoDbgRegParms; static sqInt genPushLiteral(sqInt literal) NoDbgRegParms; static sqInt genPushMaybeContextReceiverVariable(sqInt slotIndex) NoDbgRegParms; @@ -1110,7 +1108,6 @@ static sqInt genSendAbsentImplicitnumArgs(sqInt selector, sqInt numArgs) NoDbgRegParms; static sqInt genSendAbsentOuternumArgsdepth(sqInt selector, sqInt numArgs, sqInt depth) NoDbgRegParms; static sqInt genSendAbsentSelfnumArgs(sqInt selector, sqInt numArgs) NoDbgRegParms; -static sqInt genSendDynamicSupernumArgs(sqInt selector, sqInt numArgs) NoDbgRegParms; static sqInt genSendSupernumArgs(sqInt selector, sqInt numArgs) NoDbgRegParms; static sqInt genSendTrampolineFornumArgscalledargargarg(void *aRoutine, sqInt numArgs, char *aString, sqInt regOrConst0, sqInt regOrConst1, sqInt regOrConst2) NoDbgRegParms; static sqInt genSendTrampolineFornumArgscalledargargargarg(void *aRoutine, sqInt numArgs, char *aString, sqInt regOrConst0, sqInt regOrConst1, sqInt regOrConst2, sqInt regOrConst3) NoDbgRegParms; @@ -1170,8 +1167,8 @@ static CogSimStackEntry ssTopDescriptor(void); static CogSimStackEntry * ssValue(sqInt n) NoDbgRegParms; static sqInt tryCollapseTempVectorInitializationOfSize(sqInt slots) NoDbgRegParms; -static sqInt v3or4PushNilSize(sqInt aMethodObj) NoDbgRegParms; -static sqInt v3or4NumPushNils(BytecodeDescriptor *descriptor, sqInt pc, sqInt nExts, sqInt aMethodObj) NoDbgRegParms; +static sqInt v3PushNilSize(sqInt aMethodObj) NoDbgRegParms; +static sqInt v3NumPushNils(BytecodeDescriptor *descriptor, sqInt pc, sqInt nExts, sqInt aMethodObj) NoDbgRegParms; static sqInt oopisGreaterThanOrEqualTo(sqInt anOop, sqInt otherOop) NoDbgRegParms; static sqInt oopisGreaterThan(sqInt anOop, sqInt otherOop) NoDbgRegParms; static sqInt oopisLessThan(sqInt anOop, sqInt otherOop) NoDbgRegParms; @@ -1397,8 +1394,8 @@ { genReturnNil, 0, needsFrameIfInBlock, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0 }, { genReturnTopFromMethod, 0, needsFrameIfInBlock, -1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0 }, { genReturnTopFromBlock, 0, needsFrameNever, -1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0 }, - { genDynamicSuperSendBytecode, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1, 0, 0, 0 }, - { genPushImplicitReceiverBytecode, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1, 0, 0, 1 }, + { unknownBytecode, 0, 0, 0, Nop, 1, 0, 0, 0, 0, 0, 0, 1, 0 }, + { unknownBytecode, 0, 0, 0, Nop, 1, 0, 0, 0, 0, 0, 0, 1, 0 }, { extendedPushBytecode, 0, needsFrameNever, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0 }, { extendedStoreBytecode, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0 }, { extendedStoreAndPopBytecode, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0 }, @@ -18977,13 +18974,7 @@ return gJumpFPEqual(0); }
-static sqInt -genDynamicSuperSendBytecode(void) -{ - return genSendDynamicSupernumArgs(getLiteral(byte2), byte1); -}
- /* Can use any of the first 32 literals for the selector and pass up to 7 arguments. */ @@ -20466,7 +20457,7 @@ sqInt initialIndexOfIRC; sqInt initialOpcodeIndex; sqInt initialStackPtr; - sqInt (* const pushNilSizeFunction)(sqInt) = v3or4PushNilSize; + sqInt (* const pushNilSizeFunction)(sqInt) = v3PushNilSize; sqInt result; sqInt savedNeedsFrame; sqInt savedNumArgs; @@ -22558,18 +22549,6 @@ }
static sqInt -genPushImplicitReceiverBytecode(void) -{ - sqInt result; - - result = genGetImplicitReceiverForforPush(getLiteral(byte1), 1); - if (result != 0) { - return result; - } - return ssPushRegister(ReceiverResultReg); -} - -static sqInt genPushLiteralVariable(sqInt literalIndex) { sqInt association; @@ -22821,13 +22800,6 @@ }
static sqInt -genSendDynamicSupernumArgs(sqInt selector, sqInt numArgs) -{ - marshallSendArguments(numArgs); - return genMarshalledSendDynamicSupernumArgs(selector, numArgs); -} - -static sqInt genSendSupernumArgs(sqInt selector, sqInt numArgs) { marshallSendArguments(numArgs); @@ -24128,7 +24100,7 @@ sqInt framelessStackDelta; sqInt nExts; sqInt numPushNils; - sqInt (* const numPushNilsFunction)(struct _BytecodeDescriptor *,sqInt,sqInt,sqInt) = v3or4NumPushNils; + sqInt (* const numPushNilsFunction)(struct _BytecodeDescriptor *,sqInt,sqInt,sqInt) = v3NumPushNils; sqInt pc; sqInt pushingNils;
@@ -24690,27 +24662,15 @@ }
static sqInt -v3or4PushNilSize(sqInt aMethodObj) +v3PushNilSize(sqInt aMethodObj) { - return (methodUsesAlternateBytecodeSet(aMethodObj) - ? 3 - : 1); + return 1; }
static sqInt -v3or4NumPushNils(BytecodeDescriptor *descriptor, sqInt pc, sqInt nExts, sqInt aMethodObj) +v3NumPushNils(BytecodeDescriptor *descriptor, sqInt pc, sqInt nExts, sqInt aMethodObj) { - sqInt numNils; - - if (((numNils = (((descriptor->generator)) == genPushConstantNilBytecode - ? 1 - : 0))) > 0) { - return numNils; - } - return ((((descriptor->generator)) == genExtPushPseudoVariableOrOuterBytecode) - && ((assert((fetchByteofObject(pc, aMethodObj)) == 77), - (nExts == 1) - && ((fetchByteofObject(pc - 1, aMethodObj)) == 2))) + return (((descriptor->generator)) == genPushConstantNilBytecode ? 1 : 0); }
Modified: branches/Cog/nsspursrc/vm/cogit.h =================================================================== --- branches/Cog/nsspursrc/vm/cogit.h 2015-02-02 02:24:35 UTC (rev 3245) +++ branches/Cog/nsspursrc/vm/cogit.h 2015-02-04 23:48:12 UTC (rev 3246) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.1025 uuid: 1a29f456-a8e2-4312-a391-8e2cdb0430ee + CCodeGenerator VMMaker.oscog-eem.1039 uuid: 931d69b1-7be3-42dd-8833-1ba325d2b5f2 */
Modified: branches/Cog/nsspursrc/vm/cointerp.c =================================================================== --- branches/Cog/nsspursrc/vm/cointerp.c 2015-02-02 02:24:35 UTC (rev 3245) +++ branches/Cog/nsspursrc/vm/cointerp.c 2015-02-04 23:48:12 UTC (rev 3246) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1035 uuid: 33a34378-0618-40c7-8fbb-c467fb40fc57 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1041 uuid: 07a9d555-3a71-4774-a5f2-04a2ee09a74e from - CoInterpreter VMMaker.oscog-eem.1035 uuid: 33a34378-0618-40c7-8fbb-c467fb40fc57 + CoInterpreter VMMaker.oscog-eem.1041 uuid: 07a9d555-3a71-4774-a5f2-04a2ee09a74e */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1035 uuid: 33a34378-0618-40c7-8fbb-c467fb40fc57 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1041 uuid: 07a9d555-3a71-4774-a5f2-04a2ee09a74e " __DATE__ ; char *__interpBuildInfo = __buildInfo;
@@ -949,7 +949,7 @@ static void expungeFromClassTable(sqInt aBehavior) NoDbgRegParms; sqInt falseObject(void); sqInt fetchByteofObject(sqInt byteIndex, sqInt objOop); -static sqInt fetchClassOfNonImm(sqInt objOop) NoDbgRegParms; +static sqInt fetchClassOfNonImm(sqInt objOop) NoDbgRegParms NeverInline; sqInt fetchClassOf(sqInt oop); static sqInt fetchClassTagOfNonImm(sqInt obj) NoDbgRegParms; sqInt fetchLong32ofObject(sqInt fieldIndex, sqInt oop); @@ -1083,7 +1083,7 @@ static void markAndTraceObjStackandContents(sqInt stackOrNil, sqInt markAndTraceContents) NoDbgRegParms; void markAndTrace(sqInt objOop); static sqInt markInactiveEphemerons(void); -static void markObjects(sqInt objectsShouldBeUnmarked) NoDbgRegParms NeverInline; +static void markObjects(sqInt objectsShouldBeUnmarkedAndUnmarkedClassesShouldBeExpunged) NoDbgRegParms NeverInline; static void markWeaklingsAndMarkAndFireEphemerons(void); sqInt maybeSplObj(sqInt index); static sqInt moveARunOfObjectsStartingAtupTo(usqInt startAddress, usqInt limit) NoDbgRegParms; @@ -1366,7 +1366,6 @@ EXPORT(void) primitiveEventProcessingControl(void); sqInt primitiveIndexOfMethodheader(sqInt theMethod, sqInt methodHeader); sqInt primitiveIndexOf(sqInt methodPointer); -static sqInt primitiveObjectperformwithArgumentslookedUpIn(sqInt actualReceiver, sqInt selector, sqInt argumentArray, sqInt lookupClass) NoDbgRegParms; static void printActivationNameForSelectorstartClass(sqInt aSelector, sqInt startClass) NoDbgRegParms; static void printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObject, sqInt isBlock, sqInt maybeMessage) NoDbgRegParms; void printAllStacks(void); @@ -1526,10 +1525,10 @@ #endif _iss char * stackPointer; _iss sqInt primFailCode; -_iss sqInt nilObj; _iss char * framePointer; _iss usqInt method; _iss StackPage * stackPage; +_iss sqInt nilObj; _iss sqInt specialObjectsOop; _iss sqInt bytecodeSetSelector; _iss sqInt argumentCount; @@ -1538,7 +1537,6 @@ _iss usqInt instructionPointer; _iss usqInt newMethod; _iss sqInt messageSelector; -_iss sqInt hiddenRootsObj; _iss usqInt newSpaceLimit; _iss StackPage * pages; _iss char * stackBasePlus1; @@ -1547,6 +1545,7 @@ _iss usqInt newSpaceStart; _iss SpurSegmentInfo * segments; _iss sqInt trueObj; +_iss sqInt hiddenRootsObj; _iss sqInt needGCFlag; _iss sqInt falseObj; _iss usqInt totalFreeOldSpace; @@ -1557,11 +1556,11 @@ _iss usqInt scavengeThreshold; _iss sqInt remapBufferCount; _iss sqInt * freeLists; +_iss sqInt classTableFirstPage; _iss char * stackLimit; _iss sqInt rememberedSetSize; _iss sqInt tempOop; _iss sqInt * rememberedSet; -_iss sqInt classTableFirstPage; _iss usqInt freeListsMask; _iss sqInt profileProcess; _iss sqInt profileSemaphore; @@ -1725,9 +1724,9 @@ #endif #endif static void (*primitiveFunctionPointer)(); +sqInt checkForLeaks; sqInt maxLiteralCountForCompile = MaxLiteralCountForCompile /* 60 */; jmp_buf reenterInterpreter; /* private export */; -sqInt checkForLeaks; sqInt checkAllocFiller; sqInt breakSelectorLength = MinSmallInteger; sqInt inIOProcessEvents; @@ -2326,7 +2325,7 @@ /*20*/ 0, 0, 0,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0,-1,-1,-1, 0, 0, 0, /*40*/ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /*60*/ 0, 0, 1,-1,-1,-1,-1,-1, 0, 0,-1,-1, 0, 1, 1, 0, 0, 0, 0, 0, -/*80*/ -1,-1,-1, 0, 1,-1, 1, 0, 1,-1,-1, 0, 0, 0, 0,-1,-1,-1, 0, 0, +/*80*/ -1,-1,-1, 0,-1,-1, 1, 0, 1,-1,-1, 0, 0, 0, 0,-1,-1,-1, 0, 0, /*100*/ 1, 2, 0, 3,-1, 1,-1,-1,-1,-1, 0, 0,-1,-1,-1, 1, 1,-1, 1, 0, /*120*/ -1, 1,-1,-1, 0,-1, 0, 0, 0,-1,-1,-1, 1, 0, 0,-1, 0,-1,-1,-1, /*140*/ -1, 1,-1, 1, 0, 0,-1,-1, 0, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, @@ -2353,7 +2352,7 @@ /*560*/ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0,-1,-1 }; char expensiveAsserts = 0; -const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1035"; +const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1041"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace;
@@ -5103,7 +5102,7 @@
if (!((byteAt((localFP + FoxIFrameFlags) + 3)) != 0)) { goto commonCallerReturn; - goto l250; + goto l227; } closure = longAt(localFP + (frameStackedReceiverOffsetNumArgs(((((usqInt)(longAt(localFP + FoxMethod)))) < (startOfMemory()) ? ((mframeCogMethod(localFP))->cmNumArgs) @@ -5156,10 +5155,10 @@ : (byteAt((localFP + FoxIFrameFlags) + 2)) != 0)) { assert(isContext(frameContext(localFP))); ourContext = longAt(localFP + FoxThisContext); - goto l254; + goto l231; } ourContext = marryFrameSP(localFP, localSP); - l254: /* end ensureFrameIsMarried:SP: */; + l231: /* end ensureFrameIsMarried:SP: */; /* begin internalPush: */ longAtPointerput((localSP -= BytesPerOop), ourContext); /* begin internalPush: */ @@ -5168,7 +5167,7 @@ GIV(argumentCount) = 1; goto normalSend; /* return self */ - goto l250; + goto l227; } if (unwindContextOrNilOrZero != 0) { /* begin internalAboutToReturn:through: */ @@ -5178,10 +5177,10 @@ : (byteAt((localFP + FoxIFrameFlags) + 2)) != 0)) { assert(isContext(frameContext(localFP))); ourContext1 = longAt(localFP + FoxThisContext); - goto l251; + goto l228; } ourContext1 = marryFrameSP(localFP, localSP); - l251: /* end ensureFrameIsMarried:SP: */; + l228: /* end ensureFrameIsMarried:SP: */; /* begin internalPush: */ longAtPointerput((localSP -= BytesPerOop), ourContext1); /* begin internalPush: */ @@ -5192,7 +5191,7 @@ GIV(argumentCount) = 2; goto normalSend; /* return self */ - goto l250; + goto l227; } contextToReturnTo = null; if (((longAt((home + BaseHeaderSize) + (SenderIndex << (shiftForWord())))) & 1)) { @@ -5249,10 +5248,10 @@ : (byteAt((localFP + FoxIFrameFlags) + 2)) != 0)) { assert(isContext(frameContext(localFP))); ourContext2 = longAt(localFP + FoxThisContext); - goto l253; + goto l230; } ourContext2 = marryFrameSP(localFP, localSP); - l253: /* end ensureFrameIsMarried:SP: */; + l230: /* end ensureFrameIsMarried:SP: */; /* begin internalPush: */ longAtPointerput((localSP -= BytesPerOop), ourContext2); /* begin internalPush: */ @@ -5261,7 +5260,7 @@ GIV(argumentCount) = 1; goto normalSend; /* return self */ - goto l250; + goto l227; } } assert(pageListIsWellFormed()); @@ -5380,11 +5379,11 @@ GIV(framePointer) = localFP; ceEnterCogCodePopReceiverReg(); - goto l252; + goto l229; } localIP = pointerForOop(longAt(localFP + FoxIFSavedIP)); } - l252: /* end maybeReturnToMachineCodeFrame */; + l229: /* end maybeReturnToMachineCodeFrame */; /* begin setMethod: */ assert((((usqInt)(longAt(localFP + FoxMethod)))) >= (startOfMemory())); GIV(method) = longAt(localFP + FoxMethod); @@ -5398,7 +5397,7 @@
longAtPointerput(localSP, localReturnValue); } - l250: /* end case */; + l227: /* end case */; break; case 121: /* returnTrue */ @@ -5517,27 +5516,27 @@ fp = (thePage->headFP); if (fp == theFP) { frameAbove = 0; - goto l257; + goto l234; } while (((callerFP = frameCallerFP(fp))) != 0) { if (callerFP == theFP) { frameAbove = fp; - goto l257; + goto l234; } fp = callerFP; } error("did not find theFP in stack page"); frameAbove = 0; - l257: /* end findFrameAbove:inPage: */; + l234: /* end findFrameAbove:inPage: */; /* begin newStackPage */ lruOrFree = ((mostRecentlyUsedPage())->nextPage); if (isFree(lruOrFree)) { newPage = lruOrFree; - goto l258; + goto l235; } divorceFramesIn(lruOrFree); newPage = lruOrFree; - l258: /* end newStackPage */; + l235: /* end newStackPage */; assert(newPage == GIV(stackPage)); moveFramesInthroughtoPage(thePage, frameAbove, newPage); markStackPageMostRecentlyUsed(newPage); @@ -5561,7 +5560,7 @@ longAtput((sp2 = GIV(stackPointer) - BytesPerWord), GIV(instructionPointer)); GIV(stackPointer) = sp2; ceSendAborttonumArgs(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SelectorCannotReturn << (shiftForWord()))), contextToReturnFrom, 1); - goto l256; + goto l233; } GIV(instructionPointer) = 0; thePage = makeBaseFrameFor(contextToReturnTo); @@ -5599,7 +5598,8 @@ GIV(framePointer) = localFP; ceEnterCogCodePopReceiverReg(); - goto l256; + null; + goto l233; }
@@ Diff output truncated at 50000 characters. @@
vm-dev@lists.squeakfoundation.org