8230841: Remove oopDesc::equals()

Reviewed-by: rkennke, tschatzl
This commit is contained in:
Per Lidén 2019-09-17 09:51:02 +02:00
parent cb50d3b4f3
commit 2d6874b861
52 changed files with 119 additions and 132 deletions

View file

@ -539,7 +539,7 @@ ciKlass* ciEnv::get_klass_by_index_impl(const constantPoolHandle& cpool,
// Calculate accessibility the hard way. // Calculate accessibility the hard way.
if (!k->is_loaded()) { if (!k->is_loaded()) {
is_accessible = false; is_accessible = false;
} else if (!oopDesc::equals(k->loader(), accessor->loader()) && } else if (k->loader() != accessor->loader() &&
get_klass_by_name_impl(accessor, cpool, k->name(), true) == NULL) { get_klass_by_name_impl(accessor, cpool, k->name(), true) == NULL) {
// Loaded only remotely. Not linked yet. // Loaded only remotely. Not linked yet.
is_accessible = false; is_accessible = false;
@ -590,7 +590,7 @@ ciConstant ciEnv::get_constant_by_index_impl(const constantPoolHandle& cpool,
index = cpool->object_to_cp_index(cache_index); index = cpool->object_to_cp_index(cache_index);
oop obj = cpool->resolved_references()->obj_at(cache_index); oop obj = cpool->resolved_references()->obj_at(cache_index);
if (obj != NULL) { if (obj != NULL) {
if (oopDesc::equals(obj, Universe::the_null_sentinel())) { if (obj == Universe::the_null_sentinel()) {
return ciConstant(T_OBJECT, get_object(NULL)); return ciConstant(T_OBJECT, get_object(NULL));
} }
BasicType bt = T_OBJECT; BasicType bt = T_OBJECT;

View file

@ -250,7 +250,7 @@ ciObject* ciObjectFactory::get(oop key) {
// into the cache. // into the cache.
Handle keyHandle(Thread::current(), key); Handle keyHandle(Thread::current(), key);
ciObject* new_object = create_new_object(keyHandle()); ciObject* new_object = create_new_object(keyHandle());
assert(oopDesc::equals(keyHandle(), new_object->get_oop()), "must be properly recorded"); assert(keyHandle() == new_object->get_oop(), "must be properly recorded");
init_ident_of(new_object); init_ident_of(new_object);
assert(Universe::heap()->is_in(new_object->get_oop()), "must be"); assert(Universe::heap()->is_in(new_object->get_oop()), "must be");
@ -469,8 +469,8 @@ ciKlass* ciObjectFactory::get_unloaded_klass(ciKlass* accessing_klass,
for (int i=0; i<_unloaded_klasses->length(); i++) { for (int i=0; i<_unloaded_klasses->length(); i++) {
ciKlass* entry = _unloaded_klasses->at(i); ciKlass* entry = _unloaded_klasses->at(i);
if (entry->name()->equals(name) && if (entry->name()->equals(name) &&
oopDesc::equals(entry->loader(), loader) && entry->loader() == loader &&
oopDesc::equals(entry->protection_domain(), domain)) { entry->protection_domain() == domain) {
// We've found a match. // We've found a match.
return entry; return entry;
} }

View file

@ -74,7 +74,7 @@ private:
ciMetadata* create_new_metadata(Metadata* o); ciMetadata* create_new_metadata(Metadata* o);
static bool is_equal(NonPermObject* p, oop key) { static bool is_equal(NonPermObject* p, oop key) {
return oopDesc::equals(p->object()->get_oop(), key); return p->object()->get_oop() == key;
} }
NonPermObject* &find_non_perm(oop key); NonPermObject* &find_non_perm(oop key);

View file

@ -232,7 +232,7 @@ class VerifyContainsOopClosure : public OopClosure {
VerifyContainsOopClosure(oop target) : _target(target), _found(false) {} VerifyContainsOopClosure(oop target) : _target(target), _found(false) {}
void do_oop(oop* p) { void do_oop(oop* p) {
if (p != NULL && oopDesc::equals(NativeAccess<AS_NO_KEEPALIVE>::oop_load(p), _target)) { if (p != NULL && NativeAccess<AS_NO_KEEPALIVE>::oop_load(p) == _target) {
_found = true; _found = true;
} }
} }
@ -433,7 +433,7 @@ void ClassLoaderData::record_dependency(const Klass* k) {
// Just return if this dependency is to a class with the same or a parent // Just return if this dependency is to a class with the same or a parent
// class_loader. // class_loader.
if (oopDesc::equals(from, to) || java_lang_ClassLoader::isAncestor(from, to)) { if (from == to || java_lang_ClassLoader::isAncestor(from, to)) {
return; // this class loader is in the parent list, no need to add it. return; // this class loader is in the parent list, no need to add it.
} }
} }

View file

@ -98,7 +98,7 @@ public:
class ClassLoaderStatsClosure : public CLDClosure { class ClassLoaderStatsClosure : public CLDClosure {
protected: protected:
static bool oop_equals(oop const& s1, oop const& s2) { static bool oop_equals(oop const& s1, oop const& s2) {
return oopDesc::equals(s1, s2); return s1 == s2;
} }
static unsigned oop_hash(oop const& s1) { static unsigned oop_hash(oop const& s1) {

View file

@ -153,13 +153,13 @@ bool DictionaryEntry::contains_protection_domain(oop protection_domain) const {
// a Dictionary entry, which can be moved if the Dictionary is resized. // a Dictionary entry, which can be moved if the Dictionary is resized.
MutexLocker ml(ProtectionDomainSet_lock, Mutex::_no_safepoint_check_flag); MutexLocker ml(ProtectionDomainSet_lock, Mutex::_no_safepoint_check_flag);
#ifdef ASSERT #ifdef ASSERT
if (oopDesc::equals(protection_domain, instance_klass()->protection_domain())) { if (protection_domain == instance_klass()->protection_domain()) {
// Ensure this doesn't show up in the pd_set (invariant) // Ensure this doesn't show up in the pd_set (invariant)
bool in_pd_set = false; bool in_pd_set = false;
for (ProtectionDomainEntry* current = pd_set(); for (ProtectionDomainEntry* current = pd_set();
current != NULL; current != NULL;
current = current->next()) { current = current->next()) {
if (oopDesc::equals(current->object_no_keepalive(), protection_domain)) { if (current->object_no_keepalive() == protection_domain) {
in_pd_set = true; in_pd_set = true;
break; break;
} }
@ -171,7 +171,7 @@ bool DictionaryEntry::contains_protection_domain(oop protection_domain) const {
} }
#endif /* ASSERT */ #endif /* ASSERT */
if (oopDesc::equals(protection_domain, instance_klass()->protection_domain())) { if (protection_domain == instance_klass()->protection_domain()) {
// Succeeds trivially // Succeeds trivially
return true; return true;
} }
@ -179,7 +179,7 @@ bool DictionaryEntry::contains_protection_domain(oop protection_domain) const {
for (ProtectionDomainEntry* current = pd_set(); for (ProtectionDomainEntry* current = pd_set();
current != NULL; current != NULL;
current = current->next()) { current = current->next()) {
if (oopDesc::equals(current->object_no_keepalive(), protection_domain)) return true; if (current->object_no_keepalive() == protection_domain) return true;
} }
return false; return false;
} }

View file

@ -878,7 +878,7 @@ void java_lang_Class::set_mirror_module_field(Klass* k, Handle mirror, Handle mo
} else { } else {
assert(Universe::is_module_initialized() || assert(Universe::is_module_initialized() ||
(ModuleEntryTable::javabase_defined() && (ModuleEntryTable::javabase_defined() &&
(oopDesc::equals(module(), ModuleEntryTable::javabase_moduleEntry()->module()))), (module() == ModuleEntryTable::javabase_moduleEntry()->module())),
"Incorrect java.lang.Module specification while creating mirror"); "Incorrect java.lang.Module specification while creating mirror");
set_module(mirror(), module()); set_module(mirror(), module());
} }
@ -955,7 +955,7 @@ void java_lang_Class::create_mirror(Klass* k, Handle class_loader,
} }
// set the classLoader field in the java_lang_Class instance // set the classLoader field in the java_lang_Class instance
assert(oopDesc::equals(class_loader(), k->class_loader()), "should be same"); assert(class_loader() == k->class_loader(), "should be same");
set_class_loader(mirror(), class_loader()); set_class_loader(mirror(), class_loader());
// Setup indirection from klass->mirror // Setup indirection from klass->mirror
@ -1510,9 +1510,9 @@ BasicType java_lang_Class::primitive_type(oop java_class) {
// Note: create_basic_type_mirror above initializes ak to a non-null value. // Note: create_basic_type_mirror above initializes ak to a non-null value.
type = ArrayKlass::cast(ak)->element_type(); type = ArrayKlass::cast(ak)->element_type();
} else { } else {
assert(oopDesc::equals(java_class, Universe::void_mirror()), "only valid non-array primitive"); assert(java_class == Universe::void_mirror(), "only valid non-array primitive");
} }
assert(oopDesc::equals(Universe::java_mirror(type), java_class), "must be consistent"); assert(Universe::java_mirror(type) == java_class, "must be consistent");
return type; return type;
} }
@ -3712,14 +3712,14 @@ Symbol* java_lang_invoke_MethodType::as_signature(oop mt, bool intern_if_not_fou
} }
bool java_lang_invoke_MethodType::equals(oop mt1, oop mt2) { bool java_lang_invoke_MethodType::equals(oop mt1, oop mt2) {
if (oopDesc::equals(mt1, mt2)) if (mt1 == mt2)
return true; return true;
if (!oopDesc::equals(rtype(mt1), rtype(mt2))) if (rtype(mt1) != rtype(mt2))
return false; return false;
if (ptype_count(mt1) != ptype_count(mt2)) if (ptype_count(mt1) != ptype_count(mt2))
return false; return false;
for (int i = ptype_count(mt1) - 1; i >= 0; i--) { for (int i = ptype_count(mt1) - 1; i >= 0; i--) {
if (!oopDesc::equals(ptype(mt1, i), ptype(mt2, i))) if (ptype(mt1, i) != ptype(mt2, i))
return false; return false;
} }
return true; return true;
@ -3933,7 +3933,7 @@ bool java_lang_ClassLoader::isAncestor(oop loader, oop cl) {
// This loop taken verbatim from ClassLoader.java: // This loop taken verbatim from ClassLoader.java:
do { do {
acl = parent(acl); acl = parent(acl);
if (oopDesc::equals(cl, acl)) { if (cl == acl) {
return true; return true;
} }
assert(++loop_count > 0, "loop_count overflow"); assert(++loop_count > 0, "loop_count overflow");
@ -3963,7 +3963,7 @@ bool java_lang_ClassLoader::is_trusted_loader(oop loader) {
oop cl = SystemDictionary::java_system_loader(); oop cl = SystemDictionary::java_system_loader();
while(cl != NULL) { while(cl != NULL) {
if (oopDesc::equals(cl, loader)) return true; if (cl == loader) return true;
cl = parent(cl); cl = parent(cl);
} }
return false; return false;

View file

@ -52,7 +52,7 @@ bool java_lang_String::hash_is_set(oop java_string) {
// Accessors // Accessors
bool java_lang_String::value_equals(typeArrayOop str_value1, typeArrayOop str_value2) { bool java_lang_String::value_equals(typeArrayOop str_value1, typeArrayOop str_value2) {
return (oopDesc::equals(str_value1, str_value2) || return ((str_value1 == str_value2) ||
(str_value1->length() == str_value2->length() && (str_value1->length() == str_value2->length() &&
(!memcmp(str_value1->base(T_BYTE), (!memcmp(str_value1->base(T_BYTE),
str_value2->base(T_BYTE), str_value2->base(T_BYTE),

View file

@ -306,7 +306,7 @@ void Modules::define_module(jobject module, jboolean is_open, jstring version,
oop loader = java_lang_Module::loader(module_handle()); oop loader = java_lang_Module::loader(module_handle());
// Make sure loader is not the jdk.internal.reflect.DelegatingClassLoader. // Make sure loader is not the jdk.internal.reflect.DelegatingClassLoader.
if (!oopDesc::equals(loader, java_lang_ClassLoader::non_reflection_class_loader(loader))) { if (loader != java_lang_ClassLoader::non_reflection_class_loader(loader)) {
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"Class loader is an invalid delegating class loader"); "Class loader is an invalid delegating class loader");
} }

View file

@ -160,7 +160,7 @@ ProtectionDomainCacheEntry* ProtectionDomainCacheTable::get(Handle protection_do
ProtectionDomainCacheEntry* ProtectionDomainCacheTable::find_entry(int index, Handle protection_domain) { ProtectionDomainCacheEntry* ProtectionDomainCacheTable::find_entry(int index, Handle protection_domain) {
assert_locked_or_safepoint(SystemDictionary_lock); assert_locked_or_safepoint(SystemDictionary_lock);
for (ProtectionDomainCacheEntry* e = bucket(index); e != NULL; e = e->next()) { for (ProtectionDomainCacheEntry* e = bucket(index); e != NULL; e = e->next()) {
if (oopDesc::equals(e->object_no_keepalive(), protection_domain())) { if (e->object_no_keepalive() == protection_domain()) {
return e; return e;
} }
} }

View file

@ -177,7 +177,7 @@ bool SystemDictionary::is_system_class_loader(oop class_loader) {
return false; return false;
} }
return (class_loader->klass() == SystemDictionary::jdk_internal_loader_ClassLoaders_AppClassLoader_klass() || return (class_loader->klass() == SystemDictionary::jdk_internal_loader_ClassLoaders_AppClassLoader_klass() ||
oopDesc::equals(class_loader, _java_system_loader)); class_loader == _java_system_loader);
} }
// Returns true if the passed class loader is the platform class loader. // Returns true if the passed class loader is the platform class loader.
@ -393,7 +393,7 @@ InstanceKlass* SystemDictionary::resolve_super_or_fail(Symbol* child_name,
if ((childk != NULL ) && (is_superclass) && if ((childk != NULL ) && (is_superclass) &&
((quicksuperk = childk->java_super()) != NULL) && ((quicksuperk = childk->java_super()) != NULL) &&
((quicksuperk->name() == super_name) && ((quicksuperk->name() == super_name) &&
(oopDesc::equals(quicksuperk->class_loader(), class_loader())))) { (quicksuperk->class_loader() == class_loader()))) {
return quicksuperk; return quicksuperk;
} else { } else {
PlaceholderEntry* probe = placeholders()->get_entry(p_index, p_hash, child_name, loader_data); PlaceholderEntry* probe = placeholders()->get_entry(p_index, p_hash, child_name, loader_data);
@ -542,7 +542,7 @@ void SystemDictionary::double_lock_wait(Handle lockObject, TRAPS) {
bool calledholdinglock bool calledholdinglock
= ObjectSynchronizer::current_thread_holds_lock((JavaThread*)THREAD, lockObject); = ObjectSynchronizer::current_thread_holds_lock((JavaThread*)THREAD, lockObject);
assert(calledholdinglock,"must hold lock for notify"); assert(calledholdinglock,"must hold lock for notify");
assert((!oopDesc::equals(lockObject(), _system_loader_lock_obj) && !is_parallelCapable(lockObject)), "unexpected double_lock_wait"); assert((lockObject() != _system_loader_lock_obj && !is_parallelCapable(lockObject)), "unexpected double_lock_wait");
ObjectSynchronizer::notifyall(lockObject, THREAD); ObjectSynchronizer::notifyall(lockObject, THREAD);
intptr_t recursions = ObjectSynchronizer::complete_exit(lockObject, THREAD); intptr_t recursions = ObjectSynchronizer::complete_exit(lockObject, THREAD);
SystemDictionary_lock->wait(); SystemDictionary_lock->wait();
@ -850,7 +850,7 @@ InstanceKlass* SystemDictionary::resolve_instance_class_or_null(Symbol* name,
// If everything was OK (no exceptions, no null return value), and // If everything was OK (no exceptions, no null return value), and
// class_loader is NOT the defining loader, do a little more bookkeeping. // class_loader is NOT the defining loader, do a little more bookkeeping.
if (!HAS_PENDING_EXCEPTION && k != NULL && if (!HAS_PENDING_EXCEPTION && k != NULL &&
!oopDesc::equals(k->class_loader(), class_loader())) { k->class_loader() != class_loader()) {
check_constraints(d_hash, k, class_loader, false, THREAD); check_constraints(d_hash, k, class_loader, false, THREAD);
@ -1003,7 +1003,7 @@ InstanceKlass* SystemDictionary::parse_stream(Symbol* class_name,
if (unsafe_anonymous_host != NULL) { if (unsafe_anonymous_host != NULL) {
// Create a new CLD for an unsafe anonymous class, that uses the same class loader // Create a new CLD for an unsafe anonymous class, that uses the same class loader
// as the unsafe_anonymous_host // as the unsafe_anonymous_host
guarantee(oopDesc::equals(unsafe_anonymous_host->class_loader(), class_loader()), "should be the same"); guarantee(unsafe_anonymous_host->class_loader() == class_loader(), "should be the same");
loader_data = ClassLoaderData::unsafe_anonymous_class_loader_data(class_loader); loader_data = ClassLoaderData::unsafe_anonymous_class_loader_data(class_loader);
} else { } else {
loader_data = ClassLoaderData::class_loader_data(class_loader()); loader_data = ClassLoaderData::class_loader_data(class_loader());
@ -1729,7 +1729,7 @@ void SystemDictionary::check_loader_lock_contention(Handle loader_lock, TRAPS) {
== ObjectSynchronizer::owner_other) { == ObjectSynchronizer::owner_other) {
// contention will likely happen, so increment the corresponding // contention will likely happen, so increment the corresponding
// contention counter. // contention counter.
if (oopDesc::equals(loader_lock(), _system_loader_lock_obj)) { if (loader_lock() == _system_loader_lock_obj) {
ClassLoader::sync_systemLoaderLockContentionRate()->inc(); ClassLoader::sync_systemLoaderLockContentionRate()->inc();
} else { } else {
ClassLoader::sync_nonSystemLoaderLockContentionRate()->inc(); ClassLoader::sync_nonSystemLoaderLockContentionRate()->inc();
@ -2150,7 +2150,7 @@ void SystemDictionary::update_dictionary(unsigned int d_hash,
// cleared if revocation occurs too often for this type // cleared if revocation occurs too often for this type
// NOTE that we must only do this when the class is initally // NOTE that we must only do this when the class is initally
// defined, not each time it is referenced from a new class loader // defined, not each time it is referenced from a new class loader
if (oopDesc::equals(k->class_loader(), class_loader())) { if (k->class_loader() == class_loader()) {
k->set_prototype_header(markWord::biased_locking_prototype()); k->set_prototype_header(markWord::biased_locking_prototype());
} }
} }
@ -2343,7 +2343,7 @@ Symbol* SystemDictionary::check_signature_loaders(Symbol* signature,
Handle loader1, Handle loader2, Handle loader1, Handle loader2,
bool is_method, TRAPS) { bool is_method, TRAPS) {
// Nothing to do if loaders are the same. // Nothing to do if loaders are the same.
if (oopDesc::equals(loader1(), loader2())) { if (loader1() == loader2()) {
return NULL; return NULL;
} }

View file

@ -1813,12 +1813,12 @@ Klass* Dependencies::check_call_site_target_value(oop call_site, oop method_hand
if (changes == NULL) { if (changes == NULL) {
// Validate all CallSites // Validate all CallSites
if (!oopDesc::equals(java_lang_invoke_CallSite::target(call_site), method_handle)) if (java_lang_invoke_CallSite::target(call_site) != method_handle)
return call_site->klass(); // assertion failed return call_site->klass(); // assertion failed
} else { } else {
// Validate the given CallSite // Validate the given CallSite
if (oopDesc::equals(call_site, changes->call_site()) && !oopDesc::equals(java_lang_invoke_CallSite::target(call_site), changes->method_handle())) { if (call_site == changes->call_site() && java_lang_invoke_CallSite::target(call_site) != changes->method_handle()) {
assert(!oopDesc::equals(method_handle, changes->method_handle()), "must be"); assert(method_handle != changes->method_handle(), "must be");
return call_site->klass(); // assertion failed return call_site->klass(); // assertion failed
} }
} }

View file

@ -316,7 +316,7 @@ static bool can_remove(CompilerThread *ct, bool do_it) {
// We only allow the last compiler thread of each type to get removed. // We only allow the last compiler thread of each type to get removed.
jobject last_compiler = c1 ? CompileBroker::compiler1_object(compiler_count - 1) jobject last_compiler = c1 ? CompileBroker::compiler1_object(compiler_count - 1)
: CompileBroker::compiler2_object(compiler_count - 1); : CompileBroker::compiler2_object(compiler_count - 1);
if (oopDesc::equals(ct->threadObj(), JNIHandles::resolve_non_null(last_compiler))) { if (ct->threadObj() == JNIHandles::resolve_non_null(last_compiler)) {
if (do_it) { if (do_it) {
assert_locked_or_safepoint(CompileThread_lock); // Update must be consistent. assert_locked_or_safepoint(CompileThread_lock); // Update must be consistent.
compiler->set_num_compiler_threads(compiler_count - 1); compiler->set_num_compiler_threads(compiler_count - 1);
@ -1687,7 +1687,7 @@ CompileLog* CompileBroker::get_log(CompilerThread* ct) {
int compiler_number = 0; int compiler_number = 0;
bool found = false; bool found = false;
for (; compiler_number < count; compiler_number++) { for (; compiler_number < count; compiler_number++) {
if (oopDesc::equals(JNIHandles::resolve_non_null(compiler_objects[compiler_number]), compiler_obj)) { if (JNIHandles::resolve_non_null(compiler_objects[compiler_number]) == compiler_obj) {
found = true; found = true;
break; break;
} }

View file

@ -282,7 +282,7 @@ void DiscoveredListIterator::remove() {
// First _prev_next ref actually points into DiscoveredList (gross). // First _prev_next ref actually points into DiscoveredList (gross).
oop new_next; oop new_next;
if (oopDesc::equals_raw(_next_discovered, _current_discovered)) { if (_next_discovered == _current_discovered) {
// At the end of the list, we should make _prev point to itself. // At the end of the list, we should make _prev point to itself.
// If _ref is the first ref, then _prev_next will be in the DiscoveredList, // If _ref is the first ref, then _prev_next will be in the DiscoveredList,
// and _prev will be NULL. // and _prev will be NULL.
@ -472,7 +472,7 @@ void
ReferenceProcessor::clear_discovered_references(DiscoveredList& refs_list) { ReferenceProcessor::clear_discovered_references(DiscoveredList& refs_list) {
oop obj = NULL; oop obj = NULL;
oop next = refs_list.head(); oop next = refs_list.head();
while (!oopDesc::equals_raw(next, obj)) { while (next != obj) {
obj = next; obj = next;
next = java_lang_ref_Reference::discovered(obj); next = java_lang_ref_Reference::discovered(obj);
java_lang_ref_Reference::set_discovered_raw(obj, NULL); java_lang_ref_Reference::set_discovered_raw(obj, NULL);
@ -744,7 +744,7 @@ void ReferenceProcessor::balance_queues(DiscoveredList ref_lists[])
ref_lists[to_idx].inc_length(refs_to_move); ref_lists[to_idx].inc_length(refs_to_move);
// Remove the chain from the from list. // Remove the chain from the from list.
if (oopDesc::equals_raw(move_tail, new_head)) { if (move_tail == new_head) {
// We found the end of the from list. // We found the end of the from list.
ref_lists[from_idx].set_head(NULL); ref_lists[from_idx].set_head(NULL);
} else { } else {

View file

@ -143,13 +143,13 @@ public:
inline size_t removed() const { return _removed; } inline size_t removed() const { return _removed; }
inline void move_to_next() { inline void move_to_next() {
if (oopDesc::equals_raw(_current_discovered, _next_discovered)) { if (_current_discovered == _next_discovered) {
// End of the list. // End of the list.
_current_discovered = NULL; _current_discovered = NULL;
} else { } else {
_current_discovered = _next_discovered; _current_discovered = _next_discovered;
} }
assert(!oopDesc::equals_raw(_current_discovered, _first_seen), "cyclic ref_list found"); assert(_current_discovered != _first_seen, "cyclic ref_list found");
_processed++; _processed++;
} }
}; };

View file

@ -363,7 +363,7 @@ void StringDedupTable::deduplicate(oop java_string, StringDedupStat* stat) {
} }
typeArrayOop existing_value = lookup_or_add(value, latin1, hash); typeArrayOop existing_value = lookup_or_add(value, latin1, hash);
if (oopDesc::equals_raw(existing_value, value)) { if (existing_value == value) {
// Same value, already known // Same value, already known
stat->inc_known(); stat->inc_known();
return; return;

View file

@ -142,7 +142,7 @@ void ShenandoahAsserts::print_failure(SafeLevel level, oop obj, void* interior_l
if (level >= _safe_oop) { if (level >= _safe_oop) {
oop fwd = (oop) ShenandoahForwarding::get_forwardee_raw_unchecked(obj); oop fwd = (oop) ShenandoahForwarding::get_forwardee_raw_unchecked(obj);
msg.append("Forwardee:\n"); msg.append("Forwardee:\n");
if (!oopDesc::equals_raw(obj, fwd)) { if (obj != fwd) {
if (level >= _safe_oop_fwd) { if (level >= _safe_oop_fwd) {
print_obj(msg, fwd); print_obj(msg, fwd);
} else { } else {
@ -157,7 +157,7 @@ void ShenandoahAsserts::print_failure(SafeLevel level, oop obj, void* interior_l
if (level >= _safe_oop_fwd) { if (level >= _safe_oop_fwd) {
oop fwd = (oop) ShenandoahForwarding::get_forwardee_raw_unchecked(obj); oop fwd = (oop) ShenandoahForwarding::get_forwardee_raw_unchecked(obj);
oop fwd2 = (oop) ShenandoahForwarding::get_forwardee_raw_unchecked(fwd); oop fwd2 = (oop) ShenandoahForwarding::get_forwardee_raw_unchecked(fwd);
if (!oopDesc::equals_raw(fwd, fwd2)) { if (fwd != fwd2) {
msg.append("Second forwardee:\n"); msg.append("Second forwardee:\n");
print_obj_safe(msg, fwd2); print_obj_safe(msg, fwd2);
msg.append("\n"); msg.append("\n");
@ -203,7 +203,7 @@ void ShenandoahAsserts::assert_correct(void* interior_loc, oop obj, const char*
oop fwd = oop(ShenandoahForwarding::get_forwardee_raw_unchecked(obj)); oop fwd = oop(ShenandoahForwarding::get_forwardee_raw_unchecked(obj));
if (!oopDesc::equals_raw(obj, fwd)) { if (obj != fwd) {
// When Full GC moves the objects, we cannot trust fwdptrs. If we got here, it means something // When Full GC moves the objects, we cannot trust fwdptrs. If we got here, it means something
// tries fwdptr manipulation when Full GC is running. The only exception is using the fwdptr // tries fwdptr manipulation when Full GC is running. The only exception is using the fwdptr
// that still points to the object itself. // that still points to the object itself.
@ -235,7 +235,7 @@ void ShenandoahAsserts::assert_correct(void* interior_loc, oop obj, const char*
// Step 4. Check for multiple forwardings // Step 4. Check for multiple forwardings
oop fwd2 = oop(ShenandoahForwarding::get_forwardee_raw_unchecked(fwd)); oop fwd2 = oop(ShenandoahForwarding::get_forwardee_raw_unchecked(fwd));
if (!oopDesc::equals_raw(fwd, fwd2)) { if (fwd != fwd2) {
print_failure(_safe_all, obj, interior_loc, NULL, "Shenandoah assert_correct failed", print_failure(_safe_all, obj, interior_loc, NULL, "Shenandoah assert_correct failed",
"Multiple forwardings", "Multiple forwardings",
file, line); file, line);
@ -278,7 +278,7 @@ void ShenandoahAsserts::assert_forwarded(void* interior_loc, oop obj, const char
assert_correct(interior_loc, obj, file, line); assert_correct(interior_loc, obj, file, line);
oop fwd = oop(ShenandoahForwarding::get_forwardee_raw_unchecked(obj)); oop fwd = oop(ShenandoahForwarding::get_forwardee_raw_unchecked(obj));
if (oopDesc::equals_raw(obj, fwd)) { if (obj == fwd) {
print_failure(_safe_all, obj, interior_loc, NULL, "Shenandoah assert_forwarded failed", print_failure(_safe_all, obj, interior_loc, NULL, "Shenandoah assert_forwarded failed",
"Object should be forwarded", "Object should be forwarded",
file, line); file, line);
@ -289,7 +289,7 @@ void ShenandoahAsserts::assert_not_forwarded(void* interior_loc, oop obj, const
assert_correct(interior_loc, obj, file, line); assert_correct(interior_loc, obj, file, line);
oop fwd = oop(ShenandoahForwarding::get_forwardee_raw_unchecked(obj)); oop fwd = oop(ShenandoahForwarding::get_forwardee_raw_unchecked(obj));
if (!oopDesc::equals_raw(obj, fwd)) { if (obj != fwd) {
print_failure(_safe_all, obj, interior_loc, NULL, "Shenandoah assert_not_forwarded failed", print_failure(_safe_all, obj, interior_loc, NULL, "Shenandoah assert_not_forwarded failed",
"Object should not be forwarded", "Object should not be forwarded",
file, line); file, line);

View file

@ -238,7 +238,7 @@ oop ShenandoahBarrierSet::load_reference_barrier_mutator(oop obj) {
shenandoah_assert_in_cset(NULL, obj); shenandoah_assert_in_cset(NULL, obj);
oop fwd = resolve_forwarded_not_null(obj); oop fwd = resolve_forwarded_not_null(obj);
if (oopDesc::equals_raw(obj, fwd)) { if (obj == fwd) {
ShenandoahEvacOOMScope oom_evac_scope; ShenandoahEvacOOMScope oom_evac_scope;
Thread* thread = Thread::current(); Thread* thread = Thread::current();
@ -267,7 +267,7 @@ oop ShenandoahBarrierSet::load_reference_barrier_mutator(oop obj) {
size_t count = 0; size_t count = 0;
while ((cur < r->top()) && ctx->is_marked(oop(cur)) && (count++ < max)) { while ((cur < r->top()) && ctx->is_marked(oop(cur)) && (count++ < max)) {
oop cur_oop = oop(cur); oop cur_oop = oop(cur);
if (oopDesc::equals_raw(cur_oop, resolve_forwarded_not_null(cur_oop))) { if (cur_oop == resolve_forwarded_not_null(cur_oop)) {
_heap->evacuate_object(cur_oop, thread); _heap->evacuate_object(cur_oop, thread);
} }
cur = cur + cur_oop->size(); cur = cur + cur_oop->size();
@ -286,7 +286,7 @@ oop ShenandoahBarrierSet::load_reference_barrier_impl(oop obj) {
oop fwd = resolve_forwarded_not_null(obj); oop fwd = resolve_forwarded_not_null(obj);
if (evac_in_progress && if (evac_in_progress &&
_heap->in_collection_set(obj) && _heap->in_collection_set(obj) &&
oopDesc::equals_raw(obj, fwd)) { obj == fwd) {
Thread *t = Thread::current(); Thread *t = Thread::current();
if (t->is_GC_task_thread()) { if (t->is_GC_task_thread()) {
return _heap->evacuate_object(obj, t); return _heap->evacuate_object(obj, t);

View file

@ -103,7 +103,7 @@ inline oop ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_ato
compare_value = expected; compare_value = expected;
res = Raw::oop_atomic_cmpxchg(new_value, addr, compare_value); res = Raw::oop_atomic_cmpxchg(new_value, addr, compare_value);
expected = res; expected = res;
} while ((! oopDesc::equals_raw(compare_value, expected)) && oopDesc::equals_raw(resolve_forwarded(compare_value), resolve_forwarded(expected))); } while ((compare_value != expected) && (resolve_forwarded(compare_value) == resolve_forwarded(expected)));
if (res != NULL) { if (res != NULL) {
return ShenandoahBarrierSet::barrier_set()->load_reference_barrier_not_null(res); return ShenandoahBarrierSet::barrier_set()->load_reference_barrier_not_null(res);
} else { } else {
@ -118,7 +118,7 @@ inline oop ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_ato
oop result = oop_atomic_cmpxchg_not_in_heap(new_value, addr, compare_value); oop result = oop_atomic_cmpxchg_not_in_heap(new_value, addr, compare_value);
const bool keep_alive = (decorators & AS_NO_KEEPALIVE) == 0; const bool keep_alive = (decorators & AS_NO_KEEPALIVE) == 0;
if (keep_alive && ShenandoahSATBBarrier && !CompressedOops::is_null(result) && if (keep_alive && ShenandoahSATBBarrier && !CompressedOops::is_null(result) &&
oopDesc::equals_raw(result, compare_value) && (result == compare_value) &&
ShenandoahHeap::heap()->is_concurrent_mark_in_progress()) { ShenandoahHeap::heap()->is_concurrent_mark_in_progress()) {
ShenandoahBarrierSet::barrier_set()->enqueue(result); ShenandoahBarrierSet::barrier_set()->enqueue(result);
} }
@ -307,7 +307,7 @@ bool ShenandoahBarrierSet::arraycopy_element(T* cur_src, T* cur_dst, Klass* boun
case EVAC_BARRIER: case EVAC_BARRIER:
if (_heap->in_collection_set(obj)) { if (_heap->in_collection_set(obj)) {
oop forw = ShenandoahBarrierSet::resolve_forwarded_not_null(obj); oop forw = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
if (oopDesc::equals_raw(forw, obj)) { if (forw == obj) {
forw = _heap->evacuate_object(forw, thread); forw = _heap->evacuate_object(forw, thread);
} }
obj = forw; obj = forw;

View file

@ -92,7 +92,7 @@ void ShenandoahEvacuateUpdateRootsClosure::do_oop_work(T* p) {
if (_heap->in_collection_set(obj)) { if (_heap->in_collection_set(obj)) {
shenandoah_assert_marked(p, obj); shenandoah_assert_marked(p, obj);
oop resolved = ShenandoahBarrierSet::resolve_forwarded_not_null(obj); oop resolved = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
if (oopDesc::equals_raw(resolved, obj)) { if (resolved == obj) {
resolved = _heap->evacuate_object(obj, _thread); resolved = _heap->evacuate_object(obj, _thread);
} }
RawAccess<IS_NOT_NULL>::oop_store(p, resolved); RawAccess<IS_NOT_NULL>::oop_store(p, resolved);
@ -119,7 +119,7 @@ void ShenandoahEvacUpdateOopStorageRootsClosure::do_oop(oop* p) {
if (_heap->in_collection_set(obj)) { if (_heap->in_collection_set(obj)) {
shenandoah_assert_marked(p, obj); shenandoah_assert_marked(p, obj);
oop resolved = ShenandoahBarrierSet::resolve_forwarded_not_null(obj); oop resolved = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
if (oopDesc::equals_raw(resolved, obj)) { if (resolved == obj) {
resolved = _heap->evacuate_object(obj, _thread); resolved = _heap->evacuate_object(obj, _thread);
} }

View file

@ -113,11 +113,11 @@ inline oop ShenandoahHeap::evac_update_with_forwarded(T* p) {
oop heap_oop = CompressedOops::decode_not_null(o); oop heap_oop = CompressedOops::decode_not_null(o);
if (in_collection_set(heap_oop)) { if (in_collection_set(heap_oop)) {
oop forwarded_oop = ShenandoahBarrierSet::resolve_forwarded_not_null(heap_oop); oop forwarded_oop = ShenandoahBarrierSet::resolve_forwarded_not_null(heap_oop);
if (oopDesc::equals_raw(forwarded_oop, heap_oop)) { if (forwarded_oop == heap_oop) {
forwarded_oop = evacuate_object(heap_oop, Thread::current()); forwarded_oop = evacuate_object(heap_oop, Thread::current());
} }
oop prev = cas_oop(forwarded_oop, p, heap_oop); oop prev = cas_oop(forwarded_oop, p, heap_oop);
if (oopDesc::equals_raw(prev, heap_oop)) { if (prev == heap_oop) {
return forwarded_oop; return forwarded_oop;
} else { } else {
return NULL; return NULL;
@ -146,7 +146,7 @@ inline oop ShenandoahHeap::maybe_update_with_forwarded_not_null(T* p, oop heap_o
if (in_collection_set(heap_oop)) { if (in_collection_set(heap_oop)) {
oop forwarded_oop = ShenandoahBarrierSet::resolve_forwarded_not_null(heap_oop); oop forwarded_oop = ShenandoahBarrierSet::resolve_forwarded_not_null(heap_oop);
if (oopDesc::equals_raw(forwarded_oop, heap_oop)) { if (forwarded_oop == heap_oop) {
// E.g. during evacuation. // E.g. during evacuation.
return forwarded_oop; return forwarded_oop;
} }
@ -159,7 +159,7 @@ inline oop ShenandoahHeap::maybe_update_with_forwarded_not_null(T* p, oop heap_o
// reference be updated later. // reference be updated later.
oop witness = cas_oop(forwarded_oop, p, heap_oop); oop witness = cas_oop(forwarded_oop, p, heap_oop);
if (!oopDesc::equals_raw(witness, heap_oop)) { if (witness != heap_oop) {
// CAS failed, someone had beat us to it. Normally, we would return the failure witness, // CAS failed, someone had beat us to it. Normally, we would return the failure witness,
// because that would be the proper write of to-space object, enforced by strong barriers. // because that would be the proper write of to-space object, enforced by strong barriers.
// However, there is a corner case with arraycopy. It can happen that a Java thread // However, there is a corner case with arraycopy. It can happen that a Java thread
@ -279,7 +279,7 @@ inline oop ShenandoahHeap::evacuate_object(oop p, Thread* thread) {
// Try to install the new forwarding pointer. // Try to install the new forwarding pointer.
oop copy_val = oop(copy); oop copy_val = oop(copy);
oop result = ShenandoahForwarding::try_update_forwardee(p, copy_val); oop result = ShenandoahForwarding::try_update_forwardee(p, copy_val);
if (oopDesc::equals_raw(result, copy_val)) { if (result == copy_val) {
// Successfully evacuated. Our copy is now the public one! // Successfully evacuated. Our copy is now the public one!
shenandoah_assert_correct(NULL, copy_val); shenandoah_assert_correct(NULL, copy_val);
return copy_val; return copy_val;

View file

@ -141,11 +141,11 @@ public:
public: public:
ObjArrayChunkedTask(oop o = NULL) { ObjArrayChunkedTask(oop o = NULL) {
assert(oopDesc::equals_raw(decode_oop(encode_oop(o)), o), "oop can be encoded: " PTR_FORMAT, p2i(o)); assert(decode_oop(encode_oop(o)) == o, "oop can be encoded: " PTR_FORMAT, p2i(o));
_obj = encode_oop(o); _obj = encode_oop(o);
} }
ObjArrayChunkedTask(oop o, int chunk, int pow) { ObjArrayChunkedTask(oop o, int chunk, int pow) {
assert(oopDesc::equals_raw(decode_oop(encode_oop(o)), o), "oop can be encoded: " PTR_FORMAT, p2i(o)); assert(decode_oop(encode_oop(o)) == o, "oop can be encoded: " PTR_FORMAT, p2i(o));
assert(decode_chunk(encode_chunk(chunk)) == chunk, "chunk can be encoded: %d", chunk); assert(decode_chunk(encode_chunk(chunk)) == chunk, "chunk can be encoded: %d", chunk);
assert(decode_pow(encode_pow(pow)) == pow, "pow can be encoded: %d", pow); assert(decode_pow(encode_pow(pow)) == pow, "pow can be encoded: %d", pow);
_obj = encode_oop(o) | encode_chunk(chunk) | encode_pow(pow); _obj = encode_oop(o) | encode_chunk(chunk) | encode_pow(pow);

View file

@ -672,7 +672,7 @@ private:
if (!CompressedOops::is_null(o)) { if (!CompressedOops::is_null(o)) {
oop obj = CompressedOops::decode_not_null(o); oop obj = CompressedOops::decode_not_null(o);
oop forw = ShenandoahBarrierSet::resolve_forwarded_not_null(obj); oop forw = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
if (!oopDesc::equals_raw(obj, forw)) { if (obj != forw) {
RawAccess<IS_NOT_NULL>::oop_store(p, forw); RawAccess<IS_NOT_NULL>::oop_store(p, forw);
} }
} }

View file

@ -42,14 +42,14 @@ void ShenandoahTraversalGC::process_oop(T* p, Thread* thread, ShenandoahObjToSca
oop obj = CompressedOops::decode_not_null(o); oop obj = CompressedOops::decode_not_null(o);
if (DEGEN) { if (DEGEN) {
oop forw = ShenandoahBarrierSet::resolve_forwarded_not_null(obj); oop forw = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
if (!oopDesc::equals_raw(obj, forw)) { if (obj != forw) {
// Update reference. // Update reference.
RawAccess<IS_NOT_NULL>::oop_store(p, forw); RawAccess<IS_NOT_NULL>::oop_store(p, forw);
} }
obj = forw; obj = forw;
} else if (_heap->in_collection_set(obj)) { } else if (_heap->in_collection_set(obj)) {
oop forw = ShenandoahBarrierSet::resolve_forwarded_not_null(obj); oop forw = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
if (oopDesc::equals_raw(obj, forw)) { if (obj == forw) {
forw = _heap->evacuate_object(obj, thread); forw = _heap->evacuate_object(obj, thread);
} }
shenandoah_assert_forwarded_except(p, obj, _heap->cancelled_gc()); shenandoah_assert_forwarded_except(p, obj, _heap->cancelled_gc());

View file

@ -153,7 +153,7 @@ private:
ShenandoahHeapRegion* fwd_reg = NULL; ShenandoahHeapRegion* fwd_reg = NULL;
if (!oopDesc::equals_raw(obj, fwd)) { if (obj != fwd) {
check(ShenandoahAsserts::_safe_oop, obj, _heap->is_in(fwd), check(ShenandoahAsserts::_safe_oop, obj, _heap->is_in(fwd),
"Forwardee must be in heap"); "Forwardee must be in heap");
check(ShenandoahAsserts::_safe_oop, obj, !CompressedOops::is_null(fwd), check(ShenandoahAsserts::_safe_oop, obj, !CompressedOops::is_null(fwd),
@ -183,7 +183,7 @@ private:
"Forwardee end should be within the region"); "Forwardee end should be within the region");
oop fwd2 = (oop) ShenandoahForwarding::get_forwardee_raw_unchecked(fwd); oop fwd2 = (oop) ShenandoahForwarding::get_forwardee_raw_unchecked(fwd);
check(ShenandoahAsserts::_safe_oop, obj, oopDesc::equals_raw(fwd, fwd2), check(ShenandoahAsserts::_safe_oop, obj, (fwd == fwd2),
"Double forwarding"); "Double forwarding");
} else { } else {
fwd_reg = obj_reg; fwd_reg = obj_reg;
@ -212,12 +212,12 @@ private:
// skip // skip
break; break;
case ShenandoahVerifier::_verify_forwarded_none: { case ShenandoahVerifier::_verify_forwarded_none: {
check(ShenandoahAsserts::_safe_all, obj, oopDesc::equals_raw(obj, fwd), check(ShenandoahAsserts::_safe_all, obj, (obj == fwd),
"Should not be forwarded"); "Should not be forwarded");
break; break;
} }
case ShenandoahVerifier::_verify_forwarded_allow: { case ShenandoahVerifier::_verify_forwarded_allow: {
if (!oopDesc::equals_raw(obj, fwd)) { if (obj != fwd) {
check(ShenandoahAsserts::_safe_all, obj, obj_reg != fwd_reg, check(ShenandoahAsserts::_safe_all, obj, obj_reg != fwd_reg,
"Forwardee should be in another region"); "Forwardee should be in another region");
} }
@ -237,7 +237,7 @@ private:
break; break;
case ShenandoahVerifier::_verify_cset_forwarded: case ShenandoahVerifier::_verify_cset_forwarded:
if (_heap->in_collection_set(obj)) { if (_heap->in_collection_set(obj)) {
check(ShenandoahAsserts::_safe_all, obj, !oopDesc::equals_raw(obj, fwd), check(ShenandoahAsserts::_safe_all, obj, (obj != fwd),
"Object in collection set, should have forwardee"); "Object in collection set, should have forwardee");
} }
break; break;
@ -952,7 +952,7 @@ private:
if (!CompressedOops::is_null(o)) { if (!CompressedOops::is_null(o)) {
oop obj = CompressedOops::decode_not_null(o); oop obj = CompressedOops::decode_not_null(o);
oop fwd = (oop) ShenandoahForwarding::get_forwardee_raw_unchecked(obj); oop fwd = (oop) ShenandoahForwarding::get_forwardee_raw_unchecked(obj);
if (!oopDesc::equals_raw(obj, fwd)) { if (obj != fwd) {
ShenandoahAsserts::print_failure(ShenandoahAsserts::_safe_all, obj, p, NULL, ShenandoahAsserts::print_failure(ShenandoahAsserts::_safe_all, obj, p, NULL,
"Verify Roots", "Should not be forwarded", __FILE__, __LINE__); "Verify Roots", "Should not be forwarded", __FILE__, __LINE__);
} }
@ -984,7 +984,7 @@ private:
} }
oop fwd = (oop) ShenandoahForwarding::get_forwardee_raw_unchecked(obj); oop fwd = (oop) ShenandoahForwarding::get_forwardee_raw_unchecked(obj);
if (!oopDesc::equals_raw(obj, fwd)) { if (obj != fwd) {
ShenandoahAsserts::print_failure(ShenandoahAsserts::_safe_all, obj, p, NULL, ShenandoahAsserts::print_failure(ShenandoahAsserts::_safe_all, obj, p, NULL,
"Verify Roots In To-Space", "Should not be forwarded", __FILE__, __LINE__); "Verify Roots In To-Space", "Should not be forwarded", __FILE__, __LINE__);
} }

View file

@ -2436,7 +2436,7 @@ run:
handle_exception); handle_exception);
result = THREAD->vm_result(); result = THREAD->vm_result();
} }
if (oopDesc::equals(result, Universe::the_null_sentinel())) if (result == Universe::the_null_sentinel())
result = NULL; result = NULL;
VERIFY_OOP(result); VERIFY_OOP(result);

View file

@ -206,7 +206,7 @@ JRT_ENTRY(void, InterpreterRuntime::resolve_ldc(JavaThread* thread, Bytecodes::C
if (rindex >= 0) { if (rindex >= 0) {
oop coop = m->constants()->resolved_references()->obj_at(rindex); oop coop = m->constants()->resolved_references()->obj_at(rindex);
oop roop = (result == NULL ? Universe::the_null_sentinel() : result); oop roop = (result == NULL ? Universe::the_null_sentinel() : result);
assert(oopDesc::equals(roop, coop), "expected result for assembly code"); assert(roop == coop, "expected result for assembly code");
} }
} }
#endif #endif

View file

@ -123,7 +123,7 @@ bool JVMCICompiler::force_comp_at_level_simple(Method *method) {
if (excludeModules.not_null()) { if (excludeModules.not_null()) {
ModuleEntry* moduleEntry = method->method_holder()->module(); ModuleEntry* moduleEntry = method->method_holder()->module();
for (int i = 0; i < excludeModules->length(); i++) { for (int i = 0; i < excludeModules->length(); i++) {
if (oopDesc::equals(excludeModules->obj_at(i), moduleEntry->module())) { if (excludeModules->obj_at(i) == moduleEntry->module()) {
return true; return true;
} }
} }

View file

@ -125,7 +125,7 @@ class HeapShared: AllStatic {
static bool _archive_heap_region_fixed; static bool _archive_heap_region_fixed;
static bool oop_equals(oop const& p1, oop const& p2) { static bool oop_equals(oop const& p1, oop const& p2) {
return oopDesc::equals(p1, p2); return p1 == p2;
} }
static unsigned oop_hash(oop const& p); static unsigned oop_hash(oop const& p);

View file

@ -571,13 +571,13 @@ bool Universe::should_fill_in_stack_trace(Handle throwable) {
// preallocated errors with backtrace have been consumed. Also need to avoid // preallocated errors with backtrace have been consumed. Also need to avoid
// a potential loop which could happen if an out of memory occurs when attempting // a potential loop which could happen if an out of memory occurs when attempting
// to allocate the backtrace. // to allocate the backtrace.
return ((!oopDesc::equals(throwable(), Universe::_out_of_memory_error_java_heap)) && return ((throwable() != Universe::_out_of_memory_error_java_heap) &&
(!oopDesc::equals(throwable(), Universe::_out_of_memory_error_metaspace)) && (throwable() != Universe::_out_of_memory_error_metaspace) &&
(!oopDesc::equals(throwable(), Universe::_out_of_memory_error_class_metaspace)) && (throwable() != Universe::_out_of_memory_error_class_metaspace) &&
(!oopDesc::equals(throwable(), Universe::_out_of_memory_error_array_size)) && (throwable() != Universe::_out_of_memory_error_array_size) &&
(!oopDesc::equals(throwable(), Universe::_out_of_memory_error_gc_overhead_limit)) && (throwable() != Universe::_out_of_memory_error_gc_overhead_limit) &&
(!oopDesc::equals(throwable(), Universe::_out_of_memory_error_realloc_objects)) && (throwable() != Universe::_out_of_memory_error_realloc_objects) &&
(!oopDesc::equals(throwable(), Universe::_out_of_memory_error_retry))); (throwable() != Universe::_out_of_memory_error_retry));
} }

View file

@ -62,7 +62,7 @@ inline narrowOop CompressedOops::encode_not_null(oop v) {
assert(OopEncodingHeapMax > pd, "change encoding max if new encoding"); assert(OopEncodingHeapMax > pd, "change encoding max if new encoding");
uint64_t result = pd >> shift(); uint64_t result = pd >> shift();
assert((result & CONST64(0xffffffff00000000)) == 0, "narrow oop overflow"); assert((result & CONST64(0xffffffff00000000)) == 0, "narrow oop overflow");
assert(oopDesc::equals_raw(decode(result), v), "reversibility"); assert(decode(result) == v, "reversibility");
return (narrowOop)result; return (narrowOop)result;
} }

View file

@ -866,7 +866,7 @@ oop ConstantPool::resolve_constant_at_impl(const constantPoolHandle& this_cp,
if (cache_index >= 0) { if (cache_index >= 0) {
result_oop = this_cp->resolved_references()->obj_at(cache_index); result_oop = this_cp->resolved_references()->obj_at(cache_index);
if (result_oop != NULL) { if (result_oop != NULL) {
if (oopDesc::equals(result_oop, Universe::the_null_sentinel())) { if (result_oop == Universe::the_null_sentinel()) {
DEBUG_ONLY(int temp_index = (index >= 0 ? index : this_cp->object_to_cp_index(cache_index))); DEBUG_ONLY(int temp_index = (index >= 0 ? index : this_cp->object_to_cp_index(cache_index)));
assert(this_cp->tag_at(temp_index).is_dynamic_constant(), "only condy uses the null sentinel"); assert(this_cp->tag_at(temp_index).is_dynamic_constant(), "only condy uses the null sentinel");
result_oop = NULL; result_oop = NULL;
@ -1096,12 +1096,12 @@ oop ConstantPool::resolve_constant_at_impl(const constantPoolHandle& this_cp,
} else { } else {
// Return the winning thread's result. This can be different than // Return the winning thread's result. This can be different than
// the result here for MethodHandles. // the result here for MethodHandles.
if (oopDesc::equals(old_result, Universe::the_null_sentinel())) if (old_result == Universe::the_null_sentinel())
old_result = NULL; old_result = NULL;
return old_result; return old_result;
} }
} else { } else {
assert(!oopDesc::equals(result_oop, Universe::the_null_sentinel()), ""); assert(result_oop != Universe::the_null_sentinel(), "");
return result_oop; return result_oop;
} }
} }
@ -1154,7 +1154,7 @@ void ConstantPool::copy_bootstrap_arguments_at_impl(const constantPoolHandle& th
oop ConstantPool::string_at_impl(const constantPoolHandle& this_cp, int which, int obj_index, TRAPS) { oop ConstantPool::string_at_impl(const constantPoolHandle& this_cp, int which, int obj_index, TRAPS) {
// If the string has already been interned, this entry will be non-null // If the string has already been interned, this entry will be non-null
oop str = this_cp->resolved_references()->obj_at(obj_index); oop str = this_cp->resolved_references()->obj_at(obj_index);
assert(!oopDesc::equals(str, Universe::the_null_sentinel()), ""); assert(str != Universe::the_null_sentinel(), "");
if (str != NULL) return str; if (str != NULL) return str;
Symbol* sym = this_cp->unresolved_string_at(which); Symbol* sym = this_cp->unresolved_string_at(which);
str = StringTable::intern(sym, CHECK_(NULL)); str = StringTable::intern(sym, CHECK_(NULL));

View file

@ -2717,7 +2717,7 @@ bool InstanceKlass::is_same_class_package(const Klass* class2) const {
// and package entries. Both must be the same. This rule // and package entries. Both must be the same. This rule
// applies even to classes that are defined in the unnamed // applies even to classes that are defined in the unnamed
// package, they still must have the same class loader. // package, they still must have the same class loader.
if (oopDesc::equals(classloader1, classloader2) && (classpkg1 == classpkg2)) { if ((classloader1 == classloader2) && (classpkg1 == classpkg2)) {
return true; return true;
} }
@ -2728,7 +2728,7 @@ bool InstanceKlass::is_same_class_package(const Klass* class2) const {
// and classname information is enough to determine a class's package // and classname information is enough to determine a class's package
bool InstanceKlass::is_same_class_package(oop other_class_loader, bool InstanceKlass::is_same_class_package(oop other_class_loader,
const Symbol* other_class_name) const { const Symbol* other_class_name) const {
if (!oopDesc::equals(class_loader(), other_class_loader)) { if (class_loader() != other_class_loader) {
return false; return false;
} }
if (name()->fast_compare(other_class_name) == 0) { if (name()->fast_compare(other_class_name) == 0) {

View file

@ -491,7 +491,7 @@ bool klassVtable::update_inherited_vtable(InstanceKlass* klass, const methodHand
// to link to the first super, and we get all the others. // to link to the first super, and we get all the others.
Handle super_loader(THREAD, super_klass->class_loader()); Handle super_loader(THREAD, super_klass->class_loader());
if (!oopDesc::equals(target_loader(), super_loader())) { if (target_loader() != super_loader()) {
ResourceMark rm(THREAD); ResourceMark rm(THREAD);
Symbol* failed_type_symbol = Symbol* failed_type_symbol =
SystemDictionary::check_signature_loaders(signature, target_loader, SystemDictionary::check_signature_loaders(signature, target_loader,
@ -1237,7 +1237,7 @@ void klassItable::initialize_itable_for_interface(int method_table_offset, Insta
// if checkconstraints requested // if checkconstraints requested
if (checkconstraints) { if (checkconstraints) {
Handle method_holder_loader (THREAD, target->method_holder()->class_loader()); Handle method_holder_loader (THREAD, target->method_holder()->class_loader());
if (!oopDesc::equals(method_holder_loader(), interface_loader())) { if (method_holder_loader() != interface_loader()) {
ResourceMark rm(THREAD); ResourceMark rm(THREAD);
Symbol* failed_type_symbol = Symbol* failed_type_symbol =
SystemDictionary::check_signature_loaders(m->signature(), SystemDictionary::check_signature_loaders(m->signature(),

View file

@ -212,7 +212,7 @@ oop ObjArrayKlass::multi_allocate(int rank, jint* sizes, TRAPS) {
// Either oop or narrowOop depending on UseCompressedOops. // Either oop or narrowOop depending on UseCompressedOops.
void ObjArrayKlass::do_copy(arrayOop s, size_t src_offset, void ObjArrayKlass::do_copy(arrayOop s, size_t src_offset,
arrayOop d, size_t dst_offset, int length, TRAPS) { arrayOop d, size_t dst_offset, int length, TRAPS) {
if (oopDesc::equals(s, d)) { if (s == d) {
// since source and destination are equal we do not need conversion checks. // since source and destination are equal we do not need conversion checks.
assert(length > 0, "sanity check"); assert(length > 0, "sanity check");
ArrayAccess<>::oop_arraycopy(s, src_offset, d, dst_offset, length); ArrayAccess<>::oop_arraycopy(s, src_offset, d, dst_offset, length);

View file

@ -150,10 +150,6 @@ class oopDesc {
} }
} }
inline static bool equals(oop o1, oop o2) { return equals_raw(o1, o2); }
inline static bool equals_raw(oop o1, oop o2) { return o1 == o2; }
// Access to fields in a instanceOop through these methods. // Access to fields in a instanceOop through these methods.
template <DecoratorSet decorator> template <DecoratorSet decorator>
oop obj_field_access(int offset) const; oop obj_field_access(int offset) const;

View file

@ -568,7 +568,7 @@ JNI_ENTRY_NO_PRESERVE(jboolean, jni_IsAssignableFrom(JNIEnv *env, jclass sub, jc
oop super_mirror = JNIHandles::resolve_non_null(super); oop super_mirror = JNIHandles::resolve_non_null(super);
if (java_lang_Class::is_primitive(sub_mirror) || if (java_lang_Class::is_primitive(sub_mirror) ||
java_lang_Class::is_primitive(super_mirror)) { java_lang_Class::is_primitive(super_mirror)) {
jboolean ret = oopDesc::equals(sub_mirror, super_mirror); jboolean ret = (sub_mirror == super_mirror);
HOTSPOT_JNI_ISASSIGNABLEFROM_RETURN(ret); HOTSPOT_JNI_ISASSIGNABLEFROM_RETURN(ret);
return ret; return ret;

View file

@ -1257,7 +1257,7 @@ JVM_ENTRY(jobject, JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls))
protection_domain = method->method_holder()->protection_domain(); protection_domain = method->method_holder()->protection_domain();
} }
if ((!oopDesc::equals(previous_protection_domain, protection_domain)) && (protection_domain != NULL)) { if ((previous_protection_domain != protection_domain) && (protection_domain != NULL)) {
local_array->push(protection_domain); local_array->push(protection_domain);
previous_protection_domain = protection_domain; previous_protection_domain = protection_domain;
} }

View file

@ -105,7 +105,7 @@ class JvmtiTagHashmapEntry : public CHeapObj<mtInternal> {
} }
inline bool equals(oop object) { inline bool equals(oop object) {
return oopDesc::equals(object, object_peek()); return object == object_peek();
} }
inline JvmtiTagHashmapEntry* next() const { return _next; } inline JvmtiTagHashmapEntry* next() const { return _next; }

View file

@ -1003,7 +1003,7 @@ int MethodHandles::find_MemberNames(Klass* k,
if (!java_lang_invoke_MemberName::is_instance(result())) if (!java_lang_invoke_MemberName::is_instance(result()))
return -99; // caller bug! return -99; // caller bug!
oop saved = MethodHandles::init_field_MemberName(result, st.field_descriptor()); oop saved = MethodHandles::init_field_MemberName(result, st.field_descriptor());
if (!oopDesc::equals(saved, result())) if (saved != result())
results->obj_at_put(rfill-1, saved); // show saved instance to user results->obj_at_put(rfill-1, saved); // show saved instance to user
} else if (++overflow >= overflow_limit) { } else if (++overflow >= overflow_limit) {
match_flags = 0; break; // got tired of looking at overflow match_flags = 0; break; // got tired of looking at overflow
@ -1055,7 +1055,7 @@ int MethodHandles::find_MemberNames(Klass* k,
return -99; // caller bug! return -99; // caller bug!
CallInfo info(m, NULL, CHECK_0); CallInfo info(m, NULL, CHECK_0);
oop saved = MethodHandles::init_method_MemberName(result, info); oop saved = MethodHandles::init_method_MemberName(result, info);
if (!oopDesc::equals(saved, result())) if (saved != result())
results->obj_at_put(rfill-1, saved); // show saved instance to user results->obj_at_put(rfill-1, saved); // show saved instance to user
} else if (++overflow >= overflow_limit) { } else if (++overflow >= overflow_limit) {
match_flags = 0; break; // got tired of looking at overflow match_flags = 0; break; // got tired of looking at overflow

View file

@ -50,7 +50,7 @@ void BaseFrameStream::setup_magic_on_entry(objArrayHandle frames_array) {
bool BaseFrameStream::check_magic(objArrayHandle frames_array) { bool BaseFrameStream::check_magic(objArrayHandle frames_array) {
oop m1 = frames_array->obj_at(magic_pos); oop m1 = frames_array->obj_at(magic_pos);
jlong m2 = _anchor; jlong m2 = _anchor;
if (oopDesc::equals(m1, _thread->threadObj()) && m2 == address_value()) return true; if (m1 == _thread->threadObj() && m2 == address_value()) return true;
return false; return false;
} }
@ -81,7 +81,7 @@ BaseFrameStream* BaseFrameStream::from_current(JavaThread* thread, jlong magic,
{ {
assert(thread != NULL && thread->is_Java_thread(), ""); assert(thread != NULL && thread->is_Java_thread(), "");
oop m1 = frames_array->obj_at(magic_pos); oop m1 = frames_array->obj_at(magic_pos);
if (!oopDesc::equals(m1, thread->threadObj())) return NULL; if (m1 != thread->threadObj()) return NULL;
if (magic == 0L) return NULL; if (magic == 0L) return NULL;
BaseFrameStream* stream = (BaseFrameStream*) (intptr_t) magic; BaseFrameStream* stream = (BaseFrameStream*) (intptr_t) magic;
if (!stream->is_valid_in(thread, frames_array)) return NULL; if (!stream->is_valid_in(thread, frames_array)) return NULL;

View file

@ -935,7 +935,7 @@ UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSetReference(JNIEnv *env, jobject unsafe
oop p = JNIHandles::resolve(obj); oop p = JNIHandles::resolve(obj);
assert_field_offset_sane(p, offset); assert_field_offset_sane(p, offset);
oop ret = HeapAccess<ON_UNKNOWN_OOP_REF>::oop_atomic_cmpxchg_at(x, p, (ptrdiff_t)offset, e); oop ret = HeapAccess<ON_UNKNOWN_OOP_REF>::oop_atomic_cmpxchg_at(x, p, (ptrdiff_t)offset, e);
return oopDesc::equals(ret, e); return ret == e;
} UNSAFE_END } UNSAFE_END
UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSetInt(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jint e, jint x)) { UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSetInt(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jint e, jint x)) {

View file

@ -257,7 +257,7 @@ void BiasedLocking::single_revoke_at_safepoint(oop obj, bool is_bulk, JavaThread
BasicLock* highest_lock = NULL; BasicLock* highest_lock = NULL;
for (int i = 0; i < cached_monitor_info->length(); i++) { for (int i = 0; i < cached_monitor_info->length(); i++) {
MonitorInfo* mon_info = cached_monitor_info->at(i); MonitorInfo* mon_info = cached_monitor_info->at(i);
if (oopDesc::equals(mon_info->owner(), obj)) { if (mon_info->owner() == obj) {
log_trace(biasedlocking)(" mon_info->owner (" PTR_FORMAT ") == obj (" PTR_FORMAT ")", log_trace(biasedlocking)(" mon_info->owner (" PTR_FORMAT ") == obj (" PTR_FORMAT ")",
p2i((void *) mon_info->owner()), p2i((void *) mon_info->owner()),
p2i((void *) obj)); p2i((void *) obj));
@ -693,7 +693,7 @@ void BiasedLocking::walk_stack_and_revoke(oop obj, JavaThread* biased_locker) {
BasicLock* highest_lock = NULL; BasicLock* highest_lock = NULL;
for (int i = 0; i < cached_monitor_info->length(); i++) { for (int i = 0; i < cached_monitor_info->length(); i++) {
MonitorInfo* mon_info = cached_monitor_info->at(i); MonitorInfo* mon_info = cached_monitor_info->at(i);
if (oopDesc::equals(mon_info->owner(), obj)) { if (mon_info->owner() == obj) {
log_trace(biasedlocking)(" mon_info->owner (" PTR_FORMAT ") == obj (" PTR_FORMAT ")", log_trace(biasedlocking)(" mon_info->owner (" PTR_FORMAT ") == obj (" PTR_FORMAT ")",
p2i(mon_info->owner()), p2i(mon_info->owner()),
p2i(obj)); p2i(obj));

View file

@ -79,8 +79,8 @@ class Handle {
oop operator () () const { return obj(); } oop operator () () const { return obj(); }
oop operator -> () const { return non_null_obj(); } oop operator -> () const { return non_null_obj(); }
bool operator == (oop o) const { return oopDesc::equals(obj(), o); } bool operator == (oop o) const { return obj() == o; }
bool operator == (const Handle& h) const { return oopDesc::equals(obj(), h.obj()); } bool operator == (const Handle& h) const { return obj() == h.obj(); }
// Null checks // Null checks
bool is_null() const { return _handle == NULL; } bool is_null() const { return _handle == NULL; }

View file

@ -84,7 +84,7 @@ inline oop JNIHandles::resolve_no_keepalive(jobject handle) {
inline bool JNIHandles::is_same_object(jobject handle1, jobject handle2) { inline bool JNIHandles::is_same_object(jobject handle1, jobject handle2) {
oop obj1 = resolve_no_keepalive(handle1); oop obj1 = resolve_no_keepalive(handle1);
oop obj2 = resolve_no_keepalive(handle2); oop obj2 = resolve_no_keepalive(handle2);
return oopDesc::equals(obj1, obj2); return obj1 == obj2;
} }
inline oop JNIHandles::resolve_non_null(jobject handle) { inline oop JNIHandles::resolve_non_null(jobject handle) {

View file

@ -171,7 +171,7 @@ bool ObjectSynchronizer::quick_notify(oopDesc* obj, Thread* self, bool all) {
if (mark.has_monitor()) { if (mark.has_monitor()) {
ObjectMonitor* const mon = mark.monitor(); ObjectMonitor* const mon = mark.monitor();
assert(oopDesc::equals((oop) mon->object(), obj), "invariant"); assert(mon->object() == obj, "invariant");
if (mon->owner() != self) return false; // slow-path for IMS exception if (mon->owner() != self) return false; // slow-path for IMS exception
if (mon->first_waiter() != NULL) { if (mon->first_waiter() != NULL) {
@ -215,7 +215,7 @@ bool ObjectSynchronizer::quick_enter(oop obj, Thread* self,
if (mark.has_monitor()) { if (mark.has_monitor()) {
ObjectMonitor* const m = mark.monitor(); ObjectMonitor* const m = mark.monitor();
assert(oopDesc::equals((oop) m->object(), obj), "invariant"); assert(m->object() == obj, "invariant");
Thread* const owner = (Thread *) m->_owner; Thread* const owner = (Thread *) m->_owner;
// Lock contention and Transactional Lock Elision (TLE) diagnostics // Lock contention and Transactional Lock Elision (TLE) diagnostics
@ -1301,7 +1301,7 @@ ObjectMonitor* ObjectSynchronizer::inflate(Thread* self,
ObjectMonitor* inf = mark.monitor(); ObjectMonitor* inf = mark.monitor();
markWord dmw = inf->header(); markWord dmw = inf->header();
assert(dmw.is_neutral(), "invariant: header=" INTPTR_FORMAT, dmw.value()); assert(dmw.is_neutral(), "invariant: header=" INTPTR_FORMAT, dmw.value());
assert(oopDesc::equals((oop) inf->object(), object), "invariant"); assert(inf->object() == object, "invariant");
assert(ObjectSynchronizer::verify_objmon_isinpool(inf), "monitor is invalid"); assert(ObjectSynchronizer::verify_objmon_isinpool(inf), "monitor is invalid");
return inf; return inf;
} }

View file

@ -135,7 +135,7 @@ GrowableArray<MonitorInfo*>* javaVFrame::locked_monitors() {
// //
// Skip the monitor that the thread is blocked to enter or waiting on // Skip the monitor that the thread is blocked to enter or waiting on
// //
if (!found_first_monitor && (oopDesc::equals(obj, pending_obj) || oopDesc::equals(obj, waiting_obj))) { if (!found_first_monitor && (obj == pending_obj || obj == waiting_obj)) {
continue; continue;
} }
found_first_monitor = true; found_first_monitor = true;

View file

@ -70,7 +70,7 @@ public:
int add_pool(MemoryPool* pool); int add_pool(MemoryPool* pool);
bool is_manager(instanceHandle mh) { return oopDesc::equals(mh(), _memory_mgr_obj); } bool is_manager(instanceHandle mh) { return mh() == _memory_mgr_obj; }
virtual instanceOop get_memory_manager_instance(TRAPS); virtual instanceOop get_memory_manager_instance(TRAPS);
virtual bool is_gc_memory_manager() { return false; } virtual bool is_gc_memory_manager() { return false; }

View file

@ -95,7 +95,7 @@ class MemoryPool : public CHeapObj<mtInternal> {
// max size could be changed // max size could be changed
virtual size_t max_size() const { return _max_size; } virtual size_t max_size() const { return _max_size; }
bool is_pool(instanceHandle pool) { return oopDesc::equals(pool(), _memory_pool_obj); } bool is_pool(instanceHandle pool) { return pool() == _memory_pool_obj; }
bool available_for_allocation() { return _available_for_allocation; } bool available_for_allocation() { return _available_for_allocation; }
bool set_available_for_allocation(bool value) { bool set_available_for_allocation(bool value) {

View file

@ -680,7 +680,7 @@ bool ThreadStackTrace::is_owned_monitor_on_stack(oop object) {
for (int j = 0; j < len; j++) { for (int j = 0; j < len; j++) {
oop monitor = locked_monitors->at(j); oop monitor = locked_monitors->at(j);
assert(monitor != NULL, "must be a Java object"); assert(monitor != NULL, "must be a Java object");
if (oopDesc::equals(monitor, object)) { if (monitor == object) {
found = true; found = true;
break; break;
} }

View file

@ -435,9 +435,9 @@ volatile int Exceptions::_out_of_memory_error_metaspace_errors = 0;
volatile int Exceptions::_out_of_memory_error_class_metaspace_errors = 0; volatile int Exceptions::_out_of_memory_error_class_metaspace_errors = 0;
void Exceptions::count_out_of_memory_exceptions(Handle exception) { void Exceptions::count_out_of_memory_exceptions(Handle exception) {
if (oopDesc::equals(exception(), Universe::out_of_memory_error_metaspace())) { if (exception() == Universe::out_of_memory_error_metaspace()) {
Atomic::inc(&_out_of_memory_error_metaspace_errors); Atomic::inc(&_out_of_memory_error_metaspace_errors);
} else if (oopDesc::equals(exception(), Universe::out_of_memory_error_class_metaspace())) { } else if (exception() == Universe::out_of_memory_error_class_metaspace()) {
Atomic::inc(&_out_of_memory_error_class_metaspace_errors); Atomic::inc(&_out_of_memory_error_class_metaspace_errors);
} else { } else {
// everything else reported as java heap OOM // everything else reported as java heap OOM

View file

@ -218,15 +218,6 @@ template<class E> class GrowableArray : public GenericGrowableArray {
void print(); void print();
inline static bool safe_equals(oop obj1, oop obj2) {
return oopDesc::equals(obj1, obj2);
}
template <class X>
inline static bool safe_equals(X i1, X i2) {
return i1 == i2;
}
int append(const E& elem) { int append(const E& elem) {
check_nesting(); check_nesting();
if (_len == _max) grow(_len); if (_len == _max) grow(_len);
@ -311,7 +302,7 @@ template<class E> class GrowableArray : public GenericGrowableArray {
bool contains(const E& elem) const { bool contains(const E& elem) const {
for (int i = 0; i < _len; i++) { for (int i = 0; i < _len; i++) {
if (safe_equals(_data[i], elem)) return true; if (_data[i] == elem) return true;
} }
return false; return false;
} }