Skip to content

Commit 170f694

Browse files
author
eliot
committed
CogVM source as per VMMaker.oscog-eem.274.
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
1 parent 7ecdacc commit 170f694

File tree

6 files changed

+181
-6
lines changed

6 files changed

+181
-6
lines changed

cygwinbuild/HowToBuild

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ then replace --export-dynamic with --export-all-symbols in the makefiles.
3030
evalautes to the cygwin gcc 3.4.x not the MinGW gcc 2.95.x (try gcc -v).
3131

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

@@ -81,3 +82,14 @@ Then build the libraries winbochs/{cpu/libcpu.a,disasm/libdisasm.a,fpu/libfpu.a}
8182
and build the plugin either via make (for the entire VM) or just
8283
$ cd ROOT/cygwinbuild
8384
$ make build/vm/BochsIA32Plugin.dll
85+
86+
Optimization level and gcc version
87+
----------------------------------
88+
There are issues with gcc version > 4.2.1. Any of the following flags may break the build at -O2:
89+
-ftree-pre
90+
-fpartial-inlining
91+
-fcaller-saves
92+
93+
So turn them off. e.g.
94+
../../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
95+
See http://smallissimo.blogspot.fr/2013/02/compiling-squeak-cog-virtual-machine-on.html

macbuild/HowToBuild

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,19 @@ Then build the plugin:
4040
macbuild folder (or Fast.app Assert.app and Debug.app if you've used mvm).
4141

4242
N.B. The plugin set is defined by plugins.ext and plugins.int in the build dir.
43+
44+
45+
Optimization level and gcc version
46+
----------------------------------
47+
There are issues with gcc version > 4.2.1. Any of the following flags may break the build at -O2:
48+
-ftree-pre
49+
-fpartial-inlining
50+
-fcaller-saves
51+
52+
So turn them off. e.g.
53+
../../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
54+
55+
Clang
56+
-----
57+
So far Clang only works at -O1. So it may also be subject to some of the same
58+
issues as gcc. Please report back successes with clang, especially at -O2.

nscogbuild/cygwinbuild/HowToBuild

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ then replace --export-dynamic with --export-all-symbols in the makefiles.
3131
evalautes to the cygwin gcc 3.4.x not the MinGW gcc 2.95.x (try gcc -v).
3232

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

@@ -81,3 +82,14 @@ Then build the libraries winbochs/{cpu/libcpu.a,disasm/libdisasm.a,fpu/libfpu.a}
8182
and build the plugin either via make (for the entire VM) or just
8283
$ cd ROOT/nscogbuild/cygwinbuild
8384
$ make build/vm/BochsIA32Plugin.dll
85+
86+
Optimization level and gcc version
87+
----------------------------------
88+
There are issues with gcc version > 4.2.1. Any of the following flags may break the build at -O2:
89+
-ftree-pre
90+
-fpartial-inlining
91+
-fcaller-saves
92+
93+
So turn them off. e.g.
94+
../../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
95+
See http://smallissimo.blogspot.fr/2013/02/compiling-squeak-cog-virtual-machine-on.html

nscogbuild/macbuild/HowToBuild

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
How To Build On Linux
2+
---------------------
3+
4+
Contents:
5+
- Checking out sources
6+
- How to build the Cog Croquet VM on Unix
7+
- Testing an external plugin has completely linked
8+
- Compiling in 32-bit mode on a 64-bit linux
9+
- Testing an external plugin has completely linked
10+
- N.B. Please read: Optimization level and gcc version
11+
12+
13+
Checking out sources
14+
-------------------------------
15+
To generate a VM check-out http://www.squeakvm.org/svn/squeak/branches/Cog/image
16+
which contains
17+
http://www.squeakvm.org/svn/squeak/branches/Cog/image/VMMaker-Squeak4.1.changes
18+
http://www.squeakvm.org/svn/squeak/branches/Cog/image/VMMaker-Squeak4.1.image
19+
Start up VMMaker-Squeak4.1.image. In it is a workspace containing a doit that
20+
uses something like generate:and:to:platformDir:excluding:. Doit.
21+
22+
23+
How to build the Cog Croquet VM on Unix
24+
-------------------------------
25+
1. Install the tools (gcc, X11-devel, etc (e.g. libpng, libX11 & libxt source))
26+
2. Check out the following sources from svn (if you haven't already - if you're
27+
reading this in unixbuild its likely you've already got the sources)
28+
svn co http://www.squeakvm.org/svn/squeak/branches/Cog/platforms
29+
svn co http://www.squeakvm.org/svn/squeak/branches/Cog/src
30+
svn co http://www.squeakvm.org/svn/squeak/branches/Cog/unixbuild
31+
3. Open a shell, cd into the unixbuild/bld directory and execute
32+
../../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
33+
make install prefix=WhereYouWantTheVmToGo
34+
35+
N.B. If you're on a 64-bit linux read 3e below!!
36+
N.B. On Ubuntu *do not* supply "LIBS=-lpthread", i.e. use
37+
../../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"
38+
39+
4. At the end of it you'll get a new VM in the path provided via -prefix
40+
41+
N.B. The plugin set is defined by plugins.ext and plugins.int in the build dir.
42+
43+
44+
3a. For an assert-enabled VM do
45+
../../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
46+
47+
3b. For a full debug VM do
48+
../../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
49+
50+
3c. For a multi-threaded VM open a shell and cd to the mtbld directory. Then
51+
execute
52+
../../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
53+
make squeakmt
54+
make installmt prefix=WhereYouWantTheVmToGo
55+
56+
N.B. As of early 2010 the linux pthreads implementation doesn't appear to
57+
provide a way of setting priorities for the default thread scheduling policy
58+
SCHED_OTHER (unlike e.g. Mac OS X) and doesn't appear to allow changing the
59+
policy to one that does (e.g. SCHED_RR). So for now we use the itimer
60+
scheme. See platforms/unix/vm/sqUnixHeartbeat.c
61+
62+
3d. If you want to get the Cog VM simulator working you'll need to build the
63+
BochsIA32Plugin/BochsIA32Plugin.xcodeproj project and to build that you'll
64+
need to first build bochs. First check-out the processor simulator source tree
65+
containing Bochs:
66+
svn co http://www.squeakvm.org/svn/squeak/branches/Cog/processors
67+
Then build libraries linuxbochs/{cpu/libcpu.a,disasm/libdisasm.a,fpu/libfpu.a}
68+
$ cd ROOT/processors/IA32/linuxbochs
69+
$ ./conf.COG
70+
$ ../bochs/makeem
71+
and build the plugin via
72+
$ cd ROOT/unixbuild/bld/BochsIA32Plugin
73+
$ make
74+
75+
3e. (see Compiling in 32-bit mode on a 64-bit linux below)
76+
If you're building the VM on a 64-bit OS, you'll need a compiler which can
77+
compile and link to 32-bit binaries. On most Linuxes the gcc-multilib package
78+
provides the 32-bit compiler and the ia32-libs provides the 32-bit libraries.
79+
You'll also have to add the -m32 switch to all gcc & g++ invocations. The
80+
easiest way to do this is to add CC="gcc -m32" & CXX="g++ -m32" to the configure
81+
script:
82+
../../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
83+
To run a 32-bit VM on a 64-bit OS, you'll also need the 32-bit libraries
84+
provided by the ia32-libs package.
85+
86+
Compiling in 32-bit mode on a 64-bit linux
87+
-------------------------------
88+
Follow 3e. above. Also note that according to Paul DeBruicker the following
89+
packages need to be installed to compile in 32-bt mode on 64-bit ubuntu. YMMV.
90+
91+
build-essential
92+
lib32asound2-dev
93+
libgl1-mesa-dev
94+
libglu1-mesa-dev
95+
ia32-libs
96+
gcc-multilib
97+
g++multilib
98+
99+
In addition [email protected] installed libc6dev-i386.
100+
101+
This in itself may not be enough, but persistence will pay off. See for example
102+
http://permalink.gmane.org/gmane.comp.lang.smalltalk.pharo.devel/75198.
103+
104+
105+
Testing an external plugin has completely linked
106+
-------------------------------
107+
You may find that an external plugin compiles and links but does not load.
108+
This is usually because it contans undefined symbols. To find undefined
109+
symbols, remake the plugin, capturing the link step and then supply
110+
-Wl,--warn-unresolved-symbols -Wl,--no-allow-shlib-undefined
111+
when manually repeating the link command
112+
113+
114+
Optimization level and gcc version
115+
----------------------------------
116+
There are issues with gcc version > 4.2.1. Any of the following flags may break the build at -O2:
117+
-ftree-pre
118+
-fpartial-inlining
119+
-fcaller-saves
120+
121+
So turn them off. e.g.
122+
../../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
123+
124+
Clang
125+
-----
126+
So far Clang only works at -O1. So it may also be subject to some of the same
127+
issues as gcc. Please report back successes with clang, especially at -O2.

nscogbuild/unixbuild/HowToBuild

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,13 @@ when manually repeating the link command
8787

8888
Optimization level and gcc version
8989
----------------------------------
90-
There are issues with gcc version > 4.2.1. One must include -fno-caller-saves
91-
with these versions. e.g.
92-
../../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
90+
There are issues with gcc version > 4.2.1. Any of the following flags may break the build at -O2:
91+
-ftree-pre
92+
-fpartial-inlining
93+
-fcaller-saves
94+
95+
So turn them off. e.g.
96+
../../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
9397
See http://smallissimo.blogspot.fr/2013/02/compiling-squeak-cog-virtual-machine-on.html
9498

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

unixbuild/HowToBuild

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,13 @@ when manually repeating the link command
113113

114114
Optimization level and gcc version
115115
----------------------------------
116-
There are issues with gcc version > 4.2.1. One must include -fno-caller-saves
117-
with these versions. e.g.
118-
../../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
116+
There are issues with gcc version > 4.2.1. Any of the following flags may break the build at -O2:
117+
-ftree-pre
118+
-fpartial-inlining
119+
-fcaller-saves
120+
121+
So turn them off. e.g.
122+
../../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
119123
See http://smallissimo.blogspot.fr/2013/02/compiling-squeak-cog-virtual-machine-on.html
120124

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

0 commit comments

Comments
 (0)