RFR: 8272778: Consolidate is_instance and is_instance_inlined in java_lang_String

Claes Redestad redestad at openjdk.java.net
Fri Aug 20 19:12:23 UTC 2021


On Fri, 20 Aug 2021 18:20:57 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

>> src/hotspot/share/classfile/javaClasses.inline.hpp line 126:
>> 
>>> 124: }
>>> 125: 
>>> 126: bool java_lang_String::is_instance(oop obj) {
>> 
>> I don't really see anything wrong with this.  is_instance() is called above in asserts but that shouldn't affect performance by increasing the size of generated code.
>
> `is_instance()` is called in non-assertion code as well, e.g. `ConstantPool::add_dumped_interned_strings`. By merging the two versions, one wouldn't use the potentially slower version by accident, and it's also more consistent with `is_instance` of other classes (e.g. `java_lang_Class`) in the same file.

While `ConstantPool::add_dumped_interned_strings` might be an example of something that's not performance sensitive (even with dynamic CDS), the 0.02%/4Kb static size increase is less than concerning. Thanks for checking!

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

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


More information about the shenandoah-dev mailing list