[MLton] Problem porting trunk to IA64/HP-UX

Ville Laurikari ville at laurikari.net
Fri Dec 22 06:53:51 PST 2006


Hi,

HP-UX 11.23 on IA64 is one of the platforms we need to support.  I
tried to compile the new runtime on this platform.  Compilation failed
with the compile time asserts in gc/int-inf.h; on this platform the
GC_intInf and the contained anonymous struct will contain some padding
by default.  This is probably for reasons of alignment and efficiency.

I fixed the runtime to compile by explicitly marking the structs
packed with a GCC attribute:

  typedef struct GC_intInf {
    GC_arrayCounter counter;
    GC_arrayLength length;
    GC_header header;
    union {
      struct {
        mp_limb_t isneg;
        mp_limb_t limbs[1];
      } __attribute__((__packed__)) body;
      pointerAux _p; /* alignment */
    } obj;
  } __attribute__((__packed__)) *GC_intInf;

After this the runtime compiles cleanly.  I do get these warnings,
however:

  gc/int-inf.h:20: warning: packed attribute causes inefficient alignment for 'isneg'
  gc/int-inf.h:21: warning: packed attribute causes inefficient alignment for 'limbs'
  gc/int-inf.h:22: warning: packed attribute causes inefficient alignment
  gc/int-inf.h:15: warning: packed attribute causes inefficient alignment for 'counter'
  gc/int-inf.h:16: warning: packed attribute causes inefficient alignment for 'length'
  gc/int-inf.h:17: warning: packed attribute causes inefficient alignment for 'header'
  gc/int-inf.h:24: warning: packed attribute causes inefficient alignment for 'obj'
  gc/int-inf.h:25: warning: packed attribute causes inefficient alignment for 'GC_intInf'

But at least it compiles.  I think I'll just commit this unless anyone
has objections.

bin/add-cross went through OK.  But then, compiling mlton for the
target platform with "mlton -stop g" failed, producing a rather large
error message with 1259753 lines (yes, 1.26 million) and 48M size.  It
starts like this:

  Type error: bad primapp
  exp: WordVector_toIntInf (x_0)
  val x_1 =
     WordVector_toIntInf (x_0)
  let
     val x_1 =
        WordVector_toIntInf (x_0)
  in
     x_1
  end
  ...

I am not familiar with the actual compiler code (I've just hacked the
runtime so far) and don't really know where to start debugging this.

Does anyone have any ideas?  I can provide the error message file and
others for download if needed.


--
http://www.iki.fi/vl/



More information about the MLton mailing list