[Vm-dev] [commit][3687] CogVM source as per VMMaker.oscog-eem.1849
commits at squeakvm.org
commits at squeakvm.org
Wed Apr 27 22:35:26 UTC 2016
Revision: 3687
Author: eliot
Date: 2016-04-27 15:35:21 -0700 (Wed, 27 Apr 2016)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.1849
General:
Change signature of oopForPointer to eliminate compiler warnings.
Fix a bad bug in primitiveVoidVMStateForMethod. One might think that the heap
scan is unnecessary if the method does not have a cog method. But it could be
the case that the code zone has recently been reclaimed and so not having a cog
method is no indication that it didn't have a cog method some time in the recent
past, and that there are indeed still contexts with machine code pcs out there.
Refactor flushExternalPrimitiveOf: and callers to eliminate duplication; moving
the primitive number test into flushExternalPrimitiveOf:.
Side-step inlining for bereaveAllMarriedContextsForSnapshotFlushingExternalPrimitivesIf:
to reduce duplication in Spur's allObjectsDo: (which unrolls its argument three times).
Debugging: Add printContextReferencesTo: & printActivationsOf: and have them
print the pcs of the contexts they find.
Eliminate duplication in [directed]SuperclassSend.
Change overflow tests in precondition rather than postcondition for small
integer multiplication. Because integer overflow is undefined behaviour, and
because we can't rely on undefined behaviour, the compiler has a license to
eliminate the post-condition as dead code (at least since iso c89 acception).
Post-condition currently works because we use -fwrapv compiler flag, but
relying on specific compiler flags is bad practice in the long term.
Fix regression in signed 32bit long access (introduced beginning of April).
One symptom is:
(Alien newGC: 4)
signedLongAt: 1 put: -16r7287E552;
signedLongAt: 1
Fix positive32BitIntegerFor: for Spur64 which did work only because the constant
was generated ULL.
Cogit:
Reorder annotation constants to simplify isPCMappedAnnotation:.
Fix regression in VMMaker.oscog-eem.1823 when merging the two map enumerators
into one that affects Sista. The merged enumerator must extend
IsSendAnnotations with the AnnotationExtension.
Inline label maintennance funcs.
Susta Cogit:
Added a primitive to answer all the methods present in the machine code zone.
allMachineCodeMethods
<primitive: 'primitiveAllMethodsCompiledToMachineCode' module:''>
^#()
Slang:
Extend type inference capabilities from the AST. Unify type inference used to
#inferReturnTypeFromReturnsIn: with that based on AST. Now that type inference
is a bit more thorough, release type restrictions in #isFunctional in order to
obtain much more aggressive inlining. With those, a gain of 10% is possible
on the LargeIntegersPlugin dominated bench:
Use a type inference that better fits C rules (C99 standard section 6.3):
- in (float op int), int is promoted to double not float
- in (unsigned short op short) both operands are promoted to #int due to int
promotion rules.
Use minimum generality for generated integer constants:
- use int if variable fits in int
- else unsigned int
- else long long (long would be enough for 64bits versions, but long long works
for both 32 and 64)
- else unsigned long long
This is to avoid spurious unsigned promotion due to improved type inference.
Protect #pathTo:followWeak: which can currently only work with a signed int,
from possibly future spurious unsigned inference (I didn't bissect at which
stage exactly this happens, but it happened).
A few minor changes to eliminate C compiler warnings.
Mac OS X: Fix argument processing, so that e.g.
myvm -breaksel aSelector my.image
works (but -headless still fails).
Modified Paths:
--------------
branches/Cog/nsspur64src/vm/cogit.h
branches/Cog/nsspur64src/vm/cogitX64.c
branches/Cog/nsspur64src/vm/cointerp.c
branches/Cog/nsspur64src/vm/cointerp.h
branches/Cog/nsspur64src/vm/gcc3x-cointerp.c
branches/Cog/nsspursrc/vm/cogit.h
branches/Cog/nsspursrc/vm/cogitARMv5.c
branches/Cog/nsspursrc/vm/cogitIA32.c
branches/Cog/nsspursrc/vm/cogitMIPSEL.c
branches/Cog/nsspursrc/vm/cointerp.c
branches/Cog/nsspursrc/vm/cointerp.h
branches/Cog/nsspursrc/vm/gcc3x-cointerp.c
branches/Cog/nsspurstack64src/vm/gcc3x-interp.c
branches/Cog/nsspurstack64src/vm/interp.c
branches/Cog/nsspurstacksrc/vm/gcc3x-interp.c
branches/Cog/nsspurstacksrc/vm/interp.c
branches/Cog/platforms/Cross/vm/sqMemoryAccess.h
branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXApplication.m
branches/Cog/scripts/uploadvms
branches/Cog/spur64src/vm/cogit.h
branches/Cog/spur64src/vm/cogitX64.c
branches/Cog/spur64src/vm/cointerp.c
branches/Cog/spur64src/vm/cointerp.h
branches/Cog/spur64src/vm/gcc3x-cointerp.c
branches/Cog/spursistasrc/vm/cogit.h
branches/Cog/spursistasrc/vm/cogitARMv5.c
branches/Cog/spursistasrc/vm/cogitIA32.c
branches/Cog/spursistasrc/vm/cogitMIPSEL.c
branches/Cog/spursistasrc/vm/cointerp.c
branches/Cog/spursistasrc/vm/cointerp.h
branches/Cog/spursistasrc/vm/gcc3x-cointerp.c
branches/Cog/spursrc/vm/cogit.h
branches/Cog/spursrc/vm/cogitARMv5.c
branches/Cog/spursrc/vm/cogitIA32.c
branches/Cog/spursrc/vm/cogitMIPSEL.c
branches/Cog/spursrc/vm/cointerp.c
branches/Cog/spursrc/vm/cointerp.h
branches/Cog/spursrc/vm/gcc3x-cointerp.c
branches/Cog/spurstack64src/vm/gcc3x-interp.c
branches/Cog/spurstack64src/vm/interp.c
branches/Cog/spurstacksrc/vm/gcc3x-interp.c
branches/Cog/spurstacksrc/vm/interp.c
branches/Cog/src/vm/cogit.h
branches/Cog/src/vm/cogitARMv5.c
branches/Cog/src/vm/cogitIA32.c
branches/Cog/src/vm/cogitMIPSEL.c
branches/Cog/src/vm/cointerp.c
branches/Cog/src/vm/cointerp.h
branches/Cog/src/vm/cointerpmt.c
branches/Cog/src/vm/cointerpmt.h
branches/Cog/src/vm/gcc3x-cointerp.c
branches/Cog/src/vm/gcc3x-cointerpmt.c
branches/Cog/stacksrc/vm/gcc3x-interp.c
branches/Cog/stacksrc/vm/interp.c
Property Changed:
----------------
branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
Modified: branches/Cog/nsspur64src/vm/cogit.h
===================================================================
--- branches/Cog/nsspur64src/vm/cogit.h 2016-04-27 15:01:30 UTC (rev 3686)
+++ branches/Cog/nsspur64src/vm/cogit.h 2016-04-27 22:35:21 UTC (rev 3687)
@@ -1,5 +1,5 @@
/* Automatically generated by
- CCodeGenerator VMMaker.oscog-eem.1834 uuid: 858a9c54-959b-4d7e-b9b3-5f083d37f488
+ CCodeGenerator VMMaker.oscog-eem.1849 uuid: d65892b1-b636-442a-affd-36ef8f9abcd1
*/
@@ -73,6 +73,8 @@
extern void addAllToYoungReferrers(void);
extern void freeMethod(CogMethod *cogMethod);
extern CogMethod * methodFor(void *address);
+extern sqInt methodsCompiledToMachineCodeInto(sqInt arrayObj);
+extern sqInt numMethods(void);
extern sqInt numMethodsOfType(sqInt cogMethodType);
extern void printCogMethods(void);
extern void printCogMethodsOfType(sqInt cmType);
Modified: branches/Cog/nsspur64src/vm/cogitX64.c
===================================================================
--- branches/Cog/nsspur64src/vm/cogitX64.c 2016-04-27 15:01:30 UTC (rev 3686)
+++ branches/Cog/nsspur64src/vm/cogitX64.c 2016-04-27 22:35:21 UTC (rev 3687)
@@ -1,9 +1,9 @@
/* Automatically generated by
- CCodeGenerator VMMaker.oscog-eem.1832 uuid: 3e4d6e88-f60d-4a01-930d-7c5895b8a86a
+ CCodeGenerator VMMaker.oscog-eem.1849 uuid: d65892b1-b636-442a-affd-36ef8f9abcd1
from
- StackToRegisterMappingCogit VMMaker.oscog-eem.1832 uuid: 3e4d6e88-f60d-4a01-930d-7c5895b8a86a
+ StackToRegisterMappingCogit VMMaker.oscog-eem.1849 uuid: d65892b1-b636-442a-affd-36ef8f9abcd1
*/
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1832 uuid: 3e4d6e88-f60d-4a01-930d-7c5895b8a86a " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1849 uuid: d65892b1-b636-442a-affd-36ef8f9abcd1 " __DATE__ ;
char *__cogitBuildInfo = __buildInfo;
@@ -102,7 +102,7 @@
#define GCModeBecome 8
#define GCModeFull 1
#define GCModeNewSpace 2
-#define HasBytecodePC 4
+#define HasBytecodePC 5
#define HeaderIndex 0
#define IDIVR 117
#if !defined(IMMUTABILITY) /* Allow this to be overridden on the compiler command line */
@@ -121,7 +121,7 @@
#define IsNSSelfSend 10
#define IsNSSendCall 6
#define IsObjectReference 2
-#define IsRelativeCall 5
+#define IsRelativeCall 4
#define IsSendCall 7
#define IsSuperSend 8
#define Jump 15
@@ -431,7 +431,6 @@
static AbstractInstruction * NoDbgRegParms relocateJumpLongConditionalBeforeFollowingAddressby(AbstractInstruction * self_in_relocateJumpLongConditionalBeforeFollowingAddressby, sqInt pc, sqInt delta);
static AbstractInstruction * NoDbgRegParms resolveJumpTarget(AbstractInstruction * self_in_resolveJumpTarget);
static sqInt NoDbgRegParms rewriteConditionalJumpLongAttarget(AbstractInstruction * self_in_rewriteConditionalJumpLongAttarget, sqInt callSiteReturnAddress, sqInt callTargetAddress);
-static sqInt NoDbgRegParms setLabelOffset(AbstractInstruction * self_in_setLabelOffset, sqInt aValue);
static AbstractInstruction * NoDbgRegParms updateLabel(AbstractInstruction * self_in_updateLabel, AbstractInstruction *labelInstruction);
static sqInt NoDbgRegParms wantsNearAddressFor(AbstractInstruction * self_in_wantsNearAddressFor, sqInt anObject);
static CogMethod * NoDbgRegParms cmHomeMethod(CogBlockMethod * self_in_cmHomeMethod);
@@ -515,7 +514,7 @@
static sqInt NoDbgRegParms configureMNUCPICmethodOperandnumArgsdelta(CogMethod *cPIC, sqInt methodOperand, sqInt numArgs, sqInt addrDelta);
static sqInt NoDbgRegParms cPICHasForwardedClass(CogMethod *cPIC);
static sqInt NoDbgRegParms cPICHasFreedTargets(CogMethod *cPIC);
-static sqInt cPICPrototypeCaseOffset(void);
+static usqInt cPICPrototypeCaseOffset(void);
static sqInt NoDbgRegParms cPICHasTarget(CogMethod *cPIC, CogMethod *targetMethod);
static AbstractInstruction * NoDbgRegParms gDivRRQuoRem(sqInt rDivisor, sqInt rDividend, sqInt rQuotient, sqInt rRemainder);
extern sqInt defaultCogCodeSize(void);
@@ -532,7 +531,7 @@
static sqInt NoDbgRegParms findMapLocationForMcpcinMethod(sqInt targetMcpc, CogMethod *cogMethod);
extern CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod);
static sqInt NoDbgRegParms findIsBackwardBranchMcpcBcpcMatchingMcpc(BytecodeDescriptor *descriptor, sqInt isBackwardBranchAndAnnotation, char *mcpc, sqInt bcpc, void *targetMcpc);
-static sqInt NoDbgRegParms firstMappedPCFor(CogMethod *cogMethod);
+static usqInt NoDbgRegParms firstMappedPCFor(CogMethod *cogMethod);
extern void followForwardedLiteralsIn(CogMethod *cogMethod);
extern void followForwardedMethods(void);
static sqInt NoDbgRegParms followMaybeObjRefInClosedPICAt(sqInt mcpc);
@@ -642,7 +641,6 @@
extern sqInt patchToOpenPICFornumArgsreceiver(sqInt selector, sqInt numArgs, sqInt receiver);
static sqInt picAbortDiscriminatorValue(void);
static sqInt picInterpretAbortOffset(void);
-static void preenMethodLabel(void);
static AbstractInstruction * previousInstruction(void);
extern void printCogMethodFor(void *address);
extern void printPCMapPairsFor(CogMethod *cogMethod);
@@ -702,7 +700,8 @@
static sqInt kosherYoungReferrers(void);
static void NoDbgRegParms manageFromto(sqInt theStartAddress, sqInt theLimitAddress);
extern CogMethod * methodFor(void *address);
-static sqInt numMethods(void);
+extern sqInt methodsCompiledToMachineCodeInto(sqInt arrayObj);
+extern sqInt numMethods(void);
extern sqInt numMethodsOfType(sqInt cogMethodType);
static sqInt NoDbgRegParms occurrencesInYoungReferrers(CogMethod *cogMethod);
static CogMethod * NoDbgRegParms openPICWithSelector(sqInt aSelector);
@@ -2162,19 +2161,6 @@
}
-/* Hack: To arrange that the block method field pushed in a block entry has
- its MFMethodFlagIsBlockFlag bit set we provide labels with an offset. The
- offset for the fakeHeader reference is MFMethodFlagIsBlockFlag. See
- compileBlockFrameBuild: */
-
- /* CogAbstractInstruction>>#setLabelOffset: */
-static sqInt NoDbgRegParms
-setLabelOffset(AbstractInstruction * self_in_setLabelOffset, sqInt aValue)
-{
- return ((self_in_setLabelOffset->operands))[1] = aValue;
-}
-
-
/* Update an instruction that depends on a label outside
of generated code (e.g. a method or block header). */
@@ -2902,9 +2888,12 @@
if (mapByte >= FirstAnnotation) {
annotation = ((usqInt) mapByte) >> AnnotationShift;
mcpc1 += (mapByte & DisplacementMask);
- if ((annotation >= IsSendCall)
- || ((annotation == HasBytecodePC)
- || (annotation == IsNSSendCall))) {
+ if (annotation >= HasBytecodePC) {
+ if ((annotation == IsSendCall)
+ && ((((usqInt) ((mapByte = byteAt(map - 1)))) >> AnnotationShift) == IsAnnotationExtension)) {
+ annotation += mapByte & DisplacementMask;
+ map -= 1;
+ }
while (1) {
byte = (fetchByteofObject(bcpc, aMethodObj)) + bsOffset;
descriptor = generatorAt(byte);
@@ -3680,7 +3669,7 @@
closedPICRefersToUnmarkedObject(CogMethod *cPIC)
{
sqInt i;
- usqInt object;
+ sqInt object;
sqInt pc;
if (!((isImmediate((cPIC->selector)))
@@ -3842,7 +3831,7 @@
{
sqInt address;
sqInt operand;
- sqInt target;
+ unsigned long target;
compilationBreakpointisMNUCase((cPIC->selector), numBytesOf((cPIC->selector)), isMNUCase);
assert(!(inlineCacheTagIsYoung(caseNTag)));
@@ -4027,9 +4016,9 @@
{
sqInt codeSize;
sqInt end;
- sqInt fixupSize;
+ unsigned long fixupSize;
sqInt mapSize;
- sqInt opcodeSize;
+ unsigned long opcodeSize;
CogMethod *pic;
sqInt startAddress;
@@ -4154,6 +4143,7 @@
return cogMethod;
}
if ((methodClassAssociationOf(aMethodObj)) != (nilObject())) {
+ extern void *firstIndexableField(sqInt);
/* begin warnMultiple:selectors: */
fprintf(stderr, "Warning, attempt to use method with selector %.*s and selector %.*s\n", ((int) (numBytesOf((cogMethod->selector)))), ((char *) (firstIndexableField((cogMethod->selector)))), numBytesOf(aSelectorOop), ((char *) (firstIndexableField(aSelectorOop))));
return null;
@@ -4379,11 +4369,12 @@
AbstractInstruction *anInstruction7;
sqInt callTarget;
const int cStackAlignment = STACK_ALIGN_BYTES;
- sqInt delta;
+ usqInt delta;
usqInt numRegsPushed;
+ sqInt quickConstant;
usqInt regMaskCopy;
sqInt regsToSave;
- sqInt wordsPushedModAlignment;
+ usqInt wordsPushedModAlignment;
regsToSave = (resultRegOrNone == NoReg
? regMask
@@ -4404,7 +4395,9 @@
if (wordsPushedModAlignment != 0) {
delta = (cStackAlignment / BytesPerWord) - wordsPushedModAlignment;
/* begin SubCq:R: */
- anInstruction = genoperandoperand(SubCqR, delta * BytesPerWord, SPReg);
+ quickConstant = delta * BytesPerWord;
+ /* begin gen:quickConstant:operand: */
+ anInstruction = genoperandoperand(SubCqR, quickConstant, SPReg);
}
l1: /* end genAlignCStackSavingRegisters:numArgs:wordAlignment: */;
}
@@ -4644,8 +4637,8 @@
{
sqInt checkedEntryAlignment;
sqInt entryPointMask;
- sqInt fixupSize;
- sqInt opcodeSize;
+ unsigned long fixupSize;
+ unsigned long opcodeSize;
AbstractInstruction *sendMissCall;
sqInt uncheckedEntryAlignment;
@@ -4742,7 +4735,7 @@
sqInt jumpTargetAddress;
sqInt operand;
sqInt pc;
- sqInt targetEntry;
+ unsigned long targetEntry;
assert(case1Method != null);
rewriteCallAttarget(backEnd, (((sqInt)cPIC)) + missOffset, picAbortTrampolineFor(numArgs));
@@ -4891,7 +4884,7 @@
*/
/* Cogit>>#cPICPrototypeCaseOffset */
-static sqInt
+static usqInt
cPICPrototypeCaseOffset(void)
{
return ((methodZoneBase + (youngReferrers())) / 2) - 13262352;
@@ -4972,7 +4965,7 @@
sqInt byte;
BytecodeDescriptor *descriptor;
sqInt distance;
- sqInt end;
+ usqInt end;
sqInt latestContinuation;
sqInt nExts;
sqInt pc;
@@ -5073,27 +5066,27 @@
}
classTagPC = pc - (jumpLongConditionalByteSize(backEnd));
classTag = literal32BeforeFollowingAddress(backEnd, classTagPC);
- if (!(asserta(classTag == (3133021973ULL + i)))) {
+ if (!(asserta(classTag == (3133021973U + i)))) {
errors = errors | 8;
}
entryPoint = jumpLongTargetBeforeFollowingAddress(backEnd, pc);
if (!(asserta(entryPoint == (((cPICPrototypeCaseOffset()) + 13262352) + (i * 16))))) {
errors = errors | 16;
}
- rewriteCPICCaseAttagobjReftarget(pc, classTag ^ 1515870810, object ^ 2779096485ULL, entryPoint ^ 5614160);
+ rewriteCPICCaseAttagobjReftarget(pc, classTag ^ 1515870810, object ^ 2779096485U, entryPoint ^ 5614160);
object = literalBeforeFollowingAddress(backEnd, methodObjPC);
- if (!(asserta(object == ((195929424 + i) ^ 2779096485ULL)))) {
+ if (!(asserta(object == ((195929424 + i) ^ 2779096485U)))) {
errors = errors | 32;
}
classTag = literal32BeforeFollowingAddress(backEnd, classTagPC);
- if (!(asserta(classTag == ((3133021973ULL + i) ^ 1515870810)))) {
+ if (!(asserta(classTag == ((3133021973U + i) ^ 1515870810)))) {
errors = errors | 64;
}
entryPoint = jumpLongTargetBeforeFollowingAddress(backEnd, pc);
if (!(asserta(entryPoint == ((((cPICPrototypeCaseOffset()) + 13262352) + (i * 16)) ^ 5614160)))) {
errors = errors | 128;
}
- rewriteCPICCaseAttagobjReftarget(pc, classTag ^ 1515870810, object ^ 2779096485ULL, entryPoint ^ 5614160);
+ rewriteCPICCaseAttagobjReftarget(pc, classTag ^ 1515870810, object ^ 2779096485U, entryPoint ^ 5614160);
}
entryPoint = jumpLongTargetBeforeFollowingAddress(backEnd, (pc + cPICEndSize));
if (!(asserta(entryPoint == (cPICMissTrampolineFor(0))))) {
@@ -5245,7 +5238,7 @@
findMapLocationForMcpcinMethod(sqInt targetMcpc, CogMethod *cogMethod)
{
sqInt annotation;
- sqInt map;
+ usqInt map;
sqInt mapByte;
sqInt mcpc;
@@ -5316,7 +5309,7 @@
}
/* Cogit>>#firstMappedPCFor: */
-static sqInt NoDbgRegParms
+static usqInt NoDbgRegParms
firstMappedPCFor(CogMethod *cogMethod)
{
return (0
@@ -5329,9 +5322,9 @@
followForwardedLiteralsIn(CogMethod *cogMethod)
{
sqInt annotation;
- sqInt map;
+ usqInt map;
sqInt mapByte;
- sqInt mcpc;
+ usqInt mcpc;
sqInt result;
assert((((cogMethod->cmType)) != CMMethod)
@@ -5657,8 +5650,8 @@
AbstractInstruction *anInstruction1;
AbstractInstruction *anInstruction2;
AbstractInstruction *anInstruction3;
- sqInt fixupSize;
- sqInt opcodeSize;
+ unsigned long fixupSize;
+ unsigned long opcodeSize;
sqInt quickConstant;
sqInt quickConstant1;
sqInt startAddress;
@@ -5728,7 +5721,7 @@
AbstractInstruction * cPICEndOfCodeLabel;
sqInt endAddress;
AbstractInstruction * endCPICCase1;
- sqInt fixupSize;
+ unsigned long fixupSize;
sqInt h;
AbstractInstruction *jumpNext;
sqInt jumpTarget;
@@ -5737,7 +5730,7 @@
sqInt literal;
sqInt numArgs;
sqInt opcode;
- sqInt opcodeSize;
+ unsigned long opcodeSize;
sqInt wordConstant;
@@ -5778,8 +5771,8 @@
/* begin CmpC32:R: */
opcode = CmpC32R;
/* begin checkLiteral:forInstruction: */
- literal = 3133021973ULL + h;
- anInstruction = genoperandoperand(opcode, 3133021973ULL + h, TempReg);
+ literal = 3133021973U + h;
+ anInstruction = genoperandoperand(opcode, 3133021973U + h, TempReg);
/* begin JumpLongZero: */
jumpTarget = ((cPICPrototypeCaseOffset()) + 13262352) + (h * 16);
genConditionalBranchoperand(JumpLongZero, ((sqInt)jumpTarget));
@@ -5826,7 +5819,7 @@
generateCogMethod(sqInt selector)
{
sqInt codeSize;
- sqInt headerSize;
+ unsigned long headerSize;
sqInt mapSize;
CogMethod *method;
sqInt result;
@@ -5923,12 +5916,12 @@
generateMapAtstart(sqInt addressOrNull, sqInt startAddress)
{
unsigned char annotation;
- sqInt delta;
+ usqInt delta;
sqInt i;
AbstractInstruction *instruction;
sqInt length;
- sqInt location;
- sqInt mapEntry;
+ usqInt location;
+ usqInt mapEntry;
sqInt maxDelta;
usqInt mcpc;
@@ -6022,9 +6015,9 @@
generateOpenPICPrototype(void)
{
sqInt codeSize;
- sqInt fixupSize;
+ unsigned long fixupSize;
sqInt mapSize;
- sqInt opcodeSize;
+ unsigned long opcodeSize;
/* begin allocateOpcodes:bytecodes: */
numAbstractOpcodes = 100;
@@ -6107,9 +6100,9 @@
static void
generateTrampolines(void)
{
- sqInt fixupSize;
+ unsigned long fixupSize;
sqInt methodZoneStart;
- sqInt opcodeSize;
+ unsigned long opcodeSize;
methodZoneStart = methodZoneBase;
(methodLabel->address = methodZoneStart);
@@ -6145,8 +6138,8 @@
genGetLeafCallStackPointer(void)
{
AbstractInstruction *anInstruction;
- sqInt fixupSize;
- sqInt opcodeSize;
+ unsigned long fixupSize;
+ unsigned long opcodeSize;
sqInt quickConstant;
sqInt startAddress;
@@ -6739,9 +6732,9 @@
void
initializeCodeZoneFromupTo(sqInt startAddress, sqInt endAddress)
{
- sqInt fixupSize;
+ unsigned long fixupSize;
sqInt numberOfAbstractOpcodes;
- sqInt opcodeSize;
+ unsigned long opcodeSize;
sqInt startAddress1;
initializeBackend();
@@ -6914,13 +6907,14 @@
return (((descriptor->spanFunction))(descriptor, pc, nExts, aMethodObj)) < 0;
}
+
+/* See Cogit class>>initializeAnnotationConstants */
+
/* Cogit>>#isPCMappedAnnotation: */
static sqInt NoDbgRegParms
isPCMappedAnnotation(sqInt annotation)
{
- return (annotation >= IsSendCall)
- || ((annotation == HasBytecodePC)
- || (annotation == IsNSSendCall));
+ return annotation >= HasBytecodePC;
}
/* Cogit>>#isPCWithinMethodZone: */
@@ -7165,9 +7159,9 @@
mapForperformUntilarg(CogMethod *cogMethod, sqInt (*functionSymbol)(sqInt annotation, char *mcpc, sqInt arg), sqInt arg)
{
sqInt annotation;
- sqInt map;
+ usqInt map;
sqInt mapByte;
- sqInt mcpc;
+ usqInt mcpc;
sqInt result;
mcpc = (0
@@ -7272,9 +7266,9 @@
sqInt freedPIC;
sqInt hasYoungObj;
sqInt hasYoungObjPtr;
- sqInt map;
+ usqInt map;
sqInt mapByte;
- sqInt mcpc;
+ usqInt mcpc;
sqInt remappedMethod;
sqInt result;
sqInt val;
@@ -7390,9 +7384,9 @@
{
sqInt annotation;
CogMethod *cogMethod;
- sqInt map;
+ usqInt map;
sqInt mapByte;
- sqInt mcpc;
+ usqInt mcpc;
sqInt result;
codeModified = 0;
@@ -7470,9 +7464,9 @@
CogMethod *cogMethod;
sqInt hasYoungObj;
sqInt hasYoungObjPtr;
- sqInt map;
+ usqInt map;
sqInt mapByte;
- sqInt mcpc;
+ usqInt mcpc;
usqInt pointer;
sqInt result;
sqInt val;
@@ -7590,12 +7584,12 @@
sqInt annotation;
sqInt annotation1;
CogMethod *cogMethod;
- sqInt map;
- sqInt map1;
+ usqInt map;
+ usqInt map1;
sqInt mapByte;
sqInt mapByte1;
- sqInt mcpc;
- sqInt mcpc1;
+ usqInt mcpc;
+ usqInt mcpc1;
sqInt result;
sqInt result1;
sqInt val;
@@ -7750,9 +7744,9 @@
markAndTraceOrFreeCogMethodfirstVisit(CogMethod *cogMethod, sqInt firstVisit)
{
sqInt annotation;
- sqInt map;
+ usqInt map;
sqInt mapByte;
- sqInt mcpc;
+ usqInt mcpc;
sqInt result;
sqInt val;
@@ -8078,9 +8072,9 @@
{
sqInt annotation;
CogMethod *cogMethod;
- sqInt map;
+ usqInt map;
sqInt mapByte;
- sqInt mcpc;
+ usqInt mcpc;
sqInt result;
assert((((aCogMethod->cmType)) == CMMethod)
@@ -8299,21 +8293,24 @@
if (mapByte >= FirstAnnotation) {
annotation = ((usqInt) mapByte) >> AnnotationShift;
mcpc += (mapByte & DisplacementMask);
- if ((annotation >= IsSendCall)
- || ((annotation == HasBytecodePC)
- || (annotation == IsNSSendCall))) {
+ if (annotation >= HasBytecodePC) {
+ if ((annotation == IsSendCall)
+ && ((((usqInt) ((mapByte = byteAt(map - 1)))) >> AnnotationShift) == IsAnnotationExtension)) {
+ annotation += mapByte & DisplacementMask;
+ map -= 1;
+ }
while (1) {
byte = (fetchByteofObject(bcpc1, aMethodObj)) + bsOffset;
descriptor = generatorAt(byte);
if (isInBlock) {
if (bcpc1 >= endbcpc) {
- return 0;
+ return ((sqInt) 0);
}
}
else {
if (((descriptor->isReturn))
&& (bcpc1 >= latestContinuation)) {
- return 0;
+ return ((sqInt) 0);
}
if ((isBranch(descriptor))
|| ((descriptor->isBlockCreation))) {
@@ -8357,7 +8354,7 @@
}
map -= 1;
}
- return 0;
+ return ((sqInt) 0);
}
/* Cogit>>#methodNumArgs */
@@ -8617,22 +8614,6 @@
return (interpretOffset()) - (callInstructionByteSize(backEnd));
}
-
-/* The methodLabel serves as the reference to the start of the current code
- object being produced (CMMethod, CMClosedPIC etc), but it also carries
- type flags for
- the frame method field, set via the labelOffset. So we must clean the
- flags on each
- compilation to avoid stale lags being left behind from previous
- compilations. */
-
- /* Cogit>>#preenMethodLabel */
-static void
-preenMethodLabel(void)
-{
- setLabelOffset(methodLabel, 0);
-}
-
/* Cogit>>#previousInstruction */
static AbstractInstruction *
previousInstruction(void)
@@ -8841,9 +8822,9 @@
{
sqInt annotation;
sqLong callDelta;
- sqInt map;
+ usqInt map;
sqInt mapByte;
- sqInt mcpc;
+ usqInt mcpc;
sqLong refDelta;
sqInt result;
@@ -9306,7 +9287,7 @@
spanForCleanBlockStartingAt(sqInt startPC)
{
BytecodeDescriptor *descriptor;
- sqInt end;
+ usqInt end;
sqInt pc;
pc = startPC;
@@ -9415,9 +9396,9 @@
{
sqInt annotation;
CogMethod *cogMethod;
- sqInt map;
+ usqInt map;
sqInt mapByte;
- sqInt mcpc;
+ usqInt mcpc;
sqInt result;
if (!(methodZoneBase)) {
@@ -9858,9 +9839,9 @@
sqInt annotation;
CogMethod *cogMethod;
sqInt freedPIC;
- sqInt map;
+ usqInt map;
sqInt mapByte;
- sqInt mcpc;
+ usqInt mcpc;
sqInt result;
if (!(methodZoneBase)) {
@@ -9935,9 +9916,9 @@
{
sqInt annotation;
CogMethod *cogMethod;
- sqInt map;
+ usqInt map;
sqInt mapByte;
- sqInt mcpc;
+ usqInt mcpc;
sqInt mustScanAndUnlink;
sqInt result;
@@ -10034,9 +10015,9 @@
{
sqInt annotation;
CogMethod *cogMethod;
- sqInt map;
+ usqInt map;
sqInt mapByte;
- sqInt mcpc;
+ usqInt mcpc;
sqInt result;
if (!(methodZoneBase)) {
@@ -10103,9 +10084,9 @@
sqInt annotation;
CogMethod *cogMethod;
sqInt freedPIC;
- sqInt map;
+ usqInt map;
sqInt mapByte;
- sqInt mcpc;
+ usqInt mcpc;
sqInt result;
CogMethod *targetMethod;
@@ -10491,7 +10472,7 @@
static void
freeOlderMethodsForCompaction(void)
{
- sqInt amountToFree;
+ usqInt amountToFree;
sqInt cascade0;
sqInt cascade1;
CogMethod *cogMethod;
@@ -10586,8 +10567,27 @@
return 0;
}
+ /* CogMethodZone>>#methodsCompiledToMachineCodeInto: */
+sqInt
+methodsCompiledToMachineCodeInto(sqInt arrayObj)
+{
+ CogMethod *cogMethod;
+ sqInt methodIndex;
+
+ methodIndex = 0;
+ cogMethod = ((CogMethod *) baseAddress);
+ while (cogMethod < (limitZony())) {
+ if (((cogMethod->cmType)) == CMMethod) {
+ storePointerUncheckedofObjectwithValue(methodIndex, arrayObj, (cogMethod->methodObject));
+ methodIndex += 1;
+ }
+ cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
+ }
+ return methodIndex;
+}
+
/* CogMethodZone>>#numMethods */
-static sqInt
+sqInt
numMethods(void)
{
return methodCount;
@@ -11989,7 +11989,7 @@
{
sqInt address;
sqInt address1;
- sqInt allocSize;
+ unsigned long allocSize;
AbstractInstruction *anInstruction;
AbstractInstruction *anInstruction1;
AbstractInstruction *anInstruction2;
@@ -13077,7 +13077,7 @@
/* begin JumpBelow: */
jumpNotIndexableBits = genConditionalBranchoperand(JumpBelow, ((sqInt)0));
/* begin CmpCq:R: */
- anInstruction9 = genoperandoperand(CmpCqR, (((sqInt)0xFFFFFFFFULL << 3) | 1), Arg1Reg);
+ anInstruction9 = genoperandoperand(CmpCqR, (((sqInt)0xFFFFFFFFU << 3) | 1), Arg1Reg);
/* begin JumpAbove: */
jumpWordsOutOfRange = genConditionalBranchoperand(JumpAbove, ((sqInt)0));
/* begin LogicalShiftLeftCq:R: */
@@ -21719,7 +21719,8 @@
sqInt quickConstant;
sqInt reg;
- preenMethodLabel();
+ /* begin preenMethodLabel */
+ ((methodLabel->operands))[1] = 0;
compilePICAbort(numArgs);
entry = genGetClassTagOfintoscratchReg(ReceiverResultReg, ClassReg, TempReg);
/* begin MoveR:R: */
@@ -22299,7 +22300,7 @@
static sqInt
genExtSendSuperBytecode(void)
{
- sqInt isDirected;
+ int isDirected;
sqInt litIndex;
sqInt nArgs;
@@ -23258,9 +23259,12 @@
if (mapByte >= FirstAnnotation) {
annotation = ((usqInt) mapByte) >> AnnotationShift;
mcpc += (mapByte & DisplacementMask);
- if ((annotation >= IsSendCall)
- || ((annotation == HasBytecodePC)
- || (annotation == IsNSSendCall))) {
+ if (annotation >= HasBytecodePC) {
+ if ((annotation == IsSendCall)
+ && ((((usqInt) ((mapByte = byteAt(map - 1)))) >> AnnotationShift) == IsAnnotationExtension)) {
+ annotation += mapByte & DisplacementMask;
+ map -= 1;
+ }
while (1) {
byte = (fetchByteofObject(bcpc, aMethodObj)) + bsOffset;
descriptor = generatorAt(byte);
@@ -23430,9 +23434,7 @@
introspectionDataIndex += 6;
return 0;
}
- if (((((usqInt) isBackwardBranchAndAnnotation) >> 1) >= IsSendCall)
- || (((((usqInt) isBackwardBranchAndAnnotation) >> 1) == HasBytecodePC)
- || ((((usqInt) isBackwardBranchAndAnnotation) >> 1) == IsNSSendCall))) {
+ if ((((usqInt) isBackwardBranchAndAnnotation) >> 1) >= HasBytecodePC) {
actualBcpc = (isBackwardBranchAndAnnotation & 1
? bcpc + 1
: (bcpc + ((descriptor->numBytes))) + 1);
@@ -24652,7 +24654,7 @@
genoperandoperand(MoveRR, ReceiverResultReg, ClassReg);
cascade0 = (blockStart->fakeHeader);
addDependent(cascade0, annotateAbsolutePCRef(gPushCw(((sqInt)((blockStart->fakeHeader))))));
- setLabelOffset(cascade0, MFMethodFlagIsBlockFlag);
+ ((cascade0->operands))[1] = MFMethodFlagIsBlockFlag;
annotateobjRef(gPushCw(nilObject()), nilObject());
if ((blockStart->hasInstVarRef)) {
@@ -24747,14 +24749,14 @@
static CogMethod * NoDbgRegParms
compileCogMethod(sqInt selector)
{
- sqInt allocBytes;
+ unsigned long allocBytes;
sqInt debugStackPointers;
- sqInt extra;
- sqInt fixupBytes;
+ int extra;
+ unsigned long fixupBytes;
sqInt numBlocks;
sqInt numBytecodes;
sqInt numCleanBlocks;
- sqInt opcodeBytes;
+ unsigned long opcodeBytes;
sqInt result;
methodOrBlockNumTemps = tempCountOf(methodObj);
@@ -24824,7 +24826,8 @@
sqInt result;
regArgsHaveBeenPushed = 0;
- preenMethodLabel();
+ /* begin preenMethodLabel */
+ ((methodLabel->operands))[1] = 0;
compileAbort();
compileEntry();
if (((result = compilePrimitive())) < 0) {
@@ -26109,7 +26112,7 @@
genPushNewArrayBytecode(void)
{
sqInt i;
- sqInt popValues;
+ int popValues;
sqInt size;
assert(needsFrame);
@@ -26314,7 +26317,7 @@
AbstractInstruction *anInstruction6;
AbstractInstruction *anInstruction7;
sqInt argInt;
- sqInt argIsConst;
+ int argIsConst;
sqInt argIsInt;
sqInt index;
AbstractInstruction *jumpContinue;
@@ -26323,7 +26326,7 @@
sqInt literal1;
BytecodeDescriptor *primDescriptor;
sqInt rcvrInt;
- sqInt rcvrIsConst;
+ int rcvrIsConst;
sqInt rcvrIsInt;
sqInt result;
@@ -26704,8 +26707,8 @@
sqInt targetBytecodePC;
sqInt targetBytecodePC1;
sqInt topRegistersMask;
- sqInt unforwardArg;
- sqInt unforwardRcvr;
+ int unforwardArg;
+ int unforwardRcvr;
/* begin extractMaybeBranchDescriptorInto: */
primDescriptor = generatorAt(byte0);
@@ -26923,7 +26926,7 @@
sqInt argInt;
BytecodeDescriptor *primDescriptor;
sqInt rcvrInt;
- sqInt result;
+ int result;
primDescriptor = generatorAt(byte0);
argInt = ((ssTop())->constant);
Modified: branches/Cog/nsspur64src/vm/cointerp.c
===================================================================
--- branches/Cog/nsspur64src/vm/cointerp.c 2016-04-27 15:01:30 UTC (rev 3686)
+++ branches/Cog/nsspur64src/vm/cointerp.c 2016-04-27 22:35:21 UTC (rev 3687)
@@ -1,9 +1,9 @@
/* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1834 uuid: 858a9c54-959b-4d7e-b9b3-5f083d37f488
+ CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1849 uuid: d65892b1-b636-442a-affd-36ef8f9abcd1
from
- CoInterpreter VMMaker.oscog-eem.1834 uuid: 858a9c54-959b-4d7e-b9b3-5f083d37f488
+ CoInterpreter VMMaker.oscog-eem.1849 uuid: d65892b1-b636-442a-affd-36ef8f9abcd1
*/
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1834 uuid: 858a9c54-959b-4d7e-b9b3-5f083d37f488 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1849 uuid: d65892b1-b636-442a-affd-36ef8f9abcd1 " __DATE__ ;
char *__interpBuildInfo = __buildInfo;
@@ -342,7 +342,7 @@
#define TraceVMCallback 89
#define TraceVMCallbackReturn 97
#define TrueObject 2
-#define V3PrimitiveBitsMask 0x80000FF8ULL
+#define V3PrimitiveBitsMask 0x80000FF8U
#define ValueIndex 1
#if !defined(VMBIGENDIAN) /* Allow this to be overridden on the compiler command line */
# define VMBIGENDIAN 0
@@ -487,7 +487,7 @@
static sqInt executeNewMethod(void);
static sqInt NoDbgRegParms externalInstVarofContext(sqInt offset, sqInt aContext);
static void NoDbgRegParms findNewMethodInClassTag(sqInt classTagArg);
-extern sqInt flushExternalPrimitiveOf(sqInt methodObj);
+extern void flushExternalPrimitiveOf(sqInt methodObj);
static void flushMethodCache(void);
static void followForwardedFieldsInCurrentMethod(void);
static void NoDbgRegParms followForwardingPointersInStackZone(sqInt theBecomeEffectsFlags);
@@ -605,6 +605,7 @@
extern usqInt varBaseAddress(void);
static sqInt NoDbgRegParms voidVMStateForSnapshotFlushingExternalPrimitivesIf(sqInt flushExtPrims);
extern char * whereIs(sqInt anOop);
+static void NoDbgRegParms NeverInline widowOrForceToBytecodePC(sqInt ctxt);
static sqInt NoDbgRegParms frameIsMarked(sqInt theFPInt);
static void primitiveClosureCopyWithCopiedValues(void);
static void primitiveCollectCogCodeConstituents(void);
@@ -912,7 +913,7 @@
static void NeverInline computeRefCountToShrinkRT(void);
static sqInt NoDbgRegParms copyAndForward(sqInt survivor);
static sqInt NoDbgRegParms NeverInline copyToOldSpacebytesformat(sqInt survivor, sqInt bytesInObject, sqInt formatOfSurvivor);
-static sqInt NoDbgRegParms firstCorpse(sqInt headOfCorpseList);
+static usqInt NoDbgRegParms firstCorpse(sqInt headOfCorpseList);
static void growRememberedSet(void);
static sqInt NoDbgRegParms isInRememberedSet(sqInt objOop);
static sqInt NoDbgRegParms isMaybeOldScavengeSurvivor(sqInt oop);
@@ -1169,7 +1170,7 @@
extern sqInt nonIndexablePointerFormat(void);
static sqInt noUnscannedEphemerons(void);
static sqInt NoDbgRegParms numBytesOfBytes(sqInt objOop);
-extern sqInt numBytesOf(sqInt objOop);
+extern usqInt numBytesOf(sqInt objOop);
static sqInt numberOfForwarders(void);
extern sqInt numPointerSlotsOf(sqInt objOop);
static usqInt NoDbgRegParms numSlotsOfAny(sqInt objOop);
@@ -1187,6 +1188,8 @@
extern sqInt popRemappableOop(void);
static void NoDbgRegParms postBecomeScanClassTable(sqInt effectsFlags);
extern sqInt primitiveErrorTable(void);
+extern void printActivationsOf(sqInt aMethodObj);
+extern void printContextReferencesTo(sqInt anOop);
extern void printForwarders(void);
extern void printFreeChunks(void);
extern void printFreeChunk(sqInt freeChunk);
@@ -1308,8 +1311,8 @@
static sqInt NoDbgRegParms classNameOfIs(sqInt aClass, char *className);
static sqInt NoDbgRegParms contexthasSender(sqInt thisCntx, sqInt aContext);
static sqInt NoDbgRegParms contexthasValidInversePCMappingOfin(sqInt aContext, sqInt theIP, char *theFP);
-extern sqInt copiedValueCountOfClosure(sqInt closurePointer);
-extern sqInt copiedValueCountOfFullClosure(sqInt closurePointer);
+extern usqInt copiedValueCountOfClosure(sqInt closurePointer);
+extern usqInt copiedValueCountOfFullClosure(sqInt closurePointer);
extern sqInt copyBits(void);
extern sqInt copyBitsFromtoat(sqInt x0, sqInt x1, sqInt y);
static sqInt NoDbgRegParms NeverInline couldBeProcess(sqInt oop);
@@ -1372,7 +1375,7 @@
static void handleStackOverflow(void);
static sqInt NoDbgRegParms handleStackOverflowOrEventAllowContextSwitch(sqInt mayContextSwitch);
extern sqInt headerIndicatesAlternateBytecodeSet(sqInt methodHeader);
-extern sqInt highBit(usqInt anUnsignedValue);
+extern usqInt highBit(usqInt anUnsignedValue);
static sqInt NoDbgRegParms ifCurrentStackPageHasValidHeadPointers(StackPage *thePage);
static usqInt NoDbgRegParms iframeMethod(char *theFP);
extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass);
@@ -1415,6 +1418,7 @@
static sqInt lookupOrdinarySend(void);
static sqInt NoDbgRegParms lookupProtectedstartingAtrule(sqInt selector, sqInt mixinApplication, sqInt rule);
extern sqInt lookupSelectorinClass(sqInt selector, sqInt class);
+static void NoDbgRegParms makeContextSnapshotSafe(sqInt ctxt);
extern sqInt makePointwithxValueyValue(sqInt xValue, sqInt yValue);
static void mapInterpreterOops(void);
static sqInt NoDbgRegParms markAndTraceStackPages(sqInt fullGCFlag);
@@ -1621,8 +1625,8 @@
_iss char * stackBasePlus1;
_iss sqInt weaklingStack;
_iss sqInt trueObj;
+_iss sqInt falseObj;
_iss usqInt newSpaceStart;
-_iss sqInt falseObj;
_iss sqInt hiddenRootsObj;
_iss SpurSegmentInfo * segments;
_iss sqInt lkupClassTag;
@@ -2408,12 +2412,12 @@
/*40*/ 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0,-1,-1,-1,-1,-1,
/*60*/ 0, 0, 0,-1,-1,-1,-1,-1, 0, 0,-1,-1, 0, 1, 1, 0, 0, 0, 0, 0,
/*80*/ -1,-1,-1, 0,-1,-1, 0, 0, 1,-1,-1, 0, 0, 0, 0,-1,-1,-1, 0, 0,
-/*100*/ 1, 1, 0, 2,-1, 1,-1,-1,-1,-1, 0, 0,-1,-1,-1, 1, 1,-1, 1, 0,
+/*100*/ 1, 1, 0, 2,-1, 1,-1,-1,-1,-1, 0, 0,-1,-1,-1, 1, 0,-1, 1, 0,
/*120*/ -1, 0,-1,-1, 0, 0, 0, 0, 0,-1,-1,-1, 1, 0, 0,-1, 0,-1,-1,-1,
/*140*/ -1, 1,-1, 1, 0, 0,-1,-1, 0, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
/*160*/ 0, 0,-1, 0, 0, 1, 1,-1, 1, 0, 0, 1,-1, 1, 1,-1,-1,-1,-1,-1,
/*180*/ 0,-1,-1, 0, 0, 0, 1, 1, 1, 0,-1,-1,-1,-1,-1, 1, 2,-1,-1,-1,
-/*200*/ -1, 2, 2, 2, 2, 2, 2,-1,-1,-1, 1, 1, 1, 1,-1, 1,-1,-1, 3,-1,
+/*200*/ -1, 2, 2, 2, 2, 2, 2,-1,-1,-1, 1, 1, 1, 1,-1, 0,-1,-1, 3,-1,
/*220*/ -1, 2, 2,-1,-1,-1,-1,-1,-1,-1, 0,-1, 2, 0,-1,-1,-1,-1,-1,-1,
/*240*/ -1,-1, 0,-1, 0,-1,-1,-1,-1,-1,-1, 0, 1,-1, 0,-1,-1,-1,-1,-1,
/*260*/ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
@@ -2434,7 +2438,7 @@
/*560*/ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0,-1,-1
};
char expensiveAsserts = 0;
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1834";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1849";
sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
volatile int sendTrace;
@@ -2567,7 +2571,7 @@
sqInt localReturnValue;
char * localSP;
sqInt stackPageBytes;
- sqInt stackPagesBytes;
+ usqInt stackPagesBytes;
char *theStackMemory;
if (GIV(stackLimit) == 0) {
@@ -6369,7 +6373,7 @@
sqInt obj1;
sqInt object;
sqInt object1;
- sqInt onCurrentPage;
+ int onCurrentPage;
sqInt opType;
sqInt referent;
sqInt referent1;
@@ -6764,9 +6768,7 @@
sqInt aValue;
sqInt classPointer;
sqInt err;
- sqInt err1;
sqInt hash;
- sqInt hash1;
sqInt objOop;
sqInt objOop1;
sqInt referent;
@@ -6782,32 +6784,15 @@
objOop = fixFollowedFieldofObjectwithInitialValue(SuperclassIndex, classPointer, objOop);
}
superclass = objOop;
- /* begin ensureBehaviorHash: */
- assert(addressCouldBeClassObj(superclass));
- if (((hash = (long32At(superclass + 4)) & (identityHashHalfWordMask()))) != 0) {
- }
- else {
- if (objCouldBeClassObj(superclass)) {
- if (((err = enterIntoClassTable(superclass))) != 0) {
- -err;
- }
- else {
- (long32At(superclass + 4)) & (identityHashHalfWordMask());
- }
- }
- else {
- -PrimErrBadReceiver;
- }
- }
/* begin classTagForClass: */
assert(addressCouldBeClassObj(superclass));
/* begin ensureBehaviorHash: */
assert(addressCouldBeClassObj(superclass));
- GIV(lkupClassTag) = (((hash1 = (long32At(superclass + 4)) & (identityHashHalfWordMask()))) != 0
- ? hash1
+ GIV(lkupClassTag) = (((hash = (long32At(superclass + 4)) & (identityHashHalfWordMask()))) != 0
+ ? hash
: (objCouldBeClassObj(superclass)
- ? (((err1 = enterIntoClassTable(superclass))) != 0
- ? -err1
+ ? (((err = enterIntoClassTable(superclass))) != 0
+ ? -err
: (long32At(superclass + 4)) & (identityHashHalfWordMask()))
: -PrimErrBadReceiver));
/* begin ensureReceiverUnforwarded */
@@ -6899,7 +6884,7 @@
sqInt i;
usqInt newObj;
usqInt numBytes;
- sqInt popValues;
+ int popValues;
sqInt size;
VM_LABEL(pushNewArrayBytecode);
@@ -7922,7 +7907,7 @@
/* begin fetchNextBytecode */
currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector);
- goto l465;
+ goto l464;
}
if (bytecode == 172) {
@@ -7931,7 +7916,7 @@
/* begin fetchNextBytecode */
currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector);
- goto l465;
+ goto l464;
}
if (bytecode > 167) {
@@ -7941,7 +7926,7 @@
localIP = (localIP + offset) + 1;
currentBytecode = (byteAtPointer(localIP)) + GIV(bytecodeSetSelector);
- goto l465;
+ goto l464;
}
}
currentBytecode = bytecode + GIV(bytecodeSetSelector);
@@ -7949,7 +7934,7 @@
/* begin internalPush: */
longAtPointerput((localSP -= BytesPerOop), GIV(trueObj));
}
- l465: /* end case */;
+ l464: /* end case */;
break;
case 179:
/* bytecodePrimGreaterThan */
@@ -8099,7 +8084,7 @@
localIP = (localIP + (bytecode - 151)) + 1;
currentBytecode = (byteAtPointer(localIP)) + GIV(bytecodeSetSelector);
- goto l466;
+ goto l465;
}
if (bytecode == 172) {
@@ -8109,14 +8094,14 @@
localIP = (localIP + offset) + 1;
currentBytecode = (byteAtPointer(localIP)) + GIV(bytecodeSetSelector);
- goto l466;
+ goto l465;
}
currentBytecode = bytecode + GIV(bytecodeSetSelector);
/* begin internalPush: */
longAtPointerput((localSP -= BytesPerOop), GIV(falseObj));
}
- l466: /* end case */;
+ l465: /* end case */;
break;
case 180:
/* bytecodePrimLessOrEqual */
@@ -8631,6 +8616,8 @@
double arg1;
sqInt bits;
sqInt bits1;
+ sqInt oop;
+ sqInt overflow;
sqInt rcvr;
double rcvr1;
sqInt result;
@@ -8651,12 +8638,19 @@
&& ((((arg) & 7) == 1))) {
rcvr = (rcvr >> 3);
arg = (arg >> 3);
- result = rcvr * arg;
- if ((arg == 0)
- || (((result / arg) == rcvr)
- && ((((((usqInt) result) >> 60) + 1) & 15) <= 1))) {
+ overflow = (rcvr > 0
+ ? (arg > 0
+ ? rcvr > ((MaxSmallInteger) / arg)
+ : arg < ((MinSmallInteger) / rcvr))
+ : (arg > 0
+ ? rcvr < ((MinSmallInteger) / arg)
+ : (rcvr < 0)
+ && (arg < ((MaxSmallInteger) / rcvr))));
+ if (!overflow) {
+ result = rcvr * arg;
+ oop = ((result << 3) | 1);
/* begin internalPop:thenPush: */
- longAtPointerput((localSP += (2 - 1) * BytesPerOop), ((result << 3) | 1));
+ longAtPointerput((localSP += (2 - 1) * BytesPerOop), oop);
/* begin fetchNextBytecode */
currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector);
@@ -10263,7 +10257,7 @@
/* begin fetchNextBytecode */
currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector);
- goto l467;
+ goto l466;
}
if (bytecode == 244) {
@@ -10272,7 +10266,7 @@
/* begin fetchNextBytecode */
currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector);
- goto l467;
+ goto l466;
}
if (bytecode == 243) {
@@ -10282,7 +10276,7 @@
localIP = (localIP + offset) + 1;
currentBytecode = (byteAtPointer(localIP)) + GIV(bytecodeSetSelector);
- goto l467;
+ goto l466;
}
}
currentBytecode = bytecode + GIV(bytecodeSetSelector);
@@ -10290,7 +10284,7 @@
/* begin internalPush: */
longAtPointerput((localSP -= BytesPerOop), GIV(trueObj));
}
- l467: /* end case */;
+ l466: /* end case */;
break;
case 339: /*83*/
/* bytecodePrimGreaterThanV4 */
@@ -10440,7 +10434,7 @@
localIP = (localIP + (bytecode - 207)) + 1;
currentBytecode = (byteAtPointer(localIP)) + GIV(bytecodeSetSelector);
- goto l468;
+ goto l467;
}
if (bytecode == 244) {
@@ -10450,14 +10444,14 @@
localIP = (localIP + offset) + 1;
currentBytecode = (byteAtPointer(localIP)) + GIV(bytecodeSetSelector);
- goto l468;
+ goto l467;
}
currentBytecode = bytecode + GIV(bytecodeSetSelector);
/* begin internalPush: */
longAtPointerput((localSP -= BytesPerOop), GIV(falseObj));
}
- l468: /* end case */;
+ l467: /* end case */;
break;
case 340: /*84*/
/* bytecodePrimLessOrEqualV4 */
@@ -10972,6 +10966,8 @@
double arg1;
sqInt bits;
sqInt bits1;
+ sqInt oop;
+ sqInt overflow;
sqInt rcvr;
double rcvr1;
sqInt result;
@@ -10992,12 +10988,19 @@
&& ((((arg) & 7) == 1))) {
rcvr = (rcvr >> 3);
arg = (arg >> 3);
- result = rcvr * arg;
- if ((arg == 0)
- || (((result / arg) == rcvr)
- && ((((((usqInt) result) >> 60) + 1) & 15) <= 1))) {
+ overflow = (rcvr > 0
+ ? (arg > 0
+ ? rcvr > ((MaxSmallInteger) / arg)
+ : arg < ((MinSmallInteger) / rcvr))
+ : (arg > 0
+ ? rcvr < ((MinSmallInteger) / arg)
+ : (rcvr < 0)
+ && (arg < ((MaxSmallInteger) / rcvr))));
+ if (!overflow) {
+ result = rcvr * arg;
+ oop = ((result << 3) | 1);
/* begin internalPop:thenPush: */
- longAtPointerput((localSP += (2 - 1) * BytesPerOop), ((result << 3) | 1));
+ longAtPointerput((localSP += (2 - 1) * BytesPerOop), oop);
/* begin fetchNextBytecode */
currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector);
@@ -12310,7 +12313,7 @@
sqInt i;
usqInt newObj;
usqInt numBytes;
- sqInt popValues;
+ int popValues;
sqInt size;
VM_LABEL(pushNewArrayBytecode1);
@@ -12382,7 +12385,7 @@
sqInt anObject;
sqInt index1;
sqInt obj;
- sqInt onCurrentPage;
+ int onCurrentPage;
sqInt senderOop;
char * theFP;
StackPage * thePage;
@@ -12618,7 +12621,7 @@
{
sqInt index1;
sqInt obj;
- sqInt onCurrentPage;
+ int onCurrentPage;
sqInt senderOop;
char * theFP;
StackPage * thePage;
@@ -13006,12 +13009,12 @@
classTablePage = longAt((GIV(hiddenRootsObj) + BaseHeaderSize) + (((long)fieldIndex) << (shiftForWord())));
if (classTablePage == GIV(nilObj)) {
GIV(lkupClass) = null;
- goto l469;
+ goto l468;
}
/* begin fetchPointer:ofObject: */
fieldIndex1 = GIV(lkupClassTag) & ((1LL << (classTableMajorIndexShift())) - 1);
GIV(lkupClass) = longAt((classTablePage + BaseHeaderSize) + (((long)fieldIndex1) << (shiftForWord())));
- l469: /* end classAtIndex: */;
+ l468: /* end classAtIndex: */;
/* begin lookupImplicitReceiverSend */
GIV(messageSelector) = (((GIV(messageSelector) & (tagMask())) == 0)
&& (((longAt(GIV(messageSelector))) & (classIndexMask())) == (isForwardedObjectClassIndexPun()))
@@ -13076,12 +13079,12 @@
}
GIV(newMethod) = objOop2;
found = 1;
- goto l474;
+ goto l473;
}
index += 1;
}
found = 0;
- goto l474;
+ goto l473;
}
/* It is assumed that there are some nils in this dictionary, and search will
@@ -13105,7 +13108,7 @@
nextSelector = longAt((dictionary + BaseHeaderSize) + (((long)index) << (shiftForWord())));
if (nextSelector == GIV(nilObj)) {
found = 0;
- goto l474;
+ goto l473;
}
if (((nextSelector & (tagMask())) == 0)
&& (((longAt(nextSelector)) & (classIndexMask())) == (isForwardedObjectClassIndexPun()))) {
@@ -13127,24 +13130,24 @@
}
GIV(newMethod) = objOop4;
found = 1;
- goto l474;
+ goto l473;
}
index += 1;
if (index == length) {
if (wrapAround) {
found = 0;
- goto l474;
+ goto l473;
}
wrapAround = 1;
index = SelectorStart;
}
}
found = 0;
- l474: /* end lookupMethodInDictionary: */;
+ l473: /* end lookupMethodInDictionary: */;
if (found) {
GIV(localAbsentReceiver) = candidateReceiver;
actualLookupRule = lookupLexicalfromrule(GIV(messageSelector), candidateMixin, LookupRuleImplicit);
- goto l479;
+ goto l478;
}
/* begin followObjField:ofObject: */
objOop1 = longAt((candidateMixin + BaseHeaderSize) + (((long)EnclosingMixinIndex) << (shiftForWord())));
@@ -13165,7 +13168,7 @@
? longAt((GIV(classTableFirstPage) + BaseHeaderSize) + (((long)tagBits1) << (shiftForWord())))
: fetchClassOfNonImm(methodReceiver));
actualLookupRule = lookupProtectedstartingAtrule(GIV(messageSelector), GIV(lkupClass), LookupRuleImplicit);
- l479: /* end lookupImplicitReceiverSend */;
+ l478: /* end lookupImplicitReceiverSend */;
/* begin internalizeIPandSP */
assert(GIV(instructionPointer) != (ceReturnToInterpreterPC()));
localIP = pointerForOop(GIV(instructionPointer));
@@ -13193,26 +13196,26 @@
if (localPrimIndex >= 264) {
/* begin internalStackTopPut: */
longAtPointerput(localSP, longAt(((longAtPointer(localSP)) + BaseHeaderSize) + (((long)(localPrimIndex - 264)) << (shiftForWord()))));
- goto l470;
+ goto l469;
}
if (localPrimIndex == 256) {
- goto l470;
+ goto l469;
}
if (localPrimIndex == 257) {
longAtPointerput(localSP, GIV(trueObj));
- goto l470;
+ goto l469;
}
if (localPrimIndex == 258) {
longAtPointerput(localSP, GIV(falseObj));
- goto l470;
+ goto l469;
}
if (localPrimIndex == 259) {
longAtPointerput(localSP, GIV(nilObj));
- goto l470;
+ goto l469;
}
longAtPointerput(localSP, (((localPrimIndex - 261) << 3) | 1));
- l470: /* end internalQuickPrimitiveResponse */;
- goto l471;
+ l469: /* end internalQuickPrimitiveResponse */;
+ goto l470;
}
/* begin externalizeIPandSP */
assert((((usqInt)localIP)) != (ceReturnToInterpreterPC()));
@@ -13274,7 +13277,7 @@
if (succeeded) {
returntoExecutive(popStack(), 1);
browserPluginReturnIfNeeded();
- goto l471;
+ goto l470;
}
}
if (methodHasCogMethod(GIV(newMethod))) {
@@ -13349,11 +13352,11 @@
table = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((long)PrimErrTableIndex) << (shiftForWord())));
if (GIV(primFailCode) <= (numSlotsOf(table))) {
errorCode = longAt((table + BaseHeaderSize) + (((long)(GIV(primFailCode) - 1)) << (shiftForWord())));
- goto l482;
+ goto l481;
}
}
errorCode = ((GIV(primFailCode) << 3) | 1);
- l482: /* end getErrorObjectFromPrimFailCode */;
+ l481: /* end getErrorObjectFromPrimFailCode */;
longAtPointerput(localSP, errorCode);
}
GIV(primFailCode) = 0;
@@ -13377,7 +13380,7 @@
localFP = pointerForOop(GIV(framePointer));
}
}
- l471: /* end internalExecuteNewMethod */;
+ l470: /* end internalExecuteNewMethod */;
/* begin fetchNextBytecode */
currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector);
@@ -13457,7 +13460,7 @@
GIV(newMethod) = GIV(nsMethodCache)[probe1 + NSMethodCacheTargetMethod];
primitiveFunctionPointer = ((void (*)()) (GIV(nsMethodCache)[probe1 + NSMethodCachePrimFunction]));
GIV(localAbsentReceiverOrZero) = GIV(nsMethodCache)[probe1 + NSMethodCacheActualReceiver];
- goto l492;
+ goto l491;
}
/* second probe */
@@ -13469,7 +13472,7 @@
GIV(newMethod) = GIV(nsMethodCache)[probe1 + NSMethodCacheTargetMethod];
primitiveFunctionPointer = ((void (*)()) (GIV(nsMethodCache)[probe1 + NSMethodCachePrimFunction]));
GIV(localAbsentReceiverOrZero) = GIV(nsMethodCache)[probe1 + NSMethodCacheActualReceiver];
- goto l492;
+ goto l491;
}
probe1 = (((usqInt) hash1) >> 2) & NSMethodCacheMask;
if (((((GIV(nsMethodCache)[probe1 + NSMethodCacheSelector]) == GIV(messageSelector))
@@ -13479,7 +13482,7 @@
GIV(newMethod) = GIV(nsMethodCache)[probe1 + NSMethodCacheTargetMethod];
primitiveFunctionPointer = ((void (*)()) (GIV(nsMethodCache)[probe1 + NSMethodCachePrimFunction]));
GIV(localAbsentReceiverOrZero) = GIV(nsMethodCache)[probe1 + NSMethodCacheActualReceiver];
- goto l492;
+ goto l491;
}
/* end inlineLookupInNSMethodCacheSel:classTag:method:lookupRule:; fall through */
/* begin externalizeIPandSP */
@@ -13506,12 +13509,12 @@
classTablePage = longAt((GIV(hiddenRootsObj) + BaseHeaderSize) + (((long)fieldIndex) << (shiftForWord())));
if (classTablePage == GIV(nilObj)) {
GIV(lkupClass) = null;
- goto l486;
+ goto l485;
}
/* begin fetchPointer:ofObject: */
fieldIndex1 = GIV(lkupClassTag) & ((1LL << (classTableMajorIndexShift())) - 1);
GIV(lkupClass) = longAt((classTablePage + BaseHeaderSize) + (((long)fieldIndex1) << (shiftForWord())));
- l486: /* end classAtIndex: */;
+ l485: /* end classAtIndex: */;
/* begin lookupDynamicSuperSend */
GIV(localAbsentReceiver) = longAt(localFP + FoxIFReceiver);
GIV(localAbsentReceiverOrZero) = 0;
@@ -13533,7 +13536,7 @@
localSP = pointerForOop(GIV(stackPointer));
localFP = pointerForOop(GIV(framePointer));
addNewMethodToNSCache(actualLookupRule);
- l492: ;
+ l491: ;
/* begin shuffleArgumentsAndStoreAbsentReceiver: */
@@ -13555,26 +13558,26 @@
if (localPrimIndex >= 264) {
/* begin internalStackTopPut: */
longAtPointerput(localSP, longAt(((longAtPointer(localSP)) + BaseHeaderSize) + (((long)(localPrimIndex - 264)) << (shiftForWord()))));
- goto l487;
+ goto l486;
}
if (localPrimIndex == 256) {
- goto l487;
+ goto l486;
}
if (localPrimIndex == 257) {
longAtPointerput(localSP, GIV(trueObj));
- goto l487;
+ goto l486;
}
if (localPrimIndex == 258) {
longAtPointerput(localSP, GIV(falseObj));
- goto l487;
+ goto l486;
}
if (localPrimIndex == 259) {
longAtPointerput(localSP, GIV(nilObj));
- goto l487;
+ goto l486;
}
longAtPointerput(localSP, (((localPrimIndex - 261) << 3) | 1));
- l487: /* end internalQuickPrimitiveResponse */;
- goto l488;
+ l486: /* end internalQuickPrimitiveResponse */;
+ goto l487;
}
/* begin externalizeIPandSP */
assert((((usqInt)localIP)) != (ceReturnToInterpreterPC()));
@@ -13636,7 +13639,7 @@
if (succeeded) {
returntoExecutive(popStack(), 1);
browserPluginReturnIfNeeded();
- goto l488;
+ goto l487;
}
}
if (methodHasCogMethod(GIV(newMethod))) {
@@ -13711,11 +13714,11 @@
table = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((long)PrimErrTableIndex) << (shiftForWord())));
if (GIV(primFailCode) <= (numSlotsOf(table))) {
errorCode = longAt((table + BaseHeaderSize) + (((long)(GIV(primFailCode) - 1)) << (shiftForWord())));
- goto l494;
+ goto l493;
}
}
errorCode = ((GIV(primFailCode) << 3) | 1);
- l494: /* end getErrorObjectFromPrimFailCode */;
+ l493: /* end getErrorObjectFromPrimFailCode */;
longAtPointerput(localSP, errorCode);
}
GIV(primFailCode) = 0;
@@ -13739,7 +13742,7 @@
localFP = pointerForOop(GIV(framePointer));
}
}
- l488: /* end internalExecuteNewMethod */;
+ l487: /* end internalExecuteNewMethod */;
/* begin fetchNextBytecode */
currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector);
@@ -15069,7 +15072,7 @@
sqInt errorCode;
sqInt header;
sqInt i;
- sqInt inInterpreter;
+ int inInterpreter;
sqInt methodHeader;
sqInt numArgs;
sqInt numTemps;
@@ -15578,7 +15581,7 @@
EXPORT(sqInt)
callbackEnter(sqInt *callbackID)
{ DECL_MAYBE_VOLATILE_SQ_GLOBAL_STRUCT
- volatile sqInt calledFromMachineCode;
+ volatile int calledFromMachineCode;
volatile void *currentCFramePointer;
volatile void *currentCStackPointer;
volatile sqInt header;
@@ -17756,7 +17759,7 @@
static sqInt
checkForAndFollowForwardedPrimitiveState(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
- signed char accessorDepth;
+ sqInt accessorDepth;
sqInt firstBytecode;
sqInt found;
@@ Diff output truncated at 50000 characters. @@
More information about the Vm-dev
mailing list