8160399: is_oop_or_null involves undefined behavior

8164984: Improper use of is_oop in production code

Replace oop->is_oop*() with oopDesc::is_oop*(oop) so this pointer can be verified

Reviewed-by: iklam, kvn, dholmes
This commit is contained in:
Coleen Phillimore 2017-08-23 14:52:55 -04:00
parent 61a9f88ca7
commit 3d6d1ec64b
61 changed files with 195 additions and 209 deletions

View file

@ -559,7 +559,7 @@ void trace_method_handle_stub(const char* adaptername,
values.print(p); values.print(p);
} }
if (Verbose) { if (Verbose) {
if (has_mh && mh->is_oop()) { if (has_mh && oopDesc::is_oop(mh)) {
mh->print(); mh->print();
if (java_lang_invoke_MethodHandle::is_instance(mh)) { if (java_lang_invoke_MethodHandle::is_instance(mh)) {
if (java_lang_invoke_MethodHandle::form_offset_in_bytes() != 0) if (java_lang_invoke_MethodHandle::form_offset_in_bytes() != 0)

View file

@ -525,7 +525,7 @@ void trace_method_handle_stub(const char* adaptername,
values.print(p); values.print(p);
} }
if (has_mh && mh->is_oop()) { if (has_mh && oopDesc::is_oop(mh)) {
mh->print(); mh->print();
if (java_lang_invoke_MethodHandle::is_instance(mh)) { if (java_lang_invoke_MethodHandle::is_instance(mh)) {
if (java_lang_invoke_MethodHandle::form_offset_in_bytes() != 0) if (java_lang_invoke_MethodHandle::form_offset_in_bytes() != 0)

View file

@ -830,7 +830,7 @@ class StubGenerator: public StubCodeGenerator {
// Wrapper which calls oopDesc::is_oop_or_null() // Wrapper which calls oopDesc::is_oop_or_null()
// Only called by MacroAssembler::verify_oop // Only called by MacroAssembler::verify_oop
static void verify_oop_helper(const char* message, oop o) { 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); fatal("%s", message);
} }
++ StubRoutines::_verify_oop_count; ++ StubRoutines::_verify_oop_count;

View file

@ -595,7 +595,7 @@ void trace_method_handle_stub(const char* adaptername,
// Note: the unextended_sp may not be correct. // Note: the unextended_sp may not be correct.
tty->print_cr(" stack layout:"); tty->print_cr(" stack layout:");
values.print(p); values.print(p);
if (has_mh && mh->is_oop()) { if (has_mh && oopDesc::is_oop(mh)) {
mh->print(); mh->print();
if (java_lang_invoke_MethodHandle::is_instance(mh)) { if (java_lang_invoke_MethodHandle::is_instance(mh)) {
if (java_lang_invoke_MethodHandle::form_offset_in_bytes() != 0) { if (java_lang_invoke_MethodHandle::form_offset_in_bytes() != 0) {

View file

@ -562,7 +562,7 @@ void trace_method_handle_stub(const char* adaptername,
// Note: the unextended_sp may not be correct // Note: the unextended_sp may not be correct
tty->print_cr(" stack layout:"); tty->print_cr(" stack layout:");
values.print(p); values.print(p);
if (has_mh && mh->is_oop()) { if (has_mh && oopDesc::is_oop(mh)) {
mh->print(); mh->print();
if (java_lang_invoke_MethodHandle::is_instance(mh)) { if (java_lang_invoke_MethodHandle::is_instance(mh)) {
if (java_lang_invoke_MethodHandle::form_offset_in_bytes() != 0) if (java_lang_invoke_MethodHandle::form_offset_in_bytes() != 0)

View file

@ -561,7 +561,7 @@ void trace_method_handle_stub(const char* adaptername,
tty->print_cr("Stack layout:"); tty->print_cr("Stack layout:");
values.print(p); values.print(p);
} }
if (has_mh && mh->is_oop()) { if (has_mh && oopDesc::is_oop(mh)) {
mh->print(); mh->print();
if (java_lang_invoke_MethodHandle::is_instance(mh)) { if (java_lang_invoke_MethodHandle::is_instance(mh)) {
if (java_lang_invoke_MethodHandle::form_offset_in_bytes() != 0) if (java_lang_invoke_MethodHandle::form_offset_in_bytes() != 0)

View file

@ -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. // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
// //
// This code is free software; you can redistribute it and/or modify it // This code is free software; you can redistribute it and/or modify it
@ -391,7 +391,7 @@ void emit_d32_reloc(CodeBuffer &cbuf, int d32, RelocationHolder const& rspec,
int format) { int format) {
#ifdef ASSERT #ifdef ASSERT
if (rspec.reloc()->type() == relocInfo::oop_type && d32 != 0 && d32 != (int)Universe::non_oop_word()) { 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 #endif
cbuf.relocate(cbuf.insts_mark(), rspec, format); cbuf.relocate(cbuf.insts_mark(), rspec, format);

View file

@ -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. // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
// //
// This code is free software; you can redistribute it and/or modify it // This code is free software; you can redistribute it and/or modify it
@ -653,7 +653,7 @@ void emit_d32_reloc(CodeBuffer& cbuf, int d32, RelocationHolder const& rspec, in
if (rspec.reloc()->type() == relocInfo::oop_type && if (rspec.reloc()->type() == relocInfo::oop_type &&
d32 != 0 && d32 != (intptr_t) Universe::non_oop_word()) { d32 != 0 && d32 != (intptr_t) Universe::non_oop_word()) {
assert(Universe::heap()->is_in_reserved((address)(intptr_t)d32), "should be real oop"); 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 #endif
cbuf.relocate(cbuf.insts_mark(), rspec, format); cbuf.relocate(cbuf.insts_mark(), rspec, format);
@ -680,7 +680,7 @@ void emit_d64_reloc(CodeBuffer& cbuf, int64_t d64, RelocationHolder const& rspec
if (rspec.reloc()->type() == relocInfo::oop_type && if (rspec.reloc()->type() == relocInfo::oop_type &&
d64 != 0 && d64 != (int64_t) Universe::non_oop_word()) { d64 != 0 && d64 != (int64_t) Universe::non_oop_word()) {
assert(Universe::heap()->is_in_reserved((address)d64), "should be real oop"); 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"); "cannot embed scavengable oops in code");
} }
#endif #endif

View file

@ -491,7 +491,6 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* t
} }
#ifdef ASSERT #ifdef ASSERT
assert(exception.not_null(), "NULL exceptions should be handled by throw_exception"); 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 // Check that exception is a subclass of Throwable, otherwise we have a VerifyError
if (!(exception->is_a(SystemDictionary::Throwable_klass()))) { if (!(exception->is_a(SystemDictionary::Throwable_klass()))) {
if (ExitVMOnVerifyError) vm_exit(-1); if (ExitVMOnVerifyError) vm_exit(-1);
@ -676,7 +675,6 @@ JRT_ENTRY_NO_ASYNC(void, Runtime1::monitorenter(JavaThread* thread, oopDesc* obj
Atomic::inc(BiasedLocking::slow_path_entry_count_addr()); Atomic::inc(BiasedLocking::slow_path_entry_count_addr());
} }
Handle h_obj(thread, obj); Handle h_obj(thread, obj);
assert(h_obj()->is_oop(), "must be NULL or an object");
if (UseBiasedLocking) { if (UseBiasedLocking) {
// Retry fast entry if bias is revoked to avoid unnecessary inflation // Retry fast entry if bias is revoked to avoid unnecessary inflation
ObjectSynchronizer::fast_enter(h_obj, lock->lock(), true, CHECK); ObjectSynchronizer::fast_enter(h_obj, lock->lock(), true, CHECK);
@ -701,7 +699,7 @@ JRT_LEAF(void, Runtime1::monitorexit(JavaThread* thread, BasicObjectLock* lock))
EXCEPTION_MARK; EXCEPTION_MARK;
oop obj = lock->obj(); 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) { if (UseFastLocking) {
// When using fast locking, the compiled code has already tried the fast case // When using fast locking, the compiled code has already tried the fast case
ObjectSynchronizer::slow_exit(obj, lock->lock(), THREAD); ObjectSynchronizer::slow_exit(obj, lock->lock(), THREAD);

View file

@ -41,7 +41,7 @@ inline ClassLoaderData* ClassLoaderData::class_loader_data(oop loader) {
inline ClassLoaderData *ClassLoaderDataGraph::find_or_create(Handle loader, TRAPS) { 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 // 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 // it's already in the loader_data, so no need to add
ClassLoaderData* loader_data= java_lang_ClassLoader::loader_data(loader()); ClassLoaderData* loader_data= java_lang_ClassLoader::loader_data(loader());

View file

@ -1430,7 +1430,7 @@ int java_lang_ThreadGroup::_nthreads_offset = 0;
int java_lang_ThreadGroup::_ngroups_offset = 0; int java_lang_ThreadGroup::_ngroups_offset = 0;
oop java_lang_ThreadGroup::parent(oop java_thread_group) { 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); return java_thread_group->obj_field(_parent_offset);
} }
@ -1446,7 +1446,7 @@ const char* java_lang_ThreadGroup::name(oop java_thread_group) {
} }
int java_lang_ThreadGroup::nthreads(oop java_thread_group) { 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); return java_thread_group->int_field(_nthreads_offset);
} }
@ -1458,7 +1458,7 @@ objArrayOop java_lang_ThreadGroup::threads(oop java_thread_group) {
} }
int java_lang_ThreadGroup::ngroups(oop java_thread_group) { 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); return java_thread_group->int_field(_ngroups_offset);
} }
@ -1469,17 +1469,17 @@ objArrayOop java_lang_ThreadGroup::groups(oop java_thread_group) {
} }
ThreadPriority java_lang_ThreadGroup::maxPriority(oop java_thread_group) { 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); return (ThreadPriority) java_thread_group->int_field(_maxPriority_offset);
} }
bool java_lang_ThreadGroup::is_destroyed(oop java_thread_group) { 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; return java_thread_group->bool_field(_destroyed_offset) != 0;
} }
bool java_lang_ThreadGroup::is_daemon(oop java_thread_group) { 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; return java_thread_group->bool_field(_daemon_offset) != 0;
} }
@ -2868,7 +2868,7 @@ void java_lang_Module::set_name(oop module, oop value) {
ModuleEntry* java_lang_Module::module_entry(oop module, TRAPS) { ModuleEntry* java_lang_Module::module_entry(oop module, TRAPS) {
assert(_module_entry_offset != -1, "Uninitialized module_entry_offset"); assert(_module_entry_offset != -1, "Uninitialized module_entry_offset");
assert(module != NULL, "module can't be null"); 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); ModuleEntry* module_entry = (ModuleEntry*)module->address_field(_module_entry_offset);
if (module_entry == NULL) { if (module_entry == NULL) {
@ -2885,7 +2885,7 @@ ModuleEntry* java_lang_Module::module_entry(oop module, TRAPS) {
void java_lang_Module::set_module_entry(oop module, ModuleEntry* module_entry) { void java_lang_Module::set_module_entry(oop module, ModuleEntry* module_entry) {
assert(_module_entry_offset != -1, "Uninitialized module_entry_offset"); assert(_module_entry_offset != -1, "Uninitialized module_entry_offset");
assert(module != NULL, "module can't be null"); 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); module->address_field_put(_module_entry_offset, (address)module_entry);
} }
@ -3088,12 +3088,9 @@ int java_lang_invoke_DirectMethodHandle::_member_offset;
oop java_lang_invoke_DirectMethodHandle::member(oop dmh) { oop java_lang_invoke_DirectMethodHandle::member(oop dmh) {
oop member_name = NULL; oop member_name = NULL;
bool is_dmh = dmh->is_oop() && java_lang_invoke_DirectMethodHandle::is_instance(dmh); assert(oopDesc::is_oop(dmh) && java_lang_invoke_DirectMethodHandle::is_instance(dmh),
assert(is_dmh, "a DirectMethodHandle oop is expected"); "a DirectMethodHandle oop is expected");
if (is_dmh) { return dmh->obj_field(member_offset_in_bytes());
member_name = dmh->obj_field(member_offset_in_bytes());
}
return member_name;
} }
void java_lang_invoke_DirectMethodHandle::compute_offsets() { void java_lang_invoke_DirectMethodHandle::compute_offsets() {
@ -3476,7 +3473,7 @@ int java_lang_ClassLoader::name_offset = -1;
int java_lang_ClassLoader::unnamedModule_offset = -1; int java_lang_ClassLoader::unnamedModule_offset = -1;
ClassLoaderData** java_lang_ClassLoader::loader_data_addr(oop loader) { 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); return (ClassLoaderData**) loader->address_field_addr(_loader_data_offset);
} }

View file

@ -97,7 +97,7 @@ void ProtectionDomainCacheTable::verify() {
} }
void ProtectionDomainCacheEntry::verify() { 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) { ProtectionDomainCacheEntry* ProtectionDomainCacheTable::get(Handle protection_domain) {

View file

@ -48,7 +48,7 @@ void DebugInfoWriteStream::write_metadata(Metadata* h) {
oop DebugInfoReadStream::read_oop() { oop DebugInfoReadStream::read_oop() {
oop o = code()->oop_at(read_int()); 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; return o;
} }

View file

@ -940,7 +940,7 @@ uintptr_t Dependencies::DepStream::get_identifier(int i) {
oop Dependencies::DepStream::argument_oop(int i) { oop Dependencies::DepStream::argument_oop(int i) {
oop result = recorded_oop_at(argument_index(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; return result;
} }

View file

@ -2090,7 +2090,7 @@ public:
VerifyOopsClosure(nmethod* nm) : _nm(nm), _ok(true) { } VerifyOopsClosure(nmethod* nm) : _nm(nm), _ok(true) { }
bool ok() { return _ok; } bool ok() { return _ok; }
virtual void do_oop(oop* p) { virtual void do_oop(oop* p) {
if ((*p) == NULL || (*p)->is_oop()) return; if (oopDesc::is_oop_or_null(*p)) return;
if (_ok) { if (_ok) {
_nm->print_nmethod(true); _nm->print_nmethod(true);
_ok = false; _ok = false;
@ -2112,7 +2112,7 @@ void nmethod::verify() {
// Make sure all the entry points are correctly aligned for patching. // Make sure all the entry points are correctly aligned for patching.
NativeJump::check_verified_entry_alignment(entry_point(), verified_entry_point()); 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; ResourceMark rm;

View file

@ -867,7 +867,7 @@ void RelocIterator::print_current() {
// work even during GC or other inconvenient times. // work even during GC or other inconvenient times.
if (WizardMode && oop_value != NULL) { if (WizardMode && oop_value != NULL) {
tty->print("oop_value=" INTPTR_FORMAT ": ", p2i(oop_value)); 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); oop_value->print_value_on(tty);
} }
} }

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -74,7 +74,7 @@ inline void ParMarkRefsIntoAndScanClosure::trim_queue(uint max) {
while (_work_queue->size() > max) { while (_work_queue->size() > max) {
oop newOop; oop newOop;
if (_work_queue->pop_local(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), assert(_bit_map->isMarked((HeapWord*)newOop),
"only grey objects on this stack"); "only grey objects on this stack");
// iterate over the oops in this oop, marking and pushing // iterate over the oops in this oop, marking and pushing

View file

@ -929,7 +929,7 @@ size_t CompactibleFreeListSpace::block_size(const HeapWord* p) const {
if (k != NULL) { if (k != NULL) {
assert(k->is_klass(), "Should really be klass oop."); assert(k->is_klass(), "Should really be klass oop.");
oop o = (oop)p; 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); size_t res = o->size_given_klass(k);
res = adjustObjectSize(res); res = adjustObjectSize(res);
@ -979,7 +979,7 @@ const {
if (k != NULL) { if (k != NULL) {
assert(k->is_klass(), "Should really be klass oop."); assert(k->is_klass(), "Should really be klass oop.");
oop o = (oop)p; 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); size_t res = o->size_given_klass(k);
res = adjustObjectSize(res); res = adjustObjectSize(res);
@ -1005,7 +1005,7 @@ size_t CompactibleFreeListSpace::block_size_nopar(const HeapWord* p) const {
// Ignore mark word because this may be a recently promoted // Ignore mark word because this may be a recently promoted
// object whose mark word is used to chain together grey // object whose mark word is used to chain together grey
// objects (the last one would have a null value). // 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()); return adjustObjectSize(oop(p)->size());
} }
} }
@ -1022,7 +1022,7 @@ bool CompactibleFreeListSpace::block_is_obj(const HeapWord* p) const {
// Ignore mark word because it may have been used to // Ignore mark word because it may have been used to
// chain together promoted objects (the last one // chain together promoted objects (the last one
// would have a null value). // 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 true;
} else { } else {
return false; // Was not an object at the start of collection. return false; // Was not an object at the start of collection.
@ -1066,7 +1066,7 @@ bool CompactibleFreeListSpace::block_is_obj_nopar(const HeapWord* p) const {
// Ignore mark word because it may have been used to // Ignore mark word because it may have been used to
// chain together promoted objects (the last one // chain together promoted objects (the last one
// would have a null value). // 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 true;
} }
return false; return false;
@ -2174,7 +2174,7 @@ class VerifyAllBlksClosure: public BlkClosure {
if (_sp->block_is_obj(addr)) { if (_sp->block_is_obj(addr)) {
was_obj = true; was_obj = true;
oop p = oop(addr); 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()); res = _sp->adjustObjectSize(p->size());
if (_sp->obj_is_alive(addr)) { if (_sp->obj_is_alive(addr)) {
was_live = true; was_live = true;
@ -2226,7 +2226,7 @@ class VerifyAllOopsClosure: public OopClosure {
guarantee(!_sp->is_in_reserved(obj) || guarantee(!_sp->is_in_reserved(obj) ||
_sp->block_is_obj((HeapWord*)obj), _sp->block_is_obj((HeapWord*)obj),
"Should be an object"); "Should be an object");
guarantee(obj->is_oop(), "Should be an oop"); guarantee(oopDesc::is_oop(obj), "Should be an oop");
obj->verify(); obj->verify();
if (_past_remark) { if (_past_remark) {
// Remark has been completed, the object should be marked // Remark has been completed, the object should be marked
@ -2243,7 +2243,7 @@ class VerifyAllOopsClosure: public OopClosure {
} }
} else if (_sp->is_in_reserved(p)) { } else if (_sp->is_in_reserved(p)) {
// the reference is from FLS, and points out of FLS // 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(); obj->verify();
} }
} }

View file

@ -940,7 +940,7 @@ oop ConcurrentMarkSweepGeneration::promote(oop obj, size_t obj_size) {
if (res != NULL) { if (res != NULL) {
// See comment in allocate() about when objects should // See comment in allocate() about when objects should
// be allocated live. // 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 collector()->promoted(false, // Not parallel
(HeapWord*)res, obj->is_objArray(), obj_size); (HeapWord*)res, obj->is_objArray(), obj_size);
// promotion counters // promotion counters
@ -1063,13 +1063,13 @@ ConcurrentMarkSweepGeneration::par_promote(int thread_num,
} }
assert(obj->klass_or_null() == NULL, "Object should be uninitialized here."); 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(!((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). // Finally, install the klass pointer (this should be volatile).
OrderAccess::storestore(); OrderAccess::storestore();
obj->set_klass(old->klass()); obj->set_klass(old->klass());
// We should now be able to calculate the right size for this object // 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 collector()->promoted(true, // parallel
obj_ptr, old->is_objArray(), word_sz); obj_ptr, old->is_objArray(), word_sz);
@ -3348,7 +3348,7 @@ DO_OOP_WORK_IMPL(ParConcMarkingClosure)
// been published), so we do not need to check for // been published), so we do not need to check for
// uninitialized objects before pushing here. // uninitialized objects before pushing here.
void ParConcMarkingClosure::do_oop(oop obj) { 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; HeapWord* addr = (HeapWord*)obj;
// Check if oop points into the CMS generation // Check if oop points into the CMS generation
// and is not marked // and is not marked
@ -3390,7 +3390,7 @@ void ParConcMarkingClosure::trim_queue(size_t max) {
while (_work_queue->size() > max) { while (_work_queue->size() > max) {
oop new_oop; oop new_oop;
if (_work_queue->pop_local(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(_bit_map->isMarked((HeapWord*)new_oop), "Grey object");
assert(_span.contains((HeapWord*)new_oop), "Not in span"); assert(_span.contains((HeapWord*)new_oop), "Not in span");
new_oop->oop_iterate(this); // do_oop() above new_oop->oop_iterate(this); // do_oop() above
@ -3431,7 +3431,7 @@ void CMSConcMarkingTask::do_work_steal(int i) {
// assert(work_q->size() > 0, "Work from overflow stack"); // assert(work_q->size() > 0, "Work from overflow stack");
continue; continue;
} else if (task_queues()->steal(i, seed, /* reference */ obj_to_scan)) { } 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"); assert(bm->isMarked((HeapWord*)obj_to_scan), "Grey object");
obj_to_scan->oop_iterate(&cl); obj_to_scan->oop_iterate(&cl);
} else if (terminator()->offer_termination(&_term_term)) { } else if (terminator()->offer_termination(&_term_term)) {
@ -4522,7 +4522,7 @@ CMSParMarkTask::do_young_space_rescan(
assert(mr.is_empty() || space->used_region().contains(mr), assert(mr.is_empty() || space->used_region().contains(mr),
"Should be in space"); "Should be in space");
// Verify that "start" is an object boundary // 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"); "Should be an oop");
space->par_oop_iterate(mr, cl); space->par_oop_iterate(mr, cl);
} }
@ -4656,7 +4656,7 @@ CMSParRemarkTask::do_work_steal(int i, ParMarkRefsIntoAndScanClosure* cl,
// Try to steal from other queues that have work // Try to steal from other queues that have work
if (task_queues()->steal(i, seed, /* reference */ obj_to_scan)) { if (task_queues()->steal(i, seed, /* reference */ obj_to_scan)) {
NOT_PRODUCT(num_steals++;) 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?"); assert(bm->isMarked((HeapWord*)obj_to_scan), "Stole an unmarked oop?");
// Do scanning work // Do scanning work
obj_to_scan->oop_iterate(cl); obj_to_scan->oop_iterate(cl);
@ -5135,7 +5135,7 @@ void CMSRefProcTaskProxy::do_work_steal(int i,
// Try to steal from other queues that have work // Try to steal from other queues that have work
if (task_queues()->steal(i, seed, /* reference */ obj_to_scan)) { if (task_queues()->steal(i, seed, /* reference */ obj_to_scan)) {
NOT_PRODUCT(num_steals++;) 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?"); assert(_mark_bit_map->isMarked((HeapWord*)obj_to_scan), "Stole an unmarked oop?");
// Do scanning work // Do scanning work
obj_to_scan->oop_iterate(keep_alive); obj_to_scan->oop_iterate(keep_alive);
@ -5825,7 +5825,7 @@ MarkRefsIntoClosure::MarkRefsIntoClosure(
void MarkRefsIntoClosure::do_oop(oop obj) { void MarkRefsIntoClosure::do_oop(oop obj) {
// if p points into _span, then mark corresponding bit in _markBitMap // 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; HeapWord* addr = (HeapWord*)obj;
if (_span.contains(addr)) { if (_span.contains(addr)) {
// this should be made more efficient // this should be made more efficient
@ -5847,7 +5847,7 @@ ParMarkRefsIntoClosure::ParMarkRefsIntoClosure(
void ParMarkRefsIntoClosure::do_oop(oop obj) { void ParMarkRefsIntoClosure::do_oop(oop obj) {
// if p points into _span, then mark corresponding bit in _markBitMap // 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; HeapWord* addr = (HeapWord*)obj;
if (_span.contains(addr)) { if (_span.contains(addr)) {
// this should be made more efficient // this should be made more efficient
@ -5871,7 +5871,7 @@ MarkRefsIntoVerifyClosure::MarkRefsIntoVerifyClosure(
void MarkRefsIntoVerifyClosure::do_oop(oop obj) { void MarkRefsIntoVerifyClosure::do_oop(oop obj) {
// if p points into _span, then mark corresponding bit in _markBitMap // 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; HeapWord* addr = (HeapWord*)obj;
if (_span.contains(addr)) { if (_span.contains(addr)) {
_verification_bm->mark(addr); _verification_bm->mark(addr);
@ -5925,7 +5925,7 @@ MarkRefsIntoAndScanClosure::MarkRefsIntoAndScanClosure(MemRegion span,
// The parallel version (Par_...) appears further below. // The parallel version (Par_...) appears further below.
void MarkRefsIntoAndScanClosure::do_oop(oop obj) { void MarkRefsIntoAndScanClosure::do_oop(oop obj) {
if (obj != NULL) { if (obj != NULL) {
assert(obj->is_oop(), "expected an oop"); assert(oopDesc::is_oop(obj), "expected an oop");
HeapWord* addr = (HeapWord*)obj; HeapWord* addr = (HeapWord*)obj;
assert(_mark_stack->isEmpty(), "pre-condition (eager drainage)"); assert(_mark_stack->isEmpty(), "pre-condition (eager drainage)");
assert(_collector->overflow_list_is_empty(), assert(_collector->overflow_list_is_empty(),
@ -5941,7 +5941,7 @@ void MarkRefsIntoAndScanClosure::do_oop(oop obj) {
assert(res, "Should have space to push on empty stack"); assert(res, "Should have space to push on empty stack");
do { do {
oop new_oop = _mark_stack->pop(); 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), assert(_bit_map->isMarked((HeapWord*)new_oop),
"only grey objects on this stack"); "only grey objects on this stack");
// iterate over the oops in this oop, marking and pushing // iterate over the oops in this oop, marking and pushing
@ -6023,7 +6023,7 @@ void ParMarkRefsIntoAndScanClosure::do_oop(oop obj) {
if (obj != NULL) { if (obj != NULL) {
// Ignore mark word because this could be an already marked oop // Ignore mark word because this could be an already marked oop
// that may be chained at the end of the overflow list. // 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; HeapWord* addr = (HeapWord*)obj;
if (_span.contains(addr) && if (_span.contains(addr) &&
!_bit_map->isMarked(addr)) { !_bit_map->isMarked(addr)) {
@ -6069,7 +6069,7 @@ size_t ScanMarkedObjectsAgainCarefullyClosure::do_object_careful_m(
if (p->klass_or_null_acquire() != NULL) { if (p->klass_or_null_acquire() != NULL) {
// an initialized object; ignore mark word in verification below // an initialized object; ignore mark word in verification below
// since we are running concurrent with mutators // 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()) { if (p->is_objArray()) {
// objArrays are precisely marked; restrict scanning // objArrays are precisely marked; restrict scanning
// to dirty cards only. // to dirty cards only.
@ -6118,7 +6118,7 @@ size_t ScanMarkedObjectsAgainCarefullyClosure::do_object_careful_m(
} else { } else {
// An object not (yet) reached by marking: we merely need to // An object not (yet) reached by marking: we merely need to
// compute its size so as to go look at the next block. // 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()); size = CompactibleFreeListSpace::adjustObjectSize(p->size());
} }
} }
@ -6165,7 +6165,7 @@ size_t SurvivorSpacePrecleanClosure::do_object_careful(oop p) {
assert(p->klass_or_null() != NULL, "object should be initialized"); assert(p->klass_or_null() != NULL, "object should be initialized");
// an initialized object; ignore mark word in verification below // an initialized object; ignore mark word in verification below
// since we are running concurrent with mutators // 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 // Note that we do not yield while we iterate over
// the interior oops of p, pushing the relevant ones // the interior oops of p, pushing the relevant ones
// on our marking stack. // on our marking stack.
@ -6179,7 +6179,7 @@ size_t SurvivorSpacePrecleanClosure::do_object_careful(oop p) {
// from the grey objects at a later time. // from the grey objects at a later time.
while (!_mark_stack->isEmpty()) { while (!_mark_stack->isEmpty()) {
oop new_oop = _mark_stack->pop(); 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), assert(_bit_map->isMarked((HeapWord*)new_oop),
"only grey objects on this stack"); "only grey objects on this stack");
// iterate over the oops in this oop, marking and pushing // iterate over the oops in this oop, marking and pushing
@ -6223,7 +6223,7 @@ void SurvivorSpacePrecleanClosure::do_yield_work() {
// isMarked() query is "safe". // isMarked() query is "safe".
bool ScanMarkedObjectsAgainClosure::do_object_bm(oop p, MemRegion mr) { bool ScanMarkedObjectsAgainClosure::do_object_bm(oop p, MemRegion mr) {
// Ignore mark word because we are running concurrent with mutators // 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; HeapWord* addr = (HeapWord*)p;
assert(_span.contains(addr), "we are scanning the CMS generation"); assert(_span.contains(addr), "we are scanning the CMS generation");
bool is_obj_array = false; bool is_obj_array = false;
@ -6376,7 +6376,7 @@ void MarkFromRootsClosure::scanOopsInOop(HeapWord* ptr) {
oop obj = oop(ptr); oop obj = oop(ptr);
// Ignore mark word in verification below, since we // Ignore mark word in verification below, since we
// may be running concurrent with mutators. // 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"); assert(_finger <= ptr, "_finger runneth ahead");
// advance the finger to right end of this object // advance the finger to right end of this object
_finger = ptr + obj->size(); _finger = ptr + obj->size();
@ -6423,7 +6423,7 @@ void MarkFromRootsClosure::scanOopsInOop(HeapWord* ptr) {
oop new_oop = _markStack->pop(); oop new_oop = _markStack->pop();
// Skip verifying header mark word below because we are // Skip verifying header mark word below because we are
// running concurrent with mutators. // 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 // now scan this oop's oops
new_oop->oop_iterate(&pushOrMarkClosure); new_oop->oop_iterate(&pushOrMarkClosure);
do_yield_check(); do_yield_check();
@ -6489,7 +6489,7 @@ void ParMarkFromRootsClosure::scan_oops_in_oop(HeapWord* ptr) {
oop obj = oop(ptr); oop obj = oop(ptr);
// Ignore mark word in verification below, since we // Ignore mark word in verification below, since we
// may be running concurrent with mutators. // 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"); assert(_finger <= ptr, "_finger runneth ahead");
// advance the finger to right end of this object // advance the finger to right end of this object
_finger = ptr + obj->size(); _finger = ptr + obj->size();
@ -6550,7 +6550,7 @@ void ParMarkFromRootsClosure::scan_oops_in_oop(HeapWord* ptr) {
} }
// Skip verifying header mark word below because we are // Skip verifying header mark word below because we are
// running concurrent with mutators. // 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 // now scan this oop's oops
new_oop->oop_iterate(&pushOrMarkClosure); new_oop->oop_iterate(&pushOrMarkClosure);
do_yield_check(); do_yield_check();
@ -6604,7 +6604,7 @@ bool MarkFromRootsVerifyClosure::do_bit(size_t offset) {
"should drain stack to limit stack usage"); "should drain stack to limit stack usage");
// convert addr to an oop preparatory to scanning // convert addr to an oop preparatory to scanning
oop obj = oop(addr); 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"); assert(_finger <= addr, "_finger runneth ahead");
// advance the finger to right end of this object // advance the finger to right end of this object
_finger = addr + obj->size(); _finger = addr + obj->size();
@ -6615,7 +6615,7 @@ bool MarkFromRootsVerifyClosure::do_bit(size_t offset) {
assert(res, "Empty non-zero size stack should have space for single push"); assert(res, "Empty non-zero size stack should have space for single push");
while (!_mark_stack->isEmpty()) { while (!_mark_stack->isEmpty()) {
oop new_oop = _mark_stack->pop(); 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 // now scan this oop's oops
new_oop->oop_iterate(&_pam_verify_closure); new_oop->oop_iterate(&_pam_verify_closure);
} }
@ -6650,7 +6650,7 @@ void PushAndMarkVerifyClosure::handle_stack_overflow(HeapWord* lost) {
} }
void PushAndMarkVerifyClosure::do_oop(oop obj) { 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; HeapWord* addr = (HeapWord*)obj;
if (_span.contains(addr) && !_verification_bm->isMarked(addr)) { if (_span.contains(addr) && !_verification_bm->isMarked(addr)) {
// Oop lies in _span and isn't yet grey or black // Oop lies in _span and isn't yet grey or black
@ -6747,7 +6747,7 @@ void ParPushOrMarkClosure::handle_stack_overflow(HeapWord* lost) {
void PushOrMarkClosure::do_oop(oop obj) { void PushOrMarkClosure::do_oop(oop obj) {
// Ignore mark word because we are running concurrent with mutators. // 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; HeapWord* addr = (HeapWord*)obj;
if (_span.contains(addr) && !_bitMap->isMarked(addr)) { if (_span.contains(addr) && !_bitMap->isMarked(addr)) {
// Oop lies in _span and isn't yet grey or black // Oop lies in _span and isn't yet grey or black
@ -6782,7 +6782,7 @@ void PushOrMarkClosure::do_oop(narrowOop* p) { PushOrMarkClosure::do_oop_work(p)
void ParPushOrMarkClosure::do_oop(oop obj) { void ParPushOrMarkClosure::do_oop(oop obj) {
// Ignore mark word because we are running concurrent with mutators. // 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; HeapWord* addr = (HeapWord*)obj;
if (_whole_span.contains(addr) && !_bit_map->isMarked(addr)) { if (_whole_span.contains(addr) && !_bit_map->isMarked(addr)) {
// Oop lies in _span and isn't yet grey or black // Oop lies in _span and isn't yet grey or black
@ -6855,7 +6855,7 @@ void PushAndMarkClosure::do_oop(oop obj) {
// phases, the object may already have been reached by a different // phases, the object may already have been reached by a different
// path and may be at the end of the global overflow list (so // path and may be at the end of the global overflow list (so
// the mark word may be NULL). // 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)); "Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
HeapWord* addr = (HeapWord*)obj; HeapWord* addr = (HeapWord*)obj;
// Check if oop points into the CMS generation // Check if oop points into the CMS generation
@ -6934,7 +6934,7 @@ void ParPushAndMarkClosure::do_oop(oop obj) {
// value, by the time we get to examined this failing assert in // value, by the time we get to examined this failing assert in
// the debugger, is_oop_or_null(false) may subsequently start // the debugger, is_oop_or_null(false) may subsequently start
// to hold. // 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)); "Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
HeapWord* addr = (HeapWord*)obj; HeapWord* addr = (HeapWord*)obj;
// Check if oop points into the CMS generation // Check if oop points into the CMS generation
@ -7325,7 +7325,7 @@ size_t SweepClosure::do_live_chunk(FreeChunk* fc) {
// This object is live: we'd normally expect this to be // This object is live: we'd normally expect this to be
// an oop, and like to assert the following: // 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 // However, as we commented above, this may be an object whose
// header hasn't yet been initialized. // header hasn't yet been initialized.
size_t size; size_t size;
@ -7341,7 +7341,7 @@ size_t SweepClosure::do_live_chunk(FreeChunk* fc) {
#ifdef ASSERT #ifdef ASSERT
if (oop(addr)->klass_or_null_acquire() != NULL) { if (oop(addr)->klass_or_null_acquire() != NULL) {
// Ignore mark word because we are running concurrent with mutators // 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 == assert(size ==
CompactibleFreeListSpace::adjustObjectSize(oop(addr)->size()), CompactibleFreeListSpace::adjustObjectSize(oop(addr)->size()),
"P-mark and computed size do not agree"); "P-mark and computed size do not agree");
@ -7353,7 +7353,7 @@ size_t SweepClosure::do_live_chunk(FreeChunk* fc) {
assert(oop(addr)->klass_or_null_acquire() != NULL, assert(oop(addr)->klass_or_null_acquire() != NULL,
"Should be an initialized object"); "Should be an initialized object");
// Ignore mark word because we are running concurrent with mutators // 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 // Verify that the bit map has no bits marked between
// addr and purported end of this block. // addr and purported end of this block.
size = CompactibleFreeListSpace::adjustObjectSize(oop(addr)->size()); size = CompactibleFreeListSpace::adjustObjectSize(oop(addr)->size());
@ -7661,7 +7661,7 @@ void CMSParKeepAliveClosure::trim_queue(uint max) {
while (_work_queue->size() > max) { while (_work_queue->size() > max) {
oop new_oop; oop new_oop;
if (_work_queue->pop_local(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), assert(_bit_map->isMarked((HeapWord*)new_oop),
"no white objects on this stack!"); "no white objects on this stack!");
assert(_span.contains((HeapWord*)new_oop), "Out of bounds oop"); assert(_span.contains((HeapWord*)new_oop), "Out of bounds oop");
@ -7741,7 +7741,7 @@ void CMSDrainMarkingStackClosure::do_void() {
HeapWord* addr = (HeapWord*)obj; HeapWord* addr = (HeapWord*)obj;
assert(_span.contains(addr), "Should be within span"); assert(_span.contains(addr), "Should be within span");
assert(_bit_map->isMarked(addr), "Should be marked"); 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); obj->oop_iterate(_keep_alive);
} }
} }
@ -7756,7 +7756,7 @@ void CMSParDrainMarkingStackClosure::trim_queue(uint max) {
while (_work_queue->size() > max) { while (_work_queue->size() > max) {
oop new_oop; oop new_oop;
if (_work_queue->pop_local(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), assert(_bit_map->isMarked((HeapWord*)new_oop),
"no white objects on this stack!"); "no white objects on this stack!");
assert(_span.contains((HeapWord*)new_oop), "Out of bounds oop"); assert(_span.contains((HeapWord*)new_oop), "Out of bounds oop");
@ -7807,7 +7807,7 @@ bool CMSCollector::take_from_overflow_list(size_t num, CMSMarkStack* stack) {
for (oop next; i > 0 && cur != NULL; cur = next, i--) { for (oop next; i > 0 && cur != NULL; cur = next, i--) {
next = oop(cur->mark()); next = oop(cur->mark());
cur->set_mark(proto); // until proven otherwise 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); bool res = stack->push(cur);
assert(res, "Bit off more than can chew?"); assert(res, "Bit off more than can chew?");
NOT_PRODUCT(n++;) NOT_PRODUCT(n++;)
@ -7951,7 +7951,7 @@ bool CMSCollector::par_take_from_overflow_list(size_t num,
for (cur = prefix; cur != NULL; cur = next) { for (cur = prefix; cur != NULL; cur = next) {
next = oop(cur->mark()); next = oop(cur->mark());
cur->set_mark(proto); // until proven otherwise 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); bool res = work_q->push(cur);
assert(res, "Bit off more than we can chew?"); assert(res, "Bit off more than we can chew?");
NOT_PRODUCT(n++;) NOT_PRODUCT(n++;)
@ -7966,7 +7966,7 @@ bool CMSCollector::par_take_from_overflow_list(size_t num,
// Single-threaded // Single-threaded
void CMSCollector::push_on_overflow_list(oop p) { void CMSCollector::push_on_overflow_list(oop p) {
NOT_PRODUCT(_num_par_pushes++;) 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); preserve_mark_if_necessary(p);
p->set_mark((markOop)_overflow_list); p->set_mark((markOop)_overflow_list);
_overflow_list = p; _overflow_list = p;
@ -7975,7 +7975,7 @@ void CMSCollector::push_on_overflow_list(oop p) {
// Multi-threaded; use CAS to prepend to overflow list // Multi-threaded; use CAS to prepend to overflow list
void CMSCollector::par_push_on_overflow_list(oop p) { void CMSCollector::par_push_on_overflow_list(oop p) {
NOT_PRODUCT(Atomic::inc_ptr(&_num_par_pushes);) 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); par_preserve_mark_if_necessary(p);
oop observed_overflow_list = _overflow_list; oop observed_overflow_list = _overflow_list;
oop cur_overflow_list; oop cur_overflow_list;
@ -8062,7 +8062,7 @@ void CMSCollector::restore_preserved_marks_if_any() {
while (!_preserved_oop_stack.is_empty()) { while (!_preserved_oop_stack.is_empty()) {
oop p = _preserved_oop_stack.pop(); 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(_span.contains(p), "oop should be in _span");
assert(p->mark() == markOopDesc::prototype(), assert(p->mark() == markOopDesc::prototype(),
"Set when taken from overflow list"); "Set when taken from overflow list");

View file

@ -684,7 +684,7 @@ void /*ParNewGeneration::*/ParKeepAliveClosure::do_oop_work(T* p) {
oop obj = oopDesc::load_decode_heap_oop_not_null(p); oop obj = oopDesc::load_decode_heap_oop_not_null(p);
// We never expect to see a null reference being processed // We never expect to see a null reference being processed
// as a weak reference. // 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 #endif // ASSERT
@ -711,7 +711,7 @@ void /*ParNewGeneration::*/KeepAliveClosure::do_oop_work(T* p) {
oop obj = oopDesc::load_decode_heap_oop_not_null(p); oop obj = oopDesc::load_decode_heap_oop_not_null(p);
// We never expect to see a null reference being processed // We never expect to see a null reference being processed
// as a weak reference. // 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 #endif // ASSERT

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -43,7 +43,7 @@ PromotedObject* PromotedObject::next() const {
} else { } else {
res = (PromotedObject*)(_next & next_mask); 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; return res;
} }
@ -299,7 +299,7 @@ void PromotionInfo::verify() const {
for (PromotedObject* curObj = _promoHead; curObj != NULL; curObj = curObj->next()) { for (PromotedObject* curObj = _promoHead; curObj != NULL; curObj = curObj->next()) {
guarantee(space()->is_in_reserved((HeapWord*)curObj), "Containment"); guarantee(space()->is_in_reserved((HeapWord*)curObj), "Containment");
// the last promoted object may fail the mark() != NULL test of is_oop(). // 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()) { if (curObj->hasDisplacedMark()) {
numObjsWithDisplacedHdrs++; numObjsWithDisplacedHdrs++;
} }

View file

@ -1918,7 +1918,7 @@ public:
guarantee(_g1h->is_in_reserved(task_entry.slice()), "Slice " PTR_FORMAT " must be in heap.", p2i(task_entry.slice())); guarantee(_g1h->is_in_reserved(task_entry.slice()), "Slice " PTR_FORMAT " must be in heap.", p2i(task_entry.slice()));
return; return;
} }
guarantee(task_entry.obj()->is_oop(), guarantee(oopDesc::is_oop(task_entry.obj()),
"Non-oop " PTR_FORMAT ", phase: %s, info: %d", "Non-oop " PTR_FORMAT ", phase: %s, info: %d",
p2i(task_entry.obj()), _phase, _info); p2i(task_entry.obj()), _phase, _info);
guarantee(!_g1h->is_in_cset(task_entry.obj()), guarantee(!_g1h->is_in_cset(task_entry.obj()),
@ -2313,7 +2313,7 @@ bool G1CMTask::get_entries_from_global_stack() {
if (task_entry.is_null()) { if (task_entry.is_null()) {
break; 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); bool success = _task_queue->push(task_entry);
// We only call this when the local queue is empty or under a // 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. // given target limit. So, we do not expect this push to fail.

View file

@ -217,7 +217,7 @@ inline void G1ConcurrentMark::markPrev(oop p) {
} }
bool G1ConcurrentMark::isPrevMarked(oop p) const { 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); return _prevMarkBitMap->is_marked((HeapWord*)p);
} }

View file

@ -107,7 +107,7 @@ inline static void check_obj_during_refinement(T* p, oop const obj) {
#ifdef ASSERT #ifdef ASSERT
G1CollectedHeap* g1 = G1CollectedHeap::heap(); G1CollectedHeap* g1 = G1CollectedHeap::heap();
// can't do because of races // 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(check_obj_alignment(obj), "not oop aligned");
assert(g1->is_in_reserved(obj), "must be in heap"); assert(g1->is_in_reserved(obj), "must be in heap");

View file

@ -39,7 +39,7 @@ inline void G1RemSet::par_write_ref(HeapRegion* from, T* p, uint tid) {
#ifdef ASSERT #ifdef ASSERT
// can't do because of races // 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(check_obj_alignment(obj), "not oop aligned");
assert(_g1->is_in_reserved(obj), "must be in heap"); assert(_g1->is_in_reserved(obj), "must be in heap");
#endif // ASSERT #endif // ASSERT

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -43,7 +43,7 @@ G1SATBCardTableModRefBS::G1SATBCardTableModRefBS(
void G1SATBCardTableModRefBS::enqueue(oop pre_val) { void G1SATBCardTableModRefBS::enqueue(oop pre_val) {
// Nulls should have been already filtered. // 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; if (!JavaThread::satb_mark_queue_set().is_active()) return;
Thread* thr = Thread::current(); Thread* thr = Thread::current();

View file

@ -610,7 +610,7 @@ public:
LogStream ls(log.error()); LogStream ls(log.error());
_containing_obj->print_on(&ls); _containing_obj->print_on(&ls);
log.error("points to obj " PTR_FORMAT " in region " HR_FORMAT, p2i(obj), HR_FORMAT_PARAMS(to)); 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); obj->print_on(&ls);
} }
log.error("Obj head CTE = %d, field CTE = %d.", cv_obj, cv_field); log.error("Obj head CTE = %d, field CTE = %d.", cv_obj, cv_field);
@ -657,7 +657,7 @@ void HeapRegion::verify(VerifyOption vo,
object_num += 1; object_num += 1;
if (!g1->is_obj_dead_cond(obj, this, vo)) { if (!g1->is_obj_dead_cond(obj, this, vo)) {
if (obj->is_oop()) { if (oopDesc::is_oop(obj)) {
Klass* klass = obj->klass(); Klass* klass = obj->klass();
bool is_metaspace_object = Metaspace::contains(klass) || bool is_metaspace_object = Metaspace::contains(klass) ||
(vo == VerifyOption_G1UsePrevMarking && (vo == VerifyOption_G1UsePrevMarking &&
@ -803,7 +803,7 @@ void HeapRegion::verify_rem_set(VerifyOption vo, bool* failures) const {
size_t obj_size = block_size(p); size_t obj_size = block_size(p);
if (!g1->is_obj_dead_cond(obj, this, vo)) { if (!g1->is_obj_dead_cond(obj, this, vo)) {
if (obj->is_oop()) { if (oopDesc::is_oop(obj)) {
vr_cl.set_containing_obj(obj); vr_cl.set_containing_obj(obj);
obj->oop_iterate_no_header(&vr_cl); obj->oop_iterate_no_header(&vr_cl);

View file

@ -337,7 +337,7 @@ bool HeapRegion::oops_on_card_seq_iterate_careful(MemRegion mr,
const G1CMBitMap* const bitmap = g1h->concurrent_mark()->prevMarkBitMap(); const G1CMBitMap* const bitmap = g1h->concurrent_mark()->prevMarkBitMap();
do { do {
oop obj = oop(cur); 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, assert(obj->klass_or_null() != NULL,
"Unparsable heap at " PTR_FORMAT, p2i(cur)); "Unparsable heap at " PTR_FORMAT, p2i(cur));

View file

@ -95,7 +95,7 @@ inline bool requires_marking(const void* entry, G1CollectedHeap* heap) {
return false; 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)); "Invalid oop in SATB buffer: " PTR_FORMAT, p2i(entry));
return true; return true;

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -287,7 +287,7 @@ void CardTableExtension::scavenge_contents_parallel(ObjectStartArray* start_arra
while (p < to) { while (p < to) {
Prefetch::write(p, interval); Prefetch::write(p, interval);
oop m = oop(p); 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); pm->push_contents(m);
p += m->size(); p += m->size();
} }
@ -295,7 +295,7 @@ void CardTableExtension::scavenge_contents_parallel(ObjectStartArray* start_arra
} else { } else {
while (p < to) { while (p < to) {
oop m = oop(p); 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); pm->push_contents(m);
p += m->size(); p += m->size();
} }

View file

@ -2597,7 +2597,7 @@ void PSParallelCompact::update_deferred_objects(ParCompactionManager* cm,
start_array->allocate_block(addr); start_array->allocate_block(addr);
} }
cm->update_contents(oop(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 @@ MoveAndUpdateClosure::do_addr(HeapWord* addr, size_t words) {
oop moved_oop = (oop) destination(); oop moved_oop = (oop) destination();
compaction_manager()->update_contents(moved_oop); 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); update_state(words);
assert(destination() == (HeapWord*)moved_oop + moved_oop->size(), "sanity"); assert(destination() == (HeapWord*)moved_oop + moved_oop->size(), "sanity");

View file

@ -95,7 +95,7 @@ public:
template <class T> void do_oop_work(T* p) { template <class T> void do_oop_work(T* p) {
assert (!oopDesc::is_null(*p), "expected non-null ref"); 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"); "expected an oop while scanning weak refs");
// Weak refs may be visited more than once. // Weak refs may be visited more than once.

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -41,7 +41,7 @@ inline void DefNewGeneration::KeepAliveClosure::do_oop_work(T* p) {
// as a weak reference. // as a weak reference.
assert (!oopDesc::is_null(*p), "expected non-null ref"); assert (!oopDesc::is_null(*p), "expected non-null ref");
oop obj = oopDesc::load_decode_heap_oop_not_null(p); 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 #endif // ASSERT
@ -74,7 +74,7 @@ inline void DefNewGeneration::FastKeepAliveClosure::do_oop_work(T* p) {
// as a weak reference. // as a weak reference.
assert (!oopDesc::is_null(*p), "expected non-null ref"); assert (!oopDesc::is_null(*p), "expected non-null ref");
oop obj = oopDesc::load_decode_heap_oop_not_null(p); 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 #endif // ASSERT

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -343,7 +343,7 @@ void BlockOffsetArray::verify() const {
oop o = oop(start); oop o = oop(start);
assert(!Universe::is_fully_initialized() || assert(!Universe::is_fully_initialized() ||
_sp->is_free_block(start) || _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++; next_index++;
last_p = p; last_p = p;
last_start = start; last_start = start;

View file

@ -350,7 +350,7 @@ void CollectedHeap::flush_deferred_store_barrier(JavaThread* thread) {
assert(is_in(old_obj), "Not in allocated heap"); assert(is_in(old_obj), "Not in allocated heap");
assert(!can_elide_initializing_store_barrier(old_obj), assert(!can_elide_initializing_store_barrier(old_obj),
"Else should have been filtered in new_store_pre_barrier()"); "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()), assert(deferred.word_size() == (size_t)(old_obj->size()),
"Mismatch: multiple objects?"); "Mismatch: multiple objects?");
} }

View file

@ -401,7 +401,7 @@ void ReferenceProcessor::enqueue_discovered_reflists(AbstractRefProcTaskExecutor
void DiscoveredListIterator::load_ptrs(DEBUG_ONLY(bool allow_null_referent)) { void DiscoveredListIterator::load_ptrs(DEBUG_ONLY(bool allow_null_referent)) {
_discovered_addr = java_lang_ref_Reference::discovered_addr(_ref); _discovered_addr = java_lang_ref_Reference::discovered_addr(_ref);
oop discovered = java_lang_ref_Reference::discovered(_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)); "Expected an oop or NULL for discovered field at " PTR_FORMAT, p2i(discovered));
_next = discovered; _next = discovered;
_referent_addr = java_lang_ref_Reference::referent_addr(_ref); _referent_addr = java_lang_ref_Reference::referent_addr(_ref);
@ -409,15 +409,15 @@ void DiscoveredListIterator::load_ptrs(DEBUG_ONLY(bool allow_null_referent)) {
assert(Universe::heap()->is_in_reserved_or_null(_referent), assert(Universe::heap()->is_in_reserved_or_null(_referent),
"Wrong oop found in java.lang.Reference object"); "Wrong oop found in java.lang.Reference object");
assert(allow_null_referent ? assert(allow_null_referent ?
_referent->is_oop_or_null() oopDesc::is_oop_or_null(_referent)
: _referent->is_oop(), : oopDesc::is_oop(_referent),
"Expected an oop%s for referent field at " PTR_FORMAT, "Expected an oop%s for referent field at " PTR_FORMAT,
(allow_null_referent ? " or NULL" : ""), (allow_null_referent ? " or NULL" : ""),
p2i(_referent)); p2i(_referent));
} }
void DiscoveredListIterator::remove() { 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); oop_store_raw(_discovered_addr, NULL);
// First _prev_next ref actually points into DiscoveredList (gross). // First _prev_next ref actually points into DiscoveredList (gross).
@ -534,7 +534,7 @@ ReferenceProcessor::pp2_work_concurrent_discovery(DiscoveredList& refs_list,
oop next = java_lang_ref_Reference::next(iter.obj()); oop next = java_lang_ref_Reference::next(iter.obj());
if ((iter.referent() == NULL || iter.is_referent_alive() || if ((iter.referent() == NULL || iter.is_referent_alive() ||
next != NULL)) { 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 // Remove Reference object from list
iter.remove(); iter.remove();
// Trace the cohorts // Trace the cohorts
@ -582,7 +582,7 @@ ReferenceProcessor::process_phase3(DiscoveredList& refs_list,
} }
log_develop_trace(gc, ref)("Adding %sreference (" INTPTR_FORMAT ": %s) as pending", log_develop_trace(gc, ref)("Adding %sreference (" INTPTR_FORMAT ": %s) as pending",
clear_referent ? "cleared " : "", p2i(iter.obj()), iter.obj()->klass()->internal_name()); 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(); iter.next();
} }
// Close the reachable set // Close the reachable set
@ -979,7 +979,7 @@ ReferenceProcessor::add_to_discovered_list_mt(DiscoveredList& refs_list,
void ReferenceProcessor::verify_referent(oop obj) { void ReferenceProcessor::verify_referent(oop obj) {
bool da = discovery_is_atomic(); bool da = discovery_is_atomic();
oop referent = java_lang_ref_Reference::referent(obj); 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 " "Bad referent " INTPTR_FORMAT " found in Reference "
INTPTR_FORMAT " during %satomic discovery ", INTPTR_FORMAT " during %satomic discovery ",
p2i(referent), p2i(obj), da ? "" : "non-"); p2i(referent), p2i(obj), da ? "" : "non-");
@ -1057,7 +1057,7 @@ bool ReferenceProcessor::discover_reference(oop obj, ReferenceType rt) {
HeapWord* const discovered_addr = java_lang_ref_Reference::discovered_addr(obj); HeapWord* const discovered_addr = java_lang_ref_Reference::discovered_addr(obj);
const oop discovered = java_lang_ref_Reference::discovered(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) { if (discovered != NULL) {
// The reference has already been discovered... // The reference has already been discovered...
log_develop_trace(gc, ref)("Already discovered reference (" INTPTR_FORMAT ": %s)", log_develop_trace(gc, ref)("Already discovered reference (" INTPTR_FORMAT ": %s)",
@ -1118,7 +1118,7 @@ bool ReferenceProcessor::discover_reference(oop obj, ReferenceType rt) {
log_develop_trace(gc, ref)("Discovered reference (" INTPTR_FORMAT ": %s)", p2i(obj), obj->klass()->internal_name()); 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); verify_referent(obj);
return true; return true;
} }

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -491,7 +491,7 @@ bool Space::obj_is_alive(const HeapWord* p) const {
HeapWord* obj_addr = mr.start(); \ HeapWord* obj_addr = mr.start(); \
HeapWord* t = mr.end(); \ HeapWord* t = mr.end(); \
while (obj_addr < t) { \ 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); \ obj_addr += oop(obj_addr)->oop_iterate_size(blk); \
} \ } \
} }
@ -584,7 +584,7 @@ HeapWord* ContiguousSpace::block_start_const(const void* p) const {
last = cur; last = cur;
cur += oop(cur)->size(); 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; return last;
} }
} }
@ -597,10 +597,10 @@ size_t ContiguousSpace::block_size(const HeapWord* p) const {
assert(p <= current_top, assert(p <= current_top,
"p > current top - p: " PTR_FORMAT ", current top: " PTR_FORMAT, "p > current top - p: " PTR_FORMAT ", current top: " PTR_FORMAT,
p2i(p), p2i(current_top)); 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 - " "p (" PTR_FORMAT ") is not a block start - "
"current_top: " PTR_FORMAT ", is_oop: %s", "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) { if (p < current_top) {
return oop(p)->size(); return oop(p)->size();
} else { } else {

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -36,7 +36,7 @@
#ifdef ASSERT #ifdef ASSERT
#define VERIFY_OOP(o_) \ #define VERIFY_OOP(o_) \
if (VerifyOops) { \ 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++; \ StubRoutines::_verify_oop_count++; \
} }
#else #else

View file

@ -208,7 +208,7 @@ IRT_END
IRT_ENTRY(void, InterpreterRuntime::register_finalizer(JavaThread* thread, oopDesc* obj)) 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"); assert(obj->klass()->has_finalizer(), "shouldn't be here otherwise");
InstanceKlass::register_finalizer(instanceOop(obj), CHECK); InstanceKlass::register_finalizer(instanceOop(obj), CHECK);
IRT_END IRT_END
@ -435,7 +435,6 @@ IRT_ENTRY(address, InterpreterRuntime::exception_handler_for_exception(JavaThrea
// assertions // assertions
#ifdef ASSERT #ifdef ASSERT
assert(h_exception.not_null(), "NULL exceptions should be handled by athrow"); 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 // Check that exception is a subclass of Throwable, otherwise we have a VerifyError
if (!(h_exception->is_a(SystemDictionary::Throwable_klass()))) { if (!(h_exception->is_a(SystemDictionary::Throwable_klass()))) {
if (ExitVMOnVerifyError) vm_exit(-1); if (ExitVMOnVerifyError) vm_exit(-1);

View file

@ -1318,8 +1318,6 @@ void LinkResolver::runtime_resolve_virtual_method(CallInfo& result,
int vtable_index = Method::invalid_vtable_index; int vtable_index = Method::invalid_vtable_index;
methodHandle selected_method; methodHandle selected_method;
assert(recv.is_null() || recv->is_oop(), "receiver is not an oop");
// runtime method resolution // runtime method resolution
if (check_null_and_abstract && recv.is_null()) { // check if receiver exists if (check_null_and_abstract && recv.is_null()) { // check if receiver exists
THROW(vmSymbols::java_lang_NullPointerException()); THROW(vmSymbols::java_lang_NullPointerException());

View file

@ -239,7 +239,6 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* t
} }
#ifdef ASSERT #ifdef ASSERT
assert(exception.not_null(), "NULL exceptions should be handled by throw_exception"); 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 // Check that exception is a subclass of Throwable, otherwise we have a VerifyError
if (!(exception->is_a(SystemDictionary::Throwable_klass()))) { if (!(exception->is_a(SystemDictionary::Throwable_klass()))) {
if (ExitVMOnVerifyError) vm_exit(-1); if (ExitVMOnVerifyError) vm_exit(-1);
@ -385,7 +384,6 @@ JRT_ENTRY_NO_ASYNC(void, JVMCIRuntime::monitorenter(JavaThread* thread, oopDesc*
} }
#endif #endif
Handle h_obj(thread, obj); Handle h_obj(thread, obj);
assert(h_obj()->is_oop(), "must be NULL or an object");
if (UseBiasedLocking) { if (UseBiasedLocking) {
// Retry fast entry if bias is revoked to avoid unnecessary inflation // Retry fast entry if bias is revoked to avoid unnecessary inflation
ObjectSynchronizer::fast_enter(h_obj, lock, true, CHECK); ObjectSynchronizer::fast_enter(h_obj, lock, true, CHECK);
@ -407,7 +405,7 @@ JRT_LEAF(void, JVMCIRuntime::monitorexit(JavaThread* thread, oopDesc* obj, Basic
EXCEPTION_MARK; EXCEPTION_MARK;
#ifdef DEBUG #ifdef DEBUG
if (!obj->is_oop()) { if (!oopDesc::is_oop(obj)) {
ResetNoHandleMark rhm; ResetNoHandleMark rhm;
nmethod* method = thread->last_frame().cb()->as_nmethod_or_null(); nmethod* method = thread->last_frame().cb()->as_nmethod_or_null();
if (method != NULL) { if (method != NULL) {
@ -455,8 +453,8 @@ JRT_LEAF(void, JVMCIRuntime::log_object(JavaThread* thread, oopDesc* obj, bool a
if (obj == NULL) { if (obj == NULL) {
tty->print("NULL"); tty->print("NULL");
} else if (obj->is_oop_or_null(true) && (!as_string || !java_lang_String::is_instance(obj))) { } else if (oopDesc::is_oop_or_null(obj, true) && (!as_string || !java_lang_String::is_instance(obj))) {
if (obj->is_oop_or_null(true)) { if (oopDesc::is_oop_or_null(obj, true)) {
char buf[O_BUFLEN]; char buf[O_BUFLEN];
tty->print("%s@" INTPTR_FORMAT, obj->klass()->name()->as_C_string(buf, O_BUFLEN), p2i(obj)); tty->print("%s@" INTPTR_FORMAT, obj->klass()->name()->as_C_string(buf, O_BUFLEN), p2i(obj));
} else { } else {

View file

@ -3207,7 +3207,7 @@ class VerifyFieldClosure: public OopClosure {
protected: protected:
template <class T> void do_oop_work(T* p) { template <class T> void do_oop_work(T* p) {
oop obj = oopDesc::load_decode_heap_oop(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)); tty->print_cr("Failed: " PTR_FORMAT " -> " PTR_FORMAT, p2i(p), p2i(obj));
Universe::print_on(tty); Universe::print_on(tty);
guarantee(false, "boom"); guarantee(false, "boom");

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -72,12 +72,12 @@ void InstanceRefKlass::oop_verify_on(oop obj, outputStream* st) {
// Verify referent field // Verify referent field
oop referent = java_lang_ref_Reference::referent(obj); oop referent = java_lang_ref_Reference::referent(obj);
if (referent != NULL) { if (referent != NULL) {
guarantee(referent->is_oop(), "referent field heap failed"); guarantee(oopDesc::is_oop(referent), "referent field heap failed");
} }
// Verify next field // Verify next field
oop next = java_lang_ref_Reference::next(obj); oop next = java_lang_ref_Reference::next(obj);
if (next != NULL) { 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(next->is_instance(), "next field should be an instance");
guarantee(InstanceKlass::cast(next->klass())->is_reference_instance_klass(), "next field verify failed"); guarantee(InstanceKlass::cast(next->klass())->is_reference_instance_klass(), "next field verify failed");
} }

View file

@ -713,12 +713,12 @@ void Klass::verify_on(outputStream* st) {
} }
if (java_mirror() != NULL) { 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) { 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"); guarantee(obj->klass()->is_klass(), "klass field is not a klass");
} }

View file

@ -498,6 +498,6 @@ void ObjArrayKlass::oop_verify_on(oop obj, outputStream* st) {
guarantee(obj->is_objArray(), "must be objArray"); guarantee(obj->is_objArray(), "must be objArray");
objArrayOop oa = objArrayOop(obj); objArrayOop oa = objArrayOop(obj);
for(int index = 0; index < oa->length(); index++) { 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");
} }
} }

View file

@ -121,11 +121,44 @@ unsigned int oopDesc::new_hash(juint seed) {
} }
} }
// 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; VerifyOopClosure VerifyOopClosure::verify_oop;
template <class T> void VerifyOopClosure::do_oop_work(T* p) { template <class T> void VerifyOopClosure::do_oop_work(T* p) {
oop obj = oopDesc::load_decode_heap_oop(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); } void VerifyOopClosure::do_oop(oop* p) { VerifyOopClosure::do_oop_work(p); }

View file

@ -287,9 +287,9 @@ class oopDesc {
inline bool is_unlocked() const; inline bool is_unlocked() const;
inline bool has_bias_pattern() const; inline bool has_bias_pattern() const;
// asserts // asserts and guarantees
inline bool is_oop(bool ignore_mark_word = false) const; static bool is_oop(oop obj, bool ignore_mark_word = false);
inline bool is_oop_or_null(bool ignore_mark_word = false) const; static bool is_oop_or_null(oop obj, bool ignore_mark_word = false);
#ifndef PRODUCT #ifndef PRODUCT
inline bool is_unlocked_oop() const; inline bool is_unlocked_oop() const;
#endif #endif

View file

@ -533,41 +533,6 @@ bool oopDesc::has_bias_pattern() const {
return mark()->has_bias_pattern(); 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 // Used only for markSweep, scavenging
bool oopDesc::is_gc_marked() const { bool oopDesc::is_gc_marked() const {
return mark()->is_marked(); return mark()->is_marked();

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -1563,7 +1563,7 @@ const TypeFunc *OptoRuntime::dtrace_object_alloc_Type() {
JRT_ENTRY_NO_ASYNC(void, OptoRuntime::register_finalizer(oopDesc* obj, JavaThread* thread)) 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"); assert(obj->klass()->has_finalizer(), "shouldn't be here otherwise");
InstanceKlass::register_finalizer(instanceOop(obj), CHECK); InstanceKlass::register_finalizer(instanceOop(obj), CHECK);
JRT_END JRT_END

View file

@ -326,8 +326,8 @@ JVM_ENTRY(void, JVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src
} }
arrayOop s = arrayOop(JNIHandles::resolve_non_null(src)); arrayOop s = arrayOop(JNIHandles::resolve_non_null(src));
arrayOop d = arrayOop(JNIHandles::resolve_non_null(dst)); arrayOop d = arrayOop(JNIHandles::resolve_non_null(dst));
assert(s->is_oop(), "JVM_ArrayCopy: src not an oop"); assert(oopDesc::is_oop(s), "JVM_ArrayCopy: src not an oop");
assert(d->is_oop(), "JVM_ArrayCopy: dst not an oop"); assert(oopDesc::is_oop(d), "JVM_ArrayCopy: dst not an oop");
// Do copy // Do copy
s->klass()->copy_array(s, src_pos, d, dst_pos, length, thread); s->klass()->copy_array(s, src_pos, d, dst_pos, length, thread);
JVM_END JVM_END

View file

@ -39,8 +39,8 @@ void PrivilegedElement::initialize(vframeStream* vfst, oop context, PrivilegedEl
#endif // CHECK_UNHANDLED_OOPS #endif // CHECK_UNHANDLED_OOPS
_frame_id = vfst->frame_id(); _frame_id = vfst->frame_id();
_next = next; _next = next;
assert(_privileged_context == NULL || _privileged_context->is_oop(), "must be an oop"); assert(oopDesc::is_oop_or_null(_privileged_context), "must be an oop");
assert(protection_domain() == NULL || protection_domain()->is_oop(), "must be an oop"); assert(oopDesc::is_oop_or_null(protection_domain()), "must be an oop");
} }
void PrivilegedElement::oops_do(OopClosure* f) { void PrivilegedElement::oops_do(OopClosure* f) {

View file

@ -217,7 +217,7 @@ Deoptimization::UnrollBlock* Deoptimization::fetch_unroll_info_helper(JavaThread
// Reallocation may trigger GC. If deoptimization happened on return from // 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. // call which returns oop we need to save it since it is not in oopmap.
oop result = deoptee.saved_oop_result(&map); 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); return_value = Handle(thread, result);
assert(Universe::heap()->is_in_or_null(result), "must be heap pointer"); assert(Universe::heap()->is_in_or_null(result), "must be heap pointer");
if (TraceDeoptimization) { if (TraceDeoptimization) {

View file

@ -34,7 +34,7 @@
oop* HandleArea::allocate_handle(oop obj) { oop* HandleArea::allocate_handle(oop obj) {
assert(_handle_mark_nesting > 1, "memory leak: allocating handle outside HandleMark"); assert(_handle_mark_nesting > 1, "memory leak: allocating handle outside HandleMark");
assert(_no_handle_mark_nesting == 0, "allocating handle inside NoHandleMark"); 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); return real_allocate_handle(obj);
} }
#endif #endif
@ -99,7 +99,7 @@ static uintx chunk_oops_do(OopClosure* f, Chunk* chunk, char* chunk_top) {
while (bottom < top) { while (bottom < top) {
// This test can be moved up but for now check every oop. // 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++); f->do_oop(bottom++);
} }

View file

@ -567,7 +567,7 @@ class SignatureChekker : public SignatureIterator {
"Bad JNI oop argument %d: " PTR_FORMAT, _pos, v); "Bad JNI oop argument %d: " PTR_FORMAT, _pos, v);
// Verify the pointee. // Verify the pointee.
oop vv = resolve_indirect_oop(v, _value_state[_pos]); 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, "Bad JNI oop argument %d: " PTR_FORMAT " -> " PTR_FORMAT,
_pos, v, p2i(vv)); _pos, v, p2i(vv));
} }

View file

@ -988,7 +988,7 @@ void os::print_location(outputStream* st, intptr_t x, bool verbose) {
// See if we were just given an oop directly // See if we were just given an oop directly
if (p != NULL && Universe::heap()->block_is_obj(p)) { if (p != NULL && Universe::heap()->block_is_obj(p)) {
print = true; print = true;
} else if (p == NULL && ((oopDesc*)addr)->is_oop()) { } else if (p == NULL && oopDesc::is_oop(oop(addr))) {
p = (HeapWord*) addr; p = (HeapWord*) addr;
print = true; print = true;
} }

View file

@ -1104,7 +1104,7 @@ void ThreadSafepointState::handle_polling_page_exception() {
// the other registers. In order to preserve it over GCs we need // the other registers. In order to preserve it over GCs we need
// to keep it in a handle. // to keep it in a handle.
oop result = caller_fr.saved_oop_result(&map); 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); return_value = Handle(thread(), result);
assert(Universe::heap()->is_in_or_null(result), "must be heap pointer"); assert(Universe::heap()->is_in_or_null(result), "must be heap pointer");
} }

View file

@ -209,7 +209,7 @@ JRT_LEAF(void, SharedRuntime::g1_wb_pre(oopDesc* orig, JavaThread *thread))
assert(false, "should be optimized out"); assert(false, "should be optimized out");
return; 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 // store the original value that was in the field reference
thread->satb_mark_queue().enqueue(orig); thread->satb_mark_queue().enqueue(orig);
JRT_END JRT_END
@ -585,7 +585,7 @@ oop SharedRuntime::retrieve_receiver( Symbol* sig, frame caller ) {
int args_size = ArgumentSizeComputer(sig).size() + 1; int args_size = ArgumentSizeComputer(sig).size() + 1;
assert(args_size <= caller.interpreter_frame_expression_stack_size(), "receiver must be on interpreter stack"); 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)); 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; return result;
} }
@ -997,7 +997,7 @@ JRT_ENTRY_NO_ASYNC(void, SharedRuntime::register_finalizer(JavaThread* thread, o
return; return;
} }
#endif // INCLUDE_JVMCI #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"); assert(obj->klass()->has_finalizer(), "shouldn't be here otherwise");
InstanceKlass::register_finalizer(instanceOop(obj), CHECK); InstanceKlass::register_finalizer(instanceOop(obj), CHECK);
JRT_END JRT_END
@ -1165,8 +1165,6 @@ Handle SharedRuntime::find_callee_info_helper(JavaThread* thread,
} }
} }
assert(receiver.is_null() || receiver->is_oop(), "wrong receiver");
// Resolve method // Resolve method
if (attached_method.not_null()) { if (attached_method.not_null()) {
// Parameterized by attached method. // Parameterized by attached method.

View file

@ -3187,7 +3187,7 @@ class PrintAndVerifyOopClosure: public OopClosure {
oop obj = oopDesc::load_decode_heap_oop(p); oop obj = oopDesc::load_decode_heap_oop(p);
if (obj == NULL) return; if (obj == NULL) return;
tty->print(INTPTR_FORMAT ": ", p2i(p)); tty->print(INTPTR_FORMAT ": ", p2i(p));
if (obj->is_oop_or_null()) { if (oopDesc::is_oop_or_null(obj)) {
if (obj->is_objArray()) { if (obj->is_objArray()) {
tty->print_cr("valid objArray: " INTPTR_FORMAT, p2i(obj)); tty->print_cr("valid objArray: " INTPTR_FORMAT, p2i(obj));
} else { } else {

View file

@ -764,7 +764,7 @@ void DumperSupport::dump_field_value(DumpWriter* writer, char type, address addr
// reflection and Unsafe classes may have a reference to a // reflection and Unsafe classes may have a reference to a
// Klass* so filter it out. // 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); writer->write_objectID(o);
break; break;
} }

View file

@ -136,7 +136,7 @@ JRT_END
JRT_ENTRY(void, SharkRuntime::register_finalizer(JavaThread* thread, JRT_ENTRY(void, SharkRuntime::register_finalizer(JavaThread* thread,
oop object)) oop object))
assert(object->is_oop(), "should be"); assert(oopDesc::is_oop(object), "should be");
assert(object->klass()->has_finalizer(), "should have"); assert(object->klass()->has_finalizer(), "should have");
InstanceKlass::register_finalizer(instanceOop(object), CHECK); InstanceKlass::register_finalizer(instanceOop(object), CHECK);
JRT_END JRT_END

View file

@ -47,7 +47,7 @@ void check_ThreadShadow() {
void ThreadShadow::set_pending_exception(oop exception, const char* file, int line) { 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; _pending_exception = exception;
_exception_file = file; _exception_file = file;
_exception_line = line; _exception_line = line;