[Vm-dev] [commit][3645] CogVM source as per VMMaker.oscog-eem.1726

commits at squeakvm.org commits at squeakvm.org
Mon Mar 14 20:06:30 UTC 2016


Revision: 3645
Author:   eliot
Date:     2016-03-14 13:06:29 -0700 (Mon, 14 Mar 2016)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.1726

Sista:
Fix nasty regression in picData:'s populate:withPICInfoFor:firstCacheTag: from
Tim's new Closed PIC organization (mea culpa).

Fix slip in Sista mustBeBoolean/counter-tripped trampoline generation
that only shows up in simulation but would byte in the C VM.
We can't use putSelfInReceiverResultReg when generating trampolines
because simSelf has not yet been initialized.

Plugins:
Make FFI load symbol fail after (when find function fails). 
In Pharo, we allow to load global functions (so we can control world windows
through FFI). 

Modernize MacMenubarPlugin with <var:type:> definitions and cppIf:ifTrue:

Modified Paths:
--------------
    branches/Cog/spursistasrc/vm/cogit.h
    branches/Cog/spursistasrc/vm/cogitARMv5.c
    branches/Cog/spursistasrc/vm/cogitIA32.c
    branches/Cog/spursistasrc/vm/cogitMIPSEL.c
    branches/Cog/src/plugins/MacMenubarPlugin/MacMenubarPlugin.c
    branches/Cog/src/plugins/SqueakFFIPrims/ARM32FFIPlugin.c
    branches/Cog/src/plugins/SqueakFFIPrims/IA32FFIPlugin.c
    branches/Cog/src/plugins/SqueakFFIPrims/X64SysVFFIPlugin.c
    branches/Cog/src/plugins/SqueakFFIPrims/X64Win64FFIPlugin.c

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


Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
___________________________________________________________________
Modified: checkindate
   - Thu Mar 10 17:40:29 PST 2016
   + Mon Mar 14 13:04:08 PDT 2016

Modified: branches/Cog/spursistasrc/vm/cogit.h
===================================================================
--- branches/Cog/spursistasrc/vm/cogit.h	2016-03-11 21:35:39 UTC (rev 3644)
+++ branches/Cog/spursistasrc/vm/cogit.h	2016-03-14 20:06:29 UTC (rev 3645)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.1722 uuid: e5c44d63-ba75-4cd1-bf4e-c92c4232bbfe
+	CCodeGenerator VMMaker.oscog-eem.1726 uuid: 6a968923-b541-4573-bc4f-64fb95e6462d
  */
 
 

Modified: branches/Cog/spursistasrc/vm/cogitARMv5.c
===================================================================
--- branches/Cog/spursistasrc/vm/cogitARMv5.c	2016-03-11 21:35:39 UTC (rev 3644)
+++ branches/Cog/spursistasrc/vm/cogitARMv5.c	2016-03-14 20:06:29 UTC (rev 3645)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.1722 uuid: e5c44d63-ba75-4cd1-bf4e-c92c4232bbfe
+	CCodeGenerator VMMaker.oscog-eem.1726 uuid: 6a968923-b541-4573-bc4f-64fb95e6462d
    from
-	SistaStackToRegisterMappingCogit VMMaker.oscog-eem.1722 uuid: e5c44d63-ba75-4cd1-bf4e-c92c4232bbfe
+	SistaStackToRegisterMappingCogit VMMaker.oscog-eem.1726 uuid: 6a968923-b541-4573-bc4f-64fb95e6462d
  */
-static char __buildInfo[] = "SistaStackToRegisterMappingCogit VMMaker.oscog-eem.1722 uuid: e5c44d63-ba75-4cd1-bf4e-c92c4232bbfe " __DATE__ ;
+static char __buildInfo[] = "SistaStackToRegisterMappingCogit VMMaker.oscog-eem.1726 uuid: 6a968923-b541-4573-bc4f-64fb95e6462d " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -10399,12 +10399,12 @@
 generateMapAtstart(sqInt addressOrNull, sqInt startAddress)
 {
     unsigned char annotation;
-    sqInt delta;
+    usqInt delta;
     sqInt i;
     AbstractInstruction *instruction;
     sqInt length;
-    sqInt location;
-    sqInt mapEntry;
+    usqInt location;
+    usqInt mapEntry;
     sqInt maxDelta;
     usqInt mcpc;
 
@@ -24364,6 +24364,7 @@
 genMustBeBooleanTrampolineForcalled(sqInt boolean, char *trampolineName)
 {
     AbstractInstruction *anInstruction;
+    AbstractInstruction *anInstruction1;
     AbstractInstruction *jumpMBB;
 
 	zeroOpcodeIndex();
@@ -24380,8 +24381,11 @@
 	/* begin PopR: */
 	genoperand(PopR, LinkReg);
 
-	/* begin putSelfInReceiverResultReg */
-	storeToReg((&simSelf), ReceiverResultReg);
+	/* begin MoveMw:r:R: */
+	anInstruction1 = genoperandoperandoperand(MoveMwrR, FoxMFReceiver, FPReg, ReceiverResultReg);
+	if (usesOutOfLineLiteral(anInstruction1)) {
+		(anInstruction1->dependent = locateLiteral(FoxMFReceiver));
+	}
 	/* begin RetN: */
 	genoperand(RetN, 0);
 	assert(!(shouldAnnotateObjectReference(boolean)));
@@ -25931,7 +25935,7 @@
 		pc = addressOfEndOfCaseinCPIC(i, cPIC);
 		cacheTag = (i == 1
 			? firstCacheTag
-			: literalBeforeFollowingAddress(backEnd, (pc - (jumpLongConditionalByteSize(backEnd))) - (loadLiteralByteSize(backEnd))));
+			: literalBeforeFollowingAddress(backEnd, pc - (jumpLongConditionalByteSize(backEnd))));
 		classOop = classForInlineCacheTag(cacheTag);
 		storePointerofObjectwithValue((i * 2) - 1, tuple, classOop);
 		entryPoint = jumpLongTargetBeforeFollowingAddress(backEnd, pc);

Modified: branches/Cog/spursistasrc/vm/cogitIA32.c
===================================================================
--- branches/Cog/spursistasrc/vm/cogitIA32.c	2016-03-11 21:35:39 UTC (rev 3644)
+++ branches/Cog/spursistasrc/vm/cogitIA32.c	2016-03-14 20:06:29 UTC (rev 3645)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.1722 uuid: e5c44d63-ba75-4cd1-bf4e-c92c4232bbfe
+	CCodeGenerator VMMaker.oscog-eem.1726 uuid: 6a968923-b541-4573-bc4f-64fb95e6462d
    from
-	SistaStackToRegisterMappingCogit VMMaker.oscog-eem.1722 uuid: e5c44d63-ba75-4cd1-bf4e-c92c4232bbfe
+	SistaStackToRegisterMappingCogit VMMaker.oscog-eem.1726 uuid: 6a968923-b541-4573-bc4f-64fb95e6462d
  */
-static char __buildInfo[] = "SistaStackToRegisterMappingCogit VMMaker.oscog-eem.1722 uuid: e5c44d63-ba75-4cd1-bf4e-c92c4232bbfe " __DATE__ ;
+static char __buildInfo[] = "SistaStackToRegisterMappingCogit VMMaker.oscog-eem.1726 uuid: 6a968923-b541-4573-bc4f-64fb95e6462d " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -21698,6 +21698,7 @@
 genMustBeBooleanTrampolineForcalled(sqInt boolean, char *trampolineName)
 {
     AbstractInstruction *anInstruction;
+    AbstractInstruction *anInstruction1;
     AbstractInstruction *jumpMBB;
 
 	zeroOpcodeIndex();
@@ -21708,8 +21709,8 @@
 	genSmalltalkToCStackSwitch(1);
 	compileCallFornumArgsargargargargresultRegregsToSave(ceCounterTripped, 1, TempReg, null, null, null, TempReg, 0);
 	genLoadStackPointers(backEnd);
-	/* begin putSelfInReceiverResultReg */
-	storeToReg((&simSelf), ReceiverResultReg);
+	/* begin MoveMw:r:R: */
+	anInstruction1 = genoperandoperandoperand(MoveMwrR, FoxMFReceiver, FPReg, ReceiverResultReg);
 	/* begin RetN: */
 	genoperand(RetN, 0);
 	assert(!(shouldAnnotateObjectReference(boolean)));
@@ -23220,7 +23221,7 @@
 		pc = addressOfEndOfCaseinCPIC(i, cPIC);
 		cacheTag = (i == 1
 			? firstCacheTag
-			: literalBeforeFollowingAddress(backEnd, (pc - (jumpLongConditionalByteSize(backEnd))) - (loadLiteralByteSize(backEnd))));
+			: literalBeforeFollowingAddress(backEnd, pc - (jumpLongConditionalByteSize(backEnd))));
 		classOop = classForInlineCacheTag(cacheTag);
 		storePointerofObjectwithValue((i * 2) - 1, tuple, classOop);
 		entryPoint = jumpLongTargetBeforeFollowingAddress(backEnd, pc);

Modified: branches/Cog/spursistasrc/vm/cogitMIPSEL.c
===================================================================
--- branches/Cog/spursistasrc/vm/cogitMIPSEL.c	2016-03-11 21:35:39 UTC (rev 3644)
+++ branches/Cog/spursistasrc/vm/cogitMIPSEL.c	2016-03-14 20:06:29 UTC (rev 3645)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.1722 uuid: e5c44d63-ba75-4cd1-bf4e-c92c4232bbfe
+	CCodeGenerator VMMaker.oscog-eem.1726 uuid: 6a968923-b541-4573-bc4f-64fb95e6462d
    from
-	SistaStackToRegisterMappingCogit VMMaker.oscog-eem.1722 uuid: e5c44d63-ba75-4cd1-bf4e-c92c4232bbfe
+	SistaStackToRegisterMappingCogit VMMaker.oscog-eem.1726 uuid: 6a968923-b541-4573-bc4f-64fb95e6462d
  */
-static char __buildInfo[] = "SistaStackToRegisterMappingCogit VMMaker.oscog-eem.1722 uuid: e5c44d63-ba75-4cd1-bf4e-c92c4232bbfe " __DATE__ ;
+static char __buildInfo[] = "SistaStackToRegisterMappingCogit VMMaker.oscog-eem.1726 uuid: 6a968923-b541-4573-bc4f-64fb95e6462d " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -5556,12 +5556,12 @@
 generateMapAtstart(sqInt addressOrNull, sqInt startAddress)
 {
     unsigned char annotation;
-    usqInt delta;
+    sqInt delta;
     sqInt i;
     AbstractInstruction *instruction;
     sqInt length;
-    usqInt location;
-    usqInt mapEntry;
+    sqInt location;
+    sqInt mapEntry;
     sqInt maxDelta;
     usqInt mcpc;
 
@@ -21945,6 +21945,7 @@
 genMustBeBooleanTrampolineForcalled(sqInt boolean, char *trampolineName)
 {
     AbstractInstruction *anInstruction;
+    AbstractInstruction *anInstruction1;
     AbstractInstruction *jumpMBB;
 
 	zeroOpcodeIndex();
@@ -21958,8 +21959,8 @@
 	/* begin PopR: */
 	genoperand(PopR, LinkReg);
 
-	/* begin putSelfInReceiverResultReg */
-	storeToReg((&simSelf), ReceiverResultReg);
+	/* begin MoveMw:r:R: */
+	anInstruction1 = genoperandoperandoperand(MoveMwrR, FoxMFReceiver, FPReg, ReceiverResultReg);
 	/* begin RetN: */
 	genoperand(RetN, 0);
 	assert(!(shouldAnnotateObjectReference(boolean)));
@@ -23450,7 +23451,7 @@
 		pc = addressOfEndOfCaseinCPIC(i, cPIC);
 		cacheTag = (i == 1
 			? firstCacheTag
-			: literalBeforeFollowingAddress(backEnd, (pc - (jumpLongConditionalByteSize(backEnd))) - (loadLiteralByteSize(backEnd))));
+			: literalBeforeFollowingAddress(backEnd, pc - (jumpLongConditionalByteSize(backEnd))));
 		classOop = classForInlineCacheTag(cacheTag);
 		storePointerofObjectwithValue((i * 2) - 1, tuple, classOop);
 

Modified: branches/Cog/src/plugins/MacMenubarPlugin/MacMenubarPlugin.c
===================================================================
--- branches/Cog/src/plugins/MacMenubarPlugin/MacMenubarPlugin.c	2016-03-11 21:35:39 UTC (rev 3644)
+++ branches/Cog/src/plugins/MacMenubarPlugin/MacMenubarPlugin.c	2016-03-14 20:06:29 UTC (rev 3645)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.1718 uuid: cd0ee6db-bf03-4a36-9019-2a6dcfd82cf1
+	SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.1726 uuid: 6a968923-b541-4573-bc4f-64fb95e6462d
    from
-	MacMenubarPlugin VMMaker.oscog-eem.1718 uuid: cd0ee6db-bf03-4a36-9019-2a6dcfd82cf1
+	MacMenubarPlugin VMMaker.oscog-eem.1726 uuid: 6a968923-b541-4573-bc4f-64fb95e6462d
  */
-static char __buildInfo[] = "MacMenubarPlugin VMMaker.oscog-eem.1718 uuid: cd0ee6db-bf03-4a36-9019-2a6dcfd82cf1 " __DATE__ ;
+static char __buildInfo[] = "MacMenubarPlugin VMMaker.oscog-eem.1726 uuid: 6a968923-b541-4573-bc4f-64fb95e6462d " __DATE__ ;
 
 
 
@@ -142,9 +142,9 @@
 struct VirtualMachine* interpreterProxy;
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"MacMenubarPlugin VMMaker.oscog-eem.1718 (i)"
+	"MacMenubarPlugin VMMaker.oscog-eem.1726 (i)"
 #else
-	"MacMenubarPlugin VMMaker.oscog-eem.1718 (e)"
+	"MacMenubarPlugin VMMaker.oscog-eem.1726 (e)"
 #endif
 ;
 
@@ -328,10 +328,11 @@
 		return null;
 	}
 	
-#if TARGET_API_MAC_CARBON
-;
+#  if TARGET_API_MAC_CARBON
 	result = CreateStandardWindowMenu(inOptions,&menuHandle);
-#endif;
+
+#  endif /* TARGET_API_MAC_CARBON */
+
 	if (failed()) {
 		return null;
 	}
@@ -349,7 +350,7 @@
 EXPORT(sqInt)
 primitiveDeleteMenu(void)
 {
-	sqInt menuID;
+	MenuID menuID;
 
 	menuID = stackIntegerValue(0);
 	if (failed()) {
@@ -418,9 +419,11 @@
 		return null;
 	}
 	
-#if TARGET_API_MAC_CARBON
-DisableMenuCommand(menuHandle,commandID);
-#endif;
+#  if TARGET_API_MAC_CARBON
+	DisableMenuCommand(menuHandle,commandID);
+
+#  endif /* TARGET_API_MAC_CARBON */
+
 	return null;
 }
 
@@ -525,12 +528,14 @@
 	}
 	menuBarHandle = ((Handle) (positive32BitValueOf(menuHandleOop)));
 	
-#if TARGET_API_MAC_CARBON
+#  if TARGET_API_MAC_CARBON
 	DisposeMenuBar(menuBarHandle);
-	#else
+
+#  else /* TARGET_API_MAC_CARBON */
 	DisposeHandle(menuBarHandle);
-	#endif
-	;
+
+#  endif /* TARGET_API_MAC_CARBON */
+
 	return null;
 }
 
@@ -571,9 +576,11 @@
 		return null;
 	}
 	
-#if TARGET_API_MAC_CARBON
-EnableMenuCommand(menuHandle,commandID);
-#endif;
+#  if TARGET_API_MAC_CARBON
+	EnableMenuCommand(menuHandle,commandID);
+
+#  endif /* TARGET_API_MAC_CARBON */
+
 	return null;
 }
 
@@ -668,10 +675,12 @@
 		return null;
 	}
 	
-#if TARGET_API_MAC_CARBON
-GetIndMenuItemWithCommandID(menuHandle, kHICommandHide, 1,
+#  if TARGET_API_MAC_CARBON
+	GetIndMenuItemWithCommandID(menuHandle, kHICommandHide, 1,
                    &applicationMenu, &outIndex);
-#endif;
+
+#  endif /* TARGET_API_MAC_CARBON */
+
 	if (failed()) {
 		return null;
 	}
@@ -714,10 +723,12 @@
 		return null;
 	}
 	
-#if TARGET_API_MAC_CARBON
-GetIndMenuItemWithCommandID(menuHandle, kHICommandHide, 1,
+#  if TARGET_API_MAC_CARBON
+	GetIndMenuItemWithCommandID(menuHandle, kHICommandHide, 1,
                    &applicationMenu, &outIndex);
-#endif ;
+
+#  endif /* TARGET_API_MAC_CARBON */
+
 	integerObjectOf(outIndex);
 	if (failed()) {
 		return null;
@@ -918,7 +929,7 @@
 primitiveGetMenuHandle(void)
 {
 	MenuHandle menuHandle;
-	sqInt menuID;
+	MenuID menuID;
 	sqInt _return_value;
 
 	menuID = stackIntegerValue(0);
@@ -1181,7 +1192,7 @@
 primitiveGetMenuItemText(void)
 {
 	sqInt anInteger;
-	Str255  aString;
+	Str255 aString;
 	sqInt i;
 	MenuHandle menuHandle;
 	sqInt menuHandleOop;
@@ -1265,7 +1276,7 @@
 EXPORT(sqInt)
 primitiveGetMenuTitle(void)
 {
-	Str255  aString;
+	Str255 aString;
 	sqInt i;
 	MenuHandle menuHandle;
 	sqInt menuHandleOop;
@@ -1317,7 +1328,7 @@
 EXPORT(sqInt)
 primitiveHiliteMenu(void)
 {
-	sqInt menuID;
+	MenuID menuID;
 
 	menuID = stackIntegerValue(0);
 	if (failed()) {
@@ -1399,7 +1410,7 @@
 EXPORT(sqInt)
 primitiveInsertMenu(void)
 {
-	sqInt anInteger;
+	MenuID anInteger;
 	MenuHandle menuHandle;
 	sqInt menuHandleOop;
 	sqInt _return_value;
@@ -1571,7 +1582,7 @@
 {
 	ConstStr255Param constStr255;
 	MenuHandle menuHandle;
-	sqInt menuID;
+	MenuID menuID;
 	char *menuTitle;
 	sqInt _return_value;
 
@@ -1600,7 +1611,7 @@
 EXPORT(sqInt)
 primitiveSetItemCmd(void)
 {
-	CharParameter  aCharacter;
+	CharParameter aCharacter;
 	sqInt anInteger;
 	sqInt anIntegerCmdChar;
 	MenuHandle menuHandle;
@@ -1666,7 +1677,7 @@
 EXPORT(sqInt)
 primitiveSetItemMark(void)
 {
-	CharParameter  aCharacter;
+	CharParameter aCharacter;
 	sqInt aMarkChar;
 	sqInt anInteger;
 	MenuHandle menuHandle;
@@ -1814,7 +1825,7 @@
 EXPORT(sqInt)
 primitiveSetMenuItemHierarchicalID(void)
 {
-	sqInt aMenuID;
+	MenuID aMenuID;
 	sqInt anInteger;
 	MenuHandle menuHandle;
 	sqInt menuHandleOop;

Modified: branches/Cog/src/plugins/SqueakFFIPrims/ARM32FFIPlugin.c
===================================================================
--- branches/Cog/src/plugins/SqueakFFIPrims/ARM32FFIPlugin.c	2016-03-11 21:35:39 UTC (rev 3644)
+++ branches/Cog/src/plugins/SqueakFFIPrims/ARM32FFIPlugin.c	2016-03-14 20:06:29 UTC (rev 3645)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	VMPluginCodeGenerator VMMaker.oscog-eem.1718 uuid: cd0ee6db-bf03-4a36-9019-2a6dcfd82cf1
+	VMPluginCodeGenerator VMMaker.oscog-eem.1726 uuid: 6a968923-b541-4573-bc4f-64fb95e6462d
    from
-	ThreadedARMFFIPlugin VMMaker.oscog-eem.1718 uuid: cd0ee6db-bf03-4a36-9019-2a6dcfd82cf1
+	ThreadedARMFFIPlugin VMMaker.oscog-eem.1726 uuid: 6a968923-b541-4573-bc4f-64fb95e6462d
  */
-static char __buildInfo[] = "ThreadedARMFFIPlugin VMMaker.oscog-eem.1718 uuid: cd0ee6db-bf03-4a36-9019-2a6dcfd82cf1 " __DATE__ ;
+static char __buildInfo[] = "ThreadedARMFFIPlugin VMMaker.oscog-eem.1726 uuid: 6a968923-b541-4573-bc4f-64fb95e6462d " __DATE__ ;
 
 
 
@@ -472,9 +472,9 @@
 struct VirtualMachine* interpreterProxy;
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"ARM32FFIPlugin VMMaker.oscog-eem.1718 (i)"
+	"ARM32FFIPlugin VMMaker.oscog-eem.1726 (i)"
 #else
-	"ARM32FFIPlugin VMMaker.oscog-eem.1718 (e)"
+	"ARM32FFIPlugin VMMaker.oscog-eem.1726 (e)"
 #endif
 ;
 
@@ -702,10 +702,10 @@
 	/* begin ffiFloatValueOf: */
 	if (isFloatObject(oop)) {
 		floatValue = floatValueOf(oop);
-		goto l2;
+		goto l3;
 	}
 	floatValue = ((double) (ffiIntegerValueOf(oop)) );
-l2:	/* end ffiFloatValueOf: */;
+l3:	/* end ffiFloatValueOf: */;
 	if (failed()) {
 		return FFIErrorCoercionFailed;
 	}
@@ -1029,18 +1029,18 @@
 					if (!((isPointers(ptrType))
 						 && ((slotSizeOf(ptrType)) >= 2))) {
 						err = FFIErrorWrongType;
-						goto l3;
+						goto l5;
 					}
 					specOop = fetchPointerofObject(0, ptrType);
 					if (!((isWords(specOop))
 						 && ((slotSizeOf(specOop)) > 0))) {
 						err = FFIErrorWrongType;
-						goto l3;
+						goto l5;
 					}
 					spec = fetchPointerofObject(0, specOop);
 					if (!(spec & FFIFlagAtomic)) {
 						err = FFIErrorWrongType;
-						goto l3;
+						goto l5;
 					}
 					specType = ((usqInt) (spec & FFIAtomicTypeMask)) >> FFIAtomicTypeShift;
 					if (specType != atomicType) {
@@ -1051,11 +1051,11 @@
 							 && ((atomicType <= FFITypeSignedChar)
 							 && ((((usqInt) atomicType) >> 1) == (((usqInt) specType) >> 1))))) {
 							err = FFIErrorCoercionFailed;
-							goto l3;
+							goto l5;
 						}
 					}
 					err = 0;
-				l3:	/* end ffiValidateExternalData:AtomicType: */;
+				l5:	/* end ffiValidateExternalData:AtomicType: */;
 					if (err != 0) {
 						return err;
 					}
@@ -1275,7 +1275,7 @@
 				if (valueOop & (BytesPerWord - 1)) {
 					if (isIntegerObject(valueOop)) {
 						intValue = integerValueOf(valueOop);
-						goto l1;
+						goto l4;
 					}
 					
 #          if SPURVM
@@ -1283,13 +1283,13 @@
 
 						/* Immediate in Spur */
 						intValue = characterValueOf(valueOop);
-						goto l1;
+						goto l4;
 					}
 					if (isFloatObject(valueOop)) {
 
 						/* Immediate in 64-bit Spur */
 						intValue = floatValueOf(valueOop);
-						goto l1;
+						goto l4;
 					}
 
 #          endif /* SPURVM */
@@ -1304,26 +1304,26 @@
 #          else /* SPURVM */
 					if (isCharacterObject(valueOop)) {
 						intValue = characterValueOf(valueOop);
-						goto l1;
+						goto l4;
 					}
 
 #          endif /* SPURVM */
 
 					if (isFloatObject(valueOop)) {
 						intValue = floatValueOf(valueOop);
-						goto l1;
+						goto l4;
 					}
 					if (valueOop == (nilObject())) {
 						intValue = 0;
-						goto l1;
+						goto l4;
 					}
 					if (valueOop == (falseObject())) {
 						intValue = 0;
-						goto l1;
+						goto l4;
 					}
 					if (valueOop == (trueObject())) {
 						intValue = 1;
-						goto l1;
+						goto l4;
 					}
 					if ((fetchClassOf(valueOop)) == (classLargePositiveInteger())) {
 						
@@ -1331,18 +1331,18 @@
 
 						/* Use cppIf: to get the return type of the function right.  Should be sqInt on 32-bits. */
 						intValue = positive64BitValueOf(valueOop);
-						goto l1;
+						goto l4;
 
 #            else /* BytesPerWord == 8 */
 						intValue = positive32BitValueOf(valueOop);
-						goto l1;
+						goto l4;
 
 #            endif /* BytesPerWord == 8 */
 
 					}
 				}
 				intValue = signedMachineIntegerValueOf(valueOop);
-			l1:	/* end ffiIntegerValueOf: */;
+			l4:	/* end ffiIntegerValueOf: */;
 			}
 			if (failed()) {
 				return FFIErrorCoercionFailed;
@@ -1382,10 +1382,10 @@
 		/* begin ffiFloatValueOf: */
 		if (isFloatObject(valueOop)) {
 			floatValue = floatValueOf(valueOop);
-			goto l2;
+			goto l3;
 		}
 		floatValue = ((double) (ffiIntegerValueOf(valueOop)) );
-	l2:	/* end ffiFloatValueOf: */;
+	l3:	/* end ffiFloatValueOf: */;
 		if (failed()) {
 			return FFIErrorCoercionFailed;
 		}
@@ -1677,18 +1677,18 @@
 		if (!((isPointers(ptrType))
 			 && ((slotSizeOf(ptrType)) >= 2))) {
 			err = FFIErrorWrongType;
-			goto l1;
+			goto l2;
 		}
 		specOop = fetchPointerofObject(0, ptrType);
 		if (!((isWords(specOop))
 			 && ((slotSizeOf(specOop)) > 0))) {
 			err = FFIErrorWrongType;
-			goto l1;
+			goto l2;
 		}
 		spec = fetchPointerofObject(0, specOop);
 		if (!(spec & FFIFlagAtomic)) {
 			err = FFIErrorWrongType;
-			goto l1;
+			goto l2;
 		}
 		specType = ((usqInt) (spec & FFIAtomicTypeMask)) >> FFIAtomicTypeShift;
 		if (specType != atomicType) {
@@ -1699,11 +1699,11 @@
 				 && ((atomicType <= FFITypeSignedChar)
 				 && ((((usqInt) atomicType) >> 1) == (((usqInt) specType) >> 1))))) {
 				err = FFIErrorCoercionFailed;
-				goto l1;
+				goto l2;
 			}
 		}
 		err = 0;
-	l1:	/* end ffiValidateExternalData:AtomicType: */;
+	l2:	/* end ffiValidateExternalData:AtomicType: */;
 		if (err != 0) {
 			return err;
 		}
@@ -1825,7 +1825,7 @@
 					cPointer = ((usqInt) intRet);
 					if (cPointer == null) {
 						oop = methodReturnValue(nilObject());
-						goto l1;
+						goto l4;
 					}
 					cString = ((char *) cPointer);
 					strLen = 0;
@@ -1838,7 +1838,7 @@
 						strPtr[i] = (cString[i]);
 					}
 					oop = methodReturnValue(strOop);
-					goto l1;
+					goto l4;
 				}
 				
 #if SPURVM
@@ -1878,7 +1878,7 @@
 ;
 				storePointerofObjectwithValue(1, retOop1, retType);
 				oop = methodReturnValue(retOop1);
-				goto l1;
+				goto l4;
 			}
 			classOop = (((calloutState->ffiRetHeader)) & FFIFlagStructure
 				? classByteArray()
@@ -1907,7 +1907,7 @@
 ;
 			storePointerofObjectwithValue(0, retOop1, oop2);
 			oop = methodReturnValue(retOop1);
-		l1:	/* end ffiReturnPointer:ofType:in: */;
+		l4:	/* end ffiReturnPointer:ofType:in: */;
 		}
 		else {
 			/* begin ffiReturnStruct:ofType:in: */
@@ -1952,7 +1952,7 @@
 			oop = (value == 0
 				? falseObject()
 				: trueObject());
-			goto l2;
+			goto l6;
 		}
 		if (atomicType <= FFITypeSignedInt) {
 
@@ -1976,7 +1976,7 @@
 					value = (value & (mask - 1)) - (value & mask);
 				}
 				oop = integerObjectOf(value);
-				goto l2;
+				goto l6;
 			}
 			oop = (atomicType & 1
 				? (BytesPerWord == 8
@@ -1985,14 +1985,14 @@
 				: (BytesPerWord == 8
 						? positive64BitIntegerFor(intRet)
 						: positive32BitIntegerFor(intRet)));
-			goto l2;
+			goto l6;
 		}
 		oop = ((((usqInt) atomicType) >> 1) == (((usqInt) FFITypeSignedLongLong) >> 1)
 			? (atomicType & 1
 					? signed64BitIntegerFor(intRet)
 					: positive64BitIntegerFor(intRet))
 			: characterObjectOf(intRet & Byte0Mask));
-	l2:	/* end ffiCreateIntegralResultOop:ofAtomicType:in: */;
+	l6:	/* end ffiCreateIntegralResultOop:ofAtomicType:in: */;
 	}
 	return methodReturnValue(oop);
 }
@@ -2303,7 +2303,7 @@
 					cPointer = ((usqInt) intRet);
 					if (cPointer == null) {
 						oop3 = methodReturnValue(nilObject());
-						goto l5;
+						goto l10;
 					}
 					cString = ((char *) cPointer);
 					strLen = 0;
@@ -2316,7 +2316,7 @@
 						strPtr[i1] = (cString[i1]);
 					}
 					oop3 = methodReturnValue(strOop);
-					goto l5;
+					goto l10;
 				}
 				
 #if SPURVM
@@ -2356,7 +2356,7 @@
 ;
 				storePointerofObjectwithValue(1, retOop1, retType);
 				oop3 = methodReturnValue(retOop1);
-				goto l5;
+				goto l10;
 			}
 			classOop = (((calloutState->ffiRetHeader)) & FFIFlagStructure
 				? classByteArray()
@@ -2385,7 +2385,7 @@
 ;
 			storePointerofObjectwithValue(0, retOop1, oop2);
 			oop3 = methodReturnValue(retOop1);
-		l5:	/* end ffiReturnPointer:ofType:in: */;
+		l10:	/* end ffiReturnPointer:ofType:in: */;
 		}
 		else {
 			/* begin ffiReturnStruct:ofType:in: */
@@ -2413,7 +2413,7 @@
 			oop3 = methodReturnValue(retOop);
 		}
 		result = oop3;
-		goto l7;
+		goto l12;
 	}
 	if ((((usqInt) atomicType) >> 1) == (((usqInt) FFITypeSingleFloat) >> 1)) {
 		oop3 = floatObjectOf(floatRet);
@@ -2474,7 +2474,7 @@
 	l6:	/* end ffiCreateIntegralResultOop:ofAtomicType:in: */;
 	}
 	result = methodReturnValue(oop3);
-l7:	/* end ffiCalloutTo:SpecOnStack:in: */;
+l12:	/* end ffiCalloutTo:SpecOnStack:in: */;
 	/* begin cleanupCalloutState: */
 	while (((calloutState->stringArgIndex)) > 0) {
 		free(((calloutState->stringArgs))[(calloutState->stringArgIndex = ((calloutState->stringArgIndex)) - 1)]);
@@ -4277,7 +4277,7 @@
 						cPointer = ((usqInt) intRet);
 						if (cPointer == null) {
 							oop3 = methodReturnValue(nilObject());
-							goto l11;
+							goto l16;
 						}
 						cString = ((char *) cPointer);
 						strLen = 0;
@@ -4290,7 +4290,7 @@
 							strPtr[i2] = (cString[i2]);
 						}
 						oop3 = methodReturnValue(strOop);
-						goto l11;
+						goto l16;
 					}
 					
 #if SPURVM
@@ -4330,7 +4330,7 @@
 ;
 					storePointerofObjectwithValue(1, retOop1, retType);
 					oop3 = methodReturnValue(retOop1);
-					goto l11;
+					goto l16;
 				}
 				classOop = (((calloutState->ffiRetHeader)) & FFIFlagStructure
 					? classByteArray()
@@ -4359,7 +4359,7 @@
 ;
 				storePointerofObjectwithValue(0, retOop1, oop2);
 				oop3 = methodReturnValue(retOop1);
-			l11:	/* end ffiReturnPointer:ofType:in: */;
+			l16:	/* end ffiReturnPointer:ofType:in: */;
 			}
 			else {
 				/* begin ffiReturnStruct:ofType:in: */
@@ -4387,7 +4387,7 @@
 				oop3 = methodReturnValue(retOop);
 			}
 			result1 = oop3;
-			goto l13;
+			goto l18;
 		}
 		if ((((usqInt) atomicType) >> 1) == (((usqInt) FFITypeSingleFloat) >> 1)) {
 			oop3 = floatObjectOf(floatRet);
@@ -4405,7 +4405,7 @@
 				oop3 = (value == 0
 					? falseObject()
 					: trueObject());
-				goto l12;
+				goto l15;
 			}
 			if (atomicType <= FFITypeSignedInt) {
 
@@ -4429,7 +4429,7 @@
 						value = (value & (mask - 1)) - (value & mask);
 					}
 					oop3 = integerObjectOf(value);
-					goto l12;
+					goto l15;
 				}
 				oop3 = (atomicType & 1
 					? (BytesPerWord == 8
@@ -4438,17 +4438,17 @@
 					: (BytesPerWord == 8
 							? positive64BitIntegerFor(intRet)
 							: positive32BitIntegerFor(intRet)));
-				goto l12;
+				goto l15;
 			}
 			oop3 = ((((usqInt) atomicType) >> 1) == (((usqInt) FFITypeSignedLongLong) >> 1)
 				? (atomicType & 1
 						? signed64BitIntegerFor(intRet)
 						: positive64BitIntegerFor(intRet))
 				: characterObjectOf(intRet & Byte0Mask));
-		l12:	/* end ffiCreateIntegralResultOop:ofAtomicType:in: */;
+		l15:	/* end ffiCreateIntegralResultOop:ofAtomicType:in: */;
 		}
 		result1 = methodReturnValue(oop3);
-	l13:	/* end ffiCalloutTo:SpecOnStack:in: */;
+	l18:	/* end ffiCalloutTo:SpecOnStack:in: */;
 		/* begin cleanupCalloutState: */
 		while (((calloutState->stringArgIndex)) > 0) {
 			free(((calloutState->stringArgs))[(calloutState->stringArgIndex = ((calloutState->stringArgIndex)) - 1)]);
@@ -4712,7 +4712,7 @@
 					cPointer1 = ((usqInt) intRet1);
 					if (cPointer1 == null) {
 						oop4 = methodReturnValue(nilObject());
-						goto l14;
+						goto l24;
 					}
 					cString1 = ((char *) cPointer1);
 					strLen1 = 0;
@@ -4725,7 +4725,7 @@
 						strPtr1[i3] = (cString1[i3]);
 					}
 					oop4 = methodReturnValue(strOop1);
-					goto l14;
+					goto l24;
 				}
 				
 #if SPURVM
@@ -4765,7 +4765,7 @@
 ;
 				storePointerofObjectwithValue(1, retOop11, retType1);
 				oop4 = methodReturnValue(retOop11);
-				goto l14;
+				goto l24;
 			}
 			classOop1 = (((calloutState1->ffiRetHeader)) & FFIFlagStructure
 				? classByteArray()
@@ -4794,7 +4794,7 @@
 ;
 			storePointerofObjectwithValue(0, retOop11, oop21);
 			oop4 = methodReturnValue(retOop11);
-		l14:	/* end ffiReturnPointer:ofType:in: */;
+		l24:	/* end ffiReturnPointer:ofType:in: */;
 		}
 		else {
 			/* begin ffiReturnStruct:ofType:in: */
@@ -4822,7 +4822,7 @@
 			oop4 = methodReturnValue(retOop2);
 		}
 		result2 = oop4;
-		goto l16;
+		goto l26;
 	}
 	if ((((usqInt) atomicType2) >> 1) == (((usqInt) FFITypeSingleFloat) >> 1)) {
 		oop4 = floatObjectOf(floatRet1);
@@ -4840,7 +4840,7 @@
 			oop4 = (value1 == 0
 				? falseObject()
 				: trueObject());
-			goto l15;
+			goto l23;
 		}
 		if (atomicType2 <= FFITypeSignedInt) {
 
@@ -4864,7 +4864,7 @@
 					value1 = (value1 & (mask1 - 1)) - (value1 & mask1);
 				}
 				oop4 = integerObjectOf(value1);
-				goto l15;
+				goto l23;
 			}
 			oop4 = (atomicType2 & 1
 				? (BytesPerWord == 8
@@ -4873,17 +4873,17 @@
 				: (BytesPerWord == 8
 						? positive64BitIntegerFor(intRet1)
 						: positive32BitIntegerFor(intRet1)));
-			goto l15;
+			goto l23;
 		}
 		oop4 = ((((usqInt) atomicType2) >> 1) == (((usqInt) FFITypeSignedLongLong) >> 1)
 			? (atomicType2 & 1
 					? signed64BitIntegerFor(intRet1)
 					: positive64BitIntegerFor(intRet1))
 			: characterObjectOf(intRet1 & Byte0Mask));
-	l15:	/* end ffiCreateIntegralResultOop:ofAtomicType:in: */;
+	l23:	/* end ffiCreateIntegralResultOop:ofAtomicType:in: */;
 	}
 	result2 = methodReturnValue(oop4);
-l16:	/* end ffiCalloutTo:SpecOnStack:in: */;
+l26:	/* end ffiCalloutTo:SpecOnStack:in: */;
 	/* begin cleanupCalloutState: */
 	while (((calloutState1->stringArgIndex)) > 0) {
 		free(((calloutState1->stringArgs))[(calloutState1->stringArgIndex = ((calloutState1->stringArgIndex)) - 1)]);
@@ -5287,7 +5287,7 @@
 						cPointer = ((usqInt) intRet);
 						if (cPointer == null) {
 							oop3 = methodReturnValue(nilObject());
-							goto l11;
+							goto l16;
 						}
 						cString = ((char *) cPointer);
 						strLen = 0;
@@ -5300,7 +5300,7 @@
 							strPtr[i2] = (cString[i2]);
 						}
 						oop3 = methodReturnValue(strOop);
-						goto l11;
+						goto l16;
 					}
 					
 #if SPURVM
@@ -5340,7 +5340,7 @@
 ;
 					storePointerofObjectwithValue(1, retOop1, retType);
 					oop3 = methodReturnValue(retOop1);
-					goto l11;
+					goto l16;
 				}
 				classOop = (((calloutState->ffiRetHeader)) & FFIFlagStructure
 					? classByteArray()
@@ -5369,7 +5369,7 @@
 ;
 				storePointerofObjectwithValue(0, retOop1, oop2);
 				oop3 = methodReturnValue(retOop1);
-			l11:	/* end ffiReturnPointer:ofType:in: */;
+			l16:	/* end ffiReturnPointer:ofType:in: */;
 			}
 			else {
 				/* begin ffiReturnStruct:ofType:in: */
@@ -5397,7 +5397,7 @@
 				oop3 = methodReturnValue(retOop);
 			}
 			result1 = oop3;
-			goto l13;
+			goto l18;
 		}
 		if ((((usqInt) atomicType) >> 1) == (((usqInt) FFITypeSingleFloat) >> 1)) {
 			oop3 = floatObjectOf(floatRet);
@@ -5415,7 +5415,7 @@
 				oop3 = (value == 0
 					? falseObject()
 					: trueObject());
-				goto l12;
+				goto l15;
 			}
 			if (atomicType <= FFITypeSignedInt) {
 
@@ -5439,7 +5439,7 @@
 						value = (value & (mask - 1)) - (value & mask);
 					}
 					oop3 = integerObjectOf(value);
-					goto l12;
+					goto l15;
 				}
 				oop3 = (atomicType & 1
 					? (BytesPerWord == 8
@@ -5448,17 +5448,17 @@
 					: (BytesPerWord == 8
 							? positive64BitIntegerFor(intRet)
 							: positive32BitIntegerFor(intRet)));
-				goto l12;
+				goto l15;
 			}
 			oop3 = ((((usqInt) atomicType) >> 1) == (((usqInt) FFITypeSignedLongLong) >> 1)
 				? (atomicType & 1
 						? signed64BitIntegerFor(intRet)
 						: positive64BitIntegerFor(intRet))
 				: characterObjectOf(intRet & Byte0Mask));
-		l12:	/* end ffiCreateIntegralResultOop:ofAtomicType:in: */;
+		l15:	/* end ffiCreateIntegralResultOop:ofAtomicType:in: */;
 		}
 		result1 = methodReturnValue(oop3);
-	l13:	/* end ffiCalloutTo:SpecOnStack:in: */;
+	l18:	/* end ffiCalloutTo:SpecOnStack:in: */;
 		/* begin cleanupCalloutState: */
 		while (((calloutState->stringArgIndex)) > 0) {
 			free(((calloutState->stringArgs))[(calloutState->stringArgIndex = ((calloutState->stringArgIndex)) - 1)]);
@@ -5728,7 +5728,7 @@
 					cPointer1 = ((usqInt) intRet1);
 					if (cPointer1 == null) {
 						oop4 = methodReturnValue(nilObject());
-						goto l14;
+						goto l24;
 					}
 					cString1 = ((char *) cPointer1);
 					strLen1 = 0;
@@ -5741,7 +5741,7 @@
 						strPtr1[i3] = (cString1[i3]);
 					}
 					oop4 = methodReturnValue(strOop1);
-					goto l14;
+					goto l24;
 				}
 				
 #if SPURVM
@@ -5781,7 +5781,7 @@
 ;
 				storePointerofObjectwithValue(1, retOop11, retType1);
 				oop4 = methodReturnValue(retOop11);
-				goto l14;
+				goto l24;
 			}
 			classOop1 = (((calloutState1->ffiRetHeader)) & FFIFlagStructure
 				? classByteArray()
@@ -5810,7 +5810,7 @@
 ;
 			storePointerofObjectwithValue(0, retOop11, oop21);
 			oop4 = methodReturnValue(retOop11);
-		l14:	/* end ffiReturnPointer:ofType:in: */;
+		l24:	/* end ffiReturnPointer:ofType:in: */;
 		}
 		else {
 			/* begin ffiReturnStruct:ofType:in: */
@@ -5838,7 +5838,7 @@
 			oop4 = methodReturnValue(retOop2);
 		}
 		result2 = oop4;
-		goto l16;
+		goto l26;
 	}
 	if ((((usqInt) atomicType2) >> 1) == (((usqInt) FFITypeSingleFloat) >> 1)) {
 		oop4 = floatObjectOf(floatRet1);
@@ -5856,7 +5856,7 @@
 			oop4 = (value1 == 0
 				? falseObject()
 				: trueObject());
-			goto l15;
+			goto l23;
 		}
 		if (atomicType2 <= FFITypeSignedInt) {
 
@@ -5880,7 +5880,7 @@
 					value1 = (value1 & (mask1 - 1)) - (value1 & mask1);
 				}
 				oop4 = integerObjectOf(value1);
-				goto l15;
+				goto l23;
 			}
 			oop4 = (atomicType2 & 1
 				? (BytesPerWord == 8
@@ -5889,17 +5889,17 @@
 				: (BytesPerWord == 8
 						? positive64BitIntegerFor(intRet1)
 						: positive32BitIntegerFor(intRet1)));
-			goto l15;
+			goto l23;
 		}
 		oop4 = ((((usqInt) atomicType2) >> 1) == (((usqInt) FFITypeSignedLongLong) >> 1)
 			? (atomicType2 & 1
 					? signed64BitIntegerFor(intRet1)
 					: positive64BitIntegerFor(intRet1))
 			: characterObjectOf(intRet1 & Byte0Mask));
-	l15:	/* end ffiCreateIntegralResultOop:ofAtomicType:in: */;
+	l23:	/* end ffiCreateIntegralResultOop:ofAtomicType:in: */;
 	}
 	result2 = methodReturnValue(oop4);
-l16:	/* end ffiCalloutTo:SpecOnStack:in: */;
+l26:	/* end ffiCalloutTo:SpecOnStack:in: */;
 	/* begin cleanupCalloutState: */
 	while (((calloutState1->stringArgIndex)) > 0) {
 		free(((calloutState1->stringArgs))[(calloutState1->stringArgIndex = ((calloutState1->stringArgIndex)) - 1)]);
@@ -6385,7 +6385,12 @@
 	}
 	module = stackValue(0);
 	symbol = stackValue(1);
-	moduleHandle = ffiLoadCalloutModule(module);
+	if (module != (nilObject())) {
+		moduleHandle = ffiLoadCalloutModule(module);
+	}
+	else {
+		moduleHandle = null;
+	}
 	if (failed()) {
 		return primitiveFailFor(PrimErrNotFound);
 	}

Modified: branches/Cog/src/plugins/SqueakFFIPrims/IA32FFIPlugin.c
===================================================================
--- branches/Cog/src/plugins/SqueakFFIPrims/IA32FFIPlugin.c	2016-03-11 21:35:39 UTC (rev 3644)
+++ branches/Cog/src/plugins/SqueakFFIPrims/IA32FFIPlugin.c	2016-03-14 20:06:29 UTC (rev 3645)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	VMPluginCodeGenerator VMMaker.oscog-eem.1718 uuid: cd0ee6db-bf03-4a36-9019-2a6dcfd82cf1
+	VMPluginCodeGenerator VMMaker.oscog-eem.1726 uuid: 6a968923-b541-4573-bc4f-64fb95e6462d
    from
-	ThreadedIA32FFIPlugin VMMaker.oscog-eem.1718 uuid: cd0ee6db-bf03-4a36-9019-2a6dcfd82cf1
+	ThreadedIA32FFIPlugin VMMaker.oscog-eem.1726 uuid: 6a968923-b541-4573-bc4f-64fb95e6462d
  */
-static char __buildInfo[] = "ThreadedIA32FFIPlugin VMMaker.oscog-eem.1718 uuid: cd0ee6db-bf03-4a36-9019-2a6dcfd82cf1 " __DATE__ ;
+static char __buildInfo[] = "ThreadedIA32FFIPlugin VMMaker.oscog-eem.1726 uuid: 6a968923-b541-4573-bc4f-64fb95e6462d " __DATE__ ;
 
 
 
@@ -463,9 +463,9 @@
 struct VirtualMachine* interpreterProxy;
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"IA32FFIPlugin VMMaker.oscog-eem.1718 (i)"
+	"IA32FFIPlugin VMMaker.oscog-eem.1726 (i)"
 #else
-	"IA32FFIPlugin VMMaker.oscog-eem.1718 (e)"
+	"IA32FFIPlugin VMMaker.oscog-eem.1726 (e)"
 #endif
 ;
 
@@ -694,10 +694,10 @@
 	/* begin ffiFloatValueOf: */
 	if (isFloatObject(oop)) {
 		floatValue = floatValueOf(oop);
-		goto l2;
+		goto l3;
 	}
 	floatValue = ((double) (ffiIntegerValueOf(oop)) );
-l2:	/* end ffiFloatValueOf: */;
+l3:	/* end ffiFloatValueOf: */;
 	if (failed()) {
 		return FFIErrorCoercionFailed;
 	}
@@ -930,18 +930,18 @@
 					if (!((isPointers(ptrType))
 						 && ((slotSizeOf(ptrType)) >= 2))) {
 						err = FFIErrorWrongType;
-						goto l3;
+						goto l5;
 					}
 					specOop = fetchPointerofObject(0, ptrType);
 					if (!((isWords(specOop))
 						 && ((slotSizeOf(specOop)) > 0))) {
 						err = FFIErrorWrongType;
-						goto l3;
+						goto l5;
 					}
 					spec = fetchPointerofObject(0, specOop);
 					if (!(spec & FFIFlagAtomic)) {
 						err = FFIErrorWrongType;
-						goto l3;
+						goto l5;
 					}
 					specType = ((usqInt) (spec & FFIAtomicTypeMask)) >> FFIAtomicTypeShift;
 					if (specType != atomicType) {
@@ -952,11 +952,11 @@
 							 && ((atomicType <= FFITypeSignedChar)
 							 && ((((usqInt) atomicType) >> 1) == (((usqInt) specType) >> 1))))) {
 							err = FFIErrorCoercionFailed;
-							goto l3;
+							goto l5;
 						}
 					}
 					err = 0;
-				l3:	/* end ffiValidateExternalData:AtomicType: */;
+				l5:	/* end ffiValidateExternalData:AtomicType: */;
 					if (err != 0) {
 						return err;
 					}
@@ -1134,7 +1134,7 @@
 				if (valueOop & (BytesPerWord - 1)) {
 					if (isIntegerObject(valueOop)) {
 						intValue = integerValueOf(valueOop);
-						goto l1;
+						goto l4;
 					}
 					
 #          if SPURVM
@@ -1142,13 +1142,13 @@
 
 						/* Immediate in Spur */
 						intValue = characterValueOf(valueOop);
-						goto l1;
+						goto l4;
 					}
 					if (isFloatObject(valueOop)) {
 
 						/* Immediate in 64-bit Spur */
 						intValue = floatValueOf(valueOop);
-						goto l1;
+						goto l4;
 					}
 
 #          endif /* SPURVM */
@@ -1163,26 +1163,26 @@
 #          else /* SPURVM */
 					if (isCharacterObject(valueOop)) {
 						intValue = characterValueOf(valueOop);
-						goto l1;
+						goto l4;
 					}
 
 #          endif /* SPURVM */
 
 					if (isFloatObject(valueOop)) {
 						intValue = floatValueOf(valueOop);
-						goto l1;
+						goto l4;
 					}
 					if (valueOop == (nilObject())) {
 						intValue = 0;
-						goto l1;
+						goto l4;
 					}
 					if (valueOop == (falseObject())) {
 						intValue = 0;
-						goto l1;
+						goto l4;
 					}
 					if (valueOop == (trueObject())) {
 						intValue = 1;
-						goto l1;
+						goto l4;
 					}
 					if ((fetchClassOf(valueOop)) == (classLargePositiveInteger())) {
 						
@@ -1190,18 +1190,18 @@
 
 						/* Use cppIf: to get the return type of the function right.  Should be sqInt on 32-bits. */
 						intValue = positive64BitValueOf(valueOop);
-						goto l1;
+						goto l4;
 
 #            else /* BytesPerWord == 8 */
 						intValue = positive32BitValueOf(valueOop);
-						goto l1;
+						goto l4;
 
 #            endif /* BytesPerWord == 8 */
 
 					}
 				}
 				intValue = signedMachineIntegerValueOf(valueOop);
-			l1:	/* end ffiIntegerValueOf: */;
+			l4:	/* end ffiIntegerValueOf: */;
 			}
 			if (failed()) {
 				return FFIErrorCoercionFailed;
@@ -1241,10 +1241,10 @@
 		/* begin ffiFloatValueOf: */
 		if (isFloatObject(valueOop)) {
 			floatValue = floatValueOf(valueOop);
-			goto l2;
+			goto l3;
 		}
 		floatValue = ((double) (ffiIntegerValueOf(valueOop)) );
-	l2:	/* end ffiFloatValueOf: */;
+	l3:	/* end ffiFloatValueOf: */;
 		if (failed()) {
 			return FFIErrorCoercionFailed;
 		}
@@ -1471,18 +1471,18 @@
 		if (!((isPointers(ptrType))
 			 && ((slotSizeOf(ptrType)) >= 2))) {
 			err = FFIErrorWrongType;
-			goto l1;
+			goto l2;
 		}
 		specOop = fetchPointerofObject(0, ptrType);
 		if (!((isWords(specOop))
 			 && ((slotSizeOf(specOop)) > 0))) {
 			err = FFIErrorWrongType;
-			goto l1;
+			goto l2;
 		}
 		spec = fetchPointerofObject(0, specOop);
 		if (!(spec & FFIFlagAtomic)) {
 			err = FFIErrorWrongType;
-			goto l1;
+			goto l2;
 		}
 		specType = ((usqInt) (spec & FFIAtomicTypeMask)) >> FFIAtomicTypeShift;
 		if (specType != atomicType) {
@@ -1493,11 +1493,11 @@
 				 && ((atomicType <= FFITypeSignedChar)
 				 && ((((usqInt) atomicType) >> 1) == (((usqInt) specType) >> 1))))) {
 				err = FFIErrorCoercionFailed;
-				goto l1;
+				goto l2;
 			}
 		}
 		err = 0;
-	l1:	/* end ffiValidateExternalData:AtomicType: */;
+	l2:	/* end ffiValidateExternalData:AtomicType: */;
 		if (err != 0) {
 			return err;
 		}
@@ -1608,7 +1608,7 @@
 					cPointer = ((usqInt) intRet);
 					if (cPointer == null) {
 						oop = methodReturnValue(nilObject());
-						goto l1;
+						goto l4;
 					}
 					cString = ((char *) cPointer);
 					strLen = 0;
@@ -1621,7 +1621,7 @@
 						strPtr[i] = (cString[i]);
 					}
 					oop = methodReturnValue(strOop);
-					goto l1;
+					goto l4;
 				}
 				
 #if SPURVM
@@ -1661,7 +1661,7 @@
 ;
 				storePointerofObjectwithValue(1, retOop1, retType);
 				oop = methodReturnValue(retOop1);
-				goto l1;
+				goto l4;
 			}
 			classOop = (((calloutState->ffiRetHeader)) & FFIFlagStructure
 				? classByteArray()
@@ -1690,7 +1690,7 @@
 ;
 			storePointerofObjectwithValue(0, retOop1, oop2);
 			oop = methodReturnValue(retOop1);
-		l1:	/* end ffiReturnPointer:ofType:in: */;
+		l4:	/* end ffiReturnPointer:ofType:in: */;
 		}
 		else {
 			/* begin ffiReturnStruct:ofType:in: */
@@ -1738,7 +1738,7 @@
 			oop = (value == 0
 				? falseObject()
 				: trueObject());
-			goto l2;
+			goto l6;
 		}
 		if (atomicType <= FFITypeSignedInt) {
 
@@ -1762,7 +1762,7 @@
 					value = (value & (mask - 1)) - (value & mask);
 				}
 				oop = integerObjectOf(value);
-				goto l2;
+				goto l6;
 			}
 			oop = (atomicType & 1
 				? (BytesPerWord == 8
@@ -1771,14 +1771,14 @@
 				: (BytesPerWord == 8
 						? positive64BitIntegerFor(intRet)
 						: positive32BitIntegerFor(intRet)));
-			goto l2;
+			goto l6;
 		}
 		oop = ((((usqInt) atomicType) >> 1) == (((usqInt) FFITypeSignedLongLong) >> 1)
 			? (atomicType & 1
 					? signed64BitIntegerFor(intRet)
 					: positive64BitIntegerFor(intRet))
 			: characterObjectOf(intRet & Byte0Mask));
-	l2:	/* end ffiCreateIntegralResultOop:ofAtomicType:in: */;
+	l6:	/* end ffiCreateIntegralResultOop:ofAtomicType:in: */;
 	}
 	return methodReturnValue(oop);
 }
@@ -2072,7 +2072,7 @@
 					cPointer = ((usqInt) intRet);
 					if (cPointer == null) {
 						oop3 = methodReturnValue(nilObject());
-						goto l5;
+						goto l10;
 					}
 					cString = ((char *) cPointer);
 					strLen = 0;
@@ -2085,7 +2085,7 @@
 						strPtr[i1] = (cString[i1]);
 					}
 					oop3 = methodReturnValue(strOop);
-					goto l5;
+					goto l10;
 				}
 				
 #if SPURVM
@@ -2125,7 +2125,7 @@
 ;
 				storePointerofObjectwithValue(1, retOop1, retType);
 				oop3 = methodReturnValue(retOop1);
-				goto l5;
+				goto l10;
 			}
 			classOop = (((calloutState->ffiRetHeader)) & FFIFlagStructure
 				? classByteArray()
@@ -2154,7 +2154,7 @@
 ;
 			storePointerofObjectwithValue(0, retOop1, oop2);
 			oop3 = methodReturnValue(retOop1);
-		l5:	/* end ffiReturnPointer:ofType:in: */;
+		l10:	/* end ffiReturnPointer:ofType:in: */;
 		}
 		else {
 			/* begin ffiReturnStruct:ofType:in: */
@@ -2185,7 +2185,7 @@
 			oop3 = methodReturnValue(retOop);
 		}
 		result = oop3;
-		goto l7;
+		goto l12;
 	}
 	if ((((usqInt) atomicType) >> 1) == (((usqInt) FFITypeSingleFloat) >> 1)) {
 		oop3 = floatObjectOf(floatRet);
@@ -2246,7 +2246,7 @@
 	l6:	/* end ffiCreateIntegralResultOop:ofAtomicType:in: */;
 	}
 	result = methodReturnValue(oop3);
-l7:	/* end ffiCalloutTo:SpecOnStack:in: */;
+l12:	/* end ffiCalloutTo:SpecOnStack:in: */;
 	/* begin cleanupCalloutState: */
 	while (((calloutState->stringArgIndex)) > 0) {
 		free(((calloutState->stringArgs))[(calloutState->stringArgIndex = ((calloutState->stringArgIndex)) - 1)]);
@@ -3807,7 +3807,7 @@
 						cPointer = ((usqInt) intRet);
 						if (cPointer == null) {
 							oop3 = methodReturnValue(nilObject());
-							goto l11;
+							goto l16;
 						}
 						cString = ((char *) cPointer);
 						strLen = 0;
@@ -3820,7 +3820,7 @@
 							strPtr[i2] = (cString[i2]);
 						}
 						oop3 = methodReturnValue(strOop);
-						goto l11;
+						goto l16;
 					}
 					
 #if SPURVM
@@ -3860,7 +3860,7 @@
 ;
 					storePointerofObjectwithValue(1, retOop1, retType);
 					oop3 = methodReturnValue(retOop1);
-					goto l11;
+					goto l16;
 				}
 				classOop = (((calloutState->ffiRetHeader)) & FFIFlagStructure
 					? classByteArray()
@@ -3889,7 +3889,7 @@
 ;
 				storePointerofObjectwithValue(0, retOop1, oop2);
 				oop3 = methodReturnValue(retOop1);
-			l11:	/* end ffiReturnPointer:ofType:in: */;
+			l16:	/* end ffiReturnPointer:ofType:in: */;
 			}
 			else {
 				/* begin ffiReturnStruct:ofType:in: */
@@ -3920,7 +3920,7 @@
 				oop3 = methodReturnValue(retOop);
 			}
 			result1 = oop3;
-			goto l13;
+			goto l18;
 		}
 		if ((((usqInt) atomicType) >> 1) == (((usqInt) FFITypeSingleFloat) >> 1)) {
 			oop3 = floatObjectOf(floatRet);
@@ -3938,7 +3938,7 @@
 				oop3 = (value == 0
 					? falseObject()
 					: trueObject());
-				goto l12;
+				goto l15;
 			}
 			if (atomicType <= FFITypeSignedInt) {
 
@@ -3962,7 +3962,7 @@
 						value = (value & (mask - 1)) - (value & mask);
 					}
 					oop3 = integerObjectOf(value);
-					goto l12;
+					goto l15;
 				}
 				oop3 = (atomicType & 1
 					? (BytesPerWord == 8
@@ -3971,17 +3971,17 @@
 					: (BytesPerWord == 8
 							? positive64BitIntegerFor(intRet)
 							: positive32BitIntegerFor(intRet)));
-				goto l12;
+				goto l15;
 			}
 			oop3 = ((((usqInt) atomicType) >> 1) == (((usqInt) FFITypeSignedLongLong) >> 1)
 				? (atomicType & 1
 						? signed64BitIntegerFor(intRet)
 						: positive64BitIntegerFor(intRet))
 				: characterObjectOf(intRet & Byte0Mask));
-		l12:	/* end ffiCreateIntegralResultOop:ofAtomicType:in: */;
+		l15:	/* end ffiCreateIntegralResultOop:ofAtomicType:in: */;
 		}
 		result1 = methodReturnValue(oop3);
-	l13:	/* end ffiCalloutTo:SpecOnStack:in: */;
+	l18:	/* end ffiCalloutTo:SpecOnStack:in: */;
 		/* begin cleanupCalloutState: */
 		while (((calloutState->stringArgIndex)) > 0) {
 			free(((calloutState->stringArgs))[(calloutState->stringArgIndex = ((calloutState->stringArgIndex)) - 1)]);
@@ -4229,7 +4229,7 @@
 					cPointer1 = ((usqInt) intRet1);
 					if (cPointer1 == null) {
 						oop4 = methodReturnValue(nilObject());
-						goto l14;
+						goto l24;
 					}
 					cString1 = ((char *) cPointer1);
 					strLen1 = 0;
@@ -4242,7 +4242,7 @@
 						strPtr1[i3] = (cString1[i3]);
 					}
 					oop4 = methodReturnValue(strOop1);
-					goto l14;
+					goto l24;
 				}
 				
 #if SPURVM
@@ -4282,7 +4282,7 @@
 ;
 				storePointerofObjectwithValue(1, retOop11, retType1);
 				oop4 = methodReturnValue(retOop11);
-				goto l14;
+				goto l24;
 			}
 			classOop1 = (((calloutState1->ffiRetHeader)) & FFIFlagStructure
 				? classByteArray()
@@ -4311,7 +4311,7 @@
 ;
 			storePointerofObjectwithValue(0, retOop11, oop21);
 			oop4 = methodReturnValue(retOop11);
-		l14:	/* end ffiReturnPointer:ofType:in: */;
+		l24:	/* end ffiReturnPointer:ofType:in: */;
 		}
 		else {
 			/* begin ffiReturnStruct:ofType:in: */
@@ -4342,7 +4342,7 @@
 			oop4 = methodReturnValue(retOop2);
 		}
 		result2 = oop4;
-		goto l16;
+		goto l26;
 	}
 	if ((((usqInt) atomicType2) >> 1) == (((usqInt) FFITypeSingleFloat) >> 1)) {
 		oop4 = floatObjectOf(floatRet1);
@@ -4360,7 +4360,7 @@
 			oop4 = (value1 == 0
 				? falseObject()
 				: trueObject());
-			goto l15;
+			goto l23;
 		}
 		if (atomicType2 <= FFITypeSignedInt) {
 
@@ -4384,7 +4384,7 @@
 					value1 = (value1 & (mask1 - 1)) - (value1 & mask1);
 				}
 				oop4 = integerObjectOf(value1);
-				goto l15;
+				goto l23;
 			}
 			oop4 = (atomicType2 & 1
 				? (BytesPerWord == 8
@@ -4393,17 +4393,17 @@
 				: (BytesPerWord == 8
 						? positive64BitIntegerFor(intRet1)
 						: positive32BitIntegerFor(intRet1)));
-			goto l15;
+			goto l23;
 		}
 		oop4 = ((((usqInt) atomicType2) >> 1) == (((usqInt) FFITypeSignedLongLong) >> 1)
 			? (atomicType2 & 1
 					? signed64BitIntegerFor(intRet1)
 					: positive64BitIntegerFor(intRet1))
 			: characterObjectOf(intRet1 & Byte0Mask));
-	l15:	/* end ffiCreateIntegralResultOop:ofAtomicType:in: */;
+	l23:	/* end ffiCreateIntegralResultOop:ofAtomicType:in: */;
 	}
 	result2 = methodReturnValue(oop4);
-l16:	/* end ffiCalloutTo:SpecOnStack:in: */;
+l26:	/* end ffiCalloutTo:SpecOnStack:in: */;
 	/* begin cleanupCalloutState: */
 	while (((calloutState1->stringArgIndex)) > 0) {
 		free(((calloutState1->stringArgs))[(calloutState1->stringArgIndex = ((calloutState1->stringArgIndex)) - 1)]);
@@ -4789,7 +4789,7 @@
 						cPointer = ((usqInt) intRet);
 						if (cPointer == null) {
 							oop3 = methodReturnValue(nilObject());
-							goto l11;
+							goto l16;
 						}
 						cString = ((char *) cPointer);
 						strLen = 0;
@@ -4802,7 +4802,7 @@
 							strPtr[i2] = (cString[i2]);
 						}
 						oop3 = methodReturnValue(strOop);
-						goto l11;
+						goto l16;
 					}
 					
 #if SPURVM
@@ -4842,7 +4842,7 @@
 ;
 					storePointerofObjectwithValue(1, retOop1, retType);
 					oop3 = methodReturnValue(retOop1);
-					goto l11;
+					goto l16;
 				}
 				classOop = (((calloutState->ffiRetHeader)) & FFIFlagStructure
 					? classByteArray()
@@ -4871,7 +4871,7 @@
 ;
 				storePointerofObjectwithValue(0, retOop1, oop2);
 				oop3 = methodReturnValue(retOop1);
-			l11:	/* end ffiReturnPointer:ofType:in: */;
+			l16:	/* end ffiReturnPointer:ofType:in: */;
 			}
 			else {
 				/* begin ffiReturnStruct:ofType:in: */
@@ -4902,7 +4902,7 @@
 				oop3 = methodReturnValue(retOop);
 			}
 			result1 = oop3;
-			goto l13;
+			goto l18;
 		}
 		if ((((usqInt) atomicType) >> 1) == (((usqInt) FFITypeSingleFloat) >> 1)) {
 			oop3 = floatObjectOf(floatRet);
@@ -4920,7 +4920,7 @@
 				oop3 = (value == 0
 					? falseObject()
 					: trueObject());
-				goto l12;
+				goto l15;
 			}
 			if (atomicType <= FFITypeSignedInt) {
 
@@ -4944,7 +4944,7 @@
 						value = (value & (mask - 1)) - (value & mask);
 					}
 					oop3 = integerObjectOf(value);
-					goto l12;
+					goto l15;
 				}
 				oop3 = (atomicType & 1
 					? (BytesPerWord == 8
@@ -4953,17 +4953,17 @@
 					: (BytesPerWord == 8
 							? positive64BitIntegerFor(intRet)
 							: positive32BitIntegerFor(intRet)));
-				goto l12;
+				goto l15;
 			}
 			oop3 = ((((usqInt) atomicType) >> 1) == (((usqInt) FFITypeSignedLongLong) >> 1)
 				? (atomicType & 1
 						? signed64BitIntegerFor(intRet)
 						: positive64BitIntegerFor(intRet))
 				: characterObjectOf(intRet & Byte0Mask));
-		l12:	/* end ffiCreateIntegralResultOop:ofAtomicType:in: */;
+		l15:	/* end ffiCreateIntegralResultOop:ofAtomicType:in: */;
 		}
 		result1 = methodReturnValue(oop3);
-	l13:	/* end ffiCalloutTo:SpecOnStack:in: */;
+	l18:	/* end ffiCalloutTo:SpecOnStack:in: */;
 		/* begin cleanupCalloutState: */
 		while (((calloutState->stringArgIndex)) > 0) {
 			free(((calloutState->stringArgs))[(calloutState->stringArgIndex = ((calloutState->stringArgIndex)) - 1)]);
@@ -5217,7 +5217,7 @@
 					cPointer1 = ((usqInt) intRet1);
 					if (cPointer1 == null) {
 						oop4 = methodReturnValue(nilObject());
-						goto l14;
+						goto l24;
 					}
 					cString1 = ((char *) cPointer1);
 					strLen1 = 0;
@@ -5230,7 +5230,7 @@
 						strPtr1[i3] = (cString1[i3]);
 					}
 					oop4 = methodReturnValue(strOop1);
-					goto l14;
+					goto l24;
 				}
 				
 #if SPURVM
@@ -5270,7 +5270,7 @@
 ;
 				storePointerofObjectwithValue(1, retOop11, retType1);
 				oop4 = methodReturnValue(retOop11);
-				goto l14;
+				goto l24;
 			}
 			classOop1 = (((calloutState1->ffiRetHeader)) & FFIFlagStructure
 				? classByteArray()
@@ -5299,7 +5299,7 @@
 ;
 			storePointerofObjectwithValue(0, retOop11, oop21);
 			oop4 = methodReturnValue(retOop11);
-		l14:	/* end ffiReturnPointer:ofType:in: */;
+		l24:	/* end ffiReturnPointer:ofType:in: */;
 		}
 		else {
 			/* begin ffiReturnStruct:ofType:in: */
@@ -5330,7 +5330,7 @@
 			oop4 = methodReturnValue(retOop2);
 		}
 		result2 = oop4;
-		goto l16;
+		goto l26;
 	}
 	if ((((usqInt) atomicType2) >> 1) == (((usqInt) FFITypeSingleFloat) >> 1)) {
 		oop4 = floatObjectOf(floatRet1);
@@ -5348,7 +5348,7 @@
 			oop4 = (value1 == 0
 				? falseObject()
 				: trueObject());
-			goto l15;
+			goto l23;
 		}
 		if (atomicType2 <= FFITypeSignedInt) {
 
@@ -5372,7 +5372,7 @@
 					value1 = (value1 & (mask1 - 1)) - (value1 & mask1);
 				}
 				oop4 = integerObjectOf(value1);
-				goto l15;
+				goto l23;
 			}
 			oop4 = (atomicType2 & 1
 				? (BytesPerWord == 8
@@ -5381,17 +5381,17 @@
 				: (BytesPerWord == 8
 						? positive64BitIntegerFor(intRet1)
 						: positive32BitIntegerFor(intRet1)));
-			goto l15;
+			goto l23;
 		}
 		oop4 = ((((usqInt) atomicType2) >> 1) == (((usqInt) FFITypeSignedLongLong) >> 1)
 			? (atomicType2 & 1
 					? signed64BitIntegerFor(intRet1)
 					: positive64BitIntegerFor(intRet1))
 			: characterObjectOf(intRet1 & Byte0Mask));
-	l15:	/* end ffiCreateIntegralResultOop:ofAtomicType:in: */;
+	l23:	/* end ffiCreateIntegralResultOop:ofAtomicType:in: */;
 	}
 	result2 = methodReturnValue(oop4);
-l16:	/* end ffiCalloutTo:SpecOnStack:in: */;
+l26:	/* end ffiCalloutTo:SpecOnStack:in: */;
 	/* begin cleanupCalloutState: */
 	while (((calloutState1->stringArgIndex)) > 0) {
 		free(((calloutState1->stringArgs))[(calloutState1->stringArgIndex = ((calloutState1->stringArgIndex)) - 1)]);
@@ -5877,7 +5877,12 @@
 	}
 	module = stackValue(0);
 	symbol = stackValue(1);
-	moduleHandle = ffiLoadCalloutModule(module);
+	if (module != (nilObject())) {
+		moduleHandle = ffiLoadCalloutModule(module);
+	}
+	else {
+		moduleHandle = null;
+	}
 	if (failed()) {
 		return primitiveFailFor(PrimErrNotFound);
 	}

Modified: branches/Cog/src/plugins/SqueakFFIPrims/X64SysVFFIPlugin.c
===================================================================
--- branches/Cog/src/plugins/SqueakFFIPrims/X64SysVFFIPlugin.c	2016-03-11 21:35:39 UTC (rev 3644)
+++ branches/Cog/src/plugins/SqueakFFIPrims/X64SysVFFIPlugin.c	2016-03-14 20:06:29 UTC (rev 3645)

@@ Diff output truncated at 50000 characters. @@


More information about the Vm-dev mailing list