RFR: 8267870: Remove unnecessary char_converter during class loading
Coleen Phillimore
coleenp at openjdk.java.net
Tue Jun 15 14:54:48 UTC 2021
On Tue, 15 Jun 2021 03:10:12 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> We create a String object from a Symbol, then swap the '/' for '.' characters, and create another String object. Seems wasteful. Removed java_lang_String::char_converted and made externalize_classname take a Symbol.
>>
>> Tested with tier1-3 in mach5.
>
> src/hotspot/share/classfile/javaAssertions.cpp line 139:
>
>> 137: for (index = len - 1; p != 0; p = p->next(), --index) {
>> 138: assert(index >= 0, "length does not match list");
>> 139: TempNewSymbol name = SymbolTable::new_symbol(p->name());
>
> Why do we need a temp symbol?
Because the new_symbol call will increment the Symbol* refcount in the SymbolTable, it's then copied to the java.lang.String, so the name isn't needed after this.
> src/hotspot/share/classfile/javaClasses.hpp line 231:
>
>> 229:
>> 230: // Conversion between '.' and '/' formats, and allocate a String from the result.
>> 231: static Handle externalize_classname(Symbol* java_string, TRAPS);
>
> Nit: java_name might be more apt.
Done!
-------------
PR: https://git.openjdk.java.net/jdk/pull/4173
More information about the hotspot-runtime-dev
mailing list