val _ = () and exception optimization in MLton

Stephen Weeks sweeks@intertrust.com
Thu, 10 Aug 2000 12:01:50 -0700 (PDT)


I added a simple analysis to the CPS IL that determines for each toplevel
function if it can raise an exception to its caller.  I also put in an
optimization suggested by Neal that only installs an exception handler when a
nontail call is made to a function that might raise an exception.  This way, you 
only have to pay for installing a handler if a nontail call is made.

Here is the new cps for "val _ = ()".  About as small as we could want.  :-)

--------------------------------------------------------------------------------

Datatypes:
list_0 = 
bool = dummy_0


Globals:
val global_1 = 0


Functions:
fun main_0() = 
   let
      val x_692 = MLton_halt(global_1)
   in
      Bug
   end