[Vm-dev] [commit][2730] CogVM source as per VMMaker.oscog-eem.296.

commits at squeakvm.org commits at squeakvm.org
Thu Jun 6 21:40:57 UTC 2013


Revision: 2730
Author:   eliot
Date:     2013-06-06 14:40:56 -0700 (Thu, 06 Jun 2013)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.296.

Fix bug in eden filling/object overwrite checking.  must use unsigned
vars in the fill loop.

Add a plugin to support the VMProfiler on linux (now Steve Rees
has told us how to get proper thread priorities on newer linuxes).

Clean up some global struct code;
- remove need to build separate sources to accomodate use of global
  register ptr to struct
- clean up recording/testing for use of global struct in methods
- define USE_GLOBAL_STRUCT_REG to use the global struct reg;
  right now machine factors require a different define for each machine/OS.

Use asmLabel: false pragma to stop asm labels being put into floatValueOf and
safeObejctAfter.

Fix mistaken use of MFrameSlots in StackInterpreter>>interpreterAllocationReserveBytes.
Use addressCouldBeObj: in oopHasAcceptableClass:.

Replace broken primitiveUtcWithOffset with a version that works.
Cast primitiveUtcWithOffset in terms of a new ioLocalSecondsOffset.

Add stricter checking code to OSProcessPlugins.

Add SqueakSSL plugin to nsvm plugins.

Change -version output to print if a Production, Debug or Assert VM.

Add builds for the multiple thread priorities linux regime. Fix the Unix
heartbeat initialization code for this regime.

Modified Paths:
--------------
    branches/Cog/cygwinbuild/Makefile
    branches/Cog/cygwinbuild/mvm
    branches/Cog/nscogbuild/unixbuild/astbld/mvm
    branches/Cog/nscogbuild/unixbuild/bld/mvm
    branches/Cog/nscogbuild/unixbuild/dbgbld/mvm
    branches/Cog/nscogsrc/plugins/Win32OSProcessPlugin/Win32OSProcessPlugin.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/Cross/vm/sq.h
    branches/Cog/platforms/Mac OS/vm/sqMacMain.c
    branches/Cog/platforms/unix/vm/sqUnixHeartbeat.c
    branches/Cog/platforms/unix/vm/sqUnixITimerHeartbeat.c
    branches/Cog/platforms/unix/vm/sqUnixITimerTickerHeartbeat.c
    branches/Cog/platforms/unix/vm/sqUnixMain.c
    branches/Cog/platforms/win32/vm/sqWin32Heartbeat.c
    branches/Cog/platforms/win32/vm/sqWin32Intel.c
    branches/Cog/platforms/win32/vm/sqWin32Threads.c
    branches/Cog/platforms/win32/vm/sqWin32VMProfile.c
    branches/Cog/src/plugins/AioPlugin/AioPlugin.c
    branches/Cog/src/plugins/Win32OSProcessPlugin/Win32OSProcessPlugin.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/abld/mvm
    branches/Cog/unixbuild/abld/plugins.int
    branches/Cog/unixbuild/bld/mvm
    branches/Cog/unixbuild/bld/plugins.int
    branches/Cog/unixbuild/dbld/mvm
    branches/Cog/unixbuild/dbld/plugins.int
    branches/Cog/unixbuild/mtbld/mvm
    branches/Cog/unixbuild/mtbld/plugins.int

Added Paths:
-----------
    branches/Cog/nscogsrc/plugins/SqueakSSL/
    branches/Cog/nscogsrc/plugins/SqueakSSL/SqueakSSL.c
    branches/Cog/nscogsrc/plugins/VMProfileLinuxSupportPlugin/
    branches/Cog/nscogsrc/plugins/VMProfileLinuxSupportPlugin/VMProfileLinuxSupportPlugin.c
    branches/Cog/src/plugins/VMProfileLinuxSupportPlugin/
    branches/Cog/src/plugins/VMProfileLinuxSupportPlugin/VMProfileLinuxSupportPlugin.c
    branches/Cog/unixbuild/abldt/
    branches/Cog/unixbuild/abldt/mvm
    branches/Cog/unixbuild/abldt/plugins.ext
    branches/Cog/unixbuild/abldt/plugins.int
    branches/Cog/unixbuild/bldt/
    branches/Cog/unixbuild/bldt/mvm
    branches/Cog/unixbuild/bldt/plugins.ext
    branches/Cog/unixbuild/bldt/plugins.int
    branches/Cog/unixbuild/dbldt/
    branches/Cog/unixbuild/dbldt/mvm
    branches/Cog/unixbuild/dbldt/plugins.ext
    branches/Cog/unixbuild/dbldt/plugins.int

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

Modified: branches/Cog/cygwinbuild/Makefile
===================================================================
--- branches/Cog/cygwinbuild/Makefile	2013-05-08 12:29:55 UTC (rev 2729)
+++ branches/Cog/cygwinbuild/Makefile	2013-06-06 21:40:56 UTC (rev 2730)
@@ -227,6 +227,8 @@
 # Do make init to allow make -n to function.
 init:	$(OBJDIR) eitheror.exe mkNamedPrims.exe
 
+cleanall:	clean cleanmt cleanast cleanmtast cleandbg cleanmtdbg
+
 clean:
 	rm -rf sqNamedPrims.h eitheror.exe mkNamedPrims.exe build
 
@@ -239,6 +241,9 @@
 cleanmtast:
 	rm -rf sqNamedPrims.h eitheror.exe mkNamedPrims.exe buildmtast
 
+cleandbg:
+	rm -rf sqNamedPrims.h eitheror.exe mkNamedPrims.exe builddbg
+
 cleanmtdbg:
 	rm -rf sqNamedPrims.h eitheror.exe mkNamedPrims.exe buildmtdbg
 
@@ -251,6 +256,7 @@
 	@echo CFLAGS=$(CFLAGS)
 	@echo INTERNAL_PLUGINS=$(INTERNAL_PLUGINS)
 	@echo EXTERNAL_PLUGINS=$(EXTERNAL_PLUGINS)
+	@echo OBJDIR=$(OBJDIR)
 	@echo LIBS=$(LIBS)
 	@echo DLLS=$(DLLS)
 	@echo -----------------------------------------------------
@@ -263,6 +269,9 @@
 eitheror.exe: $(WIN32UTILDIR)/eitheror.c
 	$(CC) -o $@ -O1 -mconsole -mno-cygwin $<
 
+mingw32ver.exe: $(WIN32UTILDIR)/mingw32ver.c
+	$(CC) -o $@ -O1 -mconsole -mno-cygwin $<
+
 mkNamedPrims.exe: $(WIN32UTILDIR)/mkNamedPrims.c
 	$(CC) -o $@ -mconsole -mno-cygwin $<
 
@@ -274,7 +283,7 @@
 
 vm:	$(VMEXE)
 
-$(VMEXE): $(VMOBJ) $(LIBS) $(VMEXP) resource.o $(BTOBJ) $(ETOBJ)
+$(VMEXE): $(OBJDIR) $(VMOBJ) $(LIBS) $(VMEXP) resource.o $(BTOBJ) $(ETOBJ)
 	$(CC) -o $(OBJDIR)/version.o $(CFLAGS) $(INCLUDES) $(DEFS) -c $(WIN32DIR)/version.c
 	$(LD) $(LDFLAGS) -o $(VMEXE) \
 			$(BTOBJ) $(VMOBJ) $(VMEXP) $(OBJDIR)/resource.o $(LIBS) $(STDLIBS) $(ETOBJ)

Modified: branches/Cog/cygwinbuild/mvm
===================================================================
--- branches/Cog/cygwinbuild/mvm	2013-05-08 12:29:55 UTC (rev 2729)
+++ branches/Cog/cygwinbuild/mvm	2013-06-06 21:40:56 UTC (rev 2730)
@@ -1,5 +1,5 @@
 #!/bin/sh
-rm -rf build*/vm/Croquet*.exe
+rm -rf build*/vm/Croquet*.exe build*/vm/Squeak*.exe
 make debug;make assert;make
 make THREADING=multi CONFIGURATION=debug;make THREADING=multi CONFIGURATION=assert;make THREADING=multi
 ls -rlt build*/vm/Squeak*.exe

Modified: branches/Cog/nscogbuild/unixbuild/astbld/mvm
===================================================================
--- branches/Cog/nscogbuild/unixbuild/astbld/mvm	2013-05-08 12:29:55 UTC (rev 2729)
+++ branches/Cog/nscogbuild/unixbuild/astbld/mvm	2013-06-06 21:40:56 UTC (rev 2730)
@@ -10,6 +10,7 @@
 esac
 test -f config.h || ../../../platforms/unix/config/configure --with-src=nscogsrc \
 	--without-vm-display-fbdev --without-npsqueak \
+	CC="gcc -m32" \
 	CFLAGS="-g $OPT -msse2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DMULTIPLEBYTECODESETS=1 -DDEBUGVM=0 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer" \
 	LIBS="-lpthread -luuid" \
 	LDFLAGS=-Wl,-z,now

Modified: branches/Cog/nscogbuild/unixbuild/bld/mvm
===================================================================
--- branches/Cog/nscogbuild/unixbuild/bld/mvm	2013-05-08 12:29:55 UTC (rev 2729)
+++ branches/Cog/nscogbuild/unixbuild/bld/mvm	2013-06-06 21:40:56 UTC (rev 2730)
@@ -14,6 +14,7 @@
 esac
 test -f config.h || ../../../platforms/unix/config/configure --with-src=nscogsrc \
 	--without-vm-display-fbdev --without-npsqueak \
+	CC="gcc -m32" \
 	CFLAGS="-g $OPT -msse2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DMULTIPLEBYTECODESETS=1 -DDEBUGVM=0" \
 	LIBS="-lpthread -luuid" \
 	LDFLAGS=-Wl,-z,now

Modified: branches/Cog/nscogbuild/unixbuild/dbgbld/mvm
===================================================================
--- branches/Cog/nscogbuild/unixbuild/dbgbld/mvm	2013-05-08 12:29:55 UTC (rev 2729)
+++ branches/Cog/nscogbuild/unixbuild/dbgbld/mvm	2013-06-06 21:40:56 UTC (rev 2730)
@@ -10,6 +10,7 @@
 esac
 test -f config.h || ../../../platforms/unix/config/configure --with-src=nscogsrc \
 	--without-vm-display-fbdev --without-npsqueak \
+	CC="gcc -m32" \
 	CFLAGS="-g $OPT -msse2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DMULTIPLEBYTECODESETS=1 -DDEBUGVM=1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer" \
 	LIBS="-lpthread -luuid" \
 	LDFLAGS=-Wl,-z,now

Added: branches/Cog/nscogsrc/plugins/SqueakSSL/SqueakSSL.c
===================================================================
--- branches/Cog/nscogsrc/plugins/SqueakSSL/SqueakSSL.c	                        (rev 0)
+++ branches/Cog/nscogsrc/plugins/SqueakSSL/SqueakSSL.c	2013-06-06 21:40:56 UTC (rev 2730)
@@ -0,0 +1,588 @@
+/* Automatically generated by
+	VMPluginCodeGenerator VMMaker.oscog-eem.276 uuid: 52d03a8f-11ec-4454-9c4a-ea1c383f339a
+   from
+	SqueakSSLPlugin SqueakSSL-Plugin-ar.3 uuid: b76dbadd-ee96-5e44-abbb-8a0e3e17240a
+ */
+static char __buildInfo[] = "SqueakSSLPlugin SqueakSSL-Plugin-ar.3 uuid: b76dbadd-ee96-5e44-abbb-8a0e3e17240a " __DATE__ ;
+
+
+
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+/* Default EXPORT macro that does nothing (see comment in sq.h): */
+#define EXPORT(returnType) returnType
+
+/* Do not include the entire sq.h file but just those parts needed. */
+/*  The virtual machine proxy definition */
+#include "sqVirtualMachine.h"
+/* Configuration options */
+#include "sqConfig.h"
+/* Platform specific definitions */
+#include "sqPlatformSpecific.h"
+
+#define true 1
+#define false 0
+#define null 0  /* using 'null' because nil is predefined in Think C */
+#ifdef SQUEAK_BUILTIN_PLUGIN
+#undef EXPORT
+// was #undef EXPORT(returnType) but screws NorCroft cc
+#define EXPORT(returnType) static returnType
+#endif
+
+#include "SqueakSSL.h"
+#include "sqMemoryAccess.h"
+
+
+/*** Constants ***/
+#define BytesPerWord 4
+
+
+/*** Function Prototypes ***/
+static VirtualMachine * getInterpreter(void);
+EXPORT(const char*) getModuleName(void);
+static sqInt halt(void);
+static sqInt msg(char *s);
+EXPORT(sqInt) primitiveAccept(void);
+EXPORT(sqInt) primitiveConnect(void);
+EXPORT(sqInt) primitiveCreate(void);
+EXPORT(sqInt) primitiveDecrypt(void);
+EXPORT(sqInt) primitiveDestroy(void);
+EXPORT(sqInt) primitiveEncrypt(void);
+EXPORT(sqInt) primitiveGetIntProperty(void);
+EXPORT(sqInt) primitiveGetStringProperty(void);
+EXPORT(sqInt) primitiveSetIntProperty(void);
+EXPORT(sqInt) primitiveSetStringProperty(void);
+EXPORT(sqInt) setInterpreter(struct VirtualMachine*anInterpreter);
+
+
+/*** Variables ***/
+
+#if !defined(SQUEAK_BUILTIN_PLUGIN)
+static sqInt (*byteSizeOf)(sqInt oop);
+static sqInt (*classString)(void);
+static sqInt (*failed)(void);
+static void * (*firstIndexableField)(sqInt oop);
+static sqInt (*instantiateClassindexableSize)(sqInt classPointer, sqInt size);
+static sqInt (*isBytes)(sqInt oop);
+static sqInt (*methodArgumentCount)(void);
+static sqInt (*nilObject)(void);
+static sqInt (*pop)(sqInt nItems);
+static sqInt (*popthenPush)(sqInt nItems, sqInt oop);
+static sqInt (*primitiveFail)(void);
+static sqInt (*pushInteger)(sqInt integerValue);
+static sqInt (*signed32BitIntegerFor)(sqInt integerValue);
+static int (*signed32BitValueOf)(sqInt oop);
+static sqInt (*stackIntegerValue)(sqInt offset);
+static sqInt (*stackObjectValue)(sqInt offset);
+static sqInt (*stackValue)(sqInt offset);
+#else /* !defined(SQUEAK_BUILTIN_PLUGIN) */
+extern sqInt byteSizeOf(sqInt oop);
+extern sqInt classString(void);
+extern sqInt failed(void);
+extern void * firstIndexableField(sqInt oop);
+extern sqInt instantiateClassindexableSize(sqInt classPointer, sqInt size);
+extern sqInt isBytes(sqInt oop);
+extern sqInt methodArgumentCount(void);
+extern sqInt nilObject(void);
+extern sqInt pop(sqInt nItems);
+extern sqInt popthenPush(sqInt nItems, sqInt oop);
+extern sqInt primitiveFail(void);
+extern sqInt pushInteger(sqInt integerValue);
+extern sqInt signed32BitIntegerFor(sqInt integerValue);
+extern int signed32BitValueOf(sqInt oop);
+extern sqInt stackIntegerValue(sqInt offset);
+extern sqInt stackObjectValue(sqInt offset);
+extern sqInt stackValue(sqInt offset);
+
+extern
+#endif
+struct VirtualMachine* interpreterProxy;
+static const char *moduleName =
+#ifdef SQUEAK_BUILTIN_PLUGIN
+	"SqueakSSL SqueakSSL-Plugin-ar.3 (i)"
+#else
+	"SqueakSSL SqueakSSL-Plugin-ar.3 (e)"
+#endif
+;
+
+
+
+/*	Note: This is coded so that plugins can be run from Squeak. */
+
+static VirtualMachine *
+getInterpreter(void)
+{
+	return interpreterProxy;
+}
+
+
+/*	Note: This is hardcoded so it can be run from Squeak.
+	The module name is used for validating a module *after*
+	it is loaded to check if it does really contain the module
+	we're thinking it contains. This is important! */
+
+EXPORT(const char*)
+getModuleName(void)
+{
+	return moduleName;
+}
+
+static sqInt
+halt(void)
+{
+	;
+	return 0;
+}
+
+static sqInt
+msg(char *s)
+{
+	fprintf(stderr, "\n%s: %s", moduleName, s);
+	return 0;
+}
+
+
+/*	Primitive. Starts or continues a server handshake using the current
+	session. Will eventually produce output to be sent to the client. Requires
+	the host
+	and cert name to be set for the session. Returns a code indicating the
+	sate of the connection:
+	> 0	 - Number of bytes to be sent to the client.
+	0	 - Success. The connection is established.
+	-1 - More input is required.
+	< -1 - Other errors.
+	 */
+
+EXPORT(sqInt)
+primitiveAccept(void)
+{
+    sqInt dstLen;
+    sqInt dstOop;
+    char *dstPtr;
+    sqInt handle;
+    sqInt result;
+    sqInt srcLen;
+    sqInt srcOop;
+    char *srcPtr;
+    sqInt start;
+
+	if (!((methodArgumentCount()) == 5)) {
+		return primitiveFail();
+	}
+	dstOop = stackObjectValue(0);
+	srcLen = stackIntegerValue(1);
+	start = stackIntegerValue(2);
+	srcOop = stackObjectValue(3);
+	handle = stackIntegerValue(4);
+	if (failed()) {
+		return null;
+	}
+	if (!(((start > 0)
+ && (srcLen >= 0))
+		 && ((isBytes(srcOop))
+		 && ((isBytes(dstOop))
+		 && ((byteSizeOf(srcOop)) >= ((start + srcLen) - 1)))))) {
+		return primitiveFail();
+	}
+	srcPtr = firstIndexableField(srcOop);
+	dstPtr = firstIndexableField(dstOop);
+	srcPtr = (srcPtr + start) - 1;
+	dstLen = byteSizeOf(dstOop);
+	result = sqAcceptSSL(handle, srcPtr, srcLen, dstPtr, dstLen);
+	if (failed()) {
+		return null;
+	}
+	pop((methodArgumentCount()) + 1);
+	pushInteger(result);
+}
+
+
+/*	Primitive. Starts or continues a client handshake using the provided data.
+	Will eventually produce output to be sent to the server. Requires the host
+	name to be set for the session. 
+	Returns:
+	> 0	 - Number of bytes to be sent to the server
+	0	 - Success. The connection is established.
+	-1 - More input is required.
+	< -1 - Other errors.
+	 */
+
+EXPORT(sqInt)
+primitiveConnect(void)
+{
+    sqInt dstLen;
+    sqInt dstOop;
+    char *dstPtr;
+    sqInt handle;
+    sqInt result;
+    sqInt srcLen;
+    sqInt srcOop;
+    char *srcPtr;
+    sqInt start;
+
+	if (!((methodArgumentCount()) == 5)) {
+		return primitiveFail();
+	}
+	dstOop = stackObjectValue(0);
+	srcLen = stackIntegerValue(1);
+	start = stackIntegerValue(2);
+	srcOop = stackObjectValue(3);
+	handle = stackIntegerValue(4);
+	if (failed()) {
+		return null;
+	}
+	if (!(((start > 0)
+ && (srcLen >= 0))
+		 && ((isBytes(srcOop))
+		 && ((isBytes(dstOop))
+		 && ((byteSizeOf(srcOop)) >= ((start + srcLen) - 1)))))) {
+		return primitiveFail();
+	}
+	srcPtr = firstIndexableField(srcOop);
+	dstPtr = firstIndexableField(dstOop);
+	srcPtr = (srcPtr + start) - 1;
+	dstLen = byteSizeOf(dstOop);
+	result = sqConnectSSL(handle, srcPtr, srcLen, dstPtr, dstLen);
+	if (failed()) {
+		return null;
+	}
+	pop((methodArgumentCount()) + 1);
+	pushInteger(result);
+}
+
+
+/*	Primitive. Creates a new SSL session and returns its handle. */
+
+EXPORT(sqInt)
+primitiveCreate(void)
+{
+    sqInt handle;
+
+	if (!((methodArgumentCount()) == 0)) {
+		return primitiveFail();
+	}
+	handle = sqCreateSSL();
+	if (handle == 0) {
+		return primitiveFail();
+	}
+	pop((methodArgumentCount()) + 1);
+	pushInteger(handle);
+}
+
+
+/*	Primitive. Decrypts a buffer sent via the connection.
+	Requires the session to be established.
+	Returns:
+	>=0 - Number of bytes decrypted in the result buffer
+	< -1 - Other errors.
+	 */
+
+EXPORT(sqInt)
+primitiveDecrypt(void)
+{
+    sqInt dstLen;
+    sqInt dstOop;
+    char *dstPtr;
+    sqInt handle;
+    sqInt result;
+    sqInt srcLen;
+    sqInt srcOop;
+    char *srcPtr;
+    sqInt start;
+
+	if (!((methodArgumentCount()) == 5)) {
+		return primitiveFail();
+	}
+	dstOop = stackObjectValue(0);
+	srcLen = stackIntegerValue(1);
+	start = stackIntegerValue(2);
+	srcOop = stackObjectValue(3);
+	handle = stackIntegerValue(4);
+	if (failed()) {
+		return null;
+	}
+	if (!(((start > 0)
+ && (srcLen >= 0))
+		 && ((isBytes(srcOop))
+		 && ((isBytes(dstOop))
+		 && ((byteSizeOf(srcOop)) >= ((start + srcLen) - 1)))))) {
+		return primitiveFail();
+	}
+	srcPtr = firstIndexableField(srcOop);
+	dstPtr = firstIndexableField(dstOop);
+	srcPtr = (srcPtr + start) - 1;
+	dstLen = byteSizeOf(dstOop);
+	result = sqDecryptSSL(handle, srcPtr, srcLen, dstPtr, dstLen);
+	if (failed()) {
+		return null;
+	}
+	pop((methodArgumentCount()) + 1);
+	pushInteger(result);
+}
+
+
+/*	Primitive. Destroys an SSL session. */
+
+EXPORT(sqInt)
+primitiveDestroy(void)
+{
+    sqInt handle;
+    sqInt result;
+
+	if (!((methodArgumentCount()) == 1)) {
+		return primitiveFail();
+	}
+	handle = stackIntegerValue(0);
+	if (failed()) {
+		return null;
+	}
+	result = sqDestroySSL(handle);
+	if (result == 0) {
+		return primitiveFail();
+	}
+	pop(methodArgumentCount());
+}
+
+
+/*	Primitive. Encrypts a buffer to be sent to the via the connection.
+	Requires the session to be established.
+	Returns:
+	>=0 - Number of bytes encrypted in the result buffer
+	< -1 - Other errors.
+	 */
+
+EXPORT(sqInt)
+primitiveEncrypt(void)
+{
+    sqInt dstLen;
+    sqInt dstOop;
+    char *dstPtr;
+    sqInt handle;
+    sqInt result;
+    sqInt srcLen;
+    sqInt srcOop;
+    char *srcPtr;
+    sqInt start;
+
+	if (!((methodArgumentCount()) == 5)) {
+		return primitiveFail();
+	}
+	dstOop = stackObjectValue(0);
+	srcLen = stackIntegerValue(1);
+	start = stackIntegerValue(2);
+	srcOop = stackObjectValue(3);
+	handle = stackIntegerValue(4);
+	if (failed()) {
+		return null;
+	}
+	if (!(((start > 0)
+ && (srcLen >= 0))
+		 && ((isBytes(srcOop))
+		 && ((isBytes(dstOop))
+		 && ((byteSizeOf(srcOop)) >= ((start + srcLen) - 1)))))) {
+		return primitiveFail();
+	}
+	srcPtr = firstIndexableField(srcOop);
+	dstPtr = firstIndexableField(dstOop);
+	srcPtr = (srcPtr + start) - 1;
+	dstLen = byteSizeOf(dstOop);
+	result = sqEncryptSSL(handle, srcPtr, srcLen, dstPtr, dstLen);
+	if (failed()) {
+		return null;
+	}
+	pop((methodArgumentCount()) + 1);
+	pushInteger(result);
+}
+
+
+/*	Primitive. Returns an integer property for the session */
+
+EXPORT(sqInt)
+primitiveGetIntProperty(void)
+{
+    sqInt handle;
+    sqInt propID;
+    sqInt value;
+
+	if (!((methodArgumentCount()) == 2)) {
+		return primitiveFail();
+	}
+	propID = stackIntegerValue(0);
+	handle = stackIntegerValue(1);
+	if (failed()) {
+		return null;
+	}
+	value = sqGetIntPropertySSL(handle, propID);
+	if (failed()) {
+		return null;
+	}
+	popthenPush((methodArgumentCount()) + 1, signed32BitIntegerFor(value));
+}
+
+
+/*	Primitive. Returns a string property for the session */
+
+EXPORT(sqInt)
+primitiveGetStringProperty(void)
+{
+    sqInt handle;
+    sqInt i;
+    char *oopPtr;
+    sqInt propID;
+    sqInt stringLen;
+    sqInt stringOop;
+    char *stringPtr;
+
+	if (!((methodArgumentCount()) == 2)) {
+		return primitiveFail();
+	}
+	propID = stackIntegerValue(0);
+	handle = stackIntegerValue(1);
+	if (failed()) {
+		return null;
+	}
+	stringPtr = sqGetStringPropertySSL(handle, propID);
+	if (failed()) {
+		return null;
+	}
+	if (stringPtr == null) {
+		stringOop = nilObject();
+	}
+	else {
+		stringLen = strlen(stringPtr);
+		stringOop = instantiateClassindexableSize(classString(), stringLen);
+		oopPtr = firstIndexableField(stringOop);
+		for (i = 0; i <= (stringLen - 1); i += 1) {
+			oopPtr[i] = (stringPtr[i]);
+		}
+	}
+	popthenPush((methodArgumentCount()) + 1, stringOop);
+}
+
+
+/*	Primitive. Sets a integer property for the session */
+
+EXPORT(sqInt)
+primitiveSetIntProperty(void)
+{
+    sqInt handle;
+    sqInt propID;
+    sqInt result;
+    sqInt value;
+
+	if (!((methodArgumentCount()) == 3)) {
+		return primitiveFail();
+	}
+	value = signed32BitValueOf(stackValue(0));
+	propID = stackIntegerValue(1);
+	handle = stackIntegerValue(2);
+	if (failed()) {
+		return null;
+	}
+	result = sqSetIntPropertySSL(handle, propID, value);
+	if (!result) {
+		return primitiveFail();
+	}
+	if (failed()) {
+		return null;
+	}
+	pop(methodArgumentCount());
+}
+
+
+/*	Primitive. Sets a string property for the session */
+
+EXPORT(sqInt)
+primitiveSetStringProperty(void)
+{
+    sqInt handle;
+    sqInt propID;
+    sqInt result;
+    sqInt srcLen;
+    sqInt srcOop;
+    char *srcPtr;
+
+	if (!((methodArgumentCount()) == 3)) {
+		return primitiveFail();
+	}
+	srcOop = stackObjectValue(0);
+	propID = stackIntegerValue(1);
+	handle = stackIntegerValue(2);
+	if (failed()) {
+		return null;
+	}
+	if (!(isBytes(srcOop))) {
+		return primitiveFail();
+	}
+	srcPtr = firstIndexableField(srcOop);
+	srcLen = byteSizeOf(srcOop);
+	result = sqSetStringPropertySSL(handle, propID, srcPtr, srcLen);
+	if (!result) {
+		return primitiveFail();
+	}
+	if (failed()) {
+		return null;
+	}
+	pop(methodArgumentCount());
+}
+
+
+/*	Note: This is coded so that it can be run in Squeak. */
+
+EXPORT(sqInt)
+setInterpreter(struct VirtualMachine*anInterpreter)
+{
+    sqInt ok;
+
+	interpreterProxy = anInterpreter;
+	ok = ((interpreterProxy->majorVersion()) == (VM_PROXY_MAJOR))
+	 && ((interpreterProxy->minorVersion()) >= (VM_PROXY_MINOR));
+	if (ok) {
+		
+#if !defined(SQUEAK_BUILTIN_PLUGIN)
+		byteSizeOf = interpreterProxy->byteSizeOf;
+		classString = interpreterProxy->classString;
+		failed = interpreterProxy->failed;
+		firstIndexableField = interpreterProxy->firstIndexableField;
+		instantiateClassindexableSize = interpreterProxy->instantiateClassindexableSize;
+		isBytes = interpreterProxy->isBytes;
+		methodArgumentCount = interpreterProxy->methodArgumentCount;
+		nilObject = interpreterProxy->nilObject;
+		pop = interpreterProxy->pop;
+		popthenPush = interpreterProxy->popthenPush;
+		primitiveFail = interpreterProxy->primitiveFail;
+		pushInteger = interpreterProxy->pushInteger;
+		signed32BitIntegerFor = interpreterProxy->signed32BitIntegerFor;
+		signed32BitValueOf = interpreterProxy->signed32BitValueOf;
+		stackIntegerValue = interpreterProxy->stackIntegerValue;
+		stackObjectValue = interpreterProxy->stackObjectValue;
+		stackValue = interpreterProxy->stackValue;
+#endif /* !defined(SQUEAK_BUILTIN_PLUGIN) */
+	}
+	return ok;
+}
+
+
+#ifdef SQUEAK_BUILTIN_PLUGIN
+
+void* SqueakSSL_exports[][3] = {
+	{"SqueakSSL", "getModuleName", (void*)getModuleName},
+	{"SqueakSSL", "primitiveAccept", (void*)primitiveAccept},
+	{"SqueakSSL", "primitiveConnect", (void*)primitiveConnect},
+	{"SqueakSSL", "primitiveCreate", (void*)primitiveCreate},
+	{"SqueakSSL", "primitiveDecrypt", (void*)primitiveDecrypt},
+	{"SqueakSSL", "primitiveDestroy", (void*)primitiveDestroy},
+	{"SqueakSSL", "primitiveEncrypt", (void*)primitiveEncrypt},
+	{"SqueakSSL", "primitiveGetIntProperty", (void*)primitiveGetIntProperty},
+	{"SqueakSSL", "primitiveGetStringProperty", (void*)primitiveGetStringProperty},
+	{"SqueakSSL", "primitiveSetIntProperty", (void*)primitiveSetIntProperty},
+	{"SqueakSSL", "primitiveSetStringProperty", (void*)primitiveSetStringProperty},
+	{"SqueakSSL", "setInterpreter", (void*)setInterpreter},
+	{NULL, NULL, NULL}
+};
+
+#endif /* ifdef SQ_BUILTIN_PLUGIN */

Added: branches/Cog/nscogsrc/plugins/VMProfileLinuxSupportPlugin/VMProfileLinuxSupportPlugin.c
===================================================================
--- branches/Cog/nscogsrc/plugins/VMProfileLinuxSupportPlugin/VMProfileLinuxSupportPlugin.c	                        (rev 0)
+++ branches/Cog/nscogsrc/plugins/VMProfileLinuxSupportPlugin/VMProfileLinuxSupportPlugin.c	2013-06-06 21:40:56 UTC (rev 2730)
@@ -0,0 +1,318 @@
+/* Automatically generated by
+	VMPluginCodeGenerator VMMaker.oscog-eem.294 uuid: 9f0fd793-5a49-476d-9a76-c84180415334
+   from
+	VMProfileLinuxSupportPlugin VMMaker.oscog-eem.294 uuid: 9f0fd793-5a49-476d-9a76-c84180415334
+ */
+static char __buildInfo[] = "VMProfileLinuxSupportPlugin VMMaker.oscog-eem.294 uuid: 9f0fd793-5a49-476d-9a76-c84180415334 " __DATE__ ;
+
+
+
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
+#include <link.h>
+
+/* Default EXPORT macro that does nothing (see comment in sq.h): */
+#define EXPORT(returnType) returnType
+
+/* Do not include the entire sq.h file but just those parts needed. */
+/*  The virtual machine proxy definition */
+#include "sqVirtualMachine.h"
+/* Configuration options */
+#include "sqConfig.h"
+/* Platform specific definitions */
+#include "sqPlatformSpecific.h"
+
+#define true 1
+#define false 0
+#define null 0  /* using 'null' because nil is predefined in Think C */
+#ifdef SQUEAK_BUILTIN_PLUGIN
+#undef EXPORT
+// was #undef EXPORT(returnType) but screws NorCroft cc
+#define EXPORT(returnType) static returnType
+#endif
+
+#include "sqMemoryAccess.h"
+
+
+/*** Constants ***/
+#define BytesPerWord 4
+#define PrimErrBadArgument 3
+#define PrimErrInappropriate 6
+#define PrimErrNoMemory 9
+#define PrimErrNotFound 11
+
+
+/*** Function Prototypes ***/
+static sqInt countnummodules(struct dl_phdr_info *info, size_t size, void *ignored);
+static VirtualMachine * getInterpreter(void);
+EXPORT(const char*) getModuleName(void);
+static sqInt halt(void);
+static sqInt msg(char *s);
+EXPORT(sqInt) primitiveDLSymInLibrary(void);
+EXPORT(sqInt) primitiveExecutableModules(void);
+EXPORT(sqInt) primitiveInterpretAddress(void);
+static sqInt reapmodulenames(struct dl_phdr_info *info, size_t size, void *ignored);
+EXPORT(sqInt) setInterpreter(struct VirtualMachine*anInterpreter);
+
+
+/*** Variables ***/
+
+#if !defined(SQUEAK_BUILTIN_PLUGIN)
+static void * (*arrayValueOf)(sqInt oop);
+static sqInt (*byteSizeOf)(sqInt oop);
+static sqInt (*classArray)(void);
+static sqInt (*classString)(void);
+static void * (*firstIndexableField)(sqInt oop);
+static sqInt (*instantiateClassindexableSize)(sqInt classPointer, sqInt size);
+static sqInt (*isBytes)(sqInt oop);
+static sqInt (*methodReturnValue)(sqInt oop);
+static sqInt (*popRemappableOop)(void);
+static sqInt (*positive32BitIntegerFor)(sqInt integerValue);
+static unsigned long (*positiveMachineIntegerValueOf)(sqInt oop);
+static sqInt (*primitiveFailFor)(sqInt reasonCode);
+static sqInt (*pushRemappableOop)(sqInt oop);
+static sqInt (*stackValue)(sqInt offset);
+static sqInt (*storePointerofObjectwithValue)(sqInt index, sqInt oop, sqInt valuePointer);
+static sqInt (*topRemappableOop)(void);
+#else /* !defined(SQUEAK_BUILTIN_PLUGIN) */
+extern void * arrayValueOf(sqInt oop);
+extern sqInt byteSizeOf(sqInt oop);
+extern sqInt classArray(void);
+extern sqInt classString(void);
+extern void * firstIndexableField(sqInt oop);
+extern sqInt instantiateClassindexableSize(sqInt classPointer, sqInt size);
+extern sqInt isBytes(sqInt oop);
+extern sqInt methodReturnValue(sqInt oop);
+extern sqInt popRemappableOop(void);
+extern sqInt positive32BitIntegerFor(sqInt integerValue);
+extern unsigned long positiveMachineIntegerValueOf(sqInt oop);
+extern sqInt primitiveFailFor(sqInt reasonCode);
+extern sqInt pushRemappableOop(sqInt oop);
+extern sqInt stackValue(sqInt offset);
+extern sqInt storePointerofObjectwithValue(sqInt index, sqInt oop, sqInt valuePointer);
+extern sqInt topRemappableOop(void);
+
+extern
+#endif
+struct VirtualMachine* interpreterProxy;
+static const char *moduleName =
+#ifdef SQUEAK_BUILTIN_PLUGIN
+	"VMProfileLinuxSupportPlugin VMMaker.oscog-eem.294 (i)"
+#else
+	"VMProfileLinuxSupportPlugin VMMaker.oscog-eem.294 (e)"
+#endif
+;
+static sqInt numModules;
+static sqInt primErr;
+
+
+static sqInt
+countnummodules(struct dl_phdr_info *info, size_t size, void *ignored)
+{
+	numModules += 1;
+	return 0;
+}
+
+
+/*	Note: This is coded so that plugins can be run from Squeak. */
+
+static VirtualMachine *
+getInterpreter(void)
+{
+	return interpreterProxy;
+}
+
+
+/*	Note: This is hardcoded so it can be run from Squeak.
+	The module name is used for validating a module *after*
+	it is loaded to check if it does really contain the module
+	we're thinking it contains. This is important! */
+
+EXPORT(const char*)
+getModuleName(void)
+{
+	return moduleName;
+}
+
+static sqInt
+halt(void)
+{
+	;
+	return 0;
+}
+
+static sqInt
+msg(char *s)
+{
+	fprintf(stderr, "\n%s: %s", moduleName, s);
+	return 0;
+}
+
+
+/*	Answer the address of the symbol whose name is the first argument
+	in the library whose name is the second argument, or nil if none. */
+
+EXPORT(sqInt)
+primitiveDLSymInLibrary(void)
+{
+    void *addr;
+    void *lib;
+    char *libName;
+    sqInt nameObj;
+    sqInt ok;
+    char *symName;
+    sqInt sz;
+
+	nameObj = stackValue(0);
+	if (!(isBytes(nameObj))) {
+		return primitiveFailFor(PrimErrBadArgument);
+	}
+	sz = byteSizeOf(nameObj);
+	libName = malloc(sz + 1);
+	strncpy(libName, firstIndexableField(nameObj), sz);
+	nameObj = stackValue(1);
+	if (!(isBytes(nameObj))) {
+		free(libName);
+		return primitiveFailFor(PrimErrBadArgument);
+	}
+	sz = byteSizeOf(nameObj);
+	symName = malloc(sz + 1);
+	strncpy(symName, firstIndexableField(nameObj), sz);
+	lib = dlopen(libName, RTLD_LAZY || RTLD_NODELETE);
+	if (!(lib)) {
+		free(libName);
+		free(symName);
+		return primitiveFailFor(PrimErrInappropriate);
+	}
+	dlerror();
+	addr = dlsym(lib, symName);
+	ok = (dlerror()) == null;
+	free(symName);
+	free(libName);
+	dlclose(lib);
+	if (!ok) {
+		return primitiveFailFor(PrimErrNotFound);
+	}
+	return methodReturnValue(positiveMachineIntegerValueOf(((unsigned long)addr)));
+}
+
+
+/*	Answer an Array of strings for executable modules (the VM executable and
+	loaded libraries).
+ */
+
+EXPORT(sqInt)
+primitiveExecutableModules(void)
+{
+    sqInt resultObj;
+
+	numModules = 0;
+	dl_iterate_phdr(countnummodules,0);
+
+	/* skip the fake linux-gate.so.1 */
+
+	resultObj = instantiateClassindexableSize(classArray(), numModules - 1);
+	if (resultObj == 0) {
+		return primitiveFailFor(PrimErrNoMemory);
+	}
+	pushRemappableOop(resultObj);
+	primErr = (numModules = 0);
+	dl_iterate_phdr(reapmodulenames,0);
+	resultObj = popRemappableOop();
+	if (primErr != 0) {
+		return primitiveFailFor(primErr);
+	}
+	return methodReturnValue(resultObj);
+}
+
+
+/*	Answer the address of the interpret routine. */
+
+EXPORT(sqInt)
+primitiveInterpretAddress(void)
+{
+    extern void interpret();
+
+	;
+	return methodReturnValue(positive32BitIntegerFor(((unsigned long)interpret)));
+}
+
+static sqInt
+reapmodulenames(struct dl_phdr_info *info, size_t size, void *ignored)
+{
+    const char *elfModuleName;
+    extern char *GetAttributeString(sqInt);
+    sqInt len;
+    sqInt moduleNameObj;
+
+	;
+	elfModuleName = numModules ? info->dlpi_name : GetAttributeString(0);
+	if ((elfModuleName == null)
+	 || (((len = strlen(elfModuleName))) == 0)) {
+		return 0;
+	}
+	moduleNameObj = instantiateClassindexableSize(classString(), len);
+	if (moduleNameObj == 0) {
+		primErr = PrimErrNoMemory;
+		return 1;
+	}
+	strncpy(arrayValueOf(moduleNameObj), elfModuleName, len);
+	storePointerofObjectwithValue(numModules, topRemappableOop(), moduleNameObj);
+	numModules += 1;
+	return 0;
+}
+
+
+/*	Note: This is coded so that it can be run in Squeak. */
+
+EXPORT(sqInt)
+setInterpreter(struct VirtualMachine*anInterpreter)
+{
+    sqInt ok;
+
+	interpreterProxy = anInterpreter;
+	ok = ((interpreterProxy->majorVersion()) == (VM_PROXY_MAJOR))
+	 && ((interpreterProxy->minorVersion()) >= (VM_PROXY_MINOR));
+	if (ok) {
+		
+#if !defined(SQUEAK_BUILTIN_PLUGIN)
+		arrayValueOf = interpreterProxy->arrayValueOf;
+		byteSizeOf = interpreterProxy->byteSizeOf;
+		classArray = interpreterProxy->classArray;
+		classString = interpreterProxy->classString;
+		firstIndexableField = interpreterProxy->firstIndexableField;
+		instantiateClassindexableSize = interpreterProxy->instantiateClassindexableSize;
+		isBytes = interpreterProxy->isBytes;
+		methodReturnValue = interpreterProxy->methodReturnValue;
+		popRemappableOop = interpreterProxy->popRemappableOop;
+		positive32BitIntegerFor = interpreterProxy->positive32BitIntegerFor;
+		positiveMachineIntegerValueOf = interpreterProxy->positiveMachineIntegerValueOf;
+		primitiveFailFor = interpreterProxy->primitiveFailFor;
+		pushRemappableOop = interpreterProxy->pushRemappableOop;
+		stackValue = interpreterProxy->stackValue;
+		storePointerofObjectwithValue = interpreterProxy->storePointerofObjectwithValue;
+		topRemappableOop = interpreterProxy->topRemappableOop;
+#endif /* !defined(SQUEAK_BUILTIN_PLUGIN) */
+	}
+	return ok;
+}
+
+
+#ifdef SQUEAK_BUILTIN_PLUGIN
+
+void* VMProfileLinuxSupportPlugin_exports[][3] = {
+	{"VMProfileLinuxSupportPlugin", "getModuleName", (void*)getModuleName},
+	{"VMProfileLinuxSupportPlugin", "primitiveDLSymInLibrary", (void*)primitiveDLSymInLibrary},
+	{"VMProfileLinuxSupportPlugin", "primitiveExecutableModules", (void*)primitiveExecutableModules},
+	{"VMProfileLinuxSupportPlugin", "primitiveInterpretAddress", (void*)primitiveInterpretAddress},
+	{"VMProfileLinuxSupportPlugin", "setInterpreter", (void*)setInterpreter},
+	{NULL, NULL, NULL}
+};
+
+#endif /* ifdef SQ_BUILTIN_PLUGIN */

Modified: branches/Cog/nscogsrc/plugins/Win32OSProcessPlugin/Win32OSProcessPlugin.c
===================================================================
--- branches/Cog/nscogsrc/plugins/Win32OSProcessPlugin/Win32OSProcessPlugin.c	2013-05-08 12:29:55 UTC (rev 2729)
+++ branches/Cog/nscogsrc/plugins/Win32OSProcessPlugin/Win32OSProcessPlugin.c	2013-06-06 21:40:56 UTC (rev 2730)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	VMPluginCodeGenerator VMMaker.oscog-eem.282 uuid: 6c2f2048-555b-4d37-a9eb-4d9252acf3b9
+	VMPluginCodeGenerator VMMaker.oscog-eem.293 uuid: 1aa1e0a0-8883-4493-b0eb-226057aaabe3
    from
-	Win32OSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.41 uuid: 0406d3fc-7b8b-4b72-b20a-f254eeb1b893
+	Win32OSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.42 uuid: dfa6d147-0a2d-42a8-a10d-c1fbb4dd8e06
  */
-static char __buildInfo[] = "Win32OSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.41 uuid: 0406d3fc-7b8b-4b72-b20a-f254eeb1b893 " __DATE__ ;
+static char __buildInfo[] = "Win32OSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.42 uuid: dfa6d147-0a2d-42a8-a10d-c1fbb4dd8e06 " __DATE__ ;
 /* D T Lewis - Win32OSProcessPlugin.c translated from class
    Win32OSProcessPlugin of OSProcessPlugin version 4.3.3 Cog */
 
@@ -47,6 +47,7 @@
 /*** Constants ***/
 #define BytesPerWord 4
 #define FILEHANDLETYPE FILE *  /* the type of low level stream to be used in a struct SQFile */
+#define PrimErrBadArgument 3
 #define READCHARARRAYSIZE 512	/* Corresponds to expected max size of external semaphore table */
 									/* Table expands dynamically, so just use a big number */
 #define SESSIONIDENTIFIERTYPE int
@@ -62,7 +63,7 @@
 static FILEHANDLETYPE fileHandleFrom(sqInt sqFileStructByteArray);
 static sqInt fileRecordSize(void);
 static SQFile * fileValueOf(sqInt anSQFileRecord);
-static sqInt fixPointersInArrayOfStringswithOffsetscount(char *flattenedArrayOfStrings, sqInt *offsetArray, sqInt count);
+static char ** fixPointersInArrayOfStringswithOffsets(sqInt flattenedStrings, sqInt offsets);
 static VirtualMachine * getInterpreter(void);
 EXPORT(const char*) getModuleName(void);
 static sqInt getThisSessionIdentifier(void);
@@ -158,6 +159,7 @@
 static sqInt (*classArray)(void);
 static sqInt (*classByteArray)(void);
 static sqInt (*classString)(void);
+static sqInt (*failed)(void);
 static sqInt (*falseObject)(void);
 static void * (*firstIndexableField)(sqInt oop);
 static sqInt (*getThisSessionID)(void);
@@ -172,6 +174,7 @@
 static sqInt (*popRemappableOop)(void);
 static sqInt (*positive32BitIntegerFor)(sqInt integerValue);
 static sqInt (*primitiveFail)(void);
+static sqInt (*primitiveFailFor)(sqInt reasonCode);
 static sqInt (*push)(sqInt object);
 static sqInt (*pushInteger)(sqInt integerValue);
 static sqInt (*pushRemappableOop)(sqInt oop);
@@ -190,6 +193,7 @@
 extern sqInt classArray(void);
 extern sqInt classByteArray(void);
 extern sqInt classString(void);
+extern sqInt failed(void);
 extern sqInt falseObject(void);
 extern void * firstIndexableField(sqInt oop);
 extern sqInt getThisSessionID(void);
@@ -204,6 +208,7 @@
 extern sqInt popRemappableOop(void);
 extern sqInt positive32BitIntegerFor(sqInt integerValue);
 extern sqInt primitiveFail(void);
+extern sqInt primitiveFailFor(sqInt reasonCode);
 extern sqInt push(sqInt object);
 extern sqInt pushInteger(sqInt integerValue);
 extern sqInt pushRemappableOop(sqInt oop);
@@ -222,9 +227,9 @@
 struct VirtualMachine* interpreterProxy;
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"Win32OSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.41 (i)"
+	"Win32OSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.42 (i)"
 #else
-	"Win32OSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.41 (e)"
+	"Win32OSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.42 (e)"
 #endif
 ;
 static int osprocessSandboxSecurity;
@@ -352,23 +357,50 @@
 }
 
 
+/*	The image constructs a flattened string of all the argument and/or
+	environment strings.
+	There is room at the beginning for the null-terminated array of pointers
+	to strings.
+	The rest of the string contains the null-terminated strings. */
 /*	Use the address offsets in offsetArray to fix up the pointers in
 	cStringArray. The result is a C array of pointers to char, used for argv
 	and env vectors.
  */
 
-static sqInt
-fixPointersInArrayOfStringswithOffsetscount(char *flattenedArrayOfStrings, sqInt *offsetArray, sqInt count)
+static char **
+fixPointersInArrayOfStringswithOffsets(sqInt flattenedStrings, sqInt offsets)
 {
+    sqInt count;
     sqInt idx;
+    sqInt *offsetArray;
     char **ptr;
+    usqInt sz;
+    sqInt val;
 
-	ptr = ((char **) flattenedArrayOfStrings);
+	count = stSizeOf(offsets);
+	offsetArray = firstIndexableField(offsets);
+	sz = ((usqInt)(byteSizeOf(flattenedStrings)));
+	if ((count * (sizeof(char *))) >= sz) {
+		primitiveFailFor(PrimErrBadArgument);
+		return 0;
+	}
+	ptr = ((char **) (arrayValueOf(flattenedStrings)));
 	idx = 0;
 	while (idx < count) {
-		ptr[idx] = (flattenedArrayOfStrings + (integerValueOf(offsetArray[idx])));
+		val = integerValueOf(offsetArray[idx]);
+		if ((((usqInt)val)) >= sz) {
+			primitiveFailFor(PrimErrBadArgument);
+			return 0;
+		}
+		ptr[idx] = ((((char *) ptr)) + val);
 		idx += 1;
 	}
+	if ((ptr[idx]) != 0) {
+		primitiveFailFor(PrimErrBadArgument);
+	}
+	return (failed()
+		? 0
+		: ptr);
 }
 
 
@@ -519,7 +551,7 @@
 static sqInt
 isNonNullSQFile(sqInt objectPointer)
 {
-    sqInt idx;
+    unsigned idx;
     unsigned char *sqFileBytes;
 
 	sqFileBytes = arrayValueOf(objectPointer);
@@ -992,26 +1024,18 @@
 {
     sqInt count;
     sqInt cStringArray;
-    char *flattenedArrayOfStrings;
-    sqInt idx;
     sqInt offsetArray;
-    sqInt *offsets;
-    char **ptr;
 
 	count = stackIntegerValue(0);
 	offsetArray = stackObjectValue(1);
 	cStringArray = stackObjectValue(2);
-	offsets = firstIndexableField(offsetArray);
-	flattenedArrayOfStrings = arrayValueOf(cStringArray);
-	/* begin fixPointersInArrayOfStrings:withOffsets:count: */
-	ptr = ((char **) flattenedArrayOfStrings);
-	idx = 0;
-	while (idx < count) {
-		ptr[idx] = (flattenedArrayOfStrings + (integerValueOf(offsets[idx])));
-		idx += 1;
+	if ((failed())
+	 || ((fixPointersInArrayOfStringswithOffsets(cStringArray, offsetArray)) == 0)) {
+		primitiveFail();
 	}
-	pop(4);
-	push(cStringArray);
+	else {
+		popthenPush(4, cStringArray);
+	}
 }
 
 
@@ -1990,6 +2014,7 @@
 		classArray = interpreterProxy->classArray;
 		classByteArray = interpreterProxy->classByteArray;
 		classString = interpreterProxy->classString;
+		failed = interpreterProxy->failed;
 		falseObject = interpreterProxy->falseObject;
 		firstIndexableField = interpreterProxy->firstIndexableField;
 		getThisSessionID = interpreterProxy->getThisSessionID;
@@ -2004,6 +2029,7 @@
 		popRemappableOop = interpreterProxy->popRemappableOop;
 		positive32BitIntegerFor = interpreterProxy->positive32BitIntegerFor;
 		primitiveFail = interpreterProxy->primitiveFail;
+		primitiveFailFor = interpreterProxy->primitiveFailFor;
 		push = interpreterProxy->push;
 		pushInteger = interpreterProxy->pushInteger;
 		pushRemappableOop = interpreterProxy->pushRemappableOop;

Modified: branches/Cog/nscogsrc/vm/cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.c	2013-05-08 12:29:55 UTC (rev 2729)
+++ branches/Cog/nscogsrc/vm/cointerp.c	2013-06-06 21:40:56 UTC (rev 2730)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.282 uuid: 6c2f2048-555b-4d37-a9eb-4d9252acf3b9
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.296 uuid: ca2924d5-7bfb-4690-a7ce-9ec8d2222043
    from
-	CoInterpreter VMMaker.oscog-eem.282 uuid: 6c2f2048-555b-4d37-a9eb-4d9252acf3b9
+	CoInterpreter VMMaker.oscog-eem.296 uuid: ca2924d5-7bfb-4690-a7ce-9ec8d2222043
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.282 uuid: 6c2f2048-555b-4d37-a9eb-4d9252acf3b9 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.296 uuid: ca2924d5-7bfb-4690-a7ce-9ec8d2222043 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -13,6 +13,11 @@
 #else
 # define SQ_USE_GLOBAL_STRUCT 0
 #endif
+#if USE_GLOBAL_STRUCT_REG 
+# define SQ_USE_GLOBAL_STRUCT_REG 1
+#else
+# define SQ_USE_GLOBAL_STRUCT_REG 0
+#endif
 
 #include <stddef.h> /* for e.g. alloca */
 #include <setjmp.h>
@@ -1350,8 +1355,13 @@
 #undef _iss
 #if SQ_USE_GLOBAL_STRUCT
  } fum;
+ #if SQ_USE_GLOBAL_STRUCT_REG
+# define DECL_MAYBE_SQ_GLOBAL_STRUCT /* using a global reg pointer */
+# define DECL_MAYBE_VOLATILE_SQ_GLOBAL_STRUCT /* using a global reg pointer */
+#else
 # define DECL_MAYBE_SQ_GLOBAL_STRUCT register struct foo * foo = &fum;
 # define DECL_MAYBE_VOLATILE_SQ_GLOBAL_STRUCT volatile register struct foo * foo = &fum;
+#endif
 # define GIV(interpreterInstVar) (foo->interpreterInstVar)
 #else
 # define DECL_MAYBE_SQ_GLOBAL_STRUCT /* oh, no mr bill! */
@@ -1359,8 +1369,14 @@
 # define GIV(interpreterInstVar) interpreterInstVar
 #endif
 #if SQ_USE_GLOBAL_STRUCT
+#if SQ_USE_GLOBAL_STRUCT_REG
+#define fooxstr(s) foostr(s)
+#define foostr(s)  #s
+register struct foo * foo asm(fooxstr(USE_GLOBAL_STRUCT_REG));
+#else
 static struct foo * foo = &fum;
 #endif
+#endif
 static void (*primitiveFunctionPointer)();
 jmp_buf reenterInterpreter; /* private export */;
 sqInt maxLiteralCountForCompile = MaxLiteralCountForCompile /* 60 */;
@@ -1960,7 +1976,7 @@
 	/* 575 */ (void (*)(void))0,
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.282";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.296";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -1981,7 +1997,7 @@
 #define dispatchFunctionPointer(aFunctionPointer) (aFunctionPointer)()
 #define enterSmalltalkExecutive() enterSmalltalkExecutiveImplementation()
 #define flush() fflush(stdout)
-#define freeStart() freeStart
+#define freeStart() GIV(freeStart)
 #define getCodeCompactionCount() integerObjectOf(GIV(statCodeCompactionCount))
 #define getCodeCompactionMSecs() integerObjectOf((GIV(statCodeCompactionUsecs) + 500) / 1000)
 #define getCogCodeSize() integerObjectOf(GIV(cogCodeSize))
@@ -12900,7 +12916,7 @@
 
 sqInt
 activeProcess(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return longAt(((longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SchedulerAssociation << ShiftForWord))) + BaseHeaderSize) + (ValueIndex << ShiftForWord))) + BaseHeaderSize) + (ActiveProcessIndex << ShiftForWord));
 }
 
@@ -13056,7 +13072,7 @@
 
 static sqInt
 addressCouldBeClassObj(sqInt maybeClassObj)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return (((maybeClassObj & 3) == 0)
  && (((((usqInt)maybeClassObj)) >= (startOfMemory()))
  && (((((usqInt)maybeClassObj)) < GIV(freeStart))
@@ -13074,7 +13090,7 @@
 
 static sqInt
 addressCouldBeObjWhileForwarding(sqInt address)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return ((address & 3) == 0)
 	 && (((((usqInt)address)) >= (startOfMemory()))
 	 && ((((usqInt)address)) < GIV(freeStart)));
@@ -13086,7 +13102,7 @@
 
 sqInt
 addressCouldBeObj(sqInt address)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return ((address & 3) == 0)
 	 && (((((usqInt)address)) >= (startOfMemory()))
 	 && (((((usqInt)address)) < GIV(freeStart))
@@ -13099,7 +13115,7 @@
 
 sqInt
 addressCouldBeOop(sqInt address)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return ((address & 1))
 	 || (((address & 3) == 0)
 	 && (((((usqInt)address)) >= (startOfMemory()))
@@ -13283,7 +13299,7 @@
 
 usqInt
 argumentCountAddress(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return ((usqInt)((&GIV(argumentCount))));
 }
 
@@ -14206,7 +14222,7 @@
 
 void
 callForCogCompiledCodeCompaction(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	GIV(cogCompiledCodeCompactionCalledFor) = 1;
 	forceInterruptCheck();
 }
@@ -14258,7 +14274,7 @@
 
 void
 ceActivateFailingPrimitiveMethod(sqInt aPrimitiveMethod)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt methodHeader;
 
 	assert(GIV(newMethod) == aPrimitiveMethod);
@@ -14843,7 +14859,7 @@
 
 sqInt
 ceNewArraySlotSize(sqInt slotSize)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return eeInstantiateAndInitializeClassindexableSize(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassArray << ShiftForWord)), slotSize);
 }
 
@@ -15721,7 +15737,7 @@
 
 static sqInt
 changeClassOfto(sqInt rcvr, sqInt argClass)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt argClassInstByteSize;
     sqInt argFormat;
     sqInt ccIndex;
@@ -15815,13 +15831,13 @@
 
 sqInt
 characterForAscii(sqInt ascii)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CharacterTable << ShiftForWord))) + BaseHeaderSize) + (ascii << ShiftForWord));
 }
 
 sqInt
 characterTable(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CharacterTable << ShiftForWord));
 }
 
@@ -16794,7 +16810,7 @@
 
 static sqInt
 checkOkayStackPage(StackPage *thePage)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
     char *callerFP;
     char *frameRcvrOffset;
     sqInt ok;
@@ -16898,7 +16914,7 @@
 
 sqInt
 checkOopHasOkayClass(sqInt obj)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt behaviorFormatBits;
     sqInt ccIndex;
     sqInt formatMask;
@@ -17123,67 +17139,67 @@
 
 sqInt
 classAlien(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassAlien << ShiftForWord));
 }
 
 sqInt
 classArray(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassArray << ShiftForWord));
 }
 
 sqInt
 classBitmap(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassBitmap << ShiftForWord));
 }
 
 sqInt
 classByteArray(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteArray << ShiftForWord));
 }
 
 sqInt
 classCharacter(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassCharacter << ShiftForWord));
 }
 
 sqInt
 classExternalAddress(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassExternalAddress << ShiftForWord));
 }
 
 sqInt
 classExternalData(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassExternalData << ShiftForWord));
 }
 
 sqInt
 classExternalFunction(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassExternalFunction << ShiftForWord));
 }
 
 sqInt
 classExternalLibrary(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassExternalLibrary << ShiftForWord));
 }
 
 sqInt
 classExternalStructure(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassExternalStructure << ShiftForWord));
 }
 
 sqInt
 classFloat(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassFloat << ShiftForWord));
 }
 
@@ -17201,13 +17217,13 @@
 
 sqInt
 classLargeNegativeInteger(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassLargeNegativeInteger << ShiftForWord));
 }
 
 sqInt
 classLargePositiveInteger(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassLargePositiveInteger << ShiftForWord));
 }
 
@@ -17242,31 +17258,31 @@
 
 sqInt
 classPoint(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassPoint << ShiftForWord));
 }
 
 sqInt
 classSemaphore(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSemaphore << ShiftForWord));
 }
 
 sqInt
 classSmallInteger(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassInteger << ShiftForWord));
 }
 
 sqInt
 classString(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassByteString << ShiftForWord));
 }
 
 sqInt
 classUnsafeAlien(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassUnsafeAlien << ShiftForWord));
 }
 
@@ -17796,7 +17812,7 @@
 
 sqInt
 compactClassAt(sqInt ccIndex)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord));
 }
 
@@ -18491,7 +18507,7 @@
 
 sqInt
 displayObject(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (TheDisplay << ShiftForWord));
 }
 
@@ -18835,7 +18851,7 @@
 
 EXPORT(sqInt)
 dumpImage(sqInt fileName)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt dataSize;
     sqImageFile f;
     sqInt result;
@@ -20587,7 +20603,7 @@
 
 sqInt
 failed(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return GIV(primFailCode);
 }
 
@@ -20596,13 +20612,13 @@
 
 static void
 failUnbalancedPrimitive(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	GIV(primFailCode) = PrimErrBadNumArgs;
 }
 
 sqInt
 falseObject(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return GIV(falseObj);
 }
 
@@ -20640,7 +20656,7 @@
 
 static sqInt
 fetchClassOfNonInt(sqInt oop)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt ccIndex;
 
 	return (((ccIndex = (((usqInt) (longAt(oop))) >> 12) & 31)) == 0
@@ -21029,7 +21045,7 @@
 
 static sqInt
 findClassContainingMethodstartingAt(sqInt meth, sqInt classObj)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt classDict;
     sqInt classDictSize;
     sqInt currClass;
@@ -21391,7 +21407,7 @@
 
 static char *
 findSPOfon(char *theFP, StackPage *thePage)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
     char *aFrame;
     char *startFrame;
     char *theSP;
@@ -21447,7 +21463,7 @@
 
 void
 findStringBeginningWith(char *aCString)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt chunk;
     sqInt cssz;
     sqInt header;
@@ -21495,7 +21511,7 @@
 
 void
 findString(char *aCString)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt chunk;
     sqInt cssz;
     sqInt header;
@@ -21545,7 +21561,7 @@
 
 void *
 firstIndexableField(sqInt oop)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt ccIndex;
     sqInt class;
     sqInt classFormat;
@@ -21653,7 +21669,7 @@
 
 sqInt
 floatObjectOf(double aFloat)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt newFloatObj;
 
 	flag("Dan");
@@ -22037,7 +22053,7 @@
 
 usqInt
 framePointerAddress(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return ((usqInt)((&GIV(framePointer))));
 }
 
@@ -22113,7 +22129,7 @@
 
 usqInt
 freeStartAddress(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return ((usqInt)((&GIV(freeStart))));
 }
 
@@ -22125,7 +22141,7 @@
 
 sqInt
 fullDisplayUpdate(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt displayObj;
     sqInt h;
     sqInt w;
@@ -22461,19 +22477,19 @@
 
 sqInt
 getFullScreenFlag(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return GIV(fullScreenFlag);
 }
 
 sqInt
 getInterruptKeycode(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return GIV(interruptKeycode);
 }
 
 sqInt
 getInterruptPending(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return GIV(interruptPending);
 }
 
@@ -22499,13 +22515,13 @@
 
 usqLong
 getNextWakeupUsecs(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return GIV(nextWakeupUsecs);
 }
 
 sqInt
 getSavedWindowSize(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return GIV(savedWindowSize);
 }
 
@@ -22531,7 +22547,7 @@
 
 sqInt *
 getStackPointer(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return ((sqInt *) GIV(stackPointer));
 }
 
@@ -22540,7 +22556,7 @@
 
 sqInt
 getThisSessionID(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return GIV(globalSessionID);
 }
 
@@ -22967,7 +22983,7 @@
 
 static sqInt
 imageSegmentVersion(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt wholeWord;
 
 
@@ -23436,7 +23452,6 @@
 		longAtput(newFreeChunk, (bytesFreed & AllButTypeMask) | HeaderTypeFree);
 	}
 	/* begin safeObjectAfter: */
-	VM_LABEL(0safeObjectAfter);
 	if (((longAt(newFreeChunk)) & TypeMask) == HeaderTypeFree) {
 		sz3 = (longAt(newFreeChunk)) & AllButTypeMask;
 	}
@@ -23862,11 +23877,11 @@
 static void
 initializeMemoryFirstFree(sqInt firstFree)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
-    sqInt end;
+    usqInt end;
     sqInt fwdBlockBytes;
-    sqInt i;
+    usqInt i;
     sqInt newEndOfMemory;
-    sqInt start;
+    usqInt start;
     sqInt totalReserve;
 
 	fwdBlockBytes = GIV(totalObjectCount) & ((WordMask - BytesPerWord) + 1);
@@ -24380,11 +24395,15 @@
 			? GIV(nilObj)
 			: 0);
 		end = newObj + byteSize;
+
+		/* skip header */
+
 		i = newObj + BytesPerWord;
 		while (i < end) {
 			longAtput(i, fillWord);
 			i += BytesPerWord;
 		}
+		assert(i == GIV(freeStart));
 	}
 	if (DoExpensiveAssertionChecks) {
 		okayOop(newObj);
@@ -24398,7 +24417,7 @@
 
 usqInt
 instructionPointerAddress(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return ((usqInt)((&GIV(instructionPointer))));
 }
 
@@ -24483,7 +24502,7 @@
 
 static sqInt
 interpreterAllocationReserveBytes(void)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt maxFramesPerPage;
     sqInt maxUsedBytesPerPage;
 
@@ -24630,7 +24649,7 @@
 
 static sqInt
 isClassOfNonImmequalTo(sqInt oop, sqInt classOop)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt ccIndex;
     sqInt cl;
 
@@ -24742,7 +24761,7 @@
 
 sqInt
 isInMemory(sqInt address)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return (oopisGreaterThanOrEqualTo(address, startOfMemory()))
 	 && ((((usqInt) address)) < (((usqInt) GIV(endOfMemory))));
 }
@@ -24961,7 +24980,7 @@
 
 sqInt
 isReallyYoungObject(sqInt obj)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	return (GIV(gcMode) != GCModeFull)
 	 && (oopisGreaterThanOrEqualTo(obj, youngStart()));
 }

@@ Diff output truncated at 50000 characters. @@


More information about the Vm-dev mailing list