Loop safepoints and backedge copies

Gary Benson gbenson at redhat.com
Fri Mar 20 12:01:30 PDT 2009


Tom Rodriguez wrote:
> > Is it safe to say that for backwards branches (target bci <=
> > current bci) you only need to insert a safepoint check when the
> > block you are in is a backedge copy?
> 
> The specific requirement is that any cycle in the control flow graph
> has to have a safepoint somewhere in it.  The rule we use is that we
> emit a safepoint on any branch that may go backwards.  A block in
> ciTypeFlow that is marked as a backedge_copy is actually the loop
> backedge of a zero trip loop so it should be possible to place your
> safepoint in that block.  Unfortunately not all backedges are cloned
> so you can't simply restrict safepoint insertion to backedge_copy
> blocks.  If you are worried about inserting useless safepoints you
> are probably better off having an optimization that removes useless
> ones.  If a loop has a call in it then it doesn't need a separate
> safepoint poll and eliminating that is a good idea.  Also any
> safepoint poll outside of a loop is useless.

That's interesting, what is it that determines whether a backedge is
cloned or not?  And also, out of interest, what benefit does having
the backedge copies bring?

Cheers,
Gary

-- 
http://gbenson.net/



More information about the hotspot-compiler-dev mailing list