[MLton] What are the semantics for Word_addCheck?

Stephen Weeks MLton@mlton.org
Thu, 8 Jun 2006 10:39:08 -0700

> it will probably be helpful to look at mlton/atoms/prim.{sig,fun},
> particularly at the definitions of the functions 'isFunctional',
> 'mayOverflow', 'mayRaise', 'maySideEffect', and 'apply'.  The 'is*'
> and 'may*' functions should help you broadly classify the
> primitives; a vanilla CFA can mostly ignore the 'isFunctional'
> primitives.

You could also look at the existing 0CFA implementation that runs on
SXML, which is in


In particular, there is AbstractValue.primApply, which will show you
how 0CFA handles all the primitives.  There really aren't that many
that require special treatment -- basically, the primitives that deal
with data structures that can hold functions (arrays, refs, vectors,
and weaks) have to correctly propagate the information about functions
through the abstract representation of the data structure.

All in all, the flow analysis code is about 600 lines.  You can even
compile with

  -diag-pass closureConvert
  -keep-pass sxmlSimplify

to see the flow analysis output from the diagnostics printed on line
387 of closure-convert.fun.