C2 Scalar Replacement Behavior?
edilee at gmail.com
Mon Nov 17 10:49:21 PST 2008
A couple questions about object scalar replacement in opto
1) Object allocations are eliminated only if they're only written to.
It seems that any field loads prevent it from being scalar replaced,
but I would have thought that after scalar replacement, a pair of
stores/loads would become plain plain def/use. Is there any particular
reason for this?
2) Allocations with multiple CheckCastPP nodes aren't eliminated. Is
it because it's known that allocations with non-unique CheckCastPP
definitely will have uses that make them non-eliminate-able? If not,
it seems that can_eliminate_allocation() would just need an extra
nested DU loop over each of the allocation's CheckCastPPs.
Just to make sure I'm understanding the code correctly, scalar
replacement behaves as..
1) Do escape analysis and mark allocations that NoEscape as possibly
2) For allocations with a single casts, make sure fields are only
stored to and the object is not returned/passed as arguments
2.1) Additionally keep track of safepoint uses for..
3) scalar_replacement() converts safepoint uses of the allocation into
4) Clean up uses of allocation by converting stores nodes into their
memory input and fix projections for control, memory, i/o
More information about the hotspot-dev