Running Stalin version 0.9 under Cygwin on Windows XP (an innocent's notes)


Note: This is one configuration that works, but see also comments in thread 
      http://groups.google.com/group/comp.lang.scheme/browse_thread/thread/ef06d12564ee134a/

- Install Cygwin (I did complete installation)

- Stalin 0.9 will not work with gcc 3.4+, so run cygwin setup again
  and install previous versions of  gcc, gcc-core and gcc-g++
  in Devel by clicking on "keep" until version 3.3.3-3 appears.
  Be sure that they all still say 3.3.3-3 when you are
  done, since clicking on e.g. gcc-g++ may revert gcc or gcc-core
  to version 3.4+, so you may have to redo the latter.

  Google "Cygwin Time Machine" once version 3.3.3-3 is no longer
  available from the official Cygwin site.

- Put stalin-0.9 in cygwin/usr/src/

- Add the compiler option 
     
     -mno-align-double 
     
  to the invocations of gcc in file "stalin-0.9/build" and CC in 
  "stalin-0.9/makefile".
   
  The explanation: 
  
  "Stalin [...] runs fine on Cygwin as long as you pass GCC the 
  -mno-align-double argument (Windows likes to align on 64-bit boundaries 
  in its structs, which makes Stalin fail)."
  
  (from http://comments.gmane.org/gmane.lisp.scheme.bigloo/2034)

- cd /usr/src/stalin-0.9
  ./build
  
  This should take 10-15 minutes.

- If you build more than once, you may have to manually copy stalin.exe 
  from stalin-0.9/ to stalin-0.9/include/ afterwards.
  This may not happen automatically, so be sure to check that the 
  file in the stalin-0.9/include directory is the one you just built.

- Edit file stalin-0.9/stalin:  The second line is missing an .exe
  that may cause an infinite loop upon invocation if this file gets 
  copied to stalin-0.9/include/, which for some reason happened on my
  machine.  The line should be

  exec /usr/src/stalin-0.9/include/stalin.exe -I /usr/src/stalin-0.9/include $@

- Now we can compile something.  Again, we have to pass the -mno-align-double
  option to the C compiler (by preceding it with -copt):

  cd /benchmarks
  ../stalin -On -copt -mno-align-double hello

  This should take a couple of seconds.

- ./hello
  Hello World!

You may now similarly compile other benchmarks with Stalin.  For  
performance, the following set of compiler options, taken from the 
compile-and-run-stalin-benchmark script, can serve as a good 
starting point.

 ../stalin -d0 -d1 -d5 -d6 -Ob -Om -On -Or -Ot -k -copt -O3 -copt 
 -fomit-frame-pointer -copt -Wall -copt -freg-struct-return -copt 
 -mno-align-double integ

 ./integ
 2.3892726898193359375e17
  
If you ever get the error: 

  assertion "offsetof(struct{char dummy; FILE probe;}, probe)==4" failed

you probably forgot the -copt -mno-align-double option.
The build scripts in /benchmarks all need this -copt -mno-align-double 
to function properly.  In addition, they contain a line ulimit -s unlimited
that will not work under Cygwin.  This line, which sets the stack size,
may be dropped, or presumably 'unlimited' may be replaced by a concrete 
size, but probably you don't need to bother with this at first.

There is a newer alpha version of Stalin available also.  The filename is
stalin-0.10alpha2.tgz in the directory ftp://ftp.ecn.purdue.edu/qobi/
This version is advertized to have full tail call optimization.  I may 
update this page with newer instructions if I get a chance to install this 
update in future.