Skip to content

Commit

Permalink
CogVM source as per VMMaker.oscog-eem.274.
Browse files Browse the repository at this point in the history
Fix PC-mapping for NewspeakV4.  Absent receiver sends must not be maped twice,
once for IsNSSend and once for IsSend.  So introduce class vars that state
whether instructioon set uses PushImplicitReceiver (NSSendIsPCAnnotated is true)
or SendAbsentImplicit (NSSendIsPCAnnotated is false).

More info on optimizations to defeat for gcc 4.x compilation.


git-svn-id: http://squeakvm.org/svn/squeak/branches/Cog@2704 fa1542d4-bde8-0310-ad64-8ed1123d492a
  • Loading branch information
eliot committed Mar 19, 2013
1 parent 7ecdacc commit 170f694
Show file tree
Hide file tree
Showing 6 changed files with 181 additions and 6 deletions.
12 changes: 12 additions & 0 deletions cygwinbuild/HowToBuild
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ then replace --export-dynamic with --export-all-symbols in the makefiles.
evalautes to the cygwin gcc 3.4.x not the MinGW gcc 2.95.x (try gcc -v).

Caution: if your default gcc is too recent (gcc-4), compilation may fail.
See below, Optimization level and gcc version.
In this case, you should rather use the following commmand
make CC=gcc-3 LD=gcc-3 DLLWRAP='dllwrap -mno-cygwin --driver-name gcc-3'

Expand Down Expand Up @@ -81,3 +82,14 @@ Then build the libraries winbochs/{cpu/libcpu.a,disasm/libdisasm.a,fpu/libfpu.a}
and build the plugin either via make (for the entire VM) or just
$ cd ROOT/cygwinbuild
$ make build/vm/BochsIA32Plugin.dll

Optimization level and gcc version
----------------------------------
There are issues with gcc version > 4.2.1. Any of the following flags may break the build at -O2:
-ftree-pre
-fpartial-inlining
-fcaller-saves

So turn them off. e.g.
../../platforms/unix/config/configure --without-npsqueak CFLAGS="-g -O2 -msse2 -fno-caller-saves -fno-partial-inlining -fno-tree-pre -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=0" LIBS=-lpthread
See http://smallissimo.blogspot.fr/2013/02/compiling-squeak-cog-virtual-machine-on.html
16 changes: 16 additions & 0 deletions macbuild/HowToBuild
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,19 @@ Then build the plugin:
macbuild folder (or Fast.app Assert.app and Debug.app if you've used mvm).

N.B. The plugin set is defined by plugins.ext and plugins.int in the build dir.


Optimization level and gcc version
----------------------------------
There are issues with gcc version > 4.2.1. Any of the following flags may break the build at -O2:
-ftree-pre
-fpartial-inlining
-fcaller-saves

So turn them off. e.g.
../../platforms/unix/config/configure --without-npsqueak CFLAGS="-g -O2 -msse2 -fno-caller-saves -fno-partial-inlining -fno-tree-pre -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=0" LIBS=-lpthread

Clang
-----
So far Clang only works at -O1. So it may also be subject to some of the same
issues as gcc. Please report back successes with clang, especially at -O2.
12 changes: 12 additions & 0 deletions nscogbuild/cygwinbuild/HowToBuild
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ then replace --export-dynamic with --export-all-symbols in the makefiles.
evalautes to the cygwin gcc 3.4.x not the MinGW gcc 2.95.x (try gcc -v).

Caution: if your default gcc is too recent (gcc-4), compilation may fail.
See below, Optimization level and gcc version.
In this case, you should rather use the following commmand
make CC=gcc-3 LD=gcc-3 DLLWRAP='dllwrap -mno-cygwin --driver-name gcc-3'

Expand Down Expand Up @@ -81,3 +82,14 @@ Then build the libraries winbochs/{cpu/libcpu.a,disasm/libdisasm.a,fpu/libfpu.a}
and build the plugin either via make (for the entire VM) or just
$ cd ROOT/nscogbuild/cygwinbuild
$ make build/vm/BochsIA32Plugin.dll

Optimization level and gcc version
----------------------------------
There are issues with gcc version > 4.2.1. Any of the following flags may break the build at -O2:
-ftree-pre
-fpartial-inlining
-fcaller-saves

So turn them off. e.g.
../../platforms/unix/config/configure --without-npsqueak CFLAGS="-g -O2 -msse2 -fno-caller-saves -fno-partial-inlining -fno-tree-pre -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=0" LIBS=-lpthread
See http://smallissimo.blogspot.fr/2013/02/compiling-squeak-cog-virtual-machine-on.html
127 changes: 127 additions & 0 deletions nscogbuild/macbuild/HowToBuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
How To Build On Linux
---------------------

Contents:
- Checking out sources
- How to build the Cog Croquet VM on Unix
- Testing an external plugin has completely linked
- Compiling in 32-bit mode on a 64-bit linux
- Testing an external plugin has completely linked
- N.B. Please read: Optimization level and gcc version


Checking out sources
-------------------------------
To generate a VM check-out http://www.squeakvm.org/svn/squeak/branches/Cog/image
which contains
http://www.squeakvm.org/svn/squeak/branches/Cog/image/VMMaker-Squeak4.1.changes
http://www.squeakvm.org/svn/squeak/branches/Cog/image/VMMaker-Squeak4.1.image
Start up VMMaker-Squeak4.1.image. In it is a workspace containing a doit that
uses something like generate:and:to:platformDir:excluding:. Doit.


How to build the Cog Croquet VM on Unix
-------------------------------
1. Install the tools (gcc, X11-devel, etc (e.g. libpng, libX11 & libxt source))
2. Check out the following sources from svn (if you haven't already - if you're
reading this in unixbuild its likely you've already got the sources)
svn co http://www.squeakvm.org/svn/squeak/branches/Cog/platforms
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 --without-npsqueak CFLAGS="-g -O2 -msse2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=0" LIBS=-lpthread
make install prefix=WhereYouWantTheVmToGo

N.B. If you're on a 64-bit linux read 3e below!!
N.B. On Ubuntu *do not* supply "LIBS=-lpthread", i.e. use
../../platforms/unix/config/configure --without-npsqueak CFLAGS="-g -O2 -msse2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -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

N.B. The plugin set is defined by plugins.ext and plugins.int in the build dir.


3a. For an assert-enabled VM do
../../platforms/unix/config/configure --without-npsqueak CFLAGS="-g -O1 -msse2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=0" LIBS=-lpthread

3b. For a full debug VM do
../../platforms/unix/config/configure --without-npsqueak CFLAGS="-g3 -msse2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=1" LIBS=-lpthread

3c. For a multi-threaded VM open a shell and cd to the mtbld directory. Then
execute
../../platforms/unix/config/configure INTERP=cointerpmt --without-npsqueak CFLAGS="-g -O2 -msse2 -DNDEBUG -DCOGMTVM=1 -DDEBUGVM=0 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1" LIBS=-lpthread
make squeakmt
make installmt prefix=WhereYouWantTheVmToGo

N.B. As of early 2010 the linux pthreads implementation doesn't appear to
provide a way of setting priorities for the default thread scheduling policy
SCHED_OTHER (unlike e.g. Mac OS X) and doesn't appear to allow changing the
policy to one that does (e.g. SCHED_RR). So for now we use the itimer
scheme. See platforms/unix/vm/sqUnixHeartbeat.c

3d. If you want to get the Cog VM simulator working you'll need to build the
BochsIA32Plugin/BochsIA32Plugin.xcodeproj project and to build that you'll
need to first build bochs. First check-out the processor simulator source tree
containing Bochs:
svn co http://www.squeakvm.org/svn/squeak/branches/Cog/processors
Then build libraries linuxbochs/{cpu/libcpu.a,disasm/libdisasm.a,fpu/libfpu.a}
$ cd ROOT/processors/IA32/linuxbochs
$ ./conf.COG
$ ../bochs/makeem
and build the plugin via
$ cd ROOT/unixbuild/bld/BochsIA32Plugin
$ make

3e. (see Compiling in 32-bit mode on a 64-bit linux below)
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
provides the 32-bit compiler and the ia32-libs provides the 32-bit libraries.
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" --without-npsqueak CFLAGS="-g -O2 -msse2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=0" 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.

Compiling in 32-bit mode on a 64-bit linux
-------------------------------
Follow 3e. above. Also note that according to Paul DeBruicker the following
packages need to be installed to compile in 32-bt mode on 64-bit ubuntu. YMMV.

build-essential
lib32asound2-dev
libgl1-mesa-dev
libglu1-mesa-dev
ia32-libs
gcc-multilib
g++multilib

In addition [email protected] installed libc6dev-i386.

This in itself may not be enough, but persistence will pay off. See for example
http://permalink.gmane.org/gmane.comp.lang.smalltalk.pharo.devel/75198.


Testing an external plugin has completely linked
-------------------------------
You may find that an external plugin compiles and links but does not load.
This is usually because it contans undefined symbols. To find undefined
symbols, remake the plugin, capturing the link step and then supply
-Wl,--warn-unresolved-symbols -Wl,--no-allow-shlib-undefined
when manually repeating the link command


Optimization level and gcc version
----------------------------------
There are issues with gcc version > 4.2.1. Any of the following flags may break the build at -O2:
-ftree-pre
-fpartial-inlining
-fcaller-saves

So turn them off. e.g.
../../platforms/unix/config/configure --without-npsqueak CFLAGS="-g -O2 -msse2 -fno-caller-saves -fno-partial-inlining -fno-tree-pre -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=0" LIBS=-lpthread

Clang
-----
So far Clang only works at -O1. So it may also be subject to some of the same
issues as gcc. Please report back successes with clang, especially at -O2.
10 changes: 7 additions & 3 deletions nscogbuild/unixbuild/HowToBuild
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,13 @@ when manually repeating the link command

Optimization level and gcc version
----------------------------------
There are issues with gcc version > 4.2.1. One must include -fno-caller-saves
with these versions. e.g.
../../platforms/unix/config/configure --without-npsqueak CFLAGS="-g -O2 -msse2 -fno-caller-saves -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=0" LIBS=-lpthread
There are issues with gcc version > 4.2.1. Any of the following flags may break the build at -O2:
-ftree-pre
-fpartial-inlining
-fcaller-saves

So turn them off. e.g.
../../platforms/unix/config/configure --without-npsqueak CFLAGS="-g -O2 -msse2 -fno-caller-saves -fno-partial-inlining -fno-tree-pre -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=0" LIBS=-lpthread
See http://smallissimo.blogspot.fr/2013/02/compiling-squeak-cog-virtual-machine-on.html

There appear to be issues with 3.4.x gcc version on RedHat. In particular
Expand Down
10 changes: 7 additions & 3 deletions unixbuild/HowToBuild
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,13 @@ when manually repeating the link command

Optimization level and gcc version
----------------------------------
There are issues with gcc version > 4.2.1. One must include -fno-caller-saves
with these versions. e.g.
../../platforms/unix/config/configure --without-npsqueak CFLAGS="-g -O2 -msse2 -fno-caller-saves -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=0" LIBS=-lpthread
There are issues with gcc version > 4.2.1. Any of the following flags may break the build at -O2:
-ftree-pre
-fpartial-inlining
-fcaller-saves

So turn them off. e.g.
../../platforms/unix/config/configure --without-npsqueak CFLAGS="-g -O2 -msse2 -fno-caller-saves -fno-partial-inlining -fno-tree-pre -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=0" LIBS=-lpthread
See http://smallissimo.blogspot.fr/2013/02/compiling-squeak-cog-virtual-machine-on.html

There appear to be issues with 3.4.x gcc version on RedHat. In particular
Expand Down

0 comments on commit 170f694

Please sign in to comment.