RFR(M): 8227634: [lworld] Better optimize object array accesses
Tobias Hartmann
tobias.hartmann at oracle.com
Tue Jul 16 13:29:49 UTC 2019
Hi,
please review the following patch:
https://bugs.openjdk.java.net/browse/JDK-8227634
http://cr.openjdk.java.net/~thartmann/8227634/webrev.00/
This patch implements the following optimizations:
- When checkcasting an array element to a type that can not be flattened in arrays, the array should
be marked as not-flat (see TestArrays::test79-test80).
- When storing an object with a non-inline, non-null type into an array, that array should be marked
as not-null-free and therefore also as not-flat (see TestArrays::test81).
- When storing an inline type with a type that can not be flattened in arrays into an array, that
array should be marked as not-flat (see TestArrays::test82).
- When checkcasting an array element to a non-inline type, the array should be marked as
not-null-free and therefore also as not-flat (see TestArrays::test83).
- When storing a constant null into an array, the array should be marked as not-null-free and
therefore also as not-flat (see TestArrays::test84-test87).
Now these are parse time optimizations that could potentially be converted to IGVN optimizations (to
handle cases where exact type information is only available after parsing, for example with
incremental inlining). I'll investigate this as a follow-up.
Other changes:
- Strengthened the asserts to make sure we emit optimal code at parse time
- Fixed a bug where no NPE is thrown when we store NULL to a null-free value type array (happens if
we always store null, see test88 and test89)
- Moved is_flattened_array_check from loopUnswitch.cpp to IfNode
- Strengthened IR matching rules for some tests
- There are several tests with accesses to (nullable) non-flattened inline type arrays that have
their matching rules disabled but can probably be optimized further. I've filed JDK-8227588 and
marked these tests with a TODO.
- Enabled IR verification for test scenario 2 for most tests (also enabled field flattening)
- Set ValueArrayElemMaxFlatOops to 5 for test scenarios to create non-flattened inline type arrays
while array flattening is still enabled
Thanks,
Tobias
More information about the valhalla-dev
mailing list