[Vm-dev] [commit][2651] CogVM source as per VMMaker.oscog-eem.246

commits at squeakvm.org commits at squeakvm.org
Thu Jan 3 02:31:11 UTC 2013


Revision: 2651
Author:   eliot
Date:     2013-01-02 18:31:11 -0800 (Wed, 02 Jan 2013)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.246
Integrate changes from VMMaker-dtl.293 which use >> & << shifts
in place of slower bitShift: code in plugins.
Add width failure cases to BMPReadWriterPlugin read & write 24Bmp prims.
Use ClassByteString var in preference to ClassString var.

Modified Paths:
--------------
    branches/Cog/nscogsrc/plugins/BMPReadWriterPlugin/BMPReadWriterPlugin.c
    branches/Cog/nscogsrc/plugins/JPEGReaderPlugin/JPEGReaderPlugin.c
    branches/Cog/nscogsrc/plugins/LargeIntegers/LargeIntegers.c
    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/unix/vm/sqUnixMain.c
    branches/Cog/src/plugins/BMPReadWriterPlugin/BMPReadWriterPlugin.c
    branches/Cog/src/plugins/FFTPlugin/FFTPlugin.c
    branches/Cog/src/plugins/JPEGReaderPlugin/JPEGReaderPlugin.c
    branches/Cog/src/plugins/LargeIntegers/LargeIntegers.c
    branches/Cog/src/plugins/ZipPlugin/ZipPlugin.c
    branches/Cog/src/vm/cointerp.c
    branches/Cog/src/vm/cointerp.h
    branches/Cog/src/vm/cointerpmt.c
    branches/Cog/src/vm/cointerpmt.h
    branches/Cog/src/vm/gcc3x-cointerp.c
    branches/Cog/src/vm/gcc3x-cointerpmt.c
    branches/Cog/src/vm/interp.h
    branches/Cog/src/vm/vmCallback.h
    branches/Cog/unixbuild/HowToBuild

Property Changed:
----------------
    branches/Cog/platforms/Cross/vm/sqSCCSVersion.h

Modified: branches/Cog/nscogsrc/plugins/BMPReadWriterPlugin/BMPReadWriterPlugin.c
===================================================================
--- branches/Cog/nscogsrc/plugins/BMPReadWriterPlugin/BMPReadWriterPlugin.c	2013-01-03 00:56:53 UTC (rev 2650)
+++ branches/Cog/nscogsrc/plugins/BMPReadWriterPlugin/BMPReadWriterPlugin.c	2013-01-03 02:31:11 UTC (rev 2651)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	VMPluginCodeGenerator VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7
+	VMPluginCodeGenerator VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022
    from
-	BMPReadWriterPlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7
+	BMPReadWriterPlugin VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022
  */
-static char __buildInfo[] = "BMPReadWriterPlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7 " __DATE__ ;
+static char __buildInfo[] = "BMPReadWriterPlugin VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022 " __DATE__ ;
 
 
 
@@ -80,9 +80,9 @@
 struct VirtualMachine* interpreterProxy;
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"BMPReadWriterPlugin VMMaker.oscog-eem.235 (i)"
+	"BMPReadWriterPlugin VMMaker.oscog-eem.246 (i)"
 #else
-	"BMPReadWriterPlugin VMMaker.oscog-eem.235 (e)"
+	"BMPReadWriterPlugin VMMaker.oscog-eem.246 (e)"
 #endif
 ;
 
@@ -138,6 +138,9 @@
 		return primitiveFail();
 	}
 	width = stackIntegerValue(0);
+	if (width <= 0) {
+		return primitiveFail();
+	}
 	formBitsIndex = stackIntegerValue(1);
 	formBitsOop = stackObjectValue(2);
 	pixelLineOop = stackObjectValue(3);
@@ -188,6 +191,9 @@
 		return primitiveFail();
 	}
 	width = stackIntegerValue(0);
+	if (width <= 0) {
+		return primitiveFail();
+	}
 	formBitsIndex = stackIntegerValue(1);
 	formBitsOop = stackObjectValue(2);
 	pixelLineOop = stackObjectValue(3);

Modified: branches/Cog/nscogsrc/plugins/JPEGReaderPlugin/JPEGReaderPlugin.c
===================================================================
--- branches/Cog/nscogsrc/plugins/JPEGReaderPlugin/JPEGReaderPlugin.c	2013-01-03 00:56:53 UTC (rev 2650)
+++ branches/Cog/nscogsrc/plugins/JPEGReaderPlugin/JPEGReaderPlugin.c	2013-01-03 02:31:11 UTC (rev 2651)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	VMPluginCodeGenerator VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7
+	VMPluginCodeGenerator VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022
    from
-	JPEGReaderPlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7
+	JPEGReaderPlugin VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022
  */
-static char __buildInfo[] = "JPEGReaderPlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7 " __DATE__ ;
+static char __buildInfo[] = "JPEGReaderPlugin VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022 " __DATE__ ;
 
 
 
@@ -182,9 +182,9 @@
 static sqInt jsReadLimit;
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"JPEGReaderPlugin VMMaker.oscog-eem.235 (i)"
+	"JPEGReaderPlugin VMMaker.oscog-eem.246 (i)"
 #else
-	"JPEGReaderPlugin VMMaker.oscog-eem.235 (e)"
+	"JPEGReaderPlugin VMMaker.oscog-eem.246 (e)"
 #endif
 ;
 static int *residuals;
@@ -458,8 +458,12 @@
 {
     sqInt bits;
     sqInt byte;
+    sqInt byte1;
+    sqInt byte2;
     sqInt i;
     sqInt index;
+    sqInt value;
+    sqInt value1;
     sqInt zeroCount;
 
 	byte = jpegDecodeValueFromsize(dcTable, dcTableSize);
@@ -467,10 +471,46 @@
 		return primitiveFail();
 	}
 	if (byte != 0) {
-		bits = getBits(byte);
+		/* begin getBits: */
+		if (byte > jsBitCount) {
+			/* begin fillBuffer */
+			while (jsBitCount <= 16) {
+				if (!(jsPosition < jsReadLimit)) {
+					jsBitCount;
+					goto l3;
+				}
+				byte1 = jsCollection[jsPosition];
+				jsPosition += 1;
+				if (byte1 == 255) {
+
+					/* peek for 00 */
+
+					if (!((jsPosition < jsReadLimit)
+						 && ((jsCollection[jsPosition]) == 0))) {
+						jsPosition -= 1;
+						jsBitCount;
+						goto l3;
+					}
+					jsPosition += 1;
+				}
+				jsBitBuffer = (((usqInt) jsBitBuffer << 8)) | byte1;
+				jsBitCount += 8;
+			}
+			jsBitCount;
+		l3:	/* end fillBuffer */;
+			if (byte > jsBitCount) {
+				bits = -1;
+				goto l4;
+			}
+		}
+		jsBitCount -= byte;
+		value = ((usqInt) jsBitBuffer) >> jsBitCount;
+		jsBitBuffer = jsBitBuffer & ((1 << jsBitCount) - 1);
+		bits = value;
+	l4:	/* end getBits: */;
 		/* begin scaleAndSignExtend:inFieldWidth: */
-		if (bits < ((((byte - 1) < 0) ? ((usqInt) 1 >> -(byte - 1)) : ((usqInt) 1 << (byte - 1))))) {
-			byte = (bits - (((byte < 0) ? ((usqInt) 1 >> -byte) : ((usqInt) 1 << byte)))) + 1;
+		if (bits < (1 << (byte - 1))) {
+			byte = (bits - (1 << byte)) + 1;
 			goto l1;
 		}
 		else {
@@ -494,10 +534,46 @@
 		byte = byte & 15;
 		if (byte != 0) {
 			index += zeroCount;
-			bits = getBits(byte);
+			/* begin getBits: */
+			if (byte > jsBitCount) {
+				/* begin fillBuffer */
+				while (jsBitCount <= 16) {
+					if (!(jsPosition < jsReadLimit)) {
+						jsBitCount;
+						goto l5;
+					}
+					byte2 = jsCollection[jsPosition];
+					jsPosition += 1;
+					if (byte2 == 255) {
+
+						/* peek for 00 */
+
+						if (!((jsPosition < jsReadLimit)
+							 && ((jsCollection[jsPosition]) == 0))) {
+							jsPosition -= 1;
+							jsBitCount;
+							goto l5;
+						}
+						jsPosition += 1;
+					}
+					jsBitBuffer = (((usqInt) jsBitBuffer << 8)) | byte2;
+					jsBitCount += 8;
+				}
+				jsBitCount;
+			l5:	/* end fillBuffer */;
+				if (byte > jsBitCount) {
+					bits = -1;
+					goto l6;
+				}
+			}
+			jsBitCount -= byte;
+			value1 = ((usqInt) jsBitBuffer) >> jsBitCount;
+			jsBitBuffer = jsBitBuffer & ((1 << jsBitCount) - 1);
+			bits = value1;
+		l6:	/* end getBits: */;
 			/* begin scaleAndSignExtend:inFieldWidth: */
-			if (bits < ((((byte - 1) < 0) ? ((usqInt) 1 >> -(byte - 1)) : ((usqInt) 1 << (byte - 1))))) {
-				byte = (bits - (((byte < 0) ? ((usqInt) 1 >> -byte) : ((usqInt) 1 << byte)))) + 1;
+			if (bits < (1 << (byte - 1))) {
+				byte = (bits - (1 << byte)) + 1;
 				goto l2;
 			}
 			else {
@@ -587,9 +663,9 @@
 			return -1;
 		}
 	}
-	value = (((requestedBits - jsBitCount) < 0) ? ((usqInt) jsBitBuffer >> -(requestedBits - jsBitCount)) : ((usqInt) jsBitBuffer << (requestedBits - jsBitCount)));
-	jsBitBuffer = jsBitBuffer & (((((jsBitCount - requestedBits) < 0) ? ((usqInt) 1 >> -(jsBitCount - requestedBits)) : ((usqInt) 1 << (jsBitCount - requestedBits)))) - 1);
 	jsBitCount -= requestedBits;
+	value = ((usqInt) jsBitBuffer) >> jsBitCount;
+	jsBitBuffer = jsBitBuffer & ((1 << jsBitCount) - 1);
 	return value;
 }
 
@@ -656,7 +732,7 @@
 			}
 		}
 		if (anACTerm == -1) {
-			dcval = ((usqInt) ((anArray[i]) * (qt[0])) << 2);
+			dcval = ((anArray[i]) * (qt[0])) << Pass1Bits;
 			for (j = 0; j <= (DCTSize - 1); j += 1) {
 				ws[(j * DCTSize) + i] = dcval;
 			}
@@ -669,8 +745,8 @@
 			t3 = z1 + (z2 * FIXn0n765366865);
 			z2 = (anArray[i]) * (qt[i]);
 			z3 = (anArray[(DCTSize * 4) + i]) * (qt[(DCTSize * 4) + i]);
-			t0 = ((usqInt) (z2 + z3) << 13);
-			t1 = ((usqInt) (z2 - z3) << 13);
+			t0 = (z2 + z3) << ConstBits;
+			t1 = (z2 - z3) << ConstBits;
 			t10 = t0 + t3;
 			t13 = t0 - t3;
 			t11 = t1 + t2;
@@ -714,8 +790,8 @@
 		z1 = (z2 + z3) * FIXn0n541196100;
 		t2 = z1 + (z3 * (0 - FIXn1n847759065));
 		t3 = z1 + (z2 * FIXn0n765366865);
-		t0 = ((usqInt) ((ws[i]) + (ws[i + 4])) << 13);
-		t1 = ((usqInt) ((ws[i]) - (ws[i + 4])) << 13);
+		t0 = ((ws[i]) + (ws[i + 4])) << ConstBits;
+		t1 = ((ws[i]) - (ws[i + 4])) << ConstBits;
 		t10 = t0 + t3;
 		t13 = t0 - t3;
 		t11 = t1 + t2;
@@ -786,9 +862,11 @@
 {
     sqInt bits;
     sqInt bitsNeeded;
+    sqInt byte;
     sqInt index;
     sqInt tableIndex;
     sqInt value;
+    sqInt value1;
 
 
 	/* Initial bits needed */
@@ -802,10 +880,43 @@
 
 	tableIndex = 2;
 	while (1) {
+		/* begin getBits: */
+		if (bitsNeeded > jsBitCount) {
+			/* begin fillBuffer */
+			while (jsBitCount <= 16) {
+				if (!(jsPosition < jsReadLimit)) {
+					jsBitCount;
+					goto l1;
+				}
+				byte = jsCollection[jsPosition];
+				jsPosition += 1;
+				if (byte == 255) {
 
-		/* Get bits */
+					/* peek for 00 */
 
-		bits = getBits(bitsNeeded);
+					if (!((jsPosition < jsReadLimit)
+						 && ((jsCollection[jsPosition]) == 0))) {
+						jsPosition -= 1;
+						jsBitCount;
+						goto l1;
+					}
+					jsPosition += 1;
+				}
+				jsBitBuffer = (((usqInt) jsBitBuffer << 8)) | byte;
+				jsBitCount += 8;
+			}
+			jsBitCount;
+		l1:	/* end fillBuffer */;
+			if (bitsNeeded > jsBitCount) {
+				bits = -1;
+				goto l2;
+			}
+		}
+		jsBitCount -= bitsNeeded;
+		value1 = ((usqInt) jsBitBuffer) >> jsBitCount;
+		jsBitBuffer = jsBitBuffer & ((1 << jsBitCount) - 1);
+		bits = value1;
+	l2:	/* end getBits: */;
 		if (bits < 0) {
 			return -1;
 		}
@@ -1309,10 +1420,14 @@
     sqInt arrayOop;
     sqInt bits;
     sqInt byte;
+    sqInt byte1;
+    sqInt byte2;
     sqInt i;
     sqInt index;
     sqInt oop;
     sqInt streamOop;
+    sqInt value;
+    sqInt value1;
     sqInt zeroCount;
 
 	;
@@ -1372,17 +1487,53 @@
 		goto l1;
 	}
 	if (byte != 0) {
-		bits = getBits(byte);
+		/* begin getBits: */
+		if (byte > jsBitCount) {
+			/* begin fillBuffer */
+			while (jsBitCount <= 16) {
+				if (!(jsPosition < jsReadLimit)) {
+					jsBitCount;
+					goto l2;
+				}
+				byte1 = jsCollection[jsPosition];
+				jsPosition += 1;
+				if (byte1 == 255) {
+
+					/* peek for 00 */
+
+					if (!((jsPosition < jsReadLimit)
+						 && ((jsCollection[jsPosition]) == 0))) {
+						jsPosition -= 1;
+						jsBitCount;
+						goto l2;
+					}
+					jsPosition += 1;
+				}
+				jsBitBuffer = (((usqInt) jsBitBuffer << 8)) | byte1;
+				jsBitCount += 8;
+			}
+			jsBitCount;
+		l2:	/* end fillBuffer */;
+			if (byte > jsBitCount) {
+				bits = -1;
+				goto l3;
+			}
+		}
+		jsBitCount -= byte;
+		value = ((usqInt) jsBitBuffer) >> jsBitCount;
+		jsBitBuffer = jsBitBuffer & ((1 << jsBitCount) - 1);
+		bits = value;
+	l3:	/* end getBits: */;
 		/* begin scaleAndSignExtend:inFieldWidth: */
-		if (bits < ((((byte - 1) < 0) ? ((usqInt) 1 >> -(byte - 1)) : ((usqInt) 1 << (byte - 1))))) {
-			byte = (bits - (((byte < 0) ? ((usqInt) 1 >> -byte) : ((usqInt) 1 << byte)))) + 1;
-			goto l2;
+		if (bits < (1 << (byte - 1))) {
+			byte = (bits - (1 << byte)) + 1;
+			goto l4;
 		}
 		else {
 			byte = bits;
-			goto l2;
+			goto l4;
 		}
-	l2:	/* end scaleAndSignExtend:inFieldWidth: */;
+	l4:	/* end scaleAndSignExtend:inFieldWidth: */;
 	}
 	byte = yComponent[PriorDCValueIndex] = ((yComponent[PriorDCValueIndex]) + byte);
 	anArray[0] = byte;
@@ -1400,17 +1551,53 @@
 		byte = byte & 15;
 		if (byte != 0) {
 			index += zeroCount;
-			bits = getBits(byte);
+			/* begin getBits: */
+			if (byte > jsBitCount) {
+				/* begin fillBuffer */
+				while (jsBitCount <= 16) {
+					if (!(jsPosition < jsReadLimit)) {
+						jsBitCount;
+						goto l5;
+					}
+					byte2 = jsCollection[jsPosition];
+					jsPosition += 1;
+					if (byte2 == 255) {
+
+						/* peek for 00 */
+
+						if (!((jsPosition < jsReadLimit)
+							 && ((jsCollection[jsPosition]) == 0))) {
+							jsPosition -= 1;
+							jsBitCount;
+							goto l5;
+						}
+						jsPosition += 1;
+					}
+					jsBitBuffer = (((usqInt) jsBitBuffer << 8)) | byte2;
+					jsBitCount += 8;
+				}
+				jsBitCount;
+			l5:	/* end fillBuffer */;
+				if (byte > jsBitCount) {
+					bits = -1;
+					goto l6;
+				}
+			}
+			jsBitCount -= byte;
+			value1 = ((usqInt) jsBitBuffer) >> jsBitCount;
+			jsBitBuffer = jsBitBuffer & ((1 << jsBitCount) - 1);
+			bits = value1;
+		l6:	/* end getBits: */;
 			/* begin scaleAndSignExtend:inFieldWidth: */
-			if (bits < ((((byte - 1) < 0) ? ((usqInt) 1 >> -(byte - 1)) : ((usqInt) 1 << (byte - 1))))) {
-				byte = (bits - (((byte < 0) ? ((usqInt) 1 >> -byte) : ((usqInt) 1 << byte)))) + 1;
-				goto l3;
+			if (bits < (1 << (byte - 1))) {
+				byte = (bits - (1 << byte)) + 1;
+				goto l7;
 			}
 			else {
 				byte = bits;
-				goto l3;
+				goto l7;
 			}
-		l3:	/* end scaleAndSignExtend:inFieldWidth: */;
+		l7:	/* end scaleAndSignExtend:inFieldWidth: */;
 			if ((index < 0)
 			 || (index >= DCTSize2)) {
 				primitiveFail();
@@ -1484,8 +1671,8 @@
 static sqInt
 scaleAndSignExtendinFieldWidth(sqInt aNumber, sqInt w)
 {
-	if (aNumber < ((((w - 1) < 0) ? ((usqInt) 1 >> -(w - 1)) : ((usqInt) 1 << (w - 1))))) {
-		return (aNumber - (((w < 0) ? ((usqInt) 1 >> -w) : ((usqInt) 1 << w)))) + 1;
+	if (aNumber < (1 << (w - 1))) {
+		return (aNumber - (1 << w)) + 1;
 	}
 	else {
 		return aNumber;

Modified: branches/Cog/nscogsrc/plugins/LargeIntegers/LargeIntegers.c
===================================================================
--- branches/Cog/nscogsrc/plugins/LargeIntegers/LargeIntegers.c	2013-01-03 00:56:53 UTC (rev 2650)
+++ branches/Cog/nscogsrc/plugins/LargeIntegers/LargeIntegers.c	2013-01-03 02:31:11 UTC (rev 2651)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7
+	SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022
    from
-	LargeIntegersPlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7
+	LargeIntegersPlugin VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022
  */
-static char __buildInfo[] = "LargeIntegersPlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7 " __DATE__ ;
+static char __buildInfo[] = "LargeIntegersPlugin VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022 " __DATE__ ;
 
 
 
@@ -175,9 +175,9 @@
 struct VirtualMachine* interpreterProxy;
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"LargeIntegers v1.5 VMMaker.oscog-eem.235 (i)"
+	"LargeIntegers v1.5 VMMaker.oscog-eem.246 (i)"
 #else
-	"LargeIntegers v1.5 VMMaker.oscog-eem.235 (e)"
+	"LargeIntegers v1.5 VMMaker.oscog-eem.246 (e)"
 #endif
 ;
 static const int  orOpIndex = 1;
@@ -213,10 +213,10 @@
 	}
 	firstByteIx = (((sqInt) (start - 1) >> 3)) + 1;
 	lastByteIx = (((sqInt) (stop - 1) >> 3)) + 1;
-	rightShift = 0 - ((start - 1) % 8);
+	rightShift = (start - 1) % 8;
 	leftShift = 7 - ((stop - 1) % 8);
 	if (firstByteIx == lastByteIx) {
-		mask = ((((0 - rightShift) < 0) ? ((usqInt) 255 >> -(0 - rightShift)) : ((usqInt) 255 << (0 - rightShift)))) & ((((0 - leftShift) < 0) ? ((usqInt) 255 >> -(0 - leftShift)) : ((usqInt) 255 << (0 - leftShift))));
+		mask = (255 << rightShift) & (((usqInt) 255) >> leftShift);
 		/* begin digitOfBytes:at: */
 		if (firstByteIx > (slotSizeOf(magnitude))) {
 			digit = 0;
@@ -229,7 +229,7 @@
 	l1:	/* end digitOfBytes:at: */;
 		return (digit & mask) != 0;
 	}
-	if ((((rightShift < 0) ? ((usqInt) (digitOfBytesat(magnitude, firstByteIx)) >> -rightShift) : ((usqInt) (digitOfBytesat(magnitude, firstByteIx)) << rightShift))) != 0) {
+	if ((((usqInt) (digitOfBytesat(magnitude, firstByteIx))) >> rightShift) != 0) {
 		return 1;
 	}
 	for (ix = (firstByteIx + 1); ix <= (lastByteIx - 1); ix += 1) {
@@ -237,7 +237,7 @@
 			return 1;
 		}
 	}
-	if (((((leftShift < 0) ? ((usqInt) (digitOfBytesat(magnitude, lastByteIx)) >> -leftShift) : ((usqInt) (digitOfBytesat(magnitude, lastByteIx)) << leftShift))) & 255) != 0) {
+	if ((((digitOfBytesat(magnitude, lastByteIx)) << leftShift) & 255) != 0) {
 		return 1;
 	}
 	return 0;
@@ -932,7 +932,7 @@
 static sqInt
 cDigitOfCSIat(sqInt csi, sqInt ix)
 {
-	if (ix < 0) {
+	if (ix < 1) {
 		primitiveFail();
 	}
 	if (ix > 4) {
@@ -940,10 +940,10 @@
 	}
 	if (csi < 0) {
 		;
-		return (((((1 - ix) * 8) < 0) ? ((usqInt) (0 - csi) >> -((1 - ix) * 8)) : ((usqInt) (0 - csi) << ((1 - ix) * 8)))) & 255;
+		return (((usqInt) (0 - csi)) >> ((ix - 1) * 8)) & 255;
 	}
 	else {
-		return (((((1 - ix) * 8) < 0) ? ((usqInt) csi >> -((1 - ix) * 8)) : ((usqInt) csi << ((1 - ix) * 8)))) & 255;
+		return (((usqInt) csi) >> ((ix - 1) * 8)) & 255;
 	}
 }
 

Modified: branches/Cog/nscogsrc/vm/cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.c	2013-01-03 00:56:53 UTC (rev 2650)
+++ branches/Cog/nscogsrc/vm/cointerp.c	2013-01-03 02:31:11 UTC (rev 2651)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.243 uuid: 72a4a123-e10e-4d32-90dd-0b74014f02d3
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022
    from
-	CoInterpreter VMMaker.oscog-eem.243 uuid: 72a4a123-e10e-4d32-90dd-0b74014f02d3
+	CoInterpreter VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.243 uuid: 72a4a123-e10e-4d32-90dd-0b74014f02d3 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -123,6 +123,7 @@
 #define ClassBlockClosure 36
 #define ClassBlockClosureCompactIndex 0
 #define ClassByteArray 26
+#define ClassByteString 6
 #define ClassByteStringCompactIndex 11
 #define ClassCharacter 19
 #define ClassExternalAddress 43
@@ -143,7 +144,6 @@
 #define ClassMutex 39
 #define ClassPoint 12
 #define ClassSemaphore 18
-#define ClassString 6
 #define ClassUnsafeAlien 54
 #define ClosureFirstCopiedValueIndex 3
 #define ClosureIndex 4
@@ -1928,7 +1928,7 @@
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
 static usqInt heapBase;
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.243";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.246";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -7889,7 +7889,7 @@
 								GIV(primFailCode) = 1;
 							}
 						}
-						shifted = ((integerArgument < 0) ? ((usqInt) integerReceiver >> -integerArgument) : ((usqInt) integerReceiver << integerArgument));
+						shifted = ((usqInt) integerReceiver) >> (0 - integerArgument);
 					}
 				}
 				if (!GIV(primFailCode)) {
@@ -8360,14 +8360,14 @@
 				assert(!((rcvr & 1)));
 				ccIndex = (((usqInt) (longAt(rcvr))) >> 12) & 31;
 				if (ccIndex == 0) {
-					isString = ((longAt(rcvr - BaseHeaderSize)) & AllButTypeMask) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord)));
+					isString = ((longAt(rcvr - BaseHeaderSize)) & AllButTypeMask) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord)));
 					goto l122;
 				}
 				if (ClassByteStringCompactIndex != 0) {
 					isString = ClassByteStringCompactIndex == ccIndex;
 					goto l122;
 				}
-				isString = (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord))) == (longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)));
+				isString = (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord))) == (longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)));
 			l122:	/* end isClassOfNonImm:equalTo:compactClassIndex: */;
 			l120:	/* end is:instanceOf:compactClassIndex: */;
 				if (isString) {
@@ -10657,7 +10657,7 @@
 								GIV(primFailCode) = 1;
 							}
 						}
-						shifted = ((integerArgument < 0) ? ((usqInt) integerReceiver >> -integerArgument) : ((usqInt) integerReceiver << integerArgument));
+						shifted = ((usqInt) integerReceiver) >> (0 - integerArgument);
 					}
 				}
 				if (!GIV(primFailCode)) {
@@ -11128,14 +11128,14 @@
 				assert(!((rcvr & 1)));
 				ccIndex = (((usqInt) (longAt(rcvr))) >> 12) & 31;
 				if (ccIndex == 0) {
-					isString = ((longAt(rcvr - BaseHeaderSize)) & AllButTypeMask) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord)));
+					isString = ((longAt(rcvr - BaseHeaderSize)) & AllButTypeMask) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord)));
 					goto l245;
 				}
 				if (ClassByteStringCompactIndex != 0) {
 					isString = ClassByteStringCompactIndex == ccIndex;
 					goto l245;
 				}
-				isString = (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord))) == (longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)));
+				isString = (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord))) == (longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)));
 			l245:	/* end isClassOfNonImm:equalTo:compactClassIndex: */;
 			l243:	/* end is:instanceOf:compactClassIndex: */;
 				if (isString) {
@@ -16637,7 +16637,7 @@
 sqInt
 classString(void)
 {
-	return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord));
+	return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord));
 }
 
 sqInt
@@ -17632,14 +17632,14 @@
 	assert(!((oop & 1)));
 	ccIndex = (((usqInt) (longAt(oop))) >> 12) & 31;
 	if (ccIndex == 0) {
-		isString = ((longAt(oop - BaseHeaderSize)) & AllButTypeMask) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord)));
+		isString = ((longAt(oop - BaseHeaderSize)) & AllButTypeMask) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord)));
 		goto l3;
 	}
 	if (ClassByteStringCompactIndex != 0) {
 		isString = ClassByteStringCompactIndex == ccIndex;
 		goto l3;
 	}
-	isString = (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord))) == (longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)));
+	isString = (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord))) == (longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)));
 l3:	/* end isClassOfNonImm:equalTo:compactClassIndex: */;
 l1:	/* end is:instanceOf:compactClassIndex: */;
 	if (!isString) {
@@ -30103,7 +30103,7 @@
 					GIV(primFailCode) = 1;
 				}
 			}
-			shifted = ((integerArgument < 0) ? ((usqInt) integerReceiver >> -integerArgument) : ((usqInt) integerReceiver << integerArgument));
+			shifted = ((usqInt) integerReceiver) >> (0 - integerArgument);
 		}
 	}
 	if (!GIV(primFailCode)) {
@@ -30491,7 +30491,7 @@
 			}
 			return;
 		}
-		s = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord)), sz);
+		s = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord)), sz);
 		clipboardReadIntoAt(sz, s + BaseHeaderSize, 0);
 		/* begin pop:thenPush: */
 		longAtput((sp = GIV(stackPointer) + ((1 - 1) * BytesPerWord)), s);
@@ -35664,7 +35664,7 @@
 		sz = attributeSize(attr);
 	}
 	if (!GIV(primFailCode)) {
-		s = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord)), sz);
+		s = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord)), sz);
 		getAttributeIntoLength(attr, s + BaseHeaderSize, sz);
 		/* begin pop:thenPush: */
 		longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), s);
@@ -35698,7 +35698,7 @@
 		return null;
 	}
 	sz = strlen(ptr);
-	stringOop = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord)), sz);
+	stringOop = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord)), sz);
 	for (i = 0; i <= (sz - 1); i += 1) {
 		byteAtput((stringOop + BaseHeaderSize) + i, ptr[i]);
 	}
@@ -35822,7 +35822,7 @@
 		return null;
 	}
 	sz = strlen(ptr);
-	labelOop = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord)), sz);
+	labelOop = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord)), sz);
 	for (i = 0; i <= (sz - 1); i += 1) {
 		byteAtput((labelOop + BaseHeaderSize) + i, ptr[i]);
 	}
@@ -36163,7 +36163,7 @@
 		cl = (((ccIndex = (((usqInt) (longAt(s))) >> 12) & 31)) == 0
 			? (longAt(s - BaseHeaderSize)) & AllButTypeMask
 			: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)));
-		successBoolean = cl == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord)));
+		successBoolean = cl == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord)));
 	l1:	/* end isClassOfNonImm:equalTo: */;
 		if (!successBoolean) {
 
@@ -36183,7 +36183,7 @@
 	}
 	else {
 		sz = imageNameSize();
-		s = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord)), sz);
+		s = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord)), sz);
 		imageNameGetLength(s + BaseHeaderSize, sz);
 		/* begin pop: */
 		GIV(stackPointer) += 1 * BytesPerWord;
@@ -37309,7 +37309,7 @@
 		return;
 	}
 	length = strlen(moduleName);
-	nameOop = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord)), length);
+	nameOop = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord)), length);
 	for (i = 0; i <= (length - 1); i += 1) {
 		byteAtput((nameOop + BaseHeaderSize) + i, moduleName[i]);
 	}
@@ -37375,7 +37375,7 @@
 		return;
 	}
 	length = strlen(moduleName);
-	nameOop = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord)), length);
+	nameOop = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord)), length);
 	for (i = 0; i <= (length - 1); i += 1) {
 		byteAtput((nameOop + BaseHeaderSize) + i, moduleName[i]);
 	}
@@ -43235,7 +43235,7 @@
     sqInt sz;
 
 	sz = vmPathSize();
-	s = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord)), sz);
+	s = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord)), sz);
 	vmPathGetLength(s + BaseHeaderSize, sz);
 	/* begin pop:thenPush: */
 	longAtput((sp = GIV(stackPointer) + ((1 - 1) * BytesPerWord)), s);
@@ -50221,7 +50221,7 @@
     sqInt newString;
 
 	len = strlen(aCString);
-	newString = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord)), len);
+	newString = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord)), len);
 	if (!(newString == null)) {
 		strncpy(arrayValueOf(newString), aCString, len);
 	}

Modified: branches/Cog/nscogsrc/vm/cointerp.h
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.h	2013-01-03 00:56:53 UTC (rev 2650)
+++ branches/Cog/nscogsrc/vm/cointerp.h	2013-01-03 02:31:11 UTC (rev 2651)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.243 uuid: 72a4a123-e10e-4d32-90dd-0b74014f02d3
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022
  */
 
 

Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2013-01-03 00:56:53 UTC (rev 2650)
+++ branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2013-01-03 02:31:11 UTC (rev 2651)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.243 uuid: 72a4a123-e10e-4d32-90dd-0b74014f02d3
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022
    from
-	CoInterpreter VMMaker.oscog-eem.243 uuid: 72a4a123-e10e-4d32-90dd-0b74014f02d3
+	CoInterpreter VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.243 uuid: 72a4a123-e10e-4d32-90dd-0b74014f02d3 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -126,6 +126,7 @@
 #define ClassBlockClosure 36
 #define ClassBlockClosureCompactIndex 0
 #define ClassByteArray 26
+#define ClassByteString 6
 #define ClassByteStringCompactIndex 11
 #define ClassCharacter 19
 #define ClassExternalAddress 43
@@ -146,7 +147,6 @@
 #define ClassMutex 39
 #define ClassPoint 12
 #define ClassSemaphore 18
-#define ClassString 6
 #define ClassUnsafeAlien 54
 #define ClosureFirstCopiedValueIndex 3
 #define ClosureIndex 4
@@ -1931,7 +1931,7 @@
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
 static usqInt heapBase;
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.243";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.246";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -7898,7 +7898,7 @@
 								GIV(primFailCode) = 1;
 							}
 						}
-						shifted = ((integerArgument < 0) ? ((usqInt) integerReceiver >> -integerArgument) : ((usqInt) integerReceiver << integerArgument));
+						shifted = ((usqInt) integerReceiver) >> (0 - integerArgument);
 					}
 				}
 				if (!GIV(primFailCode)) {
@@ -8369,14 +8369,14 @@
 				assert(!((rcvr & 1)));
 				ccIndex = (((usqInt) (longAt(rcvr))) >> 12) & 31;
 				if (ccIndex == 0) {
-					isString = ((longAt(rcvr - BaseHeaderSize)) & AllButTypeMask) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord)));
+					isString = ((longAt(rcvr - BaseHeaderSize)) & AllButTypeMask) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord)));
 					goto l122;
 				}
 				if (ClassByteStringCompactIndex != 0) {
 					isString = ClassByteStringCompactIndex == ccIndex;
 					goto l122;
 				}
-				isString = (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord))) == (longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)));
+				isString = (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord))) == (longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)));
 			l122:	/* end isClassOfNonImm:equalTo:compactClassIndex: */;
 			l120:	/* end is:instanceOf:compactClassIndex: */;
 				if (isString) {
@@ -10666,7 +10666,7 @@
 								GIV(primFailCode) = 1;
 							}
 						}
-						shifted = ((integerArgument < 0) ? ((usqInt) integerReceiver >> -integerArgument) : ((usqInt) integerReceiver << integerArgument));
+						shifted = ((usqInt) integerReceiver) >> (0 - integerArgument);
 					}
 				}
 				if (!GIV(primFailCode)) {
@@ -11137,14 +11137,14 @@
 				assert(!((rcvr & 1)));
 				ccIndex = (((usqInt) (longAt(rcvr))) >> 12) & 31;
 				if (ccIndex == 0) {
-					isString = ((longAt(rcvr - BaseHeaderSize)) & AllButTypeMask) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord)));
+					isString = ((longAt(rcvr - BaseHeaderSize)) & AllButTypeMask) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord)));
 					goto l245;
 				}
 				if (ClassByteStringCompactIndex != 0) {
 					isString = ClassByteStringCompactIndex == ccIndex;
 					goto l245;
 				}
-				isString = (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord))) == (longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)));
+				isString = (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord))) == (longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)));
 			l245:	/* end isClassOfNonImm:equalTo:compactClassIndex: */;
 			l243:	/* end is:instanceOf:compactClassIndex: */;
 				if (isString) {
@@ -16646,7 +16646,7 @@
 sqInt
 classString(void)
 {
-	return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord));
+	return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord));
 }
 
 sqInt
@@ -17641,14 +17641,14 @@
 	assert(!((oop & 1)));
 	ccIndex = (((usqInt) (longAt(oop))) >> 12) & 31;
 	if (ccIndex == 0) {
-		isString = ((longAt(oop - BaseHeaderSize)) & AllButTypeMask) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord)));
+		isString = ((longAt(oop - BaseHeaderSize)) & AllButTypeMask) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord)));
 		goto l3;
 	}
 	if (ClassByteStringCompactIndex != 0) {
 		isString = ClassByteStringCompactIndex == ccIndex;
 		goto l3;
 	}
-	isString = (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord))) == (longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)));
+	isString = (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord))) == (longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)));
 l3:	/* end isClassOfNonImm:equalTo:compactClassIndex: */;
 l1:	/* end is:instanceOf:compactClassIndex: */;
 	if (!isString) {
@@ -30112,7 +30112,7 @@
 					GIV(primFailCode) = 1;
 				}
 			}
-			shifted = ((integerArgument < 0) ? ((usqInt) integerReceiver >> -integerArgument) : ((usqInt) integerReceiver << integerArgument));
+			shifted = ((usqInt) integerReceiver) >> (0 - integerArgument);
 		}
 	}
 	if (!GIV(primFailCode)) {
@@ -30500,7 +30500,7 @@
 			}
 			return;
 		}
-		s = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord)), sz);
+		s = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord)), sz);
 		clipboardReadIntoAt(sz, s + BaseHeaderSize, 0);
 		/* begin pop:thenPush: */
 		longAtput((sp = GIV(stackPointer) + ((1 - 1) * BytesPerWord)), s);
@@ -35673,7 +35673,7 @@
 		sz = attributeSize(attr);
 	}
 	if (!GIV(primFailCode)) {
-		s = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord)), sz);
+		s = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord)), sz);
 		getAttributeIntoLength(attr, s + BaseHeaderSize, sz);
 		/* begin pop:thenPush: */
 		longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), s);
@@ -35707,7 +35707,7 @@
 		return null;
 	}
 	sz = strlen(ptr);
-	stringOop = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord)), sz);
+	stringOop = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord)), sz);
 	for (i = 0; i <= (sz - 1); i += 1) {
 		byteAtput((stringOop + BaseHeaderSize) + i, ptr[i]);
 	}
@@ -35831,7 +35831,7 @@
 		return null;
 	}
 	sz = strlen(ptr);
-	labelOop = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord)), sz);
+	labelOop = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord)), sz);
 	for (i = 0; i <= (sz - 1); i += 1) {
 		byteAtput((labelOop + BaseHeaderSize) + i, ptr[i]);
 	}
@@ -36172,7 +36172,7 @@
 		cl = (((ccIndex = (((usqInt) (longAt(s))) >> 12) & 31)) == 0
 			? (longAt(s - BaseHeaderSize)) & AllButTypeMask
 			: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)));
-		successBoolean = cl == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord)));
+		successBoolean = cl == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord)));
 	l1:	/* end isClassOfNonImm:equalTo: */;
 		if (!successBoolean) {
 
@@ -36192,7 +36192,7 @@
 	}
 	else {
 		sz = imageNameSize();
-		s = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord)), sz);
+		s = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord)), sz);
 		imageNameGetLength(s + BaseHeaderSize, sz);
 		/* begin pop: */
 		GIV(stackPointer) += 1 * BytesPerWord;
@@ -37318,7 +37318,7 @@
 		return;
 	}
 	length = strlen(moduleName);
-	nameOop = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord)), length);
+	nameOop = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord)), length);
 	for (i = 0; i <= (length - 1); i += 1) {
 		byteAtput((nameOop + BaseHeaderSize) + i, moduleName[i]);
 	}
@@ -37384,7 +37384,7 @@
 		return;
 	}
 	length = strlen(moduleName);
-	nameOop = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord)), length);
+	nameOop = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord)), length);
 	for (i = 0; i <= (length - 1); i += 1) {
 		byteAtput((nameOop + BaseHeaderSize) + i, moduleName[i]);
 	}
@@ -43244,7 +43244,7 @@
     sqInt sz;
 
 	sz = vmPathSize();
-	s = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord)), sz);
+	s = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord)), sz);
 	vmPathGetLength(s + BaseHeaderSize, sz);
 	/* begin pop:thenPush: */
 	longAtput((sp = GIV(stackPointer) + ((1 - 1) * BytesPerWord)), s);
@@ -50230,7 +50230,7 @@
     sqInt newString;
 
 	len = strlen(aCString);
-	newString = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassString << ShiftForWord)), len);
+	newString = instantiateClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord)), len);
 	if (!(newString == null)) {
 		strncpy(arrayValueOf(newString), aCString, len);
 	}

Modified: branches/Cog/nscogsrc/vm/interp.h
===================================================================
--- branches/Cog/nscogsrc/vm/interp.h	2013-01-03 00:56:53 UTC (rev 2650)
+++ branches/Cog/nscogsrc/vm/interp.h	2013-01-03 02:31:11 UTC (rev 2651)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.243 uuid: 72a4a123-e10e-4d32-90dd-0b74014f02d3
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022
  */
 
 #define VM_PROXY_MAJOR 1

Modified: branches/Cog/nscogsrc/vm/vmCallback.h
===================================================================
--- branches/Cog/nscogsrc/vm/vmCallback.h	2013-01-03 00:56:53 UTC (rev 2650)
+++ branches/Cog/nscogsrc/vm/vmCallback.h	2013-01-03 02:31:11 UTC (rev 2651)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.243 uuid: 72a4a123-e10e-4d32-90dd-0b74014f02d3
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022
  */
 
 #define VM_CALLBACK_INC 1


Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
___________________________________________________________________
Modified: checkindate
   - Wed Jan  2 12:19:19 PST 2013
   + Wed Jan  2 18:30:24 PST 2013

Modified: branches/Cog/platforms/unix/vm/sqUnixMain.c
===================================================================
--- branches/Cog/platforms/unix/vm/sqUnixMain.c	2013-01-03 00:56:53 UTC (rev 2650)
+++ branches/Cog/platforms/unix/vm/sqUnixMain.c	2013-01-03 02:31:11 UTC (rev 2651)
@@ -819,6 +819,9 @@
 # elif __sun__ && __i386__
       void *fp = (void *)(uap ? uap->uc_mcontext.gregs[REG_FP]: 0);
       void *sp = (void *)(uap ? uap->uc_mcontext.gregs[REG_SP]: 0);
+# elif __x86_64__
+#	error Currently this VM must be build as a 32-bit binary.
+#	error See section 3e in unixbuild/HowToBuild.
 # else
 #	error need to implement extracting pc from a ucontext_t on this system
 # endif

Modified: branches/Cog/src/plugins/BMPReadWriterPlugin/BMPReadWriterPlugin.c
===================================================================
--- branches/Cog/src/plugins/BMPReadWriterPlugin/BMPReadWriterPlugin.c	2013-01-03 00:56:53 UTC (rev 2650)
+++ branches/Cog/src/plugins/BMPReadWriterPlugin/BMPReadWriterPlugin.c	2013-01-03 02:31:11 UTC (rev 2651)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	VMPluginCodeGenerator VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7
+	VMPluginCodeGenerator VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022
    from
-	BMPReadWriterPlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7
+	BMPReadWriterPlugin VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022
  */
-static char __buildInfo[] = "BMPReadWriterPlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7 " __DATE__ ;
+static char __buildInfo[] = "BMPReadWriterPlugin VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022 " __DATE__ ;
 
 
 
@@ -80,9 +80,9 @@
 struct VirtualMachine* interpreterProxy;
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"BMPReadWriterPlugin VMMaker.oscog-eem.235 (i)"
+	"BMPReadWriterPlugin VMMaker.oscog-eem.246 (i)"
 #else
-	"BMPReadWriterPlugin VMMaker.oscog-eem.235 (e)"
+	"BMPReadWriterPlugin VMMaker.oscog-eem.246 (e)"
 #endif
 ;
 
@@ -138,6 +138,9 @@
 		return primitiveFail();
 	}
 	width = stackIntegerValue(0);
+	if (width <= 0) {
+		return primitiveFail();
+	}
 	formBitsIndex = stackIntegerValue(1);
 	formBitsOop = stackObjectValue(2);
 	pixelLineOop = stackObjectValue(3);
@@ -188,6 +191,9 @@
 		return primitiveFail();
 	}
 	width = stackIntegerValue(0);
+	if (width <= 0) {
+		return primitiveFail();
+	}
 	formBitsIndex = stackIntegerValue(1);
 	formBitsOop = stackObjectValue(2);
 	pixelLineOop = stackObjectValue(3);

Modified: branches/Cog/src/plugins/FFTPlugin/FFTPlugin.c
===================================================================
--- branches/Cog/src/plugins/FFTPlugin/FFTPlugin.c	2013-01-03 00:56:53 UTC (rev 2650)
+++ branches/Cog/src/plugins/FFTPlugin/FFTPlugin.c	2013-01-03 02:31:11 UTC (rev 2651)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	VMPluginCodeGenerator VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7
+	VMPluginCodeGenerator VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022
    from
-	FFTPlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7
+	FFTPlugin VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022
  */
-static char __buildInfo[] = "FFTPlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7 " __DATE__ ;
+static char __buildInfo[] = "FFTPlugin VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022 " __DATE__ ;
 
 
 
@@ -95,9 +95,9 @@
 struct VirtualMachine* interpreterProxy;
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"FFTPlugin VMMaker.oscog-eem.235 (i)"
+	"FFTPlugin VMMaker.oscog-eem.246 (i)"
 #else
-	"FFTPlugin VMMaker.oscog-eem.235 (e)"
+	"FFTPlugin VMMaker.oscog-eem.246 (e)"
 #endif
 ;
 static sqInt nu;
@@ -319,7 +319,7 @@
 	fftSize2 = ((sqInt) fftSize >> 1);
 	fftSize4 = ((sqInt) fftSize >> 2);
 	for (level = 1; level <= nu; level += 1) {
-		lev = ((level < 0) ? ((usqInt) 1 >> -level) : ((usqInt) 1 << level));
+		lev = 1 << level;
 		lev1 = ((sqInt) lev >> 1);
 		fftScale = fftSize / lev;
 		for (j = 1; j <= lev1; j += 1) {
@@ -445,7 +445,7 @@
 	fftSize2 = ((sqInt) fftSize >> 1);
 	fftSize4 = ((sqInt) fftSize >> 2);
 	for (level = 1; level <= nu; level += 1) {
-		lev = ((level < 0) ? ((usqInt) 1 >> -level) : ((usqInt) 1 << level));
+		lev = 1 << level;
 		lev1 = ((sqInt) lev >> 1);
 		fftScale = fftSize / lev;
 		for (j = 1; j <= lev1; j += 1) {
@@ -508,7 +508,7 @@
 	fftSize2 = ((sqInt) fftSize >> 1);
 	fftSize4 = ((sqInt) fftSize >> 2);
 	for (level = 1; level <= nu; level += 1) {
-		lev = ((level < 0) ? ((usqInt) 1 >> -level) : ((usqInt) 1 << level));
+		lev = 1 << level;
 		lev1 = ((sqInt) lev >> 1);
 		fftScale = fftSize / lev;
 		for (j = 1; j <= lev1; j += 1) {

Modified: branches/Cog/src/plugins/JPEGReaderPlugin/JPEGReaderPlugin.c
===================================================================
--- branches/Cog/src/plugins/JPEGReaderPlugin/JPEGReaderPlugin.c	2013-01-03 00:56:53 UTC (rev 2650)
+++ branches/Cog/src/plugins/JPEGReaderPlugin/JPEGReaderPlugin.c	2013-01-03 02:31:11 UTC (rev 2651)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	VMPluginCodeGenerator VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7
+	VMPluginCodeGenerator VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022
    from
-	JPEGReaderPlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7
+	JPEGReaderPlugin VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022
  */
-static char __buildInfo[] = "JPEGReaderPlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7 " __DATE__ ;
+static char __buildInfo[] = "JPEGReaderPlugin VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022 " __DATE__ ;
 
 
 
@@ -182,9 +182,9 @@
 static sqInt jsReadLimit;
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"JPEGReaderPlugin VMMaker.oscog-eem.235 (i)"
+	"JPEGReaderPlugin VMMaker.oscog-eem.246 (i)"
 #else
-	"JPEGReaderPlugin VMMaker.oscog-eem.235 (e)"
+	"JPEGReaderPlugin VMMaker.oscog-eem.246 (e)"
 #endif
 ;
 static int *residuals;
@@ -458,8 +458,12 @@
 {
     sqInt bits;
     sqInt byte;
+    sqInt byte1;
+    sqInt byte2;
     sqInt i;
     sqInt index;
+    sqInt value;
+    sqInt value1;
     sqInt zeroCount;
 
 	byte = jpegDecodeValueFromsize(dcTable, dcTableSize);
@@ -467,10 +471,46 @@
 		return primitiveFail();
 	}
 	if (byte != 0) {
-		bits = getBits(byte);
+		/* begin getBits: */
+		if (byte > jsBitCount) {
+			/* begin fillBuffer */
+			while (jsBitCount <= 16) {
+				if (!(jsPosition < jsReadLimit)) {
+					jsBitCount;
+					goto l3;
+				}
+				byte1 = jsCollection[jsPosition];
+				jsPosition += 1;
+				if (byte1 == 255) {
+
+					/* peek for 00 */
+
+					if (!((jsPosition < jsReadLimit)
+						 && ((jsCollection[jsPosition]) == 0))) {
+						jsPosition -= 1;
+						jsBitCount;
+						goto l3;
+					}
+					jsPosition += 1;
+				}
+				jsBitBuffer = (((usqInt) jsBitBuffer << 8)) | byte1;
+				jsBitCount += 8;
+			}
+			jsBitCount;
+		l3:	/* end fillBuffer */;
+			if (byte > jsBitCount) {
+				bits = -1;
+				goto l4;
+			}
+		}
+		jsBitCount -= byte;
+		value = ((usqInt) jsBitBuffer) >> jsBitCount;
+		jsBitBuffer = jsBitBuffer & ((1 << jsBitCount) - 1);
+		bits = value;
+	l4:	/* end getBits: */;
 		/* begin scaleAndSignExtend:inFieldWidth: */
-		if (bits < ((((byte - 1) < 0) ? ((usqInt) 1 >> -(byte - 1)) : ((usqInt) 1 << (byte - 1))))) {
-			byte = (bits - (((byte < 0) ? ((usqInt) 1 >> -byte) : ((usqInt) 1 << byte)))) + 1;
+		if (bits < (1 << (byte - 1))) {
+			byte = (bits - (1 << byte)) + 1;
 			goto l1;
 		}
 		else {
@@ -494,10 +534,46 @@
 		byte = byte & 15;
 		if (byte != 0) {
 			index += zeroCount;
-			bits = getBits(byte);
+			/* begin getBits: */
+			if (byte > jsBitCount) {
+				/* begin fillBuffer */
+				while (jsBitCount <= 16) {
+					if (!(jsPosition < jsReadLimit)) {
+						jsBitCount;
+						goto l5;
+					}
+					byte2 = jsCollection[jsPosition];
+					jsPosition += 1;
+					if (byte2 == 255) {
+
+						/* peek for 00 */
+
+						if (!((jsPosition < jsReadLimit)
+							 && ((jsCollection[jsPosition]) == 0))) {
+							jsPosition -= 1;
+							jsBitCount;
+							goto l5;
+						}
+						jsPosition += 1;
+					}
+					jsBitBuffer = (((usqInt) jsBitBuffer << 8)) | byte2;
+					jsBitCount += 8;
+				}
+				jsBitCount;
+			l5:	/* end fillBuffer */;
+				if (byte > jsBitCount) {
+					bits = -1;
+					goto l6;
+				}
+			}
+			jsBitCount -= byte;
+			value1 = ((usqInt) jsBitBuffer) >> jsBitCount;
+			jsBitBuffer = jsBitBuffer & ((1 << jsBitCount) - 1);
+			bits = value1;
+		l6:	/* end getBits: */;
 			/* begin scaleAndSignExtend:inFieldWidth: */
-			if (bits < ((((byte - 1) < 0) ? ((usqInt) 1 >> -(byte - 1)) : ((usqInt) 1 << (byte - 1))))) {
-				byte = (bits - (((byte < 0) ? ((usqInt) 1 >> -byte) : ((usqInt) 1 << byte)))) + 1;
+			if (bits < (1 << (byte - 1))) {
+				byte = (bits - (1 << byte)) + 1;
 				goto l2;
 			}
 			else {
@@ -587,9 +663,9 @@
 			return -1;
 		}
 	}
-	value = (((requestedBits - jsBitCount) < 0) ? ((usqInt) jsBitBuffer >> -(requestedBits - jsBitCount)) : ((usqInt) jsBitBuffer << (requestedBits - jsBitCount)));
-	jsBitBuffer = jsBitBuffer & (((((jsBitCount - requestedBits) < 0) ? ((usqInt) 1 >> -(jsBitCount - requestedBits)) : ((usqInt) 1 << (jsBitCount - requestedBits)))) - 1);
 	jsBitCount -= requestedBits;
+	value = ((usqInt) jsBitBuffer) >> jsBitCount;
+	jsBitBuffer = jsBitBuffer & ((1 << jsBitCount) - 1);
 	return value;
 }
 
@@ -656,7 +732,7 @@
 			}
 		}
 		if (anACTerm == -1) {
-			dcval = ((usqInt) ((anArray[i]) * (qt[0])) << 2);
+			dcval = ((anArray[i]) * (qt[0])) << Pass1Bits;
 			for (j = 0; j <= (DCTSize - 1); j += 1) {
 				ws[(j * DCTSize) + i] = dcval;
 			}
@@ -669,8 +745,8 @@
 			t3 = z1 + (z2 * FIXn0n765366865);
 			z2 = (anArray[i]) * (qt[i]);
 			z3 = (anArray[(DCTSize * 4) + i]) * (qt[(DCTSize * 4) + i]);
-			t0 = ((usqInt) (z2 + z3) << 13);
-			t1 = ((usqInt) (z2 - z3) << 13);
+			t0 = (z2 + z3) << ConstBits;
+			t1 = (z2 - z3) << ConstBits;
 			t10 = t0 + t3;
 			t13 = t0 - t3;
 			t11 = t1 + t2;
@@ -714,8 +790,8 @@
 		z1 = (z2 + z3) * FIXn0n541196100;
 		t2 = z1 + (z3 * (0 - FIXn1n847759065));
 		t3 = z1 + (z2 * FIXn0n765366865);
-		t0 = ((usqInt) ((ws[i]) + (ws[i + 4])) << 13);
-		t1 = ((usqInt) ((ws[i]) - (ws[i + 4])) << 13);
+		t0 = ((ws[i]) + (ws[i + 4])) << ConstBits;
+		t1 = ((ws[i]) - (ws[i + 4])) << ConstBits;
 		t10 = t0 + t3;
 		t13 = t0 - t3;
 		t11 = t1 + t2;
@@ -786,9 +862,11 @@
 {
     sqInt bits;
     sqInt bitsNeeded;
+    sqInt byte;
     sqInt index;
     sqInt tableIndex;
     sqInt value;
+    sqInt value1;
 
 

@@ Diff output truncated at 50000 characters. @@


More information about the Vm-dev mailing list