[Vm-dev] [commit] r2203 - Update for Alien support. Set VM_PROXY_MINOR to 8. Requires interpreter

commits at squeakvm.org commits at squeakvm.org
Sun Apr 25 19:53:47 UTC 2010


Author: lewis
Date: 2010-04-25 12:53:47 -0700 (Sun, 25 Apr 2010)
New Revision: 2203

Modified:
   trunk/platforms/Cross/vm/sqVirtualMachine.c
   trunk/platforms/Cross/vm/sqVirtualMachine.h
Log:
Update for Alien support. Set VM_PROXY_MINOR to 8. Requires interpreter
functions in SqueakSource/Alien Alien-VMMaker-Support package. These are
now incorporated in SqueakSource/VMMaker VMMaker-dtl.170.


Modified: trunk/platforms/Cross/vm/sqVirtualMachine.c
===================================================================
--- trunk/platforms/Cross/vm/sqVirtualMachine.c	2010-04-13 18:55:21 UTC (rev 2202)
+++ trunk/platforms/Cross/vm/sqVirtualMachine.c	2010-04-25 19:53:47 UTC (rev 2203)
@@ -73,6 +73,8 @@
 sqInt isWordsOrBytes(sqInt oop);
 sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperClass);
 sqInt isArray(sqInt oop);
+sqInt internalIsMutable(sqInt oop);
+sqInt internalIsImmutable(sqInt oop);
 
 /* InterpreterProxy methodsFor: 'converting' */
 sqInt  booleanValueOf(sqInt obj);
@@ -128,6 +130,7 @@
 sqInt fullGC(void);
 sqInt incrementalGC(void);
 sqInt primitiveFail(void);
+sqInt primitiveFailFor(sqInt reasonCode);
 sqInt showDisplayBitsLeftTopRightBottom(sqInt aForm, sqInt l, sqInt t, sqInt r, sqInt b);
 sqInt signalSemaphoreWithIndex(sqInt semaIndex);
 sqInt success(sqInt aBoolean);
@@ -144,17 +147,29 @@
 sqInt copyBitsFromtoat(sqInt leftX, sqInt rightX, sqInt yValue);
 
 /* InterpreterProxy methodsFor: 'FFI support' */
-sqInt classExternalAddress(void);
+sqInt classExternalAddress(void); /* Old Squeak FFI */
 sqInt classExternalData(void);
 sqInt classExternalFunction(void);
 sqInt classExternalLibrary(void);
 sqInt classExternalStructure(void);
+sqInt classAlien(void); /* Newsqueak FFI */
+sqInt classUnsafeAlien(void); /* Newsqueak FFI */
+sqInt getStackPointer(void);  /* Newsqueak FFI */
+sqInt sendInvokeCallbackStackRegistersJmpbuf(sqInt thunkPtrAsInt, sqInt stackPtrAsInt, sqInt regsPtrAsInt, sqInt jmpBufPtrAsInt); /* Newsqueak FFI */
+sqInt reestablishContextPriorToCallback(sqInt callbackContext); /* Newsqueak FFI */
 sqInt ioLoadModuleOfLength(sqInt moduleNameIndex, sqInt moduleNameLength);
 sqInt ioLoadSymbolOfLengthFromModule(sqInt functionNameIndex, sqInt functionNameLength, sqInt moduleHandle);
 sqInt isInMemory(sqInt address);
 
 void *ioLoadFunctionFrom(char *fnName, char *modName);
 
+
+/* Proxy declarations for v1.8 */
+sqInt callbackEnter(sqInt *callbackID);
+sqInt callbackLeave(sqInt  callbackID);
+sqInt addGCRoot(sqInt *varLoc);
+sqInt removeGCRoot(sqInt *varLoc);
+
 struct VirtualMachine *VM = NULL;
 
 static sqInt majorVersion(void) {
@@ -325,16 +340,36 @@
 #endif
 
 #if VM_PROXY_MINOR > 5
+
 	VM->isArray = isArray;
 	VM->forceInterruptCheck = forceInterruptCheck;
+
 #endif
 
 #if VM_PROXY_MINOR > 6
+
 	VM->fetchLong32ofObject = fetchLong32ofObject;
 	VM->getThisSessionID = getThisSessionID;
 	VM->ioFilenamefromStringofLengthresolveAliases = ioFilenamefromStringofLengthresolveAliases;
 	VM->vmEndianness = vmEndianness;
+
 #endif
 
+#if VM_PROXY_MINOR > 7
+
+	VM->internalIsImmutable = internalIsImmutable;
+	VM->internalIsMutable   = internalIsMutable;
+	VM->primitiveFailFor    = primitiveFailFor;
+	VM->classAlien          = classAlien;
+	VM->getStackPointer     = (sqInt *(*)(void))getStackPointer;
+	VM->sendInvokeCallbackStackRegistersJmpbuf = sendInvokeCallbackStackRegistersJmpbuf;
+	VM->reestablishContextPriorToCallback = reestablishContextPriorToCallback;
+	VM->classUnsafeAlien    = classUnsafeAlien;
+	VM->callbackEnter = callbackEnter;
+	VM->callbackLeave = callbackLeave;
+	VM->addGCRoot = addGCRoot;
+	VM->removeGCRoot = removeGCRoot;
+
+#endif
 	return VM;
 }

Modified: trunk/platforms/Cross/vm/sqVirtualMachine.h
===================================================================
--- trunk/platforms/Cross/vm/sqVirtualMachine.h	2010-04-13 18:55:21 UTC (rev 2202)
+++ trunk/platforms/Cross/vm/sqVirtualMachine.h	2010-04-25 19:53:47 UTC (rev 2203)
@@ -9,11 +9,26 @@
    should work with older VMs. */
 #ifndef VM_PROXY_MINOR
 /* Increment the following number if you add functions at the end */
-#define VM_PROXY_MINOR 7
+#define VM_PROXY_MINOR 8
 #endif
 
 #include "sqMemoryAccess.h"
 
+#if VM_PROXY_MINOR > 7
+# define PrimErrNoErr 0
+# define PrimErrGenericFailure 1
+# define PrimErrBadReceiver 2
+# define PrimErrBadArgument 3
+# define PrimErrBadIndex 4
+# define PrimErrBadNumArgs 5
+# define PrimErrInappropriate 6
+# define PrimErrUnsupported 7
+# define PrimErrNoModification 8
+# define PrimErrNoMemory 9
+# define PrimErrNoCMemory 10
+# define PrimErrNotFound 11
+#endif
+
 typedef sqInt (*CompilerHook)();
 
 struct VirtualMachine* sqGetInterpreterProxy(void);
@@ -204,11 +219,52 @@
 #if VM_PROXY_MINOR > 6
 	sqInt  (*fetchLong32ofObject)(sqInt fieldFieldIndex, sqInt oop);
 	sqInt  (*getThisSessionID)(void);
-	sqInt	  (*ioFilenamefromStringofLengthresolveAliases)(char* aCharBuffer, char* filenameIndex, sqInt filenameLength, sqInt resolveFlag);
+	sqInt  (*ioFilenamefromStringofLengthresolveAliases)(char* aCharBuffer, char* filenameIndex, sqInt filenameLength, sqInt resolveFlag);
 	sqInt  (*vmEndianness)(void);	
 #endif
 
+#if VM_PROXY_MINOR > 7
+	sqInt  (*internalIsImmutable)(sqInt oop);
+	sqInt  (*internalIsMutable)(sqInt oop);
+	sqInt  (*primitiveFailFor)(sqInt code);
+	sqInt  (*classAlien)(void);
+	sqInt *(*getStackPointer)(void);
+	sqInt  (*sendInvokeCallbackStackRegistersJmpbuf)(sqInt thunkPtrAsInt, sqInt stackPtrAsInt, sqInt regsPtrAsInt, sqInt jmpBufPtrAsInt);
+	sqInt  (*reestablishContextPriorToCallback)(sqInt callbackContext);
+	sqInt  (*classUnsafeAlien)(void);
+	/* New methods for proxy version 1.8 */
+	
+	/* callbackEnter: Re-enter the interpreter loop for a callback.
+	Arguments:
+	callbackID: Pointer to a location receiving the callback ID
+	used in callbackLeave
+	Returns: True if successful, false otherwise */
+	sqInt (*callbackEnter)(sqInt *callbackID);
+	
+	/* callbackLeave: Leave the interpreter from a previous callback
+	Arguments:
+	callbackID: The ID of the callback received from callbackEnter()
+	Returns: True if succcessful, false otherwise. */
+	sqInt (*callbackLeave)(sqInt  callbackID);
+	
+	/* addGCRoot: Add a variable location to the garbage collector.
+	The contents of the variable location will be updated accordingly.
+	Arguments:
+	varLoc: Pointer to the variable location
+	Returns: True if successful, false otherwise. */
+	sqInt (*addGCRoot)(sqInt *varLoc);
+	
+	/* removeGCRoot: Remove a variable location from the garbage collector.
+	Arguments:
+	varLoc: Pointer to the variable location
+	Returns: True if successful, false otherwise.
+	*/
+	sqInt (*removeGCRoot)(sqInt *varLoc);
+#endif
 
+#if VM_PROXY_MINOR > 8
+#endif
+
 } VirtualMachine;
 
 #endif /* _SqueakVM_H */



More information about the Vm-dev mailing list