8272778: Consolidate is_instance and is_instance_inlined in java_lang_String

Reviewed-by: coleenp, redestad
This commit is contained in:
Albert Mingkun Yang 2021-08-23 14:00:31 +00:00
parent d542745dbe
commit 594e5161b4
11 changed files with 12 additions and 16 deletions

View File

@ -206,9 +206,6 @@ int java_lang_String::_flags_offset;
bool java_lang_String::_initialized;
bool java_lang_String::is_instance(oop obj) {
return is_instance_inlined(obj);
}
bool java_lang_String::test_and_set_flag(oop java_string, uint8_t flag_mask) {
uint8_t* addr = flags_addr(java_string);

View File

@ -237,9 +237,8 @@ class java_lang_String : AllStatic {
static Symbol* as_symbol(oop java_string);
static Symbol* as_symbol_or_null(oop java_string);
// Testers
static bool is_instance(oop obj);
static inline bool is_instance_inlined(oop obj);
// Tester
static inline bool is_instance(oop obj);
// Debugging
static void print(oop java_string, outputStream* st);

View File

@ -123,7 +123,7 @@ int java_lang_String::length(oop java_string) {
return length(java_string, value);
}
bool java_lang_String::is_instance_inlined(oop obj) {
bool java_lang_String::is_instance(oop obj) {
return obj != NULL && obj->klass() == vmClasses::String_klass();
}

View File

@ -64,7 +64,7 @@ inline bool G1FullGCMarker::mark_object(oop obj) {
// Check if deduplicatable string.
if (StringDedup::is_enabled() &&
java_lang_String::is_instance_inlined(obj) &&
java_lang_String::is_instance(obj) &&
G1StringDedup::is_candidate_from_mark(obj)) {
_string_dedup_requests.add(obj);
}

View File

@ -111,7 +111,7 @@ inline void ParCompactionManager::mark_and_push(T* p) {
push(obj);
if (StringDedup::is_enabled() &&
java_lang_String::is_instance_inlined(obj) &&
java_lang_String::is_instance(obj) &&
psStringDedup::is_candidate_from_mark(obj)) {
_string_dedup_requests.add(obj);
}

View File

@ -287,7 +287,7 @@ inline oop PSPromotionManager::copy_unmarked_to_survivor_space(oop o,
push_contents(new_obj);
if (StringDedup::is_enabled() &&
java_lang_String::is_instance_inlined(new_obj) &&
java_lang_String::is_instance(new_obj) &&
psStringDedup::is_candidate_from_evacuation(new_obj, new_obj_is_tenured)) {
_string_dedup_requests.add(o);
}

View File

@ -40,7 +40,7 @@
inline void MarkSweep::mark_object(oop obj) {
if (StringDedup::is_enabled() &&
java_lang_String::is_instance_inlined(obj) &&
java_lang_String::is_instance(obj) &&
SerialStringDedup::is_candidate_from_mark(obj)) {
_string_dedup_requests->add(obj);
}

View File

@ -32,7 +32,7 @@
bool SerialStringDedup::is_candidate_from_evacuation(oop obj,
bool obj_is_tenured) {
return StringDedup::is_enabled() &&
java_lang_String::is_instance_inlined(obj) &&
java_lang_String::is_instance(obj) &&
(obj_is_tenured ?
StringDedup::is_below_threshold_age(obj->age()) :
StringDedup::is_threshold_age(obj->age()));

View File

@ -32,7 +32,7 @@
bool ShenandoahStringDedup::is_string_candidate(oop obj) {
assert(Thread::current()->is_Worker_thread(),
"Only from a GC worker thread");
return java_lang_String::is_instance_inlined(obj) &&
return java_lang_String::is_instance(obj) &&
java_lang_String::value(obj) != nullptr;
}

View File

@ -288,7 +288,7 @@ static void try_deduplicate(ZMarkContext* context, oop obj) {
return;
}
if (!java_lang_String::is_instance_inlined(obj)) {
if (!java_lang_String::is_instance(obj)) {
// Not a String object
return;
}

View File

@ -158,7 +158,7 @@ int MethodHandles::ref_kind_to_flags(int ref_kind) {
Handle MethodHandles::resolve_MemberName_type(Handle mname, Klass* caller, TRAPS) {
Handle empty;
Handle type(THREAD, java_lang_invoke_MemberName::type(mname()));
if (!java_lang_String::is_instance_inlined(type())) {
if (!java_lang_String::is_instance(type())) {
return type; // already resolved
}
Symbol* signature = java_lang_String::as_symbol_or_null(type());
@ -536,7 +536,7 @@ Symbol* MethodHandles::lookup_signature(oop type_str, bool intern_if_not_found,
return java_lang_invoke_MethodType::as_signature(type_str, intern_if_not_found);
} else if (java_lang_Class::is_instance(type_str)) {
return java_lang_Class::as_signature(type_str, false);
} else if (java_lang_String::is_instance_inlined(type_str)) {
} else if (java_lang_String::is_instance(type_str)) {
if (intern_if_not_found) {
return java_lang_String::as_symbol(type_str);
} else {