[MLton-devel] -profile time and the native codegen

Stephen Weeks MLton@mlton.org
Sat, 18 Jan 2003 17:12:04 -0800

> I'm pretty sure that the only new blocks created by the native-codegen are
> register allocation compensation blocks (which essentially do nothing more
> than shuffle values around).  This didn't used to be the case before
> Arith, Runtime, and CCalls were transfers.

Great.  I figured it wasn't too bad these days.

> > How difficult would it be
> > to add a ProfileLabel to such blocks (and modify the labels in
> > profileInfo)?
> I don't know.  For each new block I create, I can identify a block that
> it's profile info should be equivalent to (i.e., I should be able to
> extract an existing ProfileLabel).  You would know better than I how
> difficult it is to modify an existing ProfileInfo to include a new
> ProfileLabel equivalent to an existing one.

It's trivial.  You just add a new pair to

		     labels: {label: ProfileLabel.t,
			      sourceSeqsIndex: int} vector

> The down side is that we won't know all the new ProfileLabel's until after
> generating all the asm, which delays producing the C stub.

It seems worth doing to me.

The easiest way that I see would be to keep a list ref accumulator of
all the new pairs.  Whenever you need to generate a new block, extract
the ProfileLabel from the "source" block (note that there may be
ProfileLabels in the middle of a block), lookup it's sourceSeqsIndex,
create a new profileLabel, and push a new pair on the list.  After all
the assembly has been generated, convert the accumulator to a vector
and append to the labels.

Since there can be many profile labels, you need to store the
sourceSeqsIndex as a property, for constant-time lookup.

I would think the whole mess could be abstracted into a function like

	val newProfileLabel: ProfileLabel.t -> ProfileLabel.t

that is passed down as part of the transinfo.

Make sense?

This SF.NET email is sponsored by: Thawte.com - A 128-bit supercerts will
allow you to extend the highest allowed 128 bit encryption to all your 
clients even if they use browsers that are limited to 40 bit encryption. 
Get a guide here:http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0030en
MLton-devel mailing list