Revision: 2823
Author: eliot
Date: 2013-12-10 16:45:24 -0800 (Tue, 10 Dec 2013)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.554.
Fix a bug in BitBltPlugin>>lockSurfaces.
Internal changes for Spur (see the Monticello package history from 546 on).
Modified Paths:
--------------
branches/Cog/nscogsrc/vm/cogit.c
branches/Cog/nscogsrc/vm/cogit.h
branches/Cog/nscogsrc/vm/cogmethod.h
branches/Cog/nscogsrc/vm/cointerp.c
branches/Cog/nscogsrc/vm/cointerp.h
branches/Cog/nscogsrc/vm/gcc3x-cointerp.c
branches/Cog/nscogsrc/vm/interp.h
branches/Cog/nscogsrc/vm/vmCallback.h
branches/Cog/spursrc/vm/cogit.c
branches/Cog/spursrc/vm/cogit.h
branches/Cog/spursrc/vm/cogmethod.h
branches/Cog/spursrc/vm/cointerp.c
branches/Cog/spursrc/vm/cointerp.h
branches/Cog/spursrc/vm/gcc3x-cointerp.c
branches/Cog/spursrc/vm/interp.h
branches/Cog/spursrc/vm/vmCallback.h
branches/Cog/spurstacksrc/vm/gcc3x-interp.c
branches/Cog/spurstacksrc/vm/interp.c
branches/Cog/spurstacksrc/vm/interp.h
branches/Cog/spurstacksrc/vm/vmCallback.h
branches/Cog/src/plugins/BitBltPlugin/BitBltPlugin.c
branches/Cog/src/vm/cogit.c
branches/Cog/src/vm/cogit.h
branches/Cog/src/vm/cogmethod.h
branches/Cog/src/vm/cointerp.c
branches/Cog/src/vm/cointerp.h
branches/Cog/src/vm/cointerpmt.c
branches/Cog/src/vm/cointerpmt.h
branches/Cog/src/vm/gcc3x-cointerp.c
branches/Cog/src/vm/gcc3x-cointerpmt.c
branches/Cog/src/vm/interp.h
branches/Cog/src/vm/vmCallback.h
branches/Cog/stacksrc/vm/gcc3x-interp.c
branches/Cog/stacksrc/vm/interp.c
branches/Cog/stacksrc/vm/interp.h
branches/Cog/stacksrc/vm/vmCallback.h
Property Changed:
----------------
branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
Modified: branches/Cog/nscogsrc/vm/cogit.c
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.c 2013-12-09 18:15:54 UTC (rev 2822)
+++ branches/Cog/nscogsrc/vm/cogit.c 2013-12-11 00:45:24 UTC (rev 2823)
@@ -1,9 +1,9 @@
/* Automatically generated by
- CCodeGenerator VMMaker.oscog-eem.538 uuid: 6b6d8ba7-4913-4563-9d01-da880441f843
+ CCodeGenerator VMMaker.oscog-eem.554 uuid: a666e7e4-245e-4e8a-9536-3aefd4509f47
from
- StackToRegisterMappingCogit VMMaker.oscog-eem.538 uuid: 6b6d8ba7-4913-4563-9d01-da880441f843
+ StackToRegisterMappingCogit VMMaker.oscog-eem.554 uuid: a666e7e4-245e-4e8a-9536-3aefd4509f47
*/
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.538 uuid: 6b6d8ba7-4913-4563-9d01-da880441f843 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.554 uuid: a666e7e4-245e-4e8a-9536-3aefd4509f47 " __DATE__ ;
char *__cogitBuildInfo = __buildInfo;
@@ -284,6 +284,7 @@
#define MoveRMbr 55
#define MoveRMwr 45
#define MoveRR 40
+#define MoveRXbrR 57
#define MoveRXwrR 47
#define MoveXbrRR 56
#define MoveXwrRR 46
@@ -507,6 +508,7 @@
static sqInt concretizeMoveRMbr(AbstractInstruction * self_in_concretizeMoveRMbr);
static sqInt concretizeMoveRMwr(AbstractInstruction * self_in_concretizeMoveRMwr);
static sqInt concretizeMoveRR(AbstractInstruction * self_in_concretizeMoveRR);
+static sqInt concretizeMoveRXbrR(AbstractInstruction * self_in_concretizeMoveRXbrR);
static sqInt concretizeMoveRXwrR(AbstractInstruction * self_in_concretizeMoveRXwrR);
static sqInt concretizeMoveXbrRR(AbstractInstruction * self_in_concretizeMoveXbrRR);
static sqInt concretizeMoveXwrRR(AbstractInstruction * self_in_concretizeMoveXwrRR);
@@ -574,8 +576,9 @@
static sqInt genAlignCStackSavingRegistersnumArgswordAlignment(AbstractInstruction * self_in_genAlignCStackSavingRegistersnumArgswordAlignment, sqInt saveRegs, sqInt numArgs, sqInt alignment);
static AbstractInstruction * genAllocFloatValueintoscratchRegscratchReg(sqInt dpreg, sqInt resultReg, sqInt scratch1, sqInt scratch2);
static sqInt genCheckForInterruptsTrampoline(void);
+static sqInt genConvertIntegerToSmallIntegerInReg(sqInt reg);
static sqInt genConvertIntegerToSmallIntegerInScratchReg(sqInt scratchReg);
-static sqInt genConvertSmallIntegerToIntegerInScratchReg(sqInt scratchReg);
+static sqInt genConvertSmallIntegerToIntegerInReg(sqInt reg);
static AbstractInstruction * genDivRRQuoRem(AbstractInstruction * self_in_genDivRRQuoRem, sqInt abstractRegDivisor, sqInt abstractRegDividend, sqInt abstractRegQuotient, sqInt abstractRegRemainder);
static sqInt genDoubleArithmeticpreOpCheck(sqInt arithmeticOperator, AbstractInstruction *(*preOpCheckOrNil)(int rcvrReg, int argReg));
static sqInt genDoubleComparisoninvert(AbstractInstruction *(*jumpOpcodeGenerator)(void *), sqInt invertComparison);
@@ -584,7 +587,7 @@
static void (*genEnilopmartForandandcalled(sqInt regArg1, sqInt regArg2, sqInt regArg3, char *trampolineName))(void) ;
static void (*genEnilopmartForandcalled(sqInt regArg1, sqInt regArg2, char *trampolineName))(void) ;
static void (*genEnilopmartForcalled(sqInt regArg, char *trampolineName))(void) ;
-static sqInt genEnsureRegNotForwardedscratchReg(sqInt reg, sqInt scratch);
+static sqInt genEnsureObjInRegRegNotForwardedscratchReg(sqInt reg, sqInt scratch);
static void (*genEnterPICEnilopmartNumArgs(sqInt numArgs))(void) ;
static sqInt genExtendedSendBytecode(void);
static sqInt genExtendedSuperBytecode(void);
@@ -643,11 +646,13 @@
static sqInt genGetLeafCallStackPointer(void);
static AbstractInstruction * genGetLeafCallStackPointerFunction(AbstractInstruction * self_in_genGetLeafCallStackPointerFunction);
static sqInt genInnerPICAbortTrampoline(char *name);
+static sqInt genInnerPrimitiveAtPut(sqInt retNoffset);
static sqInt genInnerPrimitiveAt(sqInt retNoffset);
static sqInt genInnerPrimitiveNewMethod(sqInt retNoffset);
static sqInt genInnerPrimitiveNewWithArg(sqInt retNoffset);
static sqInt genInnerPrimitiveNew(sqInt retNoffset);
static sqInt genInnerPrimitiveSize(sqInt retNoffset);
+static sqInt genInnerPrimitiveStringAtPut(sqInt retNoffset);
static sqInt genInnerPrimitiveStringAt(sqInt retNOffset);
static sqInt genJumpBackTo(sqInt targetBytecodePC);
static AbstractInstruction * genJumpFPEqual(AbstractInstruction * self_in_genJumpFPEqual, void *jumpTarget);
@@ -687,6 +692,7 @@
static sqInt genPrimitiveAdd(void);
static sqInt genPrimitiveAsFloat(void);
static sqInt genPrimitiveAt(void);
+static sqInt genPrimitiveAtPut(void);
static sqInt genPrimitiveBitAnd(void);
static sqInt genPrimitiveBitOr(void);
static sqInt genPrimitiveBitShift(void);
@@ -723,6 +729,7 @@
static sqInt genPrimitiveQuo(void);
static sqInt genPrimitiveSize(void);
static sqInt genPrimitiveStringAt(void);
+static sqInt genPrimitiveStringAtPut(void);
static sqInt genPrimitiveSubtract(void);
static void genPrimReturnEnterCogCodeEnilopmart(sqInt profiling);
static sqInt genPushActiveContextBytecode(void);
@@ -944,6 +951,7 @@
static sqInt numLowLevelLockOpcodes(AbstractInstruction * self_in_numLowLevelLockOpcodes);
static sqInt numMethods(void);
sqInt numMethodsOfType(sqInt cogMethodType);
+sqInt numRegArgs(void);
static sqInt numSmallIntegerBits(void);
static sqInt occurrencesInYoungReferrers(CogMethod *cogMethod);
static sqInt oopisGreaterThanOrEqualTo(sqInt anOop, sqInt otherOop);
@@ -1122,7 +1130,6 @@
void (*ceEnterCogCodePopReceiverReg)(void);
static sqInt ceExplicitReceiverTrampoline;
static sqInt ceFetchContextInstVarTrampoline;
-static void (*ceFlushICache)(unsigned long from, unsigned long to);
unsigned long (*ceGetSP)(void);
static sqInt ceImplicitReceiverTrampoline;
static sqInt ceMethodAbortTrampoline;
@@ -1785,15 +1792,15 @@
{ 0, -1, 0 },
{ 0, -1, 0 },
{ genPrimitiveAt, 1, 0 },
- { 0, -1, 0 },
+ { genPrimitiveAtPut, 2, 0 },
{ genPrimitiveSize, 0, 0 },
{ genPrimitiveStringAt, 1, 0 },
+ { genPrimitiveStringAtPut, 2, 0 },
{ 0, -1, 0 },
{ 0, -1, 0 },
{ 0, -1, 0 },
{ 0, -1, 0 },
{ 0, -1, 0 },
- { 0, -1, 0 },
{ genPrimitiveNew, 0, 0 },
{ genPrimitiveNewWithArg, 1, 0 },
{ 0, -1, 0 },
@@ -1969,6 +1976,7 @@
static char *trampolineAddresses[NumTrampolines*2];
static sqInt trampolineTableIndex;
static CogMethod * unpairedMethodList;
+static sqInt usesMethodClass;
static usqInt youngReferrers;
@@ -2032,7 +2040,6 @@
#define notYetImplemented() warning("not yet implemented")
#define numberOfSaveableRegisters(self) 6
#define numElementsIn(anArray) (sizeof(anArray)/sizeof(anArray[0]))
-#define numRegArgs() 1
#define printNum(n) printf("%ld", (long) n)
#define printOnTrace() (traceFlags & 1)
#define print(aString) printf(aString)
@@ -2662,15 +2669,13 @@
sqInt selector;
- if (isOopForwarded(receiver)) {
- return ceSendFromInLineCacheMiss(cPIC);
- }
+
outerReturn = stackTop();
if (((cPIC->cPICNumCases)) < numPICCases) {
/* begin lookup:for:methodAndErrorSelectorInto: */
selector = (cPIC->selector);
methodOrSelectorIndex = lookupreceiver(selector, receiver);
- if ((((usqInt)methodOrSelectorIndex)) >= (nilObject())) {
+ if ((((usqInt)methodOrSelectorIndex)) > (maxLookupNoMNUErrorCode())) {
if (!(isOopCompiledMethod(methodOrSelectorIndex))) {
newTargetMethodOrNil = methodOrSelectorIndex;
errorSelectorOrNil = SelectorCannotInterpret;
@@ -2691,7 +2696,7 @@
}
if (methodOrSelectorIndex == SelectorDoesNotUnderstand) {
methodOrSelectorIndex = lookupreceiver(splObj(SelectorDoesNotUnderstand), receiver);
- if ((((usqInt)methodOrSelectorIndex)) >= (nilObject())) {
+ if ((((usqInt)methodOrSelectorIndex)) > (maxLookupNoMNUErrorCode())) {
assert(isOopCompiledMethod(methodOrSelectorIndex));
if ((!(methodHasCogMethod(methodOrSelectorIndex)))
&& (methodShouldBeCogged(methodOrSelectorIndex))) {
@@ -2731,7 +2736,7 @@
return ceSendFromInLineCacheMiss(cPIC);
}
cogExtendPICCaseNMethodtagisMNUCase(cPIC, newTargetMethodOrNil, cacheTag, errorSelectorOrNil == SelectorDoesNotUnderstand);
- executeCogMethodFromLinkedSendwithReceiverandCacheTag(cPIC, receiver, inlineCacheTagAt(backEnd, outerReturn));
+ executeCogMethodfromLinkedSendWithReceiverandCacheTag(cPIC, receiver, inlineCacheTagAt(backEnd, outerReturn));
return null;
}
@@ -2821,9 +2826,7 @@
innerReturn = popStack();
targetMethod = ((CogMethod *) (innerReturn - missOffset));
- if (isOopForwarded(receiver)) {
- return ceSendFromInLineCacheMiss(targetMethod);
- }
+
outerReturn = stackTop();
assert(((outerReturn >= methodZoneBase) && (outerReturn <= (freeStart()))));
entryPoint = callTargetFromReturnAddress(backEnd, outerReturn);
@@ -2838,7 +2841,7 @@
/* begin lookup:for:methodAndErrorSelectorInto: */
selector = (targetMethod->selector);
methodOrSelectorIndex = lookupreceiver(selector, receiver);
- if ((((usqInt)methodOrSelectorIndex)) >= (nilObject())) {
+ if ((((usqInt)methodOrSelectorIndex)) > (maxLookupNoMNUErrorCode())) {
if (!(isOopCompiledMethod(methodOrSelectorIndex))) {
newTargetMethodOrNil = methodOrSelectorIndex;
errorSelectorOrNil = SelectorCannotInterpret;
@@ -2859,7 +2862,7 @@
}
if (methodOrSelectorIndex == SelectorDoesNotUnderstand) {
methodOrSelectorIndex = lookupreceiver(splObj(SelectorDoesNotUnderstand), receiver);
- if ((((usqInt)methodOrSelectorIndex)) >= (nilObject())) {
+ if ((((usqInt)methodOrSelectorIndex)) > (maxLookupNoMNUErrorCode())) {
assert(isOopCompiledMethod(methodOrSelectorIndex));
if ((!(methodHasCogMethod(methodOrSelectorIndex)))
&& (methodShouldBeCogged(methodOrSelectorIndex))) {
@@ -2915,7 +2918,7 @@
? rewriteInlineCacheAttagtarget(backEnd, outerReturn, (targetMethod->selector), (((sqInt)pic)) + cmEntryOffset)
: rewriteCallAttarget(backEnd, outerReturn, (((sqInt)pic)) + cmEntryOffset));
flushICacheFromto(processor, (outerReturn - 1) - extent, outerReturn - 1);
- executeCogMethodFromLinkedSendwithReceiverandCacheTag(pic, receiver, inlineCacheTagAt(backEnd, outerReturn));
+ executeCogMethodfromLinkedSendWithReceiverandCacheTag(pic, receiver, inlineCacheTagAt(backEnd, outerReturn));
return null;
}
@@ -3224,16 +3227,15 @@
}
pc += cPICCaseSize;
for (i = 2; i <= ((cPIC->cPICNumCases)); i += 1) {
- if (inlineCacheTagsMayBeObjects()) {
- if (!(checkMaybeObjRefAt((pc - (jumpLongConditionalByteSize(backEnd))) - (loadLiteralByteSize(backEnd))))) {
- print("object leak in CPIC ");
- printHex(((sqInt)cPIC));
- print(" @ ");
- printHex((pc - (jumpLongConditionalByteSize(backEnd))) - (loadLiteralByteSize(backEnd)));
- cr();
- ok = 0;
- }
+ if (!(checkMaybeObjRefAt((pc - (jumpLongConditionalByteSize(backEnd))) - (loadLiteralByteSize(backEnd))))) {
+ print("object leak in CPIC ");
+ printHex(((sqInt)cPIC));
+ print(" @ ");
+ printHex((pc - (jumpLongConditionalByteSize(backEnd))) - (loadLiteralByteSize(backEnd)));
+ cr();
+ ok = 0;
}
+
if (!(checkMaybeObjRefAt(pc - (jumpLongConditionalByteSize(backEnd))))) {
print("object leak in CPIC ");
printHex(((sqInt)cPIC));
@@ -3865,10 +3867,7 @@
/* begin MoveCq:R: */
stackOverflowCall = genoperandoperand(MoveCqR, 0, ReceiverResultReg);
- if (hasLinkRegister(backEnd)) {
- /* begin PushR: */
- genoperand(PushR, LinkReg);
- }
+
/* begin Call: */
callTarget = methodAbortTrampolineFor(methodOrBlockNumArgs);
sendMissCall = genoperand(Call, callTarget);
@@ -4319,6 +4318,7 @@
primInvokeLabel = null;
postCompileHook = null;
maxLitIndex = -1;
+ usesMethodClass = 0;
extra = ((((primitiveIndex = primitiveIndexOf(methodObj))) > 0)
&& (!(isQuickPrimitiveIndex(primitiveIndex)))
? 30
@@ -4525,10 +4525,7 @@
return 0;
}
methodHeader = headerOf(methodObj);
- if (hasLinkRegister(backEnd)) {
- /* begin PushR: */
- genoperand(PushR, LinkReg);
- }
+
/* begin PushR: */
genoperand(PushR, FPReg);
/* begin MoveR:R: */
@@ -4608,7 +4605,7 @@
/* begin Jump: */
jmpGotError = genoperand(Jump, ((sqInt)0));
jmpTarget(jmpIntError, gLabel());
- genConvertIntegerToSmallIntegerInScratchReg(TempReg);
+ genConvertIntegerToSmallIntegerInReg(TempReg);
/* begin MoveR:R: */
genoperandoperand(MoveRR, TempReg, ClassReg);
jmpTarget(jmpGotError, gMoveRMwr(ClassReg, 0, SPReg));
@@ -5039,10 +5036,7 @@
static void
compileTrampolineForcallJumpBarnumArgsargargargargsaveRegsresultReg(void *aRoutine, sqInt callJumpBar, sqInt numArgs, sqInt regOrConst0, sqInt regOrConst1, sqInt regOrConst2, sqInt regOrConst3, sqInt saveRegs, sqInt resultRegOrNil)
{
- if (hasLinkRegister(backEnd)) {
- /* begin PushR: */
- genoperand(PushR, LinkReg);
- }
+ ;
genSaveStackPointers();
genLoadCStackPointers();
if (cStackAlignment > BytesPerWord) {
@@ -5105,10 +5099,7 @@
}
}
genLoadStackPointers();
- if (hasLinkRegister(backEnd)) {
- /* begin PopR: */
- genoperand(PopR, LinkReg);
- }
+
/* begin RetN: */
genoperand(RetN, 0);
}
@@ -5376,18 +5367,19 @@
? 5
: 4));
+ case MoveRXbrR:
+ case MoveRXwrR:
+ assert((concreteRegister(self_in_computeMaximumSize, ((self_in_computeMaximumSize->operands))[1])) != ESP);
+ return ((self_in_computeMaximumSize->maxSize) = ((concreteRegister(self_in_computeMaximumSize, ((self_in_computeMaximumSize->operands))[2])) == EBP
+ ? 4
+ : 3));
+
case MoveXwrRR:
assert((concreteRegister(self_in_computeMaximumSize, ((self_in_computeMaximumSize->operands))[0])) != ESP);
return ((self_in_computeMaximumSize->maxSize) = ((concreteRegister(self_in_computeMaximumSize, ((self_in_computeMaximumSize->operands))[1])) == EBP
? 4
: 3));
- case MoveRXwrR:
- assert((concreteRegister(self_in_computeMaximumSize, ((self_in_computeMaximumSize->operands))[1])) != ESP);
- return ((self_in_computeMaximumSize->maxSize) = ((concreteRegister(self_in_computeMaximumSize, ((self_in_computeMaximumSize->operands))[2])) == EBP
- ? 4
- : 3));
-
case PrefetchAw:
return ((self_in_computeMaximumSize->maxSize) = (hasSSEInstructions(self_in_computeMaximumSize)
? 7
@@ -6860,6 +6852,32 @@
/* Will get inlined into concretizeAt: switch. */
static sqInt
+concretizeMoveRXbrR(AbstractInstruction * self_in_concretizeMoveRXbrR)
+{
+ sqInt base;
+ sqInt index;
+ sqInt src;
+
+ src = concreteRegister(self_in_concretizeMoveRXbrR, ((self_in_concretizeMoveRXbrR->operands))[0]);
+ index = concreteRegister(self_in_concretizeMoveRXbrR, ((self_in_concretizeMoveRXbrR->operands))[1]);
+ base = concreteRegister(self_in_concretizeMoveRXbrR, ((self_in_concretizeMoveRXbrR->operands))[2]);
+ if (base != EBP) {
+ ((self_in_concretizeMoveRXbrR->machineCode))[0] = 136;
+ ((self_in_concretizeMoveRXbrR->machineCode))[1] = (modRMRO(self_in_concretizeMoveRXbrR, ModRegInd, 4, src));
+ ((self_in_concretizeMoveRXbrR->machineCode))[2] = (sib(self_in_concretizeMoveRXbrR, SIB1, index, base));
+ return ((self_in_concretizeMoveRXbrR->machineCodeSize) = 3);
+ }
+ ((self_in_concretizeMoveRXbrR->machineCode))[0] = 136;
+ ((self_in_concretizeMoveRXbrR->machineCode))[1] = (modRMRO(self_in_concretizeMoveRXbrR, ModRegRegDisp8, 4, src));
+ ((self_in_concretizeMoveRXbrR->machineCode))[2] = (sib(self_in_concretizeMoveRXbrR, SIB1, index, base));
+ ((self_in_concretizeMoveRXbrR->machineCode))[3] = 0;
+ return ((self_in_concretizeMoveRXbrR->machineCodeSize) = 4);
+}
+
+
+/* Will get inlined into concretizeAt: switch. */
+
+static sqInt
concretizeMoveRXwrR(AbstractInstruction * self_in_concretizeMoveRXwrR)
{
sqInt base;
@@ -7469,6 +7487,7 @@
sqInt base;
sqInt base1;
sqInt base2;
+ sqInt base3;
sqInt dest;
sqInt dest1;
sqInt destReg;
@@ -7487,6 +7506,7 @@
sqInt index;
sqInt index1;
sqInt index2;
+ sqInt index3;
AbstractInstruction *jumpTarget;
AbstractInstruction *jumpTarget1;
AbstractInstruction *jumpTarget10;
@@ -7649,6 +7669,7 @@
sqInt regRHS8;
sqInt regRHS9;
sqInt src;
+ sqInt src1;
sqInt srcReg;
sqInt srcReg1;
sqInt srcReg2;
@@ -9347,40 +9368,59 @@
((self_in_dispatchConcretize->machineCodeSize) = 5);
return;
+ case MoveRXbrR:
+ /* begin concretizeMoveRXbrR */
+ src = concreteRegister(self_in_dispatchConcretize, ((self_in_dispatchConcretize->operands))[0]);
+ index1 = concreteRegister(self_in_dispatchConcretize, ((self_in_dispatchConcretize->operands))[1]);
+ base1 = concreteRegister(self_in_dispatchConcretize, ((self_in_dispatchConcretize->operands))[2]);
+ if (base1 != EBP) {
+ ((self_in_dispatchConcretize->machineCode))[0] = 136;
+ ((self_in_dispatchConcretize->machineCode))[1] = (modRMRO(self_in_dispatchConcretize, ModRegInd, 4, src));
+ ((self_in_dispatchConcretize->machineCode))[2] = (sib(self_in_dispatchConcretize, SIB1, index1, base1));
+ ((self_in_dispatchConcretize->machineCodeSize) = 3);
+ return;
+ }
+ ((self_in_dispatchConcretize->machineCode))[0] = 136;
+ ((self_in_dispatchConcretize->machineCode))[1] = (modRMRO(self_in_dispatchConcretize, ModRegRegDisp8, 4, src));
+ ((self_in_dispatchConcretize->machineCode))[2] = (sib(self_in_dispatchConcretize, SIB1, index1, base1));
+ ((self_in_dispatchConcretize->machineCode))[3] = 0;
+ ((self_in_dispatchConcretize->machineCodeSize) = 4);
+ return;
+
case MoveXwrRR:
/* begin concretizeMoveXwrRR */
- index1 = concreteRegister(self_in_dispatchConcretize, ((self_in_dispatchConcretize->operands))[0]);
- base1 = concreteRegister(self_in_dispatchConcretize, ((self_in_dispatchConcretize->operands))[1]);
+ index2 = concreteRegister(self_in_dispatchConcretize, ((self_in_dispatchConcretize->operands))[0]);
+ base2 = concreteRegister(self_in_dispatchConcretize, ((self_in_dispatchConcretize->operands))[1]);
dest1 = concreteRegister(self_in_dispatchConcretize, ((self_in_dispatchConcretize->operands))[2]);
- if (base1 != EBP) {
+ if (base2 != EBP) {
((self_in_dispatchConcretize->machineCode))[0] = 139;
((self_in_dispatchConcretize->machineCode))[1] = (modRMRO(self_in_dispatchConcretize, ModRegInd, 4, dest1));
- ((self_in_dispatchConcretize->machineCode))[2] = (sib(self_in_dispatchConcretize, SIB4, index1, base1));
+ ((self_in_dispatchConcretize->machineCode))[2] = (sib(self_in_dispatchConcretize, SIB4, index2, base2));
((self_in_dispatchConcretize->machineCodeSize) = 3);
return;
}
((self_in_dispatchConcretize->machineCode))[0] = 139;
((self_in_dispatchConcretize->machineCode))[1] = (modRMRO(self_in_dispatchConcretize, ModRegRegDisp8, 4, dest1));
- ((self_in_dispatchConcretize->machineCode))[2] = (sib(self_in_dispatchConcretize, SIB4, index1, base1));
+ ((self_in_dispatchConcretize->machineCode))[2] = (sib(self_in_dispatchConcretize, SIB4, index2, base2));
((self_in_dispatchConcretize->machineCode))[3] = 0;
((self_in_dispatchConcretize->machineCodeSize) = 4);
return;
case MoveRXwrR:
/* begin concretizeMoveRXwrR */
- src = concreteRegister(self_in_dispatchConcretize, ((self_in_dispatchConcretize->operands))[0]);
- index2 = concreteRegister(self_in_dispatchConcretize, ((self_in_dispatchConcretize->operands))[1]);
- base2 = concreteRegister(self_in_dispatchConcretize, ((self_in_dispatchConcretize->operands))[2]);
- if (base2 != EBP) {
+ src1 = concreteRegister(self_in_dispatchConcretize, ((self_in_dispatchConcretize->operands))[0]);
+ index3 = concreteRegister(self_in_dispatchConcretize, ((self_in_dispatchConcretize->operands))[1]);
+ base3 = concreteRegister(self_in_dispatchConcretize, ((self_in_dispatchConcretize->operands))[2]);
+ if (base3 != EBP) {
((self_in_dispatchConcretize->machineCode))[0] = 137;
- ((self_in_dispatchConcretize->machineCode))[1] = (modRMRO(self_in_dispatchConcretize, ModRegInd, 4, src));
- ((self_in_dispatchConcretize->machineCode))[2] = (sib(self_in_dispatchConcretize, SIB4, index2, base2));
+ ((self_in_dispatchConcretize->machineCode))[1] = (modRMRO(self_in_dispatchConcretize, ModRegInd, 4, src1));
+ ((self_in_dispatchConcretize->machineCode))[2] = (sib(self_in_dispatchConcretize, SIB4, index3, base3));
((self_in_dispatchConcretize->machineCodeSize) = 3);
return;
}
((self_in_dispatchConcretize->machineCode))[0] = 137;
- ((self_in_dispatchConcretize->machineCode))[1] = (modRMRO(self_in_dispatchConcretize, ModRegRegDisp8, 4, src));
- ((self_in_dispatchConcretize->machineCode))[2] = (sib(self_in_dispatchConcretize, SIB4, index2, base2));
+ ((self_in_dispatchConcretize->machineCode))[1] = (modRMRO(self_in_dispatchConcretize, ModRegRegDisp8, 4, src1));
+ ((self_in_dispatchConcretize->machineCode))[2] = (sib(self_in_dispatchConcretize, SIB4, index3, base3));
((self_in_dispatchConcretize->machineCode))[3] = 0;
((self_in_dispatchConcretize->machineCodeSize) = 4);
return;
@@ -10011,6 +10051,7 @@
(method->cmUsageCount = initialMethodUsageCount());
(method->cpicHasMNUCase = 0);
(method->cmUsesPenultimateLit = maxLitIndex >= ((literalCountOfHeader(methodHeader)) - 2));
+ (method->cmUsesMethodClass = usesMethodClass);
(method->blockEntryOffset = (blockEntryLabel != null
? ((blockEntryLabel->address)) - (((sqInt)method))
: 0));
@@ -10370,6 +10411,16 @@
}
static sqInt
+genConvertIntegerToSmallIntegerInReg(sqInt reg)
+{
+ /* begin LogicalShiftLeftCq:R: */
+ genoperandoperand(LogicalShiftLeftCqR, 1, reg);
+ /* begin AddCq:R: */
+ genoperandoperand(AddCqR, 1, reg);
+ return 0;
+}
+
+static sqInt
genConvertIntegerToSmallIntegerInScratchReg(sqInt scratchReg)
{
/* begin LogicalShiftLeftCq:R: */
@@ -10380,10 +10431,10 @@
}
static sqInt
-genConvertSmallIntegerToIntegerInScratchReg(sqInt scratchReg)
+genConvertSmallIntegerToIntegerInReg(sqInt reg)
{
/* begin ArithmeticShiftRightCq:R: */
- genoperandoperand(ArithmeticShiftRightCqR, 1, scratchReg);
+ genoperandoperand(ArithmeticShiftRightCqR, 1, reg);
return 0;
}
@@ -10564,10 +10615,8 @@
/* begin Jump: */
jumpFailClass = genoperand(Jump, ((sqInt)0));
jmpTarget(jumpImmediate, gLabel());
- if (!(smallIntegerIsOnlyImmediateType())) {
- jumpNonInt = genJumpNotSmallIntegerInScratchReg(TempReg);
- }
- genConvertSmallIntegerToIntegerInScratchReg(ClassReg);
+
+ genConvertSmallIntegerToIntegerInReg(ClassReg);
/* begin ConvertR:Rd: */
genoperandoperand(ConvertRRd, ClassReg, DPFPReg1);
/* begin Jump: */
@@ -10575,9 +10624,7 @@
jmpTarget(jumpFailAlloc, gLabel());
compileFallbackToInterpreterPrimitive();
jmpTarget(jumpFailClass, gLabel());
- if (!(smallIntegerIsOnlyImmediateType())) {
- jmpTarget(jumpNonInt, getJmpTarget(jumpFailClass));
- }
+
return 0;
}
@@ -10629,18 +10676,14 @@
/* begin RetN: */
genoperand(RetN, 0);
jmpTarget(jumpImmediate, gLabel());
- if (!(smallIntegerIsOnlyImmediateType())) {
- jumpNonInt = genJumpNotSmallIntegerInScratchReg(TempReg);
- }
- genConvertSmallIntegerToIntegerInScratchReg(Arg0Reg);
+
+ genConvertSmallIntegerToIntegerInReg(Arg0Reg);
/* begin ConvertR:Rd: */
genoperandoperand(ConvertRRd, Arg0Reg, DPFPReg1);
/* begin Jump: */
genoperand(Jump, ((sqInt)compare));
jmpTarget(jumpFail, gLabel());
- if (!(smallIntegerIsOnlyImmediateType())) {
- jmpTarget(jumpNonInt, getJmpTarget(jumpFail));
- }
+
return 0;
}
@@ -10765,11 +10808,11 @@
}
-/* Make sure that the obejct in reg is not forwarded. By default there is
+/* Make sure that the object in reg is not forwarded. By default there is
nothing to do. Subclasses for memory managers that forward will override. */
static sqInt
-genEnsureRegNotForwardedscratchReg(sqInt reg, sqInt scratch)
+genEnsureObjInRegRegNotForwardedscratchReg(sqInt reg, sqInt scratch)
{
return 0;
}
@@ -11267,21 +11310,15 @@
address = cFramePointerAddress();
genoperandoperand(MoveRAw, FPReg, address);
}
- if ((leafCallStackPointerDelta(backEnd)) == 0) {
- /* begin MoveR:Aw: */
- address1 = cStackPointerAddress();
- genoperandoperand(MoveRAw, SPReg, address1);
- }
- else {
- /* begin MoveR:R: */
- genoperandoperand(MoveRR, SPReg, TempReg);
- /* begin AddCq:R: */
- quickConstant = leafCallStackPointerDelta(backEnd);
- genoperandoperand(AddCqR, quickConstant, TempReg);
- /* begin MoveR:Aw: */
- address2 = cStackPointerAddress();
- genoperandoperand(MoveRAw, TempReg, address2);
- }
+ /* begin MoveR:R: */
+ genoperandoperand(MoveRR, SPReg, TempReg);
+ /* begin AddCq:R: */
+ quickConstant = leafCallStackPointerDelta(backEnd);
+ genoperandoperand(AddCqR, quickConstant, TempReg);
+ /* begin MoveR:Aw: */
+ address2 = cStackPointerAddress();
+ genoperandoperand(MoveRAw, TempReg, address2);
+
/* begin RetN: */
genoperand(RetN, 0);
outputInstructionsForGeneratedRuntimeAt(startAddress);
@@ -11443,13 +11480,9 @@
# endif /* Debug */
ceEnter0ArgsPIC = genEnterPICEnilopmartNumArgs(0);
- if ((numRegArgs()) >= 1) {
- ceEnter1ArgsPIC = genEnterPICEnilopmartNumArgs(1);
- if ((numRegArgs()) >= 2) {
- ceEnter1ArgsPIC = genEnterPICEnilopmartNumArgs(2);
- assert((numRegArgs()) == 2);
- }
- }
+ ceEnter1ArgsPIC = genEnterPICEnilopmartNumArgs(1);
+
+
}
@@ -12240,6 +12273,15 @@
}
+/* subclasses override if they can */
+
+static sqInt
+genInnerPrimitiveAtPut(sqInt retNoffset)
+{
+ return unimplementedPrimitive();
+}
+
+
/* c.f. StackInterpreter>>stSizeOf: lengthOf:baseHeader:format:
fixedFieldsOf:format:length:
*/
@@ -12366,7 +12408,7 @@
jumpNotIndexable = jumpNotIndexable1;
jumpIsContext = jumpIsContext1;
- genConvertSmallIntegerToIntegerInScratchReg(Arg1Reg);
+ genConvertSmallIntegerToIntegerInReg(Arg1Reg);
/* begin SubCq:R: */
genoperandoperand(SubCqR, 1, Arg1Reg);
/* begin CmpR:R: */
@@ -12411,7 +12453,7 @@
genoperandoperand(AddCqR, BaseHeaderSize, Arg1Reg);
/* begin MoveXbr:R:R: */
genoperandoperandoperand(MoveXbrRR, Arg1Reg, ReceiverResultReg, ReceiverResultReg);
- genConvertIntegerToSmallIntegerInScratchReg(ReceiverResultReg);
+ genConvertIntegerToSmallIntegerInReg(ReceiverResultReg);
/* begin RetN: */
genoperand(RetN, retNoffset);
jmpTarget(jumpFmtLt8, gLabel());
@@ -12576,7 +12618,7 @@
jumpNotIndexable = jumpNotIndexable1;
jumpIsContext = jumpIsContext1;
- genConvertIntegerToSmallIntegerInScratchReg(ClassReg);
+ genConvertIntegerToSmallIntegerInReg(ClassReg);
/* begin MoveR:R: */
genoperandoperand(MoveRR, ClassReg, ReceiverResultReg);
/* begin RetN: */
@@ -12586,6 +12628,15 @@
}
+/* subclasses override if they can */
+
+static sqInt
+genInnerPrimitiveStringAtPut(sqInt retNoffset)
+{
+ return unimplementedPrimitive();
+}
+
+
/* c.f. StackInterpreter>>stSizeOf: lengthOf:baseHeader:format:
fixedFieldsOf:format:length:
*/
@@ -12649,7 +12700,7 @@
jmpTarget(jumpSkip, gSubCqR(BaseHeaderSize, ClassReg));
/* begin SubR:R: */
genoperandoperand(SubRR, SendNumArgsReg, ClassReg);
- genConvertSmallIntegerToIntegerInScratchReg(Arg1Reg);
+ genConvertSmallIntegerToIntegerInReg(Arg1Reg);
/* begin SubCq:R: */
genoperandoperand(SubCqR, 1, Arg1Reg);
/* begin CmpR:R: */
@@ -13007,6 +13058,7 @@
/* begin MoveCw:R: */
genoperandoperand(MoveCwR, selector, ClassReg);
CallNewspeakSend(dynamicSuperSendTrampolines[((numArgs < (NumSendTrampolines - 1)) ? numArgs : (NumSendTrampolines - 1))]);
+ usesMethodClass = 1;
(optStatus.isReceiverResultRegLive = 0);
return ssPushRegister(ReceiverResultReg);
}
@@ -13025,6 +13077,7 @@
/* begin MoveCw:R: */
genoperandoperand(MoveCwR, selector, ClassReg);
CallSend(superSendTrampolines[((numArgs < (NumSendTrampolines - 1)) ? numArgs : (NumSendTrampolines - 1))]);
+ usesMethodClass = 1;
(optStatus.isReceiverResultRegLive = 0);
return ssPushRegister(ReceiverResultReg);
}
@@ -13205,7 +13258,7 @@
/* begin MoveR:R: */
genoperandoperand(MoveRR, ReceiverResultReg, TempReg);
- genConvertSmallIntegerToIntegerInScratchReg(TempReg);
+ genConvertSmallIntegerToIntegerInReg(TempReg);
/* begin ConvertR:Rd: */
genoperandoperand(ConvertRRd, TempReg, DPFPReg0);
jumpFailAlloc = genAllocFloatValueintoscratchRegscratchReg(DPFPReg0, SendNumArgsReg, ClassReg, TempReg);
@@ -13230,6 +13283,18 @@
}
static sqInt
+genPrimitiveAtPut(void)
+{
+ sqInt r;
+
+ if ((((r = genInnerPrimitiveAtPut(0))) < 0)
+ && (r != UnimplementedPrimitive)) {
+ return r;
+ }
+ return compileFallbackToInterpreterPrimitive();
+}
+
+static sqInt
genPrimitiveBitAnd(void)
{
AbstractInstruction *jumpNotSI;
@@ -13323,7 +13388,7 @@
/* begin MoveR:R: */
genoperandoperand(MoveRR, Arg0Reg, ClassReg);
jumpNotSI = genJumpNotSmallIntegerInScratchReg(TempReg);
- genConvertSmallIntegerToIntegerInScratchReg(ClassReg);
+ genConvertSmallIntegerToIntegerInReg(ClassReg);
if (!(setsConditionCodesFor(lastOpcode(), JumpNegative))) {
/* begin CmpCq:R: */
genoperandoperand(CmpCqR, 0, ClassReg);
@@ -13524,7 +13589,7 @@
/* begin SubCq:R: */
genoperandoperand(SubCqR, 1, TempReg);
jmpTarget(jumpSameSign, (convert = gLabel()));
- genConvertIntegerToSmallIntegerInScratchReg(TempReg);
+ genConvertIntegerToSmallIntegerInReg(TempReg);
/* begin MoveR:R: */
genoperandoperand(MoveRR, TempReg, ReceiverResultReg);
/* begin RetN: */
@@ -13570,7 +13635,7 @@
genoperandoperand(CmpCqR, quickConstant, TempReg);
/* begin JumpGreaterOrEqual: */
jumpOverflow = genoperand(JumpGreaterOrEqual, ((sqInt)0));
- genConvertIntegerToSmallIntegerInScratchReg(TempReg);
+ genConvertIntegerToSmallIntegerInReg(TempReg);
/* begin MoveR:R: */
genoperandoperand(MoveRR, TempReg, ReceiverResultReg);
/* begin RetN: */
@@ -13707,20 +13772,12 @@
genoperandoperand(MoveRR, ReceiverResultReg, ClassReg);
jumpSI = genJumpSmallIntegerInScratchReg(ClassReg);
genGetHashFieldNonImmOfasSmallIntegerInto(ReceiverResultReg, TempReg);
- if (!(isHashSetOnInstanceCreation())) {
- /* begin CmpCq:R: */
- genoperandoperand(CmpCqR, ConstZero, TempReg);
- /* begin JumpZero: */
- jumpNotSet = genoperand(JumpZero, ((sqInt)0));
- }
+
/* begin MoveR:R: */
genoperandoperand(MoveRR, TempReg, ReceiverResultReg);
/* begin RetN: */
genoperand(RetN, 0);
- if (!(isHashSetOnInstanceCreation())) {
- jmpTarget(jumpNotSet, gLabel());
- compileFallbackToInterpreterPrimitive();
- }
+
jmpTarget(jumpSI, gLabel());
return 0;
}
@@ -13910,7 +13967,7 @@
genoperandoperand(CmpCqR, quickConstant, TempReg);
/* begin JumpGreaterOrEqual: */
jumpOverflow = genoperand(JumpGreaterOrEqual, ((sqInt)0));
- genConvertIntegerToSmallIntegerInScratchReg(TempReg);
+ genConvertIntegerToSmallIntegerInReg(TempReg);
/* begin MoveR:R: */
genoperandoperand(MoveRR, TempReg, ReceiverResultReg);
/* begin RetN: */
@@ -13943,6 +14000,18 @@
}
static sqInt
+genPrimitiveStringAtPut(void)
+{
+ sqInt r;
+
+ if ((((r = genInnerPrimitiveStringAtPut(0))) < 0)
+ && (r != UnimplementedPrimitive)) {
+ return r;
+ }
+ return compileFallbackToInterpreterPrimitive();
+}
+
+static sqInt
genPrimitiveSubtract(void)
{
AbstractInstruction *jumpNotSI;
@@ -14209,7 +14278,7 @@
association = getLiteral(literalIndex);
annotateobjRef(gMoveCwR(association, TempReg), association);
- genEnsureRegNotForwardedscratchReg(TempReg, freeReg);
+ genEnsureObjInRegRegNotForwardedscratchReg(TempReg, freeReg);
genLoadSlotsourceRegdestReg(ValueIndex, TempReg, freeReg);
ssPushRegister(freeReg);
return 0;
@@ -14796,7 +14865,7 @@
}
-/* Generate a trampoline with four arguments.
+/* Generate a trampoline with three arguments.
Hack: a negative value indicates an abstract register, a non-negative
value indicates a constant. */
@@ -14917,7 +14986,7 @@
genoperandoperand(CmpCqR, quickConstant, SendNumArgsReg);
/* begin JumpNonZero: */
jumpFail = genoperand(JumpNonZero, ((sqInt)0));
- genConvertSmallIntegerToIntegerInScratchReg(ReceiverResultReg);
+ genConvertSmallIntegerToIntegerInReg(ReceiverResultReg);
/* begin ConvertR:Rd: */
genoperandoperand(ConvertRRd, ReceiverResultReg, DPFPReg0);
genGetDoubleValueOfinto(Arg0Reg, DPFPReg1);
@@ -15013,14 +15082,9 @@
/* begin MoveR:R: */
genoperandoperand(MoveRR, Arg0Reg, TempReg);
if (!rcvrIsInt) {
- if (isSmallIntegerTagNonZero()) {
- /* begin AndR:R: */
- genoperandoperand(AndRR, ReceiverResultReg, TempReg);
- }
- else {
- /* begin OrR:R: */
- genoperandoperand(OrRR, ReceiverResultReg, TempReg);
- }
+ /* begin AndR:R: */
+ genoperandoperand(AndRR, ReceiverResultReg, TempReg);
+
}
}
jumpNotSmallInts = genJumpNotSmallIntegerInScratchReg(TempReg);
@@ -15232,14 +15296,9 @@
/* begin MoveR:R: */
genoperandoperand(MoveRR, Arg0Reg, TempReg);
if (!rcvrIsInt) {
- if (isSmallIntegerTagNonZero()) {
- /* begin AndR:R: */
- genoperandoperand(AndRR, ReceiverResultReg, TempReg);
- }
- else {
- /* begin OrR:R: */
- genoperandoperand(OrRR, ReceiverResultReg, TempReg);
- }
+ /* begin AndR:R: */
+ genoperandoperand(AndRR, ReceiverResultReg, TempReg);
+
}
}
jumpNotSmallInts = genJumpNotSmallIntegerInScratchReg(TempReg);
@@ -15442,7 +15501,7 @@
&& (!(shouldAnnotateObjectReference(constVal)))) {
ssAllocateRequiredReg(ReceiverResultReg);
annotateobjRef(gMoveCwR(association, ReceiverResultReg), association);
- genEnsureRegNotForwardedscratchReg(ReceiverResultReg, TempReg);
+ genEnsureObjInRegRegNotForwardedscratchReg(ReceiverResultReg, TempReg);
ssStorePoptoPreferredReg(popBoolean, TempReg);
if (traceStores > 0) {
CallRT(ceTraceStoreTrampoline);
@@ -15463,7 +15522,7 @@
}
ssAllocateCallReg(ReceiverResultReg);
annotateobjRef(gMoveCwR(association, ReceiverResultReg), association);
- genEnsureRegNotForwardedscratchReg(ReceiverResultReg, TempReg);
+ genEnsureObjInRegRegNotForwardedscratchReg(ReceiverResultReg, TempReg);
if (traceStores > 0) {
/* begin MoveR:R: */
genoperandoperand(MoveRR, topReg, TempReg);
@@ -15659,9 +15718,7 @@
genoperandoperand(CmpRR, scratchReg, sourceReg);
/* begin JumpBelow: */
jmpSourceOld = genoperand(JumpBelow, ((sqInt)0));
- rootBitByteOffset = (isBigEndian(jmpSourceOld)
- ? BytesPerWord - RootBitDigitLength
- : RootBitDigitLength - 1);
+ rootBitByteOffset = RootBitDigitLength - 1;
/* N.B. MoveMb:r:R: does not zero other bits */
@@ -16672,6 +16729,8 @@
/* Set the target of a jump instruction. These all have the target in the
+ first operand. */
+/* Set the target of a jump instruction. These all have the target in the
first operand.
Override to cope with JumpFPNotEqual where because if IEEE NaN conformance
and the behaviour of COMISD/UCOMISD we generate two jumps to the same
@@ -16687,6 +16746,7 @@
jmpTarget(aDependent, anAbstractInstruction);
aDependent = (aDependent->dependent);
}
+ null;
((self_in_jmpTarget->operands))[0] = (((usqInt)anAbstractInstruction));
return anAbstractInstruction;
}
@@ -18061,9 +18121,7 @@
{
sqInt startAddress;
- if ((numCheckFeaturesOpcodes(backEnd)) == 0) {
- return null;
- }
+
allocateOpcodesbytecodes(numCheckFeaturesOpcodes(backEnd), 0);
initialPC = 0;
endPC = numAbstractOpcodes - 1;
@@ -18077,11 +18135,11 @@
static sqInt
maybeGenerateICacheFlush(void)
{
+ static void (*ceFlushICache)(unsigned long from, unsigned long to);
sqInt startAddress;
- if ((numICacheFlushOpcodes(backEnd)) == 0) {
- return null;
- }
+ return null;
+
allocateOpcodesbytecodes(numICacheFlushOpcodes(backEnd), 0);
initialPC = 0;
endPC = numAbstractOpcodes - 1;
@@ -18457,6 +18515,19 @@
return n;
}
+
+/* CogObjectRepresentationForSqueakV3 only implements at most 1-arg
+ primitives, because
+ the complexity of the object representation makes it difficult to
+ implement at:put:, the most
+ performance-critical 2-argument primitive. */
+
+sqInt
+numRegArgs(void)
+{
+ return 1;
+}
+
static sqInt
numSmallIntegerBits(void)
{
@@ -18616,7 +18687,7 @@
extent = rewriteInlineCacheAttagtarget(backEnd, outerReturn, selector, (((sqInt)oPIC)) + cmEntryOffset);
flushICacheFromto(processor, (outerReturn - 1) - extent, outerReturn - 1);
flushICacheFromto(processor, ((sqInt)oPIC), (((sqInt)oPIC)) + openPICSize);
- executeCogMethodFromLinkedSendwithReceiver(oPIC, receiver);
+ executeCogMethodfromLinkedSendWithReceiver(oPIC, receiver);
return 1;
}
Modified: branches/Cog/nscogsrc/vm/cogit.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.h 2013-12-09 18:15:54 UTC (rev 2822)
+++ branches/Cog/nscogsrc/vm/cogit.h 2013-12-11 00:45:24 UTC (rev 2823)
@@ -1,5 +1,5 @@
/* Automatically generated by
- CCodeGenerator VMMaker.oscog-eem.538 uuid: 6b6d8ba7-4913-4563-9d01-da880441f843
+ CCodeGenerator VMMaker.oscog-eem.554 uuid: a666e7e4-245e-4e8a-9536-3aefd4509f47
*/
@@ -51,6 +51,7 @@
sqInt minCogMethodAddress(void);
sqInt mnuOffset(void);
sqInt numMethodsOfType(sqInt cogMethodType);
+sqInt numRegArgs(void);
sqInt patchToOpenPICFornumArgsreceiver(sqInt selector, sqInt numArgs, sqInt receiver);
sqInt pcisWithinMethod(char *address, CogMethod *cogMethod);
void printCogMethodFor(void *address);
@@ -119,7 +120,6 @@
#define getCStackPointer() CStackPointer
#define noCheckEntryOffset() cmNoCheckEntryOffset
#define noContextSwitchBlockEntryOffset() blockNoContextSwitchOffset
-#define numRegArgs() 1
#define printOnTrace() (traceFlags & 1)
#define recordBlockTrace() (traceFlags & 4)
#define recordEventTrace() (traceFlags & 16)
Modified: branches/Cog/nscogsrc/vm/cogmethod.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogmethod.h 2013-12-09 18:15:54 UTC (rev 2822)
+++ branches/Cog/nscogsrc/vm/cogmethod.h 2013-12-11 00:45:24 UTC (rev 2823)
@@ -1,5 +1,5 @@
/* Automatically generated by
- CCodeGenerator VMMaker.oscog-eem.538 uuid: 6b6d8ba7-4913-4563-9d01-da880441f843
+ CCodeGenerator VMMaker.oscog-eem.554 uuid: a666e7e4-245e-4e8a-9536-3aefd4509f47
*/
typedef struct {
@@ -11,7 +11,8 @@
unsigned cpicHasMNUCase : 1;
unsigned cmUsageCount : 3;
unsigned cmUsesPenultimateLit : 1;
- unsigned cmUnusedFlags : 3;
+ unsigned cmUsesMethodClass : 1;
+ unsigned cmUnusedFlags : 2;
unsigned stackCheckOffset : 12;
} CogBlockMethod;
@@ -23,7 +24,8 @@
unsigned cpicHasMNUCase : 1;
unsigned cmUsageCount : 3;
unsigned cmUsesPenultimateLit : 1;
- unsigned cmUnusedFlags : 3;
+ unsigned cmUsesMethodClass : 1;
+ unsigned cmUnusedFlags : 2;
unsigned stackCheckOffset : 12;
unsigned short blockSize;
unsigned short blockEntryOffset;
Modified: branches/Cog/nscogsrc/vm/cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.c 2013-12-09 18:15:54 UTC (rev 2822)
+++ branches/Cog/nscogsrc/vm/cointerp.c 2013-12-11 00:45:24 UTC (rev 2823)
@@ -1,9 +1,9 @@
/* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.545 uuid: 36659c65-ab43-4cb4-8f2f-9fecfadfa4d9
+ CCodeGeneratorGlobalStructure VMMaker.oscog-eem.554 uuid: a666e7e4-245e-4e8a-9536-3aefd4509f47
from
- CoInterpreter VMMaker.oscog-eem.545 uuid: 36659c65-ab43-4cb4-8f2f-9fecfadfa4d9
+ CoInterpreter VMMaker.oscog-eem.554 uuid: a666e7e4-245e-4e8a-9536-3aefd4509f47
*/
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.545 uuid: 36659c65-ab43-4cb4-8f2f-9fecfadfa4d9 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.554 uuid: a666e7e4-245e-4e8a-9536-3aefd4509f47 " __DATE__ ;
char *__interpBuildInfo = __buildInfo;
@@ -522,9 +522,9 @@
static void enterRegisterArgCogMethodatreceiver(CogMethod *cogMethod, sqInt entryOffset, sqInt rcvr);
static sqInt enterSmalltalkExecutiveImplementation(void);
static char * establishFrameForContextToReturnTo(sqInt contextToReturnTo);
-void executeCogMethodFromLinkedSendwithReceiver(CogMethod *cogMethod, sqInt rcvr);
-void executeCogMethodFromLinkedSendwithReceiverandCacheTag(CogMethod *cogMethod, sqInt rcvr, sqInt cacheTag);
-static void executeCogMethodFromUnlinkedSendwithReceiver(CogMethod *cogMethod, sqInt rcvr);
+void executeCogMethodfromLinkedSendWithReceiver(CogMethod *cogMethod, sqInt rcvr);
+void executeCogMethodfromLinkedSendWithReceiverandCacheTag(CogMethod *cogMethod, sqInt rcvr, sqInt cacheTag);
+static void executeCogMethodfromUnlinkedSendWithReceiver(CogMethod *cogMethod, sqInt rcvr);
static sqInt executeNewMethod(void);
static sqInt explicitOuterReceiverwithObjectwithMixin(sqInt n, sqInt anObject, sqInt mixin);
static void externalDivorceFrameandContext(char *theFP, sqInt ctxt);
@@ -571,10 +571,10 @@
sqInt floatObjectOf(double aFloat);
double floatValueOf(sqInt oop);
sqInt flushExternalPrimitiveOf(sqInt methodObj);
-static void followForwardedFrameContentsstackPointer(char *theFP, char *theSP);
static void followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth);
static sqInt followForwarded(sqInt objOop);
static void followForwardingPointersInStackZone(sqInt theBecomeEffectsFlags);
+static void followNecessaryForwardingInMethod(sqInt methodObj);
sqInt forceInterruptCheck(void);
void forceInterruptCheckFromHeartbeat(void);
sqInt formatOfClass(sqInt classPointer);
@@ -617,8 +617,6 @@
sqInt * getStackPointer(void);
sqInt getThisSessionID(void);
static sqInt goodContextSize(sqInt oop);
-static sqInt handleForwardedSelectorFaultFor(sqInt selectorOop);
-static sqInt handleForwardedSendFaultFor(sqInt classTag);
static sqInt handleMNUInMachineCodeToclassForMessage(sqInt selectorIndex, sqInt rcvr, sqInt classForMessage);
static sqInt handleSpecialSelectorSendFaultForfpsp(sqInt obj, char *theFP, char *theSP);
static void handleStackOverflow(void);
@@ -668,7 +666,6 @@
static sqInt isContextNonImm(sqInt oop);
static sqInt isContext(sqInt oop);
sqInt isFloatObject(sqInt oop);
-static sqInt isForwardedClassTag(sqInt classTag);
static sqInt isFrameonPage(char *aFrame, StackPage *aPage);
static sqInt isFree(StackPage * self_in_isFree);
sqInt isImmediate(sqInt anOop);
@@ -685,6 +682,7 @@
sqInt isNonIntegerObject(sqInt objectPointer);
static sqInt isNullExternalPrimitiveCall(sqInt aMethodObj);
sqInt isOopCompiledMethod(sqInt oop);
+static sqInt isOopForwarded(sqInt oop);
sqInt isOopImmutable(sqInt anOop);
sqInt isOopMutable(sqInt anOop);
sqInt isPointers(sqInt oop);
@@ -757,6 +755,7 @@
static sqInt marriedContextpointsTostackDeltaForCurrentFrame(sqInt spouseContext, sqInt anOop, sqInt stackDeltaForCurrentFrame);
static void marryContextInNewStackPageAndInitializeInterpreterRegisters(sqInt aContext);
static sqInt marryFrameSP(char *theFP, char *theSP);
+sqInt maxLookupNoMNUErrorCode(void);
static void maybeFlagMethodAsInterpreted(sqInt aMethod);
sqInt maybeSplObj(sqInt index);
sqInt methodArgumentCount(void);
@@ -1147,7 +1146,7 @@
static void rewriteMethodCacheEntryForExternalPrimitiveToFunction(void (*localPrimAddress)(void));
static sqInt roomToPushNArgs(sqInt n);
static void runLeakCheckerForFullGC(sqInt fullGCFlag);
-static usqInt safeObjectAfter(sqInt oop);
+static sqInt safeObjectAfter(sqInt oop);
static sqInt safePrintStringOf(sqInt oop);
usqInt scavengeThresholdAddress(void);
EXPORT(sqInt) sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext);
@@ -1374,6 +1373,7 @@
_iss sqInt globalSessionID;
_iss sqInt interruptKeycode;
_iss sqInt maxExtSemTabSizeSet;
+_iss usqInt memory;
_iss usqLong statIGCDeltaUsecs;
_iss sqInt deferSmash;
_iss sqInt deferredSmash;
@@ -1442,17 +1442,18 @@
sqInt desiredNumStackPages;
sqInt extraVMMemory;
sqInt desiredCogCodeSize;
-static usqInt heapBase;
+usqInt heapBase;
sqInt breakSelectorLength = -1;
sqInt deferDisplayUpdates;
-static usqInt memory;
void * showSurfaceFn;
char * breakSelector;
struct VirtualMachine* interpreterProxy;
static void (*interruptCheckChain)(void) = 0;
sqInt suppressHeartbeatFlag;
static const sqInt headerTypeBytes[] = {
-8, 4, 0, 0};
+ 8, 4, 0, 0
+ }
+;
static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = {
/* 0 */ (void (*)(void))0,
/* 1 */ primitiveAdd,
@@ -2032,7 +2033,7 @@
/* 575 */ (void (*)(void))0,
0 };
static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.545";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.554";
sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
volatile int sendTrace;
@@ -2062,7 +2063,6 @@
#define instFormatFieldLSB() 8
#define instFormatFieldWidth() 4
#define isForwarded(oop) false
-#define isOopForwarded(oop) false
#define memory() memory
#define mostRecentlyUsedPage() GIV(mostRecentlyUsedPage)
#define nextOpenPIC methodObject
@@ -5034,9 +5034,7 @@
/* begin literal: */
assert(GIV(method) == (iframeMethod(localFP)));
litVar = longAt((GIV(method) + BaseHeaderSize) + ((variableIndex + LiteralStart) << ShiftForWord));
- if (isForwarded(litVar)) {
- litVar = followForwarded(litVar);
- }
+
/* begin storePointer:ofObject:withValue: */
if ((((usqInt) litVar)) < (((usqInt) GIV(youngStart)))) {
possibleRootStoreIntovalue(litVar, longAtPointer(localSP));
@@ -5088,9 +5086,7 @@
/* begin literal: */
assert(GIV(method) == (iframeMethod(localFP)));
litVar = longAt((GIV(method) + BaseHeaderSize) + ((variableIndex + LiteralStart) << ShiftForWord));
- if (isForwarded(litVar)) {
- litVar = followForwarded(litVar);
- }
+
/* begin storePointer:ofObject:withValue: */
if ((((usqInt) litVar)) < (((usqInt) GIV(youngStart)))) {
possibleRootStoreIntovalue(litVar, longAtPointer(localSP));
@@ -5245,75 +5241,7 @@
GIV(instructionPointer) = oopForPointer(localIP);
GIV(stackPointer) = localSP;
GIV(framePointer) = localFP;
- if ((isOopForwarded(GIV(messageSelector)))
- || (0)) {
- if (isOopForwarded(GIV(messageSelector))) {
- GIV(messageSelector) = handleForwardedSelectorFaultFor(GIV(messageSelector));
- }
-
- /* begin lookupInMethodCacheSel:classTag: */
-
- /* shift drops two low-order zeros from addresses */
-
- hash = GIV(messageSelector) ^ lkupClassTag;
-
- /* first probe */
-
- probe = hash & MethodCacheMask;
- if (((GIV(methodCache)[probe + MethodCacheSelector]) == GIV(messageSelector))
- && ((GIV(methodCache)[probe + MethodCacheClass]) == lkupClassTag)) {
- GIV(newMethod) = GIV(methodCache)[probe + MethodCacheMethod];
- primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe + MethodCachePrimFunction]));
- ok = 1;
- goto l311;
- }
-
- /* second probe */
-
- probe = (((usqInt) hash) >> 1) & MethodCacheMask;
- if (((GIV(methodCache)[probe + MethodCacheSelector]) == GIV(messageSelector))
- && ((GIV(methodCache)[probe + MethodCacheClass]) == lkupClassTag)) {
- GIV(newMethod) = GIV(methodCache)[probe + MethodCacheMethod];
- primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe + MethodCachePrimFunction]));
- ok = 1;
- goto l311;
- }
- probe = (((usqInt) hash) >> 2) & MethodCacheMask;
- if (((GIV(methodCache)[probe + MethodCacheSelector]) == GIV(messageSelector))
- && ((GIV(methodCache)[probe + MethodCacheClass]) == lkupClassTag)) {
- GIV(newMethod) = GIV(methodCache)[probe + MethodCacheMethod];
- primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe + MethodCachePrimFunction]));
- ok = 1;
- goto l311;
- }
- ok = 0;
- l311: /* end lookupInMethodCacheSel:classTag: */;
- if (ok) {
- /* begin ifAppropriateCompileToNativeCode:selector: */
- VM_LABEL(1ifAppropriateCompileToNativeCodeselector);
- methodHeader1 = longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
- if (isCogMethodReference(methodHeader1)) {
-
- /* makeBaseFrame: can create cog methods with nil selectors. */
-
- cogMethod1 = ((CogMethod *) methodHeader1);
- if (((cogMethod1->selector)) == GIV(nilObj)) {
- setSelectorOfto(cogMethod1, GIV(messageSelector));
- }
- }
- else {
- if ((((((sqInt) methodHeader1)) < 0
- ? (((usqInt) methodHeader1) >> 1) & 0xFFFF
- : (((usqInt) methodHeader1) >> 10) & 0xFF)) <= maxLiteralCountForCompile) {
- cogselector(GIV(newMethod), GIV(messageSelector));
- }
- else {
- maybeFlagMethodAsInterpreted(GIV(newMethod));
- }
- }
- goto l313;
- }
- }
+
GIV(lkupClass) = lkupClassTag;
lookupMethodInClass(GIV(lkupClass));
/* begin internalizeIPandSP */
@@ -5771,9 +5699,7 @@
/* begin literal: */
assert(GIV(method) == (iframeMethod(localFP)));
litVar = longAt((GIV(method) + BaseHeaderSize) + ((byte3 + LiteralStart) << ShiftForWord));
- if (isForwarded(litVar)) {
- litVar = followForwarded(litVar);
- }
+
/* begin storePointer:ofObject:withValue: */
if ((((usqInt) litVar)) < (((usqInt) GIV(youngStart)))) {
possibleRootStoreIntovalue(litVar, top);
@@ -8889,13 +8815,9 @@
VM_LABEL(0bytecodePrimIdentical);
rcvr = longAtPointer(localSP + (1 * BytesPerOop));
- if (isOopForwarded(rcvr)) {
- rcvr = handleSpecialSelectorSendFaultForfpsp(rcvr, localFP, localSP);
- }
+
arg = longAtPointer(localSP + (0 * BytesPerOop));
- if (isOopForwarded(arg)) {
- arg = handleSpecialSelectorSendFaultForfpsp(arg, localFP, localSP);
- }
+
/* begin booleanCheat: */
if (rcvr == arg) {
goto booleanCheatTrue;
@@ -8915,9 +8837,7 @@
VM_LABEL(0bytecodePrimClass);
rcvr = longAtPointer(localSP);
- if (isOopForwarded(rcvr)) {
- rcvr = handleSpecialSelectorSendFaultForfpsp(rcvr, localFP, localSP);
- }
+
/* begin internalStackTopPut: */
aValue = ((rcvr & 1)
? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassInteger << ShiftForWord))
@@ -11756,12 +11676,8 @@
VM_LABEL(0bytecodePrimIdenticalV4);
rcvr = longAtPointer(localSP + (1 * BytesPerOop));
arg = longAtPointer(localSP + (0 * BytesPerOop));
- if (isOopForwarded(rcvr)) {
- rcvr = handleSpecialSelectorSendFaultForfpsp(rcvr, localFP, localSP);
- }
- if (isOopForwarded(arg)) {
- arg = handleSpecialSelectorSendFaultForfpsp(arg, localFP, localSP);
- }
+
+
/* begin booleanCheatV4: */
if (rcvr == arg) {
goto booleanCheatTrueV4;
@@ -12564,9 +12480,7 @@
/* begin literal: */
assert(GIV(method) == (iframeMethod(localFP)));
litVar = longAt((GIV(method) + BaseHeaderSize) + ((variableIndex + LiteralStart) << ShiftForWord));
- if (isForwarded(litVar)) {
- litVar = followForwarded(litVar);
- }
+
/* begin storePointer:ofObject:withValue: */
if ((((usqInt) litVar)) < (((usqInt) GIV(youngStart)))) {
possibleRootStoreIntovalue(litVar, longAtPointer(localSP));
@@ -12724,9 +12638,7 @@
/* begin literal: */
assert(GIV(method) == (iframeMethod(localFP)));
litVar = longAt((GIV(method) + BaseHeaderSize) + ((variableIndex + LiteralStart) << ShiftForWord));
- if (isForwarded(litVar)) {
- litVar = followForwarded(litVar);
- }
+
/* begin storePointer:ofObject:withValue: */
if ((((usqInt) litVar)) < (((usqInt) GIV(youngStart)))) {
possibleRootStoreIntovalue(litVar, longAtPointer(localSP));
@@ -13161,13 +13073,12 @@
@@ Diff output truncated at 50000 characters. @@