RFR(M): 8222221: [lworld] Valhalla causes performance slowdown for reflective invocations

Tobias Hartmann tobias.hartmann at oracle.com
Mon Jul 1 13:17:14 UTC 2019


Hi,

please review the following patch:
https://bugs.openjdk.java.net/browse/JDK-8222221
http://cr.openjdk.java.net/~thartmann/8222221/webrev.00/

The performance regression observed with reflective invocations is due to Object array accesses in
the GeneratedMethodAccessor because arguments are passed as varags (see bug comments).

To mitigate this, I've added code to speculate on varag arrays not being null-free value type
arrays. The type system now allows to mark TypeAry as _not_flat and _not_null_free (which implies
_not_flat). The speculative type is added on method entry (see parse1.cpp) and only used on array
access in Parse::array_addressing by adding a corresponding guard. We could also do this when
accessing arrays in intrinsics but I leave this for future work.

I've also noticed that we were sometimes emitting value array guards even if flattening is not
possible. I've added the corresponding checks and asserts.

The patch also contains some unrelated refactoring of code I've spotted when debugging.

As a follow-up enhancement, I plan to optimize object array loads followed by a cast of the element.
If the element is successfully castes to a non-value type, we know that the source array can never
be a value type array (and we can mark the type as _not_flat and _not_null_free).

Thanks,
Tobias


More information about the valhalla-dev mailing list