[Vm-dev] [commit][2692] CogVM source as per VMMaker.oscog-eem.266.
commits at squeakvm.org
commits at squeakvm.org
Wed Feb 20 23:59:40 UTC 2013
Revision: 2692
Author: eliot
Date: 2013-02-20 15:59:35 -0800 (Wed, 20 Feb 2013)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.266.
Support one-way become on cogged methods that have the same code, for e.g.
Pharo's setSourcePosition:inFile:. Add error checks for two-way becomming
cogged methods, becomming married contexts, and for freeing any of these
during become. Refactor freeObject: and restoreHeaderOf: to allow subclasses
to add their error checks efficiently (i.e. avoiding fetching baseHeader more
than once). Make assert in rawHeaderOf:put: accept forwarding.
Tiny speed-up in using byteLengthOf: instead of byteSizeOf: in cogit.
Add asLong to CCodeGenerator and there-by eliminate printf warnings in
reportMinimumUnusedHeadroom. Eliminate warning in instVar:ofContext:put:.
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/src/examplePlugins.ext
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
Property Changed:
----------------
branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
Modified: branches/Cog/nscogsrc/vm/cogit.c
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.c 2013-02-20 17:56:53 UTC (rev 2691)
+++ branches/Cog/nscogsrc/vm/cogit.c 2013-02-20 23:59:35 UTC (rev 2692)
@@ -1,9 +1,9 @@
/* Automatically generated by
- CCodeGenerator VMMaker.oscog-eem.264 uuid: 64e76092-8af7-449f-9188-e65f3bd1f08d
+ CCodeGenerator VMMaker.oscog-eem.266 uuid: ee4e0b6e-91a8-432c-847b-132d682bc79b
from
- StackToRegisterMappingCogit VMMaker.oscog-eem.264 uuid: 64e76092-8af7-449f-9188-e65f3bd1f08d
+ StackToRegisterMappingCogit VMMaker.oscog-eem.266 uuid: ee4e0b6e-91a8-432c-847b-132d682bc79b
*/
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.264 uuid: 64e76092-8af7-449f-9188-e65f3bd1f08d " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.266 uuid: ee4e0b6e-91a8-432c-847b-132d682bc79b " __DATE__ ;
char *__cogitBuildInfo = __buildInfo;
@@ -534,6 +534,7 @@
static void dispatchConcretize(AbstractInstruction * self_in_dispatchConcretize);
static sqInt doubleExtendedDoAnythingBytecode(void);
static sqInt duplicateTopBytecode(void);
+static sqInt endPCOf(sqInt aMethod);
static BytecodeFixup * ensureFixupAt(sqInt targetIndex);
static BytecodeFixup * ensureNonMergeFixupAt(sqInt targetIndex);
static void ensureReceiverResultRegContainsSelf(void);
@@ -906,6 +907,7 @@
static sqInt methodAbortTrampolineFor(sqInt numArgs);
static CogMethod * methodAfter(CogMethod *cogMethod);
CogMethod * methodFor(void *address);
+static sqInt methodhasSameCodeAs(sqInt methodA, sqInt methodB);
sqInt minCogMethodAddress(void);
sqInt mnuOffset(void);
static sqInt modRMRO(AbstractInstruction * self_in_modRMRO, sqInt mod, sqInt regMode, sqInt regOpcode);
@@ -4166,7 +4168,7 @@
initialPC = startPCOfMethod(methodObj);
endPC = (isQuickPrimitiveIndex(primitiveIndex)
? initialPC - 1
- : byteSizeOf(methodObj));
+ : byteLengthOf(methodObj));
numBytecodes = (endPC - initialPC) + 1;
allocateOpcodesbytecodes((numBytecodes + extra) * 10, numBytecodes);
if (((numBlocks = scanMethod())) < 0) {
@@ -7611,7 +7613,56 @@
return ssPushDesc(desc);
}
+static sqInt
+endPCOf(sqInt aMethod)
+{
+ sqInt bsOffset;
+ sqInt byte;
+ BytecodeDescriptor *descriptor;
+ sqInt distance;
+ sqInt end;
+ sqInt latestContinuation;
+ sqInt nExts;
+ sqInt pc;
+ sqInt prim;
+ sqInt targetPC;
+ pc = (latestContinuation = startPCOfMethod(aMethod));
+ if (((prim = primitiveIndexOf(aMethod))) > 0) {
+ if (isQuickPrimitiveIndex(prim)) {
+ return pc - 1;
+ }
+ }
+ bsOffset = (methodUsesAlternateBytecodeSet(aMethod)
+ ? 256
+ : 0);
+ nExts = 0;
+ end = byteLengthOf(aMethod);
+ while (pc <= end) {
+ byte = fetchByteofObject(pc, aMethod);
+ descriptor = generatorAt(byte + bsOffset);
+ if (((descriptor->isReturn))
+ && (pc >= latestContinuation)) {
+ end = pc;
+ }
+ if ((isBranch(descriptor))
+ || ((descriptor->isBlockCreation))) {
+ distance = ((descriptor->spanFunction))(descriptor, pc, nExts, aMethod);
+ targetPC = (pc + ((descriptor->numBytes))) + distance;
+ latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation);
+ if ((descriptor->isBlockCreation)) {
+ pc += distance;
+ }
+ }
+ nExts = ((descriptor->isExtension)
+ ? nExts + 1
+ : 0);
+ pc += (descriptor->numBytes);
+ }
+ return end;
+}
+
+
/* Make sure there's a flagged fixup at the targetIndex (pc relative to first
pc) in fixups.
Initially a fixup's target is just a flag. Later on it is replaced with a
@@ -14691,7 +14742,7 @@
|| ((((usqInt) (byteAt(map))) >> AnnotationShift) == IsDisplacementX2N)));
latestContinuation = startbcpc;
aMethodObj = (homeMethod->methodObject);
- endbcpc = (byteSizeOf(aMethodObj)) - 1;
+ endbcpc = (byteLengthOf(aMethodObj)) - 1;
/* begin bytecodeSetOffsetForHeader: */
methodHeader = (homeMethod->methodHeader);
bsOffset = (headerIndicatesAlternateBytecodeSet(methodHeader)
@@ -14899,6 +14950,7 @@
sqInt freedPIC;
sqInt hasYoungObj;
sqInt hasYoungObjPtr;
+ sqInt remappedMethod;
hasYoungObj = 0;
hasYoungObjPtr = ((sqInt)((&hasYoungObj)));
@@ -14925,6 +14977,19 @@
assert(((cogMethod->objectHeader)) == (nullHeaderForMachineCodeMethod()));
assert(((rawHeaderOf((cogMethod->methodObject))) == (((sqInt)cogMethod)))
|| ((noAssertMethodClassAssociationOf((cogMethod->methodObject))) == (nilObject())));
+ remappedMethod = remapOop((cogMethod->methodObject));
+ if (remappedMethod != ((cogMethod->methodObject))) {
+ if (methodHasCogMethod(remappedMethod)) {
+ error("attempt to become two cogged methods");
+ }
+ if (!(withoutForwardingOnandsendToCogit((cogMethod->methodObject), remappedMethod, methodhasSameCodeAs))) {
+ error("attempt to become cogged method into different method");
+ }
+ rawHeaderOfput((cogMethod->methodObject), (cogMethod->methodHeader));
+ (cogMethod->methodHeader = rawHeaderOf(remappedMethod));
+ (cogMethod->methodObject = remappedMethod);
+ rawHeaderOfput(remappedMethod, ((sqInt)cogMethod));
+ }
if (isYoung((cogMethod->methodObject))) {
hasYoungObj = 1;
}
@@ -15814,6 +15879,47 @@
return 0;
}
+
+/* For the purposes of become: see if the two methods are similar, i.e. can
+ be safely becommed.
+ This is pretty strict. All literals and bytecodes must be identical. Only
+ trailer bytes and header
+ flags can differ. */
+
+static sqInt
+methodhasSameCodeAs(sqInt methodA, sqInt methodB)
+{
+ sqInt bi;
+ sqInt endPCA;
+ sqInt headerA;
+ sqInt headerB;
+ sqInt li;
+ sqInt numLitsA;
+
+ headerA = headerOf(methodA);
+ headerB = headerOf(methodB);
+ numLitsA = literalCountOfHeader(headerA);
+ endPCA = endPCOf(methodA);
+ if (((argumentCountOfMethodHeader(headerA)) != (argumentCountOfMethodHeader(headerB)))
+ || (((temporaryCountOfMethodHeader(headerA)) != (temporaryCountOfMethodHeader(headerB)))
+ || (((primitiveIndexOfMethodheader(methodA, headerA)) != (primitiveIndexOfMethodheader(methodB, headerB)))
+ || ((numLitsA != (literalCountOfHeader(headerB)))
+ || (endPCA > (byteLengthOf(methodB))))))) {
+ return 0;
+ }
+ for (li = 1; li <= (numLitsA - 1); li += 1) {
+ if ((fetchPointerofObject(li, methodA)) != (fetchPointerofObject(li, methodB))) {
+ return 0;
+ }
+ }
+ for (bi = (startPCOfMethod(methodA)); bi <= endPCA; bi += 1) {
+ if ((fetchByteofObject(bi, methodA)) != (fetchByteofObject(bi, methodB))) {
+ return 0;
+ }
+ }
+ return 1;
+}
+
sqInt
minCogMethodAddress(void)
{
Modified: branches/Cog/nscogsrc/vm/cogit.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.h 2013-02-20 17:56:53 UTC (rev 2691)
+++ branches/Cog/nscogsrc/vm/cogit.h 2013-02-20 23:59:35 UTC (rev 2692)
@@ -1,5 +1,5 @@
/* Automatically generated by
- CCodeGenerator VMMaker.oscog-eem.264 uuid: 64e76092-8af7-449f-9188-e65f3bd1f08d
+ CCodeGenerator VMMaker.oscog-eem.266 uuid: ee4e0b6e-91a8-432c-847b-132d682bc79b
*/
Modified: branches/Cog/nscogsrc/vm/cogmethod.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogmethod.h 2013-02-20 17:56:53 UTC (rev 2691)
+++ branches/Cog/nscogsrc/vm/cogmethod.h 2013-02-20 23:59:35 UTC (rev 2692)
@@ -1,5 +1,5 @@
/* Automatically generated by
- CCodeGenerator VMMaker.oscog-eem.264 uuid: 64e76092-8af7-449f-9188-e65f3bd1f08d
+ CCodeGenerator VMMaker.oscog-eem.266 uuid: ee4e0b6e-91a8-432c-847b-132d682bc79b
*/
typedef struct {
Modified: branches/Cog/nscogsrc/vm/cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.c 2013-02-20 17:56:53 UTC (rev 2691)
+++ branches/Cog/nscogsrc/vm/cointerp.c 2013-02-20 23:59:35 UTC (rev 2692)
@@ -1,9 +1,9 @@
/* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.265 uuid: c8c5b4d1-706a-4eb6-ad85-566811e2b239
+ CCodeGeneratorGlobalStructure VMMaker.oscog-eem.266 uuid: ee4e0b6e-91a8-432c-847b-132d682bc79b
from
- CoInterpreter VMMaker.oscog-eem.265 uuid: c8c5b4d1-706a-4eb6-ad85-566811e2b239
+ CoInterpreter VMMaker.oscog-eem.266 uuid: ee4e0b6e-91a8-432c-847b-132d682bc79b
*/
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.265 uuid: c8c5b4d1-706a-4eb6-ad85-566811e2b239 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.266 uuid: ee4e0b6e-91a8-432c-847b-132d682bc79b " __DATE__ ;
char *__interpBuildInfo = __buildInfo;
@@ -363,7 +363,7 @@
void beRootIfOld(sqInt oop);
static void beRootWhileForwarding(sqInt oop);
sqInt booleanValueOf(sqInt obj);
-static sqInt byteLengthOf(sqInt oop);
+sqInt byteLengthOf(sqInt obj);
sqInt byteSizeOf(sqInt oop);
sqInt byteSwapped(sqInt w);
EXPORT(sqInt) callbackEnter(sqInt *callbackID);
@@ -579,6 +579,7 @@
static sqInt handleStackOverflowOrEventAllowContextSwitch(sqInt mayContextSwitch);
sqInt headerIndicatesAlternateBytecodeSet(sqInt methodHeader);
sqInt headerOf(sqInt methodPointer);
+static sqInt headerWhileForwardingOf(sqInt oop);
sqInt highBit(usqInt anUnsignedValue);
static sqInt iframeIsBlockActivation(char *theFP);
static usqInt iframeMethod(char *theFP);
@@ -613,6 +614,7 @@
sqInt isBytes(sqInt oop);
static sqInt isClassOfNonImmequalTo(sqInt oop, sqInt classOop);
sqInt isCogMethodReference(sqInt methodHeader);
+static sqInt isCompiledMethodHeader(sqInt objHeader);
sqInt isCompiledMethod(sqInt oop);
static sqInt isContextHeader(sqInt aHeader);
static sqInt isContextNonInt(sqInt oop);
@@ -638,6 +640,7 @@
sqInt isQuickPrimitiveIndex(sqInt anInteger);
sqInt isReallyYoungObject(sqInt obj);
static sqInt isSingleContext(sqInt aContext);
+static sqInt isStillMarriedContext(sqInt aContext);
static sqInt isWeakNonInt(sqInt oop);
sqInt isWeak(sqInt oop);
static sqInt isWidowedContext(sqInt aOnceMarriedContext);
@@ -734,6 +737,7 @@
static sqInt noMarkedContextsOnPage(StackPage *thePage);
static sqInt nonWeakFieldsOf(sqInt oop);
sqInt nullHeaderForMachineCodeMethod(void);
+static sqInt numStkPages(void);
sqInt objectAfter(sqInt oop);
sqInt objectArg(sqInt index);
sqInt objectBefore(sqInt address);
@@ -1156,6 +1160,7 @@
static sqInt synchronousSignal(sqInt aSemaphore);
static void tearDownAndRebuildFrameForCannotReturnBaseFrameReturnFromtoreturnValue(sqInt contextToReturnFrom, sqInt contextToReturnTo, sqInt returnValue);
sqInt tempCountOf(sqInt methodPointer);
+sqInt temporaryCountOfMethodHeader(sqInt header);
void tenuringIncrementalGC(void);
sqInt topRemappableOop(void);
static void transferTofrom(sqInt newProc, sqInt sourceCode);
@@ -1172,6 +1177,7 @@
static void voidLongRunningPrimitive(char *reason);
static sqInt voidVMStateForSnapshot(void);
static sqInt wakeHighestPriority(void);
+sqInt withoutForwardingOnandsendToCogit(sqInt obj1, sqInt obj2, sqInt (*selector)(sqInt,sqInt));
static sqInt withSmallIntegerTags(char *value);
static sqInt wordSwapped(sqInt w);
static void writeImageFileIO(sqInt imageBytes);
@@ -1192,8 +1198,8 @@
_iss usqInt method;
_iss sqInt bytecodeSetSelector;
_iss usqInt instructionPointer;
+_iss sqInt argumentCount;
_iss sqInt nilObj;
-_iss sqInt argumentCount;
_iss usqInt freeStart;
_iss sqInt messageSelector;
_iss usqInt newMethod;
@@ -1939,7 +1945,7 @@
0 };
static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
static usqInt heapBase;
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.265";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.266";
sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
volatile int sendTrace;
@@ -1960,6 +1966,7 @@
#define dispatchFunctionPointer(aFunctionPointer) (aFunctionPointer)()
#define enterSmalltalkExecutive() enterSmalltalkExecutiveImplementation()
#define flush() fflush(stdout)
+#define freeStart() freeStart
#define getCodeCompactionCount() integerObjectOf(GIV(statCodeCompactionCount))
#define getCodeCompactionMSecs() integerObjectOf((GIV(statCodeCompactionUsecs) + 500) / 1000)
#define getCogCodeSize() integerObjectOf(GIV(cogCodeSize))
@@ -5609,7 +5616,7 @@
localSP = pointerForOop(GIV(stackPointer));
localFP = pointerForOop(GIV(framePointer));
markStackPageMostRecentlyUsed(GIV(stackPage));
- assertValidExecutionPointersimbar(localIP, localFP, localSP, 1);
+ assertValidExecutionPointersimbar(((usqInt)localIP), localFP, localSP, 1);
l5: /* end instVar:ofContext:put: */;
}
else {
@@ -12007,7 +12014,7 @@
localSP = pointerForOop(GIV(stackPointer));
localFP = pointerForOop(GIV(framePointer));
markStackPageMostRecentlyUsed(GIV(stackPage));
- assertValidExecutionPointersimbar(localIP, localFP, localSP, 1);
+ assertValidExecutionPointersimbar(((usqInt)localIP), localFP, localSP, 1);
l262: /* end instVar:ofContext:put: */;
}
else {
@@ -12159,7 +12166,7 @@
localSP = pointerForOop(GIV(stackPointer));
localFP = pointerForOop(GIV(framePointer));
markStackPageMostRecentlyUsed(GIV(stackPage));
- assertValidExecutionPointersimbar(localIP, localFP, localSP, 1);
+ assertValidExecutionPointersimbar(((usqInt)localIP), localFP, localSP, 1);
l263: /* end instVar:ofContext:put: */;
}
else {
@@ -13095,7 +13102,7 @@
l1: /* end adjustFieldsAndClassOf:by: */;
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) oop)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
@@ -13330,7 +13337,7 @@
assert((methodUsesAlternateBytecodeSet(GIV(method))) == (GIV(bytecodeSetSelector) == 256));
if ((asserta((((usqInt)methodField)) > (startOfMemory())))
- && (asserta((((usqInt)methodField)) < GIV(freeStart)))) {
+ && (asserta((((usqInt)methodField)) < (freeStart())))) {
if (lip != (ceReturnToInterpreterPC())) {
assert((lip >= (((methodField + (lastPointerOf(methodField))) + BaseHeaderSize) - 1))
&& (lip < ((methodField + (byteLengthOf(methodField))) + BaseHeaderSize)));
@@ -13531,6 +13538,9 @@
sqInt methodHeader;
sqInt numLiterals;
sqInt objHeader;
+ sqInt objHeader1;
+ sqInt objHeader11;
+ sqInt objHeader2;
sqInt objHeaderBytes;
sqInt objHeaderType;
sqInt objSize;
@@ -13649,13 +13659,41 @@
fwdBlock = (fwdHeader & AllButMarkBitAndTypeMask) << 1;
assert((fwdHeader & MarkBit) != 0);
assert(fwdBlockValid(fwdBlock));
- longAtput(oop1, longAt(fwdBlock + BytesPerWord));
+ objHeader = longAt(fwdBlock + BytesPerWord);
+ /* begin restoreHeaderOf:to: */
+ VM_LABEL(0restoreHeaderOfto);
+ longAtput(oop1, objHeader);
+ if (((((usqInt) objHeader) >> 12) & 31) == ClassMethodContextCompactIndex) {
+ if (!(asserta(!(isStillMarriedContext(oop1))))) {
+ error("attempt to become married context");
+ }
+ }
+ if (((((usqInt) objHeader) >> 8) & 15) >= 12) {
+ if (!(asserta((!(methodHasCogMethod(oop1)))
+ || (oop1 == (cogMethodOf(oop1)))))) {
+ error("attempt to become cogged method");
+ }
+ }
/* begin restoreHeaderOf: */
fwdHeader1 = longAt(oop2);
fwdBlock1 = (fwdHeader1 & AllButMarkBitAndTypeMask) << 1;
assert((fwdHeader1 & MarkBit) != 0);
assert(fwdBlockValid(fwdBlock1));
- longAtput(oop2, longAt(fwdBlock1 + BytesPerWord));
+ objHeader1 = longAt(fwdBlock1 + BytesPerWord);
+ /* begin restoreHeaderOf:to: */
+ VM_LABEL(1restoreHeaderOfto);
+ longAtput(oop2, objHeader1);
+ if (((((usqInt) objHeader1) >> 12) & 31) == ClassMethodContextCompactIndex) {
+ if (!(asserta(!(isStillMarriedContext(oop2))))) {
+ error("attempt to become married context");
+ }
+ }
+ if (((((usqInt) objHeader1) >> 8) & 15) >= 12) {
+ if (!(asserta((!(methodHasCogMethod(oop2)))
+ || (oop2 == (cogMethodOf(oop2)))))) {
+ error("attempt to become cogged method");
+ }
+ }
hdr1 = longAt(oop1);
hdr2 = longAt(oop2);
longAtput(oop1, (hdr1 & AllButHashBits) | (hdr2 & HashBits));
@@ -13684,7 +13722,21 @@
fwdBlock11 = (fwdHeader2 & AllButMarkBitAndTypeMask) << 1;
assert((fwdHeader2 & MarkBit) != 0);
assert(fwdBlockValid(fwdBlock11));
- longAtput(oop11, longAt(fwdBlock11 + BytesPerWord));
+ objHeader2 = longAt(fwdBlock11 + BytesPerWord);
+ /* begin restoreHeaderOf:to: */
+ VM_LABEL(2restoreHeaderOfto);
+ longAtput(oop11, objHeader2);
+ if (((((usqInt) objHeader2) >> 12) & 31) == ClassMethodContextCompactIndex) {
+ if (!(asserta(!(isStillMarriedContext(oop11))))) {
+ error("attempt to become married context");
+ }
+ }
+ if (((((usqInt) objHeader2) >> 8) & 15) >= 12) {
+ if (!(asserta((!(methodHasCogMethod(oop11)))
+ || (oop11 == (cogMethodOf(oop11)))))) {
+ error("attempt to become cogged method");
+ }
+ }
if (copyHashFlag) {
/* Change the hash of the new oop (oop2) to be that of the old (oop1)
@@ -13695,20 +13747,29 @@
longAtput(oop21, (hdr21 & AllButHashBits) | (hdr11 & HashBits));
}
/* begin freeObject: */
- VM_LABEL(0freeObject);
- assert((!(isCompiledMethod(oop11)))
- || (!(methodHasCogMethod(oop11))));
- objHeader = longAt(oop11);
- if ((objHeader & RootBit) != 0) {
+ objHeader11 = longAt(oop11);
+ /* begin freeObject:header: */
+ VM_LABEL(0freeObjectheader);
+ if (((((usqInt) objHeader11) >> 8) & 15) >= 12) {
+ if (!(asserta(!(methodHasCogMethod(oop11))))) {
+ error("attempt to free cogged method");
+ }
+ }
+ if (((((usqInt) objHeader11) >> 12) & 31) == ClassMethodContextCompactIndex) {
+ if (!(asserta(!(isStillMarriedContext(oop11))))) {
+ error("attempt to free married context");
+ }
+ }
+ if ((objHeader11 & RootBit) != 0) {
removeYoungRoot(oop11);
}
- objHeaderType = objHeader & TypeMask;
+ objHeaderType = objHeader11 & TypeMask;
objHeaderBytes = headerTypeBytes[objHeaderType];
if ((objHeaderType & 1) == 1) {
/* HeaderTypeClass or HeaderTypeShort */
- objSize = objHeader & SizeMask;
+ objSize = objHeader11 & SizeMask;
}
else {
if (objHeaderType == HeaderTypeFree) {
@@ -13719,7 +13780,7 @@
}
assert(((objSize + objHeaderBytes) & AllButTypeMask) == (objSize + objHeaderBytes));
longAtput(oop11 - objHeaderBytes, (objSize + objHeaderBytes) | HeaderTypeFree);
- l1: /* end freeObject: */;
+ l1: /* end freeObject:header: */;
fwdBlock2 += BytesPerWord * 4;
}
}
@@ -13880,20 +13941,20 @@
}
-/* Return the number of indexable bytes in the given object. This is
- basically a special copy of lengthOf: for BitBlt.
- */
+/* Return the number of indexable bytes in the given object.
+ This is basically a special copy of lengthOf: for BitBlt. But it is also
+ whoorishly used for the Cogit. */
-static sqInt
-byteLengthOf(sqInt oop)
+sqInt
+byteLengthOf(sqInt obj)
{
sqInt fmt;
sqInt header;
sqInt sz;
- header = longAt(oop);
+ header = longAt(obj);
sz = ((header & TypeMask) == HeaderTypeSizeAndClass
- ? (longAt(oop - (BytesPerWord * 2))) & AllButTypeMask
+ ? (longAt(obj - (BytesPerWord * 2))) & AllButTypeMask
: header & SizeMask);
fmt = (((usqInt) header) >> 8) & 15;
return (fmt < 8
@@ -15725,7 +15786,7 @@
goto l2;
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) obj1)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(obj1, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(obj1)) & TypeMask) == HeaderTypeFree) {
@@ -15747,7 +15808,7 @@
ok = ok && (checkOkayFields(oop));
/* begin accessibleObjectAfter: */
/* begin objectAfter: */
- if (!(asserta((((usqInt) oop)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
@@ -15767,7 +15828,7 @@
goto l1;
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) obj)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(obj, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(obj)) & TypeMask) == HeaderTypeFree) {
@@ -19480,6 +19541,7 @@
sqInt startOop1;
sqInt stopAddr;
sqInt stopAddr1;
+ sqInt stopAddr11;
sqInt stopAddr2;
sqInt stopAddr3;
sqInt swapFloatWords;
@@ -19493,9 +19555,10 @@
/* begin reverseBytesInImage */
/* begin reverseBytesFrom:to: */
startAddr = startOfMemory();
+ stopAddr1 = freeStart();
flag("Dan");
addr = startAddr;
- while ((((usqInt) addr)) < (((usqInt) GIV(freeStart)))) {
+ while ((((usqInt) addr)) < (((usqInt) stopAddr1))) {
longAtput(addr, byteSwapped(longAt(addr)));
addr += BytesPerWord;
}
@@ -19504,7 +19567,7 @@
/* begin oopFromChunk: */
chunk1 = startOfMemory();
startOop1 = chunk1 + (headerTypeBytes[(longAt(chunk1)) & TypeMask]);
- stopAddr3 = GIV(freeStart);
+ stopAddr3 = freeStart();
swapFloatWords = ((VMBIGENDIAN
? 1
: 0)) != GIV(imageFloatsBigEndian);
@@ -19526,10 +19589,10 @@
wordAddr = (wordAddr + BytesPerWord) + (((((usqInt) methodHeader) >> 10) & 255) * BytesPerWord);
}
/* begin reverseBytesFrom:to: */
- stopAddr1 = oop1 + (sizeBitsOf(oop1));
+ stopAddr11 = oop1 + (sizeBitsOf(oop1));
flag("Dan");
addr2 = wordAddr;
- while ((((usqInt) addr2)) < (((usqInt) stopAddr1))) {
+ while ((((usqInt) addr2)) < (((usqInt) stopAddr11))) {
longAtput(addr2, byteSwapped(longAt(addr2)));
addr2 += BytesPerWord;
}
@@ -19562,7 +19625,7 @@
}
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) oop1)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(oop1, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(oop1)) & TypeMask) == HeaderTypeFree) {
@@ -19584,7 +19647,7 @@
/* begin oopFromChunk: */
chunk = startOfMemory();
startOop = chunk + (headerTypeBytes[(longAt(chunk)) & TypeMask]);
- stopAddr = GIV(freeStart);
+ stopAddr = freeStart();
if (((VMBIGENDIAN
? 1
: 0)) == GIV(imageFloatsBigEndian)) {
@@ -19602,7 +19665,7 @@
}
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) oop)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
@@ -21512,7 +21575,7 @@
/* begin oopFromChunk: */
chunk = startOfMemory();
oop = chunk + (headerTypeBytes[(longAt(chunk)) & TypeMask]);
- while ((((usqInt) oop)) < (((usqInt) GIV(freeStart)))) {
+ while (oopisLessThan(oop, freeStart())) {
if (!(((longAt(oop)) & TypeMask) == HeaderTypeFree)) {
if (((((usqInt) (longAt(oop))) >> 8) & 15) >= 12) {
@@ -21542,7 +21605,7 @@
}
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) oop)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
@@ -22572,6 +22635,28 @@
}
+/* Answer the header of the argument even though
+ it may have its header word in a forwarding block. */
+
+static sqInt
+headerWhileForwardingOf(sqInt oop)
+{
+ sqInt fwdBlock;
+ sqInt header;
+
+ header = longAt(oop);
+ if ((header & MarkBit) != 0) {
+
+ /* oop is forwarded; get its real header from its forwarding table entry */
+
+ fwdBlock = (header & AllButMarkBitAndTypeMask) << 1;
+ assert(fwdBlockValid(fwdBlock));
+ header = longAt(fwdBlock + BytesPerWord);
+ }
+ return header;
+}
+
+
/* This is a C implementation needed by ioSetMaxExtSemTableSize
and e.g. stackPageByteSize. */
@@ -22991,7 +23076,7 @@
header = longAt(oop);
if ((header & MarkBit) == 0) {
/* begin objectAfter: */
- if (!(asserta((((usqInt) oop)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
@@ -23067,7 +23152,7 @@
header2 = longAt(oop);
if ((header2 & MarkBit) == 0) {
/* begin objectAfter: */
- if (!(asserta((((usqInt) oop)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
@@ -24364,6 +24449,15 @@
}
+/* Answer whether the argument header has compiled method format */
+
+static sqInt
+isCompiledMethodHeader(sqInt objHeader)
+{
+ return ((((usqInt) objHeader) >> 8) & 15) >= 12;
+}
+
+
/* Answer whether the argument object is of compiled method format */
sqInt
@@ -24657,6 +24751,17 @@
}
+/* Answer if aContext is married or widowed and still married.
+ If a context is widowed then turn it into a single dead context. */
+
+static sqInt
+isStillMarriedContext(sqInt aContext)
+{
+ return (((longAt((aContext + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1))
+ && (!(isWidowedContext(aContext)));
+}
+
+
/* Answer true if the argument has only weak fields that can hold oops. See
comment in formatOf:
*/
@@ -25240,7 +25345,7 @@
}
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) oop)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
@@ -25321,7 +25426,7 @@
}
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) oop1)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(oop1, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(oop1)) & TypeMask) == HeaderTypeFree) {
@@ -25413,7 +25518,7 @@
}
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) segOop)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(segOop, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(segOop)) & TypeMask) == HeaderTypeFree) {
@@ -25453,7 +25558,7 @@
fieldPtr += BytesPerWord;
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) segOop)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(segOop, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(segOop)) & TypeMask) == HeaderTypeFree) {
@@ -25518,7 +25623,7 @@
sqInt sz;
if (((oop & 1))
- || ((!(((oop >= (startOfMemory())) && (oop <= GIV(freeStart)))))
+ || ((!(((oop >= (startOfMemory())) && (oop <= (freeStart())))))
|| (((oop & (BytesPerWord - 1)) != 0)
|| (((longAt(oop)) & TypeMask) == HeaderTypeFree)))) {
printOop(oop); return;
@@ -25693,7 +25798,7 @@
goto l3;
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) obj1)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(obj1, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(obj1)) & TypeMask) == HeaderTypeFree) {
@@ -25776,7 +25881,7 @@
}
/* begin accessibleObjectAfter: */
/* begin objectAfter: */
- if (!(asserta((((usqInt) oop)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
@@ -25796,7 +25901,7 @@
goto l2;
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) obj)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(obj, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(obj)) & TypeMask) == HeaderTypeFree) {
@@ -28779,7 +28884,13 @@
return (1 << 12) + HeaderTypeShort;
}
+static sqInt
+numStkPages(void)
+{
+ return GIV(numStackPages);
+}
+
/* Return the object or free chunk immediately following the
given object or free chunk in memory. Return endOfMemory
when enumeration is complete. */
@@ -28790,7 +28901,7 @@
sqInt header;
sqInt sz;
- if (!(asserta((((usqInt) oop)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
@@ -29218,7 +29329,7 @@
if (!(asserta((((page->nextPage)->prevPage)) == page))) {
ok = 0;
}
- if (asserta(!(((page->baseFP)) == 0))) {
+ if (asserta(!(isFree(page)))) {
if (!(asserta((stackPageFor((page->baseFP))) == page))) {
ok = 0;
}
@@ -29232,7 +29343,7 @@
page = (page->nextPage);
count += 1;
}
- if (!(asserta(count == GIV(numStackPages)))) {
+ if (!(asserta(count == (numStkPages())))) {
ok = 0;
}
return ok;
@@ -31213,7 +31324,7 @@
? (assert(((((CogMethod *) methodHeader)->objectHeader)) == (nullHeaderForMachineCodeMethod())),
(((CogMethod *) methodHeader)->methodHeader))
: methodHeader);
- assert(isCompiledMethod(newCopy));
+ assert(isCompiledMethodHeader(headerWhileForwardingOf(newCopy)));
longAtput((newCopy + BaseHeaderSize) + (HeaderIndex << ShiftForWord), cogMethodOrMethodHeader);
}
}
@@ -38942,7 +39053,7 @@
? (longAt(object - BaseHeaderSize)) & AllButTypeMask
: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)));
/* begin objectAfter: */
- if (!(asserta((((usqInt) object)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(object, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(object)) & TypeMask) == HeaderTypeFree) {
@@ -38956,7 +39067,7 @@
: header1 & SizeMask);
}
subsequentObject = (object + sz1) + (headerTypeBytes[(longAt(object + sz1)) & TypeMask]);
- while ((((usqInt) subsequentObject)) < (((usqInt) GIV(freeStart)))) {
+ while (oopisLessThan(subsequentObject, freeStart())) {
if ((!(((longAt(subsequentObject)) & TypeMask) == HeaderTypeFree))
&& (((((ccIndex1 = (((usqInt) (longAt(subsequentObject))) >> 12) & 31)) == 0
? (longAt(subsequentObject - BaseHeaderSize)) & AllButTypeMask
@@ -38967,7 +39078,7 @@
return;
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) subsequentObject)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(subsequentObject, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(subsequentObject)) & TypeMask) == HeaderTypeFree) {
@@ -39010,7 +39121,7 @@
object = longAt(GIV(stackPointer));
/* begin accessibleObjectAfter: */
/* begin objectAfter: */
- if (!(asserta((((usqInt) object)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(object, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(object)) & TypeMask) == HeaderTypeFree) {
@@ -39030,7 +39141,7 @@
goto l1;
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) obj)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(obj, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(obj)) & TypeMask) == HeaderTypeFree) {
@@ -41600,7 +41711,7 @@
goto l2;
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) obj1)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(obj1, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(obj1)) & TypeMask) == HeaderTypeFree) {
@@ -41630,7 +41741,7 @@
}
/* begin accessibleObjectAfter: */
/* begin objectAfter: */
- if (!(asserta((((usqInt) thisObj)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(thisObj, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(thisObj)) & TypeMask) == HeaderTypeFree) {
@@ -41650,7 +41761,7 @@
goto l1;
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) obj)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(obj, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(obj)) & TypeMask) == HeaderTypeFree) {
@@ -41710,7 +41821,7 @@
goto l1;
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) obj)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(obj, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(obj)) & TypeMask) == HeaderTypeFree) {
@@ -43278,6 +43389,7 @@
sqInt valuePointer10;
sqInt valuePointer11;
sqInt valuePointer12;
+ sqInt valuePointer13;
sqInt valuePointer2;
sqInt valuePointer3;
sqInt valuePointer4;
@@ -43294,7 +43406,9 @@
/* begin storePointerUnchecked:ofObject:withValue: */
valuePointer = ((((youngStart()) - mem) << 1) | 1);
longAtput((result + BaseHeaderSize) + (0 << ShiftForWord), valuePointer);
- longAtput((result + BaseHeaderSize) + (1 << ShiftForWord), (((GIV(freeStart) - mem) << 1) | 1));
+ /* begin storePointerUnchecked:ofObject:withValue: */
+ valuePointer1 = ((((freeStart()) - mem) << 1) | 1);
+ longAtput((result + BaseHeaderSize) + (1 << ShiftForWord), valuePointer1);
longAtput((result + BaseHeaderSize) + (2 << ShiftForWord), (((GIV(endOfMemory) - mem) << 1) | 1));
longAtput((result + BaseHeaderSize) + (3 << ShiftForWord), GIV(nilObj));
longAtput((result + BaseHeaderSize) + (4 << ShiftForWord), GIV(nilObj));
@@ -43313,8 +43427,8 @@
longAtput((result + BaseHeaderSize) + (23 << ShiftForWord), ((GIV(shrinkThreshold) << 1) | 1));
longAtput((result + BaseHeaderSize) + (24 << ShiftForWord), ((GIV(growHeadroom) << 1) | 1));
/* begin storePointerUnchecked:ofObject:withValue: */
- valuePointer1 = (((ioHeartbeatMilliseconds()) << 1) | 1);
- longAtput((result + BaseHeaderSize) + (25 << ShiftForWord), valuePointer1);
+ valuePointer2 = (((ioHeartbeatMilliseconds()) << 1) | 1);
+ longAtput((result + BaseHeaderSize) + (25 << ShiftForWord), valuePointer2);
longAtput((result + BaseHeaderSize) + (26 << ShiftForWord), ((GIV(statMarkCount) << 1) | 1));
longAtput((result + BaseHeaderSize) + (27 << ShiftForWord), ((GIV(statSweepCount) << 1) | 1));
longAtput((result + BaseHeaderSize) + (28 << ShiftForWord), ((GIV(statMkFwdCount) << 1) | 1));
@@ -43330,22 +43444,22 @@
longAtput((result + BaseHeaderSize) + (38 << ShiftForWord), ((GIV(statPendingFinalizationSignals) << 1) | 1));
longAtput((result + BaseHeaderSize) + (39 << ShiftForWord), ((BytesPerWord << 1) | 1));
/* begin storePointerUnchecked:ofObject:withValue: */
- valuePointer2 = ((((BytesPerWord == 4
+ valuePointer3 = ((((BytesPerWord == 4
? 6505
: 68003)) << 1) | 1);
- longAtput((result + BaseHeaderSize) + (40 << ShiftForWord), valuePointer2);
+ longAtput((result + BaseHeaderSize) + (40 << ShiftForWord), valuePointer3);
longAtput((result + BaseHeaderSize) + (41 << ShiftForWord), ((GIV(numStackPages) << 1) | 1));
longAtput((result + BaseHeaderSize) + (42 << ShiftForWord), ((desiredNumStackPages << 1) | 1));
longAtput((result + BaseHeaderSize) + (43 << ShiftForWord), ((GIV(edenBytes) << 1) | 1));
longAtput((result + BaseHeaderSize) + (44 << ShiftForWord), ((desiredEdenBytes << 1) | 1));
/* begin storePointerUnchecked:ofObject:withValue: */
- valuePointer3 = getCogCodeSize();
- longAtput((result + BaseHeaderSize) + (45 << ShiftForWord), valuePointer3);
+ valuePointer4 = getCogCodeSize();
+ longAtput((result + BaseHeaderSize) + (45 << ShiftForWord), valuePointer4);
/* begin storePointerUnchecked:ofObject:withValue: */
- valuePointer4 = getDesiredCogCodeSize();
- longAtput((result + BaseHeaderSize) + (46 << ShiftForWord), valuePointer4);
+ valuePointer5 = getDesiredCogCodeSize();
+ longAtput((result + BaseHeaderSize) + (46 << ShiftForWord), valuePointer5);
/* begin storePointerUnchecked:ofObject:withValue: */
- valuePointer5 = (((((((GIV(processHasThreadId)
+ valuePointer6 = (((((((GIV(processHasThreadId)
? 1
: 0)) + ((GIV(flagInterpretedMethods)
? 2
@@ -43354,10 +43468,10 @@
: 4))) + ((GIV(noThreadingOfGUIThread)
? 8
: 0))) << 1) | 1);
- longAtput((result + BaseHeaderSize) + (47 << ShiftForWord), valuePointer5);
+ longAtput((result + BaseHeaderSize) + (47 << ShiftForWord), valuePointer6);
/* begin storePointerUnchecked:ofObject:withValue: */
- valuePointer6 = (((ioGetMaxExtSemTableSize()) << 1) | 1);
- longAtput((result + BaseHeaderSize) + (48 << ShiftForWord), valuePointer6);
+ valuePointer7 = (((ioGetMaxExtSemTableSize()) << 1) | 1);
+ longAtput((result + BaseHeaderSize) + (48 << ShiftForWord), valuePointer7);
for (i = 49; i <= 54; i += 1) {
longAtput((result + BaseHeaderSize) + (i << ShiftForWord), GIV(nilObj));
}
@@ -43368,19 +43482,19 @@
longAtput((result + BaseHeaderSize) + (59 << ShiftForWord), ((GIV(statStackOverflow) << 1) | 1));
longAtput((result + BaseHeaderSize) + (60 << ShiftForWord), ((GIV(statStackPageDivorce) << 1) | 1));
/* begin storePointerUnchecked:ofObject:withValue: */
- valuePointer7 = getCodeCompactionCount();
- longAtput((result + BaseHeaderSize) + (61 << ShiftForWord), valuePointer7);
+ valuePointer8 = getCodeCompactionCount();
+ longAtput((result + BaseHeaderSize) + (61 << ShiftForWord), valuePointer8);
/* begin storePointerUnchecked:ofObject:withValue: */
- valuePointer8 = getCodeCompactionMSecs();
- longAtput((result + BaseHeaderSize) + (62 << ShiftForWord), valuePointer8);
+ valuePointer9 = getCodeCompactionMSecs();
+ longAtput((result + BaseHeaderSize) + (62 << ShiftForWord), valuePointer9);
/* begin storePointerUnchecked:ofObject:withValue: */
- valuePointer9 = (((numMethodsOfType(CMMethod)) << 1) | 1);
- longAtput((result + BaseHeaderSize) + (63 << ShiftForWord), valuePointer9);
+ valuePointer10 = (((numMethodsOfType(CMMethod)) << 1) | 1);
+ longAtput((result + BaseHeaderSize) + (63 << ShiftForWord), valuePointer10);
/* begin storePointerUnchecked:ofObject:withValue: */
- valuePointer10 = (MULTIPLEBYTECODESETS
+ valuePointer11 = (MULTIPLEBYTECODESETS
? GIV(trueObj)
: GIV(falseObj));
- longAtput((result + BaseHeaderSize) + (64 << ShiftForWord), valuePointer10);
+ longAtput((result + BaseHeaderSize) + (64 << ShiftForWord), valuePointer11);
for (i = 65; i <= 68; i += 1) {
/* reserved for more Cog-related info */
@@ -43388,11 +43502,11 @@
longAtput((result + BaseHeaderSize) + (i << ShiftForWord), GIV(nilObj));
}
/* begin storePointerUnchecked:ofObject:withValue: */
- valuePointer11 = (((VM_PROXY_MAJOR) << 1) | 1);
- longAtput((result + BaseHeaderSize) + (69 << ShiftForWord), valuePointer11);
+ valuePointer12 = (((VM_PROXY_MAJOR) << 1) | 1);
+ longAtput((result + BaseHeaderSize) + (69 << ShiftForWord), valuePointer12);
/* begin storePointerUnchecked:ofObject:withValue: */
- valuePointer12 = (((VM_PROXY_MINOR) << 1) | 1);
- longAtput((result + BaseHeaderSize) + (70 << ShiftForWord), valuePointer12);
+ valuePointer13 = (((VM_PROXY_MINOR) << 1) | 1);
+ longAtput((result + BaseHeaderSize) + (70 << ShiftForWord), valuePointer13);
assert(paramsArraySize == 71);
/* begin pop:thenPush: */
longAtput((sp = GIV(stackPointer) + ((1 - 1) * BytesPerWord)), result);
@@ -43417,7 +43531,7 @@
result = ((((youngStart()) - mem) << 1) | 1);
}
if (arg == 2) {
- result = (((GIV(freeStart) - mem) << 1) | 1);
+ result = ((((freeStart()) - mem) << 1) | 1);
}
if (arg == 3) {
result = (((GIV(endOfMemory) - mem) << 1) | 1);
@@ -44024,7 +44138,7 @@
/* begin oopFromChunk: */
chunk = startOfMemory();
oop = chunk + (headerTypeBytes[(longAt(chunk)) & TypeMask]);
- while (oop < GIV(freeStart)) {
+ while (oop < (freeStart())) {
if ((!(((longAt(oop)) & TypeMask) == HeaderTypeFree))
&& ((((((usqInt) (longAt(oop))) >> 12) & 31) == ClassMethodContextCompactIndex)
&& ((longAt((oop + BaseHeaderSize) + (MethodIndex << ShiftForWord))) == methodObj))) {
@@ -44045,7 +44159,7 @@
}
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) oop)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
@@ -44457,7 +44571,7 @@
/* begin oopFromChunk: */
chunk = startOfMemory();
oop = chunk + (headerTypeBytes[(longAt(chunk)) & TypeMask]);
- while ((((usqInt) oop)) < (((usqInt) GIV(freeStart)))) {
+ while (oopisLessThan(oop, freeStart())) {
classObj = (((ccIndex1 = (((usqInt) (longAt(oop))) >> 12) & 31)) == 0
? (longAt(oop - BaseHeaderSize)) & AllButTypeMask
: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex1 - 1) << ShiftForWord)));
@@ -44466,7 +44580,7 @@
printProcsOnList(oop);
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) oop)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
@@ -45310,7 +45424,7 @@
goto l2;
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) obj1)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(obj1, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(obj1)) & TypeMask) == HeaderTypeFree) {
@@ -45338,7 +45452,7 @@
}
/* begin accessibleObjectAfter: */
/* begin objectAfter: */
- if (!(asserta((((usqInt) oop)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
@@ -45358,7 +45472,7 @@
goto l1;
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) obj)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(obj, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(obj)) & TypeMask) == HeaderTypeFree) {
@@ -45719,7 +45833,7 @@
goto l2;
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) obj1)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(obj1, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(obj1)) & TypeMask) == HeaderTypeFree) {
@@ -45754,7 +45868,7 @@
}
/* begin accessibleObjectAfter: */
/* begin objectAfter: */
- if (!(asserta((((usqInt) oop)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
@@ -45774,7 +45888,7 @@
goto l1;
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) obj)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(obj, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(obj)) & TypeMask) == HeaderTypeFree) {
@@ -45841,7 +45955,7 @@
printOop(oop);
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) oop)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
@@ -45880,7 +45994,7 @@
null;
goto l1;
}
- if (!(((oop >= (startOfMemory())) && (oop <= GIV(freeStart))))) {
+ if (!(((oop >= (startOfMemory())) && (oop <= (freeStart()))))) {
printHex(oop);
print(" is not on the heap");
null;
@@ -46010,7 +46124,7 @@
if ((oop & 1)) {
printf("=%ld\n", (long)integerValueOf(oop)); return;
}
- if (!(((oop >= (startOfMemory())) && (oop <= GIV(freeStart))))) {
+ if (!(((oop >= (startOfMemory())) && (oop <= (freeStart()))))) {
print(" is not on the heap");
/* begin cr */
printf("\n");
@@ -46241,7 +46355,7 @@
goto l3;
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) obj1)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(obj1, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(obj1)) & TypeMask) == HeaderTypeFree) {
@@ -46323,7 +46437,7 @@
}
/* begin accessibleObjectAfter: */
/* begin objectAfter: */
- if (!(asserta((((usqInt) oop)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
@@ -46343,7 +46457,7 @@
goto l2;
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) obj)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(obj, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(obj)) & TypeMask) == HeaderTypeFree) {
@@ -46531,7 +46645,7 @@
if ((oop & 1)) {
return;
}
- if (!(((oop >= (startOfMemory())) && (oop <= GIV(freeStart))))) {
+ if (!(((oop >= (startOfMemory())) && (oop <= (freeStart()))))) {
return;
}
if ((oop & (BytesPerOop - 1)) != 0) {
@@ -46847,10 +46961,15 @@
return longAt((methodPointer + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
}
+
+/* Since methods may be updated while forwarding during become, make the
+ assert accomodate this.
+ */
+
void
rawHeaderOfput(sqInt methodOop, sqInt cogMethodOrMethodHeader)
{
- assert(isCompiledMethod(methodOop));
+ assert(isCompiledMethodHeader(headerWhileForwardingOf(methodOop)));
longAtput((methodOop + BaseHeaderSize) + (HeaderIndex << ShiftForWord), cogMethodOrMethodHeader);
}
@@ -47330,7 +47449,7 @@
void
reportMinimumUnusedHeadroom(void)
{
- printf("stack page bytes %ld available headroom %ld minimum unused headroom %ld\n", stackPageByteSize(), ((stackPageByteSize()) - (((512 < (((stackPageByteSize()) - ((IFrameSlots + 64) * BytesPerWord)) - (osCogStackPageHeadroom()))) ? 512 : (((stackPageByteSize()) - ((IFrameSlots + 64) * BytesPerWord)) - (osCogStackPageHeadroom()))))) - ((IFrameSlots + 64) * BytesPerWord), minimumUnusedHeadroom());
+ printf("stack page bytes %ld available headroom %ld minimum unused headroom %ld\n", ((long)(stackPageByteSize())), ((long)(((stackPageByteSize()) - (((512 < (((stackPageByteSize()) - ((IFrameSlots + 64) * BytesPerWord)) - (osCogStackPageHeadroom()))) ? 512 : (((stackPageByteSize()) - ((IFrameSlots + 64) * BytesPerWord)) - (osCogStackPageHeadroom()))))) - ((IFrameSlots + 64) * BytesPerWord))), ((long)(minimumUnusedHeadroom())));
}
@@ -47368,7 +47487,7 @@
longAtput(oop, (longAt(oop)) & AllButMarkBit);
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) oop)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
@@ -48661,7 +48780,7 @@
if ((oop & 1)) {
printf("=%ld\n", (long)integerValueOf(oop)); return;
}
- if (!(((oop >= (startOfMemory())) && (oop <= GIV(freeStart))))) {
+ if (!(((oop >= (startOfMemory())) && (oop <= (freeStart()))))) {
printHex(oop);
print(" is not on the heap");
/* begin cr */
@@ -49427,7 +49546,7 @@
/* begin oopFromChunk: */
chunk = startOfMemory();
oop2 = chunk + (headerTypeBytes[(longAt(chunk)) & TypeMask]);
- while ((((usqInt) oop2)) < (((usqInt) GIV(freeStart)))) {
+ while (oopisLessThan(oop2, freeStart())) {
if (!(((longAt(oop2)) & TypeMask) == HeaderTypeFree)) {
header = longAt(oop2);
@@ -49467,7 +49586,7 @@
}
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) oop2)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(oop2, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(oop2)) & TypeMask) == HeaderTypeFree) {
@@ -49497,7 +49616,7 @@
/* Assume all objects are below the start of the free block */
- dataSize = GIV(freeStart) - (startOfMemory());
+ dataSize = (freeStart()) - (startOfMemory());
if (!GIV(primFailCode)) {
/* Without contexts or stacks simulate
@@ -50703,7 +50822,7 @@
}
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) segOop)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(segOop, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(segOop)) & TypeMask) == HeaderTypeFree) {
@@ -51446,7 +51565,13 @@
return (((usqInt) header) >> 19) & 63;
}
+sqInt
+temporaryCountOfMethodHeader(sqInt header)
+{
+ return (((usqInt) header) >> 19) & 63;
+}
+
/* Do an incremental GC that tenures all surviving young objects to old
space.
*/
@@ -51749,7 +51874,7 @@
header = longAt(oop);
if ((header & MarkBit) == 0) {
/* begin objectAfter: */
- if (!(asserta((((usqInt) oop)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
@@ -52102,25 +52227,17 @@
if (!(asserta(((((aPage->baseFP)) + (frameStackedReceiverOffset((aPage->baseFP)))) + (2 * BytesPerWord)) == ((aPage->baseAddress))))) {
return 0;
}
- if (!(asserta(((senderContextOrNil & 3) == 0)
- && (((((usqInt)senderContextOrNil)) >= (startOfMemory()))
- && (((((usqInt)senderContextOrNil)) < GIV(freeStart))
- && (((longAt(senderContextOrNil)) & TypeMask) != HeaderTypeGC)))))) {
+ if (!(asserta(addressCouldBeObj(senderContextOrNil)))) {
return 0;
}
- if (!(asserta(((savedThisContext & 3) == 0)
- && (((((usqInt)savedThisContext)) >= (startOfMemory()))
- && (((((usqInt)savedThisContext)) < GIV(freeStart))
- && (((longAt(savedThisContext)) & TypeMask) != HeaderTypeGC)))))) {
+ if (!(asserta(addressCouldBeObj(savedThisContext)))) {
return 0;
}
- if (!(asserta((senderContextOrNil == GIV(nilObj))
- || (((senderContextOrNil & 1) == 0)
- && (((((usqInt) (longAt(senderContextOrNil))) >> 12) & 31) == ClassMethodContextCompactIndex))))) {
+ if (!(asserta((senderContextOrNil == (nilObject()))
+ || (isContext(senderContextOrNil))))) {
return 0;
}
- if (!(asserta(((savedThisContext & 1) == 0)
- && (((((usqInt) (longAt(savedThisContext))) >> 12) & 31) == ClassMethodContextCompactIndex)))) {
+ if (!(asserta(isContext(savedThisContext)))) {
return 0;
}
if (!(asserta((frameCallerContext((aPage->baseFP))) == senderContextOrNil))) {
@@ -52160,7 +52277,7 @@
}
}
/* begin objectAfter: */
- if (!(asserta((((usqInt) oop)) < (((usqInt) GIV(freeStart)))))) {
+ if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
error("no objects after the end of memory");
}
if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
@@ -52234,7 +52351,7 @@
/* begin oopFromChunk: */
chunk = startOfMemory();
oop = chunk + (headerTypeBytes[(longAt(chunk)) & TypeMask]);
- while (oop < GIV(freeStart)) {
+ while (oop < (freeStart())) {
if ((!(((longAt(oop)) & TypeMask) == HeaderTypeFree))
@@ Diff output truncated at 50000 characters. @@
More information about the Vm-dev
mailing list