RFR: 8267870: Remove unnecessary char_converter during class loading

David Holmes dholmes at openjdk.java.net
Tue Jun 15 03:26:48 UTC 2021


On Mon, 24 May 2021 20:24:44 GMT, Coleen Phillimore <coleenp 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.

Hi Coleen,

Looks like a nice simplification if we never need a general purpose conversion utility.

I take it that Symbol::as_klass_external_name works correctly regardless of whether the name may be unicode or not? i.e that a `/` is always truly a slash and not part of some unicode sequence?

Thanks,
David

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?

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.

-------------

Marked as reviewed by dholmes (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/4173


More information about the hotspot-runtime-dev mailing list