[Vm-dev] [commit] r2428 - Newspeak VM source as per
VMMaker.oscog-eem.76. Fix change class prims to
commits at squeakvm.org
commits at squeakvm.org
Wed Jun 15 21:53:40 UTC 2011
Author: eliot
Date: 2011-06-15 14:53:40 -0700 (Wed, 15 Jun 2011)
New Revision: 2428
Modified:
branches/Cog/nssrc/vm/gcc3x-interp.c
branches/Cog/nssrc/vm/interp.c
branches/Cog/unixbuild/HowToBuild
Log:
Newspeak VM source as per VMMaker.oscog-eem.76. Fix change class prims to
allow a non-compact instance to change class to a compact class. Fix typo
in unixbuild/HowToBuild
Modified: branches/Cog/nssrc/vm/gcc3x-interp.c
===================================================================
--- branches/Cog/nssrc/vm/gcc3x-interp.c 2011-06-15 20:55:32 UTC (rev 2427)
+++ branches/Cog/nssrc/vm/gcc3x-interp.c 2011-06-15 21:53:40 UTC (rev 2428)
@@ -2,11 +2,11 @@
/* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.73 uuid: 8ef988bb-d4c8-479d-a4d8-75f1ddc5f248
+ CCodeGeneratorGlobalStructure VMMaker.oscog-eem.76 uuid: 3ff12599-c75e-4b1d-ae5d-3eb3fc3c9263
from
- NewspeakInterpreter VMMaker.oscog-eem.73 uuid: 8ef988bb-d4c8-479d-a4d8-75f1ddc5f248
+ NewspeakInterpreter VMMaker.oscog-eem.76 uuid: 3ff12599-c75e-4b1d-ae5d-3eb3fc3c9263
*/
-static char __buildInfo[] = "NewspeakInterpreter VMMaker.oscog-eem.73 uuid: 8ef988bb-d4c8-479d-a4d8-75f1ddc5f248 " __DATE__ ;
+static char __buildInfo[] = "NewspeakInterpreter VMMaker.oscog-eem.76 uuid: 3ff12599-c75e-4b1d-ae5d-3eb3fc3c9263 " __DATE__ ;
char *__interpBuildInfo = __buildInfo;
@@ -285,6 +285,7 @@
static sqInt byteSwapByteObjectsFromto(sqInt startOop, sqInt stopAddr);
sqInt byteSwapped(sqInt w);
static sqInt callExternalPrimitive(void (*functionID)());
+static sqInt changeClassOfto(sqInt rcvr, sqInt argClass);
sqInt characterForAscii(sqInt ascii);
sqInt characterTable(void);
sqInt checkedIntegerValueOf(sqInt intOop);
@@ -339,6 +340,7 @@
sqInt dumpSendTraceLog(void);
static sqInt existImmutableReferencesToForwardedInRangeFromto(sqInt memStart, sqInt memEnd);
static sqInt externalQuickPrimitiveResponse(void);
+static sqInt extraHeaderBytes(sqInt oopOrChunk);
sqInt failed(void);
static sqInt failUnbalancedPrimitive(void);
sqInt falseObject(void);
@@ -1464,7 +1466,7 @@
0 };
char * breakSelector;
sqInt breakSelectorLength = -1;
-const char *interpreterVersion = "Newspeak Virtual Machine NewspeakInterpreter_VMMaker.oscog-eem.73";
+const char *interpreterVersion = "Newspeak Virtual Machine NewspeakInterpreter_VMMaker.oscog-eem.76";
volatile int sendTrace;
@@ -8317,6 +8319,84 @@
}
+/* Attempt to change the class of the receiver into the class of the the
+ argument given that the
+ format of the receiver matches the format of the argument. If successful
+ answer 0, otherwise
+ answer an error code indicating the reason for failure. Fail if receiver
+ or argument are
+ SmallIntegers, or the receiver is an instance of a compact class and the
+ argument isn't, or when
+ the format of the receiver is different from the format of the argument's
+ class, or when the
+ arguments class is fixed and the receiver's size differs from the size
+ that an instance of the
+ argument's class should have. */
+/* Check what the format of the class says */
+
+static sqInt
+changeClassOfto(sqInt rcvr, sqInt argClass)
+{
+ sqInt argFormat;
+ sqInt byteSize;
+ sqInt ccIndex;
+ sqInt classHdr;
+ sqInt rcvrFormat;
+ sqInt rcvrHdr;
+ sqInt sizeHiBits;
+
+
+ /* Low 2 bits are 0 */
+ /* Compute the size of instances of the class (used for fixed field classes only) */
+
+ classHdr = (longAt((argClass + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1;
+ sizeHiBits = ((usqInt) (classHdr & 393216)) >> 9;
+ classHdr = classHdr & 131071;
+
+ /* size in bytes -- low 2 bits are 0 */
+ /* Check the receiver's format against that of the class */
+
+ byteSize = (classHdr & SizeMask) + sizeHiBits;
+ argFormat = (((usqInt) classHdr) >> 8) & 15;
+ rcvrHdr = longAt(rcvr);
+ rcvrFormat = (((usqInt) rcvrHdr) >> 8) & 15;
+ if (rcvrFormat > 8) {
+ rcvrFormat = rcvrFormat & 12;
+ }
+ if (!(argFormat == rcvrFormat)) {
+ return PrimErrInappropriate;
+ }
+ if (argFormat < 2) {
+ if (!((byteSize - BaseHeaderSize) == (byteSizeOf(rcvr)))) {
+ return PrimErrBadReceiver;
+ }
+ }
+ if ((rcvrHdr & TypeMask) == HeaderTypeShort) {
+
+ /* Compact classes. Check if the arg's class is compact and exchange ccIndex */
+
+ ccIndex = classHdr & CompactClassMask;
+ if (ccIndex == 0) {
+ return PrimErrInappropriate;
+ }
+ if ((rcvrHdr & ImmutabilityBit) != 0) {
+ return PrimErrNoModification;
+ }
+ longAtput(rcvr, ((longAt(rcvr)) & (~CompactClassMask)) | ccIndex);
+ }
+ else {
+ if ((rcvrHdr & ImmutabilityBit) != 0) {
+ return PrimErrNoModification;
+ }
+ longAtput(rcvr - BaseHeaderSize, argClass | ((longAt(rcvr)) & TypeMask));
+ if (rcvr < GIV(youngStart)) {
+ possibleRootStoreIntovalue(rcvr, argClass);
+ }
+ }
+ return 0;
+}
+
+
/* Arg must lie in range 0-255! */
sqInt
@@ -10292,6 +10372,19 @@
}
+/* Return the number of extra bytes used by the given object's header. */
+/* Warning: This method should not be used during marking, when the header
+ type bits of an object may be incorrect.
+ */
+/* JMM should be an array lookup! */
+
+static sqInt
+extraHeaderBytes(sqInt oopOrChunk)
+{
+ return headerTypeBytes[(longAt(oopOrChunk)) & TypeMask];
+}
+
+
/* In C, non-zero is true, so avoid computation by simply answering
primFailCode in the C version.
*/
@@ -12067,7 +12160,7 @@
&& (GIV(endOfMemory) < GIV(memoryLimit)))) {
error("error in free space computation");
}
- if (!((GIV(endOfMemory) + (headerTypeBytes[(longAt(GIV(endOfMemory))) & TypeMask])) == GIV(endOfMemory))) {
+ if (!((GIV(endOfMemory) + (extraHeaderBytes(GIV(endOfMemory)))) == GIV(endOfMemory))) {
error("header format must have changed");
}
if (!((objectAfter(GIV(freeBlock))) == GIV(endOfMemory))) {
@@ -15537,17 +15630,11 @@
primitiveAdoptInstance(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt arg;
- sqInt argFormat;
- sqInt byteSize;
- sqInt ccIndex;
- sqInt classHdr;
sqInt err;
sqInt i;
sqInt oop;
sqInt oop1;
sqInt rcvr;
- sqInt rcvrFormat;
- sqInt sizeHiBits;
/* begin stackObjectValue: */
oop = longAt(GIV(stackPointer) - (0 * BytesPerWord));
@@ -15569,65 +15656,7 @@
}
rcvr = oop1;
l2: /* end stackObjectValue: */;
- /* begin changeClassOf:to: */
- VM_LABEL(0changeClassOfto);
-
- /* Low 2 bits are 0 */
- /* Compute the size of instances of the class (used for fixed field classes only) */
-
- classHdr = (longAt((rcvr + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1;
- sizeHiBits = ((usqInt) (classHdr & 393216)) >> 9;
- classHdr = classHdr & 131071;
-
- /* size in bytes -- low 2 bits are 0 */
- /* Check the receiver's format against that of the class */
-
- byteSize = (classHdr & SizeMask) + sizeHiBits;
- argFormat = (((usqInt) classHdr) >> 8) & 15;
-
- /* If the receiver is a byte object we need to clear the number of odd bytes from the format. */
-
- rcvrFormat = (((usqInt) (longAt(arg))) >> 8) & 15;
- if (rcvrFormat > 8) {
- rcvrFormat = rcvrFormat & 12;
- }
- if (!(argFormat == rcvrFormat)) {
- err = PrimErrInappropriate;
- goto l3;
- }
- if (argFormat < 2) {
- if ((byteSize - BaseHeaderSize) != (byteSizeOf(arg))) {
- err = PrimErrBadReceiver;
- goto l3;
- }
- }
- else {
- if (argFormat == 3) {
- if ((byteSize - BaseHeaderSize) > (byteSizeOf(arg))) {
- err = PrimErrBadReceiver;
- goto l3;
- }
- }
- }
- if (((longAt(arg)) & TypeMask) == HeaderTypeShort) {
-
- /* Compact classes. Check if the arg's class is compact and exchange ccIndex */
-
- ccIndex = classHdr & CompactClassMask;
- if (ccIndex == 0) {
- err = PrimErrInappropriate;
- goto l3;
- }
- longAtput(arg, ((longAt(arg)) & (~CompactClassMask)) | ccIndex);
- }
- else {
- longAtput(arg - BaseHeaderSize, rcvr | ((longAt(arg)) & TypeMask));
- if ((((usqInt) arg)) < (((usqInt) GIV(youngStart)))) {
- possibleRootStoreIntovalue(arg, rcvr);
- }
- }
- err = 0;
-l3: /* end changeClassOf:to: */;
+ err = changeClassOfto(arg, rcvr);
if (err == 0) {
/* begin flushAtCache */
for (i = 1; i <= AtCacheTotalSize; i += 1) {
@@ -17098,31 +17127,25 @@
Fail if receiver
or argument are SmallIntegers, or the receiver is an instance of a compact
class and
- the argument isn't, or when the argument's class is compact and the
- receiver isn't, or
- when the format of the receiver is different from the format of the
- argument's class,
- or when the arguments class is fixed and the receiver's size differs from
- the size that
- an instance of the argument's class should have. */
+ the argument isn't, or when the format of the receiver is different from
+ the format of
+ the argument's class, or when the arguments class is fixed and the
+ receiver's size
+ differs from the size that an instance of the argument's class should
+ have.
+ */
static sqInt
primitiveChangeClass(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt arg;
sqInt argClass;
- sqInt argFormat;
- sqInt byteSize;
sqInt ccIndex;
- sqInt ccIndex1;
- sqInt classHdr;
sqInt err;
sqInt i;
sqInt oop;
sqInt oop1;
sqInt rcvr;
- sqInt rcvrFormat;
- sqInt sizeHiBits;
/* begin stackObjectValue: */
oop = longAt(GIV(stackPointer) - (0 * BytesPerWord));
@@ -17147,80 +17170,17 @@
if (!(!GIV(primFailCode))) {
return null;
}
- /* begin changeClassOf:toThatOf: */
- VM_LABEL(0changeClassOftoThatOf);
- /* begin fetchClassOf: */
- if ((arg & 1)) {
- argClass = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassInteger << ShiftForWord));
- goto l4;
- }
- if (((ccIndex1 = (((usqInt) (longAt(arg))) >> 12) & 31)) == 0) {
+ /* begin fetchClassOfNonInt: */
+ if (((ccIndex = (((usqInt) (longAt(arg))) >> 12) & 31)) == 0) {
argClass = (longAt(arg - BaseHeaderSize)) & AllButTypeMask;
- goto l4;
+ goto l3;
}
else {
- argClass = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex1 - 1) << ShiftForWord));
- goto l4;
+ argClass = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord));
+ goto l3;
}
-l4: /* end fetchClassOf: */;
-
- /* Low 2 bits are 0 */
- /* Compute the size of instances of the class (used for fixed field classes only) */
-
- classHdr = (longAt((argClass + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1;
- sizeHiBits = ((usqInt) (classHdr & 393216)) >> 9;
- classHdr = classHdr & 131071;
-
- /* size in bytes -- low 2 bits are 0 */
- /* Check the receiver's format against that of the class */
-
- byteSize = (classHdr & SizeMask) + sizeHiBits;
- argFormat = (((usqInt) classHdr) >> 8) & 15;
- rcvrFormat = (((usqInt) (longAt(rcvr))) >> 8) & 15;
- if (!(argFormat == rcvrFormat)) {
- if ((rcvrFormat > 8)
- && (argFormat > 8)) {
- rcvrFormat = rcvrFormat & 12;
- argFormat = argFormat & 12;
- }
- if (!(argFormat == rcvrFormat)) {
- err = PrimErrInappropriate;
- goto l3;
- }
- }
- if (argFormat < 2) {
- if ((byteSize - BaseHeaderSize) != (byteSizeOf(rcvr))) {
- err = PrimErrBadReceiver;
- goto l3;
- }
- }
- else {
- if (argFormat == 3) {
- if ((byteSize - BaseHeaderSize) > (byteSizeOf(rcvr))) {
- err = PrimErrBadReceiver;
- goto l3;
- }
- }
- }
- if (((longAt(rcvr)) & TypeMask) == HeaderTypeShort) {
-
- /* Compact classes. Check if the arg's class is compact and exchange ccIndex */
-
- ccIndex = classHdr & CompactClassMask;
- if (ccIndex == 0) {
- err = PrimErrInappropriate;
- goto l3;
- }
- longAtput(rcvr, ((longAt(rcvr)) & (~CompactClassMask)) | ccIndex);
- }
- else {
- longAtput(rcvr - BaseHeaderSize, argClass | ((longAt(rcvr)) & TypeMask));
- if (rcvr < GIV(youngStart)) {
- possibleRootStoreIntovalue(rcvr, argClass);
- }
- }
- err = 0;
-l3: /* end changeClassOf:toThatOf: */;
+l3: /* end fetchClassOfNonInt: */;
+ err = changeClassOfto(rcvr, argClass);
if (err == 0) {
/* begin flushAtCache */
for (i = 1; i <= AtCacheTotalSize; i += 1) {
@@ -18376,10 +18336,10 @@
/* receiver, argsArray, then method are on top of stack. Execute method
- against receiver and args.
+ against receiver and args. Allow for up to two extra arguments (e.g. for
+ mirror primitives).
Set primitiveFunctionPointer because no cache lookup has been done for the
- method, and
- hence primitiveFunctionPointer is stale. */
+ method, and hence primitiveFunctionPointer is stale. */
static sqInt
primitiveExecuteMethodArgsArray(void)
Modified: branches/Cog/nssrc/vm/interp.c
===================================================================
--- branches/Cog/nssrc/vm/interp.c 2011-06-15 20:55:32 UTC (rev 2427)
+++ branches/Cog/nssrc/vm/interp.c 2011-06-15 21:53:40 UTC (rev 2428)
@@ -1,9 +1,9 @@
/* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.73 uuid: 8ef988bb-d4c8-479d-a4d8-75f1ddc5f248
+ CCodeGeneratorGlobalStructure VMMaker.oscog-eem.76 uuid: 3ff12599-c75e-4b1d-ae5d-3eb3fc3c9263
from
- NewspeakInterpreter VMMaker.oscog-eem.73 uuid: 8ef988bb-d4c8-479d-a4d8-75f1ddc5f248
+ NewspeakInterpreter VMMaker.oscog-eem.76 uuid: 3ff12599-c75e-4b1d-ae5d-3eb3fc3c9263
*/
-static char __buildInfo[] = "NewspeakInterpreter VMMaker.oscog-eem.73 uuid: 8ef988bb-d4c8-479d-a4d8-75f1ddc5f248 " __DATE__ ;
+static char __buildInfo[] = "NewspeakInterpreter VMMaker.oscog-eem.76 uuid: 3ff12599-c75e-4b1d-ae5d-3eb3fc3c9263 " __DATE__ ;
char *__interpBuildInfo = __buildInfo;
@@ -282,6 +282,7 @@
static sqInt byteSwapByteObjectsFromto(sqInt startOop, sqInt stopAddr);
sqInt byteSwapped(sqInt w);
static sqInt callExternalPrimitive(void (*functionID)());
+static sqInt changeClassOfto(sqInt rcvr, sqInt argClass);
sqInt characterForAscii(sqInt ascii);
sqInt characterTable(void);
sqInt checkedIntegerValueOf(sqInt intOop);
@@ -336,6 +337,7 @@
sqInt dumpSendTraceLog(void);
static sqInt existImmutableReferencesToForwardedInRangeFromto(sqInt memStart, sqInt memEnd);
static sqInt externalQuickPrimitiveResponse(void);
+static sqInt extraHeaderBytes(sqInt oopOrChunk);
sqInt failed(void);
static sqInt failUnbalancedPrimitive(void);
sqInt falseObject(void);
@@ -1461,7 +1463,7 @@
0 };
char * breakSelector;
sqInt breakSelectorLength = -1;
-const char *interpreterVersion = "Newspeak Virtual Machine NewspeakInterpreter_VMMaker.oscog-eem.73";
+const char *interpreterVersion = "Newspeak Virtual Machine NewspeakInterpreter_VMMaker.oscog-eem.76";
volatile int sendTrace;
@@ -8313,6 +8315,84 @@
}
+/* Attempt to change the class of the receiver into the class of the the
+ argument given that the
+ format of the receiver matches the format of the argument. If successful
+ answer 0, otherwise
+ answer an error code indicating the reason for failure. Fail if receiver
+ or argument are
+ SmallIntegers, or the receiver is an instance of a compact class and the
+ argument isn't, or when
+ the format of the receiver is different from the format of the argument's
+ class, or when the
+ arguments class is fixed and the receiver's size differs from the size
+ that an instance of the
+ argument's class should have. */
+/* Check what the format of the class says */
+
+static sqInt
+changeClassOfto(sqInt rcvr, sqInt argClass)
+{
+ sqInt argFormat;
+ sqInt byteSize;
+ sqInt ccIndex;
+ sqInt classHdr;
+ sqInt rcvrFormat;
+ sqInt rcvrHdr;
+ sqInt sizeHiBits;
+
+
+ /* Low 2 bits are 0 */
+ /* Compute the size of instances of the class (used for fixed field classes only) */
+
+ classHdr = (longAt((argClass + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1;
+ sizeHiBits = ((usqInt) (classHdr & 393216)) >> 9;
+ classHdr = classHdr & 131071;
+
+ /* size in bytes -- low 2 bits are 0 */
+ /* Check the receiver's format against that of the class */
+
+ byteSize = (classHdr & SizeMask) + sizeHiBits;
+ argFormat = (((usqInt) classHdr) >> 8) & 15;
+ rcvrHdr = longAt(rcvr);
+ rcvrFormat = (((usqInt) rcvrHdr) >> 8) & 15;
+ if (rcvrFormat > 8) {
+ rcvrFormat = rcvrFormat & 12;
+ }
+ if (!(argFormat == rcvrFormat)) {
+ return PrimErrInappropriate;
+ }
+ if (argFormat < 2) {
+ if (!((byteSize - BaseHeaderSize) == (byteSizeOf(rcvr)))) {
+ return PrimErrBadReceiver;
+ }
+ }
+ if ((rcvrHdr & TypeMask) == HeaderTypeShort) {
+
+ /* Compact classes. Check if the arg's class is compact and exchange ccIndex */
+
+ ccIndex = classHdr & CompactClassMask;
+ if (ccIndex == 0) {
+ return PrimErrInappropriate;
+ }
+ if ((rcvrHdr & ImmutabilityBit) != 0) {
+ return PrimErrNoModification;
+ }
+ longAtput(rcvr, ((longAt(rcvr)) & (~CompactClassMask)) | ccIndex);
+ }
+ else {
+ if ((rcvrHdr & ImmutabilityBit) != 0) {
+ return PrimErrNoModification;
+ }
+ longAtput(rcvr - BaseHeaderSize, argClass | ((longAt(rcvr)) & TypeMask));
+ if (rcvr < GIV(youngStart)) {
+ possibleRootStoreIntovalue(rcvr, argClass);
+ }
+ }
+ return 0;
+}
+
+
/* Arg must lie in range 0-255! */
sqInt
@@ -10288,6 +10368,19 @@
}
+/* Return the number of extra bytes used by the given object's header. */
+/* Warning: This method should not be used during marking, when the header
+ type bits of an object may be incorrect.
+ */
+/* JMM should be an array lookup! */
+
+static sqInt
+extraHeaderBytes(sqInt oopOrChunk)
+{
+ return headerTypeBytes[(longAt(oopOrChunk)) & TypeMask];
+}
+
+
/* In C, non-zero is true, so avoid computation by simply answering
primFailCode in the C version.
*/
@@ -12063,7 +12156,7 @@
&& (GIV(endOfMemory) < GIV(memoryLimit)))) {
error("error in free space computation");
}
- if (!((GIV(endOfMemory) + (headerTypeBytes[(longAt(GIV(endOfMemory))) & TypeMask])) == GIV(endOfMemory))) {
+ if (!((GIV(endOfMemory) + (extraHeaderBytes(GIV(endOfMemory)))) == GIV(endOfMemory))) {
error("header format must have changed");
}
if (!((objectAfter(GIV(freeBlock))) == GIV(endOfMemory))) {
@@ -15533,17 +15626,11 @@
primitiveAdoptInstance(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt arg;
- sqInt argFormat;
- sqInt byteSize;
- sqInt ccIndex;
- sqInt classHdr;
sqInt err;
sqInt i;
sqInt oop;
sqInt oop1;
sqInt rcvr;
- sqInt rcvrFormat;
- sqInt sizeHiBits;
/* begin stackObjectValue: */
oop = longAt(GIV(stackPointer) - (0 * BytesPerWord));
@@ -15565,65 +15652,7 @@
}
rcvr = oop1;
l2: /* end stackObjectValue: */;
- /* begin changeClassOf:to: */
- VM_LABEL(0changeClassOfto);
-
- /* Low 2 bits are 0 */
- /* Compute the size of instances of the class (used for fixed field classes only) */
-
- classHdr = (longAt((rcvr + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1;
- sizeHiBits = ((usqInt) (classHdr & 393216)) >> 9;
- classHdr = classHdr & 131071;
-
- /* size in bytes -- low 2 bits are 0 */
- /* Check the receiver's format against that of the class */
-
- byteSize = (classHdr & SizeMask) + sizeHiBits;
- argFormat = (((usqInt) classHdr) >> 8) & 15;
-
- /* If the receiver is a byte object we need to clear the number of odd bytes from the format. */
-
- rcvrFormat = (((usqInt) (longAt(arg))) >> 8) & 15;
- if (rcvrFormat > 8) {
- rcvrFormat = rcvrFormat & 12;
- }
- if (!(argFormat == rcvrFormat)) {
- err = PrimErrInappropriate;
- goto l3;
- }
- if (argFormat < 2) {
- if ((byteSize - BaseHeaderSize) != (byteSizeOf(arg))) {
- err = PrimErrBadReceiver;
- goto l3;
- }
- }
- else {
- if (argFormat == 3) {
- if ((byteSize - BaseHeaderSize) > (byteSizeOf(arg))) {
- err = PrimErrBadReceiver;
- goto l3;
- }
- }
- }
- if (((longAt(arg)) & TypeMask) == HeaderTypeShort) {
-
- /* Compact classes. Check if the arg's class is compact and exchange ccIndex */
-
- ccIndex = classHdr & CompactClassMask;
- if (ccIndex == 0) {
- err = PrimErrInappropriate;
- goto l3;
- }
- longAtput(arg, ((longAt(arg)) & (~CompactClassMask)) | ccIndex);
- }
- else {
- longAtput(arg - BaseHeaderSize, rcvr | ((longAt(arg)) & TypeMask));
- if ((((usqInt) arg)) < (((usqInt) GIV(youngStart)))) {
- possibleRootStoreIntovalue(arg, rcvr);
- }
- }
- err = 0;
-l3: /* end changeClassOf:to: */;
+ err = changeClassOfto(arg, rcvr);
if (err == 0) {
/* begin flushAtCache */
for (i = 1; i <= AtCacheTotalSize; i += 1) {
@@ -17094,31 +17123,25 @@
Fail if receiver
or argument are SmallIntegers, or the receiver is an instance of a compact
class and
- the argument isn't, or when the argument's class is compact and the
- receiver isn't, or
- when the format of the receiver is different from the format of the
- argument's class,
- or when the arguments class is fixed and the receiver's size differs from
- the size that
- an instance of the argument's class should have. */
+ the argument isn't, or when the format of the receiver is different from
+ the format of
+ the argument's class, or when the arguments class is fixed and the
+ receiver's size
+ differs from the size that an instance of the argument's class should
+ have.
+ */
static sqInt
primitiveChangeClass(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt arg;
sqInt argClass;
- sqInt argFormat;
- sqInt byteSize;
sqInt ccIndex;
- sqInt ccIndex1;
- sqInt classHdr;
sqInt err;
sqInt i;
sqInt oop;
sqInt oop1;
sqInt rcvr;
- sqInt rcvrFormat;
- sqInt sizeHiBits;
/* begin stackObjectValue: */
oop = longAt(GIV(stackPointer) - (0 * BytesPerWord));
@@ -17143,80 +17166,17 @@
if (!(!GIV(primFailCode))) {
return null;
}
- /* begin changeClassOf:toThatOf: */
- VM_LABEL(0changeClassOftoThatOf);
- /* begin fetchClassOf: */
- if ((arg & 1)) {
- argClass = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassInteger << ShiftForWord));
- goto l4;
- }
- if (((ccIndex1 = (((usqInt) (longAt(arg))) >> 12) & 31)) == 0) {
+ /* begin fetchClassOfNonInt: */
+ if (((ccIndex = (((usqInt) (longAt(arg))) >> 12) & 31)) == 0) {
argClass = (longAt(arg - BaseHeaderSize)) & AllButTypeMask;
- goto l4;
+ goto l3;
}
else {
- argClass = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex1 - 1) << ShiftForWord));
- goto l4;
+ argClass = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord));
+ goto l3;
}
-l4: /* end fetchClassOf: */;
-
- /* Low 2 bits are 0 */
- /* Compute the size of instances of the class (used for fixed field classes only) */
-
- classHdr = (longAt((argClass + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1;
- sizeHiBits = ((usqInt) (classHdr & 393216)) >> 9;
- classHdr = classHdr & 131071;
-
- /* size in bytes -- low 2 bits are 0 */
- /* Check the receiver's format against that of the class */
-
- byteSize = (classHdr & SizeMask) + sizeHiBits;
- argFormat = (((usqInt) classHdr) >> 8) & 15;
- rcvrFormat = (((usqInt) (longAt(rcvr))) >> 8) & 15;
- if (!(argFormat == rcvrFormat)) {
- if ((rcvrFormat > 8)
- && (argFormat > 8)) {
- rcvrFormat = rcvrFormat & 12;
- argFormat = argFormat & 12;
- }
- if (!(argFormat == rcvrFormat)) {
- err = PrimErrInappropriate;
- goto l3;
- }
- }
- if (argFormat < 2) {
- if ((byteSize - BaseHeaderSize) != (byteSizeOf(rcvr))) {
- err = PrimErrBadReceiver;
- goto l3;
- }
- }
- else {
- if (argFormat == 3) {
- if ((byteSize - BaseHeaderSize) > (byteSizeOf(rcvr))) {
- err = PrimErrBadReceiver;
- goto l3;
- }
- }
- }
- if (((longAt(rcvr)) & TypeMask) == HeaderTypeShort) {
-
- /* Compact classes. Check if the arg's class is compact and exchange ccIndex */
-
- ccIndex = classHdr & CompactClassMask;
- if (ccIndex == 0) {
- err = PrimErrInappropriate;
- goto l3;
- }
- longAtput(rcvr, ((longAt(rcvr)) & (~CompactClassMask)) | ccIndex);
- }
- else {
- longAtput(rcvr - BaseHeaderSize, argClass | ((longAt(rcvr)) & TypeMask));
- if (rcvr < GIV(youngStart)) {
- possibleRootStoreIntovalue(rcvr, argClass);
- }
- }
- err = 0;
-l3: /* end changeClassOf:toThatOf: */;
+l3: /* end fetchClassOfNonInt: */;
+ err = changeClassOfto(rcvr, argClass);
if (err == 0) {
/* begin flushAtCache */
for (i = 1; i <= AtCacheTotalSize; i += 1) {
@@ -18372,10 +18332,10 @@
/* receiver, argsArray, then method are on top of stack. Execute method
- against receiver and args.
+ against receiver and args. Allow for up to two extra arguments (e.g. for
+ mirror primitives).
Set primitiveFunctionPointer because no cache lookup has been done for the
- method, and
- hence primitiveFunctionPointer is stale. */
+ method, and hence primitiveFunctionPointer is stale. */
static sqInt
primitiveExecuteMethodArgsArray(void)
Modified: branches/Cog/unixbuild/HowToBuild
===================================================================
--- branches/Cog/unixbuild/HowToBuild 2011-06-15 20:55:32 UTC (rev 2427)
+++ branches/Cog/unixbuild/HowToBuild 2011-06-15 21:53:40 UTC (rev 2428)
@@ -37,10 +37,10 @@
3a. For an assert-enabled VM do
- ../../platforms/unix/config/configure --without-vm-display-fbdev --without-npsqueak -prefix=/home/qwaq/qwaqvm/ CFLAGS="-g -O1 -msse2 -D_GNU_SOURCE -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=0" LIBS=-lpthread
+ ../../platforms/unix/config/configure --without-vm-display-fbdev --without-npsqueak CFLAGS="-g -O1 -msse2 -D_GNU_SOURCE -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=0" LIBS=-lpthread
3b. For a full debug VM do
- ../../platforms/unix/config/configure --without-vm-display-fbdev --without-npsqueak -prefix=/home/qwaq/qwaqvm/ CFLAGS="-g3 -msse2 -D_GNU_SOURCE -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=1" LIBS=-lpthread
+ ../../platforms/unix/config/configure --without-vm-display-fbdev --without-npsqueak CFLAGS="-g3 -msse2 -D_GNU_SOURCE -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=1" LIBS=-lpthread
N.B. As of early 2010 the linux pthreads implementation doesn't appear to
provide a way of setting priorities for the default thread scheduling policy
More information about the Vm-dev
mailing list