This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Removal of gotos from cfg based ir
Andrew MacLeod writes:
> On Fri, 2003-11-14 at 12:29, Andrew Haley wrote:
> > Andrew MacLeod writes:
> > > On Fri, 2003-11-14 at 11:58, Andrew Haley wrote:
> > > > Andrew MacLeod writes:
> > > > >
> > > > >
> > > > > How does java determine where an expression might trap to?
> > > >
> > > > "Exceptions are precise: when the transfer of control takes place, all
> > > > effects of the statements executed and expressions evaluated before
> > > > the point from which the exception is thrown must appear to have taken
> > > > place. No expressions, statements, or parts thereof that occur after
> > > > the point from which the exception is thrown may appear to have been
> > > > evaluated. If optimized code has speculatively executed some of the
> > > > expressions or statements which follow the point at which the
> > > > exception occurs, such code must be prepared to hide this speculative
> > > > execution from the user-visible state of the program."
> > > >
> > > How does it determine *where* the exception is goig to go?
> > >
> > > ie, if there are 4 stmts in a row than might trap, how do you know where
> > > the exception might go?
> >
> > They will trap to the handler for the region they're in.
> >
> > > Are they all contained inside a TRY block?
> >
> > Yes.
> >
> > > so to make a stmt trap to a different label, you need to be in a
> > > different TRY block?
> >
> > Or to have a different exception. You can have handlers for divide
> > overflow and null pointer traps, for example, and these can have
> > different handlers.
> >
> DIfferent handlers, but they are all within the same TRY region, and
> they simply have different CATCHs, like in c++?
yeah, like
try
{
a = b/c + foo();
}
catch (DivideOverflow e)
{
...
}
catch (NullPointerException e2)
{
...
}
>
> So within a TRY region, an exception on any of these stmts is
> transferred to the same Catch handling region/landing pad/ whatever? All
> NULL traps will go to the same label, all overflows go to the same label
> etc?
Yes.
> SO we can characterize all the stmts within a region the same way?
>
> and can you resume back to where you were, ie the next stmt, or is
> control premanently in the handler now?
You may not resume, no.
Andrew.