[Vm-dev] [commit] r2431 - OSCogVM source as per VMMaker.oscog-eem.78.

commits at squeakvm.org commits at squeakvm.org
Fri Jun 17 20:17:37 UTC 2011


Author: eliot
Date: 2011-06-17 13:17:36 -0700 (Fri, 17 Jun 2011)
New Revision: 2431

Modified:
   branches/Cog/macbuild/CroquetPlugin/CroquetPlugin.xcodeproj/project.pbxproj
   branches/Cog/nsbuild/cygwinbuild/sqNamedPrims.h
   branches/Cog/nsbuild/unixbuild/HowToBuild
   branches/Cog/nsbuild/unixbuild/bld/plugins.ext
   branches/Cog/nsbuild/unixbuild/bld/plugins.int
   branches/Cog/nssrc/vm/interp.h
   branches/Cog/platforms/Cross/vm/sqVirtualMachine.c
   branches/Cog/platforms/Cross/vm/sqVirtualMachine.h
   branches/Cog/platforms/Mac OS/plugins/SerialPlugin/sqMacSerialPort.c
   branches/Cog/platforms/unix/config/acinclude.m4
   branches/Cog/platforms/unix/config/configure
   branches/Cog/platforms/unix/config/configure.ac
   branches/Cog/platforms/unix/config/mkconfig.in
   branches/Cog/platforms/unix/config/mkmf
   branches/Cog/platforms/unix/plugins/SerialPlugin/sqUnixSerial.c
   branches/Cog/platforms/unix/vm/Makefile.in
   branches/Cog/platforms/unix/vm/sqUnixMain.c
   branches/Cog/processors/IA32/bochs/conf.COG
   branches/Cog/scripts/mkvmarchives
   branches/Cog/src/vm/cointerp.c
   branches/Cog/src/vm/cointerp.h
   branches/Cog/src/vm/gcc3x-cointerp.c
   branches/Cog/src/vm/interp.h
   branches/Cog/stacksrc/vm/gcc3x-interp.c
   branches/Cog/stacksrc/vm/interp.c
   branches/Cog/stacksrc/vm/interp.h
   branches/Cog/unixbuild/HowToBuild
Log:
OSCogVM source as per VMMaker.oscog-eem.78.
interp.h defines VM_PROXY_MAJOR/VM_PROXY_MINOR.
Newspeak linux build.
Win32 plugin support code taken from trunk.
Corrections to linux HowToBuilds


Modified: branches/Cog/macbuild/CroquetPlugin/CroquetPlugin.xcodeproj/project.pbxproj
===================================================================
--- branches/Cog/macbuild/CroquetPlugin/CroquetPlugin.xcodeproj/project.pbxproj	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/macbuild/CroquetPlugin/CroquetPlugin.xcodeproj/project.pbxproj	2011-06-17 20:17:36 UTC (rev 2431)
@@ -9,7 +9,7 @@
 /* Begin PBXBuildFile section */
 		8D01CCCE0486CAD60068D4B7 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08EA7FFBFE8413EDC02AAC07 /* Carbon.framework */; };
 		A295BF4D11922528003C5973 /* CroquetPlugin.c in Sources */ = {isa = PBXBuildFile; fileRef = A295BF4C11922528003C5973 /* CroquetPlugin.c */; };
-		A295BF5711922556003C5973 /* tribox.c in Sources */ = {isa = PBXBuildFile; fileRef = A295BF5411922556003C5973 /* tribox.c */; };
+		A295BF5711922556003C5973 /* TriBoxStub.c in Sources */ = {isa = PBXBuildFile; fileRef = A295BF5411922556003C5973 /* TriBoxStub.c */; };
 		A295BF7311922634003C5973 /* sqMacCroquet.c in Sources */ = {isa = PBXBuildFile; fileRef = A295BF7111922634003C5973 /* sqMacCroquet.c */; };
 /* End PBXBuildFile section */
 
@@ -37,7 +37,7 @@
 		A295BF4C11922528003C5973 /* CroquetPlugin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = CroquetPlugin.c; path = ../../src/plugins/CroquetPlugin/CroquetPlugin.c; sourceTree = SOURCE_ROOT; };
 		A295BF4F11922556003C5973 /* CroquetPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CroquetPlugin.h; sourceTree = "<group>"; };
 		A295BF5311922556003C5973 /* md5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = md5.h; sourceTree = "<group>"; };
-		A295BF5411922556003C5973 /* tribox.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tribox.c; sourceTree = "<group>"; };
+		A295BF5411922556003C5973 /* TriBoxStub.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = TriBoxStub.c; sourceTree = "<group>"; };
 		A295BF7111922634003C5973 /* sqMacCroquet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sqMacCroquet.c; sourceTree = "<group>"; };
 		A295BF7211922634003C5973 /* sqMacCroquet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sqMacCroquet.h; sourceTree = "<group>"; };
 /* End PBXFileReference section */
@@ -110,7 +110,7 @@
 			children = (
 				A295BF4F11922556003C5973 /* CroquetPlugin.h */,
 				A295BF5311922556003C5973 /* md5.h */,
-				A295BF5411922556003C5973 /* tribox.c */,
+				A295BF5411922556003C5973 /* TriBoxStub.c */,
 			);
 			name = CroquetPlugin;
 			path = ../../platforms/Cross/plugins/CroquetPlugin;
@@ -181,7 +181,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				A295BF4D11922528003C5973 /* CroquetPlugin.c in Sources */,
-				A295BF5711922556003C5973 /* tribox.c in Sources */,
+				A295BF5711922556003C5973 /* TriBoxStub.c in Sources */,
 				A295BF7311922634003C5973 /* sqMacCroquet.c in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;

Modified: branches/Cog/nsbuild/cygwinbuild/sqNamedPrims.h
===================================================================
--- branches/Cog/nsbuild/cygwinbuild/sqNamedPrims.h	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/nsbuild/cygwinbuild/sqNamedPrims.h	2011-06-17 20:17:36 UTC (rev 2431)
@@ -1,4 +1,4 @@
-/* Automatically generated on Jun  2 2011, 10:40:51 */
+/* Automatically generated on Jun 17 2011, 12:49:52 */
 
 extern sqExport vm_exports[];
 extern sqExport os_exports[];

Modified: branches/Cog/nsbuild/unixbuild/HowToBuild
===================================================================
--- branches/Cog/nsbuild/unixbuild/HowToBuild	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/nsbuild/unixbuild/HowToBuild	2011-06-17 20:17:36 UTC (rev 2431)
@@ -15,20 +15,20 @@
      svn co http://www.squeakvm.org/svn/squeak/branches/Cog/src
      svn co http://www.squeakvm.org/svn/squeak/branches/Cog/nsbuild
 3. Open a shell, cd into the unixbuild/bld directory and execute
-     ../../../platforms/unix/config/configure CFLAGS="-g -O2 -msse2 -D_GNU_SOURCE -DNDEBUG -DNO_VM_PROFILE=1 -DDEBUGVM=0" LIBS=-lpthread
+     ../../../platforms/unix/config/configure --with-src=nssrc --disable-cogit CFLAGS="-g -O2 -msse2 -D_GNU_SOURCE -DNDEBUG -DNO_VM_PROFILE=1 -DDEBUGVM=0" LIBS=-lpthread
      make install prefix=WhereYouWantTheVmToGo
 
 	N.B.  On Ubuntu *do not* supply "LIBS=-lpthread", i.e. use
-     ../../../platforms/unix/config/configure CFLAGS="-g -O2 -msse2 -D_GNU_SOURCE -DNDEBUG -DNO_VM_PROFILE=1 -DDEBUGVM=0"
+     ../../../platforms/unix/config/configure --with-src=nssrc --disable-cogit CFLAGS="-g -O2 -msse2 -D_GNU_SOURCE -DNDEBUG -DNO_VM_PROFILE=1 -DDEBUGVM=0"
 
 4. At the end of it you'll get a new VM in the path provided via -prefix
 
 
 3a. For an assert-enabled VM do
-     ../../../platforms/unix/config/configure --without-vm-display-fbdev --without-npsqueak CFLAGS="-g -O1 -msse2 -D_GNU_SOURCE -DNO_VM_PROFILE=1 -DDEBUGVM=0" LIBS=-lpthread
+     ../../../platforms/unix/config/configure --without-vm-display-fbdev --without-npsqueak --with-src=nssrc --disable-cogit CFLAGS="-g -O1 -msse2 -D_GNU_SOURCE -DNO_VM_PROFILE=1 -DDEBUGVM=0" LIBS=-lpthread
 
 3b. For a full debug VM do
-     ../../../platforms/unix/config/configure --without-vm-display-fbdev --without-npsqueak CFLAGS="-g3 -msse2 -D_GNU_SOURCE -DNO_VM_PROFILE=1 -DDEBUGVM=1" LIBS=-lpthread
+     ../../../platforms/unix/config/configure --without-vm-display-fbdev --without-npsqueak --with-src=nssrc --disable-cogit CFLAGS="-g3 -msse2 -D_GNU_SOURCE -DNO_VM_PROFILE=1 -DDEBUGVM=1" LIBS=-lpthread
 
 3c. If you're building the VM on a 64-bit OS, you'll need a compiler which can
 compile and link to 32-bit binaries. On most Linuxes the gcc-multilib package
@@ -36,7 +36,7 @@
 You'll also have to add the -m32 switch to all gcc & g++ invocations.  The
 easiest way to do this is to add CC="gcc -m32" & CXX="g++ -m32" to the configure
 script:
-     ../../../platforms/unix/config/configure CC="gcc -m32" CXX="g++ -m32" CFLAGS="-g -O2 -msse2 -D_GNU_SOURCE -DNDEBUG -DNO_VM_PROFILE=1" LIBS=-lpthread
+     ../../../platforms/unix/config/configure CC="gcc -m32" CXX="g++ -m32" --with-src=nssrc --disable-cogit CFLAGS="-g -O2 -msse2 -D_GNU_SOURCE -DNDEBUG -DNO_VM_PROFILE=1" LIBS=-lpthread
 To run a 32-bit VM on a 64-bit OS, you'll also need the 32-bit libraries
 provided by the ia32-libs package.
 

Modified: branches/Cog/nsbuild/unixbuild/bld/plugins.ext
===================================================================
--- branches/Cog/nsbuild/unixbuild/bld/plugins.ext	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/nsbuild/unixbuild/bld/plugins.ext	2011-06-17 20:17:36 UTC (rev 2431)
@@ -1,2 +1,2 @@
 # List of external plugins.
-EXTERNAL_PLUGINS =
+EXTERNAL_PLUGINS = \

Modified: branches/Cog/nsbuild/unixbuild/bld/plugins.int
===================================================================
--- branches/Cog/nsbuild/unixbuild/bld/plugins.int	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/nsbuild/unixbuild/bld/plugins.int	2011-06-17 20:17:36 UTC (rev 2431)
@@ -22,5 +22,4 @@
 SocketPlugin \
 SurfacePlugin \
 UUIDPlugin \
-UnixOSProcessPlugin \
-VMProfileMacSupportPlugin
+UnixOSProcessPlugin

Modified: branches/Cog/nssrc/vm/interp.h
===================================================================
--- branches/Cog/nssrc/vm/interp.h	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/nssrc/vm/interp.h	2011-06-17 20:17:36 UTC (rev 2431)
@@ -1,11 +1,10 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.73 uuid: 8ef988bb-d4c8-479d-a4d8-75f1ddc5f248
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.78 uuid: 412444c6-36dc-48be-b5cd-a6ebc4ade0bb
  */
 
-#define NewspeakVM 1
-#define ALIEN_FFI 1
-#define IMMUTABILITY 1
-#define BigEndianFloats 1
+#define VM_PROXY_MAJOR 1
+#define VM_PROXY_MINOR 12
+
 #define SQ_VI_BYTES_PER_WORD 4
 
 #define PrimErrGenericFailure 1
@@ -24,3 +23,8 @@
 #define PrimErrObjectMayMove 14
 #define PrimErrLimitExceeded 15
 
+#define NewspeakVM 1
+#define ALIEN_FFI 1
+#define IMMUTABILITY 1
+#define BigEndianFloats 1
+

Modified: branches/Cog/platforms/Cross/vm/sqVirtualMachine.c
===================================================================
--- branches/Cog/platforms/Cross/vm/sqVirtualMachine.c	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/platforms/Cross/vm/sqVirtualMachine.c	2011-06-17 20:17:36 UTC (rev 2431)
@@ -5,7 +5,6 @@
 #include <time.h>
 #include <setjmp.h>
 
-#include "vmCallback.h"
 #include "sqVirtualMachine.h"
 
 
@@ -177,11 +176,13 @@
 void *startOfAlienData(sqInt);
 usqInt sizeOfAlienData(sqInt);
 sqInt signalNoResume(sqInt);
+#if VM_PROXY_MINOR > 8
 sqInt getStackPointer(void);  /* Alien FFI */
 sqInt sendInvokeCallbackStackRegistersJmpbuf(sqInt thunkPtrAsInt, sqInt stackPtrAsInt, sqInt regsPtrAsInt, sqInt jmpBufPtrAsInt); /* Alien FFI */
 sqInt reestablishContextPriorToCallback(sqInt callbackContext); /* Alien FFI */
-sqInt sendInvokeCallbackContext(VMCallbackContext *);
-sqInt returnAsThroughCallbackContext(int, VMCallbackContext *, sqInt);
+sqInt sendInvokeCallbackContext(vmccp);
+sqInt returnAsThroughCallbackContext(int, vmccp, sqInt);
+#endif /* VM_PROXY_MINOR > 8 */
 char *cStringOrNullFor(sqInt);
 
 void *ioLoadFunctionFrom(char *fnName, char *modName);
@@ -428,9 +429,7 @@
 	VM->classUnsafeAlien    = classUnsafeAlien;
 	VM->sendInvokeCallbackStackRegistersJmpbuf = sendInvokeCallbackStackRegistersJmpbuf;
 	VM->reestablishContextPriorToCallback = reestablishContextPriorToCallback;
-# if ALIEN_FFI
 	VM->getStackPointer     = (sqInt *(*)(void))getStackPointer;
-# endif
 # if IMMUTABILITY
 	VM->internalIsImmutable = internalIsImmutable;
 	VM->internalIsMutable   = internalIsMutable;

Modified: branches/Cog/platforms/Cross/vm/sqVirtualMachine.h
===================================================================
--- branches/Cog/platforms/Cross/vm/sqVirtualMachine.h	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/platforms/Cross/vm/sqVirtualMachine.h	2011-06-17 20:17:36 UTC (rev 2431)
@@ -1,12 +1,17 @@
 #ifndef _SqueakVM_H
 #define _SqueakVM_H
 
+/* We expect interp.h to define VM_PROXY_MAJOR & VM_PROXY_MINOR appropriately
+ * for the VM generated with it.
+ */
+#include "interp.h"
+
+#ifndef VM_PROXY_MAJOR
 /* Increment the following number if you change the order of
    functions listed or if you remove functions */
-#define VM_PROXY_MAJOR 1
+# define VM_PROXY_MAJOR 1
+#endif
 
-/* Note: You can define a different VM_PROXY_MINOR if the plugin
-   should work with older VMs. */
 #ifndef VM_PROXY_MINOR
 /* Increment the following number if you add functions at the end */
 # define VM_PROXY_MINOR 12

Modified: branches/Cog/platforms/Mac OS/plugins/SerialPlugin/sqMacSerialPort.c
===================================================================
--- branches/Cog/platforms/Mac OS/plugins/SerialPlugin/sqMacSerialPort.c	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/platforms/Mac OS/plugins/SerialPlugin/sqMacSerialPort.c	2011-06-17 20:17:36 UTC (rev 2431)
@@ -87,7 +87,7 @@
     return false;
 }
 
-EXPORT (int) serialPortReadInto(int portNum, int count, int bufferPtr) {
+EXPORT (int) serialPortReadInto(int portNum, int count, void *bufferPtr) {
 /* Read up to count bytes from the given serial port into the given byte array.
    Read only up to the number of bytes in the port's input buffer; if fewer bytes
    than count have been received, do not wait for additional data to arrive.
@@ -96,7 +96,7 @@
     return false;
 }
 
-EXPORT (int) serialPortWriteFrom(int portNum, int count, int bufferPtr) {
+EXPORT (int) serialPortWriteFrom(int portNum, int count, void *bufferPtr) {
 /* Write count bytes from the given byte array to the given serial port's
    output buffer. Return the number of bytes written. This implementation is
    synchronous: it doesn't return until the data has been sent. However, other

Modified: branches/Cog/platforms/unix/config/acinclude.m4
===================================================================
--- branches/Cog/platforms/unix/config/acinclude.m4	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/platforms/unix/config/acinclude.m4	2011-06-17 20:17:36 UTC (rev 2431)
@@ -43,12 +43,19 @@
   vmmcheck dir  -d ${vmmdir}
   vmmcheck dir  -d ${vmmdir}/plugins
   vmmcheck dir  -d ${vmmdir}/vm
-  vmmcheck file -f ${vmmdir}/vm/cogit.c
-  vmmcheck file -f ${vmmdir}/vm/cogit.h
-  vmmcheck file -f ${vmmdir}/vm/cogmethod.h
-  vmmcheck file -f ${vmmdir}/vm/cointerp.c
-  vmmcheck file -f ${vmmdir}/vm/cointerp.h
-  vmmcheck file -f ${vmmdir}/vm/gcc3x-cointerp.c
+  vmmcheck file -f ${vmmdir}/vm/interp.h
+  vmmcheck file -f ${vmmdir}/vm/vmCallback.h
+  if test "$cogit" = yes ; then
+	  vmmcheck file -f ${vmmdir}/vm/cogit.c
+	  vmmcheck file -f ${vmmdir}/vm/cogit.h
+	  vmmcheck file -f ${vmmdir}/vm/cogmethod.h
+	  vmmcheck file -f ${vmmdir}/vm/cointerp.c
+	  vmmcheck file -f ${vmmdir}/vm/cointerp.h
+	  vmmcheck file -f ${vmmdir}/vm/gcc3x-cointerp.c
+  else
+	  vmmcheck file -f ${vmmdir}/vm/interp.c
+	  vmmcheck file -f ${vmmdir}/vm/gcc3x-interp.c
+  fi
   AC_MSG_RESULT(okay)])
 
 
@@ -137,10 +144,10 @@
 fi])
 
 AC_DEFUN([AC_GNU_INTERP],
-[INTERP="cointerp"
+[if test "$cogit" = yes ; then INTERP="cointerp"; else INTERP="interp"; fi
 AC_SUBST(INTERP)
 AC_PROG_AWK
-AC_MSG_CHECKING(whether we can compile gcc3x-cointerp.c)
+AC_MSG_CHECKING(whether we can compile gcc3x-$INTERP)
 if test "$GCC" = "yes"; then
   INTERP="gcc3x-$INTERP"; AC_MSG_RESULT(yes)
 else

Modified: branches/Cog/platforms/unix/config/configure
===================================================================
--- branches/Cog/platforms/unix/config/configure	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/platforms/unix/config/configure	2011-06-17 20:17:36 UTC (rev 2431)
@@ -463,7 +463,7 @@
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='NM LD SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS topdir cfgdir vmmdir vmmcfg blddir SQ_MAJOR SQ_MINOR SQ_UPDATE SQ_VERSION VM_MAJOR VM_MINOR VM_RELEASE VM_VERSION imgdir expanded_relative_imgdir plgdir build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT WFLAGS AS RANLIB ac_ct_RANLIB INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN CPP EGREP SED LN_S ECHO AR ac_ct_AR STRIP ac_ct_STRIP CXX CXXFLAGS ac_ct_CXX CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL INCLUDES HAVE_INTERP_H ALLOCA INTERP AWK VM_APP_ICONS npsqueak install_nps uninstall_nps SQ_LIBDIR int_modules ext_modules HAVE_LANGINFO_CODESET HAVE_NANOSLEEP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS X_CPPFLAGS X_INCLUDES LIBM_CFLAGS LIB_UUID int_plugins ext_plugins LIBOBJS LTLIBOBJS'
+ac_subst_vars='NM LD SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS cogit topdir cfgdir vmmdir vmmcfg blddir SQ_MAJOR SQ_MINOR SQ_UPDATE SQ_VERSION VM_MAJOR VM_MINOR VM_RELEASE VM_VERSION imgdir expanded_relative_imgdir plgdir build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT WFLAGS AS RANLIB ac_ct_RANLIB INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN CPP EGREP SED LN_S ECHO AR ac_ct_AR STRIP ac_ct_STRIP CXX CXXFLAGS ac_ct_CXX CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL INCLUDES HAVE_INTERP_H ALLOCA INTERP AWK VM_APP_ICONS npsqueak install_nps uninstall_nps SQ_LIBDIR int_modules ext_modules HAVE_LANGINFO_CODESET HAVE_NANOSLEEP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS X_CPPFLAGS X_INCLUDES LIBM_CFLAGS LIB_UUID int_plugins ext_plugins LIBOBJS LTLIBOBJS'
 ac_subst_files='make_cfg make_int make_ext make_prg Makefile_install Makefile_dist Makefile_rpm Makefile_deb'
 
 # Initialize some variables set by options.
@@ -1022,6 +1022,7 @@
 Optional Features:
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-cogit            compile a cogit VM default=yes
   --enable-static[=PKGS]
                           build static libraries [default=no]
   --enable-shared[=PKGS]
@@ -1554,6 +1555,24 @@
    vmmcfg="${blddir}"
 fi;
 
+# Compiling a Cogit VM or not?  If so, need a cogit$o, cointerp, etc.
+
+# Check whether --enable-cogit or --disable-cogit was given.
+if test "${enable_cogit+set}" = set; then
+  enableval="$enable_cogit"
+  cogit="no"
+else
+  cogit="yes"
+fi;
+
+
+#AC_ARG_ENABLE(jit,
+#[  --enable-jit            enable J4 support [default=no]],
+#JIT="yes", JIT="no")
+#
+#test $JIT = "yes" && J_CFLAGS="-DJ_ENABLED"
+#AC_SUBST(J_CFLAGS)
+
 # Check the generated src dir looks sane
 
 
@@ -1573,12 +1592,19 @@
   vmmcheck dir  -d ${vmmdir}
   vmmcheck dir  -d ${vmmdir}/plugins
   vmmcheck dir  -d ${vmmdir}/vm
-  vmmcheck file -f ${vmmdir}/vm/cogit.c
-  vmmcheck file -f ${vmmdir}/vm/cogit.h
-  vmmcheck file -f ${vmmdir}/vm/cogmethod.h
-  vmmcheck file -f ${vmmdir}/vm/cointerp.c
-  vmmcheck file -f ${vmmdir}/vm/cointerp.h
-  vmmcheck file -f ${vmmdir}/vm/gcc3x-cointerp.c
+  vmmcheck file -f ${vmmdir}/vm/interp.h
+  vmmcheck file -f ${vmmdir}/vm/vmCallback.h
+  if test "$cogit" = yes ; then
+	  vmmcheck file -f ${vmmdir}/vm/cogit.c
+	  vmmcheck file -f ${vmmdir}/vm/cogit.h
+	  vmmcheck file -f ${vmmdir}/vm/cogmethod.h
+	  vmmcheck file -f ${vmmdir}/vm/cointerp.c
+	  vmmcheck file -f ${vmmdir}/vm/cointerp.h
+	  vmmcheck file -f ${vmmdir}/vm/gcc3x-cointerp.c
+  else
+	  vmmcheck file -f ${vmmdir}/vm/interp.c
+	  vmmcheck file -f ${vmmdir}/vm/gcc3x-interp.c
+  fi
   echo "$as_me:$LINENO: result: okay" >&5
 echo "${ECHO_T}okay" >&6
 
@@ -5848,7 +5874,7 @@
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 5851 "configure"' > conftest.$ac_ext
+  echo '#line 5877 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -6865,7 +6891,7 @@
 
 
 # Provide some information about the compiler.
-echo "$as_me:6868:" \
+echo "$as_me:6894:" \
      "checking for Fortran 77 compiler version" >&5
 ac_compiler=`set X $ac_compile; echo $2`
 { (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@@ -7928,11 +7954,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7931: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7957: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7935: \$? = $ac_status" >&5
+   echo "$as_me:7961: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -8196,11 +8222,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8199: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8225: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:8203: \$? = $ac_status" >&5
+   echo "$as_me:8229: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -8300,11 +8326,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8303: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8329: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:8307: \$? = $ac_status" >&5
+   echo "$as_me:8333: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -9769,7 +9795,7 @@
   libsuff=
   case "$host_cpu" in
   x86_64*|s390x*|powerpc64*)
-    echo '#line 9772 "configure"' > conftest.$ac_ext
+    echo '#line 9798 "configure"' > conftest.$ac_ext
     if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -10666,7 +10692,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 10669 "configure"
+#line 10695 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10766,7 +10792,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 10769 "configure"
+#line 10795 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -13109,11 +13135,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:13112: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13138: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:13116: \$? = $ac_status" >&5
+   echo "$as_me:13142: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -13213,11 +13239,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:13216: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13242: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:13220: \$? = $ac_status" >&5
+   echo "$as_me:13246: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -13749,7 +13775,7 @@
   libsuff=
   case "$host_cpu" in
   x86_64*|s390x*|powerpc64*)
-    echo '#line 13752 "configure"' > conftest.$ac_ext
+    echo '#line 13778 "configure"' > conftest.$ac_ext
     if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -14807,11 +14833,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14810: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14836: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:14814: \$? = $ac_status" >&5
+   echo "$as_me:14840: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -14911,11 +14937,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14914: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14940: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:14918: \$? = $ac_status" >&5
+   echo "$as_me:14944: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -16360,7 +16386,7 @@
   libsuff=
   case "$host_cpu" in
   x86_64*|s390x*|powerpc64*)
-    echo '#line 16363 "configure"' > conftest.$ac_ext
+    echo '#line 16389 "configure"' > conftest.$ac_ext
     if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -17138,11 +17164,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:17141: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:17167: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:17145: \$? = $ac_status" >&5
+   echo "$as_me:17171: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -17406,11 +17432,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:17409: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:17435: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:17413: \$? = $ac_status" >&5
+   echo "$as_me:17439: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -17510,11 +17536,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:17513: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:17539: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:17517: \$? = $ac_status" >&5
+   echo "$as_me:17543: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -18979,7 +19005,7 @@
   libsuff=
   case "$host_cpu" in
   x86_64*|s390x*|powerpc64*)
-    echo '#line 18982 "configure"' > conftest.$ac_ext
+    echo '#line 19008 "configure"' > conftest.$ac_ext
     if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -23690,13 +23716,6 @@
 fi
 
 
-#AC_ARG_ENABLE(jit,
-#[  --enable-jit            enable J4 support [default=no]],
-#JIT="yes", JIT="no")
-#
-#test $JIT = "yes" && J_CFLAGS="-DJ_ENABLED"
-#AC_SUBST(J_CFLAGS)
-
 # Checks for platform characteristics.
 
 echo "$as_me:$LINENO: checking for $host_cpu optimisation flags" >&5
@@ -23732,7 +23751,7 @@
   echo "$as_me:$LINENO: result: \"$ac_optflags\"" >&5
 echo "${ECHO_T}\"$ac_optflags\"" >&6
 fi
-INTERP="cointerp"
+if test "$cogit" = yes ; then INTERP="cointerp"; else INTERP="interp"; fi
 
 for ac_prog in gawk mawk nawk awk
 do
@@ -23774,8 +23793,8 @@
   test -n "$AWK" && break
 done
 
-echo "$as_me:$LINENO: checking whether we can compile gcc3x-cointerp.c" >&5
-echo $ECHO_N "checking whether we can compile gcc3x-cointerp.c... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking whether we can compile gcc3x-$INTERP" >&5
+echo $ECHO_N "checking whether we can compile gcc3x-$INTERP... $ECHO_C" >&6
 if test "$GCC" = "yes"; then
   INTERP="gcc3x-$INTERP"; echo "$as_me:$LINENO: result: yes" >&5
 echo "${ECHO_T}yes" >&6
@@ -27507,7 +27526,6 @@
 plibs=""
 rm -f FloatMathPlugin.sub FloatMathPlugin.lib
 libm_cflags="-O"
-echo 'FloatMathPlugin/acinclude.m4:$host_cpu='$host_cpu
 
 if test "$GCC" = yes; then
   case $host_cpu in
@@ -29065,6 +29083,7 @@
 s, at ECHO_N@,$ECHO_N,;t t
 s, at ECHO_T@,$ECHO_T,;t t
 s, at LIBS@,$LIBS,;t t
+s, at cogit@,$cogit,;t t
 s, at topdir@,$topdir,;t t
 s, at cfgdir@,$cfgdir,;t t
 s, at vmmdir@,$vmmdir,;t t

Modified: branches/Cog/platforms/unix/config/configure.ac
===================================================================
--- branches/Cog/platforms/unix/config/configure.ac	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/platforms/unix/config/configure.ac	2011-06-17 20:17:36 UTC (rev 2431)
@@ -60,6 +60,20 @@
 [ vmmcfg="${with-vmmcfg}"],
 [ vmmcfg="${blddir}"])
 
+# Compiling a Cogit VM or not?  If so, need a cogit$o, cointerp, etc.
+
+AC_ARG_ENABLE(cogit,
+[  --enable-cogit            compile a cogit VM [default=yes]],
+cogit="no", cogit="yes")
+AC_SUBST(cogit)
+
+#AC_ARG_ENABLE(jit,
+#[  --enable-jit            enable J4 support [default=no]],
+#JIT="yes", JIT="no")
+#
+#test $JIT = "yes" && J_CFLAGS="-DJ_ENABLED"
+#AC_SUBST(J_CFLAGS)
+
 # Check the generated src dir looks sane
 
 AC_CHECK_VMM_DIR
@@ -242,13 +256,6 @@
 AC_FUNC_MMAP
 AC_FUNC_ALLOCA
 
-#AC_ARG_ENABLE(jit,
-#[  --enable-jit            enable J4 support [default=no]],
-#JIT="yes", JIT="no")
-#
-#test $JIT = "yes" && J_CFLAGS="-DJ_ENABLED"
-#AC_SUBST(J_CFLAGS)
-
 # Checks for platform characteristics.
 
 AC_GNU_OPT

Modified: branches/Cog/platforms/unix/config/mkconfig.in
===================================================================
--- branches/Cog/platforms/unix/config/mkconfig.in	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/platforms/unix/config/mkconfig.in	2011-06-17 20:17:36 UTC (rev 2431)
@@ -27,6 +27,7 @@
 ext_dirs="@vmmdir@/plugins ${platforms}/Cross/plugins ${plg_conf}"
 
 cat > config.sh <<EOF
+cogit="@cogit@"
 srcdir="@vmmdir@"
 blddir="@blddir@"
 topdir="@topdir@"

Modified: branches/Cog/platforms/unix/config/mkmf
===================================================================
--- branches/Cog/platforms/unix/config/mkmf	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/platforms/unix/config/mkmf	2011-06-17 20:17:36 UTC (rev 2431)
@@ -145,7 +145,11 @@
     sed -f ${name}.sub < ${makefile_in} > makefile.sub
     makefile_in="makefile.sub"
   fi
-  sed "s%\[make_inc\]%%g
+if [ "$cogit" = "no" ]; then
+  sed "s/\[COBJS_OR_IOBJS\]/\$(IOBJS)/" <${makefile_in}
+else
+  sed "s/\[COBJS_OR_IOBJS\]/\$(COBJS)/" <${makefile_in}
+fi | sed "s%\[make_inc\]%%g
 s%\[target\]%${name}"'$a'"%g
 s%\[targets\]%${targets}%g
 s%\[includes\]%${includes}%g
@@ -157,7 +161,7 @@
 s%\[make_plg\]%%g
 s%\[plibs\]%${plibs}%g
 /\[make_targets\]/r ${make_targets}
-s%\[make_targets\]%%g" < ${makefile_in} > ${name}/Makefile
+s%\[make_targets\]%%g" > ${name}/Makefile
   /bin/rm -f ${make_targets} makefile.in makefile.sub
 }
 

Modified: branches/Cog/platforms/unix/plugins/SerialPlugin/sqUnixSerial.c
===================================================================
--- branches/Cog/platforms/unix/plugins/SerialPlugin/sqUnixSerial.c	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/platforms/unix/plugins/SerialPlugin/sqUnixSerial.c	2011-06-17 20:17:36 UTC (rev 2431)
@@ -1,35 +1,33 @@
 /* sqUnixSerial.c -- Unix serial support
  * 
- * Author: Ned Konz, July 14, 2000
- * 
- * Last edited: 2002-10-26 14:36:11 by piumarta on emilia.inria.fr
- *
- * Separated from MIDI, plus various portability problems fixed, by:
- *	Ian Piumarta <Ian.Piumarta at INRIA.Fr>
+ * Last edited: 2011-03-14 14:01:56 by piumarta on emilia.ipe.media.kyoto-u.ac.jp
  */
 
 #include "sq.h"
 #include "SerialPlugin.h"
 
-#include <termios.h>
+#include <stdlib.h>
+#include <stdio.h>
 #include <unistd.h>
+#include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <termios.h>
 #include <errno.h>
 
 /*** Module variables ***/
 
-/* portNum	0=/dev/ttyS0, etc. */
-/* include 1 byte for NUL at end */
-#define PORT_NAME_SIZE 11
-static const char serialPortBaseName[] = "/dev/ttyS0";
+#define PORT_NAME_SIZE 64
 
+static const char serialPortBaseName[]		= "/dev/tty";
+static const char serialPortBaseNameDefault[]	= "/dev/ttyS0";
+
 /* stopBits	0=1.5, 1=1, 2=2 */
 /* I don't know how to get 1.5 stop bits. Oh well. So you get 2 instead */
 #define MAX_STOP_BITS 2
 /* c_cflag definitions */
-static const unsigned int stopBitsDecode[MAX_STOP_BITS+1] = { CSTOPB, 0, CSTOPB };
+static const unsigned int stopBitsDecode[MAX_STOP_BITS + 1] = { CSTOPB, 0, CSTOPB };
 
 /* dataBits	number of bits per character (5..8) */
 /* note that since CS5 is 0, you will get 5 data bits if you ask for 0..4
@@ -44,63 +42,72 @@
 #define MAX_PARITY_TYPE 2
 /* c_cflag definitions */
 static const unsigned int parityTypeDecode[MAX_PARITY_TYPE+1] = {
-	0,				/* none */
-	PARENB|PARODD,	/* odd */
-	PARENB			/* even */
+  0,			/* none */
+  PARENB | PARODD,	/* odd */
+  PARENB		/* even */
 };
 
 /* inFlowCtrl	0=none, 1=XOn/XOff, 2=hardware handshaking
  * outFlowCtrl	0=none, 1=XOn/XOff, 2=hardware handshaking */
 #define MAX_FLOW_CTRL 2
 
+typedef struct _serial_port_type
+{
+  char spName[PORT_NAME_SIZE];
+  int spDescriptor;
+  struct termios spTermios;
+} serial_port_type;
+
 /* must be <= 10, because of 1-digit filename generation */
-#define MAX_SERIAL_PORTS 10
-static int serialFileDescriptors[MAX_SERIAL_PORTS];	/* index=squeak port# */
-static struct termios savedSerialTermios[MAX_SERIAL_PORTS];	/* index=squeak port# */
+#define MAX_SERIAL_PORTS 32
+static int sp_count= 0;
+static serial_port_type previousSerialFiles[MAX_SERIAL_PORTS];	/* index=squeak port# */
 
 /* dataRate	rate in bps */
 typedef struct drDecode { int dataRate; speed_t code; } drDecode;
 static drDecode dataRateDecode[] = {
-	{ 0, B0 },		/* hang up */
-	{ 50, B50 },
-	{ 75, B75 },
-	{ 110, B110 },
-	{ 134, B134 },
-	{ 150, B150 },
-	{ 200, B200 },
-	{ 300, B300 },
-	{ 600, B600 },
-	{ 1200, B1200 },
-	{ 1800, B1800 },
-	{ 2400, B2400 },
-	{ 4800, B4800 },
-	{ 9600, B9600 },
-	{ 19200, B19200 },
-	{ 38400, B38400 },
-#       if defined(B57600)	/* missing on SunOS 4 */ 
-	{ 57600, B57600 },
-	{ 115200, B115200 },
-#       endif
-#       if defined(B230400)	/* missing on Digital Unix (ex DEC OSF/1) */
-	{ 230400, B230400 },
-#       endif
-#       if defined(B460800)	/* missing on FreeBSD */
-	{ 460800, B460800 },
-#       endif
-#       if defined(B500000)	/* missing on GNU/Linux prior to 2.2 */
-	{ 500000, B500000 },
-	{ 576000, B576000 },
-	{ 921600, B921600 },
-	{ 1000000, B1000000 },
-	{ 1152000, B1152000 },
-	{ 1500000, B1500000 },
-	{ 2000000, B2000000 },
-	{ 2500000, B2500000 },
-	{ 3000000, B3000000 },
-	{ 3500000, B3500000 },
-	{ 4000000, B4000000 },
-#       endif
-	{ -1, B0 }			/* end marker */
+  { 0, B0 },			/* hang up */
+  { 50, B50 },
+  { 75, B75 },
+  { 110, B110 },
+  { 134, B134 },
+  { 150, B150 },
+  { 200, B200 },
+  { 300, B300 },
+  { 600, B600 },
+  { 1200, B1200 },
+  { 1800, B1800 },
+  { 2400, B2400 },
+  { 4800, B4800 },
+  { 9600, B9600 },
+  { 19200, B19200 },
+  { 38400, B38400 },
+#if defined(B57600)		/* missing on SunOS 4 */ 
+  { 57600, B57600 },
+  { 115200, B115200 },
+#endif
+#if defined(B230400)		/* missing on Digital Unix (ex DEC OSF/1) */
+  { 230400, B230400 },
+#endif
+#if defined(B460800)		/* missing on FreeBSD */
+  { 460800, B460800 },
+#endif
+#if defined(B500000)		/* missing on GNU/Linux prior to 2.2 */
+  { 500000, B500000 },
+  { 576000, B576000 },
+  { 921600, B921600 },
+  { 1000000, B1000000 },
+  { 1152000, B1152000 },
+  { 1500000, B1500000 },
+  { 2000000, B2000000 },
+#endif
+#if defined(B2500000)		/* missing on GNU/Linux Sparc64 */
+  { 2500000, B2500000 },
+  { 3000000, B3000000 },
+  { 3500000, B3500000 },
+  { 4000000, B4000000 },
+#endif
+  { -1, B0 }			/* end marker */
 };
 
 /* This is the default setting for a termios structure on open */
@@ -112,243 +119,372 @@
  * or B0 if not found */
 static speed_t serialDecodeSpeed(int speed)
 {
-	drDecode* p;
-	for( p = dataRateDecode; p->dataRate >= 0; p++)
-	{
-		if (p->dataRate == speed)
-			return p->code;
-	}
-	return B0;
+  drDecode *p;
+  for (p= dataRateDecode;  p->dataRate >= 0;  p++)
+    {
+      if (p->dataRate == speed)
+	return p->code;
+    }
+  return B0;
 }
 
+/* Compare entries in previousSerialFiles. */
+
+int serial_port_cmp(const serial_port_type *sp1, const serial_port_type *sp2)
+{
+  return strcmp(sp1->spName, sp2->spName);
+}
+
+/* Return a previously-opened serial port by name, or NULL if the serial port was not found. */
+
+serial_port_type *find_stored_serialport (const char *serialPortName)
+{
+  serial_port_type target, *result;
+  strcpy((&target)->spName, serialPortName);
+  result= bsearch(&target, &previousSerialFiles, sp_count, sizeof (serial_port_type), (int(*)(const void *, const void *))serial_port_cmp);
+  return result;
+}
+
+/* generate a serial port filename (with last digit set to port number).
+ * If the port number is greater than 9, the portnumber is defaulted to 0. */
+
+void make_portname_from_portnum(char *serialPortName, const int portNum)
+{
+  strcpy(serialPortName, serialPortBaseNameDefault);
+  if (portNum <= 9) serialPortName[strlen(serialPortName) - 1]= '0' + portNum;
+}
+
 /*** Public Functions ***/
 
 /* return value ignored */
 int serialPortClose(int portNum)
 {
-	int fd;
-	if (portNum < 0 || portNum >= MAX_SERIAL_PORTS )
-	{
-		success(false);
-		return 0;
-	}
-	/* Squeak wants to close already-closed ports... */
-	if ((fd = serialFileDescriptors[ portNum ]) < 0)
-	{
-		success(true);
-		return 0;
-	}
-	serialFileDescriptors[ portNum ] = -1;
-	if (tcsetattr(fd, TCSAFLUSH, savedSerialTermios + portNum)
-		|| close(fd))
-	{
-		success(false);
-		return 0;
-	}
-	success(true);
-	return 0;
+  char serialPortName[PORT_NAME_SIZE];
+
+  if (portNum < 0 || portNum >= MAX_SERIAL_PORTS)
+    {
+      success(false);
+      return 0;
+    }
+	
+  make_portname_from_portnum(serialPortName, portNum);
+        
+  return serialPortCloseByName(serialPortName);
 }
 
-/* Open the given serial port using the given settings. The data rate can be
- * any number that is in the table above; the driver is not as flexible
- * about the speed as the Mac driver, apparently. */
-/* return value ignored */
-int serialPortOpen(
-		int portNum,
-		int dataRate,
-		int stopBitsType,
-		int parityType,
-		int dataBits,
-		int inFlowCtrl,
-		int outFlowCtrl,
-		int xOnChar,
-		int xOffChar)
+int serialPortCloseByName(const char *portName)
 {
-	int fd;
-	char serialPortName[ PORT_NAME_SIZE ];
-	speed_t speed = serialDecodeSpeed( dataRate );
-	struct termios flags;
+  serial_port_type * sp= find_stored_serialport(portName);
+	
+  /* Squeak wants to close inexistant or already-closed ports... */
+  if (sp == NULL || sp->spDescriptor < 0)
+    {
+      success(true);
+      return 0;
+    }
+	
+  if (tcsetattr(sp->spDescriptor, TCSAFLUSH, &sp->spTermios))
+    {
+      fprintf(stderr, "Error while unsetting the com port parameter (errno:%d)\n", errno);
+      success(false);
+      return -1;
+    }
 
-	/* validate arguments */
-	if (portNum < 0 || portNum >= MAX_SERIAL_PORTS
-		|| speed == B0
-		|| stopBitsType < 0 || stopBitsType > MAX_STOP_BITS
-		|| parityType < 0 || parityType > MAX_PARITY_TYPE
-		|| dataBits < 0 || dataBits > MAX_DATA_BITS
-		|| inFlowCtrl < 0 || inFlowCtrl > MAX_FLOW_CTRL
-		|| outFlowCtrl < 0 || outFlowCtrl > MAX_FLOW_CTRL
-		|| (( inFlowCtrl == 1 || outFlowCtrl == 1 )
-				&& ( xOnChar < 0 || xOnChar > 255
-					|| xOffChar < 0 || xOffChar > 255 )))
-	{
-		success(false);
-		return 0;
-	}
+  if (close(sp->spDescriptor))
+    {
+      fprintf(stderr, "Error while closing the com port (errno:%d)\n", errno);
+      success(false);
+      return -1;
+    }
 
-	/* generate a filename (with last digit set to port number) */
-	strcpy(serialPortName, serialPortBaseName);
-	serialPortName[ PORT_NAME_SIZE - 2 ] = portNum + '0';
+  /* Invalidate descriptor but leave name entry. If file will be reopened
+   * the same entry will be used. */
+  sp->spDescriptor= -1;
 
-	/* open the device */
-	if ((fd = open(serialPortName, O_RDWR|O_NONBLOCK|O_NOCTTY)) < 0)
+  success(true);
+  return 0;
+}
+
+/* Open the given serial port using the given port number.
+ * "/dev/ttySxx" port name are assumed. */
+int serialPortOpen(int portNum, int dataRate, int stopBitsType, int parityType, int dataBits,
+		   int inFlowCtrl, int outFlowCtrl, int xOnChar, int xOffChar)
+{	
+  char serialPortName[PORT_NAME_SIZE];
+  make_portname_from_portnum(serialPortName, portNum);
+      
+  return serialPortOpenByName(serialPortName, dataRate, stopBitsType, parityType, dataBits,
+			      inFlowCtrl, outFlowCtrl, xOnChar, xOffChar);
+}
+
+/* If anything goes wrong during opening make sure the file descriptor
+ * is closed again, if it was opened already. */
+static int portOpenFailed(serial_port_type *sp)
+{
+  if (sp && 0 <= sp->spDescriptor)
+    {
+      if (close(sp->spDescriptor))
 	{
-		success(false);
-		return 0;
+	  fprintf(stderr, "Error while closing the com port (errno:%d)\n", errno);
 	}
-	/* save the file descriptor */
-	serialFileDescriptors[ portNum ] = fd;
+      sp->spDescriptor= -1;
+    }
 
-	/* save the old state */
-	if (tcgetattr(fd, savedSerialTermios + portNum))
+  success(false);
+  return -1;
+}
+
+/* Open the given serial port using the given node as serial port. The
+ * data rate can be any number that is in the table above; the driver
+ * is not as flexible about the speed as the Mac driver, apparently.
+ * If the port is already open, it does nothing. */
+
+int serialPortOpenByName(char *portName, int dataRate, int stopBitsType, int parityType, int dataBits,
+			 int inFlowCtrl, int outFlowCtrl, int xOnChar, int xOffChar)
+{
+  int newPort= false;
+  serial_port_type *sp= find_stored_serialport(portName);
+  if (!sp)
+    {
+      if (sp_count >= MAX_SERIAL_PORTS)
 	{
-		success(false);
-		return 0;
+	  fprintf( stderr, "Error: maximum serial ports (%d) used.", MAX_SERIAL_PORTS);
+	  success( false);
+	  return -1;
 	}
+      sp= &previousSerialFiles[sp_count];
+      /* save the serial port name */
+      strcpy(sp->spName, portName);
+      newPort= true;
+    }
+  else if (sp->spDescriptor >= 0)
+    {
+      return 0;
+    }
 
-	/* set up the new modes */
-	flags = defaultTermios;
+  {
+    speed_t speed= serialDecodeSpeed(dataRate);
+    struct termios flags;
 
-	/* input & output data rate */
-	cfsetispeed(&flags, speed);
-	cfsetospeed(&flags, speed);
+    /* validate arguments */
+    if (speed == B0
+	|| stopBitsType < 0 || stopBitsType > MAX_STOP_BITS
+	|| parityType < 0 || parityType > MAX_PARITY_TYPE
+	|| dataBits < 0 || dataBits > MAX_DATA_BITS
+	|| inFlowCtrl < 0 || inFlowCtrl > MAX_FLOW_CTRL
+	|| outFlowCtrl < 0 || outFlowCtrl > MAX_FLOW_CTRL
+	|| (( inFlowCtrl == 1 || outFlowCtrl == 1 )
+	    && ( xOnChar < 0 || xOnChar > 255
+		 || xOffChar < 0 || xOffChar > 255 )))
+      {
+	fprintf(stderr, "Incorrect serial port parameters.\n");
+	return portOpenFailed(sp);
+      }
 
-	/* stop bits */
-	flags.c_cflag &= ~CSTOPB;
-	flags.c_cflag |= stopBitsDecode[ stopBitsType ];
+    /* open the device and save the file descriptor */
+    if ((sp->spDescriptor= open(portName, O_RDWR|O_NONBLOCK|O_NOCTTY)) < 0)
+      {
+	fprintf(stderr, "Error while opening the serial port (%s).\n", portName);
+	return portOpenFailed(sp);
+      }
 
-	/* parity */
-	flags.c_cflag &= ~(PARENB|PARODD);
-	flags.c_cflag |= parityTypeDecode[ parityType ];
+    /* save the old state */
+    if (tcgetattr(sp->spDescriptor, &sp->spTermios))
+      {
+	fprintf(stderr, "Error while saving old state.\n");
+	return portOpenFailed(sp);
+      }
 
-	/* data bits */
-	flags.c_cflag &= ~CSIZE;
-	flags.c_cflag |= dataBitsDecode[ dataBits ];
+    /* set up the new modes */
+    flags= defaultTermios;
 
-	/* flow control characters */
-	if (inFlowCtrl == 1 || outFlowCtrl == 1)
-	{
-		flags.c_cc[ VSTART ] = xOnChar;
-		flags.c_cc[ VSTOP ] = xOffChar;
-	}
+    /* input & output data rate */
+    cfsetispeed(&flags, speed);
+    cfsetospeed(&flags, speed);
 
-	flags.c_iflag &= ~(IXON|IXOFF|IXANY);
+    /* stop bits */
+    flags.c_cflag &= ~CSTOPB;
+    flags.c_cflag |= stopBitsDecode[ stopBitsType ];
 
-	if (inFlowCtrl == 1) flags.c_iflag |= IXOFF;
-	if (outFlowCtrl == 1) flags.c_iflag |= IXON;
+    /* parity */
+    flags.c_cflag &= ~(PARENB|PARODD);
+    flags.c_cflag |= parityTypeDecode[ parityType ];
 
-#	if defined(CRTSCTS)
-	flags.c_cflag &= ~CRTSCTS;
- 	if (inFlowCtrl == 2 || outFlowCtrl == 2) flags.c_cflag |= CRTSCTS;
-#	else   /* not defined in IRIX!? */
-	if (inFlowCtrl == 2 || outFlowCtrl == 2)
-	{
-		fprintf(stderr, "CRTSCTS not supported.\n");
-		success(false);
-		return 0;
-	}
-#	endif
+    /* data bits */
+    flags.c_cflag &= ~CSIZE;
+    flags.c_cflag |= dataBitsDecode[ dataBits ];
 
-	if (tcsetattr(fd, TCSANOW, &flags))	/* set it NOW */
-	{
-		success(false);
-		return 0;
-	}
+    /* flow control characters */
+    if (inFlowCtrl == 1 || outFlowCtrl == 1)
+      {
+	flags.c_cc[VSTART] = xOnChar;
+	flags.c_cc[VSTOP]  = xOffChar;
+      }
 
-	success(true);
-	return 0;
+    flags.c_iflag &= ~(IXON|IXOFF|IXANY);
+
+    if (inFlowCtrl  == 1) flags.c_iflag |= IXOFF;
+    if (outFlowCtrl == 1) flags.c_iflag |= IXON;
+
+#  if defined(CRTSCTS)
+    flags.c_cflag &= ~CRTSCTS;
+    if (inFlowCtrl == 2 || outFlowCtrl == 2) flags.c_cflag |= CRTSCTS;
+#  else   /* not defined in IRIX!? */
+    if (inFlowCtrl == 2 || outFlowCtrl == 2)
+      {
+	fprintf(stderr, "CRTSCTS not supported.\n");
+	return portOpenFailed(sp);
+      }
+#  endif
+
+    if (tcsetattr(sp->spDescriptor, TCSANOW, &flags))	/* set it NOW */
+      {
+	fprintf(stderr, "Error while setting terminal attributes.\n");
+	return portOpenFailed(sp);
+      }
+
+    if (newPort)
+      {
+	++sp_count;
+      }
+
+    /* sorts the table of serial port, to ensure a reliable later retrieval. */
+    qsort(previousSerialFiles, sp_count, sizeof (serial_port_type), (int(*)(const void *, const void *))serial_port_cmp);
+  }
+
+  success(true);
+  return 0;
 }
 
-/* Read up to count bytes from the given serial port into the given byte array.
-   Read only up to the number of bytes in the port's input buffer; if fewer bytes
-   than count have been received, do not wait for additional data to arrive.
-   Return zero if no data is available, else number of bytes read */
-int serialPortReadInto(int portNum, int count, int startPtr)
+/* Read up to count bytes from the given serial port into the given
+   byte array.  Read only up to the number of bytes in the port's
+   input buffer; if fewer bytes than count have been received, do not
+   wait for additional data to arrive.  Return zero if no data is
+   available, else number of bytes read */
+
+int serialPortReadInto(int portNum, int count, void *startPtr)
 {
-	int fd;
-	ssize_t bytesRead;
-	void* buffer = (void*)startPtr;		/* ints as pointers?? */
+  char serialPortName[PORT_NAME_SIZE];
+	
+  if ((portNum < 0) || (portNum >= MAX_SERIAL_PORTS))
+    {
+      success(false);
+      return 0;
+    }
+	
+  make_portname_from_portnum(serialPortName, portNum);
+        
+  return serialPortReadIntoByName(serialPortName, count, startPtr);
+}
 
-	if (portNum < 0
-		|| portNum >= MAX_SERIAL_PORTS
-		|| (fd = serialFileDescriptors[ portNum ]) < 0)
-	{
-		success(false);
-		return 0;
-	}
+int serialPortReadIntoByName(const char *portName, int count, void *startPtr)
+{
+  serial_port_type *sp= find_stored_serialport(portName);
+  ssize_t bytesRead;
 
-	bytesRead = read(fd, buffer, (size_t)count);
-	if (bytesRead == (ssize_t)-1)
+  /* If the serialport doesn't exist or if it is already closed. */
+  if ((sp == NULL) || (sp->spDescriptor < 0))
+    {
+      fprintf(stderr, "Error while reading: serial port is not open.\n");
+      success(false);
+      return 0;
+    }
+
+  bytesRead= read(sp->spDescriptor, startPtr, (size_t)count);
+
+  if ((ssize_t)-1 == bytesRead)
+    {
+      if (EAGAIN == errno)
+	bytesRead= 0;
+      else
 	{
-		if (errno == EAGAIN)
-			bytesRead = 0;
-		else
-		{
-			success(false);
-			return 0;
-		}
+	  success(false);
+	  return 0;
 	}
+    }
 
-	success(true);
-	return (int)bytesRead;
+  success(true);
+  return (int)bytesRead;
 }
 
-/* Write count bytes from the given byte array to the given serial port's
-   output buffer. Return the number of bytes written. This implementation is
-   synchronous: it doesn't return until the data has been sent. However, other
-   implementations may return before transmission is complete. */
-int serialPortWriteFrom(int portNum, int count, int startPtr)
+/* Write count bytes from the given byte array to the given serial
+   port's output buffer. Return the number of bytes written. This
+   implementation is synchronous: it doesn't return until the data has
+   been sent. However, other implementations may return before
+   transmission is complete. */
+
+int serialPortWriteFrom(int portNum, int count, void *startPtr)
 {
-	int fd;
-	int bytesWritten;
-	char* buffer = (void*)startPtr;
+  char serialPortName[PORT_NAME_SIZE];
+	
+  if ((portNum < 0) || (portNum >= MAX_SERIAL_PORTS))
+    {
+      success(false);
+      return 0;
+    }
+	
+  make_portname_from_portnum(serialPortName, portNum);
+        
+  return serialPortWriteFromByName(serialPortName, count, startPtr);
+}
 
-	if (portNum < 0
-		|| portNum >= MAX_SERIAL_PORTS
-		|| (fd = serialFileDescriptors[ portNum ]) < 0)
-	{
-		success(false);
-		return 0;
-	}
+int serialPortWriteFromByName(const char *portName, int count, void *startPtr)
+{
+  serial_port_type *sp= find_stored_serialport(portName);
+  int bytesWritten;
 
-	bytesWritten = write(fd, buffer, (size_t)count);
-	if (bytesWritten == (ssize_t)-1)
-	{
-		success(false);
-		return 0;
-	}
+  /* If the serialport doesn't exist or if it is already closed. */
+  if ((sp == NULL) || (sp->spDescriptor < 0))
+    {
+      fprintf(stderr, "Error while writing: serial port is not open.\n");
+      success(false);
+      return 0;
+    }
 
-	success(true);
-	return bytesWritten;
+  bytesWritten= write(sp->spDescriptor, startPtr, (size_t)count);
+        
+  if ((ssize_t)-1 == bytesWritten)
+    {
+      success(false);
+      return 0;
+    }
+
+  success(true);
+  return bytesWritten;
 }
 
 /* return true on success */
+
 int serialPortInit(void)
 {
-	int i;
+  int i;
 
-	/* initialize the file descriptors to invalid */
-	for (i = 0; i < MAX_SERIAL_PORTS; i++)
-		serialFileDescriptors[ i ] = -1;
+  /* initialize the file descriptors to invalid */
+  for (i= 0;  i < MAX_SERIAL_PORTS;  i++)
+    {
+      previousSerialFiles[i].spDescriptor= -1;
+    }
 
-	/* initialize our default termios structure (already 0'd) */
-	defaultTermios.c_iflag = IGNBRK | IGNPAR;	/* ignore break, parity/framing errs */
-	/* tcflag_t c_oflag output modes */
-	/* defaultTermios.c_oflag = 0; */
-	/* tcflag_t c_cflag control modes */
-	defaultTermios.c_cflag = CREAD;
-	/* tcflag_t c_lflag local modes */
-	/* defaultTermios.c_lflag = 0; */
-	/* cc_t c_cc[NCCS] control chars */
-	defaultTermios.c_cc[VTIME] = 0;
-	defaultTermios.c_cc[VMIN] = 0;
+  /* initialize our default termios structure (already 0'd) */
+  defaultTermios.c_iflag= IGNBRK | IGNPAR;	/* ignore break, parity/framing errs */
+  /* tcflag_t c_oflag output modes */
+  /* defaultTermios.c_oflag= 0; */
+  /* tcflag_t c_cflag control modes */
+  defaultTermios.c_cflag= CREAD;
+  /* tcflag_t c_lflag local modes */
+  /* defaultTermios.c_lflag= 0; */
+  /* cc_t c_cc[NCCS] control chars */
+  defaultTermios.c_cc[VTIME]= 0;
+  defaultTermios.c_cc[VMIN ]= 0;
 
-	success(true);
-	return 1;
+  success(true);
+  return 1;
 }
 
 /* return true on success */
+
 int serialPortShutdown(void)
 {
-	success(true);
-	return 1;
+  success(true);
+  return 1;
 }

Modified: branches/Cog/platforms/unix/vm/Makefile.in
===================================================================
--- branches/Cog/platforms/unix/vm/Makefile.in	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/platforms/unix/vm/Makefile.in	2011-06-17 20:17:36 UTC (rev 2431)
@@ -41,11 +41,18 @@
 [make_plg]
 
 TARGET		= vm$a
-OBJS		= $(INTERP)$o cogit$o sqNamedPrims$o sqVirtualMachine$o sqHeapMap$o\
+COBJS		= $(INTERP)$o cogit$o sqNamedPrims$o sqVirtualMachine$o sqHeapMap$o\
 			sqExternalSemaphores$o sqTicker$o aio$o debug$o osExports$o \
 			sqUnixExternalPrims$o sqUnixMemory$o sqUnixCharConv$o sqUnixMain$o \
 			sqUnixVMProfile$o sqUnixHeartbeat$o sqUnixThreads$o
 
+IOBJS		= $(INTERP)$o sqNamedPrims$o sqVirtualMachine$o sqHeapMap$o\
+			sqExternalSemaphores$o sqTicker$o aio$o debug$o osExports$o \
+			sqUnixExternalPrims$o sqUnixMemory$o sqUnixCharConv$o sqUnixMain$o \
+			sqUnixVMProfile$o sqUnixThreads$o
+
+OBJS		= [COBJS_OR_IOBJS] # see mkmf
+
 XINCLUDES	= [includes] \
 		  -I$(topdir)/platforms/Cross/plugins/FilePlugin \
 		  -I$(topdir)/platforms/unix/plugins/B3DAcceleratorPlugin \

Modified: branches/Cog/platforms/unix/vm/sqUnixMain.c
===================================================================
--- branches/Cog/platforms/unix/vm/sqUnixMain.c	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/platforms/unix/vm/sqUnixMain.c	2011-06-17 20:17:36 UTC (rev 2431)
@@ -173,7 +173,7 @@
 #      else
 	sa.sa_flags= 0;	/* assume we already have BSD behaviour */
 #      endif
-#      if defined(__linux__) && !defined(__ia64) &7 !defined(__alpha__)
+#      if defined(__linux__) && !defined(__ia64) && !defined(__alpha__)
 	sa.sa_restorer= 0;
 #      endif
 	sigaction(SIGALRM, &sa, 0);
@@ -198,23 +198,6 @@
 sqInt ioMSecs(void)
 {
   struct timeval now;
-  unsigned int nowMSecs;
-
-#if 1 /* HAVE_HIGHRES_COUNTER */
-
-  /* if we have a cheap, high-res counter use that to limit
-     the frequency of calls to gettimeofday to something reasonable. */
-  static unsigned int baseMSecs = 0;      /* msecs when we took base tick */
-  static sqLong baseTicks = 0;/* base tick for adjustment */
-  static sqLong tickDelta = 0;/* ticks / msec */
-  static sqLong nextTick = 0; /* next tick to check gettimeofday */
-
-  sqLong thisTick = ioHighResClock();
-
-  if(thisTick < nextTick) return lowResMSecs;
-
-#endif
-
   gettimeofday(&now, 0);
   if ((now.tv_usec-= startUpTime.tv_usec) < 0)
     {
@@ -222,32 +205,7 @@
       now.tv_sec-= 1;
     }
   now.tv_sec-= startUpTime.tv_sec;
-  nowMSecs = (now.tv_usec / 1000 + now.tv_sec * 1000);
-
-#if 1 /* HAVE_HIGHRES_COUNTER */
-  {
-    unsigned int msecsDelta;
-    /* Adjust our rdtsc rate every 10...100 msecs as needed.
-       This also covers msecs clock-wraparound. */
-    msecsDelta = nowMSecs - baseMSecs;
-    if(msecsDelta < 0 || msecsDelta > 100) {
-      /* Either we've hit a clock-wraparound or we are being
-	 sampled in intervals larger than 100msecs.
-	 Don't try any fancy adjustments */
-      baseMSecs = nowMSecs;
-      baseTicks = thisTick;
-      nextTick = 0;
-      tickDelta = 0;
-    } else if(msecsDelta >= 10) {
-      /* limit the rate of adjustments to 10msecs */
-      baseMSecs = nowMSecs;
-      tickDelta = (thisTick - baseTicks) / msecsDelta;
-      nextTick = baseTicks = thisTick;
-    }
-    nextTick += tickDelta;
-  }
-#endif
-  return lowResMSecs= nowMSecs;
+  return lowResMSecs= (now.tv_usec / 1000 + now.tv_sec * 1000);
 }
 
 sqInt ioMicroMSecs(void)
@@ -263,6 +221,34 @@
 {
   return convertToSqueakTime(time(0));
 }
+
+#define SecondsFrom1901To1970      2177452800ULL
+#define MicrosecondsFrom1901To1970 2177452800000000ULL
+
+#define MicrosecondsPerSecond 1000000ULL
+#define MillisecondsPerSecond 1000ULL
+
+#define MicrosecondsPerMillisecond 1000ULL
+/* Compute the current VM time basis, the number of microseconds from 1901. */
+
+static unsigned long long
+currentUTCMicroseconds()
+{
+	struct timeval utcNow;
+
+	gettimeofday(&utcNow,0);
+	return ((utcNow.tv_sec * MicrosecondsPerSecond) + utcNow.tv_usec)
+			+ MicrosecondsFrom1901To1970;
+}
+
+usqLong
+ioUTCMicroseconds() { return currentUTCMicroseconds(); }
+
+/* This is an expensive interface for use by profiling code that wants the time
+ * now rather than as of the last heartbeat.
+ */
+usqLong
+ioUTCMicrosecondsNow() { return currentUTCMicroseconds(); }
 #endif /* STACKVM */
 
 time_t convertToSqueakTime(time_t unixTime)
@@ -620,6 +606,8 @@
 	return result;
 }
 
+void	ioDrainEventQueue() {}
+
 sqInt ioScreenDepth(void)		 { return dpy->ioScreenDepth(); }
 sqInt ioScreenSize(void)		 { return dpy->ioScreenSize(); }
 

Modified: branches/Cog/processors/IA32/bochs/conf.COG
===================================================================
--- branches/Cog/processors/IA32/bochs/conf.COG	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/processors/IA32/bochs/conf.COG	2011-06-17 20:17:36 UTC (rev 2431)
@@ -3,6 +3,10 @@
 # this sets up the compile for Cog.  Disable as much inessential stuff
 # as possible leaving only the cpu/fpu & memory interface
 
+# build using
+# $ ./conf.COG
+# $ ./makeem
+
 set echo
 # CFLAGS="-pipe -O3 -fomit-frame-pointer -finline-functions -falign-loops=16 -falign-jumps=16 -falign-functions=16 -falign-labels=16 -falign-loops-max-skip=15 -falign-jumps-max-skip=15 -fprefetch-loop-arrays $CFLAGS"
 CFLAGS="-m32 $CFLAGS"

Modified: branches/Cog/scripts/mkvmarchives
===================================================================
--- branches/Cog/scripts/mkvmarchives	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/scripts/mkvmarchives	2011-06-17 20:17:36 UTC (rev 2431)
@@ -77,7 +77,7 @@
 do
 	echo
 	echo checking $vm version
-	strings - $vm | egrep "CoInterp.*VMMaker|Cogit.*VMMaker| built on " | grep -v 'Unix built on "__DATE__ " "__TIME__" Compiler: "__VERSION__'
+	strings - $vm | egrep "Interp.*VMMaker|Cogit.*VMMaker| built on " | grep -v 'Unix built on "__DATE__ " "__TIME__" Compiler: "__VERSION__'
 	echo checking $vm for asserts
 	strings - $vm | grep "assert[^0-9]*[0-9][0-9][0-9]"
 done

Modified: branches/Cog/src/vm/cointerp.c
===================================================================
--- branches/Cog/src/vm/cointerp.c	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/src/vm/cointerp.c	2011-06-17 20:17:36 UTC (rev 2431)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.75 uuid: e1bb08e3-482d-4bfd-a416-d203d9fe4c57
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.78 uuid: 412444c6-36dc-48be-b5cd-a6ebc4ade0bb
    from
-	CoInterpreter VMMaker.oscog-eem.75 uuid: e1bb08e3-482d-4bfd-a416-d203d9fe4c57
+	CoInterpreter VMMaker.oscog-eem.78 uuid: 412444c6-36dc-48be-b5cd-a6ebc4ade0bb
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.75 uuid: e1bb08e3-482d-4bfd-a416-d203d9fe4c57 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.78 uuid: 412444c6-36dc-48be-b5cd-a6ebc4ade0bb " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -1865,7 +1865,7 @@
 	/* 575 */ (void (*)(void))0,
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
-const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.75]";
+const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.78]";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -16968,16 +16968,16 @@
 				}
 			}
 			if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
-				sz3 = (longAt(oop)) & AllButTypeMask;
+				sz2 = (longAt(oop)) & AllButTypeMask;
 			}
 			else {
 				/* begin sizeBitsOf: */
-				header4 = longAt(oop);
-				sz3 = ((header4 & TypeMask) == HeaderTypeSizeAndClass
+				header3 = longAt(oop);
+				sz2 = ((header3 & TypeMask) == HeaderTypeSizeAndClass
 					? (longAt(oop - (BytesPerWord * 2))) & LongSizeMask
-					: header4 & SizeMask);
+					: header3 & SizeMask);
 			}
-			next = (oop + sz3) + (headerTypeBytes[(longAt(oop + sz3)) & TypeMask]);
+			next = (oop + sz2) + (headerTypeBytes[(longAt(oop + sz2)) & TypeMask]);
 			goto l1;
 		}
 		fwdBlock1 = (header2 & AllButMarkBitAndTypeMask) << 1;
@@ -16987,12 +16987,12 @@
 
 		realHeader = longAt(fwdBlock1 + BytesPerWord);
 		if ((realHeader & TypeMask) == HeaderTypeSizeAndClass) {
-			sz2 = (longAt(oop - (BytesPerWord * 2))) & LongSizeMask;
+			sz1 = (longAt(oop - (BytesPerWord * 2))) & LongSizeMask;
 		}
 		else {
-			sz2 = realHeader & SizeMask;
+			sz1 = realHeader & SizeMask;
 		}
-		next = (oop + sz2) + (headerTypeBytes[(longAt(oop + sz2)) & TypeMask]);
+		next = (oop + sz1) + (headerTypeBytes[(longAt(oop + sz1)) & TypeMask]);
 	l1:	/* end objectAfterWhileForwarding: */;
 		if (!(((longAt(oop)) & TypeMask) == HeaderTypeFree)) {
 
@@ -17045,19 +17045,20 @@
 		longAtput(newFreeChunk, (bytesFreed & AllButTypeMask) | HeaderTypeFree);
 	}
 	/* begin safeObjectAfter: */
+	VM_LABEL(0safeObjectAfter);
 	if (((longAt(newFreeChunk)) & TypeMask) == HeaderTypeFree) {
-		sz1 = (longAt(newFreeChunk)) & AllButTypeMask;
+		sz3 = (longAt(newFreeChunk)) & AllButTypeMask;
 	}
 	else {
 		/* begin sizeBitsOf: */
-		header3 = longAt(newFreeChunk);
-		sz1 = ((header3 & TypeMask) == HeaderTypeSizeAndClass
+		header4 = longAt(newFreeChunk);
+		sz3 = ((header4 & TypeMask) == HeaderTypeSizeAndClass
 			? (longAt(newFreeChunk - (BytesPerWord * 2))) & LongSizeMask
-			: header3 & SizeMask);
+			: header4 & SizeMask);
 	}
-	next = ((newFreeChunk + sz1) >= GIV(freeStart)
+	next = ((newFreeChunk + sz3) >= GIV(freeStart)
 		? GIV(freeStart)
-		: (newFreeChunk + sz1) + (headerTypeBytes[(longAt(newFreeChunk + sz1)) & TypeMask]));
+		: (newFreeChunk + sz3) + (headerTypeBytes[(longAt(newFreeChunk + sz3)) & TypeMask]));
 	assert((next == GIV(freeStart))
 	 || (next == (oopFromChunk(GIV(compEnd)))));
 	if (next == GIV(freeStart)) {

Modified: branches/Cog/src/vm/cointerp.h
===================================================================
--- branches/Cog/src/vm/cointerp.h	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/src/vm/cointerp.h	2011-06-17 20:17:36 UTC (rev 2431)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.75 uuid: e1bb08e3-482d-4bfd-a416-d203d9fe4c57
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.78 uuid: 412444c6-36dc-48be-b5cd-a6ebc4ade0bb
  */
 
 

Modified: branches/Cog/src/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/src/vm/gcc3x-cointerp.c	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/src/vm/gcc3x-cointerp.c	2011-06-17 20:17:36 UTC (rev 2431)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.75 uuid: e1bb08e3-482d-4bfd-a416-d203d9fe4c57
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.78 uuid: 412444c6-36dc-48be-b5cd-a6ebc4ade0bb
    from
-	CoInterpreter VMMaker.oscog-eem.75 uuid: e1bb08e3-482d-4bfd-a416-d203d9fe4c57
+	CoInterpreter VMMaker.oscog-eem.78 uuid: 412444c6-36dc-48be-b5cd-a6ebc4ade0bb
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.75 uuid: e1bb08e3-482d-4bfd-a416-d203d9fe4c57 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.78 uuid: 412444c6-36dc-48be-b5cd-a6ebc4ade0bb " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -1868,7 +1868,7 @@
 	/* 575 */ (void (*)(void))0,
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
-const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.75]";
+const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.78]";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -16972,16 +16972,16 @@
 				}
 			}
 			if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
-				sz3 = (longAt(oop)) & AllButTypeMask;
+				sz2 = (longAt(oop)) & AllButTypeMask;
 			}
 			else {
 				/* begin sizeBitsOf: */
-				header4 = longAt(oop);
-				sz3 = ((header4 & TypeMask) == HeaderTypeSizeAndClass
+				header3 = longAt(oop);
+				sz2 = ((header3 & TypeMask) == HeaderTypeSizeAndClass
 					? (longAt(oop - (BytesPerWord * 2))) & LongSizeMask
-					: header4 & SizeMask);
+					: header3 & SizeMask);
 			}
-			next = (oop + sz3) + (headerTypeBytes[(longAt(oop + sz3)) & TypeMask]);
+			next = (oop + sz2) + (headerTypeBytes[(longAt(oop + sz2)) & TypeMask]);
 			goto l1;
 		}
 		fwdBlock1 = (header2 & AllButMarkBitAndTypeMask) << 1;
@@ -16991,12 +16991,12 @@
 
 		realHeader = longAt(fwdBlock1 + BytesPerWord);
 		if ((realHeader & TypeMask) == HeaderTypeSizeAndClass) {
-			sz2 = (longAt(oop - (BytesPerWord * 2))) & LongSizeMask;
+			sz1 = (longAt(oop - (BytesPerWord * 2))) & LongSizeMask;
 		}
 		else {
-			sz2 = realHeader & SizeMask;
+			sz1 = realHeader & SizeMask;
 		}
-		next = (oop + sz2) + (headerTypeBytes[(longAt(oop + sz2)) & TypeMask]);
+		next = (oop + sz1) + (headerTypeBytes[(longAt(oop + sz1)) & TypeMask]);
 	l1:	/* end objectAfterWhileForwarding: */;
 		if (!(((longAt(oop)) & TypeMask) == HeaderTypeFree)) {
 
@@ -17049,19 +17049,20 @@
 		longAtput(newFreeChunk, (bytesFreed & AllButTypeMask) | HeaderTypeFree);
 	}
 	/* begin safeObjectAfter: */
+	VM_LABEL(0safeObjectAfter);
 	if (((longAt(newFreeChunk)) & TypeMask) == HeaderTypeFree) {
-		sz1 = (longAt(newFreeChunk)) & AllButTypeMask;
+		sz3 = (longAt(newFreeChunk)) & AllButTypeMask;
 	}
 	else {
 		/* begin sizeBitsOf: */
-		header3 = longAt(newFreeChunk);
-		sz1 = ((header3 & TypeMask) == HeaderTypeSizeAndClass
+		header4 = longAt(newFreeChunk);
+		sz3 = ((header4 & TypeMask) == HeaderTypeSizeAndClass
 			? (longAt(newFreeChunk - (BytesPerWord * 2))) & LongSizeMask
-			: header3 & SizeMask);
+			: header4 & SizeMask);
 	}
-	next = ((newFreeChunk + sz1) >= GIV(freeStart)
+	next = ((newFreeChunk + sz3) >= GIV(freeStart)
 		? GIV(freeStart)
-		: (newFreeChunk + sz1) + (headerTypeBytes[(longAt(newFreeChunk + sz1)) & TypeMask]));
+		: (newFreeChunk + sz3) + (headerTypeBytes[(longAt(newFreeChunk + sz3)) & TypeMask]));
 	assert((next == GIV(freeStart))
 	 || (next == (oopFromChunk(GIV(compEnd)))));
 	if (next == GIV(freeStart)) {

Modified: branches/Cog/src/vm/interp.h
===================================================================
--- branches/Cog/src/vm/interp.h	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/src/vm/interp.h	2011-06-17 20:17:36 UTC (rev 2431)
@@ -1,12 +1,10 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.70 uuid: 36b63465-1b05-401f-bcb2-f9cae49422b8
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.78 uuid: 412444c6-36dc-48be-b5cd-a6ebc4ade0bb
  */
 
-#define COGVM 1
-#if !defined(COGMTVM)
-#	define COGMTVM 0
-#endif
-#define STACKVM 1
+#define VM_PROXY_MAJOR 1
+#define VM_PROXY_MINOR 12
+
 #define SQ_VI_BYTES_PER_WORD 4
 
 #define PrimErrGenericFailure 1
@@ -25,3 +23,10 @@
 #define PrimErrObjectMayMove 14
 #define PrimErrLimitExceeded 15
 
+#define STACKVM 1
+
+#define COGVM 1
+#if !defined(COGMTVM)
+#	define COGMTVM 0
+#endif
+

Modified: branches/Cog/stacksrc/vm/gcc3x-interp.c
===================================================================
--- branches/Cog/stacksrc/vm/gcc3x-interp.c	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/stacksrc/vm/gcc3x-interp.c	2011-06-17 20:17:36 UTC (rev 2431)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.70 uuid: 36b63465-1b05-401f-bcb2-f9cae49422b8
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.78 uuid: 412444c6-36dc-48be-b5cd-a6ebc4ade0bb
    from
-	StackInterpreter VMMaker.oscog-eem.70 uuid: 36b63465-1b05-401f-bcb2-f9cae49422b8
+	StackInterpreter VMMaker.oscog-eem.78 uuid: 412444c6-36dc-48be-b5cd-a6ebc4ade0bb
  */
-static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.70 uuid: 36b63465-1b05-401f-bcb2-f9cae49422b8 " __DATE__ ;
+static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.78 uuid: 412444c6-36dc-48be-b5cd-a6ebc4ade0bb " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -68,7 +68,7 @@
 #define AllButMarkBitAndTypeMask 0x7FFFFFFC
 #define AllButRootBit 0xBFFFFFFFUL
 #define AllButTypeMask 0xFFFFFFFCUL
-#define AllocationCheckFiller 0x55AA55AA
+#define AllocationCheckFiller 182275669
 #define AtCacheFixedFields 4
 #define AtCacheFmt 3
 #define AtCacheMask 0x1C
@@ -1653,7 +1653,7 @@
  0 };
 char * breakSelector;
 sqInt breakSelectorLength = -1;
-const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreter VMMaker.oscog-eem.70]";
+const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreter VMMaker.oscog-eem.78]";
 volatile int sendTrace;
 sqInt suppressHeartbeatFlag;
 
@@ -13152,16 +13152,16 @@
 				}
 			}
 			if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
-				sz3 = (longAt(oop)) & AllButTypeMask;
+				sz2 = (longAt(oop)) & AllButTypeMask;
 			}
 			else {
 				/* begin sizeBitsOf: */
-				header4 = longAt(oop);
-				sz3 = ((header4 & TypeMask) == HeaderTypeSizeAndClass
+				header3 = longAt(oop);
+				sz2 = ((header3 & TypeMask) == HeaderTypeSizeAndClass
 					? (longAt(oop - (BytesPerWord * 2))) & LongSizeMask
-					: header4 & SizeMask);
+					: header3 & SizeMask);
 			}
-			next = (oop + sz3) + (headerTypeBytes[(longAt(oop + sz3)) & TypeMask]);
+			next = (oop + sz2) + (headerTypeBytes[(longAt(oop + sz2)) & TypeMask]);
 			goto l1;
 		}
 		fwdBlock1 = (header2 & AllButMarkBitAndTypeMask) << 1;
@@ -13171,12 +13171,12 @@
 
 		realHeader = longAt(fwdBlock1 + BytesPerWord);
 		if ((realHeader & TypeMask) == HeaderTypeSizeAndClass) {
-			sz2 = (longAt(oop - (BytesPerWord * 2))) & LongSizeMask;
+			sz1 = (longAt(oop - (BytesPerWord * 2))) & LongSizeMask;
 		}
 		else {
-			sz2 = realHeader & SizeMask;
+			sz1 = realHeader & SizeMask;
 		}
-		next = (oop + sz2) + (headerTypeBytes[(longAt(oop + sz2)) & TypeMask]);
+		next = (oop + sz1) + (headerTypeBytes[(longAt(oop + sz1)) & TypeMask]);
 	l1:	/* end objectAfterWhileForwarding: */;
 		if (!(((longAt(oop)) & TypeMask) == HeaderTypeFree)) {
 
@@ -13229,19 +13229,20 @@
 		longAtput(newFreeChunk, (bytesFreed & AllButTypeMask) | HeaderTypeFree);
 	}
 	/* begin safeObjectAfter: */
+	VM_LABEL(0safeObjectAfter);
 	if (((longAt(newFreeChunk)) & TypeMask) == HeaderTypeFree) {
-		sz1 = (longAt(newFreeChunk)) & AllButTypeMask;
+		sz3 = (longAt(newFreeChunk)) & AllButTypeMask;
 	}
 	else {
 		/* begin sizeBitsOf: */
-		header3 = longAt(newFreeChunk);
-		sz1 = ((header3 & TypeMask) == HeaderTypeSizeAndClass
+		header4 = longAt(newFreeChunk);
+		sz3 = ((header4 & TypeMask) == HeaderTypeSizeAndClass
 			? (longAt(newFreeChunk - (BytesPerWord * 2))) & LongSizeMask
-			: header3 & SizeMask);
+			: header4 & SizeMask);
 	}
-	next = ((newFreeChunk + sz1) >= GIV(freeStart)
+	next = ((newFreeChunk + sz3) >= GIV(freeStart)
 		? GIV(freeStart)
-		: (newFreeChunk + sz1) + (headerTypeBytes[(longAt(newFreeChunk + sz1)) & TypeMask]));
+		: (newFreeChunk + sz3) + (headerTypeBytes[(longAt(newFreeChunk + sz3)) & TypeMask]));
 	assert((next == GIV(freeStart))
 	 || (next == (oopFromChunk(GIV(compEnd)))));
 	if (next == GIV(freeStart)) {
@@ -21884,10 +21885,10 @@
 
 
 /*	receiver, argsArray, then method are on top of stack. Execute method
-	against receiver and args.
+	against receiver and args. Allow for up to two extra arguments (e.g. for
+	mirror primitives).
 	Set primitiveFunctionPointer because no cache lookup has been done for the
-	method, and
-	hence primitiveFunctionPointer is stale. */
+	method, and hence primitiveFunctionPointer is stale. */
 
 static void
 primitiveExecuteMethodArgsArray(void)
@@ -21931,8 +21932,14 @@
 	if (!(argCnt == (fetchWordLengthOf(argumentArray)))) {
 		GIV(primFailCode) = PrimErrBadNumArgs; return;
 	}
+	if (GIV(argumentCount) > 2) {
+		if (GIV(argumentCount) > 4) {
+			GIV(primFailCode) = PrimErrUnsupported; return;
+		}
+		stackValueput(GIV(argumentCount), longAt(GIV(stackPointer) + (2 * BytesPerWord)));
+	}
 	/* begin pop: */
-	GIV(stackPointer) += 2 * BytesPerWord;
+	GIV(stackPointer) += GIV(argumentCount) * BytesPerWord;
 	for (i = 0; i <= (argCnt - 1); i += 1) {
 		/* begin push: */
 		longAtput(sp = GIV(stackPointer) - BytesPerWord, longAt((argumentArray + BaseHeaderSize) + (i << ShiftForWord)));

Modified: branches/Cog/stacksrc/vm/interp.c
===================================================================
--- branches/Cog/stacksrc/vm/interp.c	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/stacksrc/vm/interp.c	2011-06-17 20:17:36 UTC (rev 2431)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.70 uuid: 36b63465-1b05-401f-bcb2-f9cae49422b8
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.78 uuid: 412444c6-36dc-48be-b5cd-a6ebc4ade0bb
    from
-	StackInterpreter VMMaker.oscog-eem.70 uuid: 36b63465-1b05-401f-bcb2-f9cae49422b8
+	StackInterpreter VMMaker.oscog-eem.78 uuid: 412444c6-36dc-48be-b5cd-a6ebc4ade0bb
  */
-static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.70 uuid: 36b63465-1b05-401f-bcb2-f9cae49422b8 " __DATE__ ;
+static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.78 uuid: 412444c6-36dc-48be-b5cd-a6ebc4ade0bb " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -65,7 +65,7 @@
 #define AllButMarkBitAndTypeMask 0x7FFFFFFC
 #define AllButRootBit 0xBFFFFFFFUL
 #define AllButTypeMask 0xFFFFFFFCUL
-#define AllocationCheckFiller 0x55AA55AA
+#define AllocationCheckFiller 182275669
 #define AtCacheFixedFields 4
 #define AtCacheFmt 3
 #define AtCacheMask 0x1C
@@ -1650,7 +1650,7 @@
  0 };
 char * breakSelector;
 sqInt breakSelectorLength = -1;
-const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreter VMMaker.oscog-eem.70]";
+const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreter VMMaker.oscog-eem.78]";
 volatile int sendTrace;
 sqInt suppressHeartbeatFlag;
 
@@ -13148,16 +13148,16 @@
 				}
 			}
 			if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
-				sz3 = (longAt(oop)) & AllButTypeMask;
+				sz2 = (longAt(oop)) & AllButTypeMask;
 			}
 			else {
 				/* begin sizeBitsOf: */
-				header4 = longAt(oop);
-				sz3 = ((header4 & TypeMask) == HeaderTypeSizeAndClass
+				header3 = longAt(oop);
+				sz2 = ((header3 & TypeMask) == HeaderTypeSizeAndClass
 					? (longAt(oop - (BytesPerWord * 2))) & LongSizeMask
-					: header4 & SizeMask);
+					: header3 & SizeMask);
 			}
-			next = (oop + sz3) + (headerTypeBytes[(longAt(oop + sz3)) & TypeMask]);
+			next = (oop + sz2) + (headerTypeBytes[(longAt(oop + sz2)) & TypeMask]);
 			goto l1;
 		}
 		fwdBlock1 = (header2 & AllButMarkBitAndTypeMask) << 1;
@@ -13167,12 +13167,12 @@
 
 		realHeader = longAt(fwdBlock1 + BytesPerWord);
 		if ((realHeader & TypeMask) == HeaderTypeSizeAndClass) {
-			sz2 = (longAt(oop - (BytesPerWord * 2))) & LongSizeMask;
+			sz1 = (longAt(oop - (BytesPerWord * 2))) & LongSizeMask;
 		}
 		else {
-			sz2 = realHeader & SizeMask;
+			sz1 = realHeader & SizeMask;
 		}
-		next = (oop + sz2) + (headerTypeBytes[(longAt(oop + sz2)) & TypeMask]);
+		next = (oop + sz1) + (headerTypeBytes[(longAt(oop + sz1)) & TypeMask]);
 	l1:	/* end objectAfterWhileForwarding: */;
 		if (!(((longAt(oop)) & TypeMask) == HeaderTypeFree)) {
 
@@ -13225,19 +13225,20 @@
 		longAtput(newFreeChunk, (bytesFreed & AllButTypeMask) | HeaderTypeFree);
 	}
 	/* begin safeObjectAfter: */
+	VM_LABEL(0safeObjectAfter);
 	if (((longAt(newFreeChunk)) & TypeMask) == HeaderTypeFree) {
-		sz1 = (longAt(newFreeChunk)) & AllButTypeMask;
+		sz3 = (longAt(newFreeChunk)) & AllButTypeMask;
 	}
 	else {
 		/* begin sizeBitsOf: */
-		header3 = longAt(newFreeChunk);
-		sz1 = ((header3 & TypeMask) == HeaderTypeSizeAndClass
+		header4 = longAt(newFreeChunk);
+		sz3 = ((header4 & TypeMask) == HeaderTypeSizeAndClass
 			? (longAt(newFreeChunk - (BytesPerWord * 2))) & LongSizeMask
-			: header3 & SizeMask);
+			: header4 & SizeMask);
 	}
-	next = ((newFreeChunk + sz1) >= GIV(freeStart)
+	next = ((newFreeChunk + sz3) >= GIV(freeStart)
 		? GIV(freeStart)
-		: (newFreeChunk + sz1) + (headerTypeBytes[(longAt(newFreeChunk + sz1)) & TypeMask]));
+		: (newFreeChunk + sz3) + (headerTypeBytes[(longAt(newFreeChunk + sz3)) & TypeMask]));
 	assert((next == GIV(freeStart))
 	 || (next == (oopFromChunk(GIV(compEnd)))));
 	if (next == GIV(freeStart)) {
@@ -21880,10 +21881,10 @@
 
 
 /*	receiver, argsArray, then method are on top of stack. Execute method
-	against receiver and args.
+	against receiver and args. Allow for up to two extra arguments (e.g. for
+	mirror primitives).
 	Set primitiveFunctionPointer because no cache lookup has been done for the
-	method, and
-	hence primitiveFunctionPointer is stale. */
+	method, and hence primitiveFunctionPointer is stale. */
 
 static void
 primitiveExecuteMethodArgsArray(void)
@@ -21927,8 +21928,14 @@
 	if (!(argCnt == (fetchWordLengthOf(argumentArray)))) {
 		GIV(primFailCode) = PrimErrBadNumArgs; return;
 	}
+	if (GIV(argumentCount) > 2) {
+		if (GIV(argumentCount) > 4) {
+			GIV(primFailCode) = PrimErrUnsupported; return;
+		}
+		stackValueput(GIV(argumentCount), longAt(GIV(stackPointer) + (2 * BytesPerWord)));
+	}
 	/* begin pop: */
-	GIV(stackPointer) += 2 * BytesPerWord;
+	GIV(stackPointer) += GIV(argumentCount) * BytesPerWord;
 	for (i = 0; i <= (argCnt - 1); i += 1) {
 		/* begin push: */
 		longAtput(sp = GIV(stackPointer) - BytesPerWord, longAt((argumentArray + BaseHeaderSize) + (i << ShiftForWord)));

Modified: branches/Cog/stacksrc/vm/interp.h
===================================================================
--- branches/Cog/stacksrc/vm/interp.h	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/stacksrc/vm/interp.h	2011-06-17 20:17:36 UTC (rev 2431)
@@ -1,8 +1,10 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.70 uuid: 36b63465-1b05-401f-bcb2-f9cae49422b8
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.78 uuid: 412444c6-36dc-48be-b5cd-a6ebc4ade0bb
  */
 
-#define STACKVM 1
+#define VM_PROXY_MAJOR 1
+#define VM_PROXY_MINOR 12
+
 #define SQ_VI_BYTES_PER_WORD 4
 
 #define PrimErrGenericFailure 1
@@ -21,3 +23,5 @@
 #define PrimErrObjectMayMove 14
 #define PrimErrLimitExceeded 15
 
+#define STACKVM 1
+

Modified: branches/Cog/unixbuild/HowToBuild
===================================================================
--- branches/Cog/unixbuild/HowToBuild	2011-06-17 18:55:18 UTC (rev 2430)
+++ branches/Cog/unixbuild/HowToBuild	2011-06-17 20:17:36 UTC (rev 2431)
@@ -27,11 +27,11 @@
      svn co http://www.squeakvm.org/svn/squeak/branches/Cog/src
      svn co http://www.squeakvm.org/svn/squeak/branches/Cog/unixbuild
 3. Open a shell, cd into the unixbuild/bld directory and execute
-     ../../platforms/unix/config/configure CFLAGS="-g -O2 -msse2 -D_GNU_SOURCE -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=0" LIBS=-lpthread
+     ../../platforms/unix/config/configure --without-vm-display-fbdev --without-npsqueak CFLAGS="-g -O2 -msse2 -D_GNU_SOURCE -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=0" LIBS=-lpthread
      make install prefix=WhereYouWantTheVmToGo
 
 	N.B.  On Ubuntu *do not* supply "LIBS=-lpthread", i.e. use
-     ../../platforms/unix/config/configure CFLAGS="-g -O2 -msse2 -D_GNU_SOURCE -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=0"
+     ../../platforms/unix/config/configure --without-vm-display-fbdev --without-npsqueak CFLAGS="-g -O2 -msse2 -D_GNU_SOURCE -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=0"
 
 4. At the end of it you'll get a new VM in the path provided via -prefix
 



More information about the Vm-dev mailing list