C1 and @Stable array elements
Vladimir Ivanov
vladimir.x.ivanov at oracle.com
Fri Nov 20 13:55:55 UTC 2015
>> What I'm trying to understand is what level of optimization you are
>> looking for.
>>
>
> Supporting one dimensional arrays would be sufficient.
That simplifies the task. Just "stability" bit, no need to track array
dimension. I'll experiment with 1-dimentional arrays support then. Filed
JDK-8143407 [1].
>
>> (1) With field loads it is simple
>> getfield T.f // class T { @Stable int f; }
>>
>> all information is local, so it can be constant folded during bytecode
>> parsing.
[...]
>
> AFAICT, i think it’s possible to find out, just by virtue of 1) already
> being supported, and from that C1 treats the array length as a constant,
> but i have no idea to combine the array, length and index with a bounds
> check and then an array access to produce a constant.
Array length case is simpler. It's just a final field, but there's a
need to special-case it in the code, because:
(1) it's not a Java field (no metadata associated)
(2) instance final fields are not trusted by default.
Best regards,
Vladimir Ivanov
[1] https://bugs.openjdk.java.net/browse/JDK-8143407
More information about the hotspot-compiler-dev
mailing list