[MLton-devel] Minimizing space usage in ML (fwd)

Matthew Fluet fluet@CS.Cornell.EDU
Tue, 22 Oct 2002 16:47:11 -0400 (EDT)


> Isn't the information (about mutability) a bit tricky because of things like
> Vector do assignments after the object is created?  I looked at the source
> and didn't see any cast, which I thought would be there.

The "cast" is via the "Vector_fromArray" primitive:

	    (* Don't mutate the array after you apply fromArray, because vectors
	     * are supposed to be immutable and the optimizer depends on this.
	     *)
	    val fromArray =
	       fn x => _prim "Vector_fromArray": 'a array -> 'a vector; x

which is "implemented" in the SSA to RSSA pass as a move.  So, there is a
brief time during the loops that fill in the vector that the object is
mutating.  In RSSA, the type is just "Pointer" so the information about
mutability is lost.  (Or, conservatively, assume that all Pointer objects
are mutable.) 




-------------------------------------------------------
This sf.net emial is sponsored by: Influence the future 
of Java(TM) technology. Join the Java Community 
Process(SM) (JCP(SM)) program now. 
http://ad.doubleclick.net/clk;4699841;7576301;v?http://www.sun.com/javavote
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel