nullary _ffi's

Stephen Weeks MLton@sourcelight.com
Wed, 8 Nov 2000 10:00:03 -0800 (PST)


> > There is a difference between the way the C and native backends are handling
> > nullary ffi's, and an inconsistency (in my eyes) in how the native backend is
> > handling them.  
> >
> > Any clues?
> 
> The bug was it x86-mlton.fun.  Here's the patch for the applyPrim
> function:
...

Thanks for the patch.  It fixed the problem with the regression failure
(cmdline).  Unfortunately, it introduced two new -native regression failures,
bytechar and string.  Do you see those failures as well?

Here is a pared down version of bytechar that fails for me.  Interestingly
test40 succeeds if I replace List.tabulate(6, chr) with List.tabulate(5, chr).
Maybe this can help you figure out what's going on.


fun check' f = (if f () then "OK" else "WRONG") handle _ => "EXN";

fun tst0 s s' = print (s ^ "    \t" ^ s' ^ "\n");
fun tst' s f = tst0 s (check' f);

val test39 = 
    tst' "test39"
    (fn _ => List.all (fn arg => Char.fromString arg = NONE) ["\\"])

val test40 = 
    let val chars = List.tabulate(6, chr)
    in tst' "test40" (fn _ => 
	      List.map SOME chars 
	      = List.map Char.fromCString (List.map Char.toCString chars))
    end;