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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

commits-3
 
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 */

Reply | Threaded
Open this post in threaded view
|

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

melkyades
 
Hi all,
       I just checked out svn and tryied to compile in linux. Igor already sent a mail about this, this commit added alien support but didn't change platforms/unix/src, so in Unix you get a lot undefined reference errors.
       Regenerating C from slang should be enough (I think), but, may I ask why you didn't also commit the updated platform/unix/src? It won't compile as it is now.

Regards,
          Javier.

On Sun, Apr 25, 2010 at 4:53 PM, <[hidden email]> wrote:

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 */




--
Javier Pimás
Ciudad de Buenos Aires
Reply | Threaded
Open this post in threaded view
|

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

David T. Lewis
 
Hi Javier,

The files in platforms/unix/src will not be updated at this time. They
are a snapshot of the generated sources from VMMaker, and they were
updated at the time that Ian last produced an official release on
http://squeakvm.org/unix.

So here is what you should expect:

- The files in platforms/unix/src will be updated the next time that
Ian builds a VM for release, but not before that time.

- If you use the latest SVN sources and the latest VMMaker to generate
your own ./src files, then you will usually be able to build a
working VM. But this is not guaranteed. Sometimes the platforms
sources and the VMMaker code may be out of sync, because parts of
the system may be under active development.

- If you use the latest SVN sources, and compile it using the sources
in platforms/unix/src, this will probably not work. If you are doing
this shortly after an official VM release, it probably will work, but
in general you will find that development has advanced and the older
platforms/unix/src files will no longer be in sync with the rest.

I know that this can be confusing, but keeping the copies of the older
files in platforms/unix/src is important for many people who may not
be comfortable using the VMMaker tool, or who may need to build their
VM from only from C sources some reason.

HTH,

Dave

On Thu, May 27, 2010 at 03:11:49AM -0300, Javier Pim??s wrote:

>  
> Hi all,
>        I just checked out svn and tryied to compile in linux. Igor already
> sent a mail about this, this commit added alien support but didn't change
> platforms/unix/src, so in Unix you get a lot undefined reference errors.
>        Regenerating C from slang should be enough (I think), but, may I ask
> why you didn't also commit the updated platform/unix/src? It won't compile
> as it is now.
>
> Regards,
>           Javier.
>
> On Sun, Apr 25, 2010 at 4:53 PM, <[hidden email]> wrote:
>
> >
> > 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
> > ===================================================================
>
> --
> Javier Pim??s
> Ciudad de Buenos Aires