handler labels

Stephen Weeks MLton@sourcelight.com
Sat, 12 Aug 2000 12:43:27 -0700 (PDT)


> > > But handlers are handled differently?
> > 
> > No.  They are in the entries list.
> 
> But are all of them there? 

As far as I know.  

> Reason being, I find labels that are never
> explicitly jumped to, are only every stored to the stack, but are not on
> the entries list -- and are always manipulated right before a save/restore
> exn stack (so I assumed they were handlers.)

I don't understand how this could happen.  I just looked at backend.fun and see
that any labels that are used for exception stack manipulation are in the
entries list.  If you send me an example, I'll look into it.

> > > I
> > > think that might explain why I'm getting unresolved symbols.  I wanted to
> > > be aggressive and simply count all the jumps to each label
> > 
> > Surely you want to count stores of the label to the stack as a reference.  This
> > is what happens with handlers and conts.
> 
> Definitely, although stores of a label to the stack automatically force
> that label to exist in the output (like with gcReturns and entries),
> because I can't count which "jmp (stackTop)"s actually do the transfers to
> that label.  The issue was whether I wanted to walk over the whole program
> and recognize such stores or whether I could just take them as precomputed
> values.  At first I thought the later, but now I suspect that isn't the
> case.

I think that if you do chunkifcation and never split a chunk across assembly
files, then all you will need is the entries list.  Further, if you never split
a CPS toplevel function across chunks, then the only labels that can be referred
to between chunks (and hence assembly files) are toplevel function labels.  To
me, that sounds the easiest way to go, possibly passing along the list of
toplevel function labels from the backend to your pass.