[MLton] Darwin/PPC changes

Henry Cejtin henry@sourcelight.com
Tue, 28 Sep 2004 12:02:49 -0500


From my recollection, the problem is that Mach might scatter the code of your
program in disconnected pieces.  I remember that  for  Mathematica  undump  I
used  vm_region(),  which  let  you walk through all the parts of the address
space appropriately, but to handle that would require that the profiling code
used  a  more  complicated  structure  than just a low and high value for the
count buffer.

At that time (long ago), the only things  that  were  not  continguous  where
shared  libraries.  They were important for undump because their state had to
be preserved.  For profiling, it just means that any time spent in any of the
shared  libraries  is  all gathered together and gets ascribed to the unknown
region.  Not optimal, but usually not a big problem.

If some one wants to see what gprof does in  this  case,  they  should  write
something  like  fib(),  put it in a shared library, then link a test program
that just prints out fib of 40, and see where gprof says that the time  goes.
(I  don't  have any Mach machines except for my ancient NeXT box, which isn't
powered up.)