[Vm-dev] [commit][2797] CogVM source as per VMMaker.oscog-eem.496.

commits at squeakvm.org commits at squeakvm.org
Sat Nov 2 19:45:41 UTC 2013


Revision: 2797
Author:   eliot
Date:     2013-11-02 12:45:39 -0700 (Sat, 02 Nov 2013)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.496.

Improve dead-code elimination to exprs like false or: [false].

Fix nasty bug in MessageNode>>asTranslatorNodeIn: that left
extra arguments in args for ifTrue:, and: et al, and hence confused
the new nilOrBooleanConstantReceiverOf:.

Spur:
Fix global GC bug where stack pages containing marked contexts
were being freed.  Bug was that objects marked in newSpace were
not being unmarked after GC.  Add a DontTenureButDoUnmark
tenuring policy to unmark newSpace objects.
N.B. perhaps this should be used *before* the GC.  But for now, with
no incremental GC, we don't need to.

Fix markAndTraceStackPages: to iterate while next page is untraced
rather than unreached.

Add some frames-on-page printing utilities.

Rescue plugin generation by removing final ^self & computing ret
type in VMPluginCodeGenerator>>compileToTMethodSelector:in:.
Also, checkedDeclarationAt:put:in: needs to look at definingClass's
inst vars for translated plugins.

Modified Paths:
--------------
    branches/Cog/nscogsrc/plugins/AsynchFilePlugin/AsynchFilePlugin.c
    branches/Cog/nscogsrc/plugins/B2DPlugin/B2DPlugin.c
    branches/Cog/nscogsrc/plugins/BMPReadWriterPlugin/BMPReadWriterPlugin.c
    branches/Cog/nscogsrc/plugins/BitBltPlugin/BitBltPlugin.c
    branches/Cog/nscogsrc/plugins/DSAPrims/DSAPrims.c
    branches/Cog/nscogsrc/plugins/FileCopyPlugin/FileCopyPlugin.c
    branches/Cog/nscogsrc/plugins/FilePlugin/FilePlugin.c
    branches/Cog/nscogsrc/plugins/FloatArrayPlugin/FloatArrayPlugin.c
    branches/Cog/nscogsrc/plugins/IA32ABI/IA32ABI.c
    branches/Cog/nscogsrc/plugins/JPEGReadWriter2Plugin/JPEGReadWriter2Plugin.c
    branches/Cog/nscogsrc/plugins/JPEGReaderPlugin/JPEGReaderPlugin.c
    branches/Cog/nscogsrc/plugins/LargeIntegers/LargeIntegers.c
    branches/Cog/nscogsrc/plugins/Matrix2x3Plugin/Matrix2x3Plugin.c
    branches/Cog/nscogsrc/plugins/MiscPrimitivePlugin/MiscPrimitivePlugin.c
    branches/Cog/nscogsrc/plugins/RePlugin/RePlugin.c
    branches/Cog/nscogsrc/plugins/SocketPlugin/SocketPlugin.c
    branches/Cog/nscogsrc/plugins/SoundPlugin/SoundPlugin.c
    branches/Cog/nscogsrc/plugins/UUIDPlugin/UUIDPlugin.c
    branches/Cog/nscogsrc/plugins/UnixOSProcessPlugin/UnixOSProcessPlugin.c
    branches/Cog/nscogsrc/plugins/VMProfileLinuxSupportPlugin/VMProfileLinuxSupportPlugin.c
    branches/Cog/nscogsrc/plugins/Win32OSProcessPlugin/Win32OSProcessPlugin.c
    branches/Cog/nscogsrc/plugins/ZipPlugin/ZipPlugin.c
    branches/Cog/nscogsrc/vm/cogit.c
    branches/Cog/nscogsrc/vm/cogit.h
    branches/Cog/nscogsrc/vm/cogmethod.h
    branches/Cog/nscogsrc/vm/cointerp.c
    branches/Cog/nscogsrc/vm/cointerp.h
    branches/Cog/nscogsrc/vm/gcc3x-cointerp.c
    branches/Cog/nscogsrc/vm/interp.h
    branches/Cog/nscogsrc/vm/vmCallback.h
    branches/Cog/spurstacksrc/vm/gcc3x-interp.c
    branches/Cog/spurstacksrc/vm/interp.c
    branches/Cog/spurstacksrc/vm/interp.h
    branches/Cog/spurstacksrc/vm/vmCallback.h
    branches/Cog/src/plugins/ADPCMCodecPlugin/ADPCMCodecPlugin.c
    branches/Cog/src/plugins/AioPlugin/AioPlugin.c
    branches/Cog/src/plugins/AsynchFilePlugin/AsynchFilePlugin.c
    branches/Cog/src/plugins/B2DPlugin/B2DPlugin.c
    branches/Cog/src/plugins/BMPReadWriterPlugin/BMPReadWriterPlugin.c
    branches/Cog/src/plugins/BitBltPlugin/BitBltPlugin.c
    branches/Cog/src/plugins/BochsIA32Plugin/BochsIA32Plugin.c
    branches/Cog/src/plugins/CroquetPlugin/CroquetPlugin.c
    branches/Cog/src/plugins/DSAPrims/DSAPrims.c
    branches/Cog/src/plugins/FT2Plugin/FT2Plugin.c
    branches/Cog/src/plugins/FileCopyPlugin/FileCopyPlugin.c
    branches/Cog/src/plugins/FilePlugin/FilePlugin.c
    branches/Cog/src/plugins/FloatArrayPlugin/FloatArrayPlugin.c
    branches/Cog/src/plugins/GeniePlugin/GeniePlugin.c
    branches/Cog/src/plugins/HostWindowPlugin/HostWindowPlugin.c
    branches/Cog/src/plugins/IA32ABI/IA32ABI.c
    branches/Cog/src/plugins/InternetConfigPlugin/InternetConfigPlugin.c
    branches/Cog/src/plugins/JPEGReadWriter2Plugin/JPEGReadWriter2Plugin.c
    branches/Cog/src/plugins/JPEGReaderPlugin/JPEGReaderPlugin.c
    branches/Cog/src/plugins/JoystickTabletPlugin/JoystickTabletPlugin.c
    branches/Cog/src/plugins/Klatt/Klatt.c
    branches/Cog/src/plugins/LargeIntegers/LargeIntegers.c
    branches/Cog/src/plugins/LocalePlugin/LocalePlugin.c
    branches/Cog/src/plugins/MIDIPlugin/MIDIPlugin.c
    branches/Cog/src/plugins/MacMenubarPlugin/MacMenubarPlugin.c
    branches/Cog/src/plugins/Matrix2x3Plugin/Matrix2x3Plugin.c
    branches/Cog/src/plugins/MiscPrimitivePlugin/MiscPrimitivePlugin.c
    branches/Cog/src/plugins/Mpeg3Plugin/Mpeg3Plugin.c
    branches/Cog/src/plugins/QuicktimePlugin/QuicktimePlugin.c
    branches/Cog/src/plugins/RePlugin/RePlugin.c
    branches/Cog/src/plugins/SerialPlugin/SerialPlugin.c
    branches/Cog/src/plugins/SocketPlugin/SocketPlugin.c
    branches/Cog/src/plugins/SoundGenerationPlugin/SoundGenerationPlugin.c
    branches/Cog/src/plugins/SoundPlugin/SoundPlugin.c
    branches/Cog/src/plugins/SqueakFFIPrims/SqueakFFIPrims.c
    branches/Cog/src/plugins/StarSqueakPlugin/StarSqueakPlugin.c
    branches/Cog/src/plugins/UUIDPlugin/UUIDPlugin.c
    branches/Cog/src/plugins/UnixOSProcessPlugin/UnixOSProcessPlugin.c
    branches/Cog/src/plugins/VMProfileLinuxSupportPlugin/VMProfileLinuxSupportPlugin.c
    branches/Cog/src/plugins/Win32OSProcessPlugin/Win32OSProcessPlugin.c
    branches/Cog/src/plugins/ZipPlugin/ZipPlugin.c
    branches/Cog/src/vm/cogit.c
    branches/Cog/src/vm/cogit.h
    branches/Cog/src/vm/cogmethod.h
    branches/Cog/src/vm/cointerp.c
    branches/Cog/src/vm/cointerp.h
    branches/Cog/src/vm/cointerpmt.c
    branches/Cog/src/vm/cointerpmt.h
    branches/Cog/src/vm/gcc3x-cointerp.c
    branches/Cog/src/vm/gcc3x-cointerpmt.c
    branches/Cog/src/vm/interp.h
    branches/Cog/src/vm/vmCallback.h
    branches/Cog/stacksrc/vm/gcc3x-interp.c
    branches/Cog/stacksrc/vm/interp.c
    branches/Cog/stacksrc/vm/interp.h
    branches/Cog/stacksrc/vm/vmCallback.h

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

Modified: branches/Cog/nscogsrc/plugins/AsynchFilePlugin/AsynchFilePlugin.c
===================================================================
--- branches/Cog/nscogsrc/plugins/AsynchFilePlugin/AsynchFilePlugin.c	2013-11-02 02:56:58 UTC (rev 2796)
+++ branches/Cog/nscogsrc/plugins/AsynchFilePlugin/AsynchFilePlugin.c	2013-11-02 19:45:39 UTC (rev 2797)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7
+	SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.496 uuid: f0401045-f2f7-470e-9940-3535be9c0334
    from
-	AsynchFilePlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7
+	AsynchFilePlugin VMMaker.oscog-eem.496 uuid: f0401045-f2f7-470e-9940-3535be9c0334
  */
-static char __buildInfo[] = "AsynchFilePlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7 " __DATE__ ;
+static char __buildInfo[] = "AsynchFilePlugin VMMaker.oscog-eem.496 uuid: f0401045-f2f7-470e-9940-3535be9c0334 " __DATE__ ;
 
 
 
@@ -47,7 +47,7 @@
 EXPORT(const char*) getModuleName(void);
 static sqInt halt(void);
 EXPORT(sqInt) initialiseModule(void);
-EXPORT(void) moduleUnloaded(char *aModuleName);
+EXPORT(sqInt) moduleUnloaded(char *aModuleName);
 static sqInt msg(char *s);
 EXPORT(sqInt) primitiveAsyncFileClose(void);
 EXPORT(sqInt) primitiveAsyncFileOpen(void);
@@ -57,7 +57,7 @@
 EXPORT(sqInt) primitiveAsyncFileWriteStart(void);
 EXPORT(sqInt) setInterpreter(struct VirtualMachine*anInterpreter);
 EXPORT(sqInt) shutdownModule(void);
-static void sqAssert(sqInt aBool);
+static sqInt sqAssert(sqInt aBool);
 
 
 /*** Variables ***/
@@ -98,15 +98,14 @@
 extern sqInt stackIntegerValue(sqInt offset);
 extern sqInt stackValue(sqInt offset);
 extern sqInt success(sqInt aBoolean);
-
 extern
 #endif
 struct VirtualMachine* interpreterProxy;
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"AsynchFilePlugin VMMaker.oscog-eem.235 (i)"
+	"AsynchFilePlugin VMMaker.oscog-eem.496 (i)"
 #else
-	"AsynchFilePlugin VMMaker.oscog-eem.235 (e)"
+	"AsynchFilePlugin VMMaker.oscog-eem.496 (e)"
 #endif
 ;
 static void * sCOAFfn;
@@ -171,7 +170,7 @@
 /*	The module with the given name was just unloaded. 
 	Make sure we have no dangling references. */
 
-EXPORT(void)
+EXPORT(sqInt)
 moduleUnloaded(char *aModuleName)
 {
 	if ((strcmp(aModuleName, "SecurityPlugin")) == 0) {
@@ -450,7 +449,7 @@
 	return asyncFileShutdown();
 }
 
-static void
+static sqInt
 sqAssert(sqInt aBool)
 {
 	/* missing DebugCode */;

Modified: branches/Cog/nscogsrc/plugins/B2DPlugin/B2DPlugin.c
===================================================================
--- branches/Cog/nscogsrc/plugins/B2DPlugin/B2DPlugin.c	2013-11-02 02:56:58 UTC (rev 2796)
+++ branches/Cog/nscogsrc/plugins/B2DPlugin/B2DPlugin.c	2013-11-02 19:45:39 UTC (rev 2797)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	VMPluginCodeGenerator VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9
+	VMPluginCodeGenerator VMMaker.oscog-eem.496 uuid: f0401045-f2f7-470e-9940-3535be9c0334
    from
-	BalloonEnginePlugin VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9
+	BalloonEnginePlugin VMMaker.oscog-eem.496 uuid: f0401045-f2f7-470e-9940-3535be9c0334
  */
-static char __buildInfo[] = "BalloonEnginePlugin VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9 " __DATE__ ;
+static char __buildInfo[] = "BalloonEnginePlugin VMMaker.oscog-eem.496 uuid: f0401045-f2f7-470e-9940-3535be9c0334 " __DATE__ ;
 
 
 
@@ -763,6 +763,7 @@
 static sqInt (*isArray)(sqInt oop);
 static sqInt (*isBytes)(sqInt oop);
 static sqInt (*isFloatObject)(sqInt oop);
+static sqInt (*isImmediate)(sqInt anObject);
 static sqInt (*isIntegerObject)(sqInt objectPointer);
 static sqInt (*isPointers)(sqInt oop);
 static sqInt (*isWords)(sqInt oop);
@@ -804,6 +805,11 @@
 extern sqInt isArray(sqInt oop);
 extern sqInt isBytes(sqInt oop);
 extern sqInt isFloatObject(sqInt oop);
+#if VM_PROXY_MAJOR > 1 || (VM_PROXY_MAJOR == 1 && VM_PROXY_MINOR >= 13)
+extern sqInt isImmediate(sqInt anObject);
+#else
+# define isImmediate(anObject) 0
+#endif
 extern sqInt isIntegerObject(sqInt objectPointer);
 extern sqInt isPointers(sqInt oop);
 extern sqInt isWords(sqInt oop);
@@ -828,16 +834,15 @@
 extern sqInt storeIntegerofObjectwithValue(sqInt index, sqInt oop, sqInt integer);
 extern sqInt storePointerofObjectwithValue(sqInt index, sqInt oop, sqInt valuePointer);
 extern sqInt topRemappableOop(void);
-
 extern
 #endif
 struct VirtualMachine* interpreterProxy;
 static void * loadBBFn;
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"B2DPlugin VMMaker.oscog-eem.307 (i)"
+	"B2DPlugin VMMaker.oscog-eem.496 (i)"
 #else
-	"B2DPlugin VMMaker.oscog-eem.307 (e)"
+	"B2DPlugin VMMaker.oscog-eem.496 (e)"
 #endif
 ;
 static int* objBuffer;
@@ -954,8 +959,8 @@
     sqInt word1;
     sqInt word2;
 
-	word1 = value & 65535;
-	word2 = (((usqInt) value >> 16)) & 255;
+	word1 = value & 0xFFFF;
+	word2 = (((usqInt) value >> 16)) & 0xFF;
 	return ((usqInt) (((((usqInt) (((unsigned) (word1 * word1))) >> 16)) + ((word1 * word2) * 2)) + (((usqInt) (word2 * word2) << 16))) >> 8);
 }
 
@@ -1602,8 +1607,8 @@
 	if (bmDepth == 32) {
 		value = (((int*) bits))[(bmRaster * yp) + xp];
 		if ((value != 0)
-		 && ((value & 4278190080UL) == 0)) {
-			value = value | 4278190080UL;
+		 && ((value & 0xFF000000UL) == 0)) {
+			value = value | 0xFF000000UL;
 		}
 		return uncheckedTransformColor(value);
 	}
@@ -1623,13 +1628,13 @@
 		/* Must convert by expanding bits */
 
 		if (!(value == 0)) {
-			b = (value & 31) << 3;
+			b = (value & 0x1F) << 3;
 			b += ((usqInt) b) >> 5;
-			g = ((((usqInt) value) >> 5) & 31) << 3;
+			g = ((((usqInt) value) >> 5) & 0x1F) << 3;
 			g += ((usqInt) g) >> 5;
-			r = ((((usqInt) value) >> 10) & 31) << 3;
+			r = ((((usqInt) value) >> 10) & 0x1F) << 3;
 			r += ((usqInt) r) >> 5;
-			a = 255;
+			a = 0xFF;
 			value = ((b + (g << 8)) + (r << 16)) + (a << 24);
 		}
 	}
@@ -1751,7 +1756,7 @@
 	nFills = 0;
 	for (i = 0; i <= (length - 1); i += 1) {
 		runLength = ((usqInt) ((((int *) fillPtr))[i]) >> 16);
-		runValue = ((((int *) fillPtr))[i]) & 65535;
+		runValue = ((((int *) fillPtr))[i]) & 0xFFFF;
 		if (!((runValue >= 0)
 			 && (runValue <= maxIndex))) {
 			return 0;
@@ -2957,8 +2962,8 @@
 			if (bmDepth == 32) {
 				value = (((int*) bits))[(bmRaster * yp) + xp];
 				if ((value != 0)
-				 && ((value & 4278190080UL) == 0)) {
-					value = value | 4278190080UL;
+				 && ((value & 0xFF000000UL) == 0)) {
+					value = value | 0xFF000000UL;
 				}
 				fillValue = uncheckedTransformColor(value);
 				goto l3;
@@ -2979,13 +2984,13 @@
 				/* Must convert by expanding bits */
 
 				if (!(value == 0)) {
-					b = (value & 31) << 3;
+					b = (value & 0x1F) << 3;
 					b += ((usqInt) b) >> 5;
-					g = ((((usqInt) value) >> 5) & 31) << 3;
+					g = ((((usqInt) value) >> 5) & 0x1F) << 3;
 					g += ((usqInt) g) >> 5;
-					r = ((((usqInt) value) >> 10) & 31) << 3;
+					r = ((((usqInt) value) >> 10) & 0x1F) << 3;
 					r += ((usqInt) r) >> 5;
-					a = 255;
+					a = 0xFF;
 					value = ((b + (g << 8)) + (r << 16)) + (a << 24);
 				}
 			}
@@ -3081,8 +3086,8 @@
 			if (bmDepth1 == 32) {
 				value1 = (((int*) bits))[(bmRaster1 * yp) + xp];
 				if ((value1 != 0)
-				 && ((value1 & 4278190080UL) == 0)) {
-					value1 = value1 | 4278190080UL;
+				 && ((value1 & 0xFF000000UL) == 0)) {
+					value1 = value1 | 0xFF000000UL;
 				}
 				fillValue = uncheckedTransformColor(value1);
 				goto l6;
@@ -3103,13 +3108,13 @@
 				/* Must convert by expanding bits */
 
 				if (!(value1 == 0)) {
-					b1 = (value1 & 31) << 3;
+					b1 = (value1 & 0x1F) << 3;
 					b1 += ((usqInt) b1) >> 5;
-					g1 = ((((usqInt) value1) >> 5) & 31) << 3;
+					g1 = ((((usqInt) value1) >> 5) & 0x1F) << 3;
 					g1 += ((usqInt) g1) >> 5;
-					r1 = ((((usqInt) value1) >> 10) & 31) << 3;
+					r1 = ((((usqInt) value1) >> 10) & 0x1F) << 3;
 					r1 += ((usqInt) r1) >> 5;
-					a1 = 255;
+					a1 = 0xFF;
 					value1 = ((b1 + (g1 << 8)) + (r1 << 16)) + (a1 << 24);
 				}
 			}
@@ -3205,8 +3210,8 @@
 			if (bmDepth2 == 32) {
 				value2 = (((int*) bits))[(bmRaster2 * yp) + xp];
 				if ((value2 != 0)
-				 && ((value2 & 4278190080UL) == 0)) {
-					value2 = value2 | 4278190080UL;
+				 && ((value2 & 0xFF000000UL) == 0)) {
+					value2 = value2 | 0xFF000000UL;
 				}
 				fillValue = uncheckedTransformColor(value2);
 				goto l9;
@@ -3227,13 +3232,13 @@
 				/* Must convert by expanding bits */
 
 				if (!(value2 == 0)) {
-					b2 = (value2 & 31) << 3;
+					b2 = (value2 & 0x1F) << 3;
 					b2 += ((usqInt) b2) >> 5;
-					g2 = ((((usqInt) value2) >> 5) & 31) << 3;
+					g2 = ((((usqInt) value2) >> 5) & 0x1F) << 3;
 					g2 += ((usqInt) g2) >> 5;
-					r2 = ((((usqInt) value2) >> 10) & 31) << 3;
+					r2 = ((((usqInt) value2) >> 10) & 0x1F) << 3;
 					r2 += ((usqInt) r2) >> 5;
-					a2 = 255;
+					a2 = 0xFF;
 					value2 = ((b2 + (g2 << 8)) + (r2 << 16)) + (a2 << 24);
 				}
 			}
@@ -3437,8 +3442,8 @@
 			if (bmDepth == 32) {
 				value = (((int*) bits))[(bmRaster * yp) + xp];
 				if ((value != 0)
-				 && ((value & 4278190080UL) == 0)) {
-					value = value | 4278190080UL;
+				 && ((value & 0xFF000000UL) == 0)) {
+					value = value | 0xFF000000UL;
 				}
 				fillValue = uncheckedTransformColor(value);
 				goto l3;
@@ -3459,13 +3464,13 @@
 				/* Must convert by expanding bits */
 
 				if (!(value == 0)) {
-					b = (value & 31) << 3;
+					b = (value & 0x1F) << 3;
 					b += ((usqInt) b) >> 5;
-					g = ((((usqInt) value) >> 5) & 31) << 3;
+					g = ((((usqInt) value) >> 5) & 0x1F) << 3;
 					g += ((usqInt) g) >> 5;
-					r = ((((usqInt) value) >> 10) & 31) << 3;
+					r = ((((usqInt) value) >> 10) & 0x1F) << 3;
 					r += ((usqInt) r) >> 5;
-					a = 255;
+					a = 0xFF;
 					value = ((b + (g << 8)) + (r << 16)) + (a << 24);
 				}
 			}
@@ -4614,7 +4619,7 @@
 	if (x0 >= x1) {
 		return 0;
 	}
-	if ((fill & 4278190080UL) != 0) {
+	if ((fill & 0xFF000000UL) != 0) {
 		/* begin fillColorSpan:from:to: */
 		if (!((workBuffer[GWAALevel]) == 1)) {
 			fillColorSpanAAx0x1(fill, x0, x1);
@@ -5479,24 +5484,24 @@
 static sqInt
 isFillColor(sqInt fill)
 {
-	return (fill & 4278190080UL) != 0;
+	return (fill & 0xFF000000UL) != 0;
 }
 
 static sqInt
 isFillOkay(sqInt fill)
 {
 	return (fill == 0)
-	 || (((fill & 4278190080UL) != 0)
+	 || (((fill & 0xFF000000UL) != 0)
 	 || (((fill >= 0)
  && (fill < objUsed))
-	 && (((fill & 4278190080UL) != 0)
+	 && (((fill & 0xFF000000UL) != 0)
 	 || ((((objBuffer[fill + GEObjectType]) & GEPrimitiveTypeMask) & GEPrimitiveFillMask) != 0))));
 }
 
 static sqInt
 isFill(sqInt fill)
 {
-	return ((fill & 4278190080UL) != 0)
+	return ((fill & 0xFF000000UL) != 0)
 	 || ((((objBuffer[fill + GEObjectType]) & GEPrimitiveTypeMask) & GEPrimitiveFillMask) != 0);
 }
 
@@ -6316,9 +6321,9 @@
     float *transform6;
     float *transform7;
     sqInt x;
-    sqInt x0;
-    sqInt x1;
-    sqInt x2;
+    short x0;
+    short x1;
+    short x2;
     sqInt x3;
     sqInt x4;
     sqInt x5;
@@ -6327,9 +6332,9 @@
     sqInt x8;
     sqInt x9;
     sqInt y;
-    sqInt y0;
-    sqInt y1;
-    sqInt y2;
+    short y0;
+    short y1;
+    short y2;
     sqInt y3;
     sqInt y4;
     sqInt y5;
@@ -6355,17 +6360,17 @@
 		/* Load short points */
 
 		/* begin loadPointShortAt:from: */
-		x0 = ((short) ((((short *) points))[index + 0]));
+		x0 = (((short *) points))[index + 0];
 		/* begin loadPointShortAt:from: */
-		y0 = ((short) ((((short *) points))[index + 1]));
+		y0 = (((short *) points))[index + 1];
 		/* begin loadPointShortAt:from: */
-		x1 = ((short) ((((short *) points))[index + 2]));
+		x1 = (((short *) points))[index + 2];
 		/* begin loadPointShortAt:from: */
-		y1 = ((short) ((((short *) points))[index + 3]));
+		y1 = (((short *) points))[index + 3];
 		/* begin loadPointShortAt:from: */
-		x2 = ((short) ((((short *) points))[index + 4]));
+		x2 = (((short *) points))[index + 4];
 		/* begin loadPointShortAt:from: */
-		y2 = ((short) ((((short *) points))[index + 5]));
+		y2 = (((short *) points))[index + 5];
 	}
 	else {
 		x0 = (((int *) points))[index + 0];
@@ -6648,9 +6653,9 @@
     sqInt widthRun;
     sqInt widthValue;
     sqInt x;
-    sqInt x0;
-    sqInt x1;
-    sqInt x2;
+    short x0;
+    short x1;
+    short x2;
     sqInt x3;
     sqInt x4;
     sqInt x5;
@@ -6659,9 +6664,9 @@
     sqInt x8;
     sqInt x9;
     sqInt y;
-    sqInt y0;
-    sqInt y1;
-    sqInt y2;
+    short y0;
+    short y1;
+    short y2;
     sqInt y3;
     sqInt y4;
     sqInt y5;
@@ -6683,7 +6688,7 @@
 		if (((leftLength -= 1)) <= 0) {
 			leftRun += 1;
 			leftLength = ((usqInt) ((((int *) leftFills))[leftRun]) >> 16);
-			leftValue = ((((int *) leftFills))[leftRun]) & 65535;
+			leftValue = ((((int *) leftFills))[leftRun]) & 0xFFFF;
 			if (!(leftValue == 0)) {
 				leftValue = fillIndexList[leftValue - 1];
 				leftValue = transformColor(leftValue);
@@ -6695,7 +6700,7 @@
 		if (((rightLength -= 1)) <= 0) {
 			rightRun += 1;
 			rightLength = ((usqInt) ((((int *) rightFills))[rightRun]) >> 16);
-			rightValue = ((((int *) rightFills))[rightRun]) & 65535;
+			rightValue = ((((int *) rightFills))[rightRun]) & 0xFFFF;
 			if (!(rightValue == 0)) {
 				rightValue = fillIndexList[rightValue - 1];
 				rightValue = transformColor(rightValue);
@@ -6704,7 +6709,7 @@
 		if (((widthLength -= 1)) <= 0) {
 			widthRun += 1;
 			widthLength = ((usqInt) ((((int *) lineWidths))[widthRun]) >> 16);
-			widthValue = ((((int *) lineWidths))[widthRun]) & 65535;
+			widthValue = ((((int *) lineWidths))[widthRun]) & 0xFFFF;
 			if (!(widthValue == 0)) {
 				widthValue = transformWidth(widthValue);
 			}
@@ -6712,7 +6717,7 @@
 		if (((lineFillLength -= 1)) <= 0) {
 			lineFillRun += 1;
 			lineFillLength = ((usqInt) ((((int *) lineFills))[lineFillRun]) >> 16);
-			lineFillValue = ((((int *) lineFills))[lineFillRun]) & 65535;
+			lineFillValue = ((((int *) lineFills))[lineFillRun]) & 0xFFFF;
 			if (!(lineFillValue == 0)) {
 				lineFillValue = fillIndexList[lineFillValue - 1];
 			}
@@ -6733,17 +6738,17 @@
 			/* Load short points */
 
 			/* begin loadPointShortAt:from: */
-			x0 = ((short) ((((short *) points))[index + 0]));
+			x0 = (((short *) points))[index + 0];
 			/* begin loadPointShortAt:from: */
-			y0 = ((short) ((((short *) points))[index + 1]));
+			y0 = (((short *) points))[index + 1];
 			/* begin loadPointShortAt:from: */
-			x1 = ((short) ((((short *) points))[index + 2]));
+			x1 = (((short *) points))[index + 2];
 			/* begin loadPointShortAt:from: */
-			y1 = ((short) ((((short *) points))[index + 3]));
+			y1 = (((short *) points))[index + 3];
 			/* begin loadPointShortAt:from: */
-			x2 = ((short) ((((short *) points))[index + 4]));
+			x2 = (((short *) points))[index + 4];
 			/* begin loadPointShortAt:from: */
-			y2 = ((short) ((((short *) points))[index + 5]));
+			y2 = (((short *) points))[index + 5];
 		}
 		else {
 			x0 = (((int *) points))[index + 0];
@@ -7564,23 +7569,23 @@
     float *transform2;
     float *transform3;
     sqInt x;
-    sqInt x0;
-    sqInt x1;
+    short x0;
+    short x1;
     sqInt x2;
     sqInt x3;
     sqInt x4;
     sqInt y;
-    sqInt y0;
-    sqInt y1;
+    short y0;
+    short y1;
     sqInt y2;
     sqInt y3;
     sqInt y4;
 
 	if (isShort) {
 		/* begin loadPointShortAt:from: */
-		x0 = ((short) ((((short *) points))[0]));
+		x0 = (((short *) points))[0];
 		/* begin loadPointShortAt:from: */
-		y0 = ((short) ((((short *) points))[1]));
+		y0 = (((short *) points))[1];
 	}
 	else {
 		x0 = (((int *) points))[0];
@@ -7589,9 +7594,9 @@
 	for (i = 1; i <= (nPoints - 1); i += 1) {
 		if (isShort) {
 			/* begin loadPointShortAt:from: */
-			x1 = ((short) ((((short *) points))[i * 2]));
+			x1 = (((short *) points))[i * 2];
 			/* begin loadPointShortAt:from: */
-			y1 = ((short) ((((short *) points))[(i * 2) + 1]));
+			y1 = (((short *) points))[(i * 2) + 1];
 		}
 		else {
 			x1 = (((int *) points))[i * 2];
@@ -7793,9 +7798,9 @@
     float *transform6;
     float *transform7;
     sqInt x;
-    sqInt x0;
-    sqInt x1;
-    sqInt x2;
+    short x0;
+    short x1;
+    short x2;
     sqInt x3;
     sqInt x4;
     sqInt x5;
@@ -7804,9 +7809,9 @@
     sqInt x8;
     sqInt x9;
     sqInt y;
-    sqInt y0;
-    sqInt y1;
-    sqInt y2;
+    short y0;
+    short y1;
+    short y2;
     sqInt y3;
     sqInt y4;
     sqInt y5;
@@ -7832,17 +7837,17 @@
 			/* Load short points */
 
 			/* begin loadPointShortAt:from: */
-			x0 = ((short) ((((short *) points))[index + 0]));
+			x0 = (((short *) points))[index + 0];
 			/* begin loadPointShortAt:from: */
-			y0 = ((short) ((((short *) points))[index + 1]));
+			y0 = (((short *) points))[index + 1];
 			/* begin loadPointShortAt:from: */
-			x1 = ((short) ((((short *) points))[index + 2]));
+			x1 = (((short *) points))[index + 2];
 			/* begin loadPointShortAt:from: */
-			y1 = ((short) ((((short *) points))[index + 3]));
+			y1 = (((short *) points))[index + 3];
 			/* begin loadPointShortAt:from: */
-			x2 = ((short) ((((short *) points))[index + 4]));
+			x2 = (((short *) points))[index + 4];
 			/* begin loadPointShortAt:from: */
-			y2 = ((short) ((((short *) points))[index + 5]));
+			y2 = (((short *) points))[index + 5];
 		}
 		else {
 			x0 = (((int *) points))[index + 0];
@@ -8126,7 +8131,7 @@
 	if (transformOop == (nilObject())) {
 		return 0;
 	}
-	if (isIntegerObject(transformOop)) {
+	if (isImmediate(transformOop)) {
 		return primitiveFail();
 	}
 	if (!((slotSizeOf(transformOop)) == n)) {
@@ -8305,7 +8310,7 @@
 static sqInt
 loadWorkBufferFrom(sqInt wbOop)
 {
-	if (isIntegerObject(wbOop)) {
+	if (isImmediate(wbOop)) {
 		return GEFWorkBufferIsInteger;
 	}
 	if (!(isWords(wbOop))) {
@@ -9491,9 +9496,9 @@
     float *transform7;
     sqInt x;
     sqInt x0;
-    sqInt x01;
+    short x01;
     sqInt x1;
-    sqInt x11;
+    short x11;
     sqInt x2;
     sqInt x3;
     sqInt x4;
@@ -9503,9 +9508,9 @@
     sqInt x8;
     sqInt y;
     sqInt y0;
-    sqInt y01;
+    short y01;
     sqInt y1;
-    sqInt y11;
+    short y11;
     sqInt y2;
     sqInt y3;
     sqInt y4;
@@ -9718,9 +9723,9 @@
 		points1 = firstIndexableField(points);
 		if (nPoints == length) {
 			/* begin loadPointShortAt:from: */
-			x01 = ((short) ((((short *) points1))[0]));
+			x01 = (((short *) points1))[0];
 			/* begin loadPointShortAt:from: */
-			y01 = ((short) ((((short *) points1))[1]));
+			y01 = (((short *) points1))[1];
 		}
 		else {
 			x01 = (((int *) points1))[0];
@@ -9729,9 +9734,9 @@
 		for (i1 = 1; i1 <= (nPoints - 1); i1 += 1) {
 			if (nPoints == length) {
 				/* begin loadPointShortAt:from: */
-				x11 = ((short) ((((short *) points1))[i1 * 2]));
+				x11 = (((short *) points1))[i1 * 2];
 				/* begin loadPointShortAt:from: */
-				y11 = ((short) ((((short *) points1))[(i1 * 2) + 1]));
+				y11 = (((short *) points1))[(i1 * 2) + 1];
 			}
 			else {
 				x11 = (((int *) points1))[i1 * 2];
@@ -11431,7 +11436,7 @@
 	if (failed()) {
 		return GEFAlreadyFailed;
 	}
-	if (isIntegerObject(engineOop)) {
+	if (isImmediate(engineOop)) {
 		return GEFEngineIsInteger;
 	}
 	if (!(isPointers(engineOop))) {
@@ -11754,7 +11759,7 @@
 	workBuffer[GWAALevel] = aaLevel;
 	if (aaLevel == 1) {
 		workBuffer[GWAAShift] = 0;
-		workBuffer[GWAAColorMask] = 4294967295UL;
+		workBuffer[GWAAColorMask] = 0xFFFFFFFFUL;
 		workBuffer[GWAAScanMask] = 0;
 	}
 	if (aaLevel == 2) {
@@ -11801,6 +11806,11 @@
 		isArray = interpreterProxy->isArray;
 		isBytes = interpreterProxy->isBytes;
 		isFloatObject = interpreterProxy->isFloatObject;
+#if VM_PROXY_MAJOR > 1 || (VM_PROXY_MAJOR == 1 && VM_PROXY_MINOR >= 13)
+		isImmediate = interpreterProxy->isImmediate;
+#else
+		isImmediate = 0;
+#endif
 		isIntegerObject = interpreterProxy->isIntegerObject;
 		isPointers = interpreterProxy->isPointers;
 		isWords = interpreterProxy->isWords;
@@ -11847,7 +11857,7 @@
 static sqInt
 shortRunValueAtfrom(sqInt i, sqInt runArray)
 {
-	return ((((int *) runArray))[i]) & 65535;
+	return ((((int *) runArray))[i]) & 0xFFFF;
 }
 
 static sqInt
@@ -12085,8 +12095,8 @@
 	}
 	scaledStepSize = 16777216 / maxSteps;
 	/* begin absoluteSquared8Dot24: */
-	word1 = scaledStepSize & 65535;
-	word2 = (((usqInt) scaledStepSize >> 16)) & 255;
+	word1 = scaledStepSize & 0xFFFF;
+	word2 = (((usqInt) scaledStepSize >> 16)) & 0xFF;
 	squaredStepSize = ((usqInt) (((((usqInt) (((unsigned) (word1 * word1))) >> 16)) + ((word1 * word2) * 2)) + (((usqInt) (word2 * word2) << 16))) >> 8);
 	fwDx = fwX1 * scaledStepSize;
 	fwDDx = (fwX2 * squaredStepSize) * 2;
@@ -13007,7 +13017,7 @@
 	if (deltaY < 0) {
 		deltaY = 0 - deltaY;
 	}
-	if (deltaY > 255) {
+	if (deltaY > 0xFF) {
 		workBuffer[GWBezierHeightSubdivisions] = ((workBuffer[GWBezierHeightSubdivisions]) + 1);
 		return computeBezierSplitAtHalf(index);
 	}
@@ -13329,13 +13339,13 @@
     float *transform;
 
 	if (!((fillIndex == 0)
-		 || ((fillIndex & 4278190080UL) != 0))) {
+		 || ((fillIndex & 0xFF000000UL) != 0))) {
 		return fillIndex;
 	}
-	b = fillIndex & 255;
-	g = (((usqInt) fillIndex) >> 8) & 255;
-	r = (((usqInt) fillIndex) >> 16) & 255;
-	a = (((usqInt) fillIndex) >> 24) & 255;
+	b = fillIndex & 0xFF;
+	g = (((usqInt) fillIndex) >> 8) & 0xFF;
+	r = (((usqInt) fillIndex) >> 16) & 0xFF;
+	a = (((usqInt) fillIndex) >> 24) & 0xFF;
 	if ((workBuffer[GWHasColorTransform]) != 0) {
 		/* begin colorTransform */
 		transform = ((float *) (workBuffer + GWColorTransform));
@@ -13345,18 +13355,18 @@
 		b = ((sqInt)(((b * (transform[4])) + (transform[5])) * alphaScale));
 		a = a * alphaScale;
 		r = ((r < 0) ? 0 : r);
-		r = ((r < 255) ? r : 255);
+		r = ((r < 0xFF) ? r : 0xFF);
 		g = ((g < 0) ? 0 : g);
-		g = ((g < 255) ? g : 255);
+		g = ((g < 0xFF) ? g : 0xFF);
 		b = ((b < 0) ? 0 : b);
-		b = ((b < 255) ? b : 255);
+		b = ((b < 0xFF) ? b : 0xFF);
 		a = ((a < 0) ? 0 : a);
-		a = ((a < 255) ? a : 255);
+		a = ((a < 0xFF) ? a : 0xFF);
 	}
 	if (a < 1) {
 		return 0;
 	}
-	if ((a < 255)
+	if ((a < 0xFF)
 	 && ((workBuffer[GWNeedsFlush]) != 0)) {
 		/* begin stopBecauseOf: */
 		workBuffer[GWStopReason] = GErrorNeedFlush;
@@ -13734,10 +13744,10 @@
 	if (!((workBuffer[GWHasColorTransform]) != 0)) {
 		return fillIndex;
 	}
-	b = fillIndex & 255;
-	g = (((usqInt) fillIndex) >> 8) & 255;
-	r = (((usqInt) fillIndex) >> 16) & 255;
-	a = (((usqInt) fillIndex) >> 24) & 255;
+	b = fillIndex & 0xFF;
+	g = (((usqInt) fillIndex) >> 8) & 0xFF;
+	r = (((usqInt) fillIndex) >> 16) & 0xFF;
+	a = (((usqInt) fillIndex) >> 24) & 0xFF;
 	/* begin colorTransform */
 	transform = ((float *) (workBuffer + GWColorTransform));
 	r = ((sqInt)((r * (transform[0])) + (transform[1])));
@@ -13745,13 +13755,13 @@
 	b = ((sqInt)((b * (transform[4])) + (transform[5])));
 	a = ((sqInt)((a * (transform[6])) + (transform[7])));
 	r = ((r < 0) ? 0 : r);
-	r = ((r < 255) ? r : 255);
+	r = ((r < 0xFF) ? r : 0xFF);
 	g = ((g < 0) ? 0 : g);
-	g = ((g < 255) ? g : 255);
+	g = ((g < 0xFF) ? g : 0xFF);
 	b = ((b < 0) ? 0 : b);
-	b = ((b < 255) ? b : 255);
+	b = ((b < 0xFF) ? b : 0xFF);
 	a = ((a < 0) ? 0 : a);
-	a = ((a < 255) ? a : 255);
+	a = ((a < 0xFF) ? a : 0xFF);
 	if (a < 16) {
 		return 0;
 	}

Modified: branches/Cog/nscogsrc/plugins/BMPReadWriterPlugin/BMPReadWriterPlugin.c
===================================================================
--- branches/Cog/nscogsrc/plugins/BMPReadWriterPlugin/BMPReadWriterPlugin.c	2013-11-02 02:56:58 UTC (rev 2796)
+++ branches/Cog/nscogsrc/plugins/BMPReadWriterPlugin/BMPReadWriterPlugin.c	2013-11-02 19:45:39 UTC (rev 2797)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	VMPluginCodeGenerator VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022
+	VMPluginCodeGenerator VMMaker.oscog-eem.496 uuid: f0401045-f2f7-470e-9940-3535be9c0334
    from
-	BMPReadWriterPlugin VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022
+	BMPReadWriterPlugin VMMaker.oscog-eem.496 uuid: f0401045-f2f7-470e-9940-3535be9c0334
  */
-static char __buildInfo[] = "BMPReadWriterPlugin VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022 " __DATE__ ;
+static char __buildInfo[] = "BMPReadWriterPlugin VMMaker.oscog-eem.496 uuid: f0401045-f2f7-470e-9940-3535be9c0334 " __DATE__ ;
 
 
 
@@ -74,15 +74,14 @@
 extern sqInt slotSizeOf(sqInt oop);
 extern sqInt stackIntegerValue(sqInt offset);
 extern sqInt stackObjectValue(sqInt offset);
-
 extern
 #endif
 struct VirtualMachine* interpreterProxy;
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"BMPReadWriterPlugin VMMaker.oscog-eem.246 (i)"
+	"BMPReadWriterPlugin VMMaker.oscog-eem.496 (i)"
 #else
-	"BMPReadWriterPlugin VMMaker.oscog-eem.246 (e)"
+	"BMPReadWriterPlugin VMMaker.oscog-eem.496 (e)"
 #endif
 ;
 
@@ -171,7 +170,7 @@
 		if(rgb) rgb |= 0xFF000000; else rgb |= 0xFF000001;
 		*formBits++ = rgb;
 	}
-	;
+	
 	pop(4);
 }
 
@@ -225,7 +224,7 @@
 		(*pixelLine++) = (rgb >> 16) & 0xFF;
 	}
 
-	;
+	
 	pop(4);
 }
 

Modified: branches/Cog/nscogsrc/plugins/BitBltPlugin/BitBltPlugin.c
===================================================================
--- branches/Cog/nscogsrc/plugins/BitBltPlugin/BitBltPlugin.c	2013-11-02 02:56:58 UTC (rev 2796)
+++ branches/Cog/nscogsrc/plugins/BitBltPlugin/BitBltPlugin.c	2013-11-02 19:45:39 UTC (rev 2797)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.302 uuid: 2ac39432-ac54-4584-964e-b129c90792f4
+	SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.496 uuid: f0401045-f2f7-470e-9940-3535be9c0334
    from
-	BitBltSimulation VMMaker.oscog-eem.302 uuid: 2ac39432-ac54-4584-964e-b129c90792f4
+	BitBltSimulation VMMaker.oscog-eem.496 uuid: f0401045-f2f7-470e-9940-3535be9c0334
  */
-static char __buildInfo[] = "BitBltSimulation VMMaker.oscog-eem.302 uuid: 2ac39432-ac54-4584-964e-b129c90792f4 " __DATE__ ;
+static char __buildInfo[] = "BitBltSimulation VMMaker.oscog-eem.496 uuid: f0401045-f2f7-470e-9940-3535be9c0334 " __DATE__ ;
 
 
 
@@ -89,9 +89,9 @@
 static sqInt alphaBlendScaledwith(sqInt sourceWord, sqInt destinationWord);
 static sqInt alphaBlendwith(sqInt sourceWord, sqInt destinationWord);
 static sqInt alphaPaintConstwith(sqInt sourceWord, sqInt destinationWord);
-static void alphaSourceBlendBits16(void);
-static void alphaSourceBlendBits32(void);
-static void alphaSourceBlendBits8(void);
+static sqInt alphaSourceBlendBits16(void);
+static sqInt alphaSourceBlendBits32(void);
+static sqInt alphaSourceBlendBits8(void);
 static sqInt bitAndInvertwith(sqInt sourceWord, sqInt destinationWord);
 static sqInt bitAndwith(sqInt sourceWord, sqInt destinationWord);
 static sqInt bitInvertAndInvertwith(sqInt sourceWord, sqInt destinationWord);
@@ -104,27 +104,27 @@
 static sqInt bitOrInvertwith(sqInt sourceWord, sqInt destinationWord);
 static sqInt bitOrwith(sqInt sourceWord, sqInt destinationWord);
 static sqInt bitXorwith(sqInt sourceWord, sqInt destinationWord);
-static void checkSourceOverlap(void);
+static sqInt checkSourceOverlap(void);
 static sqInt clearWordwith(sqInt source, sqInt destination);
-static void clipRange(void);
-EXPORT(void) copyBits(void);
-static void copyBitsFastPathSpecialised(void);
-EXPORT(void) copyBitsFromtoat(sqInt startX, sqInt stopX, sqInt yValue);
-static void copyBitsLockedAndClipped(void);
-static void copyBitsRule41Test(void);
+static sqInt clipRange(void);
+EXPORT(sqInt) copyBits(void);
+static sqInt copyBitsFastPathSpecialised(void);
+EXPORT(sqInt) copyBitsFromtoat(sqInt startX, sqInt stopX, sqInt yValue);
+static sqInt copyBitsLockedAndClipped(void);
+static sqInt copyBitsRule41Test(void);
 void copyBitsFallback(operation_t *op, unsigned int flags);
-static void copyLoop(void);
-static void copyLoopNoSource(void);
-static void copyLoopPixMap(void);
+static sqInt copyLoop(void);
+static sqInt copyLoopNoSource(void);
+static sqInt copyLoopPixMap(void);
 static unsigned int * default8To32Table(void);
 static sqInt deltaFromtonSteps(sqInt x1, sqInt x2, sqInt n);
 static sqInt destinationWordwith(sqInt sourceWord, sqInt destinationWord);
-static void destMaskAndPointerInit(void);
+static sqInt destMaskAndPointerInit(void);
 static sqInt dither32To16threshold(sqInt srcWord, sqInt ditherValue);
-static void drawLoopXY(sqInt xDelta, sqInt yDelta);
+static sqInt drawLoopXY(sqInt xDelta, sqInt yDelta);
 static sqInt dstLongAt(sqInt idx);
 static sqInt dstLongAtput(sqInt idx, sqInt value);
-static void dstLongAtputmask(sqInt idx, sqInt srcValue, sqInt dstMask);
+static sqInt dstLongAtputmask(sqInt idx, sqInt srcValue, sqInt dstMask);
 static sqInt expensiveDither32To16threshold(sqInt srcWord, sqInt ditherValue);
 static sqInt fetchIntOrFloatofObject(sqInt fieldIndex, sqInt objectPointer);
 static sqInt fetchIntOrFloatofObjectifNil(sqInt fieldIndex, sqInt objectPointer, sqInt defaultValue);
@@ -134,8 +134,8 @@
 static sqInt halftoneAt(sqInt idx);
 static sqInt halt(void);
 static sqInt ignoreSourceOrHalftone(sqInt formPointer);
-static void initBBOpTable(void);
-static void initDither8Lookup(void);
+static sqInt initBBOpTable(void);
+static sqInt initDither8Lookup(void);
 EXPORT(sqInt) initialiseModule(void);
 static sqInt isIdentityMapwith(int *shifts, unsigned int *masks);
 static sqInt loadBitBltDestForm(void);
@@ -150,7 +150,7 @@
 static sqInt lockSurfaces(void);
 static sqInt mapPixelflags(sqInt sourcePixel, sqInt mapperFlags);
 static sqInt mergewith(sqInt sourceWord, sqInt destinationWord);
-EXPORT(void) moduleUnloaded(char *aModuleName);
+EXPORT(sqInt) moduleUnloaded(char *aModuleName);
 static sqInt msg(char *s);
 static sqInt OLDrgbDiffwith(sqInt sourceWord, sqInt destinationWord);
 static sqInt OLDtallyIntoMapwith(sqInt sourceWord, sqInt destinationWord);
@@ -161,25 +161,25 @@
 static sqInt partitionedMulwithnBitsnPartitions(sqInt word1, sqInt word2, sqInt nBits, sqInt nParts);
 static sqInt partitionedRgbComponentAlphadestnBitsnPartitions(sqInt sourceWord, sqInt destWord, sqInt nBits, sqInt nParts);
 static sqInt partitionedSubfromnBitsnPartitions(unsigned int word1, unsigned int word2, sqInt nBits, sqInt nParts);
-static void performCopyLoop(void);
+static sqInt performCopyLoop(void);
 static sqInt pickSourcePixelsflagssrcMaskdestMasksrcShiftIncdstShiftInc(sqInt nPixels, sqInt mapperFlags, sqInt srcMask, sqInt dstMask, sqInt srcShiftInc, sqInt dstShiftInc);
 static sqInt pickWarpPixelAtXy(sqInt xx, sqInt yy);
 static sqInt pixClearwith(sqInt sourceWord, sqInt destinationWord);
 static sqInt pixMaskwith(sqInt sourceWord, sqInt destinationWord);
 static sqInt pixPaintwith(sqInt sourceWord, sqInt destinationWord);
 static sqInt pixSwapwith(sqInt sourceWord, sqInt destWord);
-EXPORT(void) primitiveCopyBits(void);
-EXPORT(void) primitiveDisplayString(void);
-EXPORT(void) primitiveDrawLoop(void);
+EXPORT(sqInt) primitiveCopyBits(void);
+EXPORT(sqInt) primitiveDisplayString(void);
+EXPORT(sqInt) primitiveDrawLoop(void);
 EXPORT(sqInt) primitivePixelValueAt(void);
-EXPORT(void) primitiveWarpBits(void);
+EXPORT(sqInt) primitiveWarpBits(void);
 static sqInt queryDestSurface(sqInt handle);
 static sqInt querySourceSurface(sqInt handle);
 static sqInt rgbAddwith(sqInt sourceWord, sqInt destinationWord);
-static void rgbComponentAlpha16(void);
-static void rgbComponentAlpha32(void);
+static sqInt rgbComponentAlpha16(void);
+static sqInt rgbComponentAlpha32(void);
 static sqInt rgbComponentAlpha32with(sqInt sourceWord, sqInt destinationWord);
-static void rgbComponentAlpha8(void);
+static sqInt rgbComponentAlpha8(void);
 static sqInt rgbComponentAlphawith(sqInt sourceWord, sqInt destinationWord);
 static sqInt rgbDiffwith(sqInt sourceWord, sqInt destinationWord);
 static sqInt rgbMap16To32(sqInt sourcePixel);
@@ -192,22 +192,22 @@
 static sqInt rgbMulwith(sqInt sourceWord, sqInt destinationWord);
 static sqInt rgbSubwith(sqInt sourceWord, sqInt destinationWord);
 EXPORT(sqInt) setInterpreter(struct VirtualMachine*anInterpreter);
-static void setupColorMasks(void);
-static void setupColorMasksFromto(sqInt srcBits, sqInt targetBits);
-static void showDisplayBits(void);
-static void sourceSkewAndPointerInit(void);
+static sqInt setupColorMasks(void);
+static sqInt setupColorMasksFromto(sqInt srcBits, sqInt targetBits);
+static sqInt showDisplayBits(void);
+static sqInt sourceSkewAndPointerInit(void);
 static sqInt sourceWordwith(sqInt sourceWord, sqInt destinationWord);
-static void sqAssert(sqInt aBool);
+static sqInt sqAssert(sqInt aBool);
 static sqInt srcLongAt(sqInt idx);
 static sqInt subWordwith(sqInt sourceWord, sqInt destinationWord);
 static sqInt tallyIntoMapwith(sqInt sourceWord, sqInt destinationWord);
 static sqInt tallyMapAt(sqInt idx);
 static sqInt tallyMapAtput(sqInt idx, sqInt value);
 static sqInt tryCopyingBitsQuickly(void);
-static void unlockSurfaces(void);
-static void warpBits(void);
-static void warpLoop(void);
-static void warpLoopSetup(void);
+static sqInt unlockSurfaces(void);
+static sqInt warpBits(void);
+static sqInt warpLoop(void);
+static sqInt warpLoopSetup(void);
 static sqInt warpPickSmoothPixelsxDeltahyDeltahxDeltavyDeltavsourceMapsmoothingdstShiftInc(sqInt nPixels, sqInt xDeltah, sqInt yDeltah, sqInt xDeltav, sqInt yDeltav, sqInt sourceMap, sqInt n, sqInt dstShiftInc);
 static sqInt warpPickSourcePixelsxDeltahyDeltahxDeltavyDeltavdstShiftIncflags(sqInt nPixels, sqInt xDeltah, sqInt yDeltah, sqInt xDeltav, sqInt yDeltav, sqInt dstShiftInc, sqInt mapperFlags);
 
@@ -332,7 +332,6 @@
 extern sqInt stackObjectValue(sqInt offset);
 extern sqInt stackValue(sqInt offset);
 extern sqInt storeIntegerofObjectwithValue(sqInt index, sqInt oop, sqInt integer);
-
 extern
 #endif
 struct VirtualMachine* interpreterProxy;
@@ -346,9 +345,9 @@
 };
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"BitBltPlugin VMMaker.oscog-eem.302 (i)"
+	"BitBltPlugin VMMaker.oscog-eem.496 (i)"
 #else
-	"BitBltPlugin VMMaker.oscog-eem.302 (e)"
+	"BitBltPlugin VMMaker.oscog-eem.496 (e)"
 #endif
 ;
 static sqInt noHalftone;
@@ -459,7 +458,7 @@
 	if (destDepth < 16) {
 		return destinationWord;
 	}
-	unAlpha = 255 - sourceAlpha;
+	unAlpha = 0xFF - sourceAlpha;
 	pixMask = maskTable[destDepth];
 	if (destDepth == 16) {
 		bitsPerColor = 5;
@@ -483,7 +482,7 @@
 			result = 0;
 			for (i = 1; i <= 4; i += 1) {
 				shift = (i - 1) * 8;
-				blend = ((((((((usqInt) sourceWord) >> shift) & rgbMask) * sourceAlpha) + (((((usqInt) destinationWord) >> shift) & rgbMask) * unAlpha)) + 254) / 255) & rgbMask;
+				blend = ((((((((usqInt) sourceWord) >> shift) & rgbMask) * sourceAlpha) + (((((usqInt) destinationWord) >> shift) & rgbMask) * unAlpha)) + 0xFE) / 0xFF) & rgbMask;
 				result = result | (blend << shift);
 			}
 		}
@@ -497,7 +496,7 @@
 				pixBlend = 0;
 				for (i = 1; i <= 3; i += 1) {
 					shift = (i - 1) * bitsPerColor;
-					blend = ((((((((usqInt) sourcePixVal) >> shift) & rgbMask) * sourceAlpha) + (((((usqInt) destPixVal) >> shift) & rgbMask) * unAlpha)) + 254) / 255) & rgbMask;
+					blend = ((((((((usqInt) sourcePixVal) >> shift) & rgbMask) * sourceAlpha) + (((((usqInt) destPixVal) >> shift) & rgbMask) * unAlpha)) + 0xFE) / 0xFF) & rgbMask;
 					pixBlend = pixBlend | (blend << shift);
 				}
 				if (destDepth == 16) {
@@ -542,30 +541,30 @@
 
 	/* High 8 bits of source pixel */
 
-	unAlpha = 255 - (((usqInt) sourceWord) >> 24);
+	unAlpha = 0xFF - (((usqInt) sourceWord) >> 24);
 	dstMask = destinationWord;
 	srcMask = sourceWord;
-	b = (((usqInt) ((dstMask & 255) * unAlpha)) >> 8) + (srcMask & 255);
-	if (b > 255) {
-		b = 255;
+	b = (((usqInt) ((dstMask & 0xFF) * unAlpha)) >> 8) + (srcMask & 0xFF);
+	if (b > 0xFF) {
+		b = 0xFF;
 	}
 	dstMask = ((usqInt) dstMask) >> 8;
 	srcMask = ((usqInt) srcMask) >> 8;
-	g = (((usqInt) ((dstMask & 255) * unAlpha)) >> 8) + (srcMask & 255);
-	if (g > 255) {
-		g = 255;
+	g = (((usqInt) ((dstMask & 0xFF) * unAlpha)) >> 8) + (srcMask & 0xFF);
+	if (g > 0xFF) {
+		g = 0xFF;
 	}
 	dstMask = ((usqInt) dstMask) >> 8;
 	srcMask = ((usqInt) srcMask) >> 8;
-	r = (((usqInt) ((dstMask & 255) * unAlpha)) >> 8) + (srcMask & 255);
-	if (r > 255) {
-		r = 255;
+	r = (((usqInt) ((dstMask & 0xFF) * unAlpha)) >> 8) + (srcMask & 0xFF);
+	if (r > 0xFF) {
+		r = 0xFF;
 	}
 	dstMask = ((usqInt) dstMask) >> 8;
 	srcMask = ((usqInt) srcMask) >> 8;
-	a = (((usqInt) ((dstMask & 255) * unAlpha)) >> 8) + (srcMask & 255);
-	if (a > 255) {
-		a = 255;
+	a = (((usqInt) ((dstMask & 0xFF) * unAlpha)) >> 8) + (srcMask & 0xFF);
+	if (a > 0xFF) {
+		a = 0xFF;
 	}
 	return (((((a << 8) + r) << 8) + g) << 8) + b;
 }
@@ -595,35 +594,35 @@
 	if (alpha == 0) {
 		return destinationWord;
 	}
-	if (alpha == 255) {
+	if (alpha == 0xFF) {
 		return sourceWord;
 	}
-	unAlpha = 255 - alpha;
-	colorMask = 255;
+	unAlpha = 0xFF - alpha;
+	colorMask = 0xFF;
 
 	/* red */
 
 	result = 0;
 	shift = 0;
-	blend = ((((((((usqInt) sourceWord) >> shift) & colorMask) * alpha) + (((((usqInt) destinationWord) >> shift) & colorMask) * unAlpha)) + 254) / 255) & colorMask;
+	blend = ((((((((usqInt) sourceWord) >> shift) & colorMask) * alpha) + (((((usqInt) destinationWord) >> shift) & colorMask) * unAlpha)) + 0xFE) / 0xFF) & colorMask;
 
 	/* green */
 
 	result = result | (blend << shift);
 	shift = 8;
-	blend = ((((((((usqInt) sourceWord) >> shift) & colorMask) * alpha) + (((((usqInt) destinationWord) >> shift) & colorMask) * unAlpha)) + 254) / 255) & colorMask;
+	blend = ((((((((usqInt) sourceWord) >> shift) & colorMask) * alpha) + (((((usqInt) destinationWord) >> shift) & colorMask) * unAlpha)) + 0xFE) / 0xFF) & colorMask;
 
 	/* blue */
 
 	result = result | (blend << shift);
 	shift = 16;
-	blend = ((((((((usqInt) sourceWord) >> shift) & colorMask) * alpha) + (((((usqInt) destinationWord) >> shift) & colorMask) * unAlpha)) + 254) / 255) & colorMask;
+	blend = ((((((((usqInt) sourceWord) >> shift) & colorMask) * alpha) + (((((usqInt) destinationWord) >> shift) & colorMask) * unAlpha)) + 0xFE) / 0xFF) & colorMask;
 
 	/* alpha (pre-multiplied) */
 
 	result = result | (blend << shift);
 	shift = 24;
-	blend = ((((alpha * 255) + (((((usqInt) destinationWord) >> shift) & colorMask) * unAlpha)) + 254) / 255) & colorMask;
+	blend = ((((alpha * 0xFF) + (((((usqInt) destinationWord) >> shift) & colorMask) * unAlpha)) + 0xFE) / 0xFF) & colorMask;
 	result = result | (blend << shift);
 	return result;
 }
@@ -645,7 +644,7 @@
 	sourceForm ~= destForm.
 	 */
 
-static void
+static sqInt
 alphaSourceBlendBits16(void)
 {
 	sqInt addThreshold;
@@ -683,7 +682,7 @@
 
 	/* This is the outer loop */
 
-	mask1 = 65535 << (16 - srcShift);
+	mask1 = 0xFFFF << (16 - srcShift);
 	while (((deltaY -= 1)) != 0) {
 		srcIndex = (sourceBits + (srcY * sourcePitch)) + (sx * 4);
 		dstIndex = (destBits + (dstY * destPitch)) + ((((sqInt) dx >> 1)) * 4);
@@ -697,7 +696,7 @@
 
 		deltaX = bbW + 1;
 		dstMask = mask1;
-		if (dstMask == 65535) {
+		if (dstMask == 0xFFFF) {
 			srcShift = 16;
 		}
 		else {
@@ -707,13 +706,13 @@
 			ditherThreshold = ditherMatrix4x4[ditherBase + ((ditherIndex = (ditherIndex + 1) & 3))];
 			sourceWord = long32At(srcIndex);
 			srcAlpha = ((usqInt) sourceWord) >> 24;
-			if (srcAlpha == 255) {
+			if (srcAlpha == 0xFF) {
 
 				/* Dither from 32 to 16 bit */
 
 				/* begin dither32To16:threshold: */
 				addThreshold = ((usqInt) ditherThreshold << 8);
-				sourceWord = ((((usqInt) (dither8Lookup[addThreshold + ((((usqInt) sourceWord >> 16)) & 255)]) << 10)) + (((usqInt) (dither8Lookup[addThreshold + ((((usqInt) sourceWord >> 8)) & 255)]) << 5))) + (dither8Lookup[addThreshold + (sourceWord & 255)]);
+				sourceWord = ((((usqInt) (dither8Lookup[addThreshold + ((((usqInt) sourceWord >> 16)) & 0xFF)]) << 10)) + (((usqInt) (dither8Lookup[addThreshold + ((((usqInt) sourceWord >> 8)) & 0xFF)]) << 5))) + (dither8Lookup[addThreshold + (sourceWord & 0xFF)]);
 				if (sourceWord == 0) {
 					sourceWord = 1 << srcShift;
 				}
@@ -744,14 +743,14 @@
 
 					/* Mix colors */
 
-					destWord = ((((usqInt) (destWord & 31744) << 9)) | (((usqInt) (destWord & 992) << 6))) | ((((usqInt) (destWord & 31) << 3)) | 4278190080UL);
+					destWord = ((((usqInt) (destWord & 0x7C00) << 9)) | (((usqInt) (destWord & 0x3E0) << 6))) | ((((usqInt) (destWord & 0x1F) << 3)) | 0xFF000000UL);
 
 					/* And dither */
 
 					sourceWord = alphaBlendScaledwith(sourceWord, destWord);
 					/* begin dither32To16:threshold: */
 					addThreshold1 = ((usqInt) ditherThreshold << 8);
-					sourceWord = ((((usqInt) (dither8Lookup[addThreshold1 + ((((usqInt) sourceWord >> 16)) & 255)]) << 10)) + (((usqInt) (dither8Lookup[addThreshold1 + ((((usqInt) sourceWord >> 8)) & 255)]) << 5))) + (dither8Lookup[addThreshold1 + (sourceWord & 255)]);
+					sourceWord = ((((usqInt) (dither8Lookup[addThreshold1 + ((((usqInt) sourceWord >> 16)) & 0xFF)]) << 10)) + (((usqInt) (dither8Lookup[addThreshold1 + ((((usqInt) sourceWord >> 8)) & 0xFF)]) << 5))) + (dither8Lookup[addThreshold1 + (sourceWord & 0xFF)]);
 					if (sourceWord == 0) {
 						sourceWord = 1 << srcShift;
 					}
@@ -796,7 +795,7 @@
 	with the special cases of srcAlpha = 0.0 and srcAlpha = 1.0 
 	 */
 
-static void
+static sqInt
 alphaSourceBlendBits32(void)
 {
 	sqInt deltaX;
@@ -838,7 +837,7 @@
 		while (((deltaX -= 1)) != 0) {
 			sourceWord = long32At(srcIndex);
 			srcAlpha = ((usqInt) sourceWord) >> 24;
-			if (srcAlpha == 255) {
+			if (srcAlpha == 0xFF) {
 				long32Atput(dstIndex, sourceWord);
 				srcIndex += 4;
 
@@ -846,7 +845,7 @@
 
 				dstIndex += 4;
 				while ((((deltaX -= 1)) != 0)
-				 && ((((usqInt) ((sourceWord = long32At(srcIndex)))) >> 24) == 255)) {
+				 && ((((usqInt) ((sourceWord = long32At(srcIndex)))) >> 24) == 0xFF)) {
 					long32Atput(dstIndex, sourceWord);
 					srcIndex += 4;
 					dstIndex += 4;
@@ -897,7 +896,7 @@
 	Note: This is not real blending since we don't have the source colors
 	available.  */
 
-static void
+static sqInt
 alphaSourceBlendBits8(void)
 {
 	sqInt adjust;
@@ -916,9 +915,43 @@
 	sqInt srcIndex;
 	sqInt srcShift;
 	sqInt srcY;
+	static unsigned int theTable[256] = { 
+0x0, 0xFF000001, 0xFFFFFFFF, 0xFF808080, 0xFFFF0000, 0xFF00FF00, 0xFF0000FF, 0xFF00FFFF, 
+0xFFFFFF00, 0xFFFF00FF, 0xFF202020, 0xFF404040, 0xFF606060, 0xFF9F9F9F, 0xFFBFBFBF, 0xFFDFDFDF, 
+0xFF080808, 0xFF101010, 0xFF181818, 0xFF282828, 0xFF303030, 0xFF383838, 0xFF484848, 0xFF505050, 
+0xFF585858, 0xFF686868, 0xFF707070, 0xFF787878, 0xFF878787, 0xFF8F8F8F, 0xFF979797, 0xFFA7A7A7, 
+0xFFAFAFAF, 0xFFB7B7B7, 0xFFC7C7C7, 0xFFCFCFCF, 0xFFD7D7D7, 0xFFE7E7E7, 0xFFEFEFEF, 0xFFF7F7F7, 
+0xFF000001, 0xFF003300, 0xFF006600, 0xFF009900, 0xFF00CC00, 0xFF00FF00, 0xFF000033, 0xFF003333, 
+0xFF006633, 0xFF009933, 0xFF00CC33, 0xFF00FF33, 0xFF000066, 0xFF003366, 0xFF006666, 0xFF009966, 
+0xFF00CC66, 0xFF00FF66, 0xFF000099, 0xFF003399, 0xFF006699, 0xFF009999, 0xFF00CC99, 0xFF00FF99, 
+0xFF0000CC, 0xFF0033CC, 0xFF0066CC, 0xFF0099CC, 0xFF00CCCC, 0xFF00FFCC, 0xFF0000FF, 0xFF0033FF, 
+0xFF0066FF, 0xFF0099FF, 0xFF00CCFF, 0xFF00FFFF, 0xFF330000, 0xFF333300, 0xFF336600, 0xFF339900, 
+0xFF33CC00, 0xFF33FF00, 0xFF330033, 0xFF333333, 0xFF336633, 0xFF339933, 0xFF33CC33, 0xFF33FF33, 
+0xFF330066, 0xFF333366, 0xFF336666, 0xFF339966, 0xFF33CC66, 0xFF33FF66, 0xFF330099, 0xFF333399, 
+0xFF336699, 0xFF339999, 0xFF33CC99, 0xFF33FF99, 0xFF3300CC, 0xFF3333CC, 0xFF3366CC, 0xFF3399CC, 
+0xFF33CCCC, 0xFF33FFCC, 0xFF3300FF, 0xFF3333FF, 0xFF3366FF, 0xFF3399FF, 0xFF33CCFF, 0xFF33FFFF, 
+0xFF660000, 0xFF663300, 0xFF666600, 0xFF669900, 0xFF66CC00, 0xFF66FF00, 0xFF660033, 0xFF663333, 
+0xFF666633, 0xFF669933, 0xFF66CC33, 0xFF66FF33, 0xFF660066, 0xFF663366, 0xFF666666, 0xFF669966, 
+0xFF66CC66, 0xFF66FF66, 0xFF660099, 0xFF663399, 0xFF666699, 0xFF669999, 0xFF66CC99, 0xFF66FF99, 
+0xFF6600CC, 0xFF6633CC, 0xFF6666CC, 0xFF6699CC, 0xFF66CCCC, 0xFF66FFCC, 0xFF6600FF, 0xFF6633FF, 
+0xFF6666FF, 0xFF6699FF, 0xFF66CCFF, 0xFF66FFFF, 0xFF990000, 0xFF993300, 0xFF996600, 0xFF999900, 
+0xFF99CC00, 0xFF99FF00, 0xFF990033, 0xFF993333, 0xFF996633, 0xFF999933, 0xFF99CC33, 0xFF99FF33, 
+0xFF990066, 0xFF993366, 0xFF996666, 0xFF999966, 0xFF99CC66, 0xFF99FF66, 0xFF990099, 0xFF993399, 
+0xFF996699, 0xFF999999, 0xFF99CC99, 0xFF99FF99, 0xFF9900CC, 0xFF9933CC, 0xFF9966CC, 0xFF9999CC, 
+0xFF99CCCC, 0xFF99FFCC, 0xFF9900FF, 0xFF9933FF, 0xFF9966FF, 0xFF9999FF, 0xFF99CCFF, 0xFF99FFFF, 
+0xFFCC0000, 0xFFCC3300, 0xFFCC6600, 0xFFCC9900, 0xFFCCCC00, 0xFFCCFF00, 0xFFCC0033, 0xFFCC3333, 
+0xFFCC6633, 0xFFCC9933, 0xFFCCCC33, 0xFFCCFF33, 0xFFCC0066, 0xFFCC3366, 0xFFCC6666, 0xFFCC9966, 
+0xFFCCCC66, 0xFFCCFF66, 0xFFCC0099, 0xFFCC3399, 0xFFCC6699, 0xFFCC9999, 0xFFCCCC99, 0xFFCCFF99, 
+0xFFCC00CC, 0xFFCC33CC, 0xFFCC66CC, 0xFFCC99CC, 0xFFCCCCCC, 0xFFCCFFCC, 0xFFCC00FF, 0xFFCC33FF, 
+0xFFCC66FF, 0xFFCC99FF, 0xFFCCCCFF, 0xFFCCFFFF, 0xFFFF0000, 0xFFFF3300, 0xFFFF6600, 0xFFFF9900, 
+0xFFFFCC00, 0xFFFFFF00, 0xFFFF0033, 0xFFFF3333, 0xFFFF6633, 0xFFFF9933, 0xFFFFCC33, 0xFFFFFF33, 
+0xFFFF0066, 0xFFFF3366, 0xFFFF6666, 0xFFFF9966, 0xFFFFCC66, 0xFFFFFF66, 0xFFFF0099, 0xFFFF3399, 
+0xFFFF6699, 0xFFFF9999, 0xFFFFCC99, 0xFFFFFF99, 0xFFFF00CC, 0xFFFF33CC, 0xFFFF66CC, 0xFFFF99CC, 
+0xFFFFCCCC, 0xFFFFFFCC, 0xFFFF00FF, 0xFFFF33FF, 0xFFFF66FF, 0xFFFF99FF, 0xFFFFCCFF, 0xFFFFFFFF};;
 	sqInt val;
 
-	mappingTable = default8To32Table();
+	/* begin default8To32Table */
+	mappingTable = theTable;
 	mapperFlags = cmFlags & (~ColorMapNewStyle);
 
 	/* So we can pre-decrement */
@@ -930,7 +963,7 @@
 	if (destMSB) {
 		mask1 = 24 - mask1;
 	}
-	mask2 = AllOnes ^ (255 << mask1);
+	mask2 = AllOnes ^ (0xFF << mask1);
 	if ((dx & 1) == 0) {
 		adjust = 0;
 	}
@@ -956,7 +989,7 @@
 		while (((deltaX -= 1)) != 0) {
 			sourceWord = ((long32At(srcIndex)) & (~adjust)) + adjust;
 			srcAlpha = ((usqInt) sourceWord) >> 24;
-			if (srcAlpha > 31) {
+			if (srcAlpha > 0x1F) {
 
 				/* Everything below 31 is transparent */
 
@@ -1004,22 +1037,22 @@
 				if (srcShift == 0) {
 					dstIndex += 4;
 					srcShift = 24;
-					dstMask = 16777215;
+					dstMask = 0xFFFFFF;
 				}
 				else {
 					srcShift -= 8;
-					dstMask = (((usqInt) dstMask) >> 8) | 4278190080UL;
+					dstMask = (((usqInt) dstMask) >> 8) | 0xFF000000UL;
 				}
 			}
 			else {
-				if (srcShift == 32) {
+				if (srcShift == 24) {
 					dstIndex += 4;
 					srcShift = 0;
-					dstMask = 4294967040UL;
+					dstMask = 0xFFFFFF00UL;
 				}
 				else {
 					srcShift += 8;
-					dstMask = (dstMask << 8) | 255;
+					dstMask = (dstMask << 8) | 0xFF;
 				}
 			}
 			adjust = adjust ^ 522133279;
@@ -1105,7 +1138,7 @@
 /*	check for possible overlap of source and destination */
 /*	ar 10/19/1999: This method requires surfaces to be locked. */
 
-static void
+static sqInt
 checkSourceOverlap(void)
 {
 	sqInt t;
@@ -1156,7 +1189,7 @@
 /*	clip and adjust source origin and extent appropriately */
 /*	first in x */
 
-static void
+static sqInt
 clipRange(void)
 {
 	if (destX >= clipX) {
@@ -1186,7 +1219,7 @@
 		bbH -= (dy + bbH) - (clipY + clipHeight);
 	}
 	if (noSource) {
-		return;
+		return null;
 	}
 	if (sx < 0) {
 		dx -= sx;
@@ -1209,7 +1242,7 @@
 
 /*	This function is exported for the Balloon engine */
 
-EXPORT(void)
+EXPORT(sqInt)
 copyBits(void)
 {
 	clipRange();
@@ -1219,10 +1252,10 @@
 		/* zero width or height; noop */
 
 		affectedL = (affectedR = (affectedT = (affectedB = 0)));
-		return;
+		return null;
 	}
 	if (!(lockSurfaces())) {
-		primitiveFail(); return;
+		return primitiveFail();
 	}
 	
 #  if ENABLE_FAST_BLT
@@ -1245,7 +1278,7 @@
 	Assume: Surfaces have been locked and clipping was performed.
  */
 
-static void
+static sqInt
 copyBitsFastPathSpecialised(void)
 {
 	
@@ -1256,21 +1289,21 @@
 	affectedL = (affectedR = (affectedT = (affectedB = 0)));
 	copyBitsRule41Test();
 	if (!(!(failed()))) {
-		primitiveFail(); return;
+		return primitiveFail();
 	}
-	if ((combinationRule == 30) || (combinationRule == 31)) {
+	if ((combinationRule == 30) || (combinationRule == 0x1F)) {
 
 		/* Check and fetch source alpha parameter for alpha blend */
 
 		if ((methodArgumentCount()) == 1) {
 			sourceAlpha = stackIntegerValue(0);
 			if (!((!(failed()))
-				 && ((sourceAlpha >= 0) && (sourceAlpha <= 255)))) {
-				primitiveFail(); return;
+				 && ((sourceAlpha >= 0) && (sourceAlpha <= 0xFF)))) {
+				return primitiveFail();
 			}
 		}
 		else {
-			primitiveFail(); return;
+			return primitiveFail();
 		}
 	}
 	if ((combinationRule != 22) && (combinationRule != 32)) {
@@ -1328,7 +1361,7 @@
 
 /*	Support for the balloon engine. */
 
-EXPORT(void)
+EXPORT(sqInt)
 copyBitsFromtoat(sqInt startX, sqInt stopX, sqInt yValue)
 {
 	destX = startX;
@@ -1344,7 +1377,7 @@
 /*	Perform the actual copyBits operation.
 	Assume: Surfaces have been locked and clipping was performed. */
 
-static void
+static sqInt
 copyBitsLockedAndClipped(void)
 {
 	sqInt done;
@@ -1359,7 +1392,7 @@
 
 	copyBitsRule41Test();
 	if (!(!(failed()))) {
-		primitiveFail(); return;
+		return primitiveFail();
 	}
 	/* begin tryCopyingBitsQuickly */
 	if (noSource) {
@@ -1435,21 +1468,21 @@
 	done = 1;
 l1:	/* end tryCopyingBitsQuickly */;
 	if (done) {
-		return;
+		return null;
 	}
-	if ((combinationRule == 30) || (combinationRule == 31)) {
+	if ((combinationRule == 30) || (combinationRule == 0x1F)) {
 
 		/* Check and fetch source alpha parameter for alpha blend */
 
 		if ((methodArgumentCount()) == 1) {
 			sourceAlpha = stackIntegerValue(0);
 			if (!((!(failed()))
-				 && ((sourceAlpha >= 0) && (sourceAlpha <= 255)))) {
-				primitiveFail(); return;
+				 && ((sourceAlpha >= 0) && (sourceAlpha <= 0xFF)))) {
+				return primitiveFail();
 			}
 		}
 		else {
-			primitiveFail(); return;
+			return primitiveFail();
 		}
 	}
 
@@ -1630,7 +1663,7 @@
 	just set up some variables
  */
 
-static void
+static sqInt
 copyBitsRule41Test(void)
 {
 	sqInt gammaLookupTableOop;
@@ -1640,18 +1673,18 @@
 
 		/* fetch the forecolor into componentAlphaModeColor. */
 
-		componentAlphaModeAlpha = 255;
-		componentAlphaModeColor = 16777215;
+		componentAlphaModeAlpha = 0xFF;
+		componentAlphaModeColor = 0xFFFFFF;
 		gammaLookupTable = null;
 		ungammaLookupTable = null;
 		if ((methodArgumentCount()) >= 2) {
 			componentAlphaModeAlpha = stackIntegerValue((methodArgumentCount()) - 2);
 			if (!(!(failed()))) {
-				primitiveFail(); return;
+				return primitiveFail();
 			}
 			componentAlphaModeColor = stackIntegerValue((methodArgumentCount()) - 1);
 			if (!(!(failed()))) {
-				primitiveFail(); return;
+				return primitiveFail();
 			}
 			if ((methodArgumentCount()) == 4) {
 				gammaLookupTableOop = stackObjectValue(1);
@@ -1668,11 +1701,11 @@
 			if ((methodArgumentCount()) == 1) {
 				componentAlphaModeColor = stackIntegerValue(0);
 				if (!(!(failed()))) {
-					primitiveFail(); return;
+					return primitiveFail();
 				}
 			}
 			else {
-				primitiveFail(); return;
+				return primitiveFail();
 			}
 		}
 	}
@@ -1735,13 +1768,13 @@
 	}
 	destPPW = 32 / destDepth;
 	cmBitsPerColor = 0;
-	if (cmMask == 511) {
+	if (cmMask == 0x1FF) {
 		cmBitsPerColor = 3;
 	}
-	if (cmMask == 4095) {
+	if (cmMask == 0xFFF) {
 		cmBitsPerColor = 4;
 	}
-	if (cmMask == 16383) {
+	if (cmMask == 0x7FFF) {
 		cmBitsPerColor = 5;
 	}
 	/* begin tryCopyingBitsQuickly */
@@ -1977,7 +2010,7 @@
 
 /*	This version of the inner loop assumes noSource = false. */
 
-static void
+static sqInt
 copyLoop(void)
 {
 	sqInt destWord;
@@ -2162,7 +2195,7 @@
 /*	Faster copyLoop when source not used. hDir and vDir are both
 	positive, and perload and skew are unused */
 
-static void
+static sqInt
 copyLoopNoSource(void)
 {

@@ Diff output truncated at 50000 characters. @@


More information about the Vm-dev mailing list