Operations like jni_GetStringLength and jni_GetStringUTFLength expliclity check if value is null before calling java_lang_String::length / utf8_length, but that method will then do the same thing and return 0, making the outer check redundant.
These repeat accesses turn out to be somewhat costly since the access API emit access barriers. This adds up measurably, especially during startup.
Streamlining the internal String access API so that we avoid repeat access of String.value brings a measurable improvement, ~10-15% on native operations over small Strings.
These repeat accesses turn out to be somewhat costly since the access API emit access barriers. This adds up measurably, especially during startup.
Streamlining the internal String access API so that we avoid repeat access of String.value brings a measurable improvement, ~10-15% on native operations over small Strings.
- relates to
-
JDK-8220496 Race in java_lang_String::length() when deduplicating
- Resolved
-
JDK-8217522 Missing barriers in some java_lang_String assertion code after JDK-8217442
- Closed