[9] RFR (M): 8143407: C1: @Stable array support
Christian Thalinger
christian.thalinger at oracle.com
Fri Feb 26 19:27:41 UTC 2016
// Stable static fields are checked for non-default values in ciField::initialize_from().
+ assert(!field->is_stable() || !field_value.is_null_or_zero(), "should not be a constant");
I don’t understand this assert. Especially the message text.
+ switch (field_type) {
+ case T_ARRAY:
+ case T_OBJECT:
+ if (field_value.as_object()->should_be_constant()) {
+ return new Constant(value);
+ }
+ break;
+ default:
+ return new Constant(value);
+ }
+ return NULL; // Not a constant.
Could you move the return NULL up to where the break is? Would make it easier to read.
+ if (FoldStableValues && field->is_stable() && field_value.is_null_or_zero()) {
// Stable field with default value can't be constant.
- constant = NULL;
I understand that the null assignment is not needed but it would be nice to keep it.
Otherwise the logic seems to be fine. I couldn’t spot any obvious mistakes.
> On Feb 26, 2016, at 5:31 AM, Vladimir Ivanov <vladimir.x.ivanov at oracle.com> wrote:
>
> Any reviews, please?
>
> Best regards,
> Vladimir Ivanov
>
> On 2/19/16 9:34 PM, Vladimir Ivanov wrote:
>> http://cr.openjdk.java.net/~vlivanov/8143407/webrev.01
>> https://bugs.openjdk.java.net/browse/JDK-8143407
>>
>> Add C1 support for constant folding loads from @Stable arrays.
>> It aligns C1 & C2 behavior w.r.t. @Stable fields and was requested for
>> VarHandles [1] implementation.
>>
>> I introduced StableArrayConstant to track stable array dimension.
>>
>> It is needed to disambiguate the following cases:
>> (1) @Stable int[][][] intArr = new int[...][...][...];
>> (2) @Stable Object[] objArr = new int[...][...][...];
>>
>> In the first case, all elements of multi-dimensional array w/
>> non-default values are considered constant.
>>
>> In the latter, only elements of objArray (which are int[][] instances).
>>
>> Testing: unit tests on @Stable support, JPRT.
>>
>> Thanks!
>>
>> Best regards,
>> Vladimir Ivanov
>>
>> [1] http://openjdk.java.net/jeps/193
More information about the hotspot-compiler-dev
mailing list