RFC - Improving C2 Escape Analysis

Tobias Hartmann tobias.hartmann at oracle.com
Tue Oct 19 13:17:21 UTC 2021


Hi Cesar,

First of all, very nice writeup!

On 04.10.21 23:32, Cesar Soares Lucas wrote:
> How much of a problem is control-flow/data-flow merge
> points in a world where Inline Types are in place? From my (external) point of
> view, I can  imagine that this will still be a problem. If so, it looks to me
> that this is an issue that  once solved would benefit not only the current EA
> implementation but also Valhalla.  What do you [all] think?

Some details on how inline types are currently implemented in C2:
- We don't rely on or even use Escape Analysis for inline types.
- Inline types are aggressively scalarized during parsing when created, casted to, loaded from an
array/field, passed as an argument or returned from a call.
- We implemented an optimized calling convention to allow passing/returning inline types in a
scalarized form to/from C2 compiled code.
- Buffering (= heap allocation) is only needed if an inline type is:
  - Passed as Object (or another supertype) and mixed with other types (no scalarization possible)
  - Stored into a non-flattened field/array
  - Returned from a method when there are not enough registers available to hold all fields

As a result, inline types would not directly benefit from an improved EA.

That said, support for stack/thread local allocation would be something that we could potentially
use in Valhalla to avoid buffering on the heap. It's difficult though because in most cases we use
buffering when storing to a non-flattened field that escapes to other threads.

Best regards,
Tobias


More information about the hotspot-dev mailing list