RFR: 8217442: Optimize native accesses to String.value
Claes Redestad
claes.redestad at oracle.com
Mon Jan 21 16:03:02 UTC 2019
Hi,
On 2019-01-21 16:07, Aleksey Shipilev wrote:
> On 1/21/19 2:57 PM, Claes Redestad wrote:
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8217442
>> Webrev: http://cr.openjdk.java.net/~redestad/8217442/open.00/
>
> Mostly stylistics:
>
> *) New line here:
>
> 592 }
> 593 int java_lang_String::utf8_length(oop java_string) {
Fixed.
>
> *) Seems like new code uses 4-space indent, while the existing style is 2-spaces.
I picked up CLion recently and seems it's been reformatting code
gratuitously on copy-paste. Told it to use 2-space indentation and
fixed things up.
>
> *) Stray space after "value":
> 626 typeArrayOop value = java_lang_String::value(java_string);
Seems I got this from a pre-existing indentation quirk where "value" was
being aligned with "length". Fixed in the new, standalone places.
>
> *) Pretty sure you need to use oopDesc::equals_raw instead of ==, as "oop::operator==" asserts in
> some BarrierSets, e.g. Shenandoah's.
>
> 581 assert(value == java_lang_String::value(java_string),
> 582 "value must be same as java_lang_String::value(java_string)");
>
> 612 assert(value == java_lang_String::value(java_string),
> 613 "value must be same as java_lang_String::value(java_string)");
Yes, that seems better/safer.
http://cr.openjdk.java.net/~redestad/8217442/open.01/
Thanks!
/Claes
More information about the hotspot-runtime-dev
mailing list