integration of PolySpace mods into MLton

Stephen Weeks MLton@sourcelight.com
Tue, 5 Feb 2002 12:04:54 -0800


Hi Alain.  I've made it through all the diffs that you sent.  I've
integrated everything, except for some stuff that was
commented/ifdef'd out and what's noted below.

* In the flags passed to gcc in bin/mlton, I didn't add -mwide-multiply,
  -fschedule-insns.

* I didn't make the changes to LimitCheck macro, which only affected
  behavior with gc-messages.

* I didn't see any need to add no_overflow to Prim.apply, since MLton
  is now always compiled with -detect-overflow true, and hence
  Prim.apply correctly handles overflow.

* I am curious about the extra contification/remove pass that you added
  to the end of the simplify pipeline, giving a total of four contify
  passes.  We have since improved the contification (and many other
  optimizations), so maybe it is unnecessary, but if you had an example
  that required it, it would be nice to look at it again.

* With regard to the code added to type-inference/infer-type.fun to
  print out "*** INTERNAL ERROR, substituting in flexible record type",
  we have since fixed several bugs fixed in flexible record inference.
  Hopefully, this bug is no longer possible.  

* For the C codegen, we now have a way of doing overflow detection that
  follows the standard and correctly raises the exception.  It is,
  however, slow, since it involves a procedure call followed by an if
  test.  I have added the ability to use fast overflow detection using
  static inline __asm__ as in your modifications, using the -DFAST_INT
  flag, which is off by default.  FAST_INT also turns Int_quot and
  Int_rem into the corresponding C operator.  Because MLton's optimizer
  knows about overflow, it may turn an overflowing intop into a raise --
  hence the semantics of FAST_INT is a bit murky.  Hopefully none of
  this matters, since you can use the X86 codegen which does both fast
  and correct overflow detection.

* I didn't understand the reason for the test on line 1151 of gc.c
 		    or (s->toSize >= (128ul*1024ul*1024ul))
  that forces toSpace to be unmapped if it is too small.

* I see that you added to the gc
	#include <asm/string.h>
	#define memmove(d,s,l) __constant_memcpy(d,s,l)   
  We have since replaced all our memmoves with other code.  There is one
  memcpy remaining in gc.c, for resizing the stack, where I doubt that
  __constant_memcpy will help.  So, I left it as is.

* Do you need the ability set RAMslop from the command line?  We have
  it at .85, but you have it at .9.

* Do you still need -stop s when compiling -native false?  We had
  eliminated it.

* Do you need the -O option when compiling -native false?  We had 
  eliminated it

* I assume your checkframes.sh script was handling the MLton bug in
  the calculation of maxFrameSize that we fixed on 2000-10-17.

* I added an option, -show-basis-used, which you can run on your code
  and send us the output so that we can see what part of the basis
  library you use.

* I added an option, -text-io-buf-size, that will let you set at
  compile time the buffer size used by TextIO to whatever you want.
  I left the default at 4096.
 
I am currently testing the code that you sent me with the new
compiler.