RFR: 8217442: Optimize native accesses to String.value

David Holmes david.holmes at oracle.com
Mon Jan 21 20:54:24 UTC 2019


Hi Claes,

On 21/01/2019 11:57 pm, Claes Redestad wrote:
> Hi,
> 
> operations like jni_GetStringLength, jni_GetStringUTFLength access
> String.value multiple times, which emits an access barrier each time.
> 
> Streamlining the API so that String.value is only accessed once lead to
> a measurable speed-up (including a tiny startup improvement).

 From an API perspective this is ugly to me: taking an object and a 
field that must come from the same object. What if we refactored so that

java_lang_String::length(oop java_string, typeArrayOop value)

became

java_lang_String::length(typeArrayOop value, bool isLatin1)

would that also achieve the goal while presenting (IMHO) a cleaner API?

Thanks,
David

> Bug:    https://bugs.openjdk.java.net/browse/JDK-8217442
> Webrev: http://cr.openjdk.java.net/~redestad/8217442/open.00/
> 
> Testing: tier1-3 (ongoing/completed on some platforms)
> 
> /Claes


More information about the hotspot-runtime-dev mailing list