[MLton] ref flattening and backpatching

Stephen Weeks MLton@mlton.org
Wed, 22 Sep 2004 16:30:22 -0700


> If refFlatten is the last optimization pass (i.e., no SSA
> optimizations get to see the immutable field), then I don't think
> that the Machine IL or codegen's will do anything functionally
> different in the two cases.

Pretty much true.  The only possible difference is if there were only
one mutable field in the object, in which case eliminating it would
cause SsaToRssa to set the object type to have hasIdentity = false
instead of hasIdentity = true.  This would, e.g., allow the runtime
GC_share function to share more than it would otherwise.  This would
also change the semantics of equality on the object, so the
optimization would only be valid if the ref was never tested for
equality.