Preliminary RFR (L): 8001107: @Stable annotation for constant folding of lazily evaluated variables
Vladimir Kozlov
vladimir.kozlov at oracle.com
Wed Sep 4 15:17:58 PDT 2013
+1
Vladimir K
On 9/4/13 12:00 PM, Christian Thalinger wrote:
> Looks good. -- Chris
>
> On Sep 4, 2013, at 2:56 AM, Vladimir Ivanov <vladimir.x.ivanov at oracle.com> wrote:
>
>> FYI, I've updated [1] with proposed changes.
>>
>> Best regards,
>> Vladimir Ivanov
>>
>> [1] http://cr.openjdk.java.net/~vlivanov/8001107/webrev.04
>>
>> On 9/4/13 1:20 AM, Vladimir Kozlov wrote:
>>> On 9/3/13 2:04 PM, Vladimir Ivanov wrote:
>>>> John,
>>>>
>>>> I'm fine with both options (add an assert or use
>>>> element_value(index).as_char() in product).
>>>>
>>>> Vladimir K., what do you prefer?
>>>
>>> assert
>>>
>>> Vladimir K
>>>
>>>>
>>>> Best regards,
>>>> Vladimir Ivanov
>>>>
>>>> On 9/3/13 10:40 AM, John Rose wrote:
>>>>> On Aug 29, 2013, at 4:57 PM, Vladimir Kozlov <vladimir.kozlov at oracle.com
>>>>> <mailto:vladimir.kozlov at oracle.com>> wrote:
>>>>>
>>>>>>>> ciTypeArray.cpp: why we need these changes?
>>>>>>> I consider this as a cleanup. element_value(index).as_char() performs
>>>>>>> additional checks and it looks better (IMO, of course :-) ) than
>>>>>>> get_typeArrayOop()->char_at(index).
>>>>>>
>>>>>> But element_value() is much more expensive! I don't like this change.
>>>>>
>>>>> The old char_at function works fine, but I think it needs an assert that
>>>>> the array being referenced is truly a char[] array. The more expensive
>>>>> element_value function performs this check, so it is safer. It is also
>>>>> helpful to prove (at least via an assert) that element_value is a true
>>>>> extension of char_at.
>>>>>
>>>>> If we don't like making char_at slightly more expensive (it doesn't make
>>>>> much difference!) then I suggest putting the call to element_value into
>>>>> the #ifdef ASSERT, as follows:
>>>>>
>>>>> assert(index >= 0 && index < length(), "out of range");
>>>>> ! jchar c = get_typeArrayOop()->char_at(index);
>>>>> ! #ifdef ASSERT
>>>>> ! jchar d = element_value(index).as_char();
>>>>> ! assert(c == d, "");
>>>>> ! #endif //ASSERT
>>>>> ! return c;
>>>>> }
>>>>>
>>>>> — John
>
More information about the hotspot-compiler-dev
mailing list