[Vm-dev] [commit][2637] CogVM source as per VMMaker.oscog-eem.238

commits at squeakvm.org commits at squeakvm.org
Mon Dec 17 19:51:17 UTC 2012


Revision: 2637
Author:   eliot
Date:     2012-12-17 11:51:15 -0800 (Mon, 17 Dec 2012)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.238

Restore ThreadedFFIPlugin wanting COGMTVM to be determined on
command line.  Probably broke in VMMaker.oscog-eem.218

Fix bug in changeClass:from: so that if receiver has long header and
class is compact, receiver still gets compact class field set, not
cleared.  No matter what header an instance has, if its class is
compact it should have the compact class index set.

Modified Paths:
--------------
    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/src/plugins/SqueakFFIPrims/SqueakFFIPrims.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

Removed Paths:
-------------
    branches/Cog/nscogbuild/cygwinbuild/sqNamedPrims.h

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

Deleted: branches/Cog/nscogbuild/cygwinbuild/sqNamedPrims.h
===================================================================
--- branches/Cog/nscogbuild/cygwinbuild/sqNamedPrims.h	2012-12-15 00:44:59 UTC (rev 2636)
+++ branches/Cog/nscogbuild/cygwinbuild/sqNamedPrims.h	2012-12-17 19:51:15 UTC (rev 2637)
@@ -1,54 +0,0 @@
-/* Automatically generated on Dec 13 2012, 17:08:01 */
-
-extern sqExport vm_exports[];
-extern sqExport os_exports[];
-extern sqExport AsynchFilePlugin_exports[];
-extern sqExport BMPReadWriterPlugin_exports[];
-extern sqExport B2DPlugin_exports[];
-extern sqExport BitBltPlugin_exports[];
-extern sqExport DSAPrims_exports[];
-extern sqExport DropPlugin_exports[];
-extern sqExport FilePlugin_exports[];
-extern sqExport FloatArrayPlugin_exports[];
-extern sqExport FloatMathPlugin_exports[];
-extern sqExport ZipPlugin_exports[];
-extern sqExport JPEGReadWriter2Plugin_exports[];
-extern sqExport JPEGReaderPlugin_exports[];
-extern sqExport LargeIntegers_exports[];
-extern sqExport Matrix2x3Plugin_exports[];
-extern sqExport MiscPrimitivePlugin_exports[];
-extern sqExport IA32ABI_exports[];
-extern sqExport RePlugin_exports[];
-extern sqExport SecurityPlugin_exports[];
-extern sqExport SocketPlugin_exports[];
-extern sqExport SurfacePlugin_exports[];
-extern sqExport UUIDPlugin_exports[];
-extern sqExport Win32OSProcessPlugin_exports[];
-
-sqExport *pluginExports[] = {
-	vm_exports,
-	os_exports,
-	AsynchFilePlugin_exports,
-	BMPReadWriterPlugin_exports,
-	B2DPlugin_exports,
-	BitBltPlugin_exports,
-	DSAPrims_exports,
-	DropPlugin_exports,
-	FilePlugin_exports,
-	FloatArrayPlugin_exports,
-	FloatMathPlugin_exports,
-	ZipPlugin_exports,
-	JPEGReadWriter2Plugin_exports,
-	JPEGReaderPlugin_exports,
-	LargeIntegers_exports,
-	Matrix2x3Plugin_exports,
-	MiscPrimitivePlugin_exports,
-	IA32ABI_exports,
-	RePlugin_exports,
-	SecurityPlugin_exports,
-	SocketPlugin_exports,
-	SurfacePlugin_exports,
-	UUIDPlugin_exports,
-	Win32OSProcessPlugin_exports,
-	NULL
-};
\ No newline at end of file

Modified: branches/Cog/nscogsrc/vm/cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.c	2012-12-15 00:44:59 UTC (rev 2636)
+++ branches/Cog/nscogsrc/vm/cointerp.c	2012-12-17 19:51:15 UTC (rev 2637)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.234 uuid: 66acafd1-cad0-4f20-b786-ab8f48201d82
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f
    from
-	CoInterpreter VMMaker.oscog-eem.234 uuid: 66acafd1-cad0-4f20-b786-ab8f48201d82
+	CoInterpreter VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.234 uuid: 66acafd1-cad0-4f20-b786-ab8f48201d82 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -1932,7 +1932,7 @@
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
 static usqInt heapBase;
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.234";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.238";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -15519,11 +15519,11 @@
 			}
 		}
 	}
+	ccIndex = classHdr & CompactClassMask;
 	if ((rcvrHdr & TypeMask) == HeaderTypeShort) {
 
 		/* Compact classes. Check if the arg's class is compact and exchange ccIndex */
 
-		ccIndex = classHdr & CompactClassMask;
 		if (ccIndex == 0) {
 			return PrimErrInappropriate;
 		}
@@ -15539,7 +15539,7 @@
 	}
 	else {
 
-		/* Exchange the class pointer, which could make rcvr a root for argClass */
+		/* Exchange the class pointer, which could make rcvr a root for argClass.  Don't forget to set ccIndex. */
 
 		
 #    if IMMUTABILITY
@@ -15550,7 +15550,7 @@
 #    endif /* IMMUTABILITY */
 
 		if (((((usqInt) (longAt(rcvr))) >> 12) & 31) != 0) {
-			longAtput(rcvr, (((longAt(rcvr)) | CompactClassMask) - CompactClassMask));
+			longAtput(rcvr, ((((longAt(rcvr)) | CompactClassMask) - CompactClassMask)) | ccIndex);
 		}
 		longAtput(rcvr - BaseHeaderSize, argClass | ((longAt(rcvr)) & TypeMask));
 		if ((((usqInt) rcvr)) < (((usqInt) GIV(youngStart)))) {

Modified: branches/Cog/nscogsrc/vm/cointerp.h
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.h	2012-12-15 00:44:59 UTC (rev 2636)
+++ branches/Cog/nscogsrc/vm/cointerp.h	2012-12-17 19:51:15 UTC (rev 2637)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.234 uuid: 66acafd1-cad0-4f20-b786-ab8f48201d82
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f
  */
 
 

Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2012-12-15 00:44:59 UTC (rev 2636)
+++ branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2012-12-17 19:51:15 UTC (rev 2637)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.234 uuid: 66acafd1-cad0-4f20-b786-ab8f48201d82
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f
    from
-	CoInterpreter VMMaker.oscog-eem.234 uuid: 66acafd1-cad0-4f20-b786-ab8f48201d82
+	CoInterpreter VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.234 uuid: 66acafd1-cad0-4f20-b786-ab8f48201d82 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -1935,7 +1935,7 @@
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
 static usqInt heapBase;
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.234";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.238";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -15528,11 +15528,11 @@
 			}
 		}
 	}
+	ccIndex = classHdr & CompactClassMask;
 	if ((rcvrHdr & TypeMask) == HeaderTypeShort) {
 
 		/* Compact classes. Check if the arg's class is compact and exchange ccIndex */
 
-		ccIndex = classHdr & CompactClassMask;
 		if (ccIndex == 0) {
 			return PrimErrInappropriate;
 		}
@@ -15548,7 +15548,7 @@
 	}
 	else {
 
-		/* Exchange the class pointer, which could make rcvr a root for argClass */
+		/* Exchange the class pointer, which could make rcvr a root for argClass.  Don't forget to set ccIndex. */
 
 		
 #    if IMMUTABILITY
@@ -15559,7 +15559,7 @@
 #    endif /* IMMUTABILITY */
 
 		if (((((usqInt) (longAt(rcvr))) >> 12) & 31) != 0) {
-			longAtput(rcvr, (((longAt(rcvr)) | CompactClassMask) - CompactClassMask));
+			longAtput(rcvr, ((((longAt(rcvr)) | CompactClassMask) - CompactClassMask)) | ccIndex);
 		}
 		longAtput(rcvr - BaseHeaderSize, argClass | ((longAt(rcvr)) & TypeMask));
 		if ((((usqInt) rcvr)) < (((usqInt) GIV(youngStart)))) {

Modified: branches/Cog/nscogsrc/vm/interp.h
===================================================================
--- branches/Cog/nscogsrc/vm/interp.h	2012-12-15 00:44:59 UTC (rev 2636)
+++ branches/Cog/nscogsrc/vm/interp.h	2012-12-17 19:51:15 UTC (rev 2637)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.234 uuid: 66acafd1-cad0-4f20-b786-ab8f48201d82
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f
  */
 
 #define VM_PROXY_MAJOR 1

Modified: branches/Cog/nscogsrc/vm/vmCallback.h
===================================================================
--- branches/Cog/nscogsrc/vm/vmCallback.h	2012-12-15 00:44:59 UTC (rev 2636)
+++ branches/Cog/nscogsrc/vm/vmCallback.h	2012-12-17 19:51:15 UTC (rev 2637)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.234 uuid: 66acafd1-cad0-4f20-b786-ab8f48201d82
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f
  */
 
 #define VM_CALLBACK_INC 1


Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
___________________________________________________________________
Modified: checkindate
   - Fri Dec 14 16:44:39 PST 2012
   + Mon Dec 17 11:50:28 PST 2012

Modified: branches/Cog/src/plugins/SqueakFFIPrims/SqueakFFIPrims.c
===================================================================
--- branches/Cog/src/plugins/SqueakFFIPrims/SqueakFFIPrims.c	2012-12-15 00:44:59 UTC (rev 2636)
+++ branches/Cog/src/plugins/SqueakFFIPrims/SqueakFFIPrims.c	2012-12-17 19:51:15 UTC (rev 2637)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	VMPluginCodeGenerator VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7
+	VMPluginCodeGenerator VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f
    from
-	ThreadedIA32FFIPlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7
+	ThreadedIA32FFIPlugin VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f
  */
-static char __buildInfo[] = "ThreadedIA32FFIPlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7 " __DATE__ ;
+static char __buildInfo[] = "ThreadedIA32FFIPlugin VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f " __DATE__ ;
 
 
 
@@ -134,7 +134,6 @@
 #define BaseHeaderSize 4
 #define BytesPerOop 4
 #define BytesPerWord 4
-#define COGMTVM 0
 #define DefaultMaxStackSize 16384
 #define ExternalFunctionArgTypesIndex 2
 #define ExternalFunctionFlagsIndex 1
@@ -420,9 +419,9 @@
 struct VirtualMachine* interpreterProxy;
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"SqueakFFIPrims VMMaker.oscog-eem.235 (i)"
+	"SqueakFFIPrims VMMaker.oscog-eem.238 (i)"
 #else
-	"SqueakFFIPrims VMMaker.oscog-eem.235 (e)"
+	"SqueakFFIPrims VMMaker.oscog-eem.238 (e)"
 #endif
 ;
 
@@ -3315,12 +3314,26 @@
 			result = ffiFail(FFIErrorBadArgs);
 			goto l3;
 		}
+		
+#    if COGMTVM
 		if (!(((flags & FFICallTypesMask) == FFICallTypeCDecl)
 			 || ((flags & FFICallTypesMask) == FFICallTypeApi))) {
 			result = ffiFail(FFIErrorCallType);
 			goto l3;
 		}
 
+#    else /* COGMTVM */
+
+		/* not masking causes threaded calls to fail, which is as they should if the plugin is not threaded. */
+
+		if (!((flags == FFICallTypeCDecl)
+			 || (flags == FFICallTypeApi))) {
+			result = ffiFail(FFIErrorCallType);
+			goto l3;
+		}
+
+#    endif /* COGMTVM */
+
 		requiredStackSize = (externalFunctionInstSize > ExternalFunctionStackSizeIndex
 			? fetchIntegerofObject(ExternalFunctionStackSizeIndex, externalFunction)
 			: -1);
@@ -3372,11 +3385,15 @@
 				while (((calloutState->stringArgIndex)) > 0) {
 					free(((calloutState->stringArgs))[(calloutState->stringArgIndex = ((calloutState->stringArgIndex)) - 1)]);
 				}
+				
+#        if COGMTVM
 				if (err == (-PrimErrObjectMayMove)) {
 					result = PrimErrObjectMayMove;
 					goto l3;
 				}
 
+#        endif /* COGMTVM */
+
 				result = ffiFail(err);
 				goto l3;
 			}
@@ -3394,11 +3411,15 @@
 				while (((calloutState->stringArgIndex)) > 0) {
 					free(((calloutState->stringArgs))[(calloutState->stringArgIndex = ((calloutState->stringArgIndex)) - 1)]);
 				}
+				
+#        if COGMTVM
 				if (err == (-PrimErrObjectMayMove)) {
 					result = PrimErrObjectMayMove;
 					goto l3;
 				}
 
+#        endif /* COGMTVM */
+
 				result = ffiFail(err);
 				goto l3;
 			}
@@ -3420,10 +3441,14 @@
 			storeIntegerofObjectwithValue(ExternalFunctionStackSizeIndex, externalFunction, stackSize);
 		}
 		/* begin ffiCalloutTo:SpecOnStack:in: */
+		
+#    if COGMTVM
 		if (((calloutState->callFlags)) & FFICallFlagThreaded) {
 			myThreadIndex = disownVM(0);
 		}
 
+#    endif /* COGMTVM */
+
 		if ((0 + (cStackAlignment())) > 0) {
 			setsp((calloutState->argVector));
 		}
@@ -3440,10 +3465,14 @@
 		if (isCalleePopsConvention((calloutState->callFlags))) {
 			setsp((calloutState->argVector));
 		}
+		
+#    if COGMTVM
 		if (((calloutState->callFlags)) & FFICallFlagThreaded) {
 			ownVM(myThreadIndex);
 		}
 
+#    endif /* COGMTVM */
+
 		if (((calloutState->ffiRetHeader)) & FFIFlagPointer) {
 			/* begin ffiReturnPointer:ofType:in: */
 			/* begin ffiReturnType: */
@@ -3634,6 +3663,15 @@
 		goto l6;
 	}
 	
+#  if COGMTVM
+	if (!(((flags1 & FFICallTypesMask) == FFICallTypeCDecl)
+		 || ((flags1 & FFICallTypesMask) == FFICallTypeApi))) {
+		ffiFail(FFIErrorCallType);
+		goto l6;
+	}
+
+#  else /* COGMTVM */
+
 	/* not masking causes threaded calls to fail, which is as they should if the plugin is not threaded. */
 
 	if (!((flags1 == FFICallTypeCDecl)
@@ -3642,6 +3680,8 @@
 		goto l6;
 	}
 
+#  endif /* COGMTVM */
+
 	requiredStackSize1 = (externalFunctionInstSize > ExternalFunctionStackSizeIndex
 		? fetchIntegerofObject(ExternalFunctionStackSizeIndex, externalFunction)
 		: -1);
@@ -3694,6 +3734,14 @@
 				free(((calloutState1->stringArgs))[(calloutState1->stringArgIndex = ((calloutState1->stringArgIndex)) - 1)]);
 			}
 			
+#      if COGMTVM
+			if (err1 == (-PrimErrObjectMayMove)) {
+				PrimErrObjectMayMove;
+				goto l6;
+			}
+
+#      endif /* COGMTVM */
+
 			ffiFail(err1);
 			goto l6;
 		}
@@ -3712,6 +3760,14 @@
 				free(((calloutState1->stringArgs))[(calloutState1->stringArgIndex = ((calloutState1->stringArgIndex)) - 1)]);
 			}
 			
+#      if COGMTVM
+			if (err1 == (-PrimErrObjectMayMove)) {
+				PrimErrObjectMayMove;
+				goto l6;
+			}
+
+#      endif /* COGMTVM */
+
 			ffiFail(err1);
 			goto l6;
 		}
@@ -3734,6 +3790,13 @@
 	}
 	/* begin ffiCalloutTo:SpecOnStack:in: */
 	
+#  if COGMTVM
+	if (((calloutState1->callFlags)) & FFICallFlagThreaded) {
+		myThreadIndex1 = disownVM(0);
+	}
+
+#  endif /* COGMTVM */
+
 	if ((0 + (cStackAlignment())) > 0) {
 		setsp((calloutState1->argVector));
 	}
@@ -3751,6 +3814,13 @@
 		setsp((calloutState1->argVector));
 	}
 	
+#  if COGMTVM
+	if (((calloutState1->callFlags)) & FFICallFlagThreaded) {
+		ownVM(myThreadIndex1);
+	}
+
+#  endif /* COGMTVM */
+
 	if (((calloutState1->ffiRetHeader)) & FFIFlagPointer) {
 		/* begin ffiReturnPointer:ofType:in: */
 		/* begin ffiReturnType: */
@@ -4057,12 +4127,26 @@
 			result = ffiFail(FFIErrorBadArgs);
 			goto l3;
 		}
+		
+#    if COGMTVM
 		if (!(((flags & FFICallTypesMask) == FFICallTypeCDecl)
 			 || ((flags & FFICallTypesMask) == FFICallTypeApi))) {
 			result = ffiFail(FFIErrorCallType);
 			goto l3;
 		}
 
+#    else /* COGMTVM */
+
+		/* not masking causes threaded calls to fail, which is as they should if the plugin is not threaded. */
+
+		if (!((flags == FFICallTypeCDecl)
+			 || (flags == FFICallTypeApi))) {
+			result = ffiFail(FFIErrorCallType);
+			goto l3;
+		}
+
+#    endif /* COGMTVM */
+
 		requiredStackSize = (externalFunctionInstSize > ExternalFunctionStackSizeIndex
 			? fetchIntegerofObject(ExternalFunctionStackSizeIndex, externalFunction)
 			: -1);
@@ -4114,11 +4198,15 @@
 				while (((calloutState->stringArgIndex)) > 0) {
 					free(((calloutState->stringArgs))[(calloutState->stringArgIndex = ((calloutState->stringArgIndex)) - 1)]);
 				}
+				
+#        if COGMTVM
 				if (err == (-PrimErrObjectMayMove)) {
 					result = PrimErrObjectMayMove;
 					goto l3;
 				}
 
+#        endif /* COGMTVM */
+
 				result = ffiFail(err);
 				goto l3;
 			}
@@ -4136,11 +4224,15 @@
 				while (((calloutState->stringArgIndex)) > 0) {
 					free(((calloutState->stringArgs))[(calloutState->stringArgIndex = ((calloutState->stringArgIndex)) - 1)]);
 				}
+				
+#        if COGMTVM
 				if (err == (-PrimErrObjectMayMove)) {
 					result = PrimErrObjectMayMove;
 					goto l3;
 				}
 
+#        endif /* COGMTVM */
+
 				result = ffiFail(err);
 				goto l3;
 			}
@@ -4162,10 +4254,14 @@
 			storeIntegerofObjectwithValue(ExternalFunctionStackSizeIndex, externalFunction, stackSize);
 		}
 		/* begin ffiCalloutTo:SpecOnStack:in: */
+		
+#    if COGMTVM
 		if (((calloutState->callFlags)) & FFICallFlagThreaded) {
 			myThreadIndex = disownVM(0);
 		}
 
+#    endif /* COGMTVM */
+
 		if ((0 + (cStackAlignment())) > 0) {
 			setsp((calloutState->argVector));
 		}
@@ -4182,10 +4278,14 @@
 		if (isCalleePopsConvention((calloutState->callFlags))) {
 			setsp((calloutState->argVector));
 		}
+		
+#    if COGMTVM
 		if (((calloutState->callFlags)) & FFICallFlagThreaded) {
 			ownVM(myThreadIndex);
 		}
 
+#    endif /* COGMTVM */
+
 		if (((calloutState->ffiRetHeader)) & FFIFlagPointer) {
 			/* begin ffiReturnPointer:ofType:in: */
 			/* begin ffiReturnType: */
@@ -4381,6 +4481,15 @@
 		goto l6;
 	}
 	
+#  if COGMTVM
+	if (!(((flags1 & FFICallTypesMask) == FFICallTypeCDecl)
+		 || ((flags1 & FFICallTypesMask) == FFICallTypeApi))) {
+		ffiFail(FFIErrorCallType);
+		goto l6;
+	}
+
+#  else /* COGMTVM */
+
 	/* not masking causes threaded calls to fail, which is as they should if the plugin is not threaded. */
 
 	if (!((flags1 == FFICallTypeCDecl)
@@ -4389,6 +4498,8 @@
 		goto l6;
 	}
 
+#  endif /* COGMTVM */
+
 	requiredStackSize1 = (externalFunctionInstSize > ExternalFunctionStackSizeIndex
 		? fetchIntegerofObject(ExternalFunctionStackSizeIndex, externalFunction)
 		: -1);
@@ -4441,6 +4552,14 @@
 				free(((calloutState1->stringArgs))[(calloutState1->stringArgIndex = ((calloutState1->stringArgIndex)) - 1)]);
 			}
 			
+#      if COGMTVM
+			if (err1 == (-PrimErrObjectMayMove)) {
+				PrimErrObjectMayMove;
+				goto l6;
+			}
+
+#      endif /* COGMTVM */
+
 			ffiFail(err1);
 			goto l6;
 		}
@@ -4459,6 +4578,14 @@
 				free(((calloutState1->stringArgs))[(calloutState1->stringArgIndex = ((calloutState1->stringArgIndex)) - 1)]);
 			}
 			
+#      if COGMTVM
+			if (err1 == (-PrimErrObjectMayMove)) {
+				PrimErrObjectMayMove;
+				goto l6;
+			}
+
+#      endif /* COGMTVM */
+
 			ffiFail(err1);
 			goto l6;
 		}
@@ -4481,6 +4608,13 @@
 	}
 	/* begin ffiCalloutTo:SpecOnStack:in: */
 	
+#  if COGMTVM
+	if (((calloutState1->callFlags)) & FFICallFlagThreaded) {
+		myThreadIndex1 = disownVM(0);
+	}
+
+#  endif /* COGMTVM */
+
 	if ((0 + (cStackAlignment())) > 0) {
 		setsp((calloutState1->argVector));
 	}
@@ -4498,6 +4632,13 @@
 		setsp((calloutState1->argVector));
 	}
 	
+#  if COGMTVM
+	if (((calloutState1->callFlags)) & FFICallFlagThreaded) {
+		ownVM(myThreadIndex1);
+	}
+
+#  endif /* COGMTVM */
+
 	if (((calloutState1->ffiRetHeader)) & FFIFlagPointer) {
 		/* begin ffiReturnPointer:ofType:in: */
 		/* begin ffiReturnType: */

Modified: branches/Cog/src/vm/cointerp.c
===================================================================
--- branches/Cog/src/vm/cointerp.c	2012-12-15 00:44:59 UTC (rev 2636)
+++ branches/Cog/src/vm/cointerp.c	2012-12-17 19:51:15 UTC (rev 2637)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.234 uuid: 66acafd1-cad0-4f20-b786-ab8f48201d82
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f
    from
-	CoInterpreter VMMaker.oscog-eem.234 uuid: 66acafd1-cad0-4f20-b786-ab8f48201d82
+	CoInterpreter VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.234 uuid: 66acafd1-cad0-4f20-b786-ab8f48201d82 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -1922,7 +1922,7 @@
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
 static usqInt heapBase;
-const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.234]";
+const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.238]";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -11420,11 +11420,11 @@
 			}
 		}
 	}
+	ccIndex = classHdr & CompactClassMask;
 	if ((rcvrHdr & TypeMask) == HeaderTypeShort) {
 
 		/* Compact classes. Check if the arg's class is compact and exchange ccIndex */
 
-		ccIndex = classHdr & CompactClassMask;
 		if (ccIndex == 0) {
 			return PrimErrInappropriate;
 		}
@@ -11440,7 +11440,7 @@
 	}
 	else {
 
-		/* Exchange the class pointer, which could make rcvr a root for argClass */
+		/* Exchange the class pointer, which could make rcvr a root for argClass.  Don't forget to set ccIndex. */
 
 		
 #    if IMMUTABILITY
@@ -11451,7 +11451,7 @@
 #    endif /* IMMUTABILITY */
 
 		if (((((usqInt) (longAt(rcvr))) >> 12) & 31) != 0) {
-			longAtput(rcvr, (((longAt(rcvr)) | CompactClassMask) - CompactClassMask));
+			longAtput(rcvr, ((((longAt(rcvr)) | CompactClassMask) - CompactClassMask)) | ccIndex);
 		}
 		longAtput(rcvr - BaseHeaderSize, argClass | ((longAt(rcvr)) & TypeMask));
 		if ((((usqInt) rcvr)) < (((usqInt) GIV(youngStart)))) {

Modified: branches/Cog/src/vm/cointerp.h
===================================================================
--- branches/Cog/src/vm/cointerp.h	2012-12-15 00:44:59 UTC (rev 2636)
+++ branches/Cog/src/vm/cointerp.h	2012-12-17 19:51:15 UTC (rev 2637)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.234 uuid: 66acafd1-cad0-4f20-b786-ab8f48201d82
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f
  */
 
 

Modified: branches/Cog/src/vm/cointerpmt.c
===================================================================
--- branches/Cog/src/vm/cointerpmt.c	2012-12-15 00:44:59 UTC (rev 2636)
+++ branches/Cog/src/vm/cointerpmt.c	2012-12-17 19:51:15 UTC (rev 2637)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.234 uuid: 66acafd1-cad0-4f20-b786-ab8f48201d82
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f
    from
-	CoInterpreterMT VMMaker.oscog-eem.234 uuid: 66acafd1-cad0-4f20-b786-ab8f48201d82
+	CoInterpreterMT VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f
  */
-static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.234 uuid: 66acafd1-cad0-4f20-b786-ab8f48201d82 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -2021,7 +2021,7 @@
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
 static usqInt heapBase;
-const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.234]";
+const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.238]";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 sqInt willNotThreadWarnCount;
@@ -11773,11 +11773,11 @@
 			}
 		}
 	}
+	ccIndex = classHdr & CompactClassMask;
 	if ((rcvrHdr & TypeMask) == HeaderTypeShort) {
 
 		/* Compact classes. Check if the arg's class is compact and exchange ccIndex */
 
-		ccIndex = classHdr & CompactClassMask;
 		if (ccIndex == 0) {
 			return PrimErrInappropriate;
 		}
@@ -11793,7 +11793,7 @@
 	}
 	else {
 
-		/* Exchange the class pointer, which could make rcvr a root for argClass */
+		/* Exchange the class pointer, which could make rcvr a root for argClass.  Don't forget to set ccIndex. */
 
 		
 #    if IMMUTABILITY
@@ -11804,7 +11804,7 @@
 #    endif /* IMMUTABILITY */
 
 		if (((((usqInt) (longAt(rcvr))) >> 12) & 31) != 0) {
-			longAtput(rcvr, (((longAt(rcvr)) | CompactClassMask) - CompactClassMask));
+			longAtput(rcvr, ((((longAt(rcvr)) | CompactClassMask) - CompactClassMask)) | ccIndex);
 		}
 		longAtput(rcvr - BaseHeaderSize, argClass | ((longAt(rcvr)) & TypeMask));
 		if ((((usqInt) rcvr)) < (((usqInt) GIV(youngStart)))) {

Modified: branches/Cog/src/vm/cointerpmt.h
===================================================================
--- branches/Cog/src/vm/cointerpmt.h	2012-12-15 00:44:59 UTC (rev 2636)
+++ branches/Cog/src/vm/cointerpmt.h	2012-12-17 19:51:15 UTC (rev 2637)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.234 uuid: 66acafd1-cad0-4f20-b786-ab8f48201d82
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f
  */
 
 

Modified: branches/Cog/src/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/src/vm/gcc3x-cointerp.c	2012-12-15 00:44:59 UTC (rev 2636)
+++ branches/Cog/src/vm/gcc3x-cointerp.c	2012-12-17 19:51:15 UTC (rev 2637)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.234 uuid: 66acafd1-cad0-4f20-b786-ab8f48201d82
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f
    from
-	CoInterpreter VMMaker.oscog-eem.234 uuid: 66acafd1-cad0-4f20-b786-ab8f48201d82
+	CoInterpreter VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.234 uuid: 66acafd1-cad0-4f20-b786-ab8f48201d82 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -1925,7 +1925,7 @@
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
 static usqInt heapBase;
-const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.234]";
+const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.238]";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -11429,11 +11429,11 @@
 			}
 		}
 	}
+	ccIndex = classHdr & CompactClassMask;
 	if ((rcvrHdr & TypeMask) == HeaderTypeShort) {
 
 		/* Compact classes. Check if the arg's class is compact and exchange ccIndex */
 
-		ccIndex = classHdr & CompactClassMask;
 		if (ccIndex == 0) {
 			return PrimErrInappropriate;
 		}
@@ -11449,7 +11449,7 @@
 	}
 	else {
 
-		/* Exchange the class pointer, which could make rcvr a root for argClass */
+		/* Exchange the class pointer, which could make rcvr a root for argClass.  Don't forget to set ccIndex. */
 
 		
 #    if IMMUTABILITY
@@ -11460,7 +11460,7 @@
 #    endif /* IMMUTABILITY */
 
 		if (((((usqInt) (longAt(rcvr))) >> 12) & 31) != 0) {
-			longAtput(rcvr, (((longAt(rcvr)) | CompactClassMask) - CompactClassMask));
+			longAtput(rcvr, ((((longAt(rcvr)) | CompactClassMask) - CompactClassMask)) | ccIndex);
 		}
 		longAtput(rcvr - BaseHeaderSize, argClass | ((longAt(rcvr)) & TypeMask));
 		if ((((usqInt) rcvr)) < (((usqInt) GIV(youngStart)))) {

Modified: branches/Cog/src/vm/gcc3x-cointerpmt.c
===================================================================
--- branches/Cog/src/vm/gcc3x-cointerpmt.c	2012-12-15 00:44:59 UTC (rev 2636)
+++ branches/Cog/src/vm/gcc3x-cointerpmt.c	2012-12-17 19:51:15 UTC (rev 2637)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.234 uuid: 66acafd1-cad0-4f20-b786-ab8f48201d82
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f
    from
-	CoInterpreterMT VMMaker.oscog-eem.234 uuid: 66acafd1-cad0-4f20-b786-ab8f48201d82
+	CoInterpreterMT VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f
  */
-static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.234 uuid: 66acafd1-cad0-4f20-b786-ab8f48201d82 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -2024,7 +2024,7 @@
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
 static usqInt heapBase;
-const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.234]";
+const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.238]";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 sqInt willNotThreadWarnCount;
@@ -11782,11 +11782,11 @@
 			}
 		}
 	}
+	ccIndex = classHdr & CompactClassMask;
 	if ((rcvrHdr & TypeMask) == HeaderTypeShort) {
 
 		/* Compact classes. Check if the arg's class is compact and exchange ccIndex */
 
-		ccIndex = classHdr & CompactClassMask;
 		if (ccIndex == 0) {
 			return PrimErrInappropriate;
 		}
@@ -11802,7 +11802,7 @@
 	}
 	else {
 
-		/* Exchange the class pointer, which could make rcvr a root for argClass */
+		/* Exchange the class pointer, which could make rcvr a root for argClass.  Don't forget to set ccIndex. */
 
 		
 #    if IMMUTABILITY
@@ -11813,7 +11813,7 @@
 #    endif /* IMMUTABILITY */
 
 		if (((((usqInt) (longAt(rcvr))) >> 12) & 31) != 0) {
-			longAtput(rcvr, (((longAt(rcvr)) | CompactClassMask) - CompactClassMask));
+			longAtput(rcvr, ((((longAt(rcvr)) | CompactClassMask) - CompactClassMask)) | ccIndex);
 		}
 		longAtput(rcvr - BaseHeaderSize, argClass | ((longAt(rcvr)) & TypeMask));
 		if ((((usqInt) rcvr)) < (((usqInt) GIV(youngStart)))) {

Modified: branches/Cog/src/vm/interp.h
===================================================================
--- branches/Cog/src/vm/interp.h	2012-12-15 00:44:59 UTC (rev 2636)
+++ branches/Cog/src/vm/interp.h	2012-12-17 19:51:15 UTC (rev 2637)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.234 uuid: 66acafd1-cad0-4f20-b786-ab8f48201d82
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f
  */
 
 #define VM_PROXY_MAJOR 1

Modified: branches/Cog/src/vm/vmCallback.h
===================================================================
--- branches/Cog/src/vm/vmCallback.h	2012-12-15 00:44:59 UTC (rev 2636)
+++ branches/Cog/src/vm/vmCallback.h	2012-12-17 19:51:15 UTC (rev 2637)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.234 uuid: 66acafd1-cad0-4f20-b786-ab8f48201d82
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.238 uuid: a3d10eab-6079-4c91-99f6-3dcf58d1446f
  */
 
 #define VM_CALLBACK_INC 1



More information about the Vm-dev mailing list