CVS Commit
Matthew Fluet
Matthew Fluet <fluet@CS.Cornell.EDU>
Mon, 24 Sep 2001 08:39:22 -0400 (EDT)
http://www.cs.cornell.edu/People/fluet/MLton/contify.tgz
(* /src/mlton/cps/contify.fun *)
Fixed bug exhibited by lrtl.sml. Recursive calls to a function with
unused-args from within the body of the function were not being handled
correctly.
E.g.
fun loop(x, env)
= let
fun L1 () = ()
in
case x of nil => L1 | :: => loop
end
...
loop(z, env)
The argument env is unused; however, :: is a constructor, and it's target
label must accept the right number of args, so we mark loop as needing a
wrapper. We were translating it to:
fun loop(x)
= let
fun L1 () = ()
in
case x of nil => L1 | :: => loop
end
fun loop''(x'', env'')
= loop(x'')
...
loop(z)
which has a type error at the :: => loop case. The "problem" was that I
wasn't setting the wrapper for loop within the body of loop. On the other
hand, even setting the wrapper for loop to loop'' doesn't work, because of
scoping. So, we need an inner wrapper set for within the body of loop and
an outer wrapper set for outside the body of loop. The final
transformation looks like:
fun loop(x)
= let
fun loop'(x', env') = loop(x')
fun L1 () = ()
in
case x of nil => L1 | :: => loop'
end
fun loop''(x'', env'')
= loop(x'')
...
loop(z)
The shrinker then does the right thing and eliminates uncalled wrappers.
http://www.cs.cornell.edu/People/fluet/MLton/unused-args.tgz
(* /src/mlton/cps/unused-args.fun *)
Fixed bug exhibited by lrtl.sml. The processing of mutually recursive
functions using strongly connected components and nesting had a bug where
a function could be marked uncontifiable but still appear on another
function's prefix list. Processing is now a little cleaner and once a
function is placed on another function's prefix list, it is marked done
and won't be marked uncontifiable.
http://www.cs.cornell.edu/People/fluet/MLton/Makefile.tgz
(* /src/mlton/Makefile *)
Added target nj-mlton-dual for SML/NJ ( >= 110.20) on a dual processor
machine. Uses two compilation servers for compilation.