Revision: 3233 Author: eliot Date: 2015-01-20 12:28:27 -0800 (Tue, 20 Jan 2015) Log Message: ----------- CogVM source as per VMMaker.oscog-eem.1024
Newspeak: Integrate Ryan's newer absent receiver sends, which first apeared in VMMaker.oscog-eem.919, abandoned because of Glue issues now resolved. Includes nice refactoring of absent send argument marshalling into its own routine.
Spur: Provide a validFreeTree checker.
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-01-19 03:36:05 UTC (rev 3232) +++ branches/Cog/nscogsrc/vm/cogit.c 2015-01-20 20:28:27 UTC (rev 3233) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.1022 uuid: 69a59ffb-cfbd-4b9e-af74-7c2eb662beac + CCodeGenerator VMMaker.oscog-eem.1024 uuid: f6cf904e-36ea-4109-a415-b8564601d19e from - StackToRegisterMappingCogit VMMaker.oscog-eem.1022 uuid: 69a59ffb-cfbd-4b9e-af74-7c2eb662beac + StackToRegisterMappingCogit VMMaker.oscog-eem.1024 uuid: f6cf904e-36ea-4109-a415-b8564601d19e */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1022 uuid: 69a59ffb-cfbd-4b9e-af74-7c2eb662beac " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1024 uuid: f6cf904e-36ea-4109-a415-b8564601d19e " __DATE__ ; char *__cogitBuildInfo = __buildInfo;
@@ -924,6 +924,8 @@ static sqInt genExtReturnTopFromBlock(void); static sqInt genExtSendAbsentDynamicSuperBytecode(void); static sqInt genExtSendAbsentImplicitBytecode(void); +static sqInt genExtSendAbsentOuterBytecode(void); +static sqInt genExtSendAbsentSelfBytecode(void); static sqInt genExtSendBytecode(void); static sqInt genExtSendSuperBytecode(void); static sqInt genExtStoreAndPopLiteralVariableBytecode(void); @@ -1088,6 +1090,8 @@ static sqInt genReturnTopFromMethod(void); static sqInt genSendAbsentDynamicSupernumArgs(sqInt selector, sqInt numArgs) NoDbgRegParms; 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; @@ -1110,7 +1114,7 @@ static void initSimStackForFramelessBlock(sqInt startpc) NoDbgRegParms; static void initSimStackForFramelessMethod(sqInt startpc) NoDbgRegParms; static sqInt liveRegisters(void); -static void marshallImplicitReceiverSendArguments(sqInt numArgs) NoDbgRegParms; +static void marshallAbsentReceiverSendArguments(sqInt numArgs) NoDbgRegParms; static void marshallSendArguments(sqInt numArgs) NoDbgRegParms; static void mergeafterContinuation(BytecodeFixup *fixup, sqInt mergeWithContinuation) NoDbgRegParms; static sqInt methodAbortTrampolineFor(sqInt numArgs) NoDbgRegParms; @@ -1749,16 +1753,16 @@ { genExtUnconditionalJump, v4LongBranchDistance, 0, 0, 0, 2, 0, 0, 0, 0, 1, 0, 0, 0 }, { genExtJumpIfTrue, v4LongBranchDistance, 0, 0, 0, 2, 1, 0, 0, 0, 1, 0, 0, 0 }, { genExtJumpIfFalse, v4LongBranchDistance, 0, 0, 0, 2, 0, 1, 0, 0, 1, 0, 0, 0 }, + { genExtSendAbsentSelfBytecode, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1, 0, 0, 0 }, { unknownBytecode, 0, 0, 0, Nop, 2, 0, 0, 0, 0, 0, 0, 1, 0 }, { unknownBytecode, 0, 0, 0, Nop, 2, 0, 0, 0, 0, 0, 0, 1, 0 }, { unknownBytecode, 0, 0, 0, Nop, 2, 0, 0, 0, 0, 0, 0, 1, 0 }, - { unknownBytecode, 0, 0, 0, Nop, 2, 0, 0, 0, 0, 0, 0, 1, 0 }, { callPrimitiveBytecode, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0 }, { genPushRemoteTempLongBytecode, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0 }, { genStoreRemoteTempLongBytecode, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0 }, { genStoreAndPopRemoteTempLongBytecode, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0 }, { genExtPushClosureBytecode, v4BlockCodeSize, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0 }, - { unknownBytecode, 0, 0, 0, Nop, 3, 0, 0, 0, 0, 0, 0, 1, 0 }, + { genExtSendAbsentOuterBytecode, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1, 0, 0, 0 }, { unknownBytecode, 0, 0, 0, Nop, 3, 0, 0, 0, 0, 0, 0, 1, 0 } }; static sqInt guardPageSize; @@ -17465,6 +17469,45 @@ }
+/* 254 11111110 i i i i i j j j kkkkkkkk Send To Absent Outer Literal + Selector #iiiii (+ Extend A * 32) with jjj (+ Extend B * 8) Arguments at + Depth kkkkkkkk + */ + +static sqInt +genExtSendAbsentOuterBytecode(void) +{ + sqInt depth; + sqInt litIndex; + sqInt nArgs; + + litIndex = (((usqInt) byte1) >> 3) + (extA << 5); + extA = 0; + nArgs = (byte1 & 7) + (extB << 3); + extB = 0; + depth = byte2; + return genSendAbsentOuternumArgsdepth(getLiteral(litIndex), nArgs, depth); +} + + +/* 245 11110101 i i i i i j j j Send To Absent Self Literal Selector #iiiii + (+ Extend A * 32) with jjj (+ Extend B * 8) Arguments + */ + +static sqInt +genExtSendAbsentSelfBytecode(void) +{ + sqInt litIndex; + sqInt nArgs; + + litIndex = (((usqInt) byte1) >> 3) + (extA << 5); + extA = 0; + nArgs = (byte1 & 7) + (extB << 3); + extB = 0; + return genSendAbsentSelfnumArgs(getLiteral(litIndex), nArgs); +} + + /* 238 11101110 i i i i i j j j Send Literal Selector #iiiii (+ Extend A * 32) with jjj (+ Extend B * 8) Arguments */ @@ -20954,7 +20997,7 @@ ssAllocateCallReg(ReceiverResultReg); /* begin MoveMw:r:R: */ genoperandoperandoperand(MoveMwrR, FoxMFReceiver, FPReg, ReceiverResultReg); - marshallImplicitReceiverSendArguments(numArgs); + marshallAbsentReceiverSendArguments(numArgs); return genMarshalledSendDynamicSupernumArgs(selector, numArgs); }
@@ -20972,11 +21015,53 @@ if (result != 0) { return result; } - marshallImplicitReceiverSendArguments(numArgs); + marshallAbsentReceiverSendArguments(numArgs); return genMarshalledSendnumArgs(selector, numArgs); }
+ +/* OK, we could do better and avoid spilling ReceiverResultReg if we + refactored marshallAbsentReceiverSendArguments: to take a flag saying + whether the + receiver was in ReceiverResultReg (absent receiver send) or on the stack + (absent dynamic super send) and in the latter case loading + ReceiverResultReg from the stack after marshalling. But this is a rare + bytecode so for the moment + don't bother. */ + static sqInt +genSendAbsentOuternumArgsdepth(sqInt selector, sqInt numArgs, sqInt depth) +{ + (optStatus.isReceiverResultRegLive = 0); + ssAllocateCallReg(SendNumArgsReg); + /* begin MoveCq:R: */ + genoperandoperand(MoveCqR, depth, SendNumArgsReg); + CallRT(ceEnclosingObjectTrampoline); + marshallAbsentReceiverSendArguments(numArgs); + return genMarshalledSendnumArgs(selector, numArgs); +} + + +/* OK, we could do better and avoid spilling ReceiverResultReg if we + refactored marshallAbsentReceiverSendArguments: to take a flag saying + whether the + receiver was in ReceiverResultReg (absent receiver send) or on the stack + (absent dynamic super send) and in the latter case loading + ReceiverResultReg from the stack after marshalling. But this is a rare + bytecode so for the moment + don't bother. */ + +static sqInt +genSendAbsentSelfnumArgs(sqInt selector, sqInt numArgs) +{ + ssAllocateCallReg(ReceiverResultReg); + /* begin MoveMw:r:R: */ + genoperandoperandoperand(MoveMwrR, FoxMFReceiver, FPReg, ReceiverResultReg); + marshallAbsentReceiverSendArguments(numArgs); + return genMarshalledSendnumArgs(selector, numArgs); +} + +static sqInt genSendDynamicSupernumArgs(sqInt selector, sqInt numArgs) { marshallSendArguments(numArgs); @@ -21964,7 +22049,7 @@ necessary. */
static void -marshallImplicitReceiverSendArguments(sqInt numArgs) +marshallAbsentReceiverSendArguments(sqInt numArgs) { sqInt index; sqInt numSpilled;
Modified: branches/Cog/nscogsrc/vm/cogit.h =================================================================== --- branches/Cog/nscogsrc/vm/cogit.h 2015-01-19 03:36:05 UTC (rev 3232) +++ branches/Cog/nscogsrc/vm/cogit.h 2015-01-20 20:28:27 UTC (rev 3233) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.1022 uuid: 69a59ffb-cfbd-4b9e-af74-7c2eb662beac + CCodeGenerator VMMaker.oscog-eem.1024 uuid: f6cf904e-36ea-4109-a415-b8564601d19e */
Modified: branches/Cog/nscogsrc/vm/cointerp.c =================================================================== --- branches/Cog/nscogsrc/vm/cointerp.c 2015-01-19 03:36:05 UTC (rev 3232) +++ branches/Cog/nscogsrc/vm/cointerp.c 2015-01-20 20:28:27 UTC (rev 3233) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1023 uuid: 3b0b931e-e8b1-4155-ac38-8a078ddcec98 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1024 uuid: f6cf904e-36ea-4109-a415-b8564601d19e from - CoInterpreter VMMaker.oscog-eem.1023 uuid: 3b0b931e-e8b1-4155-ac38-8a078ddcec98 + CoInterpreter VMMaker.oscog-eem.1024 uuid: f6cf904e-36ea-4109-a415-b8564601d19e */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1023 uuid: 3b0b931e-e8b1-4155-ac38-8a078ddcec98 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1024 uuid: f6cf904e-36ea-4109-a415-b8564601d19e " __DATE__ ; char *__interpBuildInfo = __buildInfo;
@@ -464,7 +464,7 @@ static sqInt iframeReceiver(char *theFP) NoDbgRegParms; static sqInt iframeSavedIP(char *theFP) NoDbgRegParms; void ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, char **savedSPP); -sqInt implicitReceiverFormixinimplementing(sqInt rcvr, sqInt mixin, sqInt selector); +sqInt implicitReceiverFormixinimplementing(sqInt methodReceiver, sqInt methodMixin, sqInt selector); usqInt instructionPointerAddress(void); static sqInt instructionPointerForFramecurrentFPcurrentIP(char *spouseFP, char *currentFP, sqInt instrPtr) NoDbgRegParms; usqInt interpretAddress(void); @@ -1058,7 +1058,7 @@ sqInt doSignalSemaphoreWithIndex(sqInt index); static void dummyReferToProxy(void); EXPORT(sqInt) dumpImage(sqInt fileName); -static sqInt enclosingObjectAtwithObjectwithMixin(sqInt n, sqInt anObject, sqInt mixin) NoDbgRegParms; +static sqInt enclosingObjectAtwithObjectwithMixin(sqInt depth, sqInt methodReceiver, sqInt methodMixin) NoDbgRegParms; static sqInt ensureCallerContext(char *theFP) NoDbgRegParms; static void ensureImageFormatIsUpToDate(sqInt swapBytes) NoDbgRegParms; static char * establishFrameForContextToReturnTo(sqInt contextToReturnTo) NoDbgRegParms; @@ -1072,8 +1072,6 @@ sqInt fetchIntegerofObject(sqInt fieldIndex, sqInt objectPointer); static sqInt fetchPointerofMarriedContext(sqInt offset, sqInt aContext) NoDbgRegParms; static sqInt fetchStackPointerOf(sqInt aContext) NoDbgRegParms; -static sqInt findApplicationOfTargetMixinstartingAtBehavior(sqInt targetMixin, sqInt aBehavior) NoDbgRegParms; -static sqInt findApplicationOfTargetMixinstartingAtNonMetaClass(sqInt targetMixin, sqInt aClass) NoDbgRegParms; static sqInt findClassContainingMethodstartingAt(sqInt meth, sqInt classObj) NoDbgRegParms; sqInt findClassOfMethodforReceiver(sqInt meth, sqInt rcvr); static char * findFrameAboveinPage(char *theFP, StackPage *thePage) NoDbgRegParms; @@ -1415,7 +1413,6 @@ _iss sqInt tenuringThreshold; _iss sqInt forceTenureFlag; _iss sqInt longRunningPrimitiveCheckSequenceNumber; -_iss sqInt methodDictLinearSearchLimit; _iss sqInt signalLowSpace; _iss usqLong statFullGCUsecs; _iss sqInt statFullGCs; @@ -1431,6 +1428,7 @@ _iss sqInt interruptKeycode; _iss sqInt interruptPending; _iss usqInt memory; +_iss sqInt methodDictLinearSearchLimit; _iss usqLong nextPollUsecs; _iss usqLong statForceInterruptCheck; _iss usqLong statIGCDeltaUsecs; @@ -2101,7 +2099,7 @@ /* 575 */ (void (*)(void))0, 0 }; char expensiveAsserts = 0; -const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1023"; +const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1024"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace;
@@ -4904,9 +4902,12 @@ case 126: /* dynamicSuperSendBytecode */ { + sqInt aBehavior; sqInt ccIndex; sqInt mClassMixin; + sqInt mixin; sqInt mixinApplication; + sqInt mixinApplication1; sqInt rcvr;
VM_LABEL(dynamicSuperSendBytecode); @@ -4916,12 +4917,20 @@ GIV(messageSelector) = longAt((GIV(method) + BaseHeaderSize) + (((byteAtPointer(++localIP)) + LiteralStart) << (shiftForWord()))); rcvr = longAtPointer(localSP + (GIV(argumentCount) * BytesPerOop)); mClassMixin = methodClassOf(GIV(method)); - mixinApplication = findApplicationOfTargetMixinstartingAtBehavior(mClassMixin, ((rcvr & 1) + /* begin findApplicationOfTargetMixin:startingAtBehavior: */ + aBehavior = ((rcvr & 1) ? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << (shiftForWord()))) : (((ccIndex = (((usqInt) (longAt(rcvr))) >> (compactClassFieldLSB())) & 0x1F)) == 0 ? (longAt(rcvr - BaseHeaderSize)) & AllButTypeMask : (/* begin fetchPointer:ofObject: */ - longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex - 1) << (shiftForWord()))))))); + longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex - 1) << (shiftForWord())))))); + mixinApplication1 = aBehavior; + while (!((mixinApplication1 == GIV(nilObj)) + || ((mixinApplication1 == mClassMixin) + || (((mixin = longAt((mixinApplication1 + BaseHeaderSize) + (MixinIndex << (shiftForWord()))))) == mClassMixin)))) { + mixinApplication1 = longAt((mixinApplication1 + BaseHeaderSize) + (SuperclassIndex << (shiftForWord()))); + } + mixinApplication = mixinApplication1; /* begin classTagForClass: */ lkupClassTag = longAt((mixinApplication + BaseHeaderSize) + (SuperclassIndex << (shiftForWord()))); goto commonSend; @@ -12787,11 +12796,14 @@ case 497: /*241*/ /* extSendAbsentDynamicSuperBytecode */ { + sqInt aBehavior; sqInt byte; sqInt ccIndex; sqInt i; sqInt mClassMixin; + sqInt mixin; sqInt mixinApplication; + sqInt mixinApplication1; sqInt oop;
VM_LABEL(extSendAbsentDynamicSuperBytecode); @@ -12813,12 +12825,20 @@ } longAtPointerput(localSP + (GIV(argumentCount) * BytesPerOop), longAt(localFP + FoxIFReceiver)); mClassMixin = methodClassOf(GIV(method)); - mixinApplication = findApplicationOfTargetMixinstartingAtBehavior(mClassMixin, (((longAt(localFP + FoxIFReceiver)) & 1) + /* begin findApplicationOfTargetMixin:startingAtBehavior: */ + aBehavior = (((longAt(localFP + FoxIFReceiver)) & 1) ? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << (shiftForWord()))) : (((ccIndex = (((usqInt) (longAt(longAt(localFP + FoxIFReceiver)))) >> (compactClassFieldLSB())) & 0x1F)) == 0 ? (longAt((longAt(localFP + FoxIFReceiver)) - BaseHeaderSize)) & AllButTypeMask : (/* begin fetchPointer:ofObject: */ - longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex - 1) << (shiftForWord()))))))); + longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex - 1) << (shiftForWord())))))); + mixinApplication1 = aBehavior; + while (!((mixinApplication1 == GIV(nilObj)) + || ((mixinApplication1 == mClassMixin) + || (((mixin = longAt((mixinApplication1 + BaseHeaderSize) + (MixinIndex << (shiftForWord()))))) == mClassMixin)))) { + mixinApplication1 = longAt((mixinApplication1 + BaseHeaderSize) + (SuperclassIndex << (shiftForWord()))); + } + mixinApplication = mixinApplication1; /* begin classTagForClass: */ lkupClassTag = longAt((mixinApplication + BaseHeaderSize) + (SuperclassIndex << (shiftForWord()))); goto commonSend; @@ -12965,10 +12985,46 @@ } break; case 501: /*245*/ + /* extSendAbsentSelfBytecode */ + { + sqInt byte; + sqInt ccIndex; + sqInt classObj; + sqInt i; + sqInt oop; + + VM_LABEL(extSendAbsentSelfBytecode); + byte = byteAtPointer(++localIP); + /* begin literal: */ + assert(GIV(method) == (iframeMethod(localFP))); + GIV(messageSelector) = longAt((GIV(method) + BaseHeaderSize) + ((((((usqInt) byte) >> 3) + (extA << 5)) + LiteralStart) << (shiftForWord()))); + extA = 0; + GIV(argumentCount) = (byte & 7) + (extB << 3); + extB = 0; + /* begin shuffleArgumentsAndStoreAbsentReceiver: */ + + /* a.k.a. self internalPush: anything */ + + localSP -= BytesPerOop; + for (i = 1; i <= GIV(argumentCount); i += 1) { + oop = longAtPointer(localSP + (i * BytesPerOop)); + longAtPointerput(localSP + ((i - 1) * BytesPerOop), oop); + } + longAtPointerput(localSP + (GIV(argumentCount) * BytesPerOop), longAt(localFP + FoxIFReceiver)); + /* begin classTagForClass: */ + classObj = (((longAt(localFP + FoxIFReceiver)) & 1) + ? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << (shiftForWord()))) + : (((ccIndex = (((usqInt) (longAt(longAt(localFP + FoxIFReceiver)))) >> (compactClassFieldLSB())) & 0x1F)) == 0 + ? (longAt((longAt(localFP + FoxIFReceiver)) - BaseHeaderSize)) & AllButTypeMask + : (/* begin fetchPointer:ofObject: */ + longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex - 1) << (shiftForWord())))))); + lkupClassTag = classObj; + goto commonSend; + } + break; case 502: /*246*/ case 503: /*247*/ case 504: /*248*/ - case 510: /*254*/ case 511: /*255*/ /* unknownBytecode */ { @@ -13083,6 +13139,48 @@ longAtPointerput((localSP -= BytesPerOop), newClosure); } break; + case 510: /*254*/ + /* extSendAbsentOuterBytecode */ + { + sqInt absentReceiver; + sqInt byte; + sqInt ccIndex; + sqInt classObj; + sqInt depth; + sqInt i; + sqInt oop; + + VM_LABEL(extSendAbsentOuterBytecode); + byte = byteAtPointer(++localIP); + /* begin literal: */ + assert(GIV(method) == (iframeMethod(localFP))); + GIV(messageSelector) = longAt((GIV(method) + BaseHeaderSize) + ((((((usqInt) byte) >> 3) + (extA << 5)) + LiteralStart) << (shiftForWord()))); + extA = 0; + GIV(argumentCount) = (byte & 7) + (extB << 3); + extB = 0; + depth = byteAtPointer(++localIP); + absentReceiver = enclosingObjectAtwithObjectwithMixin(depth, longAt(localFP + FoxIFReceiver), methodClassOf(GIV(method))); + /* begin shuffleArgumentsAndStoreAbsentReceiver: */ + + /* a.k.a. self internalPush: anything */ + + localSP -= BytesPerOop; + for (i = 1; i <= GIV(argumentCount); i += 1) { + oop = longAtPointer(localSP + (i * BytesPerOop)); + longAtPointerput(localSP + ((i - 1) * BytesPerOop), oop); + } + longAtPointerput(localSP + (GIV(argumentCount) * BytesPerOop), absentReceiver); + /* begin classTagForClass: */ + classObj = ((absentReceiver & 1) + ? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << (shiftForWord()))) + : (((ccIndex = (((usqInt) (longAt(absentReceiver))) >> (compactClassFieldLSB())) & 0x1F)) == 0 + ? (longAt(absentReceiver - BaseHeaderSize)) & AllButTypeMask + : (/* begin fetchPointer:ofObject: */ + longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex - 1) << (shiftForWord())))))); + lkupClassTag = classObj; + goto commonSend; + } + break; } }
@@ -14212,6 +14310,7 @@ sqInt ceDynamicSuperSendtonumArgs(sqInt selector, sqInt rcvr, sqInt numArgs) { DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt aBehavior; sqInt ccIndex; sqInt classTag; CogMethod *cogMethod; @@ -14220,7 +14319,9 @@ sqInt mClassMixin; sqInt methodHeader; sqInt methodHeader1; + sqInt mixin; sqInt mixinApplication; + sqInt mixinApplication1; CogMethod *newCogMethod; sqInt top; sqInt top1; @@ -14234,12 +14335,20 @@ /* begin sendBreakpoint:receiver: */ sendBreakpointreceiver(firstFixedFieldOfMaybeImmediate(selector), lengthOfMaybeImmediate(selector), rcvr); mClassMixin = methodClassOf(((mframeHomeMethod(GIV(framePointer)))->methodObject)); - mixinApplication = findApplicationOfTargetMixinstartingAtBehavior(mClassMixin, ((rcvr & 1) + /* begin findApplicationOfTargetMixin:startingAtBehavior: */ + aBehavior = ((rcvr & 1) ? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << (shiftForWord()))) : (((ccIndex = (((usqInt) (longAt(rcvr))) >> (compactClassFieldLSB())) & 0x1F)) == 0 ? (longAt(rcvr - BaseHeaderSize)) & AllButTypeMask : (/* begin fetchPointer:ofObject: */ - longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex - 1) << (shiftForWord()))))))); + longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex - 1) << (shiftForWord())))))); + mixinApplication1 = aBehavior; + while (!((mixinApplication1 == GIV(nilObj)) + || ((mixinApplication1 == mClassMixin) + || (((mixin = longAt((mixinApplication1 + BaseHeaderSize) + (MixinIndex << (shiftForWord()))))) == mClassMixin)))) { + mixinApplication1 = longAt((mixinApplication1 + BaseHeaderSize) + (SuperclassIndex << (shiftForWord()))); + } + mixinApplication = mixinApplication1; assert((lengthOf(mixinApplication)) > (InstanceSpecificationIndex + 1)); /* begin classTagForClass: */ classTag = longAt((mixinApplication + BaseHeaderSize) + (SuperclassIndex << (shiftForWord()))); @@ -16643,251 +16752,144 @@ }
-/* This is used to implement the innards of the pushImplicitReceiverBytecode, - used for implicit receiver sends in NS2/NS3. Find the nearest - lexically-enclosing implementation of selector by searching up the static - chain of anObject, - starting at mixin's application. This is an iterative implementation +/* This is used to implement implicit receiver sends in Newspeak. Find the + nearest lexically-enclosing implementation of selector by searching up the + static chain of the + method's receiver, starting at mixin's application. This implementation is derived from - <ContextPart> implicitReceiverFor: obj <Object> - withMixin: mixin <Mixin> + <ContextPart> implicitReceiverFor: methodReceiver <Object> + in: methodMixin <Mixin> implementing: selector <Symbol> ^<Object> */ -/* This is used to implement the innards of the pushImplicitReceiverBytecode, - used for implicit receiver sends in NS2/NS3. Find the nearest - lexically-enclosing implementation of selector by searching up the static - chain of anObject, - starting at mixin's application. This is an iterative implementation +/* This is used to implement implicit receiver sends in Newspeak. Find the + nearest lexically-enclosing implementation of selector by searching up the + static chain of the + method's receiver, starting at mixin's application. This implementation is derived from - <ContextPart> implicitReceiverFor: obj <Object> - withMixin: mixin <Mixin> + <ContextPart> implicitReceiverFor: methodReceiver <Object> + in: methodMixin <Mixin> implementing: selector <Symbol> ^<Object> */
sqInt -implicitReceiverFormixinimplementing(sqInt rcvr, sqInt mixin, sqInt selector) +implicitReceiverFormixinimplementing(sqInt methodReceiver, sqInt methodMixin, sqInt selector) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt anObject; + sqInt aBehavior; + sqInt candidateMixin; + sqInt candidateMixinApplication; + sqInt candidateReceiver; sqInt ccIndex; - sqInt ccIndex1; sqInt dictionary; - sqInt dictionary1; sqInt found; - sqInt found1; sqInt header; - sqInt header1; - sqInt implicitReceiver; - sqInt implicitReceiverOrNil; sqInt index; - sqInt index1; sqInt length; - sqInt length1; sqInt mask; - sqInt mask1; sqInt methodArray; - sqInt methodArray1; - sqInt mixin1; + sqInt mixin; sqInt mixinApplication; - sqInt mixinApplication1; sqInt nextSelector; - sqInt nextSelector1; sqInt sz; - sqInt sz1; - sqInt targetMixin; - sqInt theMixin; - sqInt theMixin1; sqInt wrapAround; - sqInt wrapAround1;
if (breakOnImplicitReceiver()) { /* begin sendBreakpoint:receiver: */ sendBreakpointreceiver(firstFixedFieldOfMaybeImmediate(selector), lengthOfMaybeImmediate(selector), null); } - assert(!((isOopForwarded(rcvr)))); - assert(!((isForwarded(mixin)))); + assert(!((isOopForwarded(methodReceiver)))); + assert(!((isForwarded(methodMixin)))); GIV(messageSelector) = selector; - mixinApplication = findApplicationOfTargetMixinstartingAtBehavior(mixin, ((rcvr & 1) - ? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << (shiftForWord()))) - : (((ccIndex = (((usqInt) (longAt(rcvr))) >> (compactClassFieldLSB())) & 0x1F)) == 0 - ? (longAt(rcvr - BaseHeaderSize)) & AllButTypeMask - : (/* begin fetchPointer:ofObject: */ - longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex - 1) << (shiftForWord()))))))); - if (mixinApplication == GIV(nilObj)) { - return rcvr; - } - dictionary = longAt((mixinApplication + BaseHeaderSize) + (MethodDictionaryIndex << (shiftForWord()))); - /* begin lookupMethodInDictionary: */ - /* begin numSlotsOf: */ - header = longAt(dictionary); - sz = ((header & TypeMask) == HeaderTypeSizeAndClass - ? (longAt(dictionary - (BytesPerWord * 2))) & AllButTypeMask - : header & SizeMask); - length = ((usqInt) (sz - BaseHeaderSize)) >> (shiftForWord()); + candidateReceiver = methodReceiver; + candidateMixin = methodMixin; + while (1) { + /* begin findApplicationOfTargetMixin:startingAtBehavior: */ + aBehavior = ((candidateReceiver & 1) + ? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << (shiftForWord()))) + : (((ccIndex = (((usqInt) (longAt(candidateReceiver))) >> (compactClassFieldLSB())) & 0x1F)) == 0 + ? (longAt(candidateReceiver - BaseHeaderSize)) & AllButTypeMask + : (/* begin fetchPointer:ofObject: */ + longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex - 1) << (shiftForWord())))))); + mixinApplication = aBehavior; + while (!((mixinApplication == GIV(nilObj)) + || ((mixinApplication == candidateMixin) + || (((mixin = longAt((mixinApplication + BaseHeaderSize) + (MixinIndex << (shiftForWord()))))) == candidateMixin)))) { + mixinApplication = longAt((mixinApplication + BaseHeaderSize) + (SuperclassIndex << (shiftForWord()))); + } + candidateMixinApplication = mixinApplication; + assert(!((candidateMixinApplication == (nilObject())))); + dictionary = longAt((candidateMixinApplication + BaseHeaderSize) + (MethodDictionaryIndex << (shiftForWord()))); + /* begin lookupMethodInDictionary: */ + /* begin numSlotsOf: */ + header = longAt(dictionary); + sz = ((header & TypeMask) == HeaderTypeSizeAndClass + ? (longAt(dictionary - (BytesPerWord * 2))) & AllButTypeMask + : header & SizeMask); + length = ((usqInt) (sz - BaseHeaderSize)) >> (shiftForWord());
- /* Use linear search on small dictionaries; its cheaper. - Also the limit can be set to force linear search of all dictionaries, which supports the - booting of images that need rehashing (e.g. because a tracer has generated an image - with different hashes but hasn't rehashed it yet.) */ + /* Use linear search on small dictionaries; its cheaper. + Also the limit can be set to force linear search of all dictionaries, which supports the + booting of images that need rehashing (e.g. because a tracer has generated an image + with different hashes but hasn't rehashed it yet.) */
- mask = (length - SelectorStart) - 1; - if (mask <= GIV(methodDictLinearSearchLimit)) { - index = 0; - while (index <= mask) { - nextSelector = longAt((dictionary + BaseHeaderSize) + ((index + SelectorStart) << (shiftForWord()))); - - if (nextSelector == GIV(messageSelector)) { - methodArray = longAt((dictionary + BaseHeaderSize) + (MethodArrayIndex << (shiftForWord()))); - GIV(newMethod) = longAt((methodArray + BaseHeaderSize) + (index << (shiftForWord()))); - found = 1; - goto l1; + mask = (length - SelectorStart) - 1; + if (mask <= GIV(methodDictLinearSearchLimit)) { + index = 0; + while (index <= mask) { + nextSelector = longAt((dictionary + BaseHeaderSize) + ((index + SelectorStart) << (shiftForWord()))); + + if (nextSelector == GIV(messageSelector)) { + methodArray = longAt((dictionary + BaseHeaderSize) + (MethodArrayIndex << (shiftForWord()))); + GIV(newMethod) = longAt((methodArray + BaseHeaderSize) + (index << (shiftForWord()))); + found = 1; + goto l1; + } + index += 1; } - index += 1; + found = 0; + goto l1; } - found = 0; - goto l1; - }
- /* It is assumed that there are some nils in this dictionary, and search will - stop when one is encountered. However, if there are no nils, then wrapAround - will be detected the second time the loop gets to the end of the table. */ + /* It is assumed that there are some nils in this dictionary, and search will + stop when one is encountered. However, if there are no nils, then wrapAround + will be detected the second time the loop gets to the end of the table. */
- index = SelectorStart + (mask & (((GIV(messageSelector) & 1) + index = SelectorStart + (mask & (((GIV(messageSelector) & 1) ? (GIV(messageSelector) >> 1) : (((usqInt) (longAt(GIV(messageSelector)))) >> HashBitsOffset) & HashMaskUnshifted))); - wrapAround = 0; - while (1) { - nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); - if (nextSelector == GIV(nilObj)) { - found = 0; - goto l1; - } - - if (nextSelector == GIV(messageSelector)) { - methodArray = longAt((dictionary + BaseHeaderSize) + (MethodArrayIndex << (shiftForWord()))); - GIV(newMethod) = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); - found = 1; - goto l1; - } - index += 1; - if (index == length) { - if (wrapAround) { + wrapAround = 0; + while (1) { + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); + if (nextSelector == GIV(nilObj)) { found = 0; goto l1; } - wrapAround = 1; - index = SelectorStart; - } - } - found = 0; -l1: /* end lookupMethodInDictionary: */; - if (!found) { - theMixin = longAt((mixinApplication + BaseHeaderSize) + (MixinIndex << (shiftForWord()))); - /* begin nextImplicitReceiverFor:withMixin: */ - anObject = longAt((mixinApplication + BaseHeaderSize) + (EnclosingObjectIndex << (shiftForWord()))); - mixin1 = longAt((theMixin + BaseHeaderSize) + (EnclosingMixinIndex << (shiftForWord()))); - assert(!((isOopForwarded(anObject)))); - assert(!((isForwarded(mixin1)))); - implicitReceiver = anObject; - targetMixin = mixin1; - while (1) { - if (targetMixin == GIV(nilObj)) { - - /* or: [implicitReceiver = objectMemory nilObject] */ - - implicitReceiverOrNil = GIV(nilObj); - goto l3; + + if (nextSelector == GIV(messageSelector)) { + methodArray = longAt((dictionary + BaseHeaderSize) + (MethodArrayIndex << (shiftForWord()))); + GIV(newMethod) = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); + found = 1; + goto l1; } - mixinApplication1 = findApplicationOfTargetMixinstartingAtNonMetaClass(targetMixin, ((implicitReceiver & 1) - ? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << (shiftForWord()))) - : (((ccIndex1 = (((usqInt) (longAt(implicitReceiver))) >> (compactClassFieldLSB())) & 0x1F)) == 0 - ? (longAt(implicitReceiver - BaseHeaderSize)) & AllButTypeMask - : (/* begin fetchPointer:ofObject: */ - longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex1 - 1) << (shiftForWord()))))))); - if (mixinApplication1 == GIV(nilObj)) { - implicitReceiverOrNil = GIV(nilObj); - goto l3; - } - dictionary1 = longAt((mixinApplication1 + BaseHeaderSize) + (MethodDictionaryIndex << (shiftForWord()))); - /* begin lookupMethodInDictionary: */ - /* begin numSlotsOf: */ - header1 = longAt(dictionary1); - sz1 = ((header1 & TypeMask) == HeaderTypeSizeAndClass - ? (longAt(dictionary1 - (BytesPerWord * 2))) & AllButTypeMask - : header1 & SizeMask); - length1 = ((usqInt) (sz1 - BaseHeaderSize)) >> (shiftForWord()); - - /* Use linear search on small dictionaries; its cheaper. - Also the limit can be set to force linear search of all dictionaries, which supports the - booting of images that need rehashing (e.g. because a tracer has generated an image - with different hashes but hasn't rehashed it yet.) */ - - mask1 = (length1 - SelectorStart) - 1; - if (mask1 <= GIV(methodDictLinearSearchLimit)) { - index1 = 0; - while (index1 <= mask1) { - nextSelector1 = longAt((dictionary1 + BaseHeaderSize) + ((index1 + SelectorStart) << (shiftForWord()))); - - if (nextSelector1 == GIV(messageSelector)) { - methodArray1 = longAt((dictionary1 + BaseHeaderSize) + (MethodArrayIndex << (shiftForWord()))); - GIV(newMethod) = longAt((methodArray1 + BaseHeaderSize) + (index1 << (shiftForWord()))); - found1 = 1; - goto l2; - } - index1 += 1; + index += 1; + if (index == length) { + if (wrapAround) { + found = 0; + goto l1; } - found1 = 0; - goto l2; + wrapAround = 1; + index = SelectorStart; } - - /* It is assumed that there are some nils in this dictionary, and search will - stop when one is encountered. However, if there are no nils, then wrapAround - will be detected the second time the loop gets to the end of the table. */ - - index1 = SelectorStart + (mask1 & (((GIV(messageSelector) & 1) - ? (GIV(messageSelector) >> 1) - : (((usqInt) (longAt(GIV(messageSelector)))) >> HashBitsOffset) & HashMaskUnshifted))); - wrapAround1 = 0; - while (1) { - nextSelector1 = longAt((dictionary1 + BaseHeaderSize) + (index1 << (shiftForWord()))); - if (nextSelector1 == GIV(nilObj)) { - found1 = 0; - goto l2; - } - - if (nextSelector1 == GIV(messageSelector)) { - methodArray1 = longAt((dictionary1 + BaseHeaderSize) + (MethodArrayIndex << (shiftForWord()))); - GIV(newMethod) = longAt((methodArray1 + BaseHeaderSize) + ((index1 - SelectorStart) << (shiftForWord()))); - found1 = 1; - goto l2; - } - index1 += 1; - if (index1 == length1) { - if (wrapAround1) { - found1 = 0; - goto l2; - } - wrapAround1 = 1; - index1 = SelectorStart; - } - } - found1 = 0; - l2: /* end lookupMethodInDictionary: */; - if (found1) break; - implicitReceiver = longAt((mixinApplication1 + BaseHeaderSize) + (EnclosingObjectIndex << (shiftForWord()))); - theMixin1 = longAt((mixinApplication1 + BaseHeaderSize) + (MixinIndex << (shiftForWord()))); - if (theMixin1 == GIV(nilObj)) { - implicitReceiverOrNil = GIV(nilObj); - goto l3; - } - targetMixin = longAt((theMixin1 + BaseHeaderSize) + (EnclosingMixinIndex << (shiftForWord()))); } - implicitReceiverOrNil = implicitReceiver; - l3: /* end nextImplicitReceiverFor:withMixin: */; - if (implicitReceiverOrNil != GIV(nilObj)) { - return implicitReceiverOrNil; + found = 0; + l1: /* end lookupMethodInDictionary: */; + if (found) { + return candidateReceiver; } + candidateMixin = longAt((candidateMixin + BaseHeaderSize) + (EnclosingMixinIndex << (shiftForWord()))); + if (candidateMixin == GIV(nilObj)) break; + candidateReceiver = longAt((candidateMixinApplication + BaseHeaderSize) + (EnclosingObjectIndex << (shiftForWord()))); } - return rcvr; + return methodReceiver; }
usqInt @@ -44811,36 +44813,41 @@ }
-/* This is used to implement the innards of the pushEnclosingObjectBytecode, - used for explicit outer sends in NS2/NS3. */ +/* This is used to implement outer sends and outer expressions in Newspeak. */
static sqInt -enclosingObjectAtwithObjectwithMixin(sqInt n, sqInt anObject, sqInt mixin) +enclosingObjectAtwithObjectwithMixin(sqInt depth, sqInt methodReceiver, sqInt methodMixin) { DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt aBehavior; sqInt ccIndex; sqInt count; sqInt enclosingObject; + sqInt mixin; sqInt mixinApplication; + sqInt mixinApplication1; sqInt targetMixin;
- enclosingObject = anObject; - targetMixin = mixin; + enclosingObject = methodReceiver; + targetMixin = methodMixin; count = 0; - while (count < n) { + while (count < depth) { count += 1; - if ((targetMixin == GIV(nilObj)) - || (enclosingObject == GIV(nilObj))) { - return GIV(nilObj); - } - mixinApplication = findApplicationOfTargetMixinstartingAtNonMetaClass(targetMixin, ((enclosingObject & 1) + assert(!((targetMixin == (nilObject())))); + /* begin findApplicationOfTargetMixin:startingAtBehavior: */ + aBehavior = ((enclosingObject & 1) ? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << (shiftForWord()))) : (((ccIndex = (((usqInt) (longAt(enclosingObject))) >> (compactClassFieldLSB())) & 0x1F)) == 0 ? (longAt(enclosingObject - BaseHeaderSize)) & AllButTypeMask : (/* begin fetchPointer:ofObject: */ - longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex - 1) << (shiftForWord()))))))); - if (mixinApplication == GIV(nilObj)) { - return GIV(nilObj); + longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex - 1) << (shiftForWord())))))); + mixinApplication1 = aBehavior; + while (!((mixinApplication1 == GIV(nilObj)) + || ((mixinApplication1 == targetMixin) + || (((mixin = longAt((mixinApplication1 + BaseHeaderSize) + (MixinIndex << (shiftForWord()))))) == targetMixin)))) { + mixinApplication1 = longAt((mixinApplication1 + BaseHeaderSize) + (SuperclassIndex << (shiftForWord()))); } + mixinApplication = mixinApplication1; + assert(!((mixinApplication == (nilObject())))); enclosingObject = longAt((mixinApplication + BaseHeaderSize) + (EnclosingObjectIndex << (shiftForWord()))); targetMixin = longAt((targetMixin + BaseHeaderSize) + (EnclosingMixinIndex << (shiftForWord()))); } @@ -45602,63 +45609,7 @@ return (sp >> 1); }
- -/* This is used to implement the innards of the pushImplicitReceiverBytecode, - used for outer sends in NS2/NS3. Find the MixinApplcation of which - aBehavior is a subclass that is an application of targetMixin. This is an - implementation derived from - - <ContextPart> findApplicationOfTargetMixin: targetMixin - startingAtBehavior: aBehavior - */ - static sqInt -findApplicationOfTargetMixinstartingAtBehavior(sqInt targetMixin, sqInt aBehavior) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt ccIndex; - sqInt mixin; - sqInt mixinOrMixinApplication; - - mixinOrMixinApplication = aBehavior; - while (!((mixinOrMixinApplication == GIV(nilObj)) - || ((mixinOrMixinApplication == targetMixin) - || ((((mixin = longAt((mixinOrMixinApplication + BaseHeaderSize) + (MixinIndex << (shiftForWord()))))) == targetMixin) - || (((((ccIndex = (((usqInt) (longAt(mixin))) >> (compactClassFieldLSB())) & 0x1F)) == 0 - ? (longAt(mixin - BaseHeaderSize)) & AllButTypeMask - : (/* begin fetchPointer:ofObject: */ - longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex - 1) << (shiftForWord())))))) == targetMixin))))) { - mixinOrMixinApplication = longAt((mixinOrMixinApplication + BaseHeaderSize) + (SuperclassIndex << (shiftForWord()))); - } - return mixinOrMixinApplication; -} - - -/* This is used to implement the innards of the pushImplicitReceiverBytecode, - used for outer sends in NS2/NS3. Find the MixinApplcation of which aClass - is a subclass that is an application of targetMixin. This is an - implementation derived from - - <ContextPart> findApplicationOfTargetMixin: targetMixin - startingAtNonMetaClass: aClass - */ - -static sqInt -findApplicationOfTargetMixinstartingAtNonMetaClass(sqInt targetMixin, sqInt aClass) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt mixinOrMixinApplication; - - assert(!((isForwarded(targetMixin)))); - assert(!((isForwarded(aClass)))); - mixinOrMixinApplication = aClass; - while (!((mixinOrMixinApplication == GIV(nilObj)) - || ((mixinOrMixinApplication == targetMixin) - || ((longAt((mixinOrMixinApplication + BaseHeaderSize) + (MixinIndex << (shiftForWord())))) == targetMixin)))) { - mixinOrMixinApplication = longAt((mixinOrMixinApplication + BaseHeaderSize) + (SuperclassIndex << (shiftForWord()))); - } - return mixinOrMixinApplication; -} - -static sqInt findClassContainingMethodstartingAt(sqInt meth, sqInt classObj) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt classDict;
Modified: branches/Cog/nscogsrc/vm/cointerp.h =================================================================== --- branches/Cog/nscogsrc/vm/cointerp.h 2015-01-19 03:36:05 UTC (rev 3232) +++ branches/Cog/nscogsrc/vm/cointerp.h 2015-01-20 20:28:27 UTC (rev 3233) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1023 uuid: 3b0b931e-e8b1-4155-ac38-8a078ddcec98 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1024 uuid: f6cf904e-36ea-4109-a415-b8564601d19e */
@@ -64,7 +64,7 @@ void (*functionPointerForCompiledMethodprimitiveIndex(sqInt methodObj, sqInt primIndex))(void) ; sqInt getCheckAllocFiller(void); void ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, char **savedSPP); -sqInt implicitReceiverFormixinimplementing(sqInt rcvr, sqInt mixin, sqInt selector); +sqInt implicitReceiverFormixinimplementing(sqInt methodReceiver, sqInt methodMixin, sqInt selector); usqInt instructionPointerAddress(void); usqInt interpretAddress(void); sqInt isCogMethodReference(sqInt methodHeader);
Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c =================================================================== --- branches/Cog/nscogsrc/vm/gcc3x-cointerp.c 2015-01-19 03:36:05 UTC (rev 3232) +++ branches/Cog/nscogsrc/vm/gcc3x-cointerp.c 2015-01-20 20:28:27 UTC (rev 3233) @@ -2,11 +2,11 @@
/* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1023 uuid: 3b0b931e-e8b1-4155-ac38-8a078ddcec98 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1024 uuid: f6cf904e-36ea-4109-a415-b8564601d19e from - CoInterpreter VMMaker.oscog-eem.1023 uuid: 3b0b931e-e8b1-4155-ac38-8a078ddcec98 + CoInterpreter VMMaker.oscog-eem.1024 uuid: f6cf904e-36ea-4109-a415-b8564601d19e */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1023 uuid: 3b0b931e-e8b1-4155-ac38-8a078ddcec98 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1024 uuid: f6cf904e-36ea-4109-a415-b8564601d19e " __DATE__ ; char *__interpBuildInfo = __buildInfo;
@@ -467,7 +467,7 @@ static sqInt iframeReceiver(char *theFP) NoDbgRegParms; static sqInt iframeSavedIP(char *theFP) NoDbgRegParms; void ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, char **savedSPP); -sqInt implicitReceiverFormixinimplementing(sqInt rcvr, sqInt mixin, sqInt selector); +sqInt implicitReceiverFormixinimplementing(sqInt methodReceiver, sqInt methodMixin, sqInt selector); usqInt instructionPointerAddress(void); static sqInt instructionPointerForFramecurrentFPcurrentIP(char *spouseFP, char *currentFP, sqInt instrPtr) NoDbgRegParms; usqInt interpretAddress(void); @@ -1061,7 +1061,7 @@ sqInt doSignalSemaphoreWithIndex(sqInt index); static void dummyReferToProxy(void); EXPORT(sqInt) dumpImage(sqInt fileName); -static sqInt enclosingObjectAtwithObjectwithMixin(sqInt n, sqInt anObject, sqInt mixin) NoDbgRegParms; +static sqInt enclosingObjectAtwithObjectwithMixin(sqInt depth, sqInt methodReceiver, sqInt methodMixin) NoDbgRegParms; static sqInt ensureCallerContext(char *theFP) NoDbgRegParms; static void ensureImageFormatIsUpToDate(sqInt swapBytes) NoDbgRegParms; static char * establishFrameForContextToReturnTo(sqInt contextToReturnTo) NoDbgRegParms; @@ -1075,8 +1075,6 @@ sqInt fetchIntegerofObject(sqInt fieldIndex, sqInt objectPointer); static sqInt fetchPointerofMarriedContext(sqInt offset, sqInt aContext) NoDbgRegParms; static sqInt fetchStackPointerOf(sqInt aContext) NoDbgRegParms; -static sqInt findApplicationOfTargetMixinstartingAtBehavior(sqInt targetMixin, sqInt aBehavior) NoDbgRegParms; -static sqInt findApplicationOfTargetMixinstartingAtNonMetaClass(sqInt targetMixin, sqInt aClass) NoDbgRegParms; static sqInt findClassContainingMethodstartingAt(sqInt meth, sqInt classObj) NoDbgRegParms; sqInt findClassOfMethodforReceiver(sqInt meth, sqInt rcvr); static char * findFrameAboveinPage(char *theFP, StackPage *thePage) NoDbgRegParms; @@ -1418,7 +1416,6 @@ _iss sqInt tenuringThreshold; _iss sqInt forceTenureFlag; _iss sqInt longRunningPrimitiveCheckSequenceNumber; -_iss sqInt methodDictLinearSearchLimit; _iss sqInt signalLowSpace; _iss usqLong statFullGCUsecs; _iss sqInt statFullGCs; @@ -1434,6 +1431,7 @@ _iss sqInt interruptKeycode; _iss sqInt interruptPending; _iss usqInt memory; +_iss sqInt methodDictLinearSearchLimit; _iss usqLong nextPollUsecs; _iss usqLong statForceInterruptCheck; _iss usqLong statIGCDeltaUsecs; @@ -2104,7 +2102,7 @@ /* 575 */ (void (*)(void))0, 0 }; char expensiveAsserts = 0; -const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1023"; +const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1024"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace;
@@ -4913,9 +4911,12 @@ CASE(126) /* dynamicSuperSendBytecode */ { + sqInt aBehavior; sqInt ccIndex; sqInt mClassMixin; + sqInt mixin; sqInt mixinApplication; + sqInt mixinApplication1; sqInt rcvr;
VM_LABEL(dynamicSuperSendBytecode); @@ -4925,12 +4926,20 @@ GIV(messageSelector) = longAt((GIV(method) + BaseHeaderSize) + (((byteAtPointer(++localIP)) + LiteralStart) << (shiftForWord()))); rcvr = longAtPointer(localSP + (GIV(argumentCount) * BytesPerOop)); mClassMixin = methodClassOf(GIV(method)); - mixinApplication = findApplicationOfTargetMixinstartingAtBehavior(mClassMixin, ((rcvr & 1) + /* begin findApplicationOfTargetMixin:startingAtBehavior: */ + aBehavior = ((rcvr & 1) ? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << (shiftForWord()))) : (((ccIndex = (((usqInt) (longAt(rcvr))) >> (compactClassFieldLSB())) & 0x1F)) == 0 ? (longAt(rcvr - BaseHeaderSize)) & AllButTypeMask : (/* begin fetchPointer:ofObject: */ - longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex - 1) << (shiftForWord()))))))); + longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex - 1) << (shiftForWord())))))); + mixinApplication1 = aBehavior; + while (!((mixinApplication1 == GIV(nilObj)) + || ((mixinApplication1 == mClassMixin) + || (((mixin = longAt((mixinApplication1 + BaseHeaderSize) + (MixinIndex << (shiftForWord()))))) == mClassMixin)))) { + mixinApplication1 = longAt((mixinApplication1 + BaseHeaderSize) + (SuperclassIndex << (shiftForWord()))); + } + mixinApplication = mixinApplication1; /* begin classTagForClass: */ lkupClassTag = longAt((mixinApplication + BaseHeaderSize) + (SuperclassIndex << (shiftForWord()))); goto commonSend; @@ -12796,11 +12805,14 @@ CASE(497) /*241*/ /* extSendAbsentDynamicSuperBytecode */ { + sqInt aBehavior; sqInt byte; sqInt ccIndex; sqInt i; sqInt mClassMixin; + sqInt mixin; sqInt mixinApplication; + sqInt mixinApplication1; sqInt oop;
VM_LABEL(extSendAbsentDynamicSuperBytecode); @@ -12822,12 +12834,20 @@ } longAtPointerput(localSP + (GIV(argumentCount) * BytesPerOop), longAt(localFP + FoxIFReceiver)); mClassMixin = methodClassOf(GIV(method)); - mixinApplication = findApplicationOfTargetMixinstartingAtBehavior(mClassMixin, (((longAt(localFP + FoxIFReceiver)) & 1) + /* begin findApplicationOfTargetMixin:startingAtBehavior: */ + aBehavior = (((longAt(localFP + FoxIFReceiver)) & 1) ? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << (shiftForWord()))) : (((ccIndex = (((usqInt) (longAt(longAt(localFP + FoxIFReceiver)))) >> (compactClassFieldLSB())) & 0x1F)) == 0 ? (longAt((longAt(localFP + FoxIFReceiver)) - BaseHeaderSize)) & AllButTypeMask : (/* begin fetchPointer:ofObject: */ - longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex - 1) << (shiftForWord()))))))); + longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))) + BaseHeaderSize) + ((ccIndex - 1) << (shiftForWord())))))); + mixinApplication1 = aBehavior; + while (!((mixinApplication1 == GIV(nilObj)) + || ((mixinApplication1 == mClassMixin) + || (((mixin = longAt((mixinApplication1 + BaseHeaderSize) + (MixinIndex << (shiftForWord()))))) == mClassMixin)))) { + mixinApplication1 = longAt((mixinApplication1 + BaseHeaderSize) + (SuperclassIndex << (shiftForWord()))); + } + mixinApplication = mixinApplication1; /* begin classTagForClass: */ lkupClassTag = longAt((mixinApplication + BaseHeaderSize) + (SuperclassIndex << (shiftForWord()))); goto commonSend; @@ -12974,10 +12994,46 @@ } BREAK; CASE(501) /*245*/ + /* extSendAbsentSelfBytecode */ + { + sqInt byte; + sqInt ccIndex; + sqInt classObj; + sqInt i; + sqInt oop; + + VM_LABEL(extSendAbsentSelfBytecode); + byte = byteAtPointer(++localIP); + /* begin literal: */ + assert(GIV(method) == (iframeMethod(localFP))); + GIV(messageSelector) = longAt((GIV(method) + BaseHeaderSize) + ((((((usqInt) byte) >> 3) + (extA << 5)) + LiteralStart) << (shiftForWord()))); + extA = 0; + GIV(argumentCount) = (byte & 7) + (extB << 3); + extB = 0; + /* begin shuffleArgumentsAndStoreAbsentReceiver: */ + + /* a.k.a. self internalPush: anything */ + + localSP -= BytesPerOop; + for (i = 1; i <= GIV(argumentCount); i += 1) { + oop = longAtPointer(localSP + (i * BytesPerOop)); + longAtPointerput(localSP + ((i - 1) * BytesPerOop), oop); + }
@@ Diff output truncated at 50000 characters. @@
vm-dev@lists.squeakfoundation.org