[Vm-dev] [commit][2696] CogVM sources as per VMMaker.oscog-eem.269.
commits at squeakvm.org
commits at squeakvm.org
Thu Feb 28 23:46:27 UTC 2013
Revision: 2696
Author: eliot
Date: 2013-02-28 15:46:24 -0800 (Thu, 28 Feb 2013)
Log Message:
-----------
CogVM sources as per VMMaker.oscog-eem.269.
Fix bug in primitiveClone/cloneContext: that causes the copy to be a word short.
Use isPointerNonInt: and isContextNonInt: in a few places.
Implement unknownBytecode. Send unknownBytecode to the activeContext on
unknown bytecode if the selector is in the specialObjectsArray.
Fix page size bug in platforms/Cross/vm/sqHeapMap.c.
Add a trap command to scripts/versionInfoPlist and the mac mvm's to allow ^C.
More description for unix builds on 64-bit linux.
Have the upload script mark the upload directory and contents as read-only.
Modified Paths:
--------------
branches/Cog/macbuild/mvm
branches/Cog/nscogbuild/macbuild/mvm
branches/Cog/nscogbuild/unixbuild/HowToBuild
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/platforms/Cross/vm/sqHeapMap.c
branches/Cog/scripts/uploadvms
branches/Cog/scripts/versionInfoPlist
branches/Cog/src/vm/cointerp.c
branches/Cog/src/vm/cointerp.h
branches/Cog/src/vm/cointerpmt.c
branches/Cog/src/vm/cointerpmt.h
branches/Cog/src/vm/gcc3x-cointerp.c
branches/Cog/src/vm/gcc3x-cointerpmt.c
branches/Cog/src/vm/interp.h
branches/Cog/src/vm/vmCallback.h
branches/Cog/unixbuild/HowToBuild
Property Changed:
----------------
branches/Cog/nscogbuild/cygwinbuild/installer/
branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
Modified: branches/Cog/macbuild/mvm
===================================================================
--- branches/Cog/macbuild/mvm 2013-02-21 01:35:22 UTC (rev 2695)
+++ branches/Cog/macbuild/mvm 2013-02-28 23:46:24 UTC (rev 2696)
@@ -25,8 +25,9 @@
done
if [ -n "$H" -o -z "$D$A$F$DT$AT$FT" ]; then
echo usage: $0 -A \| -AS -AT \| -d -a -f -dt -at -ft
- exit
+ exit 1
fi
+trap 'exit 2' HUP INT PIPE TERM 0
test -n "$D" && (makevm $C -d 2>&1 | tee $D;grep "BUILD .*ED" $D)
test -n "$A" && (makevm $C -a 2>&1 | tee $A;grep "BUILD .*ED" $A)
test -n "$F" && (makevm $C -s 2>&1 | tee $F;grep "BUILD .*ED" $F)
Property changes on: branches/Cog/nscogbuild/cygwinbuild/installer
___________________________________________________________________
Modified: svn:ignore
- Binary
Icon
files.???
nsvm.*
*.idt
*.msi
*.rtf
*.sources
+ Binary
Control.idt.orig
Icon
files.???
nsvm.*
*.idt
*.msi
*.rtf
*.sources
Modified: branches/Cog/nscogbuild/macbuild/mvm
===================================================================
--- branches/Cog/nscogbuild/macbuild/mvm 2013-02-21 01:35:22 UTC (rev 2695)
+++ branches/Cog/nscogbuild/macbuild/mvm 2013-02-28 23:46:24 UTC (rev 2696)
@@ -15,8 +15,9 @@
done
if [ -n "$H" -o -z "$D$A$F" ]; then
echo usage: $0 -A \| -AS \| -d -a -f
- exit
+ exit 1
fi
+trap 'exit 2' HUP INT PIPE TERM 0
test -n "$D" && (makevm -d 2>&1 | tee $D;grep "BUILD .*ED" $D)
test -n "$A" && (makevm -a 2>&1 | tee $A;grep "BUILD .*ED" $A)
test -n "$F" && (makevm -s 2>&1 | tee $F;grep "BUILD .*ED" $F)
Modified: branches/Cog/nscogbuild/unixbuild/HowToBuild
===================================================================
--- branches/Cog/nscogbuild/unixbuild/HowToBuild 2013-02-21 01:35:22 UTC (rev 2695)
+++ branches/Cog/nscogbuild/unixbuild/HowToBuild 2013-02-28 23:46:24 UTC (rev 2696)
@@ -50,9 +50,20 @@
provided by the ia32-libs package.
+3c. (see Compiling in 32-bit mode on a 64-bit linux below)
+If you're building the VM on a 64-bit OS, you'll need a compiler which can
+compile and link to 32-bit binaries. On most Linuxes the gcc-multilib package
+provides the 32-bit compiler and the ia32-libs provides the 32-bit libraries.
+You'll also have to add the -m32 switch to all gcc & g++ invocations. The
+easiest way to do this is to add CC="gcc -m32" & CXX="g++ -m32" to the configure
+script:
+ ../../platforms/unix/config/configure CC="gcc -m32" CXX="g++ -m32" --without-npsqueak CFLAGS="-g -O2 -msse2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=0" LIBS=-lpthread
+To run a 32-bit VM on a 64-bit OS, you'll also need the 32-bit libraries
+provided by the ia32-libs package.
+
Compiling in 32-bit mode on a 64-bit linux
-------------------------------
-Follow 3d. above. Also note that according to Paul DeBruicker the following
+Follow 3c. above. Also note that according to Paul DeBruicker the following
packages need to be installed to compile in 32-bt mode on 64-bit ubuntu. YMMV.
build-essential
@@ -60,7 +71,11 @@
gcc-multilib
g++multilib
+In addition phil at highoctane.be installed libc6dev-i386.
+This in itself may not be enough, but persistence will pay off. See for example
+http://permalink.gmane.org/gmane.comp.lang.smalltalk.pharo.devel/75198.
+
Testing an external plugin has completely linked
-------------------------------
You may find that an external plugin compiles and links but does not load.
Modified: branches/Cog/nscogsrc/vm/cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.c 2013-02-21 01:35:22 UTC (rev 2695)
+++ branches/Cog/nscogsrc/vm/cointerp.c 2013-02-28 23:46:24 UTC (rev 2696)
@@ -1,9 +1,9 @@
/* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.266 uuid: ee4e0b6e-91a8-432c-847b-132d682bc79b
+ CCodeGeneratorGlobalStructure VMMaker.oscog-eem.269 uuid: 49173296-5145-4de1-a2d9-defc8579acc6
from
- CoInterpreter VMMaker.oscog-eem.266 uuid: ee4e0b6e-91a8-432c-847b-132d682bc79b
+ CoInterpreter VMMaker.oscog-eem.269 uuid: 49173296-5145-4de1-a2d9-defc8579acc6
*/
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.266 uuid: ee4e0b6e-91a8-432c-847b-132d682bc79b " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.269 uuid: 49173296-5145-4de1-a2d9-defc8579acc6 " __DATE__ ;
char *__interpBuildInfo = __buildInfo;
@@ -291,6 +291,7 @@
#define SelectorMustBeBoolean 25
#define SelectorRunWithIn 49
#define SelectorStart 2
+#define SelectorUnknownBytecode 57
#define SenderIndex 0
#define ShiftForWord 2
#define Size4Bit 0
@@ -574,6 +575,7 @@
static sqInt getShortFromFileswap(sqImageFile aFile, sqInt swapFlag);
sqInt * getStackPointer(void);
sqInt getThisSessionID(void);
+static sqInt goodContextSize(sqInt oop);
static sqInt handleMNUInMachineCodeToclassForMessage(sqInt selectorIndex, sqInt rcvr, sqInt classForMessage);
static void handleStackOverflow(void);
static sqInt handleStackOverflowOrEventAllowContextSwitch(sqInt mayContextSwitch);
@@ -1048,6 +1050,7 @@
void printStackPagesInUse(void);
static void printStackPage(StackPage *page);
static void printStringOf(sqInt oop);
+void printWronglySizedContexts(sqInt printContexts);
void print(char *s);
void pushBool(sqInt trueOrFalse);
static sqInt pushedReceiverOrClosureOfFrame(char *theFP);
@@ -1256,6 +1259,7 @@
_iss sqInt statSweepCount;
_iss usqInt compEnd;
_iss sqInt flagInterpretedMethods;
+_iss sqInt heapMap;
_iss sqInt metaclassSizeBits;
_iss sqInt pendingFinalizationSignals;
_iss sqInt shrinkThreshold;
@@ -1945,7 +1949,7 @@
0 };
static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
static usqInt heapBase;
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.266";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_*_VMMaker.oscog-eem.269";
sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
volatile int sendTrace;
@@ -11614,17 +11618,42 @@
break;
case 478: /*222*/
case 479: /*223*/
- case 501: /*245*/
- case 502: /*246*/
- case 503: /*247*/
- case 504: /*248*/
- case 510: /*254*/
- case 511: /*255*/
/* unknownBytecode */
{
VM_LABEL(0unknownBytecode);
- error("Unknown bytecode");
+ /* goto respondToUnknownBytecode */
}
+
+ respondToUnknownBytecode:
+ /* respondToUnknownBytecode */
+ {
+ sqInt ourContext;
+ sqInt unknownBytecodeSelector;
+
+ VM_LABEL(0respondToUnknownBytecode);
+ unknownBytecodeSelector = (SelectorUnknownBytecode < (lengthOf(GIV(specialObjectsOop)))
+ ? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SelectorUnknownBytecode << ShiftForWord))
+ : 0);
+ if (unknownBytecodeSelector == null) {
+ error("Unknown bytecode");
+ }
+ /* begin ensureFrameIsMarried:SP: */
+ VM_LABEL(7ensureFrameIsMarriedSP);
+ if (((((usqInt)(longAt(localFP + FoxMethod)))) < (startOfMemory())
+ ? ((longAt(localFP + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
+ : (byteAt((localFP + FoxIFrameFlags) + 2)) != 0)) {
+ assert(isContext(frameContext(localFP)));
+ ourContext = longAt(localFP + FoxThisContext);
+ goto l283;
+ }
+ ourContext = marryFrameSP(localFP, localSP);
+ l283: /* end ensureFrameIsMarried:SP: */;
+ /* begin internalPush: */
+ longAtPointerput((localSP -= BytesPerOop), ourContext);
+ GIV(messageSelector) = unknownBytecodeSelector;
+ GIV(argumentCount) = 0;
+ goto commonSend;
+ }
break;
case 480: /*224*/
/* extABytecode */
@@ -11757,7 +11786,7 @@
goto l261;
}
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(7ensureFrameIsMarriedSP);
+ VM_LABEL(8ensureFrameIsMarriedSP);
/* begin frameCallerStackPointer: */
assert(!(isBaseFrame(spouseFP)));
theSP = (spouseFP + (frameStackedReceiverOffsetNumArgs(((((usqInt)(longAt(spouseFP + FoxMethod)))) < (startOfMemory())
@@ -12487,6 +12516,18 @@
l265: /* end jumplfFalseBy: */;
}
break;
+ case 501: /*245*/
+ case 502: /*246*/
+ case 503: /*247*/
+ case 504: /*248*/
+ case 510: /*254*/
+ case 511: /*255*/
+ /* unknownBytecode */
+ {
+ VM_LABEL(1unknownBytecode);
+ goto respondToUnknownBytecode;
+ }
+ break;
case 505: /*249*/
/* callPrimitiveBytecode */
{
@@ -12517,7 +12558,7 @@
/* begin pushClosureNumArgs:copiedValues:blockSize: */
VM_LABEL(1pushClosureNumArgscopiedValuesblockSize);
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(8ensureFrameIsMarriedSP);
+ VM_LABEL(9ensureFrameIsMarriedSP);
if (((((usqInt)(longAt(localFP + FoxMethod)))) < (startOfMemory())
? ((longAt(localFP + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
: (byteAt((localFP + FoxIFrameFlags) + 2)) != 0)) {
@@ -14871,7 +14912,7 @@
/* error: can't find home on chain; cannot return */
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(9ensureFrameIsMarriedSP);
+ VM_LABEL(10ensureFrameIsMarriedSP);
if (((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory())
? ((longAt(GIV(framePointer) + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
: (byteAt((GIV(framePointer) + FoxIFrameFlags) + 2)) != 0)) {
@@ -14897,7 +14938,7 @@
/* begin externalAboutToReturn:through: */
VM_LABEL(0externalAboutToReturnthrough);
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(10ensureFrameIsMarriedSP);
+ VM_LABEL(11ensureFrameIsMarriedSP);
if (((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory())
? ((longAt(GIV(framePointer) + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
: (byteAt((GIV(framePointer) + FoxIFrameFlags) + 2)) != 0)) {
@@ -14970,7 +15011,7 @@
/* error: home's sender is dead; cannot return */
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(11ensureFrameIsMarriedSP);
+ VM_LABEL(12ensureFrameIsMarriedSP);
if (((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory())
? ((longAt(GIV(framePointer) + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
: (byteAt((GIV(framePointer) + FoxIFrameFlags) + 2)) != 0)) {
@@ -15687,7 +15728,7 @@
return PrimErrInappropriate;
}
if (argFormat < 2) {
- if ((argClassInstByteSize - BaseHeaderSize) != (byteSizeOf(rcvr))) {
+ if ((argClassInstByteSize - BaseHeaderSize) != (byteLengthOf(rcvr))) {
return PrimErrBadReceiver;
}
}
@@ -15696,7 +15737,7 @@
/* For indexable plus fixed fields the receiver must be at least big enough. */
- if ((argClassInstByteSize - BaseHeaderSize) > (byteSizeOf(rcvr))) {
+ if ((argClassInstByteSize - BaseHeaderSize) > (byteLengthOf(rcvr))) {
return PrimErrBadReceiver;
}
}
@@ -16136,6 +16177,7 @@
printHex(fieldOop);
/* begin cr */
printf("\n");
+ /* begin eek */
ok = 0;
}
}
@@ -16191,6 +16233,7 @@
printHex(fieldOop);
/* begin cr */
printf("\n");
+ /* begin eek */
ok = 0;
}
else {
@@ -16203,6 +16246,7 @@
printHex(fieldOop);
/* begin cr */
printf("\n");
+ /* begin eek */
ok = 0;
}
}
@@ -16236,6 +16280,7 @@
printHex(obj);
/* begin cr */
printf("\n");
+ /* begin eek */
ok = 0;
}
else {
@@ -16246,6 +16291,7 @@
printHex(obj);
/* begin cr */
printf("\n");
+ /* begin eek */
ok = 0;
}
else {
@@ -16257,6 +16303,7 @@
printHex(obj);
/* begin cr */
printf("\n");
+ /* begin eek */
ok = 0;
}
}
@@ -16271,6 +16318,7 @@
printHex(obj);
/* begin cr */
printf("\n");
+ /* begin eek */
ok = 0;
}
else {
@@ -16281,6 +16329,7 @@
printHex(obj);
/* begin cr */
printf("\n");
+ /* begin eek */
ok = 0;
}
}
@@ -16294,6 +16343,7 @@
printHex(obj);
/* begin cr */
printf("\n");
+ /* begin eek */
ok = 0;
}
else {
@@ -16304,6 +16354,7 @@
printHex(obj);
/* begin cr */
printf("\n");
+ /* begin eek */
ok = 0;
}
}
@@ -16487,8 +16538,7 @@
: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)));
hasYoung = ((oop1 & 1) == 0)
&& ((((usqInt) oop1)) >= (((usqInt) GIV(youngStart))));
- if (!((((oop & 1) == 0)
- && (((((usqInt) (longAt(oop))) >> 8) & 15) <= 4))
+ if (!((((((usqInt) (longAt(oop))) >> 8) & 15) <= 4)
|| (((((usqInt) (longAt(oop))) >> 8) & 15) >= 12))) {
return 1;
}
@@ -16849,8 +16899,7 @@
printf("\n");
return 0;
}
- if (!((((objClass & 1) == 0)
- && (((((usqInt) (longAt(objClass))) >> 8) & 15) <= 4))
+ if (!((((((usqInt) (longAt(objClass))) >> 8) & 15) <= 4)
&& ((lengthOf(objClass)) >= 3))) {
print("obj ");
printHex(obj);
@@ -17195,12 +17244,14 @@
/* Perform an integrity/leak check using the heapMap. Set a bit at each
+ object's header. */
+/* Perform an integrity/leak check using the heapMap. Set a bit at each
object's header.
Override to set a bit at each Cog method */
static void
clearLeakMapAndMapAccessibleObjects(void)
-{
+{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt chunk;
sqInt header;
usqInt nextHeader;
@@ -17211,7 +17262,7 @@
/* begin oopFromChunk: */
chunk = startOfMemory();
obj = ((sqInt) (chunk + (headerTypeBytes[(longAt(chunk)) & TypeMask])));
- while (obj < GIV(freeStart)) {
+ while ((((usqInt) obj)) < (((usqInt) GIV(freeStart)))) {
if (((longAt(obj)) & TypeMask) == HeaderTypeFree) {
sz = (longAt(obj)) & AllButTypeMask;
}
@@ -18111,7 +18162,7 @@
assert(isMachineCodeFrame(GIV(framePointer)));
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(12ensureFrameIsMarriedSP);
+ VM_LABEL(13ensureFrameIsMarriedSP);
if (((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory())
? ((longAt(GIV(framePointer) + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
: (byteAt((GIV(framePointer) + FoxIFrameFlags) + 2)) != 0)) {
@@ -18436,7 +18487,7 @@
(GIV(stackPage)->headSP = GIV(stackPointer));
assert(pageListIsWellFormed());
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(13ensureFrameIsMarriedSP);
+ VM_LABEL(14ensureFrameIsMarriedSP);
if (((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory())
? ((longAt(GIV(framePointer) + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
: (byteAt((GIV(framePointer) + FoxIFrameFlags) + 2)) != 0)) {
@@ -18480,7 +18531,7 @@
if (((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory()))
&& (cogMethod == (mframeHomeMethod(theFP)))) {
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(14ensureFrameIsMarriedSP);
+ VM_LABEL(15ensureFrameIsMarriedSP);
if (((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
? ((longAt(theFP + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
: (byteAt((theFP + FoxIFrameFlags) + 2)) != 0)) {
@@ -18535,7 +18586,7 @@
calleeContext = null;
while (1) {
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(15ensureFrameIsMarriedSP);
+ VM_LABEL(16ensureFrameIsMarriedSP);
if (((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
? ((longAt(theFP + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
: (byteAt((theFP + FoxIFrameFlags) + 2)) != 0)) {
@@ -19229,12 +19280,14 @@
usqInt newFreeStart;
sqInt newObj;
+ assert((sizeInBytes == SmallContextSize)
+ || (sizeInBytes == LargeContextSize));
+ assert(sizeInBytes <= SizeMask);
hash = ((usqInt) GIV(freeStart)) >> ShiftForWord;
- header1 = ((hash & HashMaskUnshifted) << HashBitsOffset) | (((ClassMethodContextCompactIndex << 12) + (3 << 8)) + ((CtxtTempFrameStart + (((sqInt) BaseHeaderSize >> 2))) << 2));
- assert(sizeInBytes <= SizeMask);
+ header1 = ((hash & HashMaskUnshifted) << HashBitsOffset) | ((ClassMethodContextCompactIndex << 12) + (3 << 8));
assert((header1 & CompactClassMask) > 0);
- header1 += sizeInBytes - (header1 & SizeMask);
- flag("Dan");
+ assert((header1 & SizeMask) == 0);
+ header1 += sizeInBytes;
/* begin eeAllocate:headerSize:h1:h2:h3: */
/* begin allocateInterpreterChunk: */
newChunk = GIV(freeStart);
@@ -19463,7 +19516,7 @@
return callerContextOrNil;
}
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(16ensureFrameIsMarriedSP);
+ VM_LABEL(17ensureFrameIsMarriedSP);
/* begin frameCallerStackPointer: */
assert(!(isBaseFrame(theFP)));
theSP = (theFP + (frameStackedReceiverOffsetNumArgs(((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
@@ -20109,7 +20162,7 @@
goto l1;
}
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(17ensureFrameIsMarriedSP);
+ VM_LABEL(18ensureFrameIsMarriedSP);
/* begin frameCallerStackPointer: */
assert(!(isBaseFrame(theFP)));
theSP1 = (theFP + (frameStackedReceiverOffsetNumArgs(((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
@@ -20315,7 +20368,7 @@
return callerContextOrNil;
}
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(18ensureFrameIsMarriedSP);
+ VM_LABEL(19ensureFrameIsMarriedSP);
/* begin frameCallerStackPointer: */
assert(!(isBaseFrame(spouseFP)));
theSP = (spouseFP + (frameStackedReceiverOffsetNumArgs(((((usqInt)(longAt(spouseFP + FoxMethod)))) < (startOfMemory())
@@ -21026,7 +21079,7 @@
: byteAt((theFPAbove + FoxIFrameFlags) + 1))))) + BytesPerWord;
}
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(19ensureFrameIsMarriedSP);
+ VM_LABEL(20ensureFrameIsMarriedSP);
if (((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
? ((longAt(theFP + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
: (byteAt((theFP + FoxIFrameFlags) + 2)) != 0)) {
@@ -22348,7 +22401,14 @@
return GIV(globalSessionID);
}
+static sqInt
+goodContextSize(sqInt oop)
+{
+ return ((byteLengthOf(oop)) == (SmallContextSize - BaseHeaderSize))
+ || ((byteLengthOf(oop)) == (LargeContextSize - BaseHeaderSize));
+}
+
/* A message send from either an open PIC or an unlinked send has
not been understood. Execute the relevant resulting MNU method. */
@@ -22528,7 +22588,7 @@
goto l1;
}
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(20ensureFrameIsMarriedSP);
+ VM_LABEL(21ensureFrameIsMarriedSP);
/* begin frameCallerStackPointer: */
assert(!(isBaseFrame(theFP)));
theSP = (theFP + (frameStackedReceiverOffsetNumArgs(((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
@@ -25640,7 +25700,7 @@
fmt = (((usqInt) (longAt(oop))) >> 8) & 15;
if (fmt > 4) {
print(" nbytes ");
- printNum(byteSizeOf(oop));
+ printNum(byteLengthOf(oop));
}
/* begin printHeaderTypeOf: */
@@ -25817,8 +25877,7 @@
oop = null;
l3: /* end firstAccessibleObject */;
while (!(oop == null)) {
- if ((((oop & 1) == 0)
- && (((((usqInt) (longAt(oop))) >> 8) & 15) <= 4))
+ if ((((((usqInt) (longAt(oop))) >> 8) & 15) <= 4)
|| (((((usqInt) (longAt(oop))) >> 8) & 15) >= 12)) {
if (((((usqInt) (longAt(oop))) >> 8) & 15) >= 12) {
/* begin literalCountOfHeader: */
@@ -25833,8 +25892,7 @@
: (((usqInt) headerPointer) >> 10) & 255);
}
else {
- if (((oop & 1) == 0)
- && (((((usqInt) (longAt(oop))) >> 12) & 31) == ClassMethodContextCompactIndex)) {
+ if (((((usqInt) (longAt(oop))) >> 12) & 31) == ClassMethodContextCompactIndex) {
i = CtxtTempFrameStart + (fetchStackPointerOf(oop));
}
else {
@@ -26404,6 +26462,7 @@
sqInt valuePointer1;
assert(isSingleContext(aContext));
+ assert(goodContextSize(aContext));
theIP = longAt((aContext + BaseHeaderSize) + (InstructionPointerIndex << ShiftForWord));
assert((((sqInt) HasBeenReturnedFromMCPC)) < 0);
theIP = ((theIP & 1)
@@ -28006,8 +28065,8 @@
}
-/* Return one of the objects in the SpecialObjectsArray, if in range,
- otherwise ansser nil
+/* Answer one of the objects in the SpecialObjectsArray, if in range,
+ otherwise answer nil.
*/
sqInt
@@ -28442,7 +28501,7 @@
assert(frameHasContext(callerFP));
assert(isContext(frameContext(callerFP)));
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(21ensureFrameIsMarriedSP);
+ VM_LABEL(22ensureFrameIsMarriedSP);
theSP = theFP + (((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
? FoxMFReceiver
: FoxIFReceiver));
@@ -29224,8 +29283,7 @@
error("class oop is not ok");
return 0;
}
- if (!((((oopClass & 1) == 0)
- && (((((usqInt) (longAt(oopClass))) >> 8) & 15) <= 4))
+ if (!((((((usqInt) (longAt(oopClass))) >> 8) & 15) <= 4)
&& ((lengthOf(oopClass)) >= 3))) {
error("a class (behavior) must be a pointers object of size >= 3");
return 0;
@@ -31255,6 +31313,7 @@
char *sp;
sqInt sp1;
char *spouseFP;
+ sqInt sz;
sqInt value;
sqInt valuePointer;
sqInt valuePointer1;
@@ -31268,7 +31327,8 @@
if (((((usqInt) objHeader) >> 12) & 31) == ClassMethodContextCompactIndex) {
/* begin cloneContext: */
VM_LABEL(0cloneContext);
- cloned = eeInstantiateMethodContextByteSize(byteSizeOf(rcvr));
+ sz = (byteLengthOf(rcvr)) + BaseHeaderSize;
+ cloned = eeInstantiateMethodContextByteSize(sz);
if (cloned != 0) {
for (i = 0; i <= StackPointerIndex; i += 1) {
/* begin storePointerUnchecked:ofObject:withValue: */
@@ -44093,7 +44153,7 @@
(GIV(stackPage)->headSP = GIV(stackPointer));
assert(pageListIsWellFormed());
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(22ensureFrameIsMarriedSP);
+ VM_LABEL(23ensureFrameIsMarriedSP);
if (((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory())
? ((longAt(GIV(framePointer) + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
: (byteAt((GIV(framePointer) + FoxIFrameFlags) + 2)) != 0)) {
@@ -46158,7 +46218,7 @@
fmt = (((usqInt) (longAt(oop))) >> 8) & 15;
if (fmt > 4) {
print(" nbytes ");
- printNum(byteSizeOf(oop));
+ printNum(byteLengthOf(oop));
}
/* begin cr */
printf("\n");
@@ -46182,7 +46242,7 @@
}
if (((oop & 1) == 0)
&& (((((usqInt) (longAt(oop))) >> 8) & 15) == 6)) {
- lastIndex = ((64 < (((sqInt) (byteSizeOf(oop)) >> 2))) ? 64 : (((sqInt) (byteSizeOf(oop)) >> 2)));
+ lastIndex = ((64 < (((sqInt) (byteLengthOf(oop)) >> 2))) ? 64 : (((sqInt) (byteLengthOf(oop)) >> 2)));
if (lastIndex > 0) {
for (index = 1; index <= lastIndex; index += 1) {
/* begin space */
@@ -46374,8 +46434,7 @@
oop = null;
l3: /* end firstAccessibleObject */;
while (!(oop == null)) {
- if ((((oop & 1) == 0)
- && (((((usqInt) (longAt(oop))) >> 8) & 15) <= 4))
+ if ((((((usqInt) (longAt(oop))) >> 8) & 15) <= 4)
|| (((((usqInt) (longAt(oop))) >> 8) & 15) >= 12)) {
if (((((usqInt) (longAt(oop))) >> 8) & 15) >= 12) {
/* begin literalCountOfHeader: */
@@ -46390,8 +46449,7 @@
: (((usqInt) headerPointer) >> 10) & 255);
}
else {
- if (((oop & 1) == 0)
- && (((((usqInt) (longAt(oop))) >> 12) & 31) == ClassMethodContextCompactIndex)) {
+ if (((((usqInt) (longAt(oop))) >> 12) & 31) == ClassMethodContextCompactIndex) {
i = CtxtTempFrameStart + (fetchStackPointerOf(oop));
}
else {
@@ -46679,6 +46737,110 @@
}
+/* Scan the heap printing the oops of any and all contexts whose size is not
+ either SmallContextSize or LargeContextSize
+ */
+
+void
+printWronglySizedContexts(sqInt printContexts)
+{ DECL_MAYBE_SQ_GLOBAL_STRUCT
+ sqInt chunk;
+ sqInt header;
+ sqInt header1;
+ sqInt header2;
+ sqInt obj;
+ sqInt obj1;
+ sqInt oop;
+ sqInt sz;
+ sqInt sz1;
+ sqInt sz2;
+
+ /* begin firstAccessibleObject */
+ /* begin oopFromChunk: */
+ chunk = startOfMemory();
+ obj1 = chunk + (headerTypeBytes[(longAt(chunk)) & TypeMask]);
+ while ((((usqInt) obj1)) < (((usqInt) GIV(freeStart)))) {
+ if (!(((longAt(obj1)) & TypeMask) == HeaderTypeFree)) {
+ oop = obj1;
+ goto l2;
+ }
+ /* begin objectAfter: */
+ if (!(asserta(oopisLessThan(obj1, GIV(freeStart))))) {
+ error("no objects after the end of memory");
+ }
+ if (((longAt(obj1)) & TypeMask) == HeaderTypeFree) {
+ sz = (longAt(obj1)) & AllButTypeMask;
+ }
+ else {
+ /* begin sizeBitsOf: */
+ header = longAt(obj1);
+ sz = ((header & TypeMask) == HeaderTypeSizeAndClass
+ ? (longAt(obj1 - (BytesPerWord * 2))) & LongSizeMask
+ : header & SizeMask);
+ }
+ obj1 = (obj1 + sz) + (headerTypeBytes[(longAt(obj1 + sz)) & TypeMask]);
+ }
+ error("heap is empty");
+ oop = null;
+l2: /* end firstAccessibleObject */;
+ while (!(oop == null)) {
+ if ((((((usqInt) (longAt(oop))) >> 12) & 31) == ClassMethodContextCompactIndex)
+ && (((byteLengthOf(oop)) != (SmallContextSize - BaseHeaderSize))
+ && ((byteLengthOf(oop)) != (LargeContextSize - BaseHeaderSize)))) {
+ printHex(oop);
+ /* begin space */
+ /* begin printChar: */
+ putchar(' ');
+ printNum(byteLengthOf(oop));
+ /* begin cr */
+ printf("\n");
+ if (printContexts) {
+ printContext(oop);
+ }
+ }
+ /* begin accessibleObjectAfter: */
+ /* begin objectAfter: */
+ if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
+ error("no objects after the end of memory");
+ }
+ if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
+ sz2 = (longAt(oop)) & AllButTypeMask;
+ }
+ else {
+ /* begin sizeBitsOf: */
+ header2 = longAt(oop);
+ sz2 = ((header2 & TypeMask) == HeaderTypeSizeAndClass
+ ? (longAt(oop - (BytesPerWord * 2))) & LongSizeMask
+ : header2 & SizeMask);
+ }
+ obj = (oop + sz2) + (headerTypeBytes[(longAt(oop + sz2)) & TypeMask]);
+ while ((((usqInt) obj)) < (((usqInt) GIV(freeStart)))) {
+ if (!(((longAt(obj)) & TypeMask) == HeaderTypeFree)) {
+ oop = obj;
+ goto l1;
+ }
+ /* begin objectAfter: */
+ if (!(asserta(oopisLessThan(obj, GIV(freeStart))))) {
+ error("no objects after the end of memory");
+ }
+ if (((longAt(obj)) & TypeMask) == HeaderTypeFree) {
+ sz1 = (longAt(obj)) & AllButTypeMask;
+ }
+ else {
+ /* begin sizeBitsOf: */
+ header1 = longAt(obj);
+ sz1 = ((header1 & TypeMask) == HeaderTypeSizeAndClass
+ ? (longAt(obj - (BytesPerWord * 2))) & LongSizeMask
+ : header1 & SizeMask);
+ }
+ obj = (obj + sz1) + (headerTypeBytes[(longAt(obj + sz1)) & TypeMask]);
+ }
+ oop = null;
+ l1: /* end accessibleObjectAfter: */;
+ }
+}
+
+
/* For testing in Smalltalk, this method should be overridden in a subclass. */
void
@@ -50977,7 +51139,7 @@
goto l1;
}
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(23ensureFrameIsMarriedSP);
+ VM_LABEL(24ensureFrameIsMarriedSP);
/* begin frameCallerStackPointer: */
assert(!(isBaseFrame(theFP)));
theSP = (theFP + (frameStackedReceiverOffsetNumArgs(((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
@@ -51645,7 +51807,7 @@
sched = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SchedulerAssociation << ShiftForWord))) + BaseHeaderSize) + (ValueIndex << ShiftForWord));
oldProc = longAt((sched + BaseHeaderSize) + (ActiveProcessIndex << ShiftForWord));
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(24ensureFrameIsMarriedSP);
+ VM_LABEL(25ensureFrameIsMarriedSP);
theFP = GIV(framePointer);
theSP = GIV(stackPointer);
if (((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
Modified: branches/Cog/nscogsrc/vm/cointerp.h
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.h 2013-02-21 01:35:22 UTC (rev 2695)
+++ branches/Cog/nscogsrc/vm/cointerp.h 2013-02-28 23:46:24 UTC (rev 2696)
@@ -1,5 +1,5 @@
/* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.266 uuid: ee4e0b6e-91a8-432c-847b-132d682bc79b
+ CCodeGeneratorGlobalStructure VMMaker.oscog-eem.269 uuid: 49173296-5145-4de1-a2d9-defc8579acc6
*/
@@ -166,6 +166,7 @@
void printProcessStack(sqInt aProcess);
void printProcsOnList(sqInt procList);
void printReferencesTo(sqInt anOop);
+void printWronglySizedContexts(sqInt printContexts);
void print(char *s);
void pushRemappableOop(sqInt oop);
sqInt quickPrimitiveConstantFor(sqInt aQuickPrimitiveIndex);
Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/gcc3x-cointerp.c 2013-02-21 01:35:22 UTC (rev 2695)
+++ branches/Cog/nscogsrc/vm/gcc3x-cointerp.c 2013-02-28 23:46:24 UTC (rev 2696)
@@ -2,11 +2,11 @@
/* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.266 uuid: ee4e0b6e-91a8-432c-847b-132d682bc79b
+ CCodeGeneratorGlobalStructure VMMaker.oscog-eem.269 uuid: 49173296-5145-4de1-a2d9-defc8579acc6
from
- CoInterpreter VMMaker.oscog-eem.266 uuid: ee4e0b6e-91a8-432c-847b-132d682bc79b
+ CoInterpreter VMMaker.oscog-eem.269 uuid: 49173296-5145-4de1-a2d9-defc8579acc6
*/
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.266 uuid: ee4e0b6e-91a8-432c-847b-132d682bc79b " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.269 uuid: 49173296-5145-4de1-a2d9-defc8579acc6 " __DATE__ ;
char *__interpBuildInfo = __buildInfo;
@@ -294,6 +294,7 @@
#define SelectorMustBeBoolean 25
#define SelectorRunWithIn 49
#define SelectorStart 2
+#define SelectorUnknownBytecode 57
#define SenderIndex 0
#define ShiftForWord 2
#define Size4Bit 0
@@ -577,6 +578,7 @@
static sqInt getShortFromFileswap(sqImageFile aFile, sqInt swapFlag);
sqInt * getStackPointer(void);
sqInt getThisSessionID(void);
+static sqInt goodContextSize(sqInt oop);
static sqInt handleMNUInMachineCodeToclassForMessage(sqInt selectorIndex, sqInt rcvr, sqInt classForMessage);
static void handleStackOverflow(void);
static sqInt handleStackOverflowOrEventAllowContextSwitch(sqInt mayContextSwitch);
@@ -1051,6 +1053,7 @@
void printStackPagesInUse(void);
static void printStackPage(StackPage *page);
static void printStringOf(sqInt oop);
+void printWronglySizedContexts(sqInt printContexts);
void print(char *s);
void pushBool(sqInt trueOrFalse);
static sqInt pushedReceiverOrClosureOfFrame(char *theFP);
@@ -1259,6 +1262,7 @@
_iss sqInt statSweepCount;
_iss usqInt compEnd;
_iss sqInt flagInterpretedMethods;
+_iss sqInt heapMap;
_iss sqInt metaclassSizeBits;
_iss sqInt pendingFinalizationSignals;
_iss sqInt shrinkThreshold;
@@ -1948,7 +1952,7 @@
0 };
static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
static usqInt heapBase;
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.266";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_*_VMMaker.oscog-eem.269";
sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
volatile int sendTrace;
@@ -11623,17 +11627,42 @@
BREAK;
CASE(478) /*222*/
CASE(479) /*223*/
- CASE(501) /*245*/
- CASE(502) /*246*/
- CASE(503) /*247*/
- CASE(504) /*248*/
- CASE(510) /*254*/
- CASE(511) /*255*/
/* unknownBytecode */
{
VM_LABEL(0unknownBytecode);
- error("Unknown bytecode");
+ /* goto respondToUnknownBytecode */
}
+
+ respondToUnknownBytecode:
+ /* respondToUnknownBytecode */
+ {
+ sqInt ourContext;
+ sqInt unknownBytecodeSelector;
+
+ VM_LABEL(0respondToUnknownBytecode);
+ unknownBytecodeSelector = (SelectorUnknownBytecode < (lengthOf(GIV(specialObjectsOop)))
+ ? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SelectorUnknownBytecode << ShiftForWord))
+ : 0);
+ if (unknownBytecodeSelector == null) {
+ error("Unknown bytecode");
+ }
+ /* begin ensureFrameIsMarried:SP: */
+ VM_LABEL(7ensureFrameIsMarriedSP);
+ if (((((usqInt)(longAt(localFP + FoxMethod)))) < (startOfMemory())
+ ? ((longAt(localFP + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
+ : (byteAt((localFP + FoxIFrameFlags) + 2)) != 0)) {
+ assert(isContext(frameContext(localFP)));
+ ourContext = longAt(localFP + FoxThisContext);
+ goto l283;
+ }
+ ourContext = marryFrameSP(localFP, localSP);
+ l283: /* end ensureFrameIsMarried:SP: */;
+ /* begin internalPush: */
+ longAtPointerput((localSP -= BytesPerOop), ourContext);
+ GIV(messageSelector) = unknownBytecodeSelector;
+ GIV(argumentCount) = 0;
+ goto commonSend;
+ }
BREAK;
CASE(480) /*224*/
/* extABytecode */
@@ -11766,7 +11795,7 @@
goto l261;
}
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(7ensureFrameIsMarriedSP);
+ VM_LABEL(8ensureFrameIsMarriedSP);
/* begin frameCallerStackPointer: */
assert(!(isBaseFrame(spouseFP)));
theSP = (spouseFP + (frameStackedReceiverOffsetNumArgs(((((usqInt)(longAt(spouseFP + FoxMethod)))) < (startOfMemory())
@@ -12496,6 +12525,18 @@
l265: /* end jumplfFalseBy: */;
}
BREAK;
+ CASE(501) /*245*/
+ CASE(502) /*246*/
+ CASE(503) /*247*/
+ CASE(504) /*248*/
+ CASE(510) /*254*/
+ CASE(511) /*255*/
+ /* unknownBytecode */
+ {
+ VM_LABEL(1unknownBytecode);
+ goto respondToUnknownBytecode;
+ }
+ BREAK;
CASE(505) /*249*/
/* callPrimitiveBytecode */
{
@@ -12526,7 +12567,7 @@
/* begin pushClosureNumArgs:copiedValues:blockSize: */
VM_LABEL(1pushClosureNumArgscopiedValuesblockSize);
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(8ensureFrameIsMarriedSP);
+ VM_LABEL(9ensureFrameIsMarriedSP);
if (((((usqInt)(longAt(localFP + FoxMethod)))) < (startOfMemory())
? ((longAt(localFP + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
: (byteAt((localFP + FoxIFrameFlags) + 2)) != 0)) {
@@ -14880,7 +14921,7 @@
/* error: can't find home on chain; cannot return */
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(9ensureFrameIsMarriedSP);
+ VM_LABEL(10ensureFrameIsMarriedSP);
if (((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory())
? ((longAt(GIV(framePointer) + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
: (byteAt((GIV(framePointer) + FoxIFrameFlags) + 2)) != 0)) {
@@ -14906,7 +14947,7 @@
/* begin externalAboutToReturn:through: */
VM_LABEL(0externalAboutToReturnthrough);
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(10ensureFrameIsMarriedSP);
+ VM_LABEL(11ensureFrameIsMarriedSP);
if (((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory())
? ((longAt(GIV(framePointer) + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
: (byteAt((GIV(framePointer) + FoxIFrameFlags) + 2)) != 0)) {
@@ -14979,7 +15020,7 @@
/* error: home's sender is dead; cannot return */
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(11ensureFrameIsMarriedSP);
+ VM_LABEL(12ensureFrameIsMarriedSP);
if (((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory())
? ((longAt(GIV(framePointer) + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
: (byteAt((GIV(framePointer) + FoxIFrameFlags) + 2)) != 0)) {
@@ -15696,7 +15737,7 @@
return PrimErrInappropriate;
}
if (argFormat < 2) {
- if ((argClassInstByteSize - BaseHeaderSize) != (byteSizeOf(rcvr))) {
+ if ((argClassInstByteSize - BaseHeaderSize) != (byteLengthOf(rcvr))) {
return PrimErrBadReceiver;
}
}
@@ -15705,7 +15746,7 @@
/* For indexable plus fixed fields the receiver must be at least big enough. */
- if ((argClassInstByteSize - BaseHeaderSize) > (byteSizeOf(rcvr))) {
+ if ((argClassInstByteSize - BaseHeaderSize) > (byteLengthOf(rcvr))) {
return PrimErrBadReceiver;
}
}
@@ -16145,6 +16186,7 @@
printHex(fieldOop);
/* begin cr */
printf("\n");
+ /* begin eek */
ok = 0;
}
}
@@ -16200,6 +16242,7 @@
printHex(fieldOop);
/* begin cr */
printf("\n");
+ /* begin eek */
ok = 0;
}
else {
@@ -16212,6 +16255,7 @@
printHex(fieldOop);
/* begin cr */
printf("\n");
+ /* begin eek */
ok = 0;
}
}
@@ -16245,6 +16289,7 @@
printHex(obj);
/* begin cr */
printf("\n");
+ /* begin eek */
ok = 0;
}
else {
@@ -16255,6 +16300,7 @@
printHex(obj);
/* begin cr */
printf("\n");
+ /* begin eek */
ok = 0;
}
else {
@@ -16266,6 +16312,7 @@
printHex(obj);
/* begin cr */
printf("\n");
+ /* begin eek */
ok = 0;
}
}
@@ -16280,6 +16327,7 @@
printHex(obj);
/* begin cr */
printf("\n");
+ /* begin eek */
ok = 0;
}
else {
@@ -16290,6 +16338,7 @@
printHex(obj);
/* begin cr */
printf("\n");
+ /* begin eek */
ok = 0;
}
}
@@ -16303,6 +16352,7 @@
printHex(obj);
/* begin cr */
printf("\n");
+ /* begin eek */
ok = 0;
}
else {
@@ -16313,6 +16363,7 @@
printHex(obj);
/* begin cr */
printf("\n");
+ /* begin eek */
ok = 0;
}
}
@@ -16496,8 +16547,7 @@
: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)));
hasYoung = ((oop1 & 1) == 0)
&& ((((usqInt) oop1)) >= (((usqInt) GIV(youngStart))));
- if (!((((oop & 1) == 0)
- && (((((usqInt) (longAt(oop))) >> 8) & 15) <= 4))
+ if (!((((((usqInt) (longAt(oop))) >> 8) & 15) <= 4)
|| (((((usqInt) (longAt(oop))) >> 8) & 15) >= 12))) {
return 1;
}
@@ -16858,8 +16908,7 @@
printf("\n");
return 0;
}
- if (!((((objClass & 1) == 0)
- && (((((usqInt) (longAt(objClass))) >> 8) & 15) <= 4))
+ if (!((((((usqInt) (longAt(objClass))) >> 8) & 15) <= 4)
&& ((lengthOf(objClass)) >= 3))) {
print("obj ");
printHex(obj);
@@ -17204,12 +17253,14 @@
/* Perform an integrity/leak check using the heapMap. Set a bit at each
+ object's header. */
+/* Perform an integrity/leak check using the heapMap. Set a bit at each
object's header.
Override to set a bit at each Cog method */
static void
clearLeakMapAndMapAccessibleObjects(void)
-{
+{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt chunk;
sqInt header;
usqInt nextHeader;
@@ -17220,7 +17271,7 @@
/* begin oopFromChunk: */
chunk = startOfMemory();
obj = ((sqInt) (chunk + (headerTypeBytes[(longAt(chunk)) & TypeMask])));
- while (obj < GIV(freeStart)) {
+ while ((((usqInt) obj)) < (((usqInt) GIV(freeStart)))) {
if (((longAt(obj)) & TypeMask) == HeaderTypeFree) {
sz = (longAt(obj)) & AllButTypeMask;
}
@@ -18120,7 +18171,7 @@
assert(isMachineCodeFrame(GIV(framePointer)));
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(12ensureFrameIsMarriedSP);
+ VM_LABEL(13ensureFrameIsMarriedSP);
if (((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory())
? ((longAt(GIV(framePointer) + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
: (byteAt((GIV(framePointer) + FoxIFrameFlags) + 2)) != 0)) {
@@ -18445,7 +18496,7 @@
(GIV(stackPage)->headSP = GIV(stackPointer));
assert(pageListIsWellFormed());
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(13ensureFrameIsMarriedSP);
+ VM_LABEL(14ensureFrameIsMarriedSP);
if (((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory())
? ((longAt(GIV(framePointer) + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
: (byteAt((GIV(framePointer) + FoxIFrameFlags) + 2)) != 0)) {
@@ -18489,7 +18540,7 @@
if (((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory()))
&& (cogMethod == (mframeHomeMethod(theFP)))) {
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(14ensureFrameIsMarriedSP);
+ VM_LABEL(15ensureFrameIsMarriedSP);
if (((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
? ((longAt(theFP + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
: (byteAt((theFP + FoxIFrameFlags) + 2)) != 0)) {
@@ -18544,7 +18595,7 @@
calleeContext = null;
while (1) {
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(15ensureFrameIsMarriedSP);
+ VM_LABEL(16ensureFrameIsMarriedSP);
if (((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
? ((longAt(theFP + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
: (byteAt((theFP + FoxIFrameFlags) + 2)) != 0)) {
@@ -19238,12 +19289,14 @@
usqInt newFreeStart;
sqInt newObj;
+ assert((sizeInBytes == SmallContextSize)
+ || (sizeInBytes == LargeContextSize));
+ assert(sizeInBytes <= SizeMask);
hash = ((usqInt) GIV(freeStart)) >> ShiftForWord;
- header1 = ((hash & HashMaskUnshifted) << HashBitsOffset) | (((ClassMethodContextCompactIndex << 12) + (3 << 8)) + ((CtxtTempFrameStart + (((sqInt) BaseHeaderSize >> 2))) << 2));
- assert(sizeInBytes <= SizeMask);
+ header1 = ((hash & HashMaskUnshifted) << HashBitsOffset) | ((ClassMethodContextCompactIndex << 12) + (3 << 8));
assert((header1 & CompactClassMask) > 0);
- header1 += sizeInBytes - (header1 & SizeMask);
- flag("Dan");
+ assert((header1 & SizeMask) == 0);
+ header1 += sizeInBytes;
/* begin eeAllocate:headerSize:h1:h2:h3: */
/* begin allocateInterpreterChunk: */
newChunk = GIV(freeStart);
@@ -19472,7 +19525,7 @@
return callerContextOrNil;
}
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(16ensureFrameIsMarriedSP);
+ VM_LABEL(17ensureFrameIsMarriedSP);
/* begin frameCallerStackPointer: */
assert(!(isBaseFrame(theFP)));
theSP = (theFP + (frameStackedReceiverOffsetNumArgs(((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
@@ -20118,7 +20171,7 @@
goto l1;
}
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(17ensureFrameIsMarriedSP);
+ VM_LABEL(18ensureFrameIsMarriedSP);
/* begin frameCallerStackPointer: */
assert(!(isBaseFrame(theFP)));
theSP1 = (theFP + (frameStackedReceiverOffsetNumArgs(((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
@@ -20324,7 +20377,7 @@
return callerContextOrNil;
}
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(18ensureFrameIsMarriedSP);
+ VM_LABEL(19ensureFrameIsMarriedSP);
/* begin frameCallerStackPointer: */
assert(!(isBaseFrame(spouseFP)));
theSP = (spouseFP + (frameStackedReceiverOffsetNumArgs(((((usqInt)(longAt(spouseFP + FoxMethod)))) < (startOfMemory())
@@ -21035,7 +21088,7 @@
: byteAt((theFPAbove + FoxIFrameFlags) + 1))))) + BytesPerWord;
}
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(19ensureFrameIsMarriedSP);
+ VM_LABEL(20ensureFrameIsMarriedSP);
if (((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
? ((longAt(theFP + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
: (byteAt((theFP + FoxIFrameFlags) + 2)) != 0)) {
@@ -22357,7 +22410,14 @@
return GIV(globalSessionID);
}
+static sqInt
+goodContextSize(sqInt oop)
+{
+ return ((byteLengthOf(oop)) == (SmallContextSize - BaseHeaderSize))
+ || ((byteLengthOf(oop)) == (LargeContextSize - BaseHeaderSize));
+}
+
/* A message send from either an open PIC or an unlinked send has
not been understood. Execute the relevant resulting MNU method. */
@@ -22537,7 +22597,7 @@
goto l1;
}
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(20ensureFrameIsMarriedSP);
+ VM_LABEL(21ensureFrameIsMarriedSP);
/* begin frameCallerStackPointer: */
assert(!(isBaseFrame(theFP)));
theSP = (theFP + (frameStackedReceiverOffsetNumArgs(((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
@@ -25649,7 +25709,7 @@
fmt = (((usqInt) (longAt(oop))) >> 8) & 15;
if (fmt > 4) {
print(" nbytes ");
- printNum(byteSizeOf(oop));
+ printNum(byteLengthOf(oop));
}
/* begin printHeaderTypeOf: */
@@ -25826,8 +25886,7 @@
oop = null;
l3: /* end firstAccessibleObject */;
while (!(oop == null)) {
- if ((((oop & 1) == 0)
- && (((((usqInt) (longAt(oop))) >> 8) & 15) <= 4))
+ if ((((((usqInt) (longAt(oop))) >> 8) & 15) <= 4)
|| (((((usqInt) (longAt(oop))) >> 8) & 15) >= 12)) {
if (((((usqInt) (longAt(oop))) >> 8) & 15) >= 12) {
/* begin literalCountOfHeader: */
@@ -25842,8 +25901,7 @@
: (((usqInt) headerPointer) >> 10) & 255);
}
else {
- if (((oop & 1) == 0)
- && (((((usqInt) (longAt(oop))) >> 12) & 31) == ClassMethodContextCompactIndex)) {
+ if (((((usqInt) (longAt(oop))) >> 12) & 31) == ClassMethodContextCompactIndex) {
i = CtxtTempFrameStart + (fetchStackPointerOf(oop));
}
else {
@@ -26413,6 +26471,7 @@
sqInt valuePointer1;
assert(isSingleContext(aContext));
+ assert(goodContextSize(aContext));
theIP = longAt((aContext + BaseHeaderSize) + (InstructionPointerIndex << ShiftForWord));
assert((((sqInt) HasBeenReturnedFromMCPC)) < 0);
theIP = ((theIP & 1)
@@ -28015,8 +28074,8 @@
}
-/* Return one of the objects in the SpecialObjectsArray, if in range,
- otherwise ansser nil
+/* Answer one of the objects in the SpecialObjectsArray, if in range,
+ otherwise answer nil.
*/
sqInt
@@ -28451,7 +28510,7 @@
assert(frameHasContext(callerFP));
assert(isContext(frameContext(callerFP)));
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(21ensureFrameIsMarriedSP);
+ VM_LABEL(22ensureFrameIsMarriedSP);
theSP = theFP + (((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
? FoxMFReceiver
: FoxIFReceiver));
@@ -29233,8 +29292,7 @@
error("class oop is not ok");
return 0;
}
- if (!((((oopClass & 1) == 0)
- && (((((usqInt) (longAt(oopClass))) >> 8) & 15) <= 4))
+ if (!((((((usqInt) (longAt(oopClass))) >> 8) & 15) <= 4)
&& ((lengthOf(oopClass)) >= 3))) {
error("a class (behavior) must be a pointers object of size >= 3");
return 0;
@@ -31264,6 +31322,7 @@
char *sp;
sqInt sp1;
char *spouseFP;
+ sqInt sz;
sqInt value;
sqInt valuePointer;
sqInt valuePointer1;
@@ -31277,7 +31336,8 @@
if (((((usqInt) objHeader) >> 12) & 31) == ClassMethodContextCompactIndex) {
/* begin cloneContext: */
VM_LABEL(0cloneContext);
- cloned = eeInstantiateMethodContextByteSize(byteSizeOf(rcvr));
+ sz = (byteLengthOf(rcvr)) + BaseHeaderSize;
+ cloned = eeInstantiateMethodContextByteSize(sz);
if (cloned != 0) {
for (i = 0; i <= StackPointerIndex; i += 1) {
/* begin storePointerUnchecked:ofObject:withValue: */
@@ -44102,7 +44162,7 @@
(GIV(stackPage)->headSP = GIV(stackPointer));
assert(pageListIsWellFormed());
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(22ensureFrameIsMarriedSP);
+ VM_LABEL(23ensureFrameIsMarriedSP);
if (((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory())
? ((longAt(GIV(framePointer) + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
: (byteAt((GIV(framePointer) + FoxIFrameFlags) + 2)) != 0)) {
@@ -46167,7 +46227,7 @@
fmt = (((usqInt) (longAt(oop))) >> 8) & 15;
if (fmt > 4) {
print(" nbytes ");
- printNum(byteSizeOf(oop));
+ printNum(byteLengthOf(oop));
}
/* begin cr */
printf("\n");
@@ -46191,7 +46251,7 @@
}
if (((oop & 1) == 0)
&& (((((usqInt) (longAt(oop))) >> 8) & 15) == 6)) {
- lastIndex = ((64 < (((sqInt) (byteSizeOf(oop)) >> 2))) ? 64 : (((sqInt) (byteSizeOf(oop)) >> 2)));
+ lastIndex = ((64 < (((sqInt) (byteLengthOf(oop)) >> 2))) ? 64 : (((sqInt) (byteLengthOf(oop)) >> 2)));
if (lastIndex > 0) {
for (index = 1; index <= lastIndex; index += 1) {
/* begin space */
@@ -46383,8 +46443,7 @@
oop = null;
l3: /* end firstAccessibleObject */;
while (!(oop == null)) {
- if ((((oop & 1) == 0)
- && (((((usqInt) (longAt(oop))) >> 8) & 15) <= 4))
+ if ((((((usqInt) (longAt(oop))) >> 8) & 15) <= 4)
|| (((((usqInt) (longAt(oop))) >> 8) & 15) >= 12)) {
if (((((usqInt) (longAt(oop))) >> 8) & 15) >= 12) {
/* begin literalCountOfHeader: */
@@ -46399,8 +46458,7 @@
: (((usqInt) headerPointer) >> 10) & 255);
}
else {
- if (((oop & 1) == 0)
- && (((((usqInt) (longAt(oop))) >> 12) & 31) == ClassMethodContextCompactIndex)) {
+ if (((((usqInt) (longAt(oop))) >> 12) & 31) == ClassMethodContextCompactIndex) {
i = CtxtTempFrameStart + (fetchStackPointerOf(oop));
}
else {
@@ -46688,6 +46746,110 @@
}
+/* Scan the heap printing the oops of any and all contexts whose size is not
+ either SmallContextSize or LargeContextSize
+ */
+
+void
+printWronglySizedContexts(sqInt printContexts)
+{ DECL_MAYBE_SQ_GLOBAL_STRUCT
+ sqInt chunk;
+ sqInt header;
+ sqInt header1;
+ sqInt header2;
+ sqInt obj;
+ sqInt obj1;
+ sqInt oop;
+ sqInt sz;
+ sqInt sz1;
+ sqInt sz2;
+
+ /* begin firstAccessibleObject */
+ /* begin oopFromChunk: */
+ chunk = startOfMemory();
+ obj1 = chunk + (headerTypeBytes[(longAt(chunk)) & TypeMask]);
+ while ((((usqInt) obj1)) < (((usqInt) GIV(freeStart)))) {
+ if (!(((longAt(obj1)) & TypeMask) == HeaderTypeFree)) {
+ oop = obj1;
+ goto l2;
+ }
+ /* begin objectAfter: */
+ if (!(asserta(oopisLessThan(obj1, GIV(freeStart))))) {
+ error("no objects after the end of memory");
+ }
+ if (((longAt(obj1)) & TypeMask) == HeaderTypeFree) {
+ sz = (longAt(obj1)) & AllButTypeMask;
+ }
+ else {
+ /* begin sizeBitsOf: */
+ header = longAt(obj1);
+ sz = ((header & TypeMask) == HeaderTypeSizeAndClass
+ ? (longAt(obj1 - (BytesPerWord * 2))) & LongSizeMask
+ : header & SizeMask);
+ }
+ obj1 = (obj1 + sz) + (headerTypeBytes[(longAt(obj1 + sz)) & TypeMask]);
+ }
+ error("heap is empty");
+ oop = null;
+l2: /* end firstAccessibleObject */;
+ while (!(oop == null)) {
+ if ((((((usqInt) (longAt(oop))) >> 12) & 31) == ClassMethodContextCompactIndex)
+ && (((byteLengthOf(oop)) != (SmallContextSize - BaseHeaderSize))
+ && ((byteLengthOf(oop)) != (LargeContextSize - BaseHeaderSize)))) {
+ printHex(oop);
+ /* begin space */
+ /* begin printChar: */
+ putchar(' ');
+ printNum(byteLengthOf(oop));
+ /* begin cr */
+ printf("\n");
+ if (printContexts) {
+ printContext(oop);
+ }
+ }
+ /* begin accessibleObjectAfter: */
+ /* begin objectAfter: */
+ if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
+ error("no objects after the end of memory");
+ }
+ if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
+ sz2 = (longAt(oop)) & AllButTypeMask;
+ }
+ else {
+ /* begin sizeBitsOf: */
+ header2 = longAt(oop);
+ sz2 = ((header2 & TypeMask) == HeaderTypeSizeAndClass
+ ? (longAt(oop - (BytesPerWord * 2))) & LongSizeMask
+ : header2 & SizeMask);
+ }
+ obj = (oop + sz2) + (headerTypeBytes[(longAt(oop + sz2)) & TypeMask]);
+ while ((((usqInt) obj)) < (((usqInt) GIV(freeStart)))) {
+ if (!(((longAt(obj)) & TypeMask) == HeaderTypeFree)) {
+ oop = obj;
+ goto l1;
+ }
+ /* begin objectAfter: */
+ if (!(asserta(oopisLessThan(obj, GIV(freeStart))))) {
+ error("no objects after the end of memory");
+ }
+ if (((longAt(obj)) & TypeMask) == HeaderTypeFree) {
+ sz1 = (longAt(obj)) & AllButTypeMask;
+ }
+ else {
+ /* begin sizeBitsOf: */
+ header1 = longAt(obj);
+ sz1 = ((header1 & TypeMask) == HeaderTypeSizeAndClass
+ ? (longAt(obj - (BytesPerWord * 2))) & LongSizeMask
+ : header1 & SizeMask);
+ }
+ obj = (obj + sz1) + (headerTypeBytes[(longAt(obj + sz1)) & TypeMask]);
+ }
+ oop = null;
+ l1: /* end accessibleObjectAfter: */;
+ }
+}
+
+
/* For testing in Smalltalk, this method should be overridden in a subclass. */
void
@@ -50986,7 +51148,7 @@
goto l1;
}
/* begin ensureFrameIsMarried:SP: */
- VM_LABEL(23ensureFrameIsMarriedSP);
+ VM_LABEL(24ensureFrameIsMarriedSP);
/* begin frameCallerStackPointer: */
assert(!(isBaseFrame(theFP)));
theSP = (theFP + (frameStackedReceiverOffsetNumArgs(((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
@@ -51654,7 +51816,7 @@
sched = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SchedulerAssociation << ShiftForWord))) + BaseHeaderSize) + (ValueIndex << ShiftForWord));
@@ Diff output truncated at 50000 characters. @@
More information about the Vm-dev
mailing list