8160399: is_oop_or_null involves undefined behavior
8164984: Improper use of is_oop in production code
Summary: replace oop->is_oop*() with oopDesc::is_oop*(oop) so this pointer can be verified
Reviewed-by: iklam, kvn, dholmes
--- a/hotspot/src/cpu/arm/vm/methodHandles_arm.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/cpu/arm/vm/methodHandles_arm.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -559,7 +559,7 @@
values.print(p);
}
if (Verbose) {
- if (has_mh && mh->is_oop()) {
+ if (has_mh && oopDesc::is_oop(mh)) {
mh->print();
if (java_lang_invoke_MethodHandle::is_instance(mh)) {
if (java_lang_invoke_MethodHandle::form_offset_in_bytes() != 0)
--- a/hotspot/src/cpu/ppc/vm/methodHandles_ppc.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/methodHandles_ppc.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -525,7 +525,7 @@
values.print(p);
}
- if (has_mh && mh->is_oop()) {
+ if (has_mh && oopDesc::is_oop(mh)) {
mh->print();
if (java_lang_invoke_MethodHandle::is_instance(mh)) {
if (java_lang_invoke_MethodHandle::form_offset_in_bytes() != 0)
--- a/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -830,7 +830,7 @@
// Wrapper which calls oopDesc::is_oop_or_null()
// Only called by MacroAssembler::verify_oop
static void verify_oop_helper(const char* message, oop o) {
- if (!o->is_oop_or_null()) {
+ if (!oopDesc::is_oop_or_null(o)) {
fatal("%s", message);
}
++ StubRoutines::_verify_oop_count;
--- a/hotspot/src/cpu/s390/vm/methodHandles_s390.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/cpu/s390/vm/methodHandles_s390.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -595,7 +595,7 @@
// Note: the unextended_sp may not be correct.
tty->print_cr(" stack layout:");
values.print(p);
- if (has_mh && mh->is_oop()) {
+ if (has_mh && oopDesc::is_oop(mh)) {
mh->print();
if (java_lang_invoke_MethodHandle::is_instance(mh)) {
if (java_lang_invoke_MethodHandle::form_offset_in_bytes() != 0) {
--- a/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -562,7 +562,7 @@
// Note: the unextended_sp may not be correct
tty->print_cr(" stack layout:");
values.print(p);
- if (has_mh && mh->is_oop()) {
+ if (has_mh && oopDesc::is_oop(mh)) {
mh->print();
if (java_lang_invoke_MethodHandle::is_instance(mh)) {
if (java_lang_invoke_MethodHandle::form_offset_in_bytes() != 0)
--- a/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -561,7 +561,7 @@
tty->print_cr("Stack layout:");
values.print(p);
}
- if (has_mh && mh->is_oop()) {
+ if (has_mh && oopDesc::is_oop(mh)) {
mh->print();
if (java_lang_invoke_MethodHandle::is_instance(mh)) {
if (java_lang_invoke_MethodHandle::form_offset_in_bytes() != 0)
--- a/hotspot/src/cpu/x86/vm/x86_32.ad Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/cpu/x86/vm/x86_32.ad Wed Aug 23 14:52:55 2017 -0400
@@ -1,5 +1,5 @@
//
-// Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
//
// This code is free software; you can redistribute it and/or modify it
@@ -391,7 +391,7 @@
int format) {
#ifdef ASSERT
if (rspec.reloc()->type() == relocInfo::oop_type && d32 != 0 && d32 != (int)Universe::non_oop_word()) {
- assert(cast_to_oop(d32)->is_oop() && (ScavengeRootsInCode || !cast_to_oop(d32)->is_scavengable()), "cannot embed scavengable oops in code");
+ assert(oopDesc::is_oop(cast_to_oop(d32)) && (ScavengeRootsInCode || !cast_to_oop(d32)->is_scavengable()), "cannot embed scavengable oops in code");
}
#endif
cbuf.relocate(cbuf.insts_mark(), rspec, format);
--- a/hotspot/src/cpu/x86/vm/x86_64.ad Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/cpu/x86/vm/x86_64.ad Wed Aug 23 14:52:55 2017 -0400
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
//
// This code is free software; you can redistribute it and/or modify it
@@ -653,7 +653,7 @@
if (rspec.reloc()->type() == relocInfo::oop_type &&
d32 != 0 && d32 != (intptr_t) Universe::non_oop_word()) {
assert(Universe::heap()->is_in_reserved((address)(intptr_t)d32), "should be real oop");
- assert(cast_to_oop((intptr_t)d32)->is_oop() && (ScavengeRootsInCode || !cast_to_oop((intptr_t)d32)->is_scavengable()), "cannot embed scavengable oops in code");
+ assert(oopDesc::is_oop(cast_to_oop((intptr_t)d32)) && (ScavengeRootsInCode || !cast_to_oop((intptr_t)d32)->is_scavengable()), "cannot embed scavengable oops in code");
}
#endif
cbuf.relocate(cbuf.insts_mark(), rspec, format);
@@ -680,7 +680,7 @@
if (rspec.reloc()->type() == relocInfo::oop_type &&
d64 != 0 && d64 != (int64_t) Universe::non_oop_word()) {
assert(Universe::heap()->is_in_reserved((address)d64), "should be real oop");
- assert(cast_to_oop(d64)->is_oop() && (ScavengeRootsInCode || !cast_to_oop(d64)->is_scavengable()),
+ assert(oopDesc::is_oop(cast_to_oop(d64)) && (ScavengeRootsInCode || !cast_to_oop(d64)->is_scavengable()),
"cannot embed scavengable oops in code");
}
#endif
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -491,7 +491,6 @@
}
#ifdef ASSERT
assert(exception.not_null(), "NULL exceptions should be handled by throw_exception");
- assert(exception->is_oop(), "just checking");
// Check that exception is a subclass of Throwable, otherwise we have a VerifyError
if (!(exception->is_a(SystemDictionary::Throwable_klass()))) {
if (ExitVMOnVerifyError) vm_exit(-1);
@@ -676,7 +675,6 @@
Atomic::inc(BiasedLocking::slow_path_entry_count_addr());
}
Handle h_obj(thread, obj);
- assert(h_obj()->is_oop(), "must be NULL or an object");
if (UseBiasedLocking) {
// Retry fast entry if bias is revoked to avoid unnecessary inflation
ObjectSynchronizer::fast_enter(h_obj, lock->lock(), true, CHECK);
@@ -701,7 +699,7 @@
EXCEPTION_MARK;
oop obj = lock->obj();
- assert(obj->is_oop(), "must be NULL or an object");
+ assert(oopDesc::is_oop(obj), "must be NULL or an object");
if (UseFastLocking) {
// When using fast locking, the compiled code has already tried the fast case
ObjectSynchronizer::slow_exit(obj, lock->lock(), THREAD);
--- a/hotspot/src/share/vm/classfile/classLoaderData.inline.hpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/classfile/classLoaderData.inline.hpp Wed Aug 23 14:52:55 2017 -0400
@@ -41,7 +41,7 @@
inline ClassLoaderData *ClassLoaderDataGraph::find_or_create(Handle loader, TRAPS) {
- guarantee(loader() != NULL && loader()->is_oop(), "Loader must be oop");
+ guarantee(loader() != NULL && oopDesc::is_oop(loader()), "Loader must be oop");
// Gets the class loader data out of the java/lang/ClassLoader object, if non-null
// it's already in the loader_data, so no need to add
ClassLoaderData* loader_data= java_lang_ClassLoader::loader_data(loader());
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -1430,7 +1430,7 @@
int java_lang_ThreadGroup::_ngroups_offset = 0;
oop java_lang_ThreadGroup::parent(oop java_thread_group) {
- assert(java_thread_group->is_oop(), "thread group must be oop");
+ assert(oopDesc::is_oop(java_thread_group), "thread group must be oop");
return java_thread_group->obj_field(_parent_offset);
}
@@ -1446,7 +1446,7 @@
}
int java_lang_ThreadGroup::nthreads(oop java_thread_group) {
- assert(java_thread_group->is_oop(), "thread group must be oop");
+ assert(oopDesc::is_oop(java_thread_group), "thread group must be oop");
return java_thread_group->int_field(_nthreads_offset);
}
@@ -1458,7 +1458,7 @@
}
int java_lang_ThreadGroup::ngroups(oop java_thread_group) {
- assert(java_thread_group->is_oop(), "thread group must be oop");
+ assert(oopDesc::is_oop(java_thread_group), "thread group must be oop");
return java_thread_group->int_field(_ngroups_offset);
}
@@ -1469,17 +1469,17 @@
}
ThreadPriority java_lang_ThreadGroup::maxPriority(oop java_thread_group) {
- assert(java_thread_group->is_oop(), "thread group must be oop");
+ assert(oopDesc::is_oop(java_thread_group), "thread group must be oop");
return (ThreadPriority) java_thread_group->int_field(_maxPriority_offset);
}
bool java_lang_ThreadGroup::is_destroyed(oop java_thread_group) {
- assert(java_thread_group->is_oop(), "thread group must be oop");
+ assert(oopDesc::is_oop(java_thread_group), "thread group must be oop");
return java_thread_group->bool_field(_destroyed_offset) != 0;
}
bool java_lang_ThreadGroup::is_daemon(oop java_thread_group) {
- assert(java_thread_group->is_oop(), "thread group must be oop");
+ assert(oopDesc::is_oop(java_thread_group), "thread group must be oop");
return java_thread_group->bool_field(_daemon_offset) != 0;
}
@@ -2868,7 +2868,7 @@
ModuleEntry* java_lang_Module::module_entry(oop module, TRAPS) {
assert(_module_entry_offset != -1, "Uninitialized module_entry_offset");
assert(module != NULL, "module can't be null");
- assert(module->is_oop(), "module must be oop");
+ assert(oopDesc::is_oop(module), "module must be oop");
ModuleEntry* module_entry = (ModuleEntry*)module->address_field(_module_entry_offset);
if (module_entry == NULL) {
@@ -2885,7 +2885,7 @@
void java_lang_Module::set_module_entry(oop module, ModuleEntry* module_entry) {
assert(_module_entry_offset != -1, "Uninitialized module_entry_offset");
assert(module != NULL, "module can't be null");
- assert(module->is_oop(), "module must be oop");
+ assert(oopDesc::is_oop(module), "module must be oop");
module->address_field_put(_module_entry_offset, (address)module_entry);
}
@@ -3088,12 +3088,9 @@
oop java_lang_invoke_DirectMethodHandle::member(oop dmh) {
oop member_name = NULL;
- bool is_dmh = dmh->is_oop() && java_lang_invoke_DirectMethodHandle::is_instance(dmh);
- assert(is_dmh, "a DirectMethodHandle oop is expected");
- if (is_dmh) {
- member_name = dmh->obj_field(member_offset_in_bytes());
- }
- return member_name;
+ assert(oopDesc::is_oop(dmh) && java_lang_invoke_DirectMethodHandle::is_instance(dmh),
+ "a DirectMethodHandle oop is expected");
+ return dmh->obj_field(member_offset_in_bytes());
}
void java_lang_invoke_DirectMethodHandle::compute_offsets() {
@@ -3476,7 +3473,7 @@
int java_lang_ClassLoader::unnamedModule_offset = -1;
ClassLoaderData** java_lang_ClassLoader::loader_data_addr(oop loader) {
- assert(loader != NULL && loader->is_oop(), "loader must be oop");
+ assert(loader != NULL && oopDesc::is_oop(loader), "loader must be oop");
return (ClassLoaderData**) loader->address_field_addr(_loader_data_offset);
}
--- a/hotspot/src/share/vm/classfile/protectionDomainCache.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/classfile/protectionDomainCache.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -97,7 +97,7 @@
}
void ProtectionDomainCacheEntry::verify() {
- guarantee(literal()->is_oop(), "must be an oop");
+ guarantee(oopDesc::is_oop(literal()), "must be an oop");
}
ProtectionDomainCacheEntry* ProtectionDomainCacheTable::get(Handle protection_domain) {
--- a/hotspot/src/share/vm/code/debugInfo.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/code/debugInfo.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -48,7 +48,7 @@
oop DebugInfoReadStream::read_oop() {
oop o = code()->oop_at(read_int());
- assert(o->is_oop_or_null(), "oop only");
+ assert(oopDesc::is_oop_or_null(o), "oop only");
return o;
}
--- a/hotspot/src/share/vm/code/dependencies.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/code/dependencies.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -940,7 +940,7 @@
oop Dependencies::DepStream::argument_oop(int i) {
oop result = recorded_oop_at(argument_index(i));
- assert(result == NULL || result->is_oop(), "must be");
+ assert(oopDesc::is_oop_or_null(result), "must be");
return result;
}
--- a/hotspot/src/share/vm/code/nmethod.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/code/nmethod.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -2090,7 +2090,7 @@
VerifyOopsClosure(nmethod* nm) : _nm(nm), _ok(true) { }
bool ok() { return _ok; }
virtual void do_oop(oop* p) {
- if ((*p) == NULL || (*p)->is_oop()) return;
+ if (oopDesc::is_oop_or_null(*p)) return;
if (_ok) {
_nm->print_nmethod(true);
_ok = false;
@@ -2112,7 +2112,7 @@
// Make sure all the entry points are correctly aligned for patching.
NativeJump::check_verified_entry_alignment(entry_point(), verified_entry_point());
- // assert(method()->is_oop(), "must be valid");
+ // assert(oopDesc::is_oop(method()), "must be valid");
ResourceMark rm;
--- a/hotspot/src/share/vm/code/relocInfo.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/code/relocInfo.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -867,7 +867,7 @@
// work even during GC or other inconvenient times.
if (WizardMode && oop_value != NULL) {
tty->print("oop_value=" INTPTR_FORMAT ": ", p2i(oop_value));
- if (oop_value->is_oop()) {
+ if (oopDesc::is_oop(oop_value)) {
oop_value->print_value_on(tty);
}
}
--- a/hotspot/src/share/vm/gc/cms/cmsOopClosures.inline.hpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/gc/cms/cmsOopClosures.inline.hpp Wed Aug 23 14:52:55 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -74,7 +74,7 @@
while (_work_queue->size() > max) {
oop newOop;
if (_work_queue->pop_local(newOop)) {
- assert(newOop->is_oop(), "Expected an oop");
+ assert(oopDesc::is_oop(newOop), "Expected an oop");
assert(_bit_map->isMarked((HeapWord*)newOop),
"only grey objects on this stack");
// iterate over the oops in this oop, marking and pushing
--- a/hotspot/src/share/vm/gc/cms/compactibleFreeListSpace.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/gc/cms/compactibleFreeListSpace.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -929,7 +929,7 @@
if (k != NULL) {
assert(k->is_klass(), "Should really be klass oop.");
oop o = (oop)p;
- assert(o->is_oop(true /* ignore mark word */), "Should be an oop.");
+ assert(oopDesc::is_oop(o, true /* ignore mark word */), "Should be an oop.");
size_t res = o->size_given_klass(k);
res = adjustObjectSize(res);
@@ -979,7 +979,7 @@
if (k != NULL) {
assert(k->is_klass(), "Should really be klass oop.");
oop o = (oop)p;
- assert(o->is_oop(), "Should be an oop");
+ assert(oopDesc::is_oop(o), "Should be an oop");
size_t res = o->size_given_klass(k);
res = adjustObjectSize(res);
@@ -1005,7 +1005,7 @@
// Ignore mark word because this may be a recently promoted
// object whose mark word is used to chain together grey
// objects (the last one would have a null value).
- assert(oop(p)->is_oop(true), "Should be an oop");
+ assert(oopDesc::is_oop(oop(p), true), "Should be an oop");
return adjustObjectSize(oop(p)->size());
}
}
@@ -1022,7 +1022,7 @@
// Ignore mark word because it may have been used to
// chain together promoted objects (the last one
// would have a null value).
- assert(oop(p)->is_oop(true), "Should be an oop");
+ assert(oopDesc::is_oop(oop(p), true), "Should be an oop");
return true;
} else {
return false; // Was not an object at the start of collection.
@@ -1066,7 +1066,7 @@
// Ignore mark word because it may have been used to
// chain together promoted objects (the last one
// would have a null value).
- assert(oop(p)->is_oop(true), "Should be an oop");
+ assert(oopDesc::is_oop(oop(p), true), "Should be an oop");
return true;
}
return false;
@@ -2174,7 +2174,7 @@
if (_sp->block_is_obj(addr)) {
was_obj = true;
oop p = oop(addr);
- guarantee(p->is_oop(), "Should be an oop");
+ guarantee(oopDesc::is_oop(p), "Should be an oop");
res = _sp->adjustObjectSize(p->size());
if (_sp->obj_is_alive(addr)) {
was_live = true;
@@ -2226,7 +2226,7 @@
guarantee(!_sp->is_in_reserved(obj) ||
_sp->block_is_obj((HeapWord*)obj),
"Should be an object");
- guarantee(obj->is_oop(), "Should be an oop");
+ guarantee(oopDesc::is_oop(obj), "Should be an oop");
obj->verify();
if (_past_remark) {
// Remark has been completed, the object should be marked
@@ -2243,7 +2243,7 @@
}
} else if (_sp->is_in_reserved(p)) {
// the reference is from FLS, and points out of FLS
- guarantee(obj->is_oop(), "Should be an oop");
+ guarantee(oopDesc::is_oop(obj), "Should be an oop");
obj->verify();
}
}
--- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -940,7 +940,7 @@
if (res != NULL) {
// See comment in allocate() about when objects should
// be allocated live.
- assert(obj->is_oop(), "Will dereference klass pointer below");
+ assert(oopDesc::is_oop(obj), "Will dereference klass pointer below");
collector()->promoted(false, // Not parallel
(HeapWord*)res, obj->is_objArray(), obj_size);
// promotion counters
@@ -1063,13 +1063,13 @@
}
assert(obj->klass_or_null() == NULL, "Object should be uninitialized here.");
assert(!((FreeChunk*)obj_ptr)->is_free(), "Error, block will look free but show wrong size");
- assert(old->is_oop(), "Will use and dereference old klass ptr below");
+ assert(oopDesc::is_oop(old), "Will use and dereference old klass ptr below");
// Finally, install the klass pointer (this should be volatile).
OrderAccess::storestore();
obj->set_klass(old->klass());
// We should now be able to calculate the right size for this object
- assert(obj->is_oop() && obj->size() == (int)word_sz, "Error, incorrect size computed for promoted object");
+ assert(oopDesc::is_oop(obj) && obj->size() == (int)word_sz, "Error, incorrect size computed for promoted object");
collector()->promoted(true, // parallel
obj_ptr, old->is_objArray(), word_sz);
@@ -3348,7 +3348,7 @@
// been published), so we do not need to check for
// uninitialized objects before pushing here.
void ParConcMarkingClosure::do_oop(oop obj) {
- assert(obj->is_oop_or_null(true), "Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
+ assert(oopDesc::is_oop_or_null(obj, true), "Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
HeapWord* addr = (HeapWord*)obj;
// Check if oop points into the CMS generation
// and is not marked
@@ -3390,7 +3390,7 @@
while (_work_queue->size() > max) {
oop new_oop;
if (_work_queue->pop_local(new_oop)) {
- assert(new_oop->is_oop(), "Should be an oop");
+ assert(oopDesc::is_oop(new_oop), "Should be an oop");
assert(_bit_map->isMarked((HeapWord*)new_oop), "Grey object");
assert(_span.contains((HeapWord*)new_oop), "Not in span");
new_oop->oop_iterate(this); // do_oop() above
@@ -3431,7 +3431,7 @@
// assert(work_q->size() > 0, "Work from overflow stack");
continue;
} else if (task_queues()->steal(i, seed, /* reference */ obj_to_scan)) {
- assert(obj_to_scan->is_oop(), "Should be an oop");
+ assert(oopDesc::is_oop(obj_to_scan), "Should be an oop");
assert(bm->isMarked((HeapWord*)obj_to_scan), "Grey object");
obj_to_scan->oop_iterate(&cl);
} else if (terminator()->offer_termination(&_term_term)) {
@@ -4522,7 +4522,7 @@
assert(mr.is_empty() || space->used_region().contains(mr),
"Should be in space");
// Verify that "start" is an object boundary
- assert(mr.is_empty() || oop(mr.start())->is_oop(),
+ assert(mr.is_empty() || oopDesc::is_oop(oop(mr.start())),
"Should be an oop");
space->par_oop_iterate(mr, cl);
}
@@ -4656,7 +4656,7 @@
// Try to steal from other queues that have work
if (task_queues()->steal(i, seed, /* reference */ obj_to_scan)) {
NOT_PRODUCT(num_steals++;)
- assert(obj_to_scan->is_oop(), "Oops, not an oop!");
+ assert(oopDesc::is_oop(obj_to_scan), "Oops, not an oop!");
assert(bm->isMarked((HeapWord*)obj_to_scan), "Stole an unmarked oop?");
// Do scanning work
obj_to_scan->oop_iterate(cl);
@@ -5135,7 +5135,7 @@
// Try to steal from other queues that have work
if (task_queues()->steal(i, seed, /* reference */ obj_to_scan)) {
NOT_PRODUCT(num_steals++;)
- assert(obj_to_scan->is_oop(), "Oops, not an oop!");
+ assert(oopDesc::is_oop(obj_to_scan), "Oops, not an oop!");
assert(_mark_bit_map->isMarked((HeapWord*)obj_to_scan), "Stole an unmarked oop?");
// Do scanning work
obj_to_scan->oop_iterate(keep_alive);
@@ -5825,7 +5825,7 @@
void MarkRefsIntoClosure::do_oop(oop obj) {
// if p points into _span, then mark corresponding bit in _markBitMap
- assert(obj->is_oop(), "expected an oop");
+ assert(oopDesc::is_oop(obj), "expected an oop");
HeapWord* addr = (HeapWord*)obj;
if (_span.contains(addr)) {
// this should be made more efficient
@@ -5847,7 +5847,7 @@
void ParMarkRefsIntoClosure::do_oop(oop obj) {
// if p points into _span, then mark corresponding bit in _markBitMap
- assert(obj->is_oop(), "expected an oop");
+ assert(oopDesc::is_oop(obj), "expected an oop");
HeapWord* addr = (HeapWord*)obj;
if (_span.contains(addr)) {
// this should be made more efficient
@@ -5871,7 +5871,7 @@
void MarkRefsIntoVerifyClosure::do_oop(oop obj) {
// if p points into _span, then mark corresponding bit in _markBitMap
- assert(obj->is_oop(), "expected an oop");
+ assert(oopDesc::is_oop(obj), "expected an oop");
HeapWord* addr = (HeapWord*)obj;
if (_span.contains(addr)) {
_verification_bm->mark(addr);
@@ -5925,7 +5925,7 @@
// The parallel version (Par_...) appears further below.
void MarkRefsIntoAndScanClosure::do_oop(oop obj) {
if (obj != NULL) {
- assert(obj->is_oop(), "expected an oop");
+ assert(oopDesc::is_oop(obj), "expected an oop");
HeapWord* addr = (HeapWord*)obj;
assert(_mark_stack->isEmpty(), "pre-condition (eager drainage)");
assert(_collector->overflow_list_is_empty(),
@@ -5941,7 +5941,7 @@
assert(res, "Should have space to push on empty stack");
do {
oop new_oop = _mark_stack->pop();
- assert(new_oop != NULL && new_oop->is_oop(), "Expected an oop");
+ assert(new_oop != NULL && oopDesc::is_oop(new_oop), "Expected an oop");
assert(_bit_map->isMarked((HeapWord*)new_oop),
"only grey objects on this stack");
// iterate over the oops in this oop, marking and pushing
@@ -6023,7 +6023,7 @@
if (obj != NULL) {
// Ignore mark word because this could be an already marked oop
// that may be chained at the end of the overflow list.
- assert(obj->is_oop(true), "expected an oop");
+ assert(oopDesc::is_oop(obj, true), "expected an oop");
HeapWord* addr = (HeapWord*)obj;
if (_span.contains(addr) &&
!_bit_map->isMarked(addr)) {
@@ -6069,7 +6069,7 @@
if (p->klass_or_null_acquire() != NULL) {
// an initialized object; ignore mark word in verification below
// since we are running concurrent with mutators
- assert(p->is_oop(true), "should be an oop");
+ assert(oopDesc::is_oop(p, true), "should be an oop");
if (p->is_objArray()) {
// objArrays are precisely marked; restrict scanning
// to dirty cards only.
@@ -6118,7 +6118,7 @@
} else {
// An object not (yet) reached by marking: we merely need to
// compute its size so as to go look at the next block.
- assert(p->is_oop(true), "should be an oop");
+ assert(oopDesc::is_oop(p, true), "should be an oop");
size = CompactibleFreeListSpace::adjustObjectSize(p->size());
}
}
@@ -6165,7 +6165,7 @@
assert(p->klass_or_null() != NULL, "object should be initialized");
// an initialized object; ignore mark word in verification below
// since we are running concurrent with mutators
- assert(p->is_oop(true), "should be an oop");
+ assert(oopDesc::is_oop(p, true), "should be an oop");
// Note that we do not yield while we iterate over
// the interior oops of p, pushing the relevant ones
// on our marking stack.
@@ -6179,7 +6179,7 @@
// from the grey objects at a later time.
while (!_mark_stack->isEmpty()) {
oop new_oop = _mark_stack->pop();
- assert(new_oop != NULL && new_oop->is_oop(), "Expected an oop");
+ assert(new_oop != NULL && oopDesc::is_oop(new_oop), "Expected an oop");
assert(_bit_map->isMarked((HeapWord*)new_oop),
"only grey objects on this stack");
// iterate over the oops in this oop, marking and pushing
@@ -6223,7 +6223,7 @@
// isMarked() query is "safe".
bool ScanMarkedObjectsAgainClosure::do_object_bm(oop p, MemRegion mr) {
// Ignore mark word because we are running concurrent with mutators
- assert(p->is_oop_or_null(true), "Expected an oop or NULL at " PTR_FORMAT, p2i(p));
+ assert(oopDesc::is_oop_or_null(p, true), "Expected an oop or NULL at " PTR_FORMAT, p2i(p));
HeapWord* addr = (HeapWord*)p;
assert(_span.contains(addr), "we are scanning the CMS generation");
bool is_obj_array = false;
@@ -6376,7 +6376,7 @@
oop obj = oop(ptr);
// Ignore mark word in verification below, since we
// may be running concurrent with mutators.
- assert(obj->is_oop(true), "should be an oop");
+ assert(oopDesc::is_oop(obj, true), "should be an oop");
assert(_finger <= ptr, "_finger runneth ahead");
// advance the finger to right end of this object
_finger = ptr + obj->size();
@@ -6423,7 +6423,7 @@
oop new_oop = _markStack->pop();
// Skip verifying header mark word below because we are
// running concurrent with mutators.
- assert(new_oop->is_oop(true), "Oops! expected to pop an oop");
+ assert(oopDesc::is_oop(new_oop, true), "Oops! expected to pop an oop");
// now scan this oop's oops
new_oop->oop_iterate(&pushOrMarkClosure);
do_yield_check();
@@ -6489,7 +6489,7 @@
oop obj = oop(ptr);
// Ignore mark word in verification below, since we
// may be running concurrent with mutators.
- assert(obj->is_oop(true), "should be an oop");
+ assert(oopDesc::is_oop(obj, true), "should be an oop");
assert(_finger <= ptr, "_finger runneth ahead");
// advance the finger to right end of this object
_finger = ptr + obj->size();
@@ -6550,7 +6550,7 @@
}
// Skip verifying header mark word below because we are
// running concurrent with mutators.
- assert(new_oop->is_oop(true), "Oops! expected to pop an oop");
+ assert(oopDesc::is_oop(new_oop, true), "Oops! expected to pop an oop");
// now scan this oop's oops
new_oop->oop_iterate(&pushOrMarkClosure);
do_yield_check();
@@ -6604,7 +6604,7 @@
"should drain stack to limit stack usage");
// convert addr to an oop preparatory to scanning
oop obj = oop(addr);
- assert(obj->is_oop(), "should be an oop");
+ assert(oopDesc::is_oop(obj), "should be an oop");
assert(_finger <= addr, "_finger runneth ahead");
// advance the finger to right end of this object
_finger = addr + obj->size();
@@ -6615,7 +6615,7 @@
assert(res, "Empty non-zero size stack should have space for single push");
while (!_mark_stack->isEmpty()) {
oop new_oop = _mark_stack->pop();
- assert(new_oop->is_oop(), "Oops! expected to pop an oop");
+ assert(oopDesc::is_oop(new_oop), "Oops! expected to pop an oop");
// now scan this oop's oops
new_oop->oop_iterate(&_pam_verify_closure);
}
@@ -6650,7 +6650,7 @@
}
void PushAndMarkVerifyClosure::do_oop(oop obj) {
- assert(obj->is_oop_or_null(), "Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
+ assert(oopDesc::is_oop_or_null(obj), "Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
HeapWord* addr = (HeapWord*)obj;
if (_span.contains(addr) && !_verification_bm->isMarked(addr)) {
// Oop lies in _span and isn't yet grey or black
@@ -6747,7 +6747,7 @@
void PushOrMarkClosure::do_oop(oop obj) {
// Ignore mark word because we are running concurrent with mutators.
- assert(obj->is_oop_or_null(true), "Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
+ assert(oopDesc::is_oop_or_null(obj, true), "Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
HeapWord* addr = (HeapWord*)obj;
if (_span.contains(addr) && !_bitMap->isMarked(addr)) {
// Oop lies in _span and isn't yet grey or black
@@ -6782,7 +6782,7 @@
void ParPushOrMarkClosure::do_oop(oop obj) {
// Ignore mark word because we are running concurrent with mutators.
- assert(obj->is_oop_or_null(true), "Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
+ assert(oopDesc::is_oop_or_null(obj, true), "Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
HeapWord* addr = (HeapWord*)obj;
if (_whole_span.contains(addr) && !_bit_map->isMarked(addr)) {
// Oop lies in _span and isn't yet grey or black
@@ -6855,7 +6855,7 @@
// phases, the object may already have been reached by a different
// path and may be at the end of the global overflow list (so
// the mark word may be NULL).
- assert(obj->is_oop_or_null(true /* ignore mark word */),
+ assert(oopDesc::is_oop_or_null(obj, true /* ignore mark word */),
"Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
HeapWord* addr = (HeapWord*)obj;
// Check if oop points into the CMS generation
@@ -6934,7 +6934,7 @@
// value, by the time we get to examined this failing assert in
// the debugger, is_oop_or_null(false) may subsequently start
// to hold.
- assert(obj->is_oop_or_null(true),
+ assert(oopDesc::is_oop_or_null(obj, true),
"Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
HeapWord* addr = (HeapWord*)obj;
// Check if oop points into the CMS generation
@@ -7325,7 +7325,7 @@
// This object is live: we'd normally expect this to be
// an oop, and like to assert the following:
- // assert(oop(addr)->is_oop(), "live block should be an oop");
+ // assert(oopDesc::is_oop(oop(addr)), "live block should be an oop");
// However, as we commented above, this may be an object whose
// header hasn't yet been initialized.
size_t size;
@@ -7341,7 +7341,7 @@
#ifdef ASSERT
if (oop(addr)->klass_or_null_acquire() != NULL) {
// Ignore mark word because we are running concurrent with mutators
- assert(oop(addr)->is_oop(true), "live block should be an oop");
+ assert(oopDesc::is_oop(oop(addr), true), "live block should be an oop");
assert(size ==
CompactibleFreeListSpace::adjustObjectSize(oop(addr)->size()),
"P-mark and computed size do not agree");
@@ -7353,7 +7353,7 @@
assert(oop(addr)->klass_or_null_acquire() != NULL,
"Should be an initialized object");
// Ignore mark word because we are running concurrent with mutators
- assert(oop(addr)->is_oop(true), "live block should be an oop");
+ assert(oopDesc::is_oop(oop(addr), true), "live block should be an oop");
// Verify that the bit map has no bits marked between
// addr and purported end of this block.
size = CompactibleFreeListSpace::adjustObjectSize(oop(addr)->size());
@@ -7661,7 +7661,7 @@
while (_work_queue->size() > max) {
oop new_oop;
if (_work_queue->pop_local(new_oop)) {
- assert(new_oop != NULL && new_oop->is_oop(), "Expected an oop");
+ assert(new_oop != NULL && oopDesc::is_oop(new_oop), "Expected an oop");
assert(_bit_map->isMarked((HeapWord*)new_oop),
"no white objects on this stack!");
assert(_span.contains((HeapWord*)new_oop), "Out of bounds oop");
@@ -7741,7 +7741,7 @@
HeapWord* addr = (HeapWord*)obj;
assert(_span.contains(addr), "Should be within span");
assert(_bit_map->isMarked(addr), "Should be marked");
- assert(obj->is_oop(), "Should be an oop");
+ assert(oopDesc::is_oop(obj), "Should be an oop");
obj->oop_iterate(_keep_alive);
}
}
@@ -7756,7 +7756,7 @@
while (_work_queue->size() > max) {
oop new_oop;
if (_work_queue->pop_local(new_oop)) {
- assert(new_oop->is_oop(), "Expected an oop");
+ assert(oopDesc::is_oop(new_oop), "Expected an oop");
assert(_bit_map->isMarked((HeapWord*)new_oop),
"no white objects on this stack!");
assert(_span.contains((HeapWord*)new_oop), "Out of bounds oop");
@@ -7807,7 +7807,7 @@
for (oop next; i > 0 && cur != NULL; cur = next, i--) {
next = oop(cur->mark());
cur->set_mark(proto); // until proven otherwise
- assert(cur->is_oop(), "Should be an oop");
+ assert(oopDesc::is_oop(cur), "Should be an oop");
bool res = stack->push(cur);
assert(res, "Bit off more than can chew?");
NOT_PRODUCT(n++;)
@@ -7951,7 +7951,7 @@
for (cur = prefix; cur != NULL; cur = next) {
next = oop(cur->mark());
cur->set_mark(proto); // until proven otherwise
- assert(cur->is_oop(), "Should be an oop");
+ assert(oopDesc::is_oop(cur), "Should be an oop");
bool res = work_q->push(cur);
assert(res, "Bit off more than we can chew?");
NOT_PRODUCT(n++;)
@@ -7966,7 +7966,7 @@
// Single-threaded
void CMSCollector::push_on_overflow_list(oop p) {
NOT_PRODUCT(_num_par_pushes++;)
- assert(p->is_oop(), "Not an oop");
+ assert(oopDesc::is_oop(p), "Not an oop");
preserve_mark_if_necessary(p);
p->set_mark((markOop)_overflow_list);
_overflow_list = p;
@@ -7975,7 +7975,7 @@
// Multi-threaded; use CAS to prepend to overflow list
void CMSCollector::par_push_on_overflow_list(oop p) {
NOT_PRODUCT(Atomic::inc_ptr(&_num_par_pushes);)
- assert(p->is_oop(), "Not an oop");
+ assert(oopDesc::is_oop(p), "Not an oop");
par_preserve_mark_if_necessary(p);
oop observed_overflow_list = _overflow_list;
oop cur_overflow_list;
@@ -8062,7 +8062,7 @@
while (!_preserved_oop_stack.is_empty()) {
oop p = _preserved_oop_stack.pop();
- assert(p->is_oop(), "Should be an oop");
+ assert(oopDesc::is_oop(p), "Should be an oop");
assert(_span.contains(p), "oop should be in _span");
assert(p->mark() == markOopDesc::prototype(),
"Set when taken from overflow list");
--- a/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -684,7 +684,7 @@
oop obj = oopDesc::load_decode_heap_oop_not_null(p);
// We never expect to see a null reference being processed
// as a weak reference.
- assert(obj->is_oop(), "expected an oop while scanning weak refs");
+ assert(oopDesc::is_oop(obj), "expected an oop while scanning weak refs");
}
#endif // ASSERT
@@ -711,7 +711,7 @@
oop obj = oopDesc::load_decode_heap_oop_not_null(p);
// We never expect to see a null reference being processed
// as a weak reference.
- assert(obj->is_oop(), "expected an oop while scanning weak refs");
+ assert(oopDesc::is_oop(obj), "expected an oop while scanning weak refs");
}
#endif // ASSERT
--- a/hotspot/src/share/vm/gc/cms/promotionInfo.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/gc/cms/promotionInfo.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
} else {
res = (PromotedObject*)(_next & next_mask);
}
- assert(oop(res)->is_oop_or_null(true /* ignore mark word */), "Expected an oop or NULL at " PTR_FORMAT, p2i(oop(res)));
+ assert(oopDesc::is_oop_or_null(oop(res), true /* ignore mark word */), "Expected an oop or NULL at " PTR_FORMAT, p2i(oop(res)));
return res;
}
@@ -299,7 +299,7 @@
for (PromotedObject* curObj = _promoHead; curObj != NULL; curObj = curObj->next()) {
guarantee(space()->is_in_reserved((HeapWord*)curObj), "Containment");
// the last promoted object may fail the mark() != NULL test of is_oop().
- guarantee(curObj->next() == NULL || oop(curObj)->is_oop(), "must be an oop");
+ guarantee(curObj->next() == NULL || oopDesc::is_oop(oop(curObj)), "must be an oop");
if (curObj->hasDisplacedMark()) {
numObjsWithDisplacedHdrs++;
}
--- a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -1918,7 +1918,7 @@
guarantee(_g1h->is_in_reserved(task_entry.slice()), "Slice " PTR_FORMAT " must be in heap.", p2i(task_entry.slice()));
return;
}
- guarantee(task_entry.obj()->is_oop(),
+ guarantee(oopDesc::is_oop(task_entry.obj()),
"Non-oop " PTR_FORMAT ", phase: %s, info: %d",
p2i(task_entry.obj()), _phase, _info);
guarantee(!_g1h->is_in_cset(task_entry.obj()),
@@ -2313,7 +2313,7 @@
if (task_entry.is_null()) {
break;
}
- assert(task_entry.is_array_slice() || task_entry.obj()->is_oop(), "Element " PTR_FORMAT " must be an array slice or oop", p2i(task_entry.obj()));
+ assert(task_entry.is_array_slice() || oopDesc::is_oop(task_entry.obj()), "Element " PTR_FORMAT " must be an array slice or oop", p2i(task_entry.obj()));
bool success = _task_queue->push(task_entry);
// We only call this when the local queue is empty or under a
// given target limit. So, we do not expect this push to fail.
--- a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.inline.hpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.inline.hpp Wed Aug 23 14:52:55 2017 -0400
@@ -217,7 +217,7 @@
}
bool G1ConcurrentMark::isPrevMarked(oop p) const {
- assert(p != NULL && p->is_oop(), "expected an oop");
+ assert(p != NULL && oopDesc::is_oop(p), "expected an oop");
return _prevMarkBitMap->is_marked((HeapWord*)p);
}
--- a/hotspot/src/share/vm/gc/g1/g1OopClosures.inline.hpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1OopClosures.inline.hpp Wed Aug 23 14:52:55 2017 -0400
@@ -107,7 +107,7 @@
#ifdef ASSERT
G1CollectedHeap* g1 = G1CollectedHeap::heap();
// can't do because of races
- // assert(obj == NULL || obj->is_oop(), "expected an oop");
+ // assert(oopDesc::is_oop_or_null(obj), "expected an oop");
assert(check_obj_alignment(obj), "not oop aligned");
assert(g1->is_in_reserved(obj), "must be in heap");
--- a/hotspot/src/share/vm/gc/g1/g1RemSet.inline.hpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1RemSet.inline.hpp Wed Aug 23 14:52:55 2017 -0400
@@ -39,7 +39,7 @@
#ifdef ASSERT
// can't do because of races
- // assert(obj == NULL || obj->is_oop(), "expected an oop");
+ // assert(oopDesc::is_oop_or_null(obj), "expected an oop");
assert(check_obj_alignment(obj), "not oop aligned");
assert(_g1->is_in_reserved(obj), "must be in heap");
#endif // ASSERT
--- a/hotspot/src/share/vm/gc/g1/g1SATBCardTableModRefBS.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1SATBCardTableModRefBS.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
void G1SATBCardTableModRefBS::enqueue(oop pre_val) {
// Nulls should have been already filtered.
- assert(pre_val->is_oop(true), "Error");
+ assert(oopDesc::is_oop(pre_val, true), "Error");
if (!JavaThread::satb_mark_queue_set().is_active()) return;
Thread* thr = Thread::current();
--- a/hotspot/src/share/vm/gc/g1/heapRegion.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/gc/g1/heapRegion.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -610,7 +610,7 @@
LogStream ls(log.error());
_containing_obj->print_on(&ls);
log.error("points to obj " PTR_FORMAT " in region " HR_FORMAT, p2i(obj), HR_FORMAT_PARAMS(to));
- if (obj->is_oop()) {
+ if (oopDesc::is_oop(obj)) {
obj->print_on(&ls);
}
log.error("Obj head CTE = %d, field CTE = %d.", cv_obj, cv_field);
@@ -657,7 +657,7 @@
object_num += 1;
if (!g1->is_obj_dead_cond(obj, this, vo)) {
- if (obj->is_oop()) {
+ if (oopDesc::is_oop(obj)) {
Klass* klass = obj->klass();
bool is_metaspace_object = Metaspace::contains(klass) ||
(vo == VerifyOption_G1UsePrevMarking &&
@@ -803,7 +803,7 @@
size_t obj_size = block_size(p);
if (!g1->is_obj_dead_cond(obj, this, vo)) {
- if (obj->is_oop()) {
+ if (oopDesc::is_oop(obj)) {
vr_cl.set_containing_obj(obj);
obj->oop_iterate_no_header(&vr_cl);
--- a/hotspot/src/share/vm/gc/g1/heapRegion.inline.hpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/gc/g1/heapRegion.inline.hpp Wed Aug 23 14:52:55 2017 -0400
@@ -337,7 +337,7 @@
const G1CMBitMap* const bitmap = g1h->concurrent_mark()->prevMarkBitMap();
do {
oop obj = oop(cur);
- assert(obj->is_oop(true), "Not an oop at " PTR_FORMAT, p2i(cur));
+ assert(oopDesc::is_oop(obj, true), "Not an oop at " PTR_FORMAT, p2i(cur));
assert(obj->klass_or_null() != NULL,
"Unparsable heap at " PTR_FORMAT, p2i(cur));
--- a/hotspot/src/share/vm/gc/g1/satbMarkQueue.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/gc/g1/satbMarkQueue.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -95,7 +95,7 @@
return false;
}
- assert(((oop)entry)->is_oop(true /* ignore mark word */),
+ assert(oopDesc::is_oop(oop(entry), true /* ignore mark word */),
"Invalid oop in SATB buffer: " PTR_FORMAT, p2i(entry));
return true;
--- a/hotspot/src/share/vm/gc/parallel/cardTableExtension.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/gc/parallel/cardTableExtension.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -287,7 +287,7 @@
while (p < to) {
Prefetch::write(p, interval);
oop m = oop(p);
- assert(m->is_oop_or_null(), "Expected an oop or NULL for header field at " PTR_FORMAT, p2i(m));
+ assert(oopDesc::is_oop_or_null(m), "Expected an oop or NULL for header field at " PTR_FORMAT, p2i(m));
pm->push_contents(m);
p += m->size();
}
@@ -295,7 +295,7 @@
} else {
while (p < to) {
oop m = oop(p);
- assert(m->is_oop_or_null(), "Expected an oop or NULL for header field at " PTR_FORMAT, p2i(m));
+ assert(oopDesc::is_oop_or_null(m), "Expected an oop or NULL for header field at " PTR_FORMAT, p2i(m));
pm->push_contents(m);
p += m->size();
}
--- a/hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -2597,7 +2597,7 @@
start_array->allocate_block(addr);
}
cm->update_contents(oop(addr));
- assert(oop(addr)->is_oop_or_null(), "Expected an oop or NULL at " PTR_FORMAT, p2i(oop(addr)));
+ assert(oopDesc::is_oop_or_null(oop(addr)), "Expected an oop or NULL at " PTR_FORMAT, p2i(oop(addr)));
}
}
}
@@ -3144,7 +3144,7 @@
oop moved_oop = (oop) destination();
compaction_manager()->update_contents(moved_oop);
- assert(moved_oop->is_oop_or_null(), "Expected an oop or NULL at " PTR_FORMAT, p2i(moved_oop));
+ assert(oopDesc::is_oop_or_null(moved_oop), "Expected an oop or NULL at " PTR_FORMAT, p2i(moved_oop));
update_state(words);
assert(destination() == (HeapWord*)moved_oop + moved_oop->size(), "sanity");
--- a/hotspot/src/share/vm/gc/parallel/psScavenge.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/gc/parallel/psScavenge.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -95,7 +95,7 @@
template <class T> void do_oop_work(T* p) {
assert (!oopDesc::is_null(*p), "expected non-null ref");
- assert ((oopDesc::load_decode_heap_oop_not_null(p))->is_oop(),
+ assert (oopDesc::is_oop(oopDesc::load_decode_heap_oop_not_null(p)),
"expected an oop while scanning weak refs");
// Weak refs may be visited more than once.
--- a/hotspot/src/share/vm/gc/serial/defNewGeneration.inline.hpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/gc/serial/defNewGeneration.inline.hpp Wed Aug 23 14:52:55 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -41,7 +41,7 @@
// as a weak reference.
assert (!oopDesc::is_null(*p), "expected non-null ref");
oop obj = oopDesc::load_decode_heap_oop_not_null(p);
- assert (obj->is_oop(), "expected an oop while scanning weak refs");
+ assert (oopDesc::is_oop(obj), "expected an oop while scanning weak refs");
}
#endif // ASSERT
@@ -74,7 +74,7 @@
// as a weak reference.
assert (!oopDesc::is_null(*p), "expected non-null ref");
oop obj = oopDesc::load_decode_heap_oop_not_null(p);
- assert (obj->is_oop(), "expected an oop while scanning weak refs");
+ assert (oopDesc::is_oop(obj), "expected an oop while scanning weak refs");
}
#endif // ASSERT
--- a/hotspot/src/share/vm/gc/shared/blockOffsetTable.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/gc/shared/blockOffsetTable.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -343,7 +343,7 @@
oop o = oop(start);
assert(!Universe::is_fully_initialized() ||
_sp->is_free_block(start) ||
- o->is_oop_or_null(), "Bad object was found");
+ oopDesc::is_oop_or_null(o), "Bad object was found");
next_index++;
last_p = p;
last_start = start;
--- a/hotspot/src/share/vm/gc/shared/collectedHeap.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/gc/shared/collectedHeap.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -350,7 +350,7 @@
assert(is_in(old_obj), "Not in allocated heap");
assert(!can_elide_initializing_store_barrier(old_obj),
"Else should have been filtered in new_store_pre_barrier()");
- assert(old_obj->is_oop(true), "Not an oop");
+ assert(oopDesc::is_oop(old_obj, true), "Not an oop");
assert(deferred.word_size() == (size_t)(old_obj->size()),
"Mismatch: multiple objects?");
}
--- a/hotspot/src/share/vm/gc/shared/referenceProcessor.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/gc/shared/referenceProcessor.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -401,7 +401,7 @@
void DiscoveredListIterator::load_ptrs(DEBUG_ONLY(bool allow_null_referent)) {
_discovered_addr = java_lang_ref_Reference::discovered_addr(_ref);
oop discovered = java_lang_ref_Reference::discovered(_ref);
- assert(_discovered_addr && discovered->is_oop_or_null(),
+ assert(_discovered_addr && oopDesc::is_oop_or_null(discovered),
"Expected an oop or NULL for discovered field at " PTR_FORMAT, p2i(discovered));
_next = discovered;
_referent_addr = java_lang_ref_Reference::referent_addr(_ref);
@@ -409,15 +409,15 @@
assert(Universe::heap()->is_in_reserved_or_null(_referent),
"Wrong oop found in java.lang.Reference object");
assert(allow_null_referent ?
- _referent->is_oop_or_null()
- : _referent->is_oop(),
+ oopDesc::is_oop_or_null(_referent)
+ : oopDesc::is_oop(_referent),
"Expected an oop%s for referent field at " PTR_FORMAT,
(allow_null_referent ? " or NULL" : ""),
p2i(_referent));
}
void DiscoveredListIterator::remove() {
- assert(_ref->is_oop(), "Dropping a bad reference");
+ assert(oopDesc::is_oop(_ref), "Dropping a bad reference");
oop_store_raw(_discovered_addr, NULL);
// First _prev_next ref actually points into DiscoveredList (gross).
@@ -534,7 +534,7 @@
oop next = java_lang_ref_Reference::next(iter.obj());
if ((iter.referent() == NULL || iter.is_referent_alive() ||
next != NULL)) {
- assert(next->is_oop_or_null(), "Expected an oop or NULL for next field at " PTR_FORMAT, p2i(next));
+ assert(oopDesc::is_oop_or_null(next), "Expected an oop or NULL for next field at " PTR_FORMAT, p2i(next));
// Remove Reference object from list
iter.remove();
// Trace the cohorts
@@ -582,7 +582,7 @@
}
log_develop_trace(gc, ref)("Adding %sreference (" INTPTR_FORMAT ": %s) as pending",
clear_referent ? "cleared " : "", p2i(iter.obj()), iter.obj()->klass()->internal_name());
- assert(iter.obj()->is_oop(UseConcMarkSweepGC), "Adding a bad reference");
+ assert(oopDesc::is_oop(iter.obj(), UseConcMarkSweepGC), "Adding a bad reference");
iter.next();
}
// Close the reachable set
@@ -979,7 +979,7 @@
void ReferenceProcessor::verify_referent(oop obj) {
bool da = discovery_is_atomic();
oop referent = java_lang_ref_Reference::referent(obj);
- assert(da ? referent->is_oop() : referent->is_oop_or_null(),
+ assert(da ? oopDesc::is_oop(referent) : oopDesc::is_oop_or_null(referent),
"Bad referent " INTPTR_FORMAT " found in Reference "
INTPTR_FORMAT " during %satomic discovery ",
p2i(referent), p2i(obj), da ? "" : "non-");
@@ -1057,7 +1057,7 @@
HeapWord* const discovered_addr = java_lang_ref_Reference::discovered_addr(obj);
const oop discovered = java_lang_ref_Reference::discovered(obj);
- assert(discovered->is_oop_or_null(), "Expected an oop or NULL for discovered field at " PTR_FORMAT, p2i(discovered));
+ assert(oopDesc::is_oop_or_null(discovered), "Expected an oop or NULL for discovered field at " PTR_FORMAT, p2i(discovered));
if (discovered != NULL) {
// The reference has already been discovered...
log_develop_trace(gc, ref)("Already discovered reference (" INTPTR_FORMAT ": %s)",
@@ -1118,7 +1118,7 @@
log_develop_trace(gc, ref)("Discovered reference (" INTPTR_FORMAT ": %s)", p2i(obj), obj->klass()->internal_name());
}
- assert(obj->is_oop(), "Discovered a bad reference");
+ assert(oopDesc::is_oop(obj), "Discovered a bad reference");
verify_referent(obj);
return true;
}
--- a/hotspot/src/share/vm/gc/shared/space.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/gc/shared/space.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -491,7 +491,7 @@
HeapWord* obj_addr = mr.start(); \
HeapWord* t = mr.end(); \
while (obj_addr < t) { \
- assert(oop(obj_addr)->is_oop(), "Should be an oop"); \
+ assert(oopDesc::is_oop(oop(obj_addr)), "Should be an oop"); \
obj_addr += oop(obj_addr)->oop_iterate_size(blk); \
} \
}
@@ -584,7 +584,7 @@
last = cur;
cur += oop(cur)->size();
}
- assert(oop(last)->is_oop(), PTR_FORMAT " should be an object start", p2i(last));
+ assert(oopDesc::is_oop(oop(last)), PTR_FORMAT " should be an object start", p2i(last));
return last;
}
}
@@ -597,10 +597,10 @@
assert(p <= current_top,
"p > current top - p: " PTR_FORMAT ", current top: " PTR_FORMAT,
p2i(p), p2i(current_top));
- assert(p == current_top || oop(p)->is_oop(),
+ assert(p == current_top || oopDesc::is_oop(oop(p)),
"p (" PTR_FORMAT ") is not a block start - "
"current_top: " PTR_FORMAT ", is_oop: %s",
- p2i(p), p2i(current_top), BOOL_TO_STR(oop(p)->is_oop()));
+ p2i(p), p2i(current_top), BOOL_TO_STR(oopDesc::is_oop(oop(p))));
if (p < current_top) {
return oop(p)->size();
} else {
--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp Wed Aug 23 14:52:55 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
#ifdef ASSERT
#define VERIFY_OOP(o_) \
if (VerifyOops) { \
- assert((oop(o_))->is_oop_or_null(), "Expected an oop or NULL at " PTR_FORMAT, p2i(oop(o_))); \
+ assert(oopDesc::is_oop_or_null(oop(o_)), "Expected an oop or NULL at " PTR_FORMAT, p2i(oop(o_))); \
StubRoutines::_verify_oop_count++; \
}
#else
--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -208,7 +208,7 @@
IRT_ENTRY(void, InterpreterRuntime::register_finalizer(JavaThread* thread, oopDesc* obj))
- assert(obj->is_oop(), "must be a valid oop");
+ assert(oopDesc::is_oop(obj), "must be a valid oop");
assert(obj->klass()->has_finalizer(), "shouldn't be here otherwise");
InstanceKlass::register_finalizer(instanceOop(obj), CHECK);
IRT_END
@@ -435,7 +435,6 @@
// assertions
#ifdef ASSERT
assert(h_exception.not_null(), "NULL exceptions should be handled by athrow");
- assert(h_exception->is_oop(), "just checking");
// Check that exception is a subclass of Throwable, otherwise we have a VerifyError
if (!(h_exception->is_a(SystemDictionary::Throwable_klass()))) {
if (ExitVMOnVerifyError) vm_exit(-1);
--- a/hotspot/src/share/vm/interpreter/linkResolver.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -1318,8 +1318,6 @@
int vtable_index = Method::invalid_vtable_index;
methodHandle selected_method;
- assert(recv.is_null() || recv->is_oop(), "receiver is not an oop");
-
// runtime method resolution
if (check_null_and_abstract && recv.is_null()) { // check if receiver exists
THROW(vmSymbols::java_lang_NullPointerException());
--- a/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -239,7 +239,6 @@
}
#ifdef ASSERT
assert(exception.not_null(), "NULL exceptions should be handled by throw_exception");
- assert(exception->is_oop(), "just checking");
// Check that exception is a subclass of Throwable, otherwise we have a VerifyError
if (!(exception->is_a(SystemDictionary::Throwable_klass()))) {
if (ExitVMOnVerifyError) vm_exit(-1);
@@ -385,7 +384,6 @@
}
#endif
Handle h_obj(thread, obj);
- assert(h_obj()->is_oop(), "must be NULL or an object");
if (UseBiasedLocking) {
// Retry fast entry if bias is revoked to avoid unnecessary inflation
ObjectSynchronizer::fast_enter(h_obj, lock, true, CHECK);
@@ -407,7 +405,7 @@
EXCEPTION_MARK;
#ifdef DEBUG
- if (!obj->is_oop()) {
+ if (!oopDesc::is_oop(obj)) {
ResetNoHandleMark rhm;
nmethod* method = thread->last_frame().cb()->as_nmethod_or_null();
if (method != NULL) {
@@ -455,8 +453,8 @@
if (obj == NULL) {
tty->print("NULL");
- } else if (obj->is_oop_or_null(true) && (!as_string || !java_lang_String::is_instance(obj))) {
- if (obj->is_oop_or_null(true)) {
+ } else if (oopDesc::is_oop_or_null(obj, true) && (!as_string || !java_lang_String::is_instance(obj))) {
+ if (oopDesc::is_oop_or_null(obj, true)) {
char buf[O_BUFLEN];
tty->print("%s@" INTPTR_FORMAT, obj->klass()->name()->as_C_string(buf, O_BUFLEN), p2i(obj));
} else {
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -3207,7 +3207,7 @@
protected:
template <class T> void do_oop_work(T* p) {
oop obj = oopDesc::load_decode_heap_oop(p);
- if (!obj->is_oop_or_null()) {
+ if (!oopDesc::is_oop_or_null(obj)) {
tty->print_cr("Failed: " PTR_FORMAT " -> " PTR_FORMAT, p2i(p), p2i(obj));
Universe::print_on(tty);
guarantee(false, "boom");
--- a/hotspot/src/share/vm/oops/instanceRefKlass.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/oops/instanceRefKlass.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -72,12 +72,12 @@
// Verify referent field
oop referent = java_lang_ref_Reference::referent(obj);
if (referent != NULL) {
- guarantee(referent->is_oop(), "referent field heap failed");
+ guarantee(oopDesc::is_oop(referent), "referent field heap failed");
}
// Verify next field
oop next = java_lang_ref_Reference::next(obj);
if (next != NULL) {
- guarantee(next->is_oop(), "next field should be an oop");
+ guarantee(oopDesc::is_oop(next), "next field should be an oop");
guarantee(next->is_instance(), "next field should be an instance");
guarantee(InstanceKlass::cast(next->klass())->is_reference_instance_klass(), "next field verify failed");
}
--- a/hotspot/src/share/vm/oops/klass.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/oops/klass.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -713,12 +713,12 @@
}
if (java_mirror() != NULL) {
- guarantee(java_mirror()->is_oop(), "should be instance");
+ guarantee(oopDesc::is_oop(java_mirror()), "should be instance");
}
}
void Klass::oop_verify_on(oop obj, outputStream* st) {
- guarantee(obj->is_oop(), "should be oop");
+ guarantee(oopDesc::is_oop(obj), "should be oop");
guarantee(obj->klass()->is_klass(), "klass field is not a klass");
}
--- a/hotspot/src/share/vm/oops/objArrayKlass.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/oops/objArrayKlass.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -498,6 +498,6 @@
guarantee(obj->is_objArray(), "must be objArray");
objArrayOop oa = objArrayOop(obj);
for(int index = 0; index < oa->length(); index++) {
- guarantee(oa->obj_at(index)->is_oop_or_null(), "should be oop");
+ guarantee(oopDesc::is_oop_or_null(oa->obj_at(index)), "should be oop");
}
}
--- a/hotspot/src/share/vm/oops/oop.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/oops/oop.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -121,11 +121,44 @@
}
}
+// used only for asserts and guarantees
+bool oopDesc::is_oop(oop obj, bool ignore_mark_word) {
+ if (!check_obj_alignment(obj)) return false;
+ if (!Universe::heap()->is_in_reserved(obj)) return false;
+ // obj is aligned and accessible in heap
+ if (Universe::heap()->is_in_reserved(obj->klass_or_null())) return false;
+
+ // Header verification: the mark is typically non-NULL. If we're
+ // at a safepoint, it must not be null.
+ // Outside of a safepoint, the header could be changing (for example,
+ // another thread could be inflating a lock on this object).
+ if (ignore_mark_word) {
+ return true;
+ }
+ if (obj->mark() != NULL) {
+ return true;
+ }
+ return !SafepointSynchronize::is_at_safepoint();
+}
+
+// used only for asserts and guarantees
+bool oopDesc::is_oop_or_null(oop obj, bool ignore_mark_word) {
+ return obj == NULL ? true : is_oop(obj, ignore_mark_word);
+}
+
+#ifndef PRODUCT
+// used only for asserts
+bool oopDesc::is_unlocked_oop() const {
+ if (!Universe::heap()->is_in_reserved(this)) return false;
+ return mark()->is_unlocked();
+}
+#endif // PRODUCT
+
VerifyOopClosure VerifyOopClosure::verify_oop;
template <class T> void VerifyOopClosure::do_oop_work(T* p) {
oop obj = oopDesc::load_decode_heap_oop(p);
- guarantee(obj->is_oop_or_null(), "invalid oop: " INTPTR_FORMAT, p2i((oopDesc*) obj));
+ guarantee(oopDesc::is_oop_or_null(obj), "invalid oop: " INTPTR_FORMAT, p2i((oopDesc*) obj));
}
void VerifyOopClosure::do_oop(oop* p) { VerifyOopClosure::do_oop_work(p); }
--- a/hotspot/src/share/vm/oops/oop.hpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/oops/oop.hpp Wed Aug 23 14:52:55 2017 -0400
@@ -287,9 +287,9 @@
inline bool is_unlocked() const;
inline bool has_bias_pattern() const;
- // asserts
- inline bool is_oop(bool ignore_mark_word = false) const;
- inline bool is_oop_or_null(bool ignore_mark_word = false) const;
+ // asserts and guarantees
+ static bool is_oop(oop obj, bool ignore_mark_word = false);
+ static bool is_oop_or_null(oop obj, bool ignore_mark_word = false);
#ifndef PRODUCT
inline bool is_unlocked_oop() const;
#endif
--- a/hotspot/src/share/vm/oops/oop.inline.hpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/oops/oop.inline.hpp Wed Aug 23 14:52:55 2017 -0400
@@ -533,41 +533,6 @@
return mark()->has_bias_pattern();
}
-// used only for asserts
-bool oopDesc::is_oop(bool ignore_mark_word) const {
- oop obj = (oop) this;
- if (!check_obj_alignment(obj)) return false;
- if (!Universe::heap()->is_in_reserved(obj)) return false;
- // obj is aligned and accessible in heap
- if (Universe::heap()->is_in_reserved(obj->klass_or_null())) return false;
-
- // Header verification: the mark is typically non-NULL. If we're
- // at a safepoint, it must not be null.
- // Outside of a safepoint, the header could be changing (for example,
- // another thread could be inflating a lock on this object).
- if (ignore_mark_word) {
- return true;
- }
- if (mark() != NULL) {
- return true;
- }
- return !SafepointSynchronize::is_at_safepoint();
-}
-
-
-// used only for asserts
-bool oopDesc::is_oop_or_null(bool ignore_mark_word) const {
- return this == NULL ? true : is_oop(ignore_mark_word);
-}
-
-#ifndef PRODUCT
-// used only for asserts
-bool oopDesc::is_unlocked_oop() const {
- if (!Universe::heap()->is_in_reserved(this)) return false;
- return mark()->is_unlocked();
-}
-#endif // PRODUCT
-
// Used only for markSweep, scavenging
bool oopDesc::is_gc_marked() const {
return mark()->is_marked();
--- a/hotspot/src/share/vm/opto/runtime.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/opto/runtime.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1563,7 +1563,7 @@
JRT_ENTRY_NO_ASYNC(void, OptoRuntime::register_finalizer(oopDesc* obj, JavaThread* thread))
- assert(obj->is_oop(), "must be a valid oop");
+ assert(oopDesc::is_oop(obj), "must be a valid oop");
assert(obj->klass()->has_finalizer(), "shouldn't be here otherwise");
InstanceKlass::register_finalizer(instanceOop(obj), CHECK);
JRT_END
--- a/hotspot/src/share/vm/prims/jvm.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/prims/jvm.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -326,8 +326,8 @@
}
arrayOop s = arrayOop(JNIHandles::resolve_non_null(src));
arrayOop d = arrayOop(JNIHandles::resolve_non_null(dst));
- assert(s->is_oop(), "JVM_ArrayCopy: src not an oop");
- assert(d->is_oop(), "JVM_ArrayCopy: dst not an oop");
+ assert(oopDesc::is_oop(s), "JVM_ArrayCopy: src not an oop");
+ assert(oopDesc::is_oop(d), "JVM_ArrayCopy: dst not an oop");
// Do copy
s->klass()->copy_array(s, src_pos, d, dst_pos, length, thread);
JVM_END
--- a/hotspot/src/share/vm/prims/privilegedStack.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/prims/privilegedStack.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -39,8 +39,8 @@
#endif // CHECK_UNHANDLED_OOPS
_frame_id = vfst->frame_id();
_next = next;
- assert(_privileged_context == NULL || _privileged_context->is_oop(), "must be an oop");
- assert(protection_domain() == NULL || protection_domain()->is_oop(), "must be an oop");
+ assert(oopDesc::is_oop_or_null(_privileged_context), "must be an oop");
+ assert(oopDesc::is_oop_or_null(protection_domain()), "must be an oop");
}
void PrivilegedElement::oops_do(OopClosure* f) {
--- a/hotspot/src/share/vm/runtime/deoptimization.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/runtime/deoptimization.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -217,7 +217,7 @@
// Reallocation may trigger GC. If deoptimization happened on return from
// call which returns oop we need to save it since it is not in oopmap.
oop result = deoptee.saved_oop_result(&map);
- assert(result == NULL || result->is_oop(), "must be oop");
+ assert(oopDesc::is_oop_or_null(result), "must be oop");
return_value = Handle(thread, result);
assert(Universe::heap()->is_in_or_null(result), "must be heap pointer");
if (TraceDeoptimization) {
--- a/hotspot/src/share/vm/runtime/handles.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/runtime/handles.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -34,7 +34,7 @@
oop* HandleArea::allocate_handle(oop obj) {
assert(_handle_mark_nesting > 1, "memory leak: allocating handle outside HandleMark");
assert(_no_handle_mark_nesting == 0, "allocating handle inside NoHandleMark");
- assert(obj->is_oop(), "not an oop: " INTPTR_FORMAT, p2i(obj));
+ assert(oopDesc::is_oop(obj), "not an oop: " INTPTR_FORMAT, p2i(obj));
return real_allocate_handle(obj);
}
#endif
@@ -99,7 +99,7 @@
while (bottom < top) {
// This test can be moved up but for now check every oop.
- assert((*bottom)->is_oop(), "handle should point to oop");
+ assert(oopDesc::is_oop(*bottom), "handle should point to oop");
f->do_oop(bottom++);
}
--- a/hotspot/src/share/vm/runtime/javaCalls.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/runtime/javaCalls.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -567,7 +567,7 @@
"Bad JNI oop argument %d: " PTR_FORMAT, _pos, v);
// Verify the pointee.
oop vv = resolve_indirect_oop(v, _value_state[_pos]);
- guarantee(vv->is_oop_or_null(true),
+ guarantee(oopDesc::is_oop_or_null(vv, true),
"Bad JNI oop argument %d: " PTR_FORMAT " -> " PTR_FORMAT,
_pos, v, p2i(vv));
}
--- a/hotspot/src/share/vm/runtime/os.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/runtime/os.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -988,7 +988,7 @@
// See if we were just given an oop directly
if (p != NULL && Universe::heap()->block_is_obj(p)) {
print = true;
- } else if (p == NULL && ((oopDesc*)addr)->is_oop()) {
+ } else if (p == NULL && oopDesc::is_oop(oop(addr))) {
p = (HeapWord*) addr;
print = true;
}
--- a/hotspot/src/share/vm/runtime/safepoint.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/runtime/safepoint.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -1104,7 +1104,7 @@
// the other registers. In order to preserve it over GCs we need
// to keep it in a handle.
oop result = caller_fr.saved_oop_result(&map);
- assert(result == NULL || result->is_oop(), "must be oop");
+ assert(oopDesc::is_oop_or_null(result), "must be oop");
return_value = Handle(thread(), result);
assert(Universe::heap()->is_in_or_null(result), "must be heap pointer");
}
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -209,7 +209,7 @@
assert(false, "should be optimized out");
return;
}
- assert(orig->is_oop(true /* ignore mark word */), "Error");
+ assert(oopDesc::is_oop(orig, true /* ignore mark word */), "Error");
// store the original value that was in the field reference
thread->satb_mark_queue().enqueue(orig);
JRT_END
@@ -585,7 +585,7 @@
int args_size = ArgumentSizeComputer(sig).size() + 1;
assert(args_size <= caller.interpreter_frame_expression_stack_size(), "receiver must be on interpreter stack");
oop result = cast_to_oop(*caller.interpreter_frame_tos_at(args_size - 1));
- assert(Universe::heap()->is_in(result) && result->is_oop(), "receiver must be an oop");
+ assert(Universe::heap()->is_in(result) && oopDesc::is_oop(result), "receiver must be an oop");
return result;
}
@@ -997,7 +997,7 @@
return;
}
#endif // INCLUDE_JVMCI
- assert(obj->is_oop(), "must be a valid oop");
+ assert(oopDesc::is_oop(obj), "must be a valid oop");
assert(obj->klass()->has_finalizer(), "shouldn't be here otherwise");
InstanceKlass::register_finalizer(instanceOop(obj), CHECK);
JRT_END
@@ -1165,8 +1165,6 @@
}
}
- assert(receiver.is_null() || receiver->is_oop(), "wrong receiver");
-
// Resolve method
if (attached_method.not_null()) {
// Parameterized by attached method.
--- a/hotspot/src/share/vm/runtime/thread.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/runtime/thread.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -3187,7 +3187,7 @@
oop obj = oopDesc::load_decode_heap_oop(p);
if (obj == NULL) return;
tty->print(INTPTR_FORMAT ": ", p2i(p));
- if (obj->is_oop_or_null()) {
+ if (oopDesc::is_oop_or_null(obj)) {
if (obj->is_objArray()) {
tty->print_cr("valid objArray: " INTPTR_FORMAT, p2i(obj));
} else {
--- a/hotspot/src/share/vm/services/heapDumper.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/services/heapDumper.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -764,7 +764,7 @@
// reflection and Unsafe classes may have a reference to a
// Klass* so filter it out.
- assert(o->is_oop_or_null(), "Expected an oop or NULL at " PTR_FORMAT, p2i(o));
+ assert(oopDesc::is_oop_or_null(o), "Expected an oop or NULL at " PTR_FORMAT, p2i(o));
writer->write_objectID(o);
break;
}
--- a/hotspot/src/share/vm/shark/sharkRuntime.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/shark/sharkRuntime.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -136,7 +136,7 @@
JRT_ENTRY(void, SharkRuntime::register_finalizer(JavaThread* thread,
oop object))
- assert(object->is_oop(), "should be");
+ assert(oopDesc::is_oop(object), "should be");
assert(object->klass()->has_finalizer(), "should have");
InstanceKlass::register_finalizer(instanceOop(object), CHECK);
JRT_END
--- a/hotspot/src/share/vm/utilities/exceptions.cpp Wed Aug 23 10:25:25 2017 +0200
+++ b/hotspot/src/share/vm/utilities/exceptions.cpp Wed Aug 23 14:52:55 2017 -0400
@@ -47,7 +47,7 @@
void ThreadShadow::set_pending_exception(oop exception, const char* file, int line) {
- assert(exception != NULL && exception->is_oop(), "invalid exception oop");
+ assert(exception != NULL && oopDesc::is_oop(exception), "invalid exception oop");
_pending_exception = exception;
_exception_file = file;
_exception_line = line;