From cb25363cbfe3bcacfd150eecff6ea7412b990879 Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Thu, 18 Dec 2025 14:38:48 +0100 Subject: [PATCH 1/2] 8374007: [lworld] Remove dead code in Symbol --- src/hotspot/share/oops/symbol.cpp | 40 ------------------------------- src/hotspot/share/oops/symbol.hpp | 3 --- 2 files changed, 43 deletions(-) diff --git a/src/hotspot/share/oops/symbol.cpp b/src/hotspot/share/oops/symbol.cpp index f8f04f022ba..65a5015350c 100644 --- a/src/hotspot/share/oops/symbol.cpp +++ b/src/hotspot/share/oops/symbol.cpp @@ -84,46 +84,6 @@ void Symbol::set_permanent() { } #endif -Symbol* Symbol::fundamental_name(TRAPS) { - if (char_at(0) == JVM_SIGNATURE_CLASS && ends_with(JVM_SIGNATURE_ENDCLASS)) { - return SymbolTable::new_symbol(this, 1, utf8_length() - 1); - } else { - // reference count is incremented to be consistent with the behavior with - // the SymbolTable::new_symbol() call above - this->increment_refcount(); - return this; - } -} - -bool Symbol::is_same_fundamental_type(Symbol* s) const { - if (this == s) return true; - if (utf8_length() < 3) return false; - int offset1, offset2, len; - if (ends_with(JVM_SIGNATURE_ENDCLASS)) { - if (char_at(0) != JVM_SIGNATURE_CLASS) return false; - offset1 = 1; - len = utf8_length() - 2; - } else { - offset1 = 0; - len = utf8_length(); - } - if (ends_with(JVM_SIGNATURE_ENDCLASS)) { - if (s->char_at(0) != JVM_SIGNATURE_CLASS) return false; - offset2 = 1; - } else { - offset2 = 0; - } - if ((offset2 + len) > s->utf8_length()) return false; - if ((utf8_length() - offset1 * 2) != (s->utf8_length() - offset2 * 2)) - return false; - int l = len; - while (l-- > 0) { - if (char_at(offset1 + l) != s->char_at(offset2 + l)) - return false; - } - return true; -} - // ------------------------------------------------------------------ // Symbol::index_of // diff --git a/src/hotspot/share/oops/symbol.hpp b/src/hotspot/share/oops/symbol.hpp index e4355afe64a..e92f2d2f701 100644 --- a/src/hotspot/share/oops/symbol.hpp +++ b/src/hotspot/share/oops/symbol.hpp @@ -246,9 +246,6 @@ class Symbol : public MetaspaceObj { return starts_with('(') && ends_with('V'); } - Symbol* fundamental_name(TRAPS); - bool is_same_fundamental_type(Symbol*) const; - // Test if the symbol has the give substring at or after the i-th char. int index_of_at(int i, const char* substr, int substr_len) const; From d62c04d5d8642d61891052da1564042e84434282 Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Thu, 18 Dec 2025 15:30:37 +0100 Subject: [PATCH 2/2] 8374016: [lworld] Too late checked_cast in ResolvedFieldEntry::set_flags --- .../share/interpreter/interpreterRuntime.cpp | 6 ++- src/hotspot/share/oops/resolvedFieldEntry.hpp | 40 ++++++++++--------- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/src/hotspot/share/interpreter/interpreterRuntime.cpp b/src/hotspot/share/interpreter/interpreterRuntime.cpp index c9598c1f17d..f14aeae3859 100644 --- a/src/hotspot/share/interpreter/interpreterRuntime.cpp +++ b/src/hotspot/share/interpreter/interpreterRuntime.cpp @@ -802,8 +802,10 @@ void InterpreterRuntime::resolve_get_put(Bytecodes::Code bytecode, int field_ind } ResolvedFieldEntry* entry = pool->resolved_field_entry_at(field_index); - entry->set_flags(info.access_flags().is_final(), info.access_flags().is_volatile(), - info.is_flat(), info.is_null_free_inline_type(), + entry->set_flags(info.access_flags().is_volatile(), + info.access_flags().is_final(), + info.is_flat(), + info.is_null_free_inline_type(), info.has_null_marker()); entry->fill_in(info.field_holder(), info.offset(), diff --git a/src/hotspot/share/oops/resolvedFieldEntry.hpp b/src/hotspot/share/oops/resolvedFieldEntry.hpp index 76356ca9274..a187fe7f3ce 100644 --- a/src/hotspot/share/oops/resolvedFieldEntry.hpp +++ b/src/hotspot/share/oops/resolvedFieldEntry.hpp @@ -80,7 +80,6 @@ class ResolvedFieldEntry { ResolvedFieldEntry(0) {} // Bit shift to get flags - // Note: Only two flags exists at the moment but more could be added enum { is_volatile_shift = 0, is_final_shift = 1, // unused @@ -91,18 +90,18 @@ class ResolvedFieldEntry { }; // Getters - InstanceKlass* field_holder() const { return _field_holder; } - int field_offset() const { return _field_offset; } - u2 field_index() const { return _field_index; } - u2 constant_pool_index() const { return _cpool_index; } - u1 tos_state() const { return _tos_state; } - u1 get_code() const { return AtomicAccess::load_acquire(&_get_code); } - u1 put_code() const { return AtomicAccess::load_acquire(&_put_code); } - bool is_final() const { return (_flags & (1 << is_final_shift)) != 0; } - bool is_volatile () const { return (_flags & (1 << is_volatile_shift)) != 0; } - bool is_flat() const { return (_flags & (1 << is_flat_shift)) != 0; } + InstanceKlass* field_holder() const { return _field_holder; } + int field_offset() const { return _field_offset; } + u2 field_index() const { return _field_index; } + u2 constant_pool_index() const { return _cpool_index; } + u1 tos_state() const { return _tos_state; } + u1 get_code() const { return AtomicAccess::load_acquire(&_get_code); } + u1 put_code() const { return AtomicAccess::load_acquire(&_put_code); } + bool is_volatile () const { return (_flags & (1 << is_volatile_shift)) != 0; } + bool is_final() const { return (_flags & (1 << is_final_shift)) != 0; } + bool is_flat() const { return (_flags & (1 << is_flat_shift)) != 0; } bool is_null_free_inline_type() const { return (_flags & (1 << is_null_free_inline_type_shift)) != 0; } - bool has_null_marker() const { return (_flags & (1 << has_null_marker_shift)) != 0; } + bool has_null_marker() const { return (_flags & (1 << has_null_marker_shift)) != 0; } bool is_resolved(Bytecodes::Code code) const { switch(code) { case Bytecodes::_getstatic: @@ -120,15 +119,20 @@ class ResolvedFieldEntry { // Printing void print_on(outputStream* st) const; - void set_flags(bool is_final_flag, bool is_volatile_flag, bool is_flat_flag, bool is_null_free_inline_type_flag, + void set_flags(bool is_volatile_flag, + bool is_final_flag, + bool is_flat_flag, + bool is_null_free_inline_type_flag, bool has_null_marker_flag) { - u1 new_flags = ((is_final_flag ? 1 : 0) << is_final_shift) | static_cast(is_volatile_flag) | - ((is_flat_flag ? 1 : 0) << is_flat_shift) | - ((is_null_free_inline_type_flag ? 1 : 0) << is_null_free_inline_type_shift) | - ((has_null_marker_flag ? 1 : 0) << has_null_marker_shift); + int new_flags = + ((is_volatile_flag ? 1 : 0) << is_volatile_shift) | + ((is_final_flag ? 1 : 0) << is_final_shift) | + ((is_flat_flag ? 1 : 0) << is_flat_shift) | + ((is_null_free_inline_type_flag ? 1 : 0) << is_null_free_inline_type_shift) | + ((has_null_marker_flag ? 1 : 0) << has_null_marker_shift); _flags = checked_cast(new_flags); - assert(is_final() == is_final_flag, "Must be"); assert(is_volatile() == is_volatile_flag, "Must be"); + assert(is_final() == is_final_flag, "Must be"); assert(is_flat() == is_flat_flag, "Must be"); assert(is_null_free_inline_type() == is_null_free_inline_type_flag, "Must be"); assert(has_null_marker() == has_null_marker_flag, "Must be");