[9] RFR(S): 8164612: NoSuchMethodException when method name contains NULL or Latin-1 supplement character
Coleen Phillimore
coleen.phillimore at oracle.com
Wed Oct 26 12:11:58 UTC 2016
This looks good. Thank you for running the jck tests.
http://cr.openjdk.java.net/~thartmann/8164612/webrev.00/src/share/vm/utilities/utf8.hpp.udiff.html
I really like the refactoring into a template function. Can you add a
short comment here that the parameter 'length' is an input and output
parameter? ie. not just output.
http://cr.openjdk.java.net/~thartmann/8164612/webrev.00/src/share/vm/utilities/utf8.cpp.udiff.html
And a comment here at
+ length = utf8_len;
Just something to point out that the length passed in has been adjusted
for utf8 encoding.
I don't need to see another webrev for these comment changes.
Thanks,
Coleen
On 10/25/16 8:43 AM, Tobias Hartmann wrote:
> [Ping]
>
> As Coleen requested, I executed the JCK/VM tests (see comment in bug).
>
> Best regards,
> Tobias
>
> On 20.10.2016 08:50, Tobias Hartmann wrote:
>> Hi,
>>
>> since this is affecting runtime code, could someone from the runtime team please have a look as well?
>>
>> Thanks,
>> Tobias
>>
>> On 18.10.2016 15:25, Tobias Hartmann wrote:
>>> Hi,
>>>
>>> please review the following patch:
>>> https://bugs.openjdk.java.net/browse/JDK-8164612
>>> http://cr.openjdk.java.net/~thartmann/8164612/webrev.00/
>>>
>>> The test executes Java Script code that defines getter methods containing Latin-1 supplement characters (0x80 - 0xFF). Those methods are registered at runtime through anonymous classes via Unsafe_DefineAnonymousClass. When calling a method, the VM fails with a NoSuchMethodException in MethodHandles::resolve_MemberName().
>>>
>>> The failure happens while looking up the method name symbol in java_lang_String::as_symbol_or_null() [1]:
>>> 544 jbyte* position = (length == 0) ? NULL : value->byte_at_addr(0);
>>> 545 const char* base = UNICODE::as_utf8(position, length);
>>> 546 return SymbolTable::probe(base, length);
>>>
>>> If Compact Strings is enabled, we pass the Latin-1 encoded method name to UNICODE::as_utf8() and probe for the UTF-8 String in the SymbolTable. Since the Latin-1 method name contains non-ASCII characters, the length of the resulting UTF-8 String is larger (characters >= 0x80 are encoded as two bytes in UTF-8). However, we pass the shorter Latin-1 length to SymbolTable::probe() resulting in a lookup failure.
>>>
>>> I fixed this by passing the String length by reference to UNICODE::as_utf8(). I also refactored the related code in utf8.cpp, added comments and updated the callers.
>>>
>>> Tested with regression test and hs-comp PIT RBT (running).
>>>
>>> Thanks,
>>> Tobias,
>>>
>>> [1] http://hg.openjdk.java.net/jdk9/hs/hotspot/file/652537a80080/src/share/vm/classfile/javaClasses.cpp#l535
>>>
More information about the hotspot-dev
mailing list