More bugs later... :)

Stephen Weeks sweeks@intertrust.com
Sun, 12 Dec 1999 13:12:14 -0800 (PST)


> So after some hacking, it works...	thanks for all the hints.. 

Great.

> In mtype.fun
> 
>    fun size t =
>       case dest t of
> 	 Char => byte
>        | Double => double
>        | Int => word
>        | Pointer => word
>        | Uint => word
>        | Void => 0
> 
> I had to change 
>         Void => word
> 
> to avoid a divison by zero error raised by. 
> 
> fun align(n: int, ty: t): int =
>    let val s = size ty
>    in if n mod s = 0
> 	 then n
>       else n - (n mod s) + s
>    end
> 
> 
> I'm not sure if this is a proper bug that doesn't show up when you bootstrap
> MLton or not.. but it shows up with SMLNJ... and my simple test code...

It is a bug that is fixed in the current (unreleased) working
version.  The correct fix is to replace align with the following:

fun align(n: int, ty: t): int =
   let val s = size ty
   in if s = 0 orelse n mod s = 0
	 then n
      else n - (n mod s) + s
   end

> Now you guys get to field all my silly runtime questions as I hack into the
> backend and replace/disable the GC :)

I have a newer stable version of the compiler that just recently
passed all the regression tests (including a successful self compile).
Many of the changes were in the backend and runtime system so that
threads could be easily supported.  I also cleaned up the runtime code
in general and made the C output more readable.  I don't think the Cps
interface has changed at all.  If you're willing, I'd be happier if
you work with the latest version so that any changes you make are more
easily integrated into the mainline code tree.  Also, there have been
a number of bug fixes (such as the above align function) since the
1999-7-12 version.

Let me know if you want and I will make a snapshot available.