Loop safepoints and backedge copies
Tom Rodriguez
Thomas.Rodriguez at Sun.COM
Fri Mar 20 10:09:39 PDT 2009
> I'm writing a compiler that uses the HotSpot's typeflow pass.
>
> 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.
tom
>
>
> Cheers,
> Gary
>
> --
> http://gbenson.net/
More information about the hotspot-compiler-dev
mailing list