Revision: 3544 Author: eliot Date: 2015-12-17 09:50:55 -0800 (Thu, 17 Dec 2015) Log Message: ----------- CogVM source as per VMMaker.oscog-eem.1608
Cogit: Implement identifyingPredefinedMacros and therefore start generating C for MIPSEL alongside IA32 and ARMv5 (!!)
Nuke incorrect uses of signedIntToLong on the results of callTargetFromReturnAddress:
Refactor genLookupForPerformNumArgs: along the same lines as compileOpenPIC:numArgs: to use a base reg to access the method dict when outside the MoveMw:r:R: offset range.
generateCaptureCStackPointers: must establish the VarBaseReg before accessing any of the stack pointer variables.
x86 Cogit: Fix order of cmp in ArithCwR. Extend var base range to 1Mb Fix stupidities in concretize[Call|Jump]Full (move absolute value, not value referenced by absolute address). Fix REX byte slip in concretizeMoveCwR.
Subversion: add more svn:ignore properties
Modified Paths: -------------- branches/Cog/nsspursrc/vm/cogit.c branches/Cog/nsspursrc/vm/cogit.h branches/Cog/nsspursrc/vm/cogitARMv5.c branches/Cog/nsspursrc/vm/cogitIA32.c branches/Cog/spur64src/vm/cogit.h branches/Cog/spur64src/vm/cogitX64.c branches/Cog/spursistasrc/vm/cogit.c branches/Cog/spursistasrc/vm/cogit.h branches/Cog/spursistasrc/vm/cogitARMv5.c branches/Cog/spursistasrc/vm/cogitIA32.c branches/Cog/spursrc/vm/cogit.c branches/Cog/spursrc/vm/cogit.h branches/Cog/spursrc/vm/cogitARMv5.c branches/Cog/spursrc/vm/cogitIA32.c branches/Cog/src/vm/cogit.c branches/Cog/src/vm/cogit.h branches/Cog/src/vm/cogitARMv5.c branches/Cog/src/vm/cogitIA32.c
Added Paths: ----------- branches/Cog/nsspursrc/vm/cogitMIPSEL.c branches/Cog/spursistasrc/vm/cogitMIPSEL.c branches/Cog/spursrc/vm/cogitMIPSEL.c branches/Cog/src/vm/cogitMIPSEL.c
Property Changed: ---------------- branches/Cog/build.macos64x64/gdbarm32/ branches/Cog/build.macos64x64/squeak.cog.spur/SqueakCogSpur32x86.xcodeproj/ branches/Cog/image/ branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
Property changes on: branches/Cog/build.macos64x64/gdbarm32 ___________________________________________________________________ Added: svn:ignore + bfd libiberty opcodes sim zlib
Property changes on: branches/Cog/build.macos64x64/squeak.cog.spur/SqueakCogSpur32x86.xcodeproj ___________________________________________________________________ Added: svn:ignore + *.pbxuser *.mode1v3
Property changes on: branches/Cog/image ___________________________________________________________________ Modified: svn:ignore - CogVMMaker* *-14.23.2987.* coglinux* cogwin Cog.app cogspurlinux* cogspurwin CogSpur.app Squeak-4.5-All-in-One.* SqueakDebug.log SqueakV41.sources __MACOSX crash.dmp package-cache prefs special-dirs
+ *.image *.changes *.tgz coglinux* cogwin Cog.app cogspurlinux* cogspurwin CogSpur.app Squeak-*-All-in-One.* SqueakDebug.log SqueakV41.sources __MACOSX crash.dmp package-cache prefs special-dirs
Modified: branches/Cog/nsspursrc/vm/cogit.c =================================================================== --- branches/Cog/nsspursrc/vm/cogit.c 2015-12-17 00:52:47 UTC (rev 3543) +++ branches/Cog/nsspursrc/vm/cogit.c 2015-12-17 17:50:55 UTC (rev 3544) @@ -1,5 +1,5 @@ /* Automatically generated by - Cogit VMMaker.oscog-eem.1580 uuid: 2b856f5e-e0b4-44bb-b23d-07561132f8c8 + Cogit VMMaker.oscog-eem.1608 uuid: bf1e1bd4-7dd4-47e2-bb33-3a988cc4c276 */
#if defined(__ARM_ARCH__) || defined(__arm__) || defined(__arm32__) || defined(ARM32) || defined(_M_ARM) @@ -10,6 +10,10 @@
# include "cogitIA32.c"
+#elif defined(__MIPSEL__) + +# include "cogitMIPSEL.c" + #else # error As yet no Cogit implementation appears to exist for your platform. # error Consider implementing it, starting by adding a subclass of CogAbstractInstruction.
Modified: branches/Cog/nsspursrc/vm/cogit.h =================================================================== --- branches/Cog/nsspursrc/vm/cogit.h 2015-12-17 00:52:47 UTC (rev 3543) +++ branches/Cog/nsspursrc/vm/cogit.h 2015-12-17 17:50:55 UTC (rev 3544) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.1602 uuid: 16ff1141-4cce-41a9-a9f5-742da38970ef + CCodeGenerator VMMaker.oscog-eem.1608 uuid: bf1e1bd4-7dd4-47e2-bb33-3a988cc4c276 */
Modified: branches/Cog/nsspursrc/vm/cogitARMv5.c =================================================================== --- branches/Cog/nsspursrc/vm/cogitARMv5.c 2015-12-17 00:52:47 UTC (rev 3543) +++ branches/Cog/nsspursrc/vm/cogitARMv5.c 2015-12-17 17:50:55 UTC (rev 3544) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.1602 uuid: 16ff1141-4cce-41a9-a9f5-742da38970ef + CCodeGenerator VMMaker.oscog-eem.1608 uuid: bf1e1bd4-7dd4-47e2-bb33-3a988cc4c276 from - StackToRegisterMappingCogit VMMaker.oscog-eem.1602 uuid: 16ff1141-4cce-41a9-a9f5-742da38970ef + StackToRegisterMappingCogit VMMaker.oscog-eem.1608 uuid: bf1e1bd4-7dd4-47e2-bb33-3a988cc4c276 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1602 uuid: 16ff1141-4cce-41a9-a9f5-742da38970ef " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1608 uuid: bf1e1bd4-7dd4-47e2-bb33-3a988cc4c276 " __DATE__ ; char *__cogitBuildInfo = __buildInfo;
@@ -897,7 +897,7 @@ static sqInt NoDbgRegParms genGetClassIndexOfNonImminto(sqInt sourceReg, sqInt destReg); static sqInt NoDbgRegParms genGetClassObjectOfClassIndexintoscratchReg(sqInt instReg, sqInt destReg, sqInt scratchReg); static sqInt NoDbgRegParms genGetClassObjectOfintoscratchReginstRegIsReceiver(sqInt instReg, sqInt destReg, sqInt scratchReg, sqInt instRegIsReceiver); -static AbstractInstruction * NoDbgRegParms genGetClassTagOfintoscratchReg(sqInt instReg, sqInt destReg, sqInt scratchReg); +static sqInt NoDbgRegParms genGetClassTagOfintoscratchReg(sqInt instReg, sqInt destReg, sqInt scratchReg); static sqInt NoDbgRegParms genGetCompactClassIndexNonImmOfinto(sqInt instReg, sqInt destReg); static sqInt NoDbgRegParms genGetDoubleValueOfinto(sqInt srcReg, sqInt destFPReg); static sqInt NoDbgRegParms genGetFormatOfinto(sqInt srcReg, sqInt destReg); @@ -975,6 +975,7 @@ static sqInt NoDbgRegParms compileInterpreterPrimitive(void (*primitiveRoutine)(void)); static AbstractInstruction * NoDbgRegParms compileOpenPICMethodCacheProbeForwithShiftbaseRegOrNone(sqInt selector, sqInt shift, sqInt baseRegOrNone); static void NoDbgRegParms compileOpenPICnumArgs(sqInt selector, sqInt numArgs); +static AbstractInstruction * NoDbgRegParms compilePerformMethodCacheProbeForwithShiftbaseRegOrNone(sqInt selectorReg, sqInt shift, sqInt baseRegOrNone); static sqInt extendedPushBytecode(void); static sqInt extendedStoreAndPopBytecode(void); static sqInt extendedStoreBytecode(void); @@ -1013,7 +1014,7 @@ static sqInt genLongUnconditionalBackwardJump(void); static sqInt genLongUnconditionalForwardJump(void); static sqInt NoDbgRegParms genLookupForPerformNumArgs(sqInt numArgs); -static AbstractInstruction * NoDbgRegParms genMoveFalseR(sqInt reg); +static AbstractInstruction * NoDbgRegParms genMoveConstantR(sqInt constant, sqInt reg); static AbstractInstruction * NoDbgRegParms genMoveTrueR(sqInt reg); static sqInt NoDbgRegParms genMustBeBooleanTrampolineForcalled(sqInt boolean, char *trampolineName); static sqInt genPrimitiveEqual(void); @@ -3335,8 +3336,8 @@ sqInt index1; sqInt index2; sqInt index3; - sqInt instrOffset; - usqInt instrOffset1; + usqInt instrOffset; + sqInt instrOffset1; sqInt instrOffset10; sqInt instrOffset11; sqInt instrOffset12; @@ -3346,22 +3347,22 @@ sqInt instrOffset16; sqInt instrOffset17; sqInt instrOffset18; - sqInt instrOffset19; + usqInt instrOffset19; sqInt instrOffset2; sqInt instrOffset20; - usqInt instrOffset21; - sqInt instrOffset22; + sqInt instrOffset21; + usqInt instrOffset22; usqInt instrOffset23; sqInt instrOffset24; - usqInt instrOffset25; + sqInt instrOffset25; sqInt instrOffset26; sqInt instrOffset27; sqInt instrOffset28; - sqInt instrOffset3; - usqInt instrOffset4; + usqInt instrOffset3; + sqInt instrOffset4; sqInt instrOffset5; sqInt instrOffset6; - usqInt instrOffset7; + sqInt instrOffset7; sqInt instrOffset8; sqInt instrOffset9; sqInt invert; @@ -3694,7 +3695,7 @@ ? 1 : 0), abs(((((self_in_dispatchConcretize->dependent))->address)) - (((self_in_dispatchConcretize->address)) + 8))); ((self_in_dispatchConcretize->machineCode))[0 / 4] = aWord43; - instrOffset7 = ((self_in_dispatchConcretize->machineCodeSize) = 4); + instrOffset7 = ((usqInt) (((self_in_dispatchConcretize->machineCodeSize) = 4))); /* begin machineCodeAt:put: */ ((self_in_dispatchConcretize->machineCode))[instrOffset7 / 4] = ((AL << 28) | ((19922704 | ((0 & 1) << 5)) | ConcreteIPReg)); ((self_in_dispatchConcretize->machineCodeSize) = instrOffset7 + 4); @@ -5106,7 +5107,7 @@ ? 1 : 0), abs(((((self_in_dispatchConcretize->dependent))->address)) - (((self_in_dispatchConcretize->address)) + 8))); ((self_in_dispatchConcretize->machineCode))[0 / 4] = aWord35; - instrOffset = ((usqInt) (((self_in_dispatchConcretize->machineCodeSize) = 4))); + instrOffset = ((self_in_dispatchConcretize->machineCodeSize) = 4); /* begin machineCodeAt:put: */ aWord17 = addrnrm(self_in_dispatchConcretize, destReg, srcReg1, ConcreteIPReg); ((self_in_dispatchConcretize->machineCode))[16 / 4] = aWord17; @@ -5295,7 +5296,7 @@ ? 1 : 0), abs(((((self_in_dispatchConcretize->dependent))->address)) - (((self_in_dispatchConcretize->address)) + 8))); ((self_in_dispatchConcretize->machineCode))[0 / 4] = aWord210; - instrOffset19 = ((usqInt) (((self_in_dispatchConcretize->machineCodeSize) = 4))); + instrOffset19 = ((self_in_dispatchConcretize->machineCodeSize) = 4); /* begin machineCodeAt:put: */ aWord119 = ldrrnplusImm(self_in_dispatchConcretize, destReg10, ConcreteIPReg, 0); ((self_in_dispatchConcretize->machineCode))[instrOffset19 / 4] = aWord119; @@ -5351,7 +5352,7 @@ ? 1 : 0), abs(((((self_in_dispatchConcretize->dependent))->address)) - (((self_in_dispatchConcretize->address)) + 8))); ((self_in_dispatchConcretize->machineCode))[0 / 4] = aWord212; - instrOffset21 = ((self_in_dispatchConcretize->machineCodeSize) = 4); + instrOffset21 = ((usqInt) (((self_in_dispatchConcretize->machineCodeSize) = 4))); /* begin machineCodeAt:put: */ aWord121 = ldrbrnplusimm(self_in_dispatchConcretize, destReg11, ConcreteIPReg, 1, 0); ((self_in_dispatchConcretize->machineCode))[instrOffset21 / 4] = aWord121; @@ -5379,7 +5380,7 @@ ? 1 : 0), abs(((((self_in_dispatchConcretize->dependent))->address)) - (((self_in_dispatchConcretize->address)) + 8))); ((self_in_dispatchConcretize->machineCode))[0 / 4] = aWord213; - instrOffset22 = ((usqInt) (((self_in_dispatchConcretize->machineCodeSize) = 4))); + instrOffset22 = ((self_in_dispatchConcretize->machineCodeSize) = 4); /* begin machineCodeAt:put: */ aWord122 = strbrnplusimm(self_in_dispatchConcretize, srcReg16, ConcreteIPReg, 1, 0); ((self_in_dispatchConcretize->machineCode))[instrOffset22 / 4] = aWord122; @@ -5542,7 +5543,7 @@ ? 1 : 0), abs(((((self_in_dispatchConcretize->dependent))->address)) - (((self_in_dispatchConcretize->address)) + 8))); ((self_in_dispatchConcretize->machineCode))[0 / 4] = aWord37; - instrOffset1 = ((self_in_dispatchConcretize->machineCodeSize) = 4); + instrOffset1 = ((usqInt) (((self_in_dispatchConcretize->machineCodeSize) = 4))); /* begin machineCodeAt:put: */ aWord110 = ldrhrnrm(self_in_dispatchConcretize, destReg2, srcReg3, ConcreteIPReg); ((self_in_dispatchConcretize->machineCode))[instrOffset1 / 4] = aWord110; @@ -5711,7 +5712,7 @@ ? 1 : 0), abs(((((self_in_dispatchConcretize->dependent))->address)) - (((self_in_dispatchConcretize->address)) + 8))); ((self_in_dispatchConcretize->machineCode))[0 / 4] = aWord39; - instrOffset3 = ((usqInt) (((self_in_dispatchConcretize->machineCodeSize) = 4))); + instrOffset3 = ((self_in_dispatchConcretize->machineCodeSize) = 4); /* begin machineCodeAt:put: */ aWord112 = strrnrm(self_in_dispatchConcretize, srcReg6, baseReg, ConcreteIPReg); ((self_in_dispatchConcretize->machineCode))[instrOffset3 / 4] = aWord112; @@ -5801,7 +5802,7 @@ ? 1 : 0), abs(((((self_in_dispatchConcretize->dependent))->address)) - (((self_in_dispatchConcretize->address)) + 8))); ((self_in_dispatchConcretize->machineCode))[0 / 4] = aWord40; - instrOffset4 = ((self_in_dispatchConcretize->machineCodeSize) = 4); + instrOffset4 = ((usqInt) (((self_in_dispatchConcretize->machineCodeSize) = 4)));
l12: /* end rotateable8bitBitwiseImmediate:ifTrue:ifFalse: */; /* begin machineCodeAt:put: */ @@ -5884,7 +5885,7 @@ ? 1 : 0), abs(((((self_in_dispatchConcretize->dependent))->address)) - (((self_in_dispatchConcretize->address)) + 8))); ((self_in_dispatchConcretize->machineCode))[0 / 4] = aWord125; - instrOffset25 = ((self_in_dispatchConcretize->machineCodeSize) = 4); + instrOffset25 = ((usqInt) (((self_in_dispatchConcretize->machineCodeSize) = 4))); /* begin machineCodeAt:put: */ ((self_in_dispatchConcretize->machineCode))[instrOffset25 / 4] = (4115722240UL | ((ConcreteIPReg << 16) | ((1 << 23) | 0))); ((self_in_dispatchConcretize->machineCodeSize) = instrOffset25 + 4); @@ -7163,7 +7164,7 @@ assert((instructionIsB(self_in_rewriteTransferAttarget, instr)) || (instructionIsBL(self_in_rewriteTransferAttarget, instr))); longAtput(callSiteReturnAddress - 4, (instr & 0xFF000000UL) | ((callDistance / 4) & 0xFFFFFF)); - assert((((usqInt) (callTargetFromReturnAddress(self_in_rewriteTransferAttarget, callSiteReturnAddress)))) == callTargetAddress); + assert((callTargetFromReturnAddress(self_in_rewriteTransferAttarget, callSiteReturnAddress)) == callTargetAddress); return 4; }
@@ -10527,6 +10528,7 @@ zeroOpcodeIndex(); labelCounter = 0; startAddress = methodZoneBase; + maybeEstablishVarBase(backEnd); if (captureFramePointer) { /* begin MoveR:Aw: */ address = cFramePointerAddress(); @@ -10765,14 +10767,14 @@ generateMapAtstart(sqInt addressOrNull, sqInt startAddress) { unsigned char annotation; - usqInt delta; + sqInt delta; sqInt i; AbstractInstruction *instruction; sqInt length; - usqInt location; - usqInt mapEntry; + sqInt location; + sqInt mapEntry; sqInt maxDelta; - usqInt mcpc; + sqInt mcpc;
length = 0; location = startAddress; @@ -16374,7 +16376,7 @@ AbstractInstruction * jumpIsCompiledMethod; AbstractInstruction *jumpIsContext; AbstractInstruction *jumpNegative; - sqInt jumpNonSmallIntegerValue; + AbstractInstruction * jumpNonSmallIntegerValue; AbstractInstruction *jumpNotIndexableBits; AbstractInstruction *jumpNotIndexablePointers; AbstractInstruction * jumpNotPointers; @@ -19338,7 +19340,7 @@ }
/* CogObjectRepresentationForSpur>>#genGetClassTagOf:into:scratchReg: */ -static AbstractInstruction * NoDbgRegParms +static sqInt NoDbgRegParms genGetClassTagOfintoscratchReg(sqInt instReg, sqInt destReg, sqInt scratchReg) { return genGetInlineCacheClassTagFromintoforEntry(instReg, destReg, 1); @@ -19552,7 +19554,7 @@ } /* begin RetN: */ genoperand(RetN, retNoffset); - jmpTarget(jumpCmp, genMoveFalseR(ReceiverResultReg)); + jmpTarget(jumpCmp, genMoveConstantR(falseObject(), ReceiverResultReg)); /* begin RetN: */ genoperand(RetN, retNoffset); return 0; @@ -21961,8 +21963,8 @@ }
-/* Compile one method cache probe in an OpenPIC's lookup of selector. Answer - the jump taken if the selector probe fails. */ +/* Compile one method cache probe in an OpenPIC's lookup of selector. + Answer the jump taken if the selector probe fails. */
/* SimpleStackBasedCogit>>#compileOpenPICMethodCacheProbeFor:withShift:baseRegOrNone: */ static AbstractInstruction * NoDbgRegParms @@ -22097,6 +22099,79 @@ compileCallFornumArgsargargargargresultRegsaveRegs(ceSendFromInLineCacheMiss, 1, SendNumArgsReg, null, null, null, NoReg, 0); }
+ +/* Compile one method cache probe in a perform: primitive's lookup of + selector. Answer the jump taken if the selector probe fails. */ + + /* SimpleStackBasedCogit>>#compilePerformMethodCacheProbeFor:withShift:baseRegOrNone: */ +static AbstractInstruction * NoDbgRegParms +compilePerformMethodCacheProbeForwithShiftbaseRegOrNone(sqInt selectorReg, sqInt shift, sqInt baseRegOrNone) +{ + AbstractInstruction *anInstruction; + AbstractInstruction *anInstruction1; + AbstractInstruction *anInstruction2; + AbstractInstruction *anInstruction3; + AbstractInstruction *anInstruction4; + AbstractInstruction *jumpSelectorMiss; + sqInt offset; + sqInt offset1; + + /* begin MoveR:R: */ + genoperandoperand(MoveRR, SendNumArgsReg, ClassReg); + /* begin XorR:R: */ + genoperandoperand(XorRR, selectorReg, ClassReg); + if ((shiftForWord()) > shift) { + /* begin LogicalShiftLeftCq:R: */ + genoperandoperand(LogicalShiftLeftCqR, (shiftForWord()) - shift, ClassReg); + } + /* begin AndCq:R: */ + anInstruction = genoperandoperand(AndCqR, MethodCacheMask << (shiftForWord()), ClassReg); + if (usesOutOfLineLiteral(anInstruction)) { + (anInstruction->dependent = locateLiteral(MethodCacheMask << (shiftForWord()))); + } + if (baseRegOrNone == NoReg) { + /* begin MoveMw:r:R: */ + offset = (((usqInt)(methodCacheAddress()))) + (MethodCacheSelector << (shiftForWord())); + /* begin gen:quickConstant:operand:operand: */ + anInstruction1 = genoperandoperandoperand(MoveMwrR, offset, ClassReg, TempReg); + if (usesOutOfLineLiteral(anInstruction1)) { + (anInstruction1->dependent = locateLiteral(offset)); + } + } + else { + /* begin AddR:R: */ + genoperandoperand(AddRR, baseRegOrNone, ClassReg); + /* begin MoveMw:r:R: */ + anInstruction2 = genoperandoperandoperand(MoveMwrR, MethodCacheSelector << (shiftForWord()), ClassReg, TempReg); + if (usesOutOfLineLiteral(anInstruction2)) { + (anInstruction2->dependent = locateLiteral(MethodCacheSelector << (shiftForWord()))); + } + } + /* begin CmpR:R: */ + genoperandoperand(CmpRR, selectorReg, TempReg); + /* begin JumpNonZero: */ + jumpSelectorMiss = genConditionalBranchoperand(JumpNonZero, ((sqInt)0)); + if (baseRegOrNone == NoReg) { + /* begin MoveMw:r:R: */ + offset1 = (((usqInt)(methodCacheAddress()))) + (MethodCacheClass << (shiftForWord())); + /* begin gen:quickConstant:operand:operand: */ + anInstruction3 = genoperandoperandoperand(MoveMwrR, offset1, ClassReg, TempReg); + if (usesOutOfLineLiteral(anInstruction3)) { + (anInstruction3->dependent = locateLiteral(offset1)); + } + } + else { + /* begin MoveMw:r:R: */ + anInstruction4 = genoperandoperandoperand(MoveMwrR, MethodCacheClass << (shiftForWord()), ClassReg, TempReg); + if (usesOutOfLineLiteral(anInstruction4)) { + (anInstruction4->dependent = locateLiteral(MethodCacheClass << (shiftForWord()))); + } + } + /* begin CmpR:R: */ + genoperandoperand(CmpRR, SendNumArgsReg, TempReg); + return jumpSelectorMiss; +} + /* SimpleStackBasedCogit>>#extendedPushBytecode */ static sqInt extendedPushBytecode(void) @@ -22779,165 +22854,65 @@ { AbstractInstruction *anInstruction; AbstractInstruction *anInstruction1; - AbstractInstruction *anInstruction10; AbstractInstruction *anInstruction2; - AbstractInstruction *anInstruction3; - AbstractInstruction *anInstruction4; - AbstractInstruction *anInstruction5; - AbstractInstruction *anInstruction6; - AbstractInstruction *anInstruction7; - AbstractInstruction *anInstruction8; - AbstractInstruction *anInstruction9; + sqInt cacheBaseReg; AbstractInstruction *itsAHit; AbstractInstruction *jumpClassMiss; AbstractInstruction *jumpInterpret; AbstractInstruction *jumpSelectorMiss; sqInt offset; - sqInt offset1; - sqInt offset2; - sqInt offset3; - sqInt offset4; - sqInt offset5; - sqInt offset6; + sqInt quickConstant; + sqInt reg;
/* N.B. Can't assume TempReg already contains the tag because a method can of course be invoked via the unchecked entry-point, e.g. as does perform:. */ - genGetInlineCacheClassTagFromintoforEntry(ReceiverResultReg, ClassReg, 0); + genGetInlineCacheClassTagFromintoforEntry(ReceiverResultReg, SendNumArgsReg, 0); flag("lookupInMethodCacheSel:classTag:"); - /* begin MoveR:R: */ - genoperandoperand(MoveRR, ClassReg, SendNumArgsReg); - /* begin XorR:R: */ - genoperandoperand(XorRR, Arg0Reg, ClassReg); - /* begin LogicalShiftLeftCq:R: */ - genoperandoperand(LogicalShiftLeftCqR, shiftForWord(), ClassReg); - /* begin AndCq:R: */ - anInstruction = genoperandoperand(AndCqR, MethodCacheMask << (shiftForWord()), ClassReg); - if (usesOutOfLineLiteral(anInstruction)) { - (anInstruction->dependent = locateLiteral(MethodCacheMask << (shiftForWord()))); - } - /* begin MoveMw:r:R: */ - offset = (((usqInt)(methodCacheAddress()))) + (MethodCacheSelector << (shiftForWord())); - /* begin gen:quickConstant:operand:operand: */ - anInstruction4 = genoperandoperandoperand(MoveMwrR, offset, ClassReg, TempReg); - if (usesOutOfLineLiteral(anInstruction4)) { - (anInstruction4->dependent = locateLiteral(offset)); - } - /* begin CmpR:R: */ - genoperandoperand(CmpRR, Arg0Reg, TempReg); + cacheBaseReg = NoReg; + jumpSelectorMiss = compilePerformMethodCacheProbeForwithShiftbaseRegOrNone(Arg0Reg, 0, cacheBaseReg); /* begin JumpNonZero: */ - jumpSelectorMiss = genConditionalBranchoperand(JumpNonZero, ((sqInt)0)); - /* begin MoveMw:r:R: */ - offset1 = (((usqInt)(methodCacheAddress()))) + (MethodCacheClass << (shiftForWord())); - /* begin gen:quickConstant:operand:operand: */ - anInstruction5 = genoperandoperandoperand(MoveMwrR, offset1, ClassReg, TempReg); - if (usesOutOfLineLiteral(anInstruction5)) { - (anInstruction5->dependent = locateLiteral(offset1)); - } - /* begin CmpR:R: */ - genoperandoperand(CmpRR, SendNumArgsReg, TempReg); - /* begin JumpNonZero: */ jumpClassMiss = genConditionalBranchoperand(JumpNonZero, ((sqInt)0)); - /* begin Label */ - itsAHit = genoperandoperand(Label, (labelCounter += 1), bytecodePC); /* begin MoveMw:r:R: */ - offset2 = (((usqInt)(methodCacheAddress()))) + (MethodCacheMethod << (shiftForWord())); + offset = (cacheBaseReg == NoReg + ? (((usqInt)(methodCacheAddress()))) + (MethodCacheMethod << (shiftForWord())) + : MethodCacheMethod << (shiftForWord())); /* begin gen:quickConstant:operand:operand: */ - anInstruction6 = genoperandoperandoperand(MoveMwrR, offset2, ClassReg, SendNumArgsReg); - if (usesOutOfLineLiteral(anInstruction6)) { - (anInstruction6->dependent = locateLiteral(offset2)); + anInstruction2 = genoperandoperandoperand(MoveMwrR, offset, ClassReg, SendNumArgsReg); + if (usesOutOfLineLiteral(anInstruction2)) { + (anInstruction2->dependent = locateLiteral(offset)); } + itsAHit = anInstruction2; genLoadSlotsourceRegdestReg(HeaderIndex, SendNumArgsReg, ClassReg);
/* Adjust arguments and jump to the method's unchecked entry-point. */ jumpInterpret = genJumpImmediate(ClassReg); /* begin AddCq:R: */ - anInstruction1 = genoperandoperand(AddCqR, cmNoCheckEntryOffset, ClassReg); - if (usesOutOfLineLiteral(anInstruction1)) { - (anInstruction1->dependent = locateLiteral(cmNoCheckEntryOffset)); + anInstruction = genoperandoperand(AddCqR, cmNoCheckEntryOffset, ClassReg); + if (usesOutOfLineLiteral(anInstruction)) { + (anInstruction->dependent = locateLiteral(cmNoCheckEntryOffset)); } adjustArgumentsForPerform(numArgs); /* begin JumpR: */ genoperand(JumpR, ClassReg); jmpTarget(jumpSelectorMiss, jmpTarget(jumpClassMiss, gLabel())); - /* begin MoveR:R: */ - genoperandoperand(MoveRR, SendNumArgsReg, ClassReg); - /* begin XorR:R: */ - genoperandoperand(XorRR, Arg0Reg, ClassReg); - /* begin LogicalShiftLeftCq:R: */ - genoperandoperand(LogicalShiftLeftCqR, (shiftForWord()) - 1, ClassReg); - /* begin AndCq:R: */ - anInstruction2 = genoperandoperand(AndCqR, MethodCacheMask << (shiftForWord()), ClassReg); - if (usesOutOfLineLiteral(anInstruction2)) { - (anInstruction2->dependent = locateLiteral(MethodCacheMask << (shiftForWord()))); - } - /* begin MoveMw:r:R: */ - offset3 = (((usqInt)(methodCacheAddress()))) + (MethodCacheSelector << (shiftForWord())); - /* begin gen:quickConstant:operand:operand: */ - anInstruction7 = genoperandoperandoperand(MoveMwrR, offset3, ClassReg, TempReg); - if (usesOutOfLineLiteral(anInstruction7)) { - (anInstruction7->dependent = locateLiteral(offset3)); - } - /* begin CmpR:R: */ - genoperandoperand(CmpRR, Arg0Reg, TempReg); - /* begin JumpNonZero: */ - jumpSelectorMiss = genConditionalBranchoperand(JumpNonZero, ((sqInt)0)); - /* begin MoveMw:r:R: */ - offset4 = (((usqInt)(methodCacheAddress()))) + (MethodCacheClass << (shiftForWord())); - /* begin gen:quickConstant:operand:operand: */ - anInstruction8 = genoperandoperandoperand(MoveMwrR, offset4, ClassReg, TempReg); - if (usesOutOfLineLiteral(anInstruction8)) { - (anInstruction8->dependent = locateLiteral(offset4)); - } - /* begin CmpR:R: */ - genoperandoperand(CmpRR, SendNumArgsReg, TempReg); + jumpSelectorMiss = compilePerformMethodCacheProbeForwithShiftbaseRegOrNone(Arg0Reg, 1, cacheBaseReg); /* begin JumpZero: */ genConditionalBranchoperand(JumpZero, ((sqInt)itsAHit)); jmpTarget(jumpSelectorMiss, gLabel()); - /* begin MoveR:R: */ - genoperandoperand(MoveRR, SendNumArgsReg, ClassReg); - /* begin XorR:R: */ - genoperandoperand(XorRR, Arg0Reg, ClassReg); - /* begin AndCq:R: */ - anInstruction3 = genoperandoperand(AndCqR, MethodCacheMask << (shiftForWord()), ClassReg); - if (usesOutOfLineLiteral(anInstruction3)) { - (anInstruction3->dependent = locateLiteral(MethodCacheMask << (shiftForWord()))); - } - /* begin MoveMw:r:R: */ - offset5 = (((usqInt)(methodCacheAddress()))) + (MethodCacheSelector << (shiftForWord())); - /* begin gen:quickConstant:operand:operand: */ - anInstruction9 = genoperandoperandoperand(MoveMwrR, offset5, ClassReg, TempReg); - if (usesOutOfLineLiteral(anInstruction9)) { - (anInstruction9->dependent = locateLiteral(offset5)); - } - /* begin CmpR:R: */ - genoperandoperand(CmpRR, Arg0Reg, TempReg); - /* begin JumpNonZero: */ - jumpSelectorMiss = genConditionalBranchoperand(JumpNonZero, ((sqInt)0)); - /* begin MoveMw:r:R: */ - offset6 = (((usqInt)(methodCacheAddress()))) + (MethodCacheClass << (shiftForWord())); - /* begin gen:quickConstant:operand:operand: */ - anInstruction10 = genoperandoperandoperand(MoveMwrR, offset6, ClassReg, TempReg); - if (usesOutOfLineLiteral(anInstruction10)) { - (anInstruction10->dependent = locateLiteral(offset6)); - } - /* begin CmpR:R: */ - genoperandoperand(CmpRR, SendNumArgsReg, TempReg); + jumpSelectorMiss = compilePerformMethodCacheProbeForwithShiftbaseRegOrNone(Arg0Reg, 1, cacheBaseReg); /* begin JumpZero: */ genConditionalBranchoperand(JumpZero, ((sqInt)itsAHit)); jmpTarget(jumpSelectorMiss, jmpTarget(jumpInterpret, gLabel())); return 0; }
- /* SimpleStackBasedCogit>>#genMoveFalseR: */ + /* SimpleStackBasedCogit>>#genMoveConstant:R: */ static AbstractInstruction * NoDbgRegParms -genMoveFalseR(sqInt reg) +genMoveConstantR(sqInt constant, sqInt reg) { AbstractInstruction *anInstruction; - sqInt constant;
- /* begin genMoveConstant:R: */ - constant = falseObject(); return (shouldAnnotateObjectReference(constant) ? annotateobjRef(gMoveCwR(constant, reg), constant) : (/* begin MoveCq:R: */ @@ -26230,6 +26205,7 @@ jumpNotSI = genJumpNotSmallInteger(Arg0Reg); genShiftAwaySmallIntegerTagsInScratchReg(ClassReg); genRemoveSmallIntegerTagsInScratchReg(Arg1Reg); + /* begin MulR:R: */ genMulRR(backEnd, Arg1Reg, ClassReg); /* begin JumpOverflow: */ jumpOvfl = genConditionalBranchoperand(JumpOverflow, ((sqInt)0));
Modified: branches/Cog/nsspursrc/vm/cogitIA32.c =================================================================== --- branches/Cog/nsspursrc/vm/cogitIA32.c 2015-12-17 00:52:47 UTC (rev 3543) +++ branches/Cog/nsspursrc/vm/cogitIA32.c 2015-12-17 17:50:55 UTC (rev 3544) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.1602 uuid: 16ff1141-4cce-41a9-a9f5-742da38970ef + CCodeGenerator VMMaker.oscog-eem.1608 uuid: bf1e1bd4-7dd4-47e2-bb33-3a988cc4c276 from - StackToRegisterMappingCogit VMMaker.oscog-eem.1602 uuid: 16ff1141-4cce-41a9-a9f5-742da38970ef + StackToRegisterMappingCogit VMMaker.oscog-eem.1608 uuid: bf1e1bd4-7dd4-47e2-bb33-3a988cc4c276 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1602 uuid: 16ff1141-4cce-41a9-a9f5-742da38970ef " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1608 uuid: bf1e1bd4-7dd4-47e2-bb33-3a988cc4c276 " __DATE__ ; char *__cogitBuildInfo = __buildInfo;
@@ -889,6 +889,7 @@ static sqInt NoDbgRegParms compileInterpreterPrimitive(void (*primitiveRoutine)(void)); static AbstractInstruction * NoDbgRegParms compileOpenPICMethodCacheProbeForwithShiftbaseRegOrNone(sqInt selector, sqInt shift, sqInt baseRegOrNone); static void NoDbgRegParms compileOpenPICnumArgs(sqInt selector, sqInt numArgs); +static AbstractInstruction * NoDbgRegParms compilePerformMethodCacheProbeForwithShiftbaseRegOrNone(sqInt selectorReg, sqInt shift, sqInt baseRegOrNone); static sqInt extendedPushBytecode(void); static sqInt extendedStoreAndPopBytecode(void); static sqInt extendedStoreBytecode(void); @@ -927,8 +928,8 @@ static sqInt genLongUnconditionalBackwardJump(void); static sqInt genLongUnconditionalForwardJump(void); static sqInt NoDbgRegParms genLookupForPerformNumArgs(sqInt numArgs); -static AbstractInstruction * NoDbgRegParms genMoveFalseR(sqInt reg); -static sqInt NoDbgRegParms genMoveTrueR(sqInt reg); +static AbstractInstruction * NoDbgRegParms genMoveConstantR(sqInt constant, sqInt reg); +static AbstractInstruction * NoDbgRegParms genMoveTrueR(sqInt reg); static sqInt NoDbgRegParms genMustBeBooleanTrampolineForcalled(sqInt boolean, char *trampolineName); static sqInt genPrimitiveEqual(void); static sqInt genPrimitiveFloatAdd(void); @@ -6230,7 +6231,7 @@ byteAtput(callSiteReturnAddress - 7, (((usqInt) cacheTag) >> 16) & 0xFF); byteAtput(callSiteReturnAddress - 8, (((usqInt) cacheTag) >> 8) & 0xFF); byteAtput(callSiteReturnAddress - 9, cacheTag & 0xFF); - assert((((usqInt) (callTargetFromReturnAddress(self_in_rewriteInlineCacheAttagtarget, callSiteReturnAddress)))) == callTargetAddress); + assert((callTargetFromReturnAddress(self_in_rewriteInlineCacheAttagtarget, callSiteReturnAddress)) == callTargetAddress); return 10; }
@@ -9592,6 +9593,7 @@ zeroOpcodeIndex(); labelCounter = 0; startAddress = methodZoneBase; + maybeEstablishVarBase(backEnd); if (captureFramePointer) { /* begin MoveR:Aw: */ address = cFramePointerAddress(); @@ -11165,8 +11167,7 @@ literal = literalBeforeFollowingAddress(backEnd, mcpc); mappedLiteral = remapObject(literal); if (mappedLiteral != literal) { - /* begin storeLiteral:atAnnotatedAddress:using: */ - storeLiteralbeforeFollowingAddress(((AbstractInstruction *) backEnd), mappedLiteral, mcpc); + storeLiteralbeforeFollowingAddress(backEnd, mappedLiteral, mcpc); codeModified = 1; } } @@ -13152,8 +13153,7 @@ if (couldBeObject(literal)) { mappedLiteral = remapObject(literal); if (literal != mappedLiteral) { - /* begin storeLiteral:atAnnotatedAddress:using: */ - storeLiteralbeforeFollowingAddress(((AbstractInstruction *) backEnd), mappedLiteral, ((usqInt)mcpc)); + storeLiteralbeforeFollowingAddress(backEnd, mappedLiteral, ((usqInt)mcpc)); codeModified = 1; } if ((hasYoungPtr != 0) @@ -15362,7 +15362,7 @@ AbstractInstruction * jumpIsCompiledMethod; AbstractInstruction *jumpIsContext; AbstractInstruction *jumpNegative; - AbstractInstruction * jumpNonSmallIntegerValue; + sqInt jumpNonSmallIntegerValue; AbstractInstruction *jumpNotIndexableBits; AbstractInstruction *jumpNotIndexablePointers; AbstractInstruction * jumpNotPointers; @@ -17869,7 +17869,7 @@ /* begin JumpNonZero: */ jumpCmp = genConditionalBranchoperand(JumpNonZero, ((sqInt)0)); } - /* begin genMoveConstant:R: */ + /* begin genMoveTrueR: */ constant = trueObject(); if (shouldAnnotateObjectReference(constant)) { annotateobjRef(gMoveCwR(constant, ReceiverResultReg), constant); @@ -17880,7 +17880,7 @@ } /* begin RetN: */ genoperand(RetN, retNoffset); - jmpTarget(jumpCmp, genMoveFalseR(ReceiverResultReg)); + jmpTarget(jumpCmp, genMoveConstantR(falseObject(), ReceiverResultReg)); /* begin RetN: */ genoperand(RetN, retNoffset); return 0; @@ -19350,8 +19350,8 @@ }
-/* Compile one method cache probe in an OpenPIC's lookup of selector. Answer - the jump taken if the selector probe fails. */ +/* Compile one method cache probe in an OpenPIC's lookup of selector. + Answer the jump taken if the selector probe fails. */
/* SimpleStackBasedCogit>>#compileOpenPICMethodCacheProbeFor:withShift:baseRegOrNone: */ static AbstractInstruction * NoDbgRegParms @@ -19465,6 +19465,64 @@ compileCallFornumArgsargargargargresultRegsaveRegs(ceSendFromInLineCacheMiss, 1, SendNumArgsReg, null, null, null, NoReg, 0); }
+ +/* Compile one method cache probe in a perform: primitive's lookup of + selector. Answer the jump taken if the selector probe fails. */ + + /* SimpleStackBasedCogit>>#compilePerformMethodCacheProbeFor:withShift:baseRegOrNone: */ +static AbstractInstruction * NoDbgRegParms +compilePerformMethodCacheProbeForwithShiftbaseRegOrNone(sqInt selectorReg, sqInt shift, sqInt baseRegOrNone) +{ + AbstractInstruction *anInstruction; + AbstractInstruction *anInstruction1; + AbstractInstruction *anInstruction2; + AbstractInstruction *anInstruction3; + AbstractInstruction *anInstruction4; + AbstractInstruction *jumpSelectorMiss; + sqInt offset; + sqInt offset1; + + /* begin MoveR:R: */ + genoperandoperand(MoveRR, SendNumArgsReg, ClassReg); + /* begin XorR:R: */ + genoperandoperand(XorRR, selectorReg, ClassReg); + if ((shiftForWord()) > shift) { + /* begin LogicalShiftLeftCq:R: */ + genoperandoperand(LogicalShiftLeftCqR, (shiftForWord()) - shift, ClassReg); + } + /* begin AndCq:R: */ + anInstruction = genoperandoperand(AndCqR, MethodCacheMask << (shiftForWord()), ClassReg); + if (baseRegOrNone == NoReg) { + /* begin MoveMw:r:R: */ + offset = (((usqInt)(methodCacheAddress()))) + (MethodCacheSelector << (shiftForWord())); + /* begin gen:quickConstant:operand:operand: */ + anInstruction1 = genoperandoperandoperand(MoveMwrR, offset, ClassReg, TempReg); + } + else { + /* begin AddR:R: */ + genoperandoperand(AddRR, baseRegOrNone, ClassReg); + /* begin MoveMw:r:R: */ + anInstruction2 = genoperandoperandoperand(MoveMwrR, MethodCacheSelector << (shiftForWord()), ClassReg, TempReg); + } + /* begin CmpR:R: */ + genoperandoperand(CmpRR, selectorReg, TempReg); + /* begin JumpNonZero: */ + jumpSelectorMiss = genConditionalBranchoperand(JumpNonZero, ((sqInt)0)); + if (baseRegOrNone == NoReg) { + /* begin MoveMw:r:R: */ + offset1 = (((usqInt)(methodCacheAddress()))) + (MethodCacheClass << (shiftForWord())); + /* begin gen:quickConstant:operand:operand: */ + anInstruction3 = genoperandoperandoperand(MoveMwrR, offset1, ClassReg, TempReg); + } + else { + /* begin MoveMw:r:R: */ + anInstruction4 = genoperandoperandoperand(MoveMwrR, MethodCacheClass << (shiftForWord()), ClassReg, TempReg); + } + /* begin CmpR:R: */ + genoperandoperand(CmpRR, SendNumArgsReg, TempReg); + return jumpSelectorMiss; +} + /* SimpleStackBasedCogit>>#extendedPushBytecode */ static sqInt extendedPushBytecode(void) @@ -20138,132 +20196,59 @@ { AbstractInstruction *anInstruction; AbstractInstruction *anInstruction1; - AbstractInstruction *anInstruction10; AbstractInstruction *anInstruction2; - AbstractInstruction *anInstruction3; - AbstractInstruction *anInstruction4; - AbstractInstruction *anInstruction5; - AbstractInstruction *anInstruction6; - AbstractInstruction *anInstruction7; - AbstractInstruction *anInstruction8; - AbstractInstruction *anInstruction9; + sqInt cacheBaseReg; AbstractInstruction *itsAHit; AbstractInstruction *jumpClassMiss; AbstractInstruction *jumpInterpret; AbstractInstruction *jumpSelectorMiss; sqInt offset; - sqInt offset1; - sqInt offset2; - sqInt offset3; - sqInt offset4; - sqInt offset5; - sqInt offset6; + sqInt quickConstant; + sqInt reg;
/* N.B. Can't assume TempReg already contains the tag because a method can of course be invoked via the unchecked entry-point, e.g. as does perform:. */ - genGetInlineCacheClassTagFromintoforEntry(ReceiverResultReg, ClassReg, 0); + genGetInlineCacheClassTagFromintoforEntry(ReceiverResultReg, SendNumArgsReg, 0); flag("lookupInMethodCacheSel:classTag:"); - /* begin MoveR:R: */ - genoperandoperand(MoveRR, ClassReg, SendNumArgsReg); - /* begin XorR:R: */ - genoperandoperand(XorRR, Arg0Reg, ClassReg); - /* begin LogicalShiftLeftCq:R: */ - genoperandoperand(LogicalShiftLeftCqR, shiftForWord(), ClassReg); - /* begin AndCq:R: */ - anInstruction = genoperandoperand(AndCqR, MethodCacheMask << (shiftForWord()), ClassReg); - /* begin MoveMw:r:R: */ - offset = (((usqInt)(methodCacheAddress()))) + (MethodCacheSelector << (shiftForWord())); - /* begin gen:quickConstant:operand:operand: */ - anInstruction4 = genoperandoperandoperand(MoveMwrR, offset, ClassReg, TempReg); - /* begin CmpR:R: */ - genoperandoperand(CmpRR, Arg0Reg, TempReg); + cacheBaseReg = NoReg; + jumpSelectorMiss = compilePerformMethodCacheProbeForwithShiftbaseRegOrNone(Arg0Reg, 0, cacheBaseReg); /* begin JumpNonZero: */ - jumpSelectorMiss = genConditionalBranchoperand(JumpNonZero, ((sqInt)0)); - /* begin MoveMw:r:R: */ - offset1 = (((usqInt)(methodCacheAddress()))) + (MethodCacheClass << (shiftForWord())); - /* begin gen:quickConstant:operand:operand: */ - anInstruction5 = genoperandoperandoperand(MoveMwrR, offset1, ClassReg, TempReg); - /* begin CmpR:R: */ - genoperandoperand(CmpRR, SendNumArgsReg, TempReg); - /* begin JumpNonZero: */ jumpClassMiss = genConditionalBranchoperand(JumpNonZero, ((sqInt)0)); - /* begin Label */ - itsAHit = genoperandoperand(Label, (labelCounter += 1), bytecodePC); /* begin MoveMw:r:R: */ - offset2 = (((usqInt)(methodCacheAddress()))) + (MethodCacheMethod << (shiftForWord())); + offset = (cacheBaseReg == NoReg + ? (((usqInt)(methodCacheAddress()))) + (MethodCacheMethod << (shiftForWord())) + : MethodCacheMethod << (shiftForWord())); /* begin gen:quickConstant:operand:operand: */ - anInstruction6 = genoperandoperandoperand(MoveMwrR, offset2, ClassReg, SendNumArgsReg); + anInstruction2 = genoperandoperandoperand(MoveMwrR, offset, ClassReg, SendNumArgsReg); + itsAHit = anInstruction2; genLoadSlotsourceRegdestReg(HeaderIndex, SendNumArgsReg, ClassReg);
/* Adjust arguments and jump to the method's unchecked entry-point. */ jumpInterpret = genJumpImmediate(ClassReg); /* begin AddCq:R: */ - anInstruction1 = genoperandoperand(AddCqR, cmNoCheckEntryOffset, ClassReg); + anInstruction = genoperandoperand(AddCqR, cmNoCheckEntryOffset, ClassReg); adjustArgumentsForPerform(numArgs); /* begin JumpR: */ genoperand(JumpR, ClassReg); jmpTarget(jumpSelectorMiss, jmpTarget(jumpClassMiss, gLabel())); - /* begin MoveR:R: */ - genoperandoperand(MoveRR, SendNumArgsReg, ClassReg); - /* begin XorR:R: */ - genoperandoperand(XorRR, Arg0Reg, ClassReg); - /* begin LogicalShiftLeftCq:R: */ - genoperandoperand(LogicalShiftLeftCqR, (shiftForWord()) - 1, ClassReg); - /* begin AndCq:R: */ - anInstruction2 = genoperandoperand(AndCqR, MethodCacheMask << (shiftForWord()), ClassReg); - /* begin MoveMw:r:R: */ - offset3 = (((usqInt)(methodCacheAddress()))) + (MethodCacheSelector << (shiftForWord())); - /* begin gen:quickConstant:operand:operand: */ - anInstruction7 = genoperandoperandoperand(MoveMwrR, offset3, ClassReg, TempReg); - /* begin CmpR:R: */ - genoperandoperand(CmpRR, Arg0Reg, TempReg); - /* begin JumpNonZero: */ - jumpSelectorMiss = genConditionalBranchoperand(JumpNonZero, ((sqInt)0)); - /* begin MoveMw:r:R: */ - offset4 = (((usqInt)(methodCacheAddress()))) + (MethodCacheClass << (shiftForWord())); - /* begin gen:quickConstant:operand:operand: */ - anInstruction8 = genoperandoperandoperand(MoveMwrR, offset4, ClassReg, TempReg); - /* begin CmpR:R: */ - genoperandoperand(CmpRR, SendNumArgsReg, TempReg); + jumpSelectorMiss = compilePerformMethodCacheProbeForwithShiftbaseRegOrNone(Arg0Reg, 1, cacheBaseReg); /* begin JumpZero: */ genConditionalBranchoperand(JumpZero, ((sqInt)itsAHit)); jmpTarget(jumpSelectorMiss, gLabel()); - /* begin MoveR:R: */ - genoperandoperand(MoveRR, SendNumArgsReg, ClassReg); - /* begin XorR:R: */ - genoperandoperand(XorRR, Arg0Reg, ClassReg); - /* begin AndCq:R: */ - anInstruction3 = genoperandoperand(AndCqR, MethodCacheMask << (shiftForWord()), ClassReg); - /* begin MoveMw:r:R: */ - offset5 = (((usqInt)(methodCacheAddress()))) + (MethodCacheSelector << (shiftForWord())); - /* begin gen:quickConstant:operand:operand: */ - anInstruction9 = genoperandoperandoperand(MoveMwrR, offset5, ClassReg, TempReg); - /* begin CmpR:R: */ - genoperandoperand(CmpRR, Arg0Reg, TempReg); - /* begin JumpNonZero: */ - jumpSelectorMiss = genConditionalBranchoperand(JumpNonZero, ((sqInt)0)); - /* begin MoveMw:r:R: */ - offset6 = (((usqInt)(methodCacheAddress()))) + (MethodCacheClass << (shiftForWord())); - /* begin gen:quickConstant:operand:operand: */ - anInstruction10 = genoperandoperandoperand(MoveMwrR, offset6, ClassReg, TempReg); - /* begin CmpR:R: */ - genoperandoperand(CmpRR, SendNumArgsReg, TempReg); + jumpSelectorMiss = compilePerformMethodCacheProbeForwithShiftbaseRegOrNone(Arg0Reg, 1, cacheBaseReg); /* begin JumpZero: */ genConditionalBranchoperand(JumpZero, ((sqInt)itsAHit)); jmpTarget(jumpSelectorMiss, jmpTarget(jumpInterpret, gLabel())); return 0; }
- /* SimpleStackBasedCogit>>#genMoveFalseR: */ + /* SimpleStackBasedCogit>>#genMoveConstant:R: */ static AbstractInstruction * NoDbgRegParms -genMoveFalseR(sqInt reg) +genMoveConstantR(sqInt constant, sqInt reg) { AbstractInstruction *anInstruction; - sqInt constant;
- /* begin genMoveConstant:R: */ - constant = falseObject(); return (shouldAnnotateObjectReference(constant) ? annotateobjRef(gMoveCwR(constant, reg), constant) : (/* begin MoveCq:R: */ @@ -20272,7 +20257,7 @@ }
/* SimpleStackBasedCogit>>#genMoveTrueR: */ -static sqInt NoDbgRegParms +static AbstractInstruction * NoDbgRegParms genMoveTrueR(sqInt reg) { AbstractInstruction *anInstruction;
Added: branches/Cog/nsspursrc/vm/cogitMIPSEL.c =================================================================== --- branches/Cog/nsspursrc/vm/cogitMIPSEL.c (rev 0) +++ branches/Cog/nsspursrc/vm/cogitMIPSEL.c 2015-12-17 17:50:55 UTC (rev 3544) @@ -0,0 +1,26768 @@ +/* Automatically generated by + CCodeGenerator VMMaker.oscog-eem.1608 uuid: bf1e1bd4-7dd4-47e2-bb33-3a988cc4c276 + from + StackToRegisterMappingCogit VMMaker.oscog-eem.1608 uuid: bf1e1bd4-7dd4-47e2-bb33-3a988cc4c276 + */ +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1608 uuid: bf1e1bd4-7dd4-47e2-bb33-3a988cc4c276 " __DATE__ ; +char *__cogitBuildInfo = __buildInfo; + + + +#include <stddef.h> +#include "sq.h" +#include "sqCogStackAlignment.h" +#include "dispdbg.h" +#include "cogmethod.h" +#include "nssendcache.h" +#if COGMTVM +#include "cointerpmt.h" +#else +#include "cointerp.h" +#endif +#include "cogit.h" + +typedef struct _AbstractInstruction { + unsigned char opcode; + unsigned char machineCodeSize; + unsigned char maxSize; + unsigned char annotation; + unsigned long operands [3]; + unsigned long address; + struct _AbstractInstruction *dependent; + unsigned long machineCode [7]; + } AbstractInstruction; + +#define CogMIPSELCompiler AbstractInstruction +#define CogAbstractInstruction AbstractInstruction + + +typedef struct { + AbstractInstruction *fakeHeader; + AbstractInstruction *fillInstruction; + sqInt numArgs; + sqInt numCopied; + sqInt numInitialNils; + sqInt startpc; + AbstractInstruction *entryLabel; + AbstractInstruction *stackCheckLabel; + sqInt span; + sqInt hasInstVarRef; + } BlockStart; + +#define CogBlockStart BlockStart + + +typedef struct _BytecodeDescriptor { + sqInt (*generator )(void); + sqInt (*spanFunction )(struct _BytecodeDescriptor *,sqInt,sqInt,sqInt); + sqInt (*needsFrameFunction )(sqInt); + signed char stackDelta; + unsigned char opcode; + unsigned char numBytes; + unsigned isBranchTrue : 1; + unsigned isBranchFalse : 1; + unsigned isReturn : 1; + unsigned isBlockCreation : 1; + unsigned isMapped : 1; + unsigned isMappedInBlock : 1; + unsigned isExtension : 1; + unsigned isInstVarRef : 1; + unsigned hasIRC : 1; + } BytecodeDescriptor; + +#define CogBytecodeDescriptor BytecodeDescriptor + + +typedef struct { + sqInt (*primitiveGenerator )(void); + sqInt primNumArgs; + sqInt (*enabled )(sqInt); + } PrimitiveDescriptor; + +#define CogPrimitiveDescriptor PrimitiveDescriptor + + +typedef struct { + AbstractInstruction *targetInstruction; + sqInt instructionIndex; + sqInt simStackPtr; + } BytecodeFixup; + +#define CogSSBytecodeFixup BytecodeFixup +#define CogBytecodeFixup BytecodeFixup + + +typedef struct { + char type; + char spilled; + char annotateUse; + sqInt registerr; + sqInt offset; + sqInt constant; + sqInt bcptr; + } CogSimStackEntry; + + +typedef struct { + sqInt isReceiverResultRegLive; + CogSimStackEntry *ssEntry; + } CogSSOptStatus; + + + +/*** Constants ***/ +#define A0 4 +#define A1 5 +#define A2 6 +#define A3 7 +#define ADDIU 9 +#define ADDU 33 +#define AddCheckOverflowCqR 120 +#define AddCheckOverflowRR 121 +#define AddCqR 95 +#define AddCwR 103 +#define AddRdRd 110 +#define AddRR 89 +#define AlignmentNops 3 +#define AltBlockCreationBytecodeSize 3 +#define AltFirstSpecialSelector 80 +#define AltNumSpecialSelectors 32 +#define AND 36 +#define ANDI 12 +#define AndCqR 97 +#define AndCqRR 108 +#define AndCwR 105 +#define AndRR 91 +#define AnnotationShift 5 +#define Arg0Reg -7 +#define Arg1Reg -8 +#define ArithmeticShiftRightCqR 80 +#define ArithmeticShiftRightRR 81 +#define AT 1 +#define BadRegisterSet 1 +#define BEQ 4 +#define BGEZ 1 +#define BGTZ 7 +#define BLEZ 6 +#define BLTZ 0 +#define BlockCreationBytecodeSize 4 +#define BNE 5 +#define BREAK 13 +#define BranchTemp 11 +#define BrEqualRR 125 +#define BrLongEqualRR 135 +#define BrLongNotEqualRR 136 +#define BrNotEqualRR 126 +#define BrSignedGreaterEqualRR 134 +#define BrSignedGreaterRR 133 +#define BrSignedLessEqualRR 132 +#define BrSignedLessRR 131 +#define BrUnsignedGreaterEqualRR 130 +#define BrUnsignedGreaterRR 129 +#define BrUnsignedLessEqualRR 128 +#define BrUnsignedLessRR 127 +#define BytecodeSetHasDirectedSuperSend 0 +#define Call 6 +#define CallFull 7 +#define ClassArrayCompactIndex 51 +#define ClassBlockClosureCompactIndex 37 +#define ClassFloatCompactIndex 34 +#define ClassMethodContextCompactIndex 36 +#define ClassReg -5 +#define ClosureFirstCopiedValueIndex 3 +#define ClosureIndex 4 +#define ClosureNumArgsIndex 2 +#define ClosureOuterContextIndex 0 +#define ClosureStartPCIndex 1 +#define CMBlock 3 +#define CMClosedPIC 4 +#define CMFree 1 +#define CMMaxUsageCount 7 +#define CMMethod 2 +#define CMOpenPIC 5 +#define Cmp 8 +#define CmpC32R 102 +#define CmpCqR 94 +#define CmpCwR 101 +#define CmpRdRd 109 +#define CmpRR 88 +#define CompletePrimitive 4 +#define ConcreteVarBaseReg 22 +#define ConstZero 1 +#define ConvertRRd 115 +#define Debug DEBUGVM +#define DIV 26 +#define DisplacementMask 0x1F +#define DisplacementX2N 0 +#define DivRdRd 113 +#define DivRR 117 +#define DPFPReg0 -21 +#define DPFPReg1 -22 +#define DPFPReg2 -23 +#define EncounteredUnknownBytecode -6 +#define Fill32 4 +#define FirstAnnotation 64 +#define FirstJump 11 +#define FirstShortJump 15 +#define FirstSpecialSelector 176 +#define FoxCallerSavedIP 4 +#define FoxMethod -4 +#define FoxMFReceiver -12 +#define FoxSavedFP 0 +#define FoxThisContext -8 +#define FP 30 +#define FPReg -1 +#define GCModeBecome 8 +#define GCModeFull 1 +#define GCModeNewSpace 2 +#define HasBytecodePC 4 +#define HeaderIndex 0 +#define HintLoad 0 +#define HintStore 1 +#define InstanceSpecificationIndex 2 +#define InstructionPointerIndex 1 +#define InsufficientCodeSpace -2 +#define IsAbsPCReference 3 +#define IsAnnotationExtension 1 +#define IsDirectedSuperSend 9 +#define IsDisplacementX2N 0 +#define IsNSDynamicSuperSend 11 +#define IsNSSelfSend 10 +#define IsNSSendCall 6 +#define IsObjectReference 2 +#define IsRelativeCall 5 +#define IsSendCall 7 +#define IsSuperSend 8 +#define J 2 +#define JAL 3 +#define JALR 9 +#define JR 8 +#define Jump 15 +#define JumpAbove 30 +#define JumpAboveOrEqual 29 +#define JumpBelow 28 +#define JumpBelowOrEqual 31 +#define JumpCarry 22 +#define JumpFPEqual 32 +#define JumpFPGreater 36 +#define JumpFPGreaterOrEqual 37 +#define JumpFPLess 34 +#define JumpFPLessOrEqual 35 +#define JumpFPNotEqual 33 +#define JumpFPOrdered 38 +#define JumpFPUnordered 39 +#define JumpFull 11 +#define JumpGreater 26 +#define JumpGreaterOrEqual 25 +#define JumpLess 24 +#define JumpLessOrEqual 27 +#define JumpLong 12 +#define JumpLongNonZero 14 +#define JumpLongZero 13 +#define JumpNegative 18 +#define JumpNoCarry 23 +#define JumpNonNegative 19 +#define JumpNonZero 17 +#define JumpNoOverflow 21 +#define JumpOverflow 20 +#define JumpR 9 +#define JumpZero 16 +#define Label 1 +#define LargeContextSlots 62 +#define LastJump 39 +#define LB 32 +#define LBU 36 +#define LH 33 +#define LHU 37 +#define LinkReg -17 +#define Literal 2 +#define LiteralStart 1 +#define LoadEffectiveAddressMwrR 77 +#define LogicalShiftLeftCqR 84 +#define LogicalShiftLeftRR 85 +#define LogicalShiftRightCqR 82 +#define LogicalShiftRightRR 83 +#define LookupRuleDynamicSuper 0x101 +#define LookupRuleImplicit 0x100 +#define LookupRuleSelf 0 +#define LUI 15 +#define LW 35 +#define MapEnd 0 +#define MaxCompiledPrimitiveIndex 222 +#define MaxMethodSize 65535 +#define MaxNegativeErrorCode -8 +#define MaxNumArgs 15 +#define MaxStackAllocSize 1572864 +#define MaxStackCheckOffset 0xFFF +#define MaxX2NDisplacement 992 +#define MethodCacheClass 2 +#define MethodCacheMask 0x7FC +#define MethodCacheMethod 3 +#define MethodCacheSelector 1 +#define MethodIndex 3 +#define MethodTooBig -4 +#define MFHI 16 +#define MFLO 18 +#define MFMethodFlagHasContextFlag 1 +#define MFMethodFlagIsBlockFlag 2 +#define MoveAbR 43 +#define MoveAwR 41 +#define MoveC32R 65 +#define MoveCqR 63 +#define MoveCwR 64 +#define MoveHighR 119 +#define MoveLowR 118 +#define MoveM16rR 51 +#define MoveM64rRd 70 +#define MoveMbrR 59 +#define MoveMwrR 45 +#define MoveRAb 44 +#define MoveRAw 42 +#define MoveRdM64r 71 +#define MoveRdRd 69 +#define MoveRMbr 60 +#define MoveRMwr 46 +#define MoveRR 40 +#define MoveRXbrR 62 +#define MoveRXwrR 48 +#define MoveXbrRR 61 +#define MoveXwrRR 47 +#define MULT 24 +#define MULTIPLEBYTECODESETS 1 +#define MulCheckOverflowRR 122 +#define MulRdRd 112 +#define MulRR 116 +#define NegateR 79 +#define NewspeakVM 1 +#define Nop 5 +#define NoReg null +#define NotFullyInitialized -1 +#define NSCClassTagIndex 0 +#define NSCEnclosingObjectIndex 1 +#define NSCNumArgsIndex 4 +#define NSCTargetIndex 2 +#define NumObjRefsInRuntime 0 +#define NumOopsPerNSC 6 +#define NumSendTrampolines 4 +#define NumSpecialSelectors 32 +#define NumTrampolines 72 +#define OneInstruction 4 +#define OR 37 +#define ORI 13 +#define OrCqR 98 +#define OrCwR 106 +#define OrRR 92 +#define Overflow 8 +#define OverflowTemp1 9 +#define OverflowTemp2 10 +#define PCReg -19 +#define PopR 72 +#define PREF 51 +#define PrefetchAw 76 +#define PrimCallCollectsProfileSamples 8 +#define PrimCallDoNotJIT 32 +#define PrimCallMayCallBack 4 +#define PrimCallNeedsNewMethod 1 +#define PrimCallNeedsPrimitiveFunction 2 +#define PrimErrWritePastObject 17 +#define PushCq 74 +#define PushCw 75 +#define PushR 73 +#define R0 0 +#define R31 31 +#define RA 31 +#define REGIMM 1 +#define ReceiverIndex 5 +#define ReceiverResultReg -3 +#define RetN 8 +#define RISCTempReg -18 +#define S0 16 +#define S1 17 +#define S2 18 +#define S3 19 +#define S4 20 +#define S5 21 +#define S6 22 +#define S7 23 +#define SB 40 +#define Scratch0Reg -9 +#define SelectorCannotInterpret 34 +#define SelectorDoesNotUnderstand 20 +#define SenderIndex 0 +#define SendNumArgsReg -6 +#define SH 41 +#define ShouldNotJIT -8 +#define SistaVM 0 +#define SLL 0 +#define SLLV 4 +#define SLT 42 +#define SLTI 10 +#define SLTIU 11 +#define SLTU 43 +#define SmallContextSlots 22 +#define SP 29 +#define SPECIAL 0 +#define SPReg -2 +#define SqrtRd 114 +#define SRA 3 +#define SRAV 7 +#define SRL 2 +#define SRLV 6 +#define SSBaseOffset 1 +#define SSConstant 2 +#define SSRegister 3 +#define SSSpill 4 +#define StackPointerIndex 2 +#define Stop 10 +#define SUBU 35 +#define SubCheckOverflowCqR 123 +#define SubCheckOverflowRR 124 +#define SubCqR 96 +#define SubCwR 104 +#define SubRdRd 111 +#define SubRR 90 +#define SW 43 +#define T2 10 +#define TargetReg 25 +#define TempReg -4 +#define TstCqR 99 +#define UnfailingPrimitive 3 +#define UnimplementedPrimitive -7 +#define V0 2
@@ Diff output truncated at 50000 characters. @@
vm-dev@lists.squeakfoundation.org