Revision: 3105 Author: eliot Date: 2014-10-14 12:54:42 -0700 (Tue, 14 Oct 2014) Log Message: ----------- CogVM source as per VMMaker.oscog-eem.903
Rewrite implicit receiver lookup logic to follow and fix up forwarding pointers. Fixes occasional failures to locate correct implicit receiver which manifest as MNUs. And follow in enclosingObjectAt:withObject:withMixin:
Rename hiddenRootsObj: to setHiddenRootsObj: for clang.
Modified Paths: -------------- 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/spursistasrc/vm/cointerp.c branches/Cog/spursistasrc/vm/cointerp.h branches/Cog/spursistasrc/vm/gcc3x-cointerp.c branches/Cog/spursrc/vm/cointerp.c branches/Cog/spursrc/vm/cointerp.h branches/Cog/spursrc/vm/gcc3x-cointerp.c branches/Cog/spurstacksrc/vm/gcc3x-interp.c branches/Cog/spurstacksrc/vm/interp.c
Property Changed: ---------------- branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
Modified: branches/Cog/nsspursrc/vm/cointerp.c =================================================================== --- branches/Cog/nsspursrc/vm/cointerp.c 2014-10-13 23:35:34 UTC (rev 3104) +++ branches/Cog/nsspursrc/vm/cointerp.c 2014-10-14 19:54:42 UTC (rev 3105) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.900 uuid: 3d11cf21-4f5f-406a-85ae-ccbc786612a0 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.902 uuid: e97518bb-4f81-470b-9557-6beed90a223c from - CoInterpreter VMMaker.oscog-eem.900 uuid: 3d11cf21-4f5f-406a-85ae-ccbc786612a0 + CoInterpreter VMMaker.oscog-eem.902 uuid: e97518bb-4f81-470b-9557-6beed90a223c */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.900 uuid: 3d11cf21-4f5f-406a-85ae-ccbc786612a0 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.902 uuid: e97518bb-4f81-470b-9557-6beed90a223c " __DATE__ ; char *__interpBuildInfo = __buildInfo;
@@ -861,7 +861,7 @@ static void addFreeSubTree(sqInt freeTree) NoDbgRegParms; sqInt addGCRoot(sqInt *varLoc); sqInt addressCouldBeObj(sqInt address); -static sqInt addressCouldBeOop(sqInt address) NoDbgRegParms; +sqInt addressCouldBeOop(sqInt address); static sqInt addToFreeTreebytes(sqInt freeChunk, sqInt chunkBytes) NoDbgRegParms; static sqInt allInstancesOf(sqInt aClass) NoDbgRegParms; static sqInt allObjects(void); @@ -969,6 +969,7 @@ static sqInt followForwardedInObjStackatIndex(sqInt objStack, sqInt objStackRootIndex) NoDbgRegParms; sqInt followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth); sqInt followForwarded(sqInt objOop); +static sqInt followObjFieldofObject(sqInt fieldIndex, sqInt anObject) NoDbgRegParms; sqInt formatMask(void); sqInt formatOfClass(sqInt classPointer); static sqInt formatOf(sqInt objOop) NoDbgRegParms; @@ -1083,6 +1084,7 @@ static sqInt noCheckClassAtIndex(sqInt classIndex) NoDbgRegParms; static sqInt noCheckPushonObjStack(sqInt objOop, sqInt objStack) NoDbgRegParms; static sqInt noFixupFollowFieldofObject(sqInt fieldIndex, sqInt anObject) NoDbgRegParms; +static sqInt noInlineFollowForwarded(sqInt objOop) NoDbgRegParms; sqInt nonIndexablePointerFormat(void); static sqInt noUnscannedEphemerons(void); sqInt numBytesOf(sqInt objOop); @@ -1243,6 +1245,7 @@ sqInt fetchIntegerofObject(sqInt fieldIndex, sqInt objectPointer); 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; @@ -1506,8 +1509,8 @@ _iss usqInt freeStart; _iss sqInt argumentCount; _iss usqInt instructionPointer; +_iss sqInt messageSelector; _iss usqInt newMethod; -_iss sqInt messageSelector; _iss usqInt newSpaceLimit; _iss StackPage * pages; _iss sqInt hiddenRootsObj; @@ -1537,10 +1540,10 @@ _iss StackPage * mostRecentlyUsedPage; _iss sqInt numStackPages; _iss SpurNewSpaceSpace pastSpace; -_iss sqInt classTableFirstPage; _iss sqInt markStack; _iss sqInt numClassTablePages; _iss sqInt profileProcess; +_iss sqInt classTableFirstPage; _iss usqInt oldSpaceStart; _iss SpurNewSpaceSpace futureSpace; _iss sqInt longRunningPrimitiveCheckSemaphore; @@ -2322,7 +2325,7 @@ /*540*/ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /*560*/ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0,-1,-1 }; -const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.900"; +const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.902"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace;
@@ -15044,13 +15047,14 @@
/* frameless method; nothing to activate... */
- - /* dont use and: so as to get Slang to inline cogit numRegArgs > 0 */ + if ((numRegArgs()) > 0) {
- if (((cogMethod->cmNumArgs)) <= (numRegArgs())) { - callRegisterArgCogMethodatreceiver(cogMethod, noCheckEntryOffset(), rcvr); + /* dont use and: so as to get Slang to inline cogit numRegArgs > 0 */ + + if (((cogMethod->cmNumArgs)) <= (numRegArgs())) { + callRegisterArgCogMethodatreceiver(cogMethod, noCheckEntryOffset(), rcvr); + } } - /* begin push: */ object = (((sqInt)cogMethod)) + (noCheckEntryOffset()); longAtput((sp = GIV(stackPointer) - BytesPerWord), object); @@ -18031,13 +18035,14 @@ assertCStackWellAligned(); assert(isMachineCodeFrame(GIV(framePointer))); assertValidExecutionPointersimbarline(longAt(GIV(stackPointer)), GIV(framePointer), GIV(stackPointer), 0, __LINE__); - - /* dont use and: so as to get Slang to inline cogit numRegArgs > 0 */ + if ((numRegArgs()) > 0) {
- if (((cogMethod->cmNumArgs)) <= (numRegArgs())) { - callRegisterArgCogMethodatreceiver(cogMethod, entryOffset(), rcvr); + /* dont use and: so as to get Slang to inline cogit numRegArgs > 0 */ + + if (((cogMethod->cmNumArgs)) <= (numRegArgs())) { + callRegisterArgCogMethodatreceiver(cogMethod, entryOffset(), rcvr); + } } - /* begin push: */ object = (((sqInt)cogMethod)) + (entryOffset()); longAtput((sp = GIV(stackPointer) - BytesPerWord), object); @@ -18074,31 +18079,32 @@ object = (((sqInt)cogMethod)) + (entryOffset()); longAtput((sp1 = GIV(stackPointer) - BytesPerWord), object); GIV(stackPointer) = sp1; - - /* dont use and: so as to get Slang to inline cogit numRegArgs > 0 */ + if ((numRegArgs()) > 0) {
- if (((cogMethod->cmNumArgs)) <= (numRegArgs())) { - /* begin push: */ - longAtput((sp = GIV(stackPointer) - BytesPerWord), cacheTag); - GIV(stackPointer) = sp; - - switch ((cogMethod->cmNumArgs)) { - case 0: - ceCall0ArgsPIC(); - break; - case 1: - ceCall1ArgsPIC(); - break; - case 2: - ceCall2ArgsPIC(); - break; - default: - null; + /* dont use and: so as to get Slang to inline cogit numRegArgs > 0 */
+ if (((cogMethod->cmNumArgs)) <= (numRegArgs())) { + /* begin push: */ + longAtput((sp = GIV(stackPointer) - BytesPerWord), cacheTag); + GIV(stackPointer) = sp; + + switch ((cogMethod->cmNumArgs)) { + case 0: + ceCall0ArgsPIC(); + break; + case 1: + ceCall1ArgsPIC(); + break; + case 2: + ceCall2ArgsPIC(); + break; + default: + null; + + } + error("not reached"); } - error("not reached"); } - /* begin push: */ longAtput((sp2 = GIV(stackPointer) - BytesPerWord), rcvr); GIV(stackPointer) = sp2; @@ -18128,13 +18134,14 @@ assertCStackWellAligned(); assert(isMachineCodeFrame(GIV(framePointer))); assertValidExecutionPointersimbarline(longAt(GIV(stackPointer)), GIV(framePointer), GIV(stackPointer), 0, __LINE__); - - /* dont use and: so as to get Slang to inline cogit numRegArgs > 0 */ + if ((numRegArgs()) > 0) {
- if (((cogMethod->cmNumArgs)) <= (numRegArgs())) { - callRegisterArgCogMethodatreceiver(cogMethod, noCheckEntryOffset(), rcvr); + /* dont use and: so as to get Slang to inline cogit numRegArgs > 0 */ + + if (((cogMethod->cmNumArgs)) <= (numRegArgs())) { + callRegisterArgCogMethodatreceiver(cogMethod, noCheckEntryOffset(), rcvr); + } } - /* begin push: */ object = (((sqInt)cogMethod)) + (noCheckEntryOffset()); longAtput((sp = GIV(stackPointer) - BytesPerWord), object); @@ -19024,9 +19031,7 @@ sqInt implicitReceiverFormixinimplementing(sqInt rcvr, sqInt mixin, sqInt selector) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt aClass; - sqInt classIndex; - sqInt classTablePage; + sqInt anObject; sqInt dictionary; sqInt dictionary1; sqInt found; @@ -19043,9 +19048,9 @@ sqInt mask1; sqInt methodArray; sqInt methodArray1; + sqInt mixin1; sqInt mixinApplication; sqInt mixinApplication1; - sqInt mixinOrMixinApplication; sqInt nextSelector; sqInt nextSelector1; usqInt numSlots; @@ -19056,13 +19061,16 @@ sqInt objOop12; sqInt objOop2; sqInt objOop21; + sqInt objOop22; sqInt objOop3; sqInt objOop31; + sqInt objOop32; sqInt objOop4; - sqInt objOop41; sqInt objOop5; sqInt objOop6; - sqInt tagBits; + sqInt objOop7; + sqInt objOop8; + sqInt objOop9; sqInt targetMixin; sqInt theMixin; sqInt theMixin1; @@ -19073,21 +19081,23 @@ /* begin sendBreakpoint:receiver: */ sendBreakpointreceiver(firstFixedFieldOfMaybeImmediate(selector), lengthOfMaybeImmediate(selector), null); } - - /* messageSelector is an implicit parameter of lookupMethodInDictionary: */ - - GIV(messageSelector) = selector; + assert(!((isOopForwarded(rcvr)))); + assert(!((isForwarded(mixin)))); + GIV(messageSelector) = (((selector & 3) == 0) + && (((longAt(selector)) & 0x3FFFFF) == 8) + ? noInlineFollowForwarded(selector) + : selector); mixinApplication = findApplicationOfTargetMixinstartingAtBehavior(mixin, fetchClassOf(rcvr)); if (mixinApplication == GIV(nilObj)) { return rcvr; } /* begin followObjField:ofObject: */ - objOop = longAt((mixinApplication + (BaseHeaderSize)) + (MethodDictionaryIndex << 2)); - assert(isNonImmediate(objOop)); - if (((longAt(objOop)) & (0x3FFFFF - 8)) == 0) { - objOop = fixFollowedFieldofObjectwithInitialValue(MethodDictionaryIndex, mixinApplication, objOop); + objOop7 = longAt((mixinApplication + (BaseHeaderSize)) + (MethodDictionaryIndex << 2)); + assert(isNonImmediate(objOop7)); + if (((longAt(objOop7)) & (0x3FFFFF - 8)) == 0) { + objOop7 = fixFollowedFieldofObjectwithInitialValue(MethodDictionaryIndex, mixinApplication, objOop7); } - dictionary = objOop; + dictionary = objOop7; /* begin lookupMethodInDictionary: */ /* begin numSlotsOf: */ flag("endianness"); @@ -19113,12 +19123,12 @@ } if (nextSelector1 == GIV(messageSelector)) { /* begin followObjField:ofObject: */ - objOop6 = longAt((dictionary + (BaseHeaderSize)) + (MethodArrayIndex << 2)); - assert(isNonImmediate(objOop6)); - if (((longAt(objOop6)) & (0x3FFFFF - 8)) == 0) { - objOop6 = fixFollowedFieldofObjectwithInitialValue(MethodArrayIndex, dictionary, objOop6); + objOop9 = longAt((dictionary + (BaseHeaderSize)) + (MethodArrayIndex << 2)); + assert(isNonImmediate(objOop9)); + if (((longAt(objOop9)) & (0x3FFFFF - 8)) == 0) { + objOop9 = fixFollowedFieldofObjectwithInitialValue(MethodArrayIndex, dictionary, objOop9); } - methodArray1 = objOop6; + methodArray1 = objOop9; /* begin followField:ofObject: */ objOop12 = longAt((methodArray1 + (BaseHeaderSize)) + (index1 << 2)); if (((objOop12 & 3) == 0) @@ -19127,12 +19137,12 @@ } GIV(newMethod) = ((sqInt) objOop12); found = 1; - goto l4; + goto l3; } index1 += 1; } found = 0; - goto l4; + goto l3; }
/* It is assumed that there are some nils in this dictionary, and search will @@ -19144,14 +19154,13 @@ ? (GIV(messageSelector) >> 1) : ((usqInt) (((usqInt)GIV(messageSelector)))) >> 2) : (/* begin hashBitsOf: */ - (objOop41 = GIV(messageSelector)), - (hash1 = (longAt(objOop41 + 4)) & 0x3FFFFF), + (hash1 = (longAt(GIV(messageSelector) + 4)) & 0x3FFFFF), (hash1 == 0 ? ((hash1 = (newObjectHash()) & 0x3FFFFF), /* begin setHashBitsOf:to: */ flag("endianness"), assert(((hash1 >= 0) && (hash1 <= (identityHashHalfWordMask())))), - longAtput(objOop41 + 4, ((((longAt(objOop41 + 4)) | 0x3FFFFF) - 0x3FFFFF)) + hash1)) + longAtput(GIV(messageSelector) + 4, ((((longAt(GIV(messageSelector) + 4)) | 0x3FFFFF) - 0x3FFFFF)) + hash1)) : 0), hash1)))); wrapAround1 = 0; @@ -19159,7 +19168,7 @@ nextSelector1 = longAt((dictionary + (BaseHeaderSize)) + (index1 << 2)); if (nextSelector1 == GIV(nilObj)) { found = 0; - goto l4; + goto l3; } if (((nextSelector1 & 3) == 0) && (((longAt(nextSelector1)) & 0x3FFFFF) == 8)) { @@ -19167,39 +19176,61 @@ } if (nextSelector1 == GIV(messageSelector)) { /* begin followObjField:ofObject: */ - objOop21 = longAt((dictionary + (BaseHeaderSize)) + (MethodArrayIndex << 2)); - assert(isNonImmediate(objOop21)); - if (((longAt(objOop21)) & (0x3FFFFF - 8)) == 0) { - objOop21 = fixFollowedFieldofObjectwithInitialValue(MethodArrayIndex, dictionary, objOop21); + objOop22 = longAt((dictionary + (BaseHeaderSize)) + (MethodArrayIndex << 2)); + assert(isNonImmediate(objOop22)); + if (((longAt(objOop22)) & (0x3FFFFF - 8)) == 0) { + objOop22 = fixFollowedFieldofObjectwithInitialValue(MethodArrayIndex, dictionary, objOop22); } - methodArray1 = objOop21; + methodArray1 = objOop22; /* begin followField:ofObject: */ - objOop31 = longAt((methodArray1 + (BaseHeaderSize)) + ((index1 - SelectorStart) << 2)); - if (((objOop31 & 3) == 0) - && (((longAt(objOop31)) & 0x3FFFFF) == 8)) { - objOop31 = fixFollowedFieldofObjectwithInitialValue(index1 - SelectorStart, methodArray1, objOop31); + objOop32 = longAt((methodArray1 + (BaseHeaderSize)) + ((index1 - SelectorStart) << 2)); + if (((objOop32 & 3) == 0) + && (((longAt(objOop32)) & 0x3FFFFF) == 8)) { + objOop32 = fixFollowedFieldofObjectwithInitialValue(index1 - SelectorStart, methodArray1, objOop32); } - GIV(newMethod) = ((sqInt) objOop31); + GIV(newMethod) = ((sqInt) objOop32); found = 1; - goto l4; + goto l3; } index1 += 1; if (index1 == length1) { if (wrapAround1) { found = 0; - goto l4; + goto l3; } wrapAround1 = 1; index1 = SelectorStart; } } found = 0; -l4: /* end lookupMethodInDictionary: */; +l3: /* end lookupMethodInDictionary: */; if (!found) { - theMixin = longAt((mixinApplication + (BaseHeaderSize)) + (MixinIndex << 2)); + /* begin followObjField:ofObject: */ + objOop4 = longAt((mixinApplication + (BaseHeaderSize)) + (MixinIndex << 2)); + assert(isNonImmediate(objOop4)); + if (((longAt(objOop4)) & (0x3FFFFF - 8)) == 0) { + objOop4 = fixFollowedFieldofObjectwithInitialValue(MixinIndex, mixinApplication, objOop4); + } + theMixin = objOop4; /* begin nextImplicitReceiverFor:withMixin: */ - implicitReceiver = longAt((mixinApplication + (BaseHeaderSize)) + (EnclosingObjectIndex << 2)); - targetMixin = longAt((theMixin + (BaseHeaderSize)) + (EnclosingMixinIndex << 2)); + /* begin followObjField:ofObject: */ + objOop5 = longAt((mixinApplication + (BaseHeaderSize)) + (EnclosingObjectIndex << 2)); + assert(isNonImmediate(objOop5)); + if (((longAt(objOop5)) & (0x3FFFFF - 8)) == 0) { + objOop5 = fixFollowedFieldofObjectwithInitialValue(EnclosingObjectIndex, mixinApplication, objOop5); + } + anObject = objOop5; + /* begin followObjField:ofObject: */ + objOop6 = longAt((theMixin + (BaseHeaderSize)) + (EnclosingMixinIndex << 2)); + assert(isNonImmediate(objOop6)); + if (((longAt(objOop6)) & (0x3FFFFF - 8)) == 0) { + objOop6 = fixFollowedFieldofObjectwithInitialValue(EnclosingMixinIndex, theMixin, objOop6); + } + mixin1 = objOop6; + assert(!((isOopForwarded(anObject)))); + assert(!((isForwarded(mixin1)))); + implicitReceiver = anObject; + targetMixin = mixin1; while (1) { if (targetMixin == GIV(nilObj)) {
@@ -19208,53 +19239,18 @@ implicitReceiverOrNil = GIV(nilObj); goto l1; } - /* begin findApplicationOfTargetMixin:startingAtNonMetaClass: */ - /* begin fetchClassOf: */ - if (((tagBits = implicitReceiver & 3)) != 0) { - aClass = longAt((GIV(classTableFirstPage) + (BaseHeaderSize)) + (tagBits << 2)); - goto l2; - } - /* begin fetchClassOfNonImm: */ - classIndex = (longAt(implicitReceiver)) & 0x3FFFFF; - if (classIndex <= 0x1F) { - if (classIndex == 0x1F) { - aClass = implicitReceiver; - goto l2; - } - if (classIndex == 8) { - aClass = GIV(nilObj); - goto l2; - } - } - assert(classIndex >= (arrayClassIndexPun())); - /* begin classOrNilAtIndex: */ - assert((classIndex <= (tagMask())) - || (classIndex >= (arrayClassIndexPun()))); - classTablePage = longAt((GIV(hiddenRootsObj) + (BaseHeaderSize)) + ((((usqInt) classIndex) >> 10) << 2)); - if (classTablePage == GIV(nilObj)) { - aClass = GIV(nilObj); - goto l2; - } - aClass = longAt((classTablePage + (BaseHeaderSize)) + ((classIndex & ((1 << 10) - 1)) << 2)); - l2: /* end fetchClassOf: */; - mixinOrMixinApplication = aClass; - while (!((mixinOrMixinApplication == GIV(nilObj)) - || ((mixinOrMixinApplication == targetMixin) - || ((longAt((mixinOrMixinApplication + (BaseHeaderSize)) + (MixinIndex << 2))) == targetMixin)))) { - mixinOrMixinApplication = longAt((mixinOrMixinApplication + (BaseHeaderSize)) + (SuperclassIndex << 2)); - } - mixinApplication1 = mixinOrMixinApplication; + mixinApplication1 = findApplicationOfTargetMixinstartingAtNonMetaClass(targetMixin, fetchClassOf(implicitReceiver)); if (mixinApplication1 == GIV(nilObj)) { implicitReceiverOrNil = GIV(nilObj); goto l1; } /* begin followObjField:ofObject: */ - objOop1 = longAt((mixinApplication1 + (BaseHeaderSize)) + (MethodDictionaryIndex << 2)); - assert(isNonImmediate(objOop1)); - if (((longAt(objOop1)) & (0x3FFFFF - 8)) == 0) { - objOop1 = fixFollowedFieldofObjectwithInitialValue(MethodDictionaryIndex, mixinApplication1, objOop1); + objOop = longAt((mixinApplication1 + (BaseHeaderSize)) + (MethodDictionaryIndex << 2)); + assert(isNonImmediate(objOop)); + if (((longAt(objOop)) & (0x3FFFFF - 8)) == 0) { + objOop = fixFollowedFieldofObjectwithInitialValue(MethodDictionaryIndex, mixinApplication1, objOop); } - dictionary1 = objOop1; + dictionary1 = objOop; /* begin lookupMethodInDictionary: */ /* begin numSlotsOf: */ flag("endianness"); @@ -19280,12 +19276,12 @@ } if (nextSelector == GIV(messageSelector)) { /* begin followObjField:ofObject: */ - objOop5 = longAt((dictionary1 + (BaseHeaderSize)) + (MethodArrayIndex << 2)); - assert(isNonImmediate(objOop5)); - if (((longAt(objOop5)) & (0x3FFFFF - 8)) == 0) { - objOop5 = fixFollowedFieldofObjectwithInitialValue(MethodArrayIndex, dictionary1, objOop5); + objOop8 = longAt((dictionary1 + (BaseHeaderSize)) + (MethodArrayIndex << 2)); + assert(isNonImmediate(objOop8)); + if (((longAt(objOop8)) & (0x3FFFFF - 8)) == 0) { + objOop8 = fixFollowedFieldofObjectwithInitialValue(MethodArrayIndex, dictionary1, objOop8); } - methodArray = objOop5; + methodArray = objOop8; /* begin followField:ofObject: */ objOop11 = longAt((methodArray + (BaseHeaderSize)) + (index << 2)); if (((objOop11 & 3) == 0) @@ -19294,12 +19290,12 @@ } GIV(newMethod) = ((sqInt) objOop11); found1 = 1; - goto l3; + goto l2; } index += 1; } found1 = 0; - goto l3; + goto l2; }
/* It is assumed that there are some nils in this dictionary, and search will @@ -19311,14 +19307,13 @@ ? (GIV(messageSelector) >> 1) : ((usqInt) (((usqInt)GIV(messageSelector)))) >> 2) : (/* begin hashBitsOf: */ - (objOop4 = GIV(messageSelector)), - (hash = (longAt(objOop4 + 4)) & 0x3FFFFF), + (hash = (longAt(GIV(messageSelector) + 4)) & 0x3FFFFF), (hash == 0 ? ((hash = (newObjectHash()) & 0x3FFFFF), /* begin setHashBitsOf:to: */ flag("endianness"), assert(((hash >= 0) && (hash <= (identityHashHalfWordMask())))), - longAtput(objOop4 + 4, ((((longAt(objOop4 + 4)) | 0x3FFFFF) - 0x3FFFFF)) + hash)) + longAtput(GIV(messageSelector) + 4, ((((longAt(GIV(messageSelector) + 4)) | 0x3FFFFF) - 0x3FFFFF)) + hash)) : 0), hash)))); wrapAround = 0; @@ -19326,7 +19321,7 @@ nextSelector = longAt((dictionary1 + (BaseHeaderSize)) + (index << 2)); if (nextSelector == GIV(nilObj)) { found1 = 0; - goto l3; + goto l2; } if (((nextSelector & 3) == 0) && (((longAt(nextSelector)) & 0x3FFFFF) == 8)) { @@ -19334,42 +19329,60 @@ } if (nextSelector == GIV(messageSelector)) { /* begin followObjField:ofObject: */ - objOop2 = longAt((dictionary1 + (BaseHeaderSize)) + (MethodArrayIndex << 2)); - assert(isNonImmediate(objOop2)); - if (((longAt(objOop2)) & (0x3FFFFF - 8)) == 0) { - objOop2 = fixFollowedFieldofObjectwithInitialValue(MethodArrayIndex, dictionary1, objOop2); + objOop21 = longAt((dictionary1 + (BaseHeaderSize)) + (MethodArrayIndex << 2)); + assert(isNonImmediate(objOop21)); + if (((longAt(objOop21)) & (0x3FFFFF - 8)) == 0) { + objOop21 = fixFollowedFieldofObjectwithInitialValue(MethodArrayIndex, dictionary1, objOop21); } - methodArray = objOop2; + methodArray = objOop21; /* begin followField:ofObject: */ - objOop3 = longAt((methodArray + (BaseHeaderSize)) + ((index - SelectorStart) << 2)); - if (((objOop3 & 3) == 0) - && (((longAt(objOop3)) & 0x3FFFFF) == 8)) { - objOop3 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop3); + objOop31 = longAt((methodArray + (BaseHeaderSize)) + ((index - SelectorStart) << 2)); + if (((objOop31 & 3) == 0) + && (((longAt(objOop31)) & 0x3FFFFF) == 8)) { + objOop31 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop31); } - GIV(newMethod) = ((sqInt) objOop3); + GIV(newMethod) = ((sqInt) objOop31); found1 = 1; - goto l3; + goto l2; } index += 1; if (index == length) { if (wrapAround) { found1 = 0; - goto l3; + goto l2; } wrapAround = 1; index = SelectorStart; } } found1 = 0; - l3: /* end lookupMethodInDictionary: */; + l2: /* end lookupMethodInDictionary: */; if (found1) break; - implicitReceiver = longAt((mixinApplication1 + (BaseHeaderSize)) + (EnclosingObjectIndex << 2)); - theMixin1 = longAt((mixinApplication1 + (BaseHeaderSize)) + (MixinIndex << 2)); + /* begin followObjField:ofObject: */ + objOop1 = longAt((mixinApplication1 + (BaseHeaderSize)) + (EnclosingObjectIndex << 2)); + assert(isNonImmediate(objOop1)); + if (((longAt(objOop1)) & (0x3FFFFF - 8)) == 0) { + objOop1 = fixFollowedFieldofObjectwithInitialValue(EnclosingObjectIndex, mixinApplication1, objOop1); + } + implicitReceiver = objOop1; + /* begin followObjField:ofObject: */ + objOop2 = longAt((mixinApplication1 + (BaseHeaderSize)) + (MixinIndex << 2)); + assert(isNonImmediate(objOop2)); + if (((longAt(objOop2)) & (0x3FFFFF - 8)) == 0) { + objOop2 = fixFollowedFieldofObjectwithInitialValue(MixinIndex, mixinApplication1, objOop2); + } + theMixin1 = objOop2; if (theMixin1 == GIV(nilObj)) { implicitReceiverOrNil = GIV(nilObj); goto l1; } - targetMixin = longAt((theMixin1 + (BaseHeaderSize)) + (EnclosingMixinIndex << 2)); + /* begin followObjField:ofObject: */ + objOop3 = longAt((theMixin1 + (BaseHeaderSize)) + (EnclosingMixinIndex << 2)); + assert(isNonImmediate(objOop3)); + if (((longAt(objOop3)) & (0x3FFFFF - 8)) == 0) { + objOop3 = fixFollowedFieldofObjectwithInitialValue(EnclosingMixinIndex, theMixin1, objOop3); + } + targetMixin = objOop3; } implicitReceiverOrNil = implicitReceiver; l1: /* end nextImplicitReceiverFor:withMixin: */; @@ -40942,7 +40955,11 @@ && (oopisGreaterThanOrEqualToandLessThan(address, ((futureSpace()).start), futureSurvivorStart())))))); }
-static sqInt + +/* Answer if address appears to be that of either an immediate or an object. + For code disassembly and assertions. */ + +sqInt addressCouldBeOop(sqInt address) { return ((address & 3) != 0) @@ -46346,6 +46363,24 @@ }
+/* Make sure the obj at fieldIndex in anObject is not forwarded (follow the + forwarder there-in if so). Answer the (possibly followed) obj at + fieldIndex. */ + +static sqInt +followObjFieldofObject(sqInt fieldIndex, sqInt anObject) +{ + sqInt objOop; + + objOop = longAt((anObject + (BaseHeaderSize)) + (fieldIndex << 2)); + assert(isNonImmediate(objOop)); + if (((longAt(objOop)) & (0x3FFFFF - 8)) == 0) { + objOop = fixFollowedFieldofObjectwithInitialValue(fieldIndex, anObject, objOop); + } + return objOop; +} + + /* 0 = 0 sized objects (UndefinedObject True False et al) 1 = non-indexable objects with inst vars (Point et al) 2 = indexable objects with no inst vars (Array et al) @@ -47245,7 +47280,7 @@ assert(GIV(falseObj) == (objectAfter(GIV(nilObj)))); assert(GIV(trueObj) == (objectAfter(GIV(falseObj)))); freeListObj = objectAfter(GIV(trueObj)); - /* begin hiddenRootsObj: */ + /* begin setHiddenRootsObj: */ anOop = objectAfter(freeListObj); GIV(hiddenRootsObj) = anOop; assert(validClassTableRootPages()); @@ -47260,7 +47295,7 @@ } } GIV(classTableIndex) = 1 << 10; -l1: /* end hiddenRootsObj: */; +l1: /* end setHiddenRootsObj: */; GIV(markStack) = swizzleObjStackAt(MarkStackRootIndex); GIV(weaklingStack) = swizzleObjStackAt(WeaklingStackRootIndex); GIV(ephemeronQueue) = swizzleObjStackAt(EphemeronQueueRootIndex); @@ -49917,6 +49952,21 @@ return objOop; }
+static sqInt +noInlineFollowForwarded(sqInt objOop) +{ + sqInt referent; + + /* begin followForwarded: */ + assert(isUnambiguouslyForwarder(objOop)); + referent = longAt((objOop + (BaseHeaderSize)) + (0 << 2)); + while (((referent & 3) == 0) + && (((longAt(referent)) & 0x3FFFFF) == 8)) { + referent = longAt((referent + (BaseHeaderSize)) + (0 << 2)); + } + return referent; +} + sqInt nonIndexablePointerFormat(void) { @@ -55148,14 +55198,9 @@ static sqInt enclosingObjectAtwithObjectwithMixin(sqInt n, sqInt anObject, sqInt mixin) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt aClass; - sqInt classIndex; - sqInt classTablePage; sqInt count; sqInt enclosingObject; sqInt mixinApplication; - sqInt mixinOrMixinApplication; - sqInt tagBits; sqInt targetMixin;
enclosingObject = anObject; @@ -55167,42 +55212,7 @@ || (enclosingObject == GIV(nilObj))) { return GIV(nilObj); } - /* begin findApplicationOfTargetMixin:startingAtNonMetaClass: */ - /* begin fetchClassOf: */ - if (((tagBits = enclosingObject & 3)) != 0) { - aClass = longAt((GIV(classTableFirstPage) + (BaseHeaderSize)) + (tagBits << 2)); - goto l1; - } - /* begin fetchClassOfNonImm: */ - classIndex = (longAt(enclosingObject)) & 0x3FFFFF; - if (classIndex <= 0x1F) { - if (classIndex == 0x1F) { - aClass = enclosingObject; - goto l1; - } - if (classIndex == 8) { - aClass = GIV(nilObj); - goto l1; - } - } - assert(classIndex >= (arrayClassIndexPun())); - /* begin classOrNilAtIndex: */ - assert((classIndex <= (tagMask())) - || (classIndex >= (arrayClassIndexPun()))); - classTablePage = longAt((GIV(hiddenRootsObj) + (BaseHeaderSize)) + ((((usqInt) classIndex) >> 10) << 2)); - if (classTablePage == GIV(nilObj)) { - aClass = GIV(nilObj); - goto l1; - } - aClass = longAt((classTablePage + (BaseHeaderSize)) + ((classIndex & ((1 << 10) - 1)) << 2)); - l1: /* end fetchClassOf: */; - mixinOrMixinApplication = aClass; - while (!((mixinOrMixinApplication == GIV(nilObj)) - || ((mixinOrMixinApplication == targetMixin) - || ((longAt((mixinOrMixinApplication + (BaseHeaderSize)) + (MixinIndex << 2))) == targetMixin)))) { - mixinOrMixinApplication = longAt((mixinOrMixinApplication + (BaseHeaderSize)) + (SuperclassIndex << 2)); - } - mixinApplication = mixinOrMixinApplication; + mixinApplication = findApplicationOfTargetMixinstartingAtNonMetaClass(targetMixin, fetchClassOf(enclosingObject)); if (mixinApplication == GIV(nilObj)) { return GIV(nilObj); } @@ -56087,7 +56097,40 @@ 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; + sqInt objOop; + + assert(!((isForwarded(targetMixin)))); + assert(!((isForwarded(aClass)))); + mixinOrMixinApplication = aClass; + while (!((mixinOrMixinApplication == GIV(nilObj)) + || ((mixinOrMixinApplication == targetMixin) + || ((followObjFieldofObject(MixinIndex, mixinOrMixinApplication)) == targetMixin)))) { + /* begin followObjField:ofObject: */ + objOop = longAt((mixinOrMixinApplication + (BaseHeaderSize)) + (SuperclassIndex << 2)); + assert(isNonImmediate(objOop)); + if (((longAt(objOop)) & (0x3FFFFF - 8)) == 0) { + objOop = fixFollowedFieldofObjectwithInitialValue(SuperclassIndex, mixinOrMixinApplication, objOop); + } + mixinOrMixinApplication = objOop; + } + return mixinOrMixinApplication; +} + +static sqInt findClassContainingMethodstartingAt(sqInt meth, sqInt classObj) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt classDict; @@ -58101,7 +58144,6 @@ sqInt objOop2; sqInt objOop3; sqInt objOop4; - sqInt objOop5; sqInt wrapAround;
assert(addressCouldBeClassObj(class)); @@ -58150,12 +58192,12 @@ } if (nextSelector == GIV(messageSelector)) { /* begin followObjField:ofObject: */ - objOop5 = longAt((dictionary + (BaseHeaderSize)) + (MethodArrayIndex << 2)); - assert(isNonImmediate(objOop5)); - if (((longAt(objOop5)) & (0x3FFFFF - 8)) == 0) { - objOop5 = fixFollowedFieldofObjectwithInitialValue(MethodArrayIndex, dictionary, objOop5); + objOop4 = longAt((dictionary + (BaseHeaderSize)) + (MethodArrayIndex << 2)); + assert(isNonImmediate(objOop4)); + if (((longAt(objOop4)) & (0x3FFFFF - 8)) == 0) { + objOop4 = fixFollowedFieldofObjectwithInitialValue(MethodArrayIndex, dictionary, objOop4); } - methodArray = objOop5; + methodArray = objOop4; /* begin followField:ofObject: */ objOop11 = longAt((methodArray + (BaseHeaderSize)) + (index << 2)); if (((objOop11 & 3) == 0) @@ -58181,14 +58223,13 @@ ? (GIV(messageSelector) >> 1) : ((usqInt) (((usqInt)GIV(messageSelector)))) >> 2) : (/* begin hashBitsOf: */ - (objOop4 = GIV(messageSelector)), - (hash = (longAt(objOop4 + 4)) & 0x3FFFFF), + (hash = (longAt(GIV(messageSelector) + 4)) & 0x3FFFFF), (hash == 0 ? ((hash = (newObjectHash()) & 0x3FFFFF), /* begin setHashBitsOf:to: */ flag("endianness"), assert(((hash >= 0) && (hash <= (identityHashHalfWordMask())))), - longAtput(objOop4 + 4, ((((longAt(objOop4 + 4)) | 0x3FFFFF) - 0x3FFFFF)) + hash)) + longAtput(GIV(messageSelector) + 4, ((((longAt(GIV(messageSelector) + 4)) | 0x3FFFFF) - 0x3FFFFF)) + hash)) : 0), hash)))); wrapAround = 0; @@ -58277,7 +58318,6 @@ sqInt objOop4; sqInt objOop5; sqInt objOop6; - sqInt objOop7; sqInt wrapAround1;
currentClass = class; @@ -58352,14 +58392,13 @@ ? (GIV(messageSelector) >> 1) : ((usqInt) (((usqInt)GIV(messageSelector)))) >> 2) : (/* begin hashBitsOf: */ - (objOop7 = GIV(messageSelector)), - (hash = (longAt(objOop7 + 4)) & 0x3FFFFF), + (hash = (longAt(GIV(messageSelector) + 4)) & 0x3FFFFF), (hash == 0 ? ((hash = (newObjectHash()) & 0x3FFFFF), /* begin setHashBitsOf:to: */ flag("endianness"), assert(((hash >= 0) && (hash <= (identityHashHalfWordMask())))), - longAtput(objOop7 + 4, ((((longAt(objOop7 + 4)) | 0x3FFFFF) - 0x3FFFFF)) + hash)) + longAtput(GIV(messageSelector) + 4, ((((longAt(GIV(messageSelector) + 4)) | 0x3FFFFF) - 0x3FFFFF)) + hash)) : 0), hash)))); wrapAround1 = 0;
Modified: branches/Cog/nsspursrc/vm/cointerp.h =================================================================== --- branches/Cog/nsspursrc/vm/cointerp.h 2014-10-13 23:35:34 UTC (rev 3104) +++ branches/Cog/nsspursrc/vm/cointerp.h 2014-10-14 19:54:42 UTC (rev 3105) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.900 uuid: 3d11cf21-4f5f-406a-85ae-ccbc786612a0 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.902 uuid: e97518bb-4f81-470b-9557-6beed90a223c */
@@ -140,6 +140,7 @@ sqInt remember(sqInt objOop); sqInt addGCRoot(sqInt *varLoc); sqInt addressCouldBeObj(sqInt address); +sqInt addressCouldBeOop(sqInt address); sqInt allocatePinnedSlots(sqInt nSlots); sqInt arrayFormat(void); sqInt becomewith(sqInt array1, sqInt array2);
Modified: branches/Cog/nsspursrc/vm/gcc3x-cointerp.c =================================================================== --- branches/Cog/nsspursrc/vm/gcc3x-cointerp.c 2014-10-13 23:35:34 UTC (rev 3104) +++ branches/Cog/nsspursrc/vm/gcc3x-cointerp.c 2014-10-14 19:54:42 UTC (rev 3105) @@ -2,11 +2,11 @@
/* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.900 uuid: 3d11cf21-4f5f-406a-85ae-ccbc786612a0 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.902 uuid: e97518bb-4f81-470b-9557-6beed90a223c from - CoInterpreter VMMaker.oscog-eem.900 uuid: 3d11cf21-4f5f-406a-85ae-ccbc786612a0 + CoInterpreter VMMaker.oscog-eem.902 uuid: e97518bb-4f81-470b-9557-6beed90a223c */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.900 uuid: 3d11cf21-4f5f-406a-85ae-ccbc786612a0 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.902 uuid: e97518bb-4f81-470b-9557-6beed90a223c " __DATE__ ; char *__interpBuildInfo = __buildInfo;
@@ -864,7 +864,7 @@ static void addFreeSubTree(sqInt freeTree) NoDbgRegParms; sqInt addGCRoot(sqInt *varLoc); sqInt addressCouldBeObj(sqInt address); -static sqInt addressCouldBeOop(sqInt address) NoDbgRegParms; +sqInt addressCouldBeOop(sqInt address); static sqInt addToFreeTreebytes(sqInt freeChunk, sqInt chunkBytes) NoDbgRegParms; static sqInt allInstancesOf(sqInt aClass) NoDbgRegParms; static sqInt allObjects(void); @@ -972,6 +972,7 @@ static sqInt followForwardedInObjStackatIndex(sqInt objStack, sqInt objStackRootIndex) NoDbgRegParms; sqInt followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth); sqInt followForwarded(sqInt objOop); +static sqInt followObjFieldofObject(sqInt fieldIndex, sqInt anObject) NoDbgRegParms; sqInt formatMask(void); sqInt formatOfClass(sqInt classPointer); static sqInt formatOf(sqInt objOop) NoDbgRegParms; @@ -1086,6 +1087,7 @@ static sqInt noCheckClassAtIndex(sqInt classIndex) NoDbgRegParms; static sqInt noCheckPushonObjStack(sqInt objOop, sqInt objStack) NoDbgRegParms; static sqInt noFixupFollowFieldofObject(sqInt fieldIndex, sqInt anObject) NoDbgRegParms; +static sqInt noInlineFollowForwarded(sqInt objOop) NoDbgRegParms; sqInt nonIndexablePointerFormat(void); static sqInt noUnscannedEphemerons(void); sqInt numBytesOf(sqInt objOop); @@ -1246,6 +1248,7 @@ sqInt fetchIntegerofObject(sqInt fieldIndex, sqInt objectPointer); 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; @@ -1509,8 +1512,8 @@ _iss usqInt freeStart; _iss sqInt argumentCount; _iss usqInt instructionPointer; +_iss sqInt messageSelector; _iss usqInt newMethod; -_iss sqInt messageSelector; _iss usqInt newSpaceLimit; _iss StackPage * pages; _iss sqInt hiddenRootsObj; @@ -1540,10 +1543,10 @@ _iss StackPage * mostRecentlyUsedPage; _iss sqInt numStackPages; _iss SpurNewSpaceSpace pastSpace; -_iss sqInt classTableFirstPage; _iss sqInt markStack; _iss sqInt numClassTablePages; _iss sqInt profileProcess; +_iss sqInt classTableFirstPage; _iss usqInt oldSpaceStart; _iss SpurNewSpaceSpace futureSpace; _iss sqInt longRunningPrimitiveCheckSemaphore; @@ -2325,7 +2328,7 @@ /*540*/ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /*560*/ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0,-1,-1 }; -const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.900"; +const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.902"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace;
@@ -15053,13 +15056,14 @@
/* frameless method; nothing to activate... */
- - /* dont use and: so as to get Slang to inline cogit numRegArgs > 0 */ + if ((numRegArgs()) > 0) {
- if (((cogMethod->cmNumArgs)) <= (numRegArgs())) { - callRegisterArgCogMethodatreceiver(cogMethod, noCheckEntryOffset(), rcvr); + /* dont use and: so as to get Slang to inline cogit numRegArgs > 0 */ + + if (((cogMethod->cmNumArgs)) <= (numRegArgs())) { + callRegisterArgCogMethodatreceiver(cogMethod, noCheckEntryOffset(), rcvr); + } } - /* begin push: */ object = (((sqInt)cogMethod)) + (noCheckEntryOffset()); longAtput((sp = GIV(stackPointer) - BytesPerWord), object); @@ -18040,13 +18044,14 @@ assertCStackWellAligned(); assert(isMachineCodeFrame(GIV(framePointer))); assertValidExecutionPointersimbarline(longAt(GIV(stackPointer)), GIV(framePointer), GIV(stackPointer), 0, __LINE__); - - /* dont use and: so as to get Slang to inline cogit numRegArgs > 0 */ + if ((numRegArgs()) > 0) {
- if (((cogMethod->cmNumArgs)) <= (numRegArgs())) { - callRegisterArgCogMethodatreceiver(cogMethod, entryOffset(), rcvr); + /* dont use and: so as to get Slang to inline cogit numRegArgs > 0 */ + + if (((cogMethod->cmNumArgs)) <= (numRegArgs())) { + callRegisterArgCogMethodatreceiver(cogMethod, entryOffset(), rcvr); + } } - /* begin push: */ object = (((sqInt)cogMethod)) + (entryOffset()); longAtput((sp = GIV(stackPointer) - BytesPerWord), object); @@ -18083,31 +18088,32 @@ object = (((sqInt)cogMethod)) + (entryOffset()); longAtput((sp1 = GIV(stackPointer) - BytesPerWord), object); GIV(stackPointer) = sp1; - - /* dont use and: so as to get Slang to inline cogit numRegArgs > 0 */ + if ((numRegArgs()) > 0) {
- if (((cogMethod->cmNumArgs)) <= (numRegArgs())) { - /* begin push: */ - longAtput((sp = GIV(stackPointer) - BytesPerWord), cacheTag); - GIV(stackPointer) = sp; - - switch ((cogMethod->cmNumArgs)) { - case 0: - ceCall0ArgsPIC(); - break; - case 1: - ceCall1ArgsPIC(); - break; - case 2: - ceCall2ArgsPIC(); - break; - default: - null; + /* dont use and: so as to get Slang to inline cogit numRegArgs > 0 */
+ if (((cogMethod->cmNumArgs)) <= (numRegArgs())) { + /* begin push: */ + longAtput((sp = GIV(stackPointer) - BytesPerWord), cacheTag); + GIV(stackPointer) = sp; + + switch ((cogMethod->cmNumArgs)) { + case 0: + ceCall0ArgsPIC(); + break; + case 1: + ceCall1ArgsPIC(); + break; + case 2: + ceCall2ArgsPIC(); + break; + default: + null; + + } + error("not reached"); } - error("not reached"); } - /* begin push: */ longAtput((sp2 = GIV(stackPointer) - BytesPerWord), rcvr); GIV(stackPointer) = sp2; @@ -18137,13 +18143,14 @@ assertCStackWellAligned(); assert(isMachineCodeFrame(GIV(framePointer))); assertValidExecutionPointersimbarline(longAt(GIV(stackPointer)), GIV(framePointer), GIV(stackPointer), 0, __LINE__); - - /* dont use and: so as to get Slang to inline cogit numRegArgs > 0 */ + if ((numRegArgs()) > 0) {
- if (((cogMethod->cmNumArgs)) <= (numRegArgs())) { - callRegisterArgCogMethodatreceiver(cogMethod, noCheckEntryOffset(), rcvr); + /* dont use and: so as to get Slang to inline cogit numRegArgs > 0 */ + + if (((cogMethod->cmNumArgs)) <= (numRegArgs())) { + callRegisterArgCogMethodatreceiver(cogMethod, noCheckEntryOffset(), rcvr); + } } - /* begin push: */ object = (((sqInt)cogMethod)) + (noCheckEntryOffset()); longAtput((sp = GIV(stackPointer) - BytesPerWord), object); @@ -19033,9 +19040,7 @@ sqInt implicitReceiverFormixinimplementing(sqInt rcvr, sqInt mixin, sqInt selector) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt aClass; - sqInt classIndex; - sqInt classTablePage; + sqInt anObject; sqInt dictionary; sqInt dictionary1; sqInt found; @@ -19052,9 +19057,9 @@ sqInt mask1; sqInt methodArray; sqInt methodArray1; + sqInt mixin1; sqInt mixinApplication; sqInt mixinApplication1; - sqInt mixinOrMixinApplication; sqInt nextSelector; sqInt nextSelector1; usqInt numSlots; @@ -19065,13 +19070,16 @@ sqInt objOop12; sqInt objOop2; sqInt objOop21; + sqInt objOop22; sqInt objOop3; sqInt objOop31; + sqInt objOop32; sqInt objOop4; - sqInt objOop41; sqInt objOop5; sqInt objOop6; - sqInt tagBits; + sqInt objOop7; + sqInt objOop8; + sqInt objOop9; sqInt targetMixin; sqInt theMixin; sqInt theMixin1; @@ -19082,21 +19090,23 @@ /* begin sendBreakpoint:receiver: */ sendBreakpointreceiver(firstFixedFieldOfMaybeImmediate(selector), lengthOfMaybeImmediate(selector), null); } - - /* messageSelector is an implicit parameter of lookupMethodInDictionary: */ - - GIV(messageSelector) = selector; + assert(!((isOopForwarded(rcvr)))); + assert(!((isForwarded(mixin)))); + GIV(messageSelector) = (((selector & 3) == 0) + && (((longAt(selector)) & 0x3FFFFF) == 8) + ? noInlineFollowForwarded(selector) + : selector); mixinApplication = findApplicationOfTargetMixinstartingAtBehavior(mixin, fetchClassOf(rcvr)); if (mixinApplication == GIV(nilObj)) { return rcvr; } /* begin followObjField:ofObject: */ - objOop = longAt((mixinApplication + (BaseHeaderSize)) + (MethodDictionaryIndex << 2)); - assert(isNonImmediate(objOop)); - if (((longAt(objOop)) & (0x3FFFFF - 8)) == 0) { - objOop = fixFollowedFieldofObjectwithInitialValue(MethodDictionaryIndex, mixinApplication, objOop); + objOop7 = longAt((mixinApplication + (BaseHeaderSize)) + (MethodDictionaryIndex << 2)); + assert(isNonImmediate(objOop7)); + if (((longAt(objOop7)) & (0x3FFFFF - 8)) == 0) { + objOop7 = fixFollowedFieldofObjectwithInitialValue(MethodDictionaryIndex, mixinApplication, objOop7); } - dictionary = objOop; + dictionary = objOop7; /* begin lookupMethodInDictionary: */ /* begin numSlotsOf: */ flag("endianness"); @@ -19122,12 +19132,12 @@ } if (nextSelector1 == GIV(messageSelector)) { /* begin followObjField:ofObject: */ - objOop6 = longAt((dictionary + (BaseHeaderSize)) + (MethodArrayIndex << 2)); - assert(isNonImmediate(objOop6)); - if (((longAt(objOop6)) & (0x3FFFFF - 8)) == 0) { - objOop6 = fixFollowedFieldofObjectwithInitialValue(MethodArrayIndex, dictionary, objOop6); + objOop9 = longAt((dictionary + (BaseHeaderSize)) + (MethodArrayIndex << 2)); + assert(isNonImmediate(objOop9)); + if (((longAt(objOop9)) & (0x3FFFFF - 8)) == 0) { + objOop9 = fixFollowedFieldofObjectwithInitialValue(MethodArrayIndex, dictionary, objOop9); } - methodArray1 = objOop6; + methodArray1 = objOop9; /* begin followField:ofObject: */ objOop12 = longAt((methodArray1 + (BaseHeaderSize)) + (index1 << 2)); if (((objOop12 & 3) == 0) @@ -19136,12 +19146,12 @@ } GIV(newMethod) = ((sqInt) objOop12); found = 1; - goto l4; + goto l3; } index1 += 1; } found = 0; - goto l4; + goto l3; }
/* It is assumed that there are some nils in this dictionary, and search will @@ -19153,14 +19163,13 @@ ? (GIV(messageSelector) >> 1) : ((usqInt) (((usqInt)GIV(messageSelector)))) >> 2) : (/* begin hashBitsOf: */ - (objOop41 = GIV(messageSelector)), - (hash1 = (longAt(objOop41 + 4)) & 0x3FFFFF), + (hash1 = (longAt(GIV(messageSelector) + 4)) & 0x3FFFFF), (hash1 == 0 ? ((hash1 = (newObjectHash()) & 0x3FFFFF), /* begin setHashBitsOf:to: */ flag("endianness"), assert(((hash1 >= 0) && (hash1 <= (identityHashHalfWordMask())))), - longAtput(objOop41 + 4, ((((longAt(objOop41 + 4)) | 0x3FFFFF) - 0x3FFFFF)) + hash1)) + longAtput(GIV(messageSelector) + 4, ((((longAt(GIV(messageSelector) + 4)) | 0x3FFFFF) - 0x3FFFFF)) + hash1)) : 0), hash1)))); wrapAround1 = 0; @@ -19168,7 +19177,7 @@ nextSelector1 = longAt((dictionary + (BaseHeaderSize)) + (index1 << 2)); if (nextSelector1 == GIV(nilObj)) { found = 0; - goto l4; + goto l3; } if (((nextSelector1 & 3) == 0) && (((longAt(nextSelector1)) & 0x3FFFFF) == 8)) { @@ -19176,39 +19185,61 @@ } if (nextSelector1 == GIV(messageSelector)) { /* begin followObjField:ofObject: */ - objOop21 = longAt((dictionary + (BaseHeaderSize)) + (MethodArrayIndex << 2)); - assert(isNonImmediate(objOop21)); - if (((longAt(objOop21)) & (0x3FFFFF - 8)) == 0) { - objOop21 = fixFollowedFieldofObjectwithInitialValue(MethodArrayIndex, dictionary, objOop21); + objOop22 = longAt((dictionary + (BaseHeaderSize)) + (MethodArrayIndex << 2)); + assert(isNonImmediate(objOop22)); + if (((longAt(objOop22)) & (0x3FFFFF - 8)) == 0) { + objOop22 = fixFollowedFieldofObjectwithInitialValue(MethodArrayIndex, dictionary, objOop22); } - methodArray1 = objOop21; + methodArray1 = objOop22; /* begin followField:ofObject: */ - objOop31 = longAt((methodArray1 + (BaseHeaderSize)) + ((index1 - SelectorStart) << 2)); - if (((objOop31 & 3) == 0) - && (((longAt(objOop31)) & 0x3FFFFF) == 8)) { - objOop31 = fixFollowedFieldofObjectwithInitialValue(index1 - SelectorStart, methodArray1, objOop31); + objOop32 = longAt((methodArray1 + (BaseHeaderSize)) + ((index1 - SelectorStart) << 2)); + if (((objOop32 & 3) == 0) + && (((longAt(objOop32)) & 0x3FFFFF) == 8)) { + objOop32 = fixFollowedFieldofObjectwithInitialValue(index1 - SelectorStart, methodArray1, objOop32); } - GIV(newMethod) = ((sqInt) objOop31); + GIV(newMethod) = ((sqInt) objOop32); found = 1; - goto l4; + goto l3; } index1 += 1; if (index1 == length1) { if (wrapAround1) { found = 0; - goto l4; + goto l3; } wrapAround1 = 1; index1 = SelectorStart; } } found = 0; -l4: /* end lookupMethodInDictionary: */; +l3: /* end lookupMethodInDictionary: */; if (!found) { - theMixin = longAt((mixinApplication + (BaseHeaderSize)) + (MixinIndex << 2)); + /* begin followObjField:ofObject: */ + objOop4 = longAt((mixinApplication + (BaseHeaderSize)) + (MixinIndex << 2)); + assert(isNonImmediate(objOop4)); + if (((longAt(objOop4)) & (0x3FFFFF - 8)) == 0) { + objOop4 = fixFollowedFieldofObjectwithInitialValue(MixinIndex, mixinApplication, objOop4); + } + theMixin = objOop4; /* begin nextImplicitReceiverFor:withMixin: */ - implicitReceiver = longAt((mixinApplication + (BaseHeaderSize)) + (EnclosingObjectIndex << 2)); - targetMixin = longAt((theMixin + (BaseHeaderSize)) + (EnclosingMixinIndex << 2)); + /* begin followObjField:ofObject: */ + objOop5 = longAt((mixinApplication + (BaseHeaderSize)) + (EnclosingObjectIndex << 2)); + assert(isNonImmediate(objOop5)); + if (((longAt(objOop5)) & (0x3FFFFF - 8)) == 0) { + objOop5 = fixFollowedFieldofObjectwithInitialValue(EnclosingObjectIndex, mixinApplication, objOop5); + } + anObject = objOop5; + /* begin followObjField:ofObject: */ + objOop6 = longAt((theMixin + (BaseHeaderSize)) + (EnclosingMixinIndex << 2)); + assert(isNonImmediate(objOop6)); + if (((longAt(objOop6)) & (0x3FFFFF - 8)) == 0) { + objOop6 = fixFollowedFieldofObjectwithInitialValue(EnclosingMixinIndex, theMixin, objOop6); + } + mixin1 = objOop6; + assert(!((isOopForwarded(anObject)))); + assert(!((isForwarded(mixin1)))); + implicitReceiver = anObject; + targetMixin = mixin1; while (1) { if (targetMixin == GIV(nilObj)) {
@@ -19217,53 +19248,18 @@ implicitReceiverOrNil = GIV(nilObj); goto l1; } - /* begin findApplicationOfTargetMixin:startingAtNonMetaClass: */ - /* begin fetchClassOf: */ - if (((tagBits = implicitReceiver & 3)) != 0) { - aClass = longAt((GIV(classTableFirstPage) + (BaseHeaderSize)) + (tagBits << 2)); - goto l2; - } - /* begin fetchClassOfNonImm: */ - classIndex = (longAt(implicitReceiver)) & 0x3FFFFF; - if (classIndex <= 0x1F) { - if (classIndex == 0x1F) { - aClass = implicitReceiver; - goto l2; - } - if (classIndex == 8) { - aClass = GIV(nilObj); - goto l2; - } - } - assert(classIndex >= (arrayClassIndexPun())); - /* begin classOrNilAtIndex: */ - assert((classIndex <= (tagMask())) - || (classIndex >= (arrayClassIndexPun()))); - classTablePage = longAt((GIV(hiddenRootsObj) + (BaseHeaderSize)) + ((((usqInt) classIndex) >> 10) << 2)); - if (classTablePage == GIV(nilObj)) { - aClass = GIV(nilObj); - goto l2; - } - aClass = longAt((classTablePage + (BaseHeaderSize)) + ((classIndex & ((1 << 10) - 1)) << 2)); - l2: /* end fetchClassOf: */; - mixinOrMixinApplication = aClass; - while (!((mixinOrMixinApplication == GIV(nilObj)) - || ((mixinOrMixinApplication == targetMixin) - || ((longAt((mixinOrMixinApplication + (BaseHeaderSize)) + (MixinIndex << 2))) == targetMixin)))) { - mixinOrMixinApplication = longAt((mixinOrMixinApplication + (BaseHeaderSize)) + (SuperclassIndex << 2)); - } - mixinApplication1 = mixinOrMixinApplication; + mixinApplication1 = findApplicationOfTargetMixinstartingAtNonMetaClass(targetMixin, fetchClassOf(implicitReceiver)); if (mixinApplication1 == GIV(nilObj)) { implicitReceiverOrNil = GIV(nilObj); goto l1; } /* begin followObjField:ofObject: */ - objOop1 = longAt((mixinApplication1 + (BaseHeaderSize)) + (MethodDictionaryIndex << 2)); - assert(isNonImmediate(objOop1)); - if (((longAt(objOop1)) & (0x3FFFFF - 8)) == 0) { - objOop1 = fixFollowedFieldofObjectwithInitialValue(MethodDictionaryIndex, mixinApplication1, objOop1); + objOop = longAt((mixinApplication1 + (BaseHeaderSize)) + (MethodDictionaryIndex << 2)); + assert(isNonImmediate(objOop)); + if (((longAt(objOop)) & (0x3FFFFF - 8)) == 0) { + objOop = fixFollowedFieldofObjectwithInitialValue(MethodDictionaryIndex, mixinApplication1, objOop); } - dictionary1 = objOop1; + dictionary1 = objOop; /* begin lookupMethodInDictionary: */ /* begin numSlotsOf: */ flag("endianness"); @@ -19289,12 +19285,12 @@ } if (nextSelector == GIV(messageSelector)) { /* begin followObjField:ofObject: */ - objOop5 = longAt((dictionary1 + (BaseHeaderSize)) + (MethodArrayIndex << 2)); - assert(isNonImmediate(objOop5)); - if (((longAt(objOop5)) & (0x3FFFFF - 8)) == 0) { - objOop5 = fixFollowedFieldofObjectwithInitialValue(MethodArrayIndex, dictionary1, objOop5); + objOop8 = longAt((dictionary1 + (BaseHeaderSize)) + (MethodArrayIndex << 2)); + assert(isNonImmediate(objOop8)); + if (((longAt(objOop8)) & (0x3FFFFF - 8)) == 0) {
@@ Diff output truncated at 50000 characters. @@
vm-dev@lists.squeakfoundation.org