[Vm-dev] [commit][2885] CogVM source as per VMMaker.oscog-eem.659

commits at squeakvm.org commits at squeakvm.org
Fri Mar 28 19:19:19 UTC 2014


Revision: 2885
Author:   eliot
Date:     2014-03-28 12:19:16 -0700 (Fri, 28 Mar 2014)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.659

Allow vmParameterAt: 26 put: 0 to disable the heartbeat itimer.

Fix compilation warnings in cogit.c by moving callerSavedRegMask up to Cogit.c,
accessing it in CogObjectRepresentation store check via a macro and eliminating
the hideous copying of the backEnd variable (whose removal in
CogObjectRepresentation was losing its type decl in Cog class>>declareCVarsIn:).

Make primitivePathToUsing work on Spur also.

Add ImmX11Plugin to generated plugins (but not to builds).


Addmissing  SA_ONSTACK to itimer sigaction in sqUnixITimerTickerHeartbeat.c.

Modified Paths:
--------------
    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/nsspursrc/vm/cogit.c
    branches/Cog/nsspursrc/vm/cogit.h
    branches/Cog/nsspursrc/vm/cogmethod.h
    branches/Cog/nsspursrc/vm/cointerp.c
    branches/Cog/nsspursrc/vm/cointerp.h
    branches/Cog/nsspursrc/vm/gcc3x-cointerp.c
    branches/Cog/nsspursrc/vm/interp.h
    branches/Cog/nsspursrc/vm/vmCallback.h
    branches/Cog/nsspurstacksrc/vm/gcc3x-interp.c
    branches/Cog/nsspurstacksrc/vm/interp.c
    branches/Cog/nsspurstacksrc/vm/interp.h
    branches/Cog/nsspurstacksrc/vm/vmCallback.h
    branches/Cog/platforms/unix/vm/sqUnixITimerTickerHeartbeat.c
    branches/Cog/spursrc/vm/cogit.c
    branches/Cog/spursrc/vm/cogit.h
    branches/Cog/spursrc/vm/cogmethod.h
    branches/Cog/spursrc/vm/cointerp.c
    branches/Cog/spursrc/vm/cointerp.h
    branches/Cog/spursrc/vm/gcc3x-cointerp.c
    branches/Cog/spursrc/vm/interp.h
    branches/Cog/spursrc/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/ImmX11Plugin/ImmX11Plugin.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

Added Paths:
-----------
    branches/Cog/nscogsrc/plugins/ImmX11Plugin/
    branches/Cog/nscogsrc/plugins/ImmX11Plugin/ImmX11Plugin.c

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

Added: branches/Cog/nscogsrc/plugins/ImmX11Plugin/ImmX11Plugin.c
===================================================================
--- branches/Cog/nscogsrc/plugins/ImmX11Plugin/ImmX11Plugin.c	                        (rev 0)
+++ branches/Cog/nscogsrc/plugins/ImmX11Plugin/ImmX11Plugin.c	2014-03-28 19:19:16 UTC (rev 2885)
@@ -0,0 +1,582 @@
+/* Automatically generated by
+	SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.659 uuid: cc4b5641-6415-4f25-a5ee-bffa61fbd6d9
+   from
+	ImmX11Plugin VMMaker.oscog-eem.659 uuid: cc4b5641-6415-4f25-a5ee-bffa61fbd6d9
+ */
+static char __buildInfo[] = "ImmX11Plugin VMMaker.oscog-eem.659 uuid: cc4b5641-6415-4f25-a5ee-bffa61fbd6d9 " __DATE__ ;
+
+
+
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <locale.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 "sqUnixMain.h"
+#include "sqUnixCharConv.h"
+extern char *setLocale(char *, size_t);
+extern int setCompositionWindowPosition(int, int);
+extern int setCompostionFocus(int);
+#include "sqMemoryAccess.h"
+
+
+/*** Constants ***/
+
+
+/*** Function Prototypes ***/
+static VirtualMachine * getInterpreter(void);
+EXPORT(const char*) getModuleName(void);
+static sqInt halt(void);
+EXPORT(sqInt) initialiseModule(void);
+static sqInt msg(char *s);
+EXPORT(sqInt) primGetEncoding(void);
+EXPORT(sqInt) primGetLocale(void);
+EXPORT(sqInt) primGetLocaleEncoding(void);
+EXPORT(sqInt) primGetPathEnc(void);
+EXPORT(sqInt) primGetTextEnc(void);
+EXPORT(sqInt) primGetXWinEnc(void);
+EXPORT(sqInt) primIsTextEncUTF8(void);
+EXPORT(sqInt) primSetCompositionFocus(void);
+EXPORT(sqInt) primSetCompositionWindowPosition(void);
+EXPORT(sqInt) primSetEncodingToLocale(void);
+EXPORT(sqInt) primSetEncoding(sqInt encoding);
+EXPORT(sqInt) primSetLocaleEncoding(sqInt encoding);
+EXPORT(sqInt) primSetLocale(sqInt locale);
+EXPORT(sqInt) primSetPathEncToLocale(void);
+EXPORT(sqInt) primSetPathEnc(sqInt encoding);
+EXPORT(sqInt) primSetTextEncToLocale(void);
+EXPORT(sqInt) primSetTextEncUTF8(void);
+EXPORT(sqInt) primSetTextEnc(sqInt encoding);
+EXPORT(sqInt) primSetXWinEncToLocale(void);
+EXPORT(sqInt) primSetXWinEnc(sqInt encoding);
+EXPORT(sqInt) setInterpreter(struct VirtualMachine*anInterpreter);
+EXPORT(sqInt) shutdownModule(void);
+static sqInt sqAssert(sqInt aBool);
+
+
+/*** Variables ***/
+
+#if !defined(SQUEAK_BUILTIN_PLUGIN)
+static void * (*arrayValueOf)(sqInt oop);
+static sqInt (*booleanValueOf)(sqInt obj);
+static sqInt (*classString)(void);
+static sqInt (*failed)(void);
+static sqInt (*falseObject)(void);
+static void * (*firstIndexableField)(sqInt oop);
+static sqInt (*instantiateClassindexableSize)(sqInt classPointer, sqInt size);
+static sqInt (*nilObject)(void);
+static sqInt (*popthenPush)(sqInt nItems, sqInt oop);
+static sqInt (*primitiveFail)(void);
+static sqInt (*stSizeOf)(sqInt oop);
+static sqInt (*stackIntegerValue)(sqInt offset);
+static sqInt (*stackValue)(sqInt offset);
+static sqInt (*trueObject)(void);
+#else /* !defined(SQUEAK_BUILTIN_PLUGIN) */
+extern void * arrayValueOf(sqInt oop);
+extern sqInt booleanValueOf(sqInt obj);
+extern sqInt classString(void);
+extern sqInt failed(void);
+extern sqInt falseObject(void);
+extern void * firstIndexableField(sqInt oop);
+extern sqInt instantiateClassindexableSize(sqInt classPointer, sqInt size);
+extern sqInt nilObject(void);
+extern sqInt popthenPush(sqInt nItems, sqInt oop);
+extern sqInt primitiveFail(void);
+extern sqInt stSizeOf(sqInt oop);
+extern sqInt stackIntegerValue(sqInt offset);
+extern sqInt stackValue(sqInt offset);
+extern sqInt trueObject(void);
+extern
+#endif
+struct VirtualMachine* interpreterProxy;
+static const char *moduleName =
+#ifdef SQUEAK_BUILTIN_PLUGIN
+	"ImmX11Plugin VMMaker.oscog-eem.659 (i)"
+#else
+	"ImmX11Plugin VMMaker.oscog-eem.659 (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;
+}
+
+EXPORT(sqInt)
+initialiseModule(void)
+{
+	return 1;
+}
+
+static sqInt
+msg(char *s)
+{
+	fprintf(stderr, "\n%s: %s", moduleName, s);
+	return 0;
+}
+
+EXPORT(sqInt)
+primGetEncoding(void)
+{
+	char *array;
+	int len;
+	sqInt ret;
+
+	len = strlen(sqTextEncoding);
+	ret = instantiateClassindexableSize(classString(), len);
+	array = ((char *) (firstIndexableField(ret)));
+	strncpy(array, (char *)sqTextEncoding, len);
+	return ret;
+}
+
+EXPORT(sqInt)
+primGetLocale(void)
+{
+	char *array;
+	int len;
+	char *locale;
+	sqInt ret;
+
+	locale = setlocale(LC_CTYPE, "");
+	if (locale) {
+		len = strlen(locale);
+		ret = instantiateClassindexableSize(classString(), len);
+		array = ((char *) (firstIndexableField(ret)));
+		strncpy(array, (char *)locale, len);
+	}
+	else {
+		ret = nilObject();
+	}
+	return ret;
+}
+
+EXPORT(sqInt)
+primGetLocaleEncoding(void)
+{
+	char *array;
+	int len;
+	sqInt ret;
+
+	if ((int) localeEncoding) {
+		len = strlen(localeEncoding);
+		ret = instantiateClassindexableSize(classString(), len);
+		array = ((char *) (firstIndexableField(ret)));
+		strncpy(array, (char *)localeEncoding, len);
+	}
+	else {
+		ret = nilObject();
+	}
+	return ret;
+}
+
+EXPORT(sqInt)
+primGetPathEnc(void)
+{
+	char *array;
+	int len;
+	sqInt ret;
+
+	len = strlen(uxPathEncoding);
+	ret = instantiateClassindexableSize(classString(), len);
+	array = ((char *) (firstIndexableField(ret)));
+	strncpy(array, (char *)uxPathEncoding, len);
+	return ret;
+}
+
+EXPORT(sqInt)
+primGetTextEnc(void)
+{
+	char *array;
+	int len;
+	sqInt ret;
+
+	len = strlen(uxTextEncoding);
+	ret = instantiateClassindexableSize(classString(), len);
+	array = ((char *) (firstIndexableField(ret)));
+	strncpy(array, (char *)uxTextEncoding, len);
+	return ret;
+}
+
+EXPORT(sqInt)
+primGetXWinEnc(void)
+{
+	char *array;
+	int len;
+	sqInt ret;
+
+	len = strlen(uxXWinEncoding);
+	ret = instantiateClassindexableSize(classString(), len);
+	array = ((char *) (firstIndexableField(ret)));
+	strncpy(array, (char *)uxXWinEncoding, len);
+	return ret;
+}
+
+EXPORT(sqInt)
+primIsTextEncUTF8(void)
+{
+	sqInt _return_value;
+
+	_return_value = (((textEncodingUTF8)) ? trueObject() : falseObject());
+	if (failed()) {
+		return null;
+	}
+	popthenPush(1, _return_value);
+	return null;
+}
+
+EXPORT(sqInt)
+primSetCompositionFocus(void)
+{
+	sqInt bool;
+	sqInt ret;
+	sqInt _return_value;
+
+	bool = booleanValueOf(stackValue(0));
+	if (failed()) {
+		return null;
+	}
+	ret = setCompositionFocus(bool);
+	if (ret == 0) {
+		primitiveFail();
+		return null;
+	}
+	_return_value = ((ret) ? trueObject() : falseObject());
+	if (failed()) {
+		return null;
+	}
+	popthenPush(2, _return_value);
+	return null;
+}
+
+EXPORT(sqInt)
+primSetCompositionWindowPosition(void)
+{
+	sqInt ret;
+	sqInt x;
+	sqInt y;
+	sqInt _return_value;
+
+	x = stackIntegerValue(1);
+	y = stackIntegerValue(0);
+	if (failed()) {
+		return null;
+	}
+	ret = setCompositionWindowPosition(x, y);
+	if (ret == 0) {
+		primitiveFail();
+		return null;
+	}
+	_return_value = ((ret) ? trueObject() : falseObject());
+	if (failed()) {
+		return null;
+	}
+	popthenPush(3, _return_value);
+	return null;
+}
+
+EXPORT(sqInt)
+primSetEncodingToLocale(void)
+{
+	sqInt ret;
+
+	if ((int) localeEncoding) {
+		sqTextEncoding = (void *)localeEncoding;
+		ret = trueObject();
+	}
+	else {
+		ret = falseObject();
+	}
+	if (failed()) {
+		return null;
+	}
+	popthenPush(1, ret);
+	return null;
+}
+
+EXPORT(sqInt)
+primSetEncoding(sqInt encoding)
+{
+	size_t len;
+	char *name;
+
+	len = stSizeOf(encoding);
+	name = ((char *) (firstIndexableField(encoding)));
+	setNEncoding(&sqTextEncoding, name, len);
+	return encoding;
+}
+
+EXPORT(sqInt)
+primSetLocaleEncoding(sqInt encoding)
+{
+	size_t len;
+	char *name;
+
+	len = stSizeOf(encoding);
+	name = ((char *) (firstIndexableField(encoding)));
+	setNEncoding(&localeEncoding, name, len);
+	sqTextEncoding= uxTextEncoding= uxPathEncoding= uxXWinEncoding= localeEncoding;
+	return encoding;
+}
+
+EXPORT(sqInt)
+primSetLocale(sqInt locale)
+{
+	char *array;
+	size_t len;
+	char *name;
+	sqInt ret;
+
+	len = stSizeOf(locale);
+	name = ((char *) (arrayValueOf(locale)));
+	name = setLocale(name, len);
+	if ((int) name) {
+		len = strlen(name);
+		ret = instantiateClassindexableSize(classString(), len);
+		array = ((char *) (firstIndexableField(ret)));
+		strncpy(array, (char *)name, len);
+		return ret;
+	}
+	else {
+		return nilObject();
+	}
+}
+
+EXPORT(sqInt)
+primSetPathEncToLocale(void)
+{
+	sqInt ret;
+
+	if ((int) localeEncoding) {
+		uxPathEncoding = (void *)localeEncoding;
+		ret = trueObject();
+	}
+	else {
+		ret = falseObject();
+	}
+	if (failed()) {
+		return null;
+	}
+	popthenPush(1, ret);
+	return null;
+}
+
+EXPORT(sqInt)
+primSetPathEnc(sqInt encoding)
+{
+	size_t len;
+	char *name;
+
+	len = stSizeOf(encoding);
+	name = ((char *) (firstIndexableField(encoding)));
+	setNEncoding(&uxPathEncoding, name, len);
+	return encoding;
+}
+
+EXPORT(sqInt)
+primSetTextEncToLocale(void)
+{
+	sqInt ret;
+
+	if ((int) localeEncoding) {
+		uxTextEncoding = (void *)localeEncoding;
+		ret = trueObject();
+	}
+	else {
+		ret = falseObject();
+	}
+	if (failed()) {
+		return null;
+	}
+	popthenPush(1, ret);
+	return null;
+}
+
+EXPORT(sqInt)
+primSetTextEncUTF8(void)
+{
+	sqInt bool;
+	sqInt _return_value;
+
+	bool = booleanValueOf(stackValue(0));
+	if (failed()) {
+		return null;
+	}
+	textEncodingUTF8 = bool;
+	_return_value = ((bool) ? trueObject() : falseObject());
+	if (failed()) {
+		return null;
+	}
+	popthenPush(2, _return_value);
+	return null;
+}
+
+EXPORT(sqInt)
+primSetTextEnc(sqInt encoding)
+{
+	size_t len;
+	char *name;
+
+	len = stSizeOf(encoding);
+	name = ((char *) (firstIndexableField(encoding)));
+	setNEncoding(&uxTextEncoding, name, len);
+	return encoding;
+}
+
+EXPORT(sqInt)
+primSetXWinEncToLocale(void)
+{
+	sqInt ret;
+
+	if ((int) localeEncoding) {
+		uxXWinEncoding = (void *)localeEncoding;
+		ret = trueObject();
+	}
+	else {
+		ret = falseObject();
+	}
+	if (failed()) {
+		return null;
+	}
+	popthenPush(1, ret);
+	return null;
+}
+
+EXPORT(sqInt)
+primSetXWinEnc(sqInt encoding)
+{
+	size_t len;
+	char *name;
+
+	len = stSizeOf(encoding);
+	name = ((char *) (firstIndexableField(encoding)));
+	setNEncoding(&uxXWinEncoding, name, len);
+	return encoding;
+}
+
+
+/*	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;
+		booleanValueOf = interpreterProxy->booleanValueOf;
+		classString = interpreterProxy->classString;
+		failed = interpreterProxy->failed;
+		falseObject = interpreterProxy->falseObject;
+		firstIndexableField = interpreterProxy->firstIndexableField;
+		instantiateClassindexableSize = interpreterProxy->instantiateClassindexableSize;
+		nilObject = interpreterProxy->nilObject;
+		popthenPush = interpreterProxy->popthenPush;
+		primitiveFail = interpreterProxy->primitiveFail;
+		stSizeOf = interpreterProxy->stSizeOf;
+		stackIntegerValue = interpreterProxy->stackIntegerValue;
+		stackValue = interpreterProxy->stackValue;
+		trueObject = interpreterProxy->trueObject;
+#endif /* !defined(SQUEAK_BUILTIN_PLUGIN) */
+	}
+	return ok;
+}
+
+EXPORT(sqInt)
+shutdownModule(void)
+{
+	return 1;
+}
+
+static sqInt
+sqAssert(sqInt aBool)
+{
+	/* missing DebugCode */;
+}
+
+
+#ifdef SQUEAK_BUILTIN_PLUGIN
+
+void* ImmX11Plugin_exports[][3] = {
+	{"ImmX11Plugin", "getModuleName", (void*)getModuleName},
+	{"ImmX11Plugin", "initialiseModule", (void*)initialiseModule},
+	{"ImmX11Plugin", "primGetEncoding\000\377", (void*)primGetEncoding},
+	{"ImmX11Plugin", "primGetLocale\000\377", (void*)primGetLocale},
+	{"ImmX11Plugin", "primGetLocaleEncoding\000\377", (void*)primGetLocaleEncoding},
+	{"ImmX11Plugin", "primGetPathEnc\000\377", (void*)primGetPathEnc},
+	{"ImmX11Plugin", "primGetTextEnc\000\377", (void*)primGetTextEnc},
+	{"ImmX11Plugin", "primGetXWinEnc\000\377", (void*)primGetXWinEnc},
+	{"ImmX11Plugin", "primIsTextEncUTF8\000\377", (void*)primIsTextEncUTF8},
+	{"ImmX11Plugin", "primSetCompositionFocus\000\377", (void*)primSetCompositionFocus},
+	{"ImmX11Plugin", "primSetCompositionWindowPosition\000\000", (void*)primSetCompositionWindowPosition},
+	{"ImmX11Plugin", "primSetEncoding", (void*)primSetEncoding},
+	{"ImmX11Plugin", "primSetEncodingToLocale\000\377", (void*)primSetEncodingToLocale},
+	{"ImmX11Plugin", "primSetLocale", (void*)primSetLocale},
+	{"ImmX11Plugin", "primSetLocaleEncoding", (void*)primSetLocaleEncoding},
+	{"ImmX11Plugin", "primSetPathEnc", (void*)primSetPathEnc},
+	{"ImmX11Plugin", "primSetPathEncToLocale\000\377", (void*)primSetPathEncToLocale},
+	{"ImmX11Plugin", "primSetTextEnc", (void*)primSetTextEnc},
+	{"ImmX11Plugin", "primSetTextEncToLocale\000\377", (void*)primSetTextEncToLocale},
+	{"ImmX11Plugin", "primSetTextEncUTF8\000\377", (void*)primSetTextEncUTF8},
+	{"ImmX11Plugin", "primSetXWinEnc", (void*)primSetXWinEnc},
+	{"ImmX11Plugin", "primSetXWinEncToLocale\000\377", (void*)primSetXWinEncToLocale},
+	{"ImmX11Plugin", "setInterpreter", (void*)setInterpreter},
+	{"ImmX11Plugin", "shutdownModule\000\377", (void*)shutdownModule},
+	{NULL, NULL, NULL}
+};
+
+#else /* ifdef SQ_BUILTIN_PLUGIN */
+
+signed char primSetCompositionWindowPositionAccessorDepth = 0;
+
+#endif /* ifdef SQ_BUILTIN_PLUGIN */

Modified: branches/Cog/nscogsrc/vm/cogit.c
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.c	2014-03-26 01:03:02 UTC (rev 2884)
+++ branches/Cog/nscogsrc/vm/cogit.c	2014-03-28 19:19:16 UTC (rev 2885)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.655 uuid: d6c00552-e909-49e0-a838-d6c3225dedda
+	CCodeGenerator VMMaker.oscog-eem.659 uuid: cc4b5641-6415-4f25-a5ee-bffa61fbd6d9
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.655 uuid: d6c00552-e909-49e0-a838-d6c3225dedda
+	StackToRegisterMappingCogit VMMaker.oscog-eem.659 uuid: cc4b5641-6415-4f25-a5ee-bffa61fbd6d9
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.655 uuid: d6c00552-e909-49e0-a838-d6c3225dedda " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.659 uuid: cc4b5641-6415-4f25-a5ee-bffa61fbd6d9 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -1101,7 +1101,7 @@
 static AbstractInstruction aMethodLabel;
 static sqInt annotationIndex;
 static InstructionAnnotation * annotations;
-static sqInt backEnd;
+static AbstractInstruction * const backEnd = &aMethodLabel;
 static usqInt baseAddress;
 static sqInt blockCount;
 static AbstractInstruction * blockEntryLabel;
@@ -2019,6 +2019,7 @@
 #define blockAlignment(self) 8
 #define blockStartAt(index) (&blockStarts[index])
 #define breakOnImplicitReceiver() (traceFlags & 64)
+#define callerSavedRegMask() callerSavedRegMask
 #define ceBaseFrameReturnPC() ceBaseFrameReturnTrampoline
 #define ceCannotResumePC() ((usqInt)ceCannotResumeTrampoline)
 #define ceCheckFeatures() ceCheckFeaturesFunction()
@@ -2554,7 +2555,7 @@
     AbstractInstruction *lastInst;
     sqInt reg;
 
-	callerSavedRegsToBeSaved = (callerSavedRegisterMask(backEnd)) & registersToBeSaved;
+	callerSavedRegsToBeSaved = callerSavedRegMask & registersToBeSaved;
 	for (reg = GPRegMax; reg >= GPRegMin; reg += -1) {
 		if ((reg != TempReg)
 		 && (callerSavedRegsToBeSaved & (registerMaskFor(reg)))) {
@@ -15896,7 +15897,7 @@
 	/* begin JumpNonZero: */
 	jmpAlreadyRoot = genoperand(JumpNonZero, ((sqInt)0));
 	assert(destReg == ReceiverResultReg);
-	CallRTregistersToBeSavedMask(ceStoreCheckTrampoline, (registerMaskFor(sourceReg)) & (callerSavedRegisterMask(backEnd)));
+	CallRTregistersToBeSavedMask(ceStoreCheckTrampoline, (registerMaskFor(sourceReg)) & (callerSavedRegMask()));
 	jmpTarget(jmpImmediate, jmpTarget(jmpDestYoung, jmpTarget(jmpSourceOld, jmpTarget(jmpAlreadyRoot, gLabel()))));
 	return 0;
 }

Modified: branches/Cog/nscogsrc/vm/cogit.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.h	2014-03-26 01:03:02 UTC (rev 2884)
+++ branches/Cog/nscogsrc/vm/cogit.h	2014-03-28 19:19:16 UTC (rev 2885)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.655 uuid: d6c00552-e909-49e0-a838-d6c3225dedda
+	CCodeGenerator VMMaker.oscog-eem.659 uuid: cc4b5641-6415-4f25-a5ee-bffa61fbd6d9
  */
 
 

Modified: branches/Cog/nscogsrc/vm/cogmethod.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogmethod.h	2014-03-26 01:03:02 UTC (rev 2884)
+++ branches/Cog/nscogsrc/vm/cogmethod.h	2014-03-28 19:19:16 UTC (rev 2885)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.655 uuid: d6c00552-e909-49e0-a838-d6c3225dedda
+	CCodeGenerator VMMaker.oscog-eem.659 uuid: cc4b5641-6415-4f25-a5ee-bffa61fbd6d9
  */
 
 typedef struct {

Modified: branches/Cog/nscogsrc/vm/cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.c	2014-03-26 01:03:02 UTC (rev 2884)
+++ branches/Cog/nscogsrc/vm/cointerp.c	2014-03-28 19:19:16 UTC (rev 2885)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.656 uuid: 03e04241-b10f-4620-9be5-99543d124412
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.658 uuid: e40c5fd5-9990-433f-bd76-2f8d0324e24f
    from
-	CoInterpreter VMMaker.oscog-eem.656 uuid: 03e04241-b10f-4620-9be5-99543d124412
+	CoInterpreter VMMaker.oscog-eem.658 uuid: e40c5fd5-9990-433f-bd76-2f8d0324e24f
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.656 uuid: 03e04241-b10f-4620-9be5-99543d124412 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.658 uuid: e40c5fd5-9990-433f-bd76-2f8d0324e24f " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -367,6 +367,7 @@
 static sqInt adjustAllOopsBy(sqInt bytesToShift);
 static sqInt allInstancesOf(sqInt aBehavior);
 static sqInt allObjects(void);
+static sqInt allObjectsUnmarked(void);
 static char * allocateMemoryminimumimageFileheaderSize(sqInt heapSize, sqInt minimumMemory, sqImageFile fileStream, sqInt headerSize);
 static sqInt allYoungand(sqInt array1, sqInt array2);
 usqInt argumentCountAddress(void);
@@ -2039,7 +2040,7 @@
 	/* 574 */ (void (*)(void))0,
 	/* 575 */ (void (*)(void))0,
  0 };
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.656";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.658";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -13775,7 +13776,46 @@
 	return resultArray;
 }
 
+static sqInt
+allObjectsUnmarked(void)
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    sqInt chunk;
+    sqInt header;
+    sqInt o;
+    sqInt oop;
+    sqInt sz;
 
+	/* begin allObjectsDo: */
+	/* begin oopFromChunk: */
+	chunk = startOfMemory();
+	oop = chunk + (headerTypeBytes[(longAt(chunk)) & TypeMask]);
+	while (oop < GIV(freeStart)) {
+		if (!(((longAt(oop)) & TypeMask) == HeaderTypeFree)) {
+			if (((longAt(oop)) & MarkBit) != 0) {
+				return 0;
+			}
+
+		}
+		/* begin objectAfter: */
+		if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
+			error("no objects after the end of memory");
+		}
+		if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
+			sz = (longAt(oop)) & AllButTypeMask;
+		}
+		else {
+			/* begin sizeBitsOf: */
+			header = longAt(oop);
+			sz = ((header & TypeMask) == HeaderTypeSizeAndClass
+				? (longAt(oop - (BytesPerWord * 2))) & LongSizeMask
+				: header & SizeMask);
+		}
+		oop = (oop + sz) + (headerTypeBytes[(longAt(oop + sz)) & TypeMask]);
+	}
+	return 1;
+}
+
+
 /*	Translate to C function call with (case sensitive) camelCase. The purpose
 	of this
 	method is to document the translation.
@@ -40760,7 +40800,6 @@
     sqInt followWeak;
     usqInt freeStartAtStart;
     sqInt goal;
-    sqInt hdr;
     sqInt header;
     sqInt header1;
     sqInt header2;
@@ -40780,9 +40819,6 @@
     sqInt sz1;
     sqInt sz2;
 
-
-	/* for now... */
-
 	/* begin externalWriteBackHeadFramePointers */
 	assert((GIV(framePointer) - GIV(stackPointer)) < LargeContextSize);
 	assert(GIV(stackPage) == (mostRecentlyUsedPage()));
@@ -40795,6 +40831,13 @@
 	(GIV(stackPage)->headFP = GIV(framePointer));
 	(GIV(stackPage)->headSP = GIV(stackPointer));
 	assert(pageListIsWellFormed());
+	if (!(GIV(argumentCount) >= 2)) {
+		return (GIV(primFailCode) = PrimErrBadNumArgs);
+	}
+	if (!(((longAt(GIV(stackPointer))) == GIV(trueObj))
+		 || ((longAt(GIV(stackPointer))) == GIV(falseObj)))) {
+		return (GIV(primFailCode) = PrimErrBadArgument);
+	}
 	/* begin pathTo:using:followWeak: */
 	goal = longAt(GIV(stackPointer) + (2 * BytesPerWord));
 	stack = longAt(GIV(stackPointer) + (1 * BytesPerWord));
@@ -40804,6 +40847,7 @@
 		err = PrimErrBadArgument;
 		goto l4;
 	}
+	assert(allObjectsUnmarked());
 
 	/* check no allocations during search */
 
@@ -40863,8 +40907,7 @@
 			}
 			else {
 				if (index >= 0) {
-					hdr = longAt(current);
-					next = (((((usqInt) hdr) >> 12) & 0x1F) == ClassMethodContextCompactIndex
+					next = (((((usqInt) (longAt(current))) >> 12) & 0x1F) == ClassMethodContextCompactIndex
 						? fieldOrSenderFPofContext(index, current)
 						: longAt((current + BaseHeaderSize) + (index << ShiftForWord)));
 				}
@@ -40880,6 +40923,9 @@
 			}
 			else {
 				if (next >= heapBase) {
+
+					/* exclude Cog methods */
+
 					assert(checkOkayOop(next));
 				}
 			}
@@ -40932,9 +40978,9 @@
 					index = CtxtTempFrameStart + (stackPointerIndexForFrame(((char *) next)));
 				}
 				else {
-					hdr = longAt(next);
-					longAtput(next, hdr | MarkBit);
-					if (((((usqInt) hdr) >> (instFormatFieldLSB())) & 15) >= 12) {
+					/* begin mark: */
+					longAtput(next, (longAt(next)) | MarkBit);
+					if (((((usqInt) (longAt(next))) >> (instFormatFieldLSB())) & 15) >= 12) {
 						index = (literalCountOfHeader(headerOf(next))) + LiteralStart;
 					}
 					else {
@@ -45539,7 +45585,10 @@
 		}
 	}
 	if (index == 26) {
-		if (arg > 1) {
+		if (arg >= 0) {
+
+			/* 0 turns off the heartbeat */
+
 			result = ioHeartbeatMilliseconds();
 			ioSetHeartbeatMilliseconds(arg);
 			/* begin initPrimCall */

Modified: branches/Cog/nscogsrc/vm/cointerp.h
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.h	2014-03-26 01:03:02 UTC (rev 2884)
+++ branches/Cog/nscogsrc/vm/cointerp.h	2014-03-28 19:19:16 UTC (rev 2885)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.656 uuid: 03e04241-b10f-4620-9be5-99543d124412
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.658 uuid: e40c5fd5-9990-433f-bd76-2f8d0324e24f
  */
 
 

Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2014-03-26 01:03:02 UTC (rev 2884)
+++ branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2014-03-28 19:19:16 UTC (rev 2885)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.656 uuid: 03e04241-b10f-4620-9be5-99543d124412
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.658 uuid: e40c5fd5-9990-433f-bd76-2f8d0324e24f
    from
-	CoInterpreter VMMaker.oscog-eem.656 uuid: 03e04241-b10f-4620-9be5-99543d124412
+	CoInterpreter VMMaker.oscog-eem.658 uuid: e40c5fd5-9990-433f-bd76-2f8d0324e24f
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.656 uuid: 03e04241-b10f-4620-9be5-99543d124412 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.658 uuid: e40c5fd5-9990-433f-bd76-2f8d0324e24f " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -370,6 +370,7 @@
 static sqInt adjustAllOopsBy(sqInt bytesToShift);
 static sqInt allInstancesOf(sqInt aBehavior);
 static sqInt allObjects(void);
+static sqInt allObjectsUnmarked(void);
 static char * allocateMemoryminimumimageFileheaderSize(sqInt heapSize, sqInt minimumMemory, sqImageFile fileStream, sqInt headerSize);
 static sqInt allYoungand(sqInt array1, sqInt array2);
 usqInt argumentCountAddress(void);
@@ -2042,7 +2043,7 @@
 	/* 574 */ (void (*)(void))0,
 	/* 575 */ (void (*)(void))0,
  0 };
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.656";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.658";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -13784,7 +13785,46 @@
 	return resultArray;
 }
 
+static sqInt
+allObjectsUnmarked(void)
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    sqInt chunk;
+    sqInt header;
+    sqInt o;
+    sqInt oop;
+    sqInt sz;
 
+	/* begin allObjectsDo: */
+	/* begin oopFromChunk: */
+	chunk = startOfMemory();
+	oop = chunk + (headerTypeBytes[(longAt(chunk)) & TypeMask]);
+	while (oop < GIV(freeStart)) {
+		if (!(((longAt(oop)) & TypeMask) == HeaderTypeFree)) {
+			if (((longAt(oop)) & MarkBit) != 0) {
+				return 0;
+			}
+
+		}
+		/* begin objectAfter: */
+		if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
+			error("no objects after the end of memory");
+		}
+		if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
+			sz = (longAt(oop)) & AllButTypeMask;
+		}
+		else {
+			/* begin sizeBitsOf: */
+			header = longAt(oop);
+			sz = ((header & TypeMask) == HeaderTypeSizeAndClass
+				? (longAt(oop - (BytesPerWord * 2))) & LongSizeMask
+				: header & SizeMask);
+		}
+		oop = (oop + sz) + (headerTypeBytes[(longAt(oop + sz)) & TypeMask]);
+	}
+	return 1;
+}
+
+
 /*	Translate to C function call with (case sensitive) camelCase. The purpose
 	of this
 	method is to document the translation.
@@ -40769,7 +40809,6 @@
     sqInt followWeak;
     usqInt freeStartAtStart;
     sqInt goal;
-    sqInt hdr;
     sqInt header;
     sqInt header1;
     sqInt header2;
@@ -40789,9 +40828,6 @@
     sqInt sz1;
     sqInt sz2;
 
-
-	/* for now... */
-
 	/* begin externalWriteBackHeadFramePointers */
 	assert((GIV(framePointer) - GIV(stackPointer)) < LargeContextSize);
 	assert(GIV(stackPage) == (mostRecentlyUsedPage()));
@@ -40804,6 +40840,13 @@
 	(GIV(stackPage)->headFP = GIV(framePointer));
 	(GIV(stackPage)->headSP = GIV(stackPointer));
 	assert(pageListIsWellFormed());
+	if (!(GIV(argumentCount) >= 2)) {
+		return (GIV(primFailCode) = PrimErrBadNumArgs);
+	}
+	if (!(((longAt(GIV(stackPointer))) == GIV(trueObj))
+		 || ((longAt(GIV(stackPointer))) == GIV(falseObj)))) {
+		return (GIV(primFailCode) = PrimErrBadArgument);
+	}
 	/* begin pathTo:using:followWeak: */
 	goal = longAt(GIV(stackPointer) + (2 * BytesPerWord));
 	stack = longAt(GIV(stackPointer) + (1 * BytesPerWord));
@@ -40813,6 +40856,7 @@
 		err = PrimErrBadArgument;
 		goto l4;
 	}
+	assert(allObjectsUnmarked());
 
 	/* check no allocations during search */
 
@@ -40872,8 +40916,7 @@
 			}
 			else {
 				if (index >= 0) {
-					hdr = longAt(current);
-					next = (((((usqInt) hdr) >> 12) & 0x1F) == ClassMethodContextCompactIndex
+					next = (((((usqInt) (longAt(current))) >> 12) & 0x1F) == ClassMethodContextCompactIndex
 						? fieldOrSenderFPofContext(index, current)
 						: longAt((current + BaseHeaderSize) + (index << ShiftForWord)));
 				}
@@ -40889,6 +40932,9 @@
 			}
 			else {
 				if (next >= heapBase) {
+
+					/* exclude Cog methods */
+
 					assert(checkOkayOop(next));
 				}
 			}
@@ -40941,9 +40987,9 @@
 					index = CtxtTempFrameStart + (stackPointerIndexForFrame(((char *) next)));
 				}
 				else {
-					hdr = longAt(next);
-					longAtput(next, hdr | MarkBit);
-					if (((((usqInt) hdr) >> (instFormatFieldLSB())) & 15) >= 12) {
+					/* begin mark: */
+					longAtput(next, (longAt(next)) | MarkBit);
+					if (((((usqInt) (longAt(next))) >> (instFormatFieldLSB())) & 15) >= 12) {
 						index = (literalCountOfHeader(headerOf(next))) + LiteralStart;
 					}
 					else {
@@ -45548,7 +45594,10 @@
 		}
 	}
 	if (index == 26) {
-		if (arg > 1) {
+		if (arg >= 0) {
+
+			/* 0 turns off the heartbeat */
+
 			result = ioHeartbeatMilliseconds();
 			ioSetHeartbeatMilliseconds(arg);
 			/* begin initPrimCall */

Modified: branches/Cog/nscogsrc/vm/interp.h
===================================================================
--- branches/Cog/nscogsrc/vm/interp.h	2014-03-26 01:03:02 UTC (rev 2884)
+++ branches/Cog/nscogsrc/vm/interp.h	2014-03-28 19:19:16 UTC (rev 2885)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.656 uuid: 03e04241-b10f-4620-9be5-99543d124412
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.658 uuid: e40c5fd5-9990-433f-bd76-2f8d0324e24f
  */
 
 #define VM_PROXY_MAJOR 1

Modified: branches/Cog/nscogsrc/vm/vmCallback.h
===================================================================
--- branches/Cog/nscogsrc/vm/vmCallback.h	2014-03-26 01:03:02 UTC (rev 2884)
+++ branches/Cog/nscogsrc/vm/vmCallback.h	2014-03-28 19:19:16 UTC (rev 2885)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.656 uuid: 03e04241-b10f-4620-9be5-99543d124412
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.658 uuid: e40c5fd5-9990-433f-bd76-2f8d0324e24f
  */
 
 #define VM_CALLBACK_INC 1

Modified: branches/Cog/nsspursrc/vm/cogit.c
===================================================================
--- branches/Cog/nsspursrc/vm/cogit.c	2014-03-26 01:03:02 UTC (rev 2884)
+++ branches/Cog/nsspursrc/vm/cogit.c	2014-03-28 19:19:16 UTC (rev 2885)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.655 uuid: d6c00552-e909-49e0-a838-d6c3225dedda
+	CCodeGenerator VMMaker.oscog-eem.659 uuid: cc4b5641-6415-4f25-a5ee-bffa61fbd6d9
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.655 uuid: d6c00552-e909-49e0-a838-d6c3225dedda
+	StackToRegisterMappingCogit VMMaker.oscog-eem.659 uuid: cc4b5641-6415-4f25-a5ee-bffa61fbd6d9
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.655 uuid: d6c00552-e909-49e0-a838-d6c3225dedda " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.659 uuid: cc4b5641-6415-4f25-a5ee-bffa61fbd6d9 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -1097,7 +1097,7 @@
 static AbstractInstruction aMethodLabel;
 static sqInt annotationIndex;
 static InstructionAnnotation * annotations;
-static sqInt backEnd;
+static AbstractInstruction * const backEnd = &aMethodLabel;
 static usqInt baseAddress;
 static sqInt blockCount;
 static AbstractInstruction * blockEntryLabel;
@@ -2015,6 +2015,7 @@
 #define blockAlignment(self) 8
 #define blockStartAt(index) (&blockStarts[index])
 #define breakOnImplicitReceiver() (traceFlags & 64)
+#define callerSavedRegMask() callerSavedRegMask
 #define canLinkToYoungClasses() true
 #define ceBaseFrameReturnPC() ceBaseFrameReturnTrampoline
 #define ceCannotResumePC() ((usqInt)ceCannotResumeTrampoline)
@@ -2551,7 +2552,7 @@
     AbstractInstruction *lastInst;
     sqInt reg;
 
-	callerSavedRegsToBeSaved = (callerSavedRegisterMask(backEnd)) & registersToBeSaved;
+	callerSavedRegsToBeSaved = callerSavedRegMask & registersToBeSaved;
 	for (reg = GPRegMax; reg >= GPRegMin; reg += -1) {
 		if ((reg != TempReg)
 		 && (callerSavedRegsToBeSaved & (registerMaskFor(reg)))) {
@@ -16572,7 +16573,7 @@
 	/* begin JumpNonZero: */
 	jmpAlreadyRemembered = genoperand(JumpNonZero, ((sqInt)0));
 	assert(destReg == ReceiverResultReg);
-	CallRTregistersToBeSavedMask(ceStoreCheckTrampoline, (registerMaskFor(valueReg)) & (callerSavedRegisterMask(backEnd)));
+	CallRTregistersToBeSavedMask(ceStoreCheckTrampoline, (registerMaskFor(valueReg)) & (callerSavedRegMask()));
 	jmpTarget(jmpImmediate, jmpTarget(jmpDestYoung, jmpTarget(jmpSourceOld, jmpTarget(jmpAlreadyRemembered, gLabel()))));
 	return 0;
 }

Modified: branches/Cog/nsspursrc/vm/cogit.h
===================================================================
--- branches/Cog/nsspursrc/vm/cogit.h	2014-03-26 01:03:02 UTC (rev 2884)
+++ branches/Cog/nsspursrc/vm/cogit.h	2014-03-28 19:19:16 UTC (rev 2885)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.655 uuid: d6c00552-e909-49e0-a838-d6c3225dedda
+	CCodeGenerator VMMaker.oscog-eem.659 uuid: cc4b5641-6415-4f25-a5ee-bffa61fbd6d9
  */
 
 

Modified: branches/Cog/nsspursrc/vm/cogmethod.h
===================================================================
--- branches/Cog/nsspursrc/vm/cogmethod.h	2014-03-26 01:03:02 UTC (rev 2884)
+++ branches/Cog/nsspursrc/vm/cogmethod.h	2014-03-28 19:19:16 UTC (rev 2885)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.655 uuid: d6c00552-e909-49e0-a838-d6c3225dedda
+	CCodeGenerator VMMaker.oscog-eem.659 uuid: cc4b5641-6415-4f25-a5ee-bffa61fbd6d9
  */
 
 typedef struct {

Modified: branches/Cog/nsspursrc/vm/cointerp.c
===================================================================
--- branches/Cog/nsspursrc/vm/cointerp.c	2014-03-26 01:03:02 UTC (rev 2884)
+++ branches/Cog/nsspursrc/vm/cointerp.c	2014-03-28 19:19:16 UTC (rev 2885)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.655 uuid: d6c00552-e909-49e0-a838-d6c3225dedda
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.658 uuid: e40c5fd5-9990-433f-bd76-2f8d0324e24f
    from
-	CoInterpreter VMMaker.oscog-eem.655 uuid: d6c00552-e909-49e0-a838-d6c3225dedda
+	CoInterpreter VMMaker.oscog-eem.658 uuid: e40c5fd5-9990-433f-bd76-2f8d0324e24f
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.655 uuid: d6c00552-e909-49e0-a838-d6c3225dedda " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.658 uuid: e40c5fd5-9990-433f-bd76-2f8d0324e24f " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -591,6 +591,8 @@
 static sqInt fetchPointerofFreeChunk(sqInt fieldIndex, sqInt objOop);
 sqInt fetchPointerofObject(sqInt fieldIndex, sqInt objOop);
 static sqInt fetchStackPointerOf(sqInt aContext);
+static sqInt fieldOrSenderFPofContext(sqInt index, sqInt contextObj);
+static sqInt fieldofFrame(sqInt index, char *theFP);
 static void fillHighestObjectsWithMovableObjectsFromFirstFreeChunkUpTo(sqInt limitObj);
 static sqInt findApplicationOfTargetMixinstartingAtBehavior(sqInt targetMixin, sqInt aBehavior);
 static sqInt findClassContainingMethodstartingAt(sqInt meth, sqInt classObj);
@@ -648,6 +650,7 @@
 static sqInt frameContext(char *theFP);
 static sqInt frameHasContext(char *theFP);
 static sqInt frameIsBlockActivation(char *theFP);
+static sqInt frameIsMarked(sqInt theFPInt);
 static sqInt frameMethodObject(char *theFP);
 static sqInt frameNumArgs(char *theFP);
 static char * frameOfMarriedContext(sqInt aContext);
@@ -745,6 +748,7 @@
 static sqInt isForwardedClassTag(sqInt classIndex);
 sqInt isForwardedObjectClassIndexPun(void);
 sqInt isForwarded(sqInt objOop);
+static sqInt isFrameonPage(char *aFrame, StackPage *aPage);
 static sqInt isFree(StackPage * self_in_isFree);
 static sqInt isFreeObject(sqInt objOop);
 sqInt isImmediate(sqInt oop);
@@ -1107,6 +1111,7 @@
 static void primitiveObjectPointsTo(void);
 static sqInt primitiveObjectperformwithArgumentslookedUpIn(sqInt actualReceiver, sqInt selector, sqInt argumentArray, sqInt lookupClass);
 EXPORT(sqInt) primitiveOriginalMillisecondClock(void);
+EXPORT(sqInt) primitivePathToUsing(void);
 static void primitivePerform(void);
 static void primitivePerformInSuperclass(void);
 static void primitivePerformWithArgs(void);
@@ -1238,6 +1243,7 @@
 static void processEphemerons(void);
 static void processWeaklings(void);
 static void processWeakSurvivor(sqInt weakObj);
+static void pruneStackstackp(sqInt stack, sqInt stackp);
 void pushBool(sqInt trueOrFalse);
 static sqInt pushedReceiverOrClosureOfFrame(char *theFP);
 void pushFloat(double f);
@@ -1383,6 +1389,8 @@
 static void transferTofrom(sqInt newProc, sqInt sourceCode);
 sqInt trueObject(void);
 static void unlinkSolitaryFreeTreeNode(sqInt freeTreeNode);
+static void unmarkAfterPathTo(void);
+static void unmarkAllFrames(void);
 void updateStackZoneReferencesToCompiledCodePreCompaction(void);
 static void updateStateOfSpouseContextForFrameWithSP(char *theFP, char *theSP);
 static sqInt usedSize(SpurCircularBuffer * self_in_usedSize);
@@ -1417,8 +1425,8 @@
 _iss sqInt primFailCode;
 _iss sqInt specialObjectsOop;
 _iss char * framePointer;
+_iss sqInt nilObj;
 _iss usqInt method;
-_iss sqInt nilObj;
 _iss StackPage * stackPage;
 _iss sqInt bytecodeSetSelector;
 _iss sqInt argumentCount;
@@ -1428,16 +1436,16 @@
 _iss usqInt newMethod;
 _iss usqInt newSpaceLimit;
 _iss StackPage * pages;
+_iss char * stackBasePlus1;
 _iss sqInt hiddenRootsObj;
-_iss char * stackBasePlus1;
 _iss SpurCircularBuffer highestObjects;
 _iss sqInt totalFreeOldSpace;
 _iss usqInt endOfMemory;
 _iss sqInt trueObj;
+_iss sqInt remapBufferCount;
 _iss sqInt needGCFlag;
 _iss SpurSegmentInfo * segments;
 _iss sqInt falseObj;
-_iss sqInt remapBufferCount;
 _iss sqInt traceLogIndex;
 _iss sqInt bytesPerPage;
 _iss sqInt * freeLists;
@@ -1453,8 +1461,8 @@
 _iss SpurNewSpaceSpace futureSpace;
 _iss usqInt newSpaceStart;
 _iss StackPage * mostRecentlyUsedPage;
+_iss sqInt numStackPages;
 _iss unsigned char primTraceLogIndex;
-_iss sqInt numStackPages;
 _iss sqInt classTableFirstPage;
 _iss usqInt oldSpaceStart;
 _iss sqInt futureSurvivorStart;
@@ -1613,6 +1621,7 @@
 sqInt deferDisplayUpdates;
 void * showSurfaceFn;
 char * breakSelector;
+usqInt heapBase;
 struct VirtualMachine* interpreterProxy;
 static void (*interruptCheckChain)(void) = 0;
 sqInt suppressHeartbeatFlag;
@@ -2195,8 +2204,7 @@
 	/* 574 */ (void (*)(void))0,
 	/* 575 */ (void (*)(void))0,
  0 };
-usqInt heapBase;
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.655";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.658";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -5488,6 +5496,7 @@
 							GIV(framePointer) = localFP;
 							
 							ceEnterCogCodePopReceiverReg();
+							null;
 							goto l290;
 						}
 						localIP = pointerForOop(longAt(localFP + FoxIFSavedIP));
@@ -5505,7 +5514,7 @@
 					/* begin fetchNextBytecode */
 					currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector);
 
-					/* return self */
+					null;
 				l290:	/* end baseFrameReturn */;
 					goto l287;
 				}
@@ -6551,7 +6560,6 @@
 						/* begin internalPush: */
 						longAtPointerput((localSP -= BytesPerOop), longAt((rcvr1 + (BaseHeaderSize)) + (byte3 << 2)));
 					}
-					null;
 					goto l5;
 				}
 				if (opType == 3) {
@@ -6561,7 +6569,6 @@
 					assert(GIV(method) == (iframeMethod(localFP)));
 					object = longAt((GIV(method) + (BaseHeaderSize)) + ((byte3 + LiteralStart) << 2));
 					longAtPointerput((localSP -= BytesPerOop), object);
-					null;
 					goto l5;
 				}
 				if (opType == 4) {
@@ -6589,7 +6596,6 @@
 					/* begin internalPush: */
 					longAtPointerput((localSP -= BytesPerOop), longAt((litVar1 + (BaseHeaderSize)) + (ValueIndex << 2)));
 
-					null;
 					goto l5;
 				}
 				top = longAtPointer(localSP);
@@ -26959,6 +26965,114 @@
 }
 
 
+/*	Arrange to answer naked frame pointers for unmarried
+	senders to avoid reifying contexts in the search. */
+
+static sqInt
+fieldOrSenderFPofContext(sqInt index, sqInt contextObj)
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    char *spouseFP;
+    sqInt tempIndex;
+    sqInt value;
+
+	tempIndex = index - CtxtTempFrameStart;
+	if (!((((longAt((contextObj + (BaseHeaderSize)) + (SenderIndex << 2))) & 1))
+		 && (!(isWidowedContext(contextObj))))) {
+		return (tempIndex >= (fetchStackPointerOf(contextObj))
+			? GIV(nilObj)
+			: longAt((contextObj + (BaseHeaderSize)) + (index << 2)));
+	}
+	/* begin frameOfMarriedContext: */
+	value = longAt((contextObj + (BaseHeaderSize)) + (SenderIndex << 2));
+	/* begin withoutSmallIntegerTags: */
+	assert((value & 1));
+	spouseFP = pointerForOop(value - 1);
+	if (tempIndex >= (stackPointerIndexForFrame(spouseFP))) {
+		return GIV(nilObj);
+	}
+	return fieldofFrame(index, spouseFP);
+}
+
+
+/*	Arrange to answer naked frame pointers for unmarried
+	senders to avoid reifying contexts in the search. */
+
+static sqInt
+fieldofFrame(sqInt index, char *theFP)
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    sqInt callerContextOrNil;
+    char *callerFP;
+    sqInt frameNumArgs;
+    sqInt frameNumArgs1;
+    sqInt index1;
+    sqInt numArgs;
+    StackPage *thePage;
+
+	
+	switch (index) {
+	case SenderIndex:
+		/* begin frameCallerFP: */
+		callerFP = pointerForOop(longAt(theFP + FoxSavedFP));
+		return (callerFP == 0
+			? (/* begin frameCallerContext: */
+				assert(isBaseFrame(theFP)),
+				/* begin stackPageFor: */
+				/* begin stackPageAt: */
+				/* begin pageIndexFor: */
+				assert((((((char *) theFP)) >= (GIV(stackBasePlus1) - 1)) && ((((char *) theFP)) <= (((char *) GIV(pages)))))),
+				(index1 = pageIndexForstackBasePlus1bytesPerPage(theFP, GIV(stackBasePlus1), GIV(bytesPerPage))),
+				(thePage = stackPageAtpages(index1, GIV(pages))),
+				(callerContextOrNil = longAt((thePage->baseAddress))),
+				assert(addressCouldBeObj(callerContextOrNil)),
+				assert((callerContextOrNil == (nilObject()))
+					 || (isContext(callerContextOrNil))),
+				callerContextOrNil)
+			: (((((usqInt)(longAt(callerFP + FoxMethod)))) < (startOfMemory())
+					? ((longAt(callerFP + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
+					: (byteAt((callerFP + FoxIFrameFlags) + 2)) != 0)
+					? (assert(checkIsStillMarriedContextcurrentFP(frameContext(callerFP), null)),
+						longAt(callerFP + FoxThisContext))
+					: ((sqInt)callerFP)));
+
+	case StackPointerIndex:
+	case InstructionPointerIndex:
+		return ConstZero;
+
+	case MethodIndex:
+		return ((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
+			? ((mframeHomeMethod(theFP))->methodObject)
+			: longAt(theFP + FoxMethod));
+
+	case ClosureIndex:
+		return (((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
+			? ((longAt(theFP + FoxMethod)) & MFMethodFlagIsBlockFlag) != 0
+			: (byteAt((theFP + FoxIFrameFlags) + 3)) != 0)
+			? (/* begin frameStackedReceiver:numArgs: */
+				(numArgs = ((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
+						? ((mframeCogMethod(theFP))->cmNumArgs)
+						: byteAt((theFP + FoxIFrameFlags) + 1))),
+				longAt(theFP + ((FoxCallerSavedIP + BytesPerWord) + (numArgs << ShiftForWord))))
+			: GIV(nilObj));
+
+	case ReceiverIndex:
+		return ((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
+			? longAt(theFP + FoxMFReceiver)
+			: longAt(theFP + FoxIFReceiver));
+
+	default:
+		assert((((index - CtxtTempFrameStart) >= 0) && ((index - CtxtTempFrameStart) <= (stackPointerIndexForFrame(theFP)))));
+		return ((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
+			? ((index - CtxtTempFrameStart) < ((frameNumArgs = ((mframeCogMethod(theFP))->cmNumArgs)))
+					? longAt((theFP + FoxCallerSavedIP) + ((frameNumArgs - (index - CtxtTempFrameStart)) * BytesPerWord))
+					: longAt(((theFP + FoxMFReceiver) - BytesPerWord) + ((frameNumArgs - (index - CtxtTempFrameStart)) * BytesPerWord)))
+			: ((index - CtxtTempFrameStart) < ((frameNumArgs1 = byteAt((theFP + FoxIFrameFlags) + 1)))
+					? longAt((theFP + FoxCallerSavedIP) + ((frameNumArgs1 - (index - CtxtTempFrameStart)) * BytesPerWord))
+					: longAt(((theFP + FoxIFReceiver) - BytesPerWord) + ((frameNumArgs1 - (index - CtxtTempFrameStart)) * BytesPerWord))));
+
+	}
+}
+
+
 /*	Refill highestObjects with movable objects up to, but not including
 	limitObj. c.f. the loop in freeUnmarkedObjectsAndSortAndCoalesceFreeSpace. */
 
@@ -29432,6 +29546,17 @@
 }
 
 static sqInt
+frameIsMarked(sqInt theFPInt)
+{
+    sqInt methodField;
+
+	methodField = longAt(theFPInt + FoxMethod);
+	return ((((usqInt)methodField)) < (startOfMemory())
+		? (methodField & 4) != 0
+		: ((longAt(theFPInt + FoxIFrameFlags)) & 2) != 0);
+}
+
+static sqInt
 frameMethodObject(char *theFP)
 {
 	return ((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
@@ -32417,6 +32542,24 @@
 }
 
 static sqInt
+isFrameonPage(char *aFrame, StackPage *aPage)
+{
+    char *theFP;
+
+	theFP = (aPage->headFP);
+	while (1) {
+		if (theFP == aFrame) {
+			return 1;
+		}
+		if (!((theFP != ((aPage->baseFP)))
+ && ((stackPageFor(theFP)) == aPage))) break;
+		/* begin frameCallerFP: */
+		theFP = pointerForOop(longAt(theFP + FoxSavedFP));
+	}
+	return 0;
+}
+
+static sqInt
 isFree(StackPage * self_in_isFree)
 {
 	return ((self_in_isFree->baseFP)) == 0;
@@ -49946,6 +50089,319 @@
 	GIV(stackPointer) = sp;
 }
 
+
+/*	primitivePathTo: anObject using: stack <Array> followWeak: boolean
+	Answer a path to anObject from the root that does not pass through
+	the current context */
+
+EXPORT(sqInt)
+primitivePathToUsing(void)
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    sqInt classIndex;
+    sqInt classTablePage;
+    sqInt current;
+    sqInt err;
+    sqInt followWeak;
+    usqInt freeStartAtStart;
+    sqInt goal;
+    sqInt i;
+    sqInt i1;
+    sqInt iLimiT;
+    sqInt iLimiT1;
+    sqInt index;
+    sqInt methodField;
+    sqInt next;
+    usqInt numSlots;
+    usqInt numSlots1;
+    usqInt numSlots2;
+    usqInt numSlots3;
+    usqInt numSlots4;
+    usqInt numSlots5;
+    sqInt path;
+    char *sp;
+    sqInt stack;
+    sqInt stackp;
+    sqInt stackSize;
+
+	/* begin externalWriteBackHeadFramePointers */
+	assert((GIV(framePointer) - GIV(stackPointer)) < LargeContextSize);
+	assert(GIV(stackPage) == (mostRecentlyUsedPage()));
+	/* begin setHeadFP:andSP:inPage: */
+	assert(GIV(stackPointer) < GIV(framePointer));
+	assert((GIV(stackPointer) < ((GIV(stackPage)->baseAddress)))
+	 && (GIV(stackPointer) > (((GIV(stackPage)->realStackLimit)) - LargeContextSize)));
+	assert((GIV(framePointer) < ((GIV(stackPage)->baseAddress)))
+	 && (GIV(framePointer) > (((GIV(stackPage)->realStackLimit)) - (((sqInt) LargeContextSize >> 1)))));
+	(GIV(stackPage)->headFP = GIV(framePointer));
+	(GIV(stackPage)->headSP = GIV(stackPointer));
+	assert(pageListIsWellFormed());
+	if (!(GIV(argumentCount) >= 2)) {
+		return (GIV(primFailCode) = PrimErrBadNumArgs);
+	}
+	if (!(((longAt(GIV(stackPointer))) == GIV(trueObj))
+		 || ((longAt(GIV(stackPointer))) == GIV(falseObj)))) {
+		return (GIV(primFailCode) = PrimErrBadArgument);
+	}
+	/* begin pathTo:using:followWeak: */
+	goal = longAt(GIV(stackPointer) + (2 * BytesPerWord));
+	stack = longAt(GIV(stackPointer) + (1 * BytesPerWord));
+	followWeak = (longAt(GIV(stackPointer))) == GIV(trueObj);
+	if (!(((stack & 3) == 0)
+		 && (((((usqInt) (longAt(stack))) >> 24) & 0x1F) == 2))) {
+		err = PrimErrBadArgument;
+		goto l6;
+	}
+	assert(allObjectsUnmarked());
+
+	/* check no allocations during search */
+
+	freeStartAtStart = freeStart();
+	beRootIfOld(stack);
+	/* begin lengthOf:format: */
+	/* begin numSlotsOf: */
+	flag("endianness");
+	assert((classIndexOf(stack)) > (isForwardedObjectClassIndexPun()));
+	/* begin rawNumSlotsOf: */
+	flag("endianness");
+	numSlots4 = ((usqInt) (((usqInt)(longAt(stack + 4))))) >> 24;
+	numSlots1 = (numSlots4 == 0xFF
+		? (/* begin rawOverflowSlotsOf: */
+			flag("endianness"),
+			longAt(stack - (BaseHeaderSize)))
+		: numSlots4);
+	if (((((usqInt) (longAt(stack))) >> 24) & 0x1F) <= 9) {
+		stackSize = numSlots1;
+		goto l3;
+	}
+	if (((((usqInt) (longAt(stack))) >> 24) & 0x1F) >= 16) {
+
+		/* bytes, including CompiledMethod */
+
+		stackSize = (numSlots1 << 2) - (((((usqInt) (longAt(stack))) >> 24) & 0x1F) & 7);
+		goto l3;
+	}
+	if (((((usqInt) (longAt(stack))) >> 24) & 0x1F) >= 12) {
+		stackSize = (numSlots1 << (2 - 1)) - (((((usqInt) (longAt(stack))) >> 24) & 0x1F) & 3);
+		goto l3;
+	}
+	stackSize = (numSlots1 << (2 - 2)) - (((((usqInt) (longAt(stack))) >> 24) & 0x1F) & 1);
+l3:	/* end lengthOf:format: */;
+	/* begin mark: */
+	setIsMarkedOfto(stack, 1);
+	current = GIV(specialObjectsOop);
+	/* begin mark: */
+	setIsMarkedOfto(current, 1);
+	/* begin lengthOf:format: */
+	/* begin numSlotsOf: */
+	flag("endianness");
+	assert((classIndexOf(current)) > (isForwardedObjectClassIndexPun()));
+	/* begin rawNumSlotsOf: */
+	flag("endianness");
+	numSlots5 = ((usqInt) (((usqInt)(longAt(current + 4))))) >> 24;
+	numSlots2 = (numSlots5 == 0xFF
+		? (/* begin rawOverflowSlotsOf: */
+			flag("endianness"),
+			longAt(current - (BaseHeaderSize)))
+		: numSlots5);
+	if (((((usqInt) (longAt(current))) >> 24) & 0x1F) <= 9) {
+		index = numSlots2;
+		goto l4;
+	}
+	if (((((usqInt) (longAt(current))) >> 24) & 0x1F) >= 16) {
+
+		/* bytes, including CompiledMethod */
+
+		index = (numSlots2 << 2) - (((((usqInt) (longAt(current))) >> 24) & 0x1F) & 7);
+		goto l4;
+	}
+	if (((((usqInt) (longAt(current))) >> 24) & 0x1F) >= 12) {
+		index = (numSlots2 << (2 - 1)) - (((((usqInt) (longAt(current))) >> 24) & 0x1F) & 3);
+		goto l4;
+	}
+	index = (numSlots2 << (2 - 2)) - (((((usqInt) (longAt(current))) >> 24) & 0x1F) & 1);
+l4:	/* end lengthOf:format: */;
+	stackp = 0;
+	while(1) {
+		while (((index -= 1)) >= -1) {
+			if ((((((usqInt)current)) & (BytesPerWord - 1)) == 0)
+			 && ((((((usqInt)current)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)current)) <= (((usqInt)GIV(pages))))))) {
+				next = (index >= 0
+					? fieldofFrame(index, ((char *) current))
+					: GIV(nilObj));
+			}
+			else {
+				if (index >= 0) {
+					next = (((longAt(current)) & 0x3FFFFF) == ClassMethodContextCompactIndex
+						? fieldOrSenderFPofContext(index, current)
+						: longAt((current + (BaseHeaderSize)) + (index << 2)));
+				}
+				else {
+					/* begin fetchClassOfNonImm: */
+					classIndex = (longAt(current)) & 0x3FFFFF;
+					if (classIndex == 0x1F) {
+						next = current;
+						goto l1;
+					}
+					assert(classIndex >= (arrayClassIndexPun()));
+					/* begin classOrNilAtIndex: */
+					assert((classIndex <= (tagMask()))
+					 || (classIndex >= (arrayClassIndexPun())));
+					classTablePage = longAt((GIV(hiddenRootsObj) + (BaseHeaderSize)) + ((((usqInt) classIndex) >> 10) << 2));
+					if (classTablePage == GIV(nilObj)) {
+						next = GIV(nilObj);
+						goto l5;
+					}
+					next = longAt((classTablePage + (BaseHeaderSize)) + ((classIndex & ((1 << 10) - 1)) << 2));
+				l5:	/* end classOrNilAtIndex: */;

@@ Diff output truncated at 50000 characters. @@


More information about the Vm-dev mailing list