8139203: Consistent naming for klass type predicates

8138923: Remove oop coupling with InstanceKlass subclasses

Renamed oop_is_instance and friends, removed the functions in oop that dug down into InstanceKlass.

Reviewed-by: jrose, lfoltan, stefank
This commit is contained in:
Coleen Phillimore 2015-10-28 09:47:23 -04:00
parent 5179fc3488
commit fc03719078
68 changed files with 257 additions and 279 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -38,7 +38,7 @@
//
// Loaded array klass.
ciArrayKlass::ciArrayKlass(KlassHandle h_k) : ciKlass(h_k) {
assert(get_Klass()->oop_is_array(), "wrong type");
assert(get_Klass()->is_array_klass(), "wrong type");
_dimension = get_ArrayKlass()->dimension();
}

View File

@ -365,11 +365,11 @@ bool ciEnv::check_klass_accessibility(ciKlass* accessing_klass,
return true;
}
if (resolved_klass->oop_is_objArray()) {
if (resolved_klass->is_objArray_klass()) {
// Find the element klass, if this is an array.
resolved_klass = ObjArrayKlass::cast(resolved_klass)->bottom_klass();
}
if (resolved_klass->oop_is_instance()) {
if (resolved_klass->is_instance_klass()) {
return Reflection::verify_class_access(accessing_klass->get_Klass(),
resolved_klass,
true);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -46,7 +46,7 @@
ciInstanceKlass::ciInstanceKlass(KlassHandle h_k) :
ciKlass(h_k)
{
assert(get_Klass()->oop_is_instance(), "wrong type");
assert(get_Klass()->is_instance_klass(), "wrong type");
assert(get_instanceKlass()->is_loaded(), "must be at least loaded");
InstanceKlass* ik = get_instanceKlass();
@ -356,7 +356,7 @@ ciInstanceKlass* ciInstanceKlass::unique_concrete_subklass() {
VM_ENTRY_MARK;
InstanceKlass* ik = get_instanceKlass();
Klass* up = ik->up_cast_abstract();
assert(up->oop_is_instance(), "must be InstanceKlass");
assert(up->is_instance_klass(), "must be InstanceKlass");
if (ik == up) {
return NULL;
}
@ -683,7 +683,7 @@ void ciInstanceKlass::dump_replay_data(outputStream* out) {
// Try to record related loaded classes
Klass* sub = ik->subklass();
while (sub != NULL) {
if (sub->oop_is_instance()) {
if (sub->is_instance_klass()) {
out->print_cr("instanceKlass %s", sub->name()->as_quoted_ascii());
}
sub = sub->next_sibling();

View File

@ -791,7 +791,7 @@ ciMethod* ciMethod::resolve_invoke(ciKlass* caller, ciKlass* exact_receiver, boo
methodHandle m;
// Only do exact lookup if receiver klass has been linked. Otherwise,
// the vtable has not been setup, and the LinkResolver will fail.
if (h_recv->oop_is_array()
if (h_recv->is_array_klass()
||
InstanceKlass::cast(h_recv())->is_linked() && !exact_receiver->is_interface()) {
if (holder()->is_interface()) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -39,7 +39,7 @@
//
// Constructor for loaded object array klasses.
ciObjArrayKlass::ciObjArrayKlass(KlassHandle h_k) : ciArrayKlass(h_k) {
assert(get_Klass()->oop_is_objArray(), "wrong type");
assert(get_Klass()->is_objArray_klass(), "wrong type");
Klass* element_Klass = get_ObjArrayKlass()->bottom_klass();
_base_element_klass = CURRENT_ENV->get_klass(element_Klass);
assert(_base_element_klass->is_instance_klass() ||

View File

@ -357,7 +357,7 @@ ciMetadata* ciObjectFactory::create_new_metadata(Metadata* o) {
// Hold metadata from unloading by keeping it's holder alive.
if (_initialized && o->is_klass()) {
Klass* holder = ((Klass*)o);
if (holder->oop_is_instance() && InstanceKlass::cast(holder)->is_anonymous()) {
if (holder->is_instance_klass() && InstanceKlass::cast(holder)->is_anonymous()) {
// Though ciInstanceKlass records class loader oop, it's not enough to keep
// VM anonymous classes alive (loader == NULL). Klass holder should be used instead.
// It is enough to record a ciObject, since cached elements are never removed
@ -370,11 +370,11 @@ ciMetadata* ciObjectFactory::create_new_metadata(Metadata* o) {
if (o->is_klass()) {
KlassHandle h_k(THREAD, (Klass*)o);
Klass* k = (Klass*)o;
if (k->oop_is_instance()) {
if (k->is_instance_klass()) {
return new (arena()) ciInstanceKlass(h_k);
} else if (k->oop_is_objArray()) {
} else if (k->is_objArray_klass()) {
return new (arena()) ciObjArrayKlass(h_k);
} else if (k->oop_is_typeArray()) {
} else if (k->is_typeArray_klass()) {
return new (arena()) ciTypeArrayKlass(h_k);
}
} else if (o->is_method()) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -45,7 +45,7 @@ ciType::ciType(BasicType basic_type) : ciMetadata() {
}
ciType::ciType(KlassHandle k) : ciMetadata(k()) {
_basic_type = k()->oop_is_array() ? T_ARRAY : T_OBJECT;
_basic_type = k()->is_array_klass() ? T_ARRAY : T_OBJECT;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,7 +34,7 @@
// ------------------------------------------------------------------
// ciTypeArrayKlass::ciTypeArrayKlass
ciTypeArrayKlass::ciTypeArrayKlass(KlassHandle h_k) : ciArrayKlass(h_k) {
assert(get_Klass()->oop_is_typeArray(), "wrong type");
assert(get_Klass()->is_typeArray_klass(), "wrong type");
assert(element_type() == get_TypeArrayKlass()->element_type(), "");
}

View File

@ -3175,8 +3175,9 @@ instanceKlassHandle ClassFileParser::parse_super_class(int super_class_index,
bool is_array = false;
if (_cp->tag_at(super_class_index).is_klass()) {
super_klass = instanceKlassHandle(THREAD, _cp->resolved_klass_at(super_class_index));
if (_need_verify)
is_array = super_klass->oop_is_array();
if (_need_verify) {
is_array = super_klass->is_array_klass();
}
} else if (_need_verify) {
is_array = (_cp->klass_name_at(super_class_index)->byte_at(0) == JVM_SIGNATURE_ARRAY);
}
@ -4111,7 +4112,7 @@ instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name,
this_klass->set_should_verify_class(verify);
jint lh = Klass::instance_layout_helper(info.instance_size, false);
this_klass->set_layout_helper(lh);
assert(this_klass->oop_is_instance(), "layout is correct");
assert(this_klass->is_instance_klass(), "layout is correct");
assert(this_klass->size_helper() == info.instance_size, "correct size_helper");
// Not yet: supers are done below to support the new subtype-checking fields
//this_klass->set_super(super_klass());

View File

@ -140,7 +140,7 @@ void ClassLoaderData::classes_do(void f(Klass * const)) {
void ClassLoaderData::methods_do(void f(Method*)) {
for (Klass* k = _klasses; k != NULL; k = k->next_link()) {
if (k->oop_is_instance()) {
if (k->is_instance_klass()) {
InstanceKlass::cast(k)->methods_do(f);
}
}
@ -151,7 +151,7 @@ void ClassLoaderData::loaded_classes_do(KlassClosure* klass_closure) {
MutexLockerEx ml(metaspace_lock(), Mutex::_no_safepoint_check_flag);
for (Klass* k = _klasses; k != NULL; k = k->next_link()) {
// Do not filter ArrayKlass oops here...
if (k->oop_is_array() || (k->oop_is_instance() && InstanceKlass::cast(k)->is_loaded())) {
if (k->is_array_klass() || (k->is_instance_klass() && InstanceKlass::cast(k)->is_loaded())) {
klass_closure->do_klass(k);
}
}
@ -159,7 +159,7 @@ void ClassLoaderData::loaded_classes_do(KlassClosure* klass_closure) {
void ClassLoaderData::classes_do(void f(InstanceKlass*)) {
for (Klass* k = _klasses; k != NULL; k = k->next_link()) {
if (k->oop_is_instance()) {
if (k->is_instance_klass()) {
f(InstanceKlass::cast(k));
}
assert(k != k->next_link(), "no loops!");

View File

@ -60,7 +60,7 @@ DictionaryEntry* Dictionary::new_entry(unsigned int hash, Klass* klass,
DictionaryEntry* entry = (DictionaryEntry*)Hashtable<Klass*, mtClass>::new_entry(hash, klass);
entry->set_loader_data(loader_data);
entry->set_pd_set(NULL);
assert(klass->oop_is_instance(), "Must be");
assert(klass->is_instance_klass(), "Must be");
return entry;
}
@ -756,7 +756,7 @@ void Dictionary::verify() {
probe = probe->next()) {
Klass* e = probe->klass();
ClassLoaderData* loader_data = probe->loader_data();
guarantee(e->oop_is_instance(),
guarantee(e->is_instance_klass(),
"Verify of system dictionary failed");
// class loader must be present; a null class loader is the
// boostrap loader

View File

@ -555,7 +555,7 @@ void java_lang_Class::fixup_mirror(KlassHandle k, TRAPS) {
// If the offset was read from the shared archive, it was fixed up already
if (!k->is_shared()) {
if (k->oop_is_instance()) {
if (k->is_instance_klass()) {
// During bootstrap, java.lang.Class wasn't loaded so static field
// offsets were computed without the size added it. Go back and
// update all the static field offsets to included the size.
@ -613,13 +613,13 @@ void java_lang_Class::create_mirror(KlassHandle k, Handle class_loader,
java_lang_Class::set_static_oop_field_count(mirror(), mk->compute_static_oop_field_count(mirror()));
// It might also have a component mirror. This mirror must already exist.
if (k->oop_is_array()) {
if (k->is_array_klass()) {
Handle comp_mirror;
if (k->oop_is_typeArray()) {
if (k->is_typeArray_klass()) {
BasicType type = TypeArrayKlass::cast(k())->element_type();
comp_mirror = Universe::java_mirror(type);
} else {
assert(k->oop_is_objArray(), "Must be");
assert(k->is_objArray_klass(), "Must be");
Klass* element_klass = ObjArrayKlass::cast(k())->element_klass();
assert(element_klass != NULL, "Must have an element klass");
comp_mirror = element_klass->java_mirror();
@ -631,7 +631,7 @@ void java_lang_Class::create_mirror(KlassHandle k, Handle class_loader,
set_component_mirror(mirror(), comp_mirror());
set_array_klass(comp_mirror(), k());
} else {
assert(k->oop_is_instance(), "Must be");
assert(k->is_instance_klass(), "Must be");
initialize_mirror_fields(k, mirror, protection_domain, THREAD);
if (HAS_PENDING_EXCEPTION) {
@ -770,7 +770,7 @@ void java_lang_Class::print_signature(oop java_class, outputStream* st) {
name = vmSymbols::type_signature(primitive_type(java_class));
} else {
Klass* k = as_Klass(java_class);
is_instance = k->oop_is_instance();
is_instance = k->is_instance_klass();
name = k->name();
}
if (name == NULL) {
@ -793,7 +793,7 @@ Symbol* java_lang_Class::as_signature(oop java_class, bool intern_if_not_found,
name->increment_refcount();
} else {
Klass* k = as_Klass(java_class);
if (!k->oop_is_instance()) {
if (!k->is_instance_klass()) {
name = k->name();
name->increment_refcount();
} else {
@ -829,13 +829,13 @@ const char* java_lang_Class::as_external_name(oop java_class) {
Klass* java_lang_Class::array_klass(oop java_class) {
Klass* k = ((Klass*)java_class->metadata_field(_array_klass_offset));
assert(k == NULL || k->is_klass() && k->oop_is_array(), "should be array klass");
assert(k == NULL || k->is_klass() && k->is_array_klass(), "should be array klass");
return k;
}
void java_lang_Class::set_array_klass(oop java_class, Klass* klass) {
assert(klass->is_klass() && klass->oop_is_array(), "should be array klass");
assert(klass->is_klass() && klass->is_array_klass(), "should be array klass");
java_class->metadata_field_put(_array_klass_offset, klass);
}
@ -2506,7 +2506,7 @@ ConstantPool* sun_reflect_ConstantPool::get_cp(oop reflect) {
oop mirror = reflect->obj_field(_oop_offset);
Klass* k = java_lang_Class::as_Klass(mirror);
assert(k->oop_is_instance(), "Must be");
assert(k->is_instance_klass(), "Must be");
// Get the constant pool back from the klass. Since class redefinition
// merges the new constant pool into the old, this is essentially the

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -320,7 +320,7 @@ Klass* LoaderConstraintTable::find_constrained_klass(Symbol* name,
Handle loader) {
LoaderConstraintEntry *p = *(find_loader_constraint(name, loader));
if (p != NULL && p->klass() != NULL) {
if (p->klass()->oop_is_instance() && !InstanceKlass::cast(p->klass())->is_loaded()) {
if (p->klass()->is_instance_klass() && !InstanceKlass::cast(p->klass())->is_loaded()) {
// Only return fully loaded classes. Classes found through the
// constraints might still be in the process of loading.
return NULL;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -244,7 +244,7 @@ void PlaceholderEntry::verify() const {
guarantee(loader_data()->class_loader() == NULL || loader_data()->class_loader()->is_instance(),
"checking type of _loader");
guarantee(instance_klass() == NULL
|| instance_klass()->oop_is_instance(),
|| instance_klass()->is_instance_klass(),
"checking type of instance_klass result");
}

View File

@ -1982,7 +1982,7 @@ void SystemDictionary::check_constraints(int d_index, unsigned int d_hash,
// system dictionary only holds instance classes, placeholders
// also holds array classes
assert(check->oop_is_instance(), "noninstance in systemdictionary");
assert(check->is_instance_klass(), "noninstance in systemdictionary");
if ((defining == true) || (k() != check)) {
linkage_error = "loader (instance of %s): attempted duplicate class "
"definition for name: \"%s\"";
@ -2388,13 +2388,13 @@ methodHandle SystemDictionary::find_method_handle_invoker(Symbol* name,
// Out of an abundance of caution, we do not include any other classes, not even for packages like java.util.
static bool is_always_visible_class(oop mirror) {
Klass* klass = java_lang_Class::as_Klass(mirror);
if (klass->oop_is_objArray()) {
if (klass->is_objArray_klass()) {
klass = ObjArrayKlass::cast(klass)->bottom_klass(); // check element type
}
if (klass->oop_is_typeArray()) {
if (klass->is_typeArray_klass()) {
return true; // primitive array
}
assert(klass->oop_is_instance(), "%s", klass->external_name());
assert(klass->is_instance_klass(), "%s", klass->external_name());
return klass->is_public() &&
(InstanceKlass::cast(klass)->is_same_class_package(SystemDictionary::Object_klass()) || // java.lang
InstanceKlass::cast(klass)->is_same_class_package(SystemDictionary::MethodHandle_klass())); // java.lang.invoke
@ -2458,9 +2458,9 @@ Handle SystemDictionary::find_method_handle_type(Symbol* signature,
Klass* sel_klass = java_lang_Class::as_Klass(mirror);
mirror = NULL; // safety
// Emulate ConstantPool::verify_constant_pool_resolve.
if (sel_klass->oop_is_objArray())
if (sel_klass->is_objArray_klass())
sel_klass = ObjArrayKlass::cast(sel_klass)->bottom_klass();
if (sel_klass->oop_is_instance()) {
if (sel_klass->is_instance_klass()) {
KlassHandle sel_kh(THREAD, sel_klass);
LinkResolver::check_klass_accessability(accessing_klass, sel_kh, CHECK_(empty));
}

View File

@ -151,7 +151,7 @@ void Dependencies::assert_has_no_finalizable_subclasses(Klass* ctxk) {
}
void Dependencies::assert_leaf_type(Klass* ctxk) {
if (ctxk->oop_is_array()) {
if (ctxk->is_array_klass()) {
// As a special case, support this assertion on an array type,
// which reduces to an assertion on its element type.
// Note that this cannot be done with assertions that
@ -1084,7 +1084,7 @@ class ClassHierarchyWalker {
return true; // Must punt the assertion to true.
Klass* k = ctxk;
Method* lm = k->lookup_method(m->name(), m->signature());
if (lm == NULL && k->oop_is_instance()) {
if (lm == NULL && k->is_instance_klass()) {
// It might be an interface method
lm = InstanceKlass::cast(k)->lookup_method_in_ordered_interfaces(m->name(),
m->signature());
@ -1135,7 +1135,7 @@ class ClassHierarchyWalker {
bool is_witness(Klass* k) {
if (doing_subtype_search()) {
return Dependencies::is_concrete_klass(k);
} else if (!k->oop_is_instance()) {
} else if (!k->is_instance_klass()) {
return false; // no methods to find in an array type
} else {
// Search class hierarchy first.
@ -1931,7 +1931,7 @@ KlassDepChange::~KlassDepChange() {
}
bool KlassDepChange::involves_context(Klass* k) {
if (k == NULL || !k->oop_is_instance()) {
if (k == NULL || !k->is_instance_klass()) {
return false;
}
InstanceKlass* ik = InstanceKlass::cast(k);

View File

@ -351,7 +351,7 @@ class Dependencies: public ResourceObj {
#if INCLUDE_JVMCI
private:
static void check_ctxk(Klass* ctxk) {
assert(ctxk->oop_is_instance(), "java types only");
assert(ctxk->is_instance_klass(), "java types only");
}
static void check_ctxk_abstract(Klass* ctxk) {
check_ctxk(ctxk);

View File

@ -3021,7 +3021,7 @@ void nmethod::print_dependencies() {
deps.print_dependency();
Klass* ctxk = deps.context_type();
if (ctxk != NULL) {
if (ctxk->oop_is_instance() && InstanceKlass::cast(ctxk)->is_dependent_nmethod(this)) {
if (ctxk->is_instance_klass() && InstanceKlass::cast(ctxk)->is_dependent_nmethod(this)) {
tty->print_cr(" [nmethod<=klass]%s", ctxk->external_name());
}
}

View File

@ -790,7 +790,7 @@ void CompileBroker::compile_method_base(const methodHandle& method,
}
guarantee(!method->is_abstract(), "cannot compile abstract methods");
assert(method->method_holder()->oop_is_instance(),
assert(method->method_holder()->is_instance_klass(),
"sanity check");
assert(!method->method_holder()->is_not_initialized(),
"method holder must be initialized");
@ -985,7 +985,7 @@ nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci,
const methodHandle& hot_method, int hot_count,
const char* comment, Thread* THREAD) {
// make sure arguments make sense
assert(method->method_holder()->oop_is_instance(), "not an instance method");
assert(method->method_holder()->is_instance_klass(), "not an instance method");
assert(osr_bci == InvocationEntryBci || (0 <= osr_bci && osr_bci < method->code_size()), "bci out of range");
assert(!method->is_abstract() && (osr_bci == InvocationEntryBci || !method->is_native()), "cannot compile abstract/native methods");
assert(!method->method_holder()->is_not_initialized(), "method holder must be initialized");

View File

@ -4590,7 +4590,7 @@ class G1KlassCleaningTask : public StackObj {
Klass* klass;
do {
klass =_klass_iterator.next_klass();
} while (klass != NULL && !klass->oop_is_instance());
} while (klass != NULL && !klass->is_instance_klass());
// this can be null so don't call InstanceKlass::cast
return static_cast<InstanceKlass*>(klass);

View File

@ -200,7 +200,7 @@ void InstanceMirrorKlass::oop_pc_follow_contents(oop obj, ParCompactionManager*
// by calling follow_class_loader explicitly. For non-anonymous classes
// the call to follow_class_loader is made when the class loader itself
// is handled.
if (klass->oop_is_instance() && InstanceKlass::cast(klass)->is_anonymous()) {
if (klass->is_instance_klass() && InstanceKlass::cast(klass)->is_anonymous()) {
cm->follow_class_loader(klass->class_loader_data());
} else {
cm->follow_klass(klass);

View File

@ -373,7 +373,8 @@ void ReferenceProcessor::enqueue_discovered_reflist(DiscoveredList& refs_list,
// so that the References are not considered active.
while (obj != next_d) {
obj = next_d;
assert(obj->is_instanceRef(), "should be reference object");
assert(obj->is_instance(), "should be an instance object");
assert(InstanceKlass::cast(obj->klass())->is_reference_instance_klass(), "should be reference object");
next_d = java_lang_ref_Reference::discovered(obj);
if (TraceReferenceGC && PrintGCDetails) {
gclog_or_tty->print_cr(" obj " INTPTR_FORMAT "/next_d " INTPTR_FORMAT,

View File

@ -2606,7 +2606,7 @@ run:
- klass: {other class}
but using InstanceKlass::cast(STACK_OBJECT(-parms)->klass()) causes in assertion failure
because rcvr->klass()->oop_is_instance() == 0
because rcvr->klass()->is_instance_klass() == 0
However it seems to have a vtable in the right location. Huh?
Because vtables have the same offset for ArrayKlass and InstanceKlass.
*/

View File

@ -302,7 +302,7 @@ methodHandle LinkResolver::lookup_method_in_klasses(const LinkInfo& link_info,
// Ignore overpasses so statics can be found during resolution
Method* result = klass->uncached_lookup_method(name, signature, Klass::skip_overpass);
if (klass->oop_is_array()) {
if (klass->is_array_klass()) {
// Only consider klass and super klass for arrays
return methodHandle(THREAD, result);
}
@ -355,7 +355,7 @@ methodHandle LinkResolver::lookup_instance_method_in_klasses(KlassHandle klass,
result = super_klass->uncached_lookup_method(name, signature, Klass::find_overpass);
}
if (klass->oop_is_array()) {
if (klass->is_array_klass()) {
// Only consider klass and super klass for arrays
return methodHandle(THREAD, result);
}
@ -531,7 +531,7 @@ void LinkResolver::check_method_accessability(KlassHandle ref_klass,
// to be false (so we'll short-circuit out of these tests).
if (sel_method->name() == vmSymbols::clone_name() &&
sel_klass() == SystemDictionary::Object_klass() &&
resolved_klass->oop_is_array()) {
resolved_klass->is_array_klass()) {
// We need to change "protected" to "public".
assert(flags.is_protected(), "clone not protected?");
jint new_flags = flags.as_int();
@ -684,7 +684,7 @@ methodHandle LinkResolver::resolve_method(const LinkInfo& link_info,
// 2. lookup method in resolved klass and its super klasses
methodHandle resolved_method = lookup_method_in_klasses(link_info, true, false, CHECK_NULL);
if (resolved_method.is_null() && !resolved_klass->oop_is_array()) { // not found in the class hierarchy
if (resolved_method.is_null() && !resolved_klass->is_array_klass()) { // not found in the class hierarchy
// 3. lookup method in all the interfaces implemented by the resolved klass
resolved_method = lookup_method_in_interfaces(link_info, CHECK_NULL);
@ -744,7 +744,7 @@ methodHandle LinkResolver::resolve_interface_method(const LinkInfo& link_info,
// JDK8: also look for static methods
methodHandle resolved_method = lookup_method_in_klasses(link_info, false, true, CHECK_NULL);
if (resolved_method.is_null() && !resolved_klass->oop_is_array()) {
if (resolved_method.is_null() && !resolved_klass->is_array_klass()) {
// lookup method in all the super-interfaces
resolved_method = lookup_method_in_interfaces(link_info, CHECK_NULL);
}

View File

@ -549,7 +549,7 @@ C2V_VMENTRY(jobject, resolveMethod, (JNIEnv *, jobject, jobject receiver_jvmci_t
Klass* caller_klass = CompilerToVM::asKlass(caller_jvmci_type);
Method* method = CompilerToVM::asMethod(jvmci_method);
if (recv_klass->oop_is_array() || (InstanceKlass::cast(recv_klass)->is_linked())) {
if (recv_klass->is_array_klass() || (InstanceKlass::cast(recv_klass)->is_linked())) {
Klass* holder_klass = method->method_holder();
Symbol* method_name = method->name();
Symbol* method_signature = method->signature();

View File

@ -64,18 +64,18 @@ JVMCIEnv::JVMCIEnv(CompileTask* task, int system_dictionary_modification_counter
// Note: the logic of this method should mirror the logic of
// constantPoolOopDesc::verify_constant_pool_resolve.
bool JVMCIEnv::check_klass_accessibility(KlassHandle accessing_klass, KlassHandle resolved_klass) {
if (accessing_klass->oop_is_objArray()) {
if (accessing_klass->is_objArray_klass()) {
accessing_klass = ObjArrayKlass::cast(accessing_klass())->bottom_klass();
}
if (!accessing_klass->oop_is_instance()) {
if (!accessing_klass->is_instance_klass()) {
return true;
}
if (resolved_klass->oop_is_objArray()) {
if (resolved_klass->is_objArray_klass()) {
// Find the element klass, if this is an array.
resolved_klass = ObjArrayKlass::cast(resolved_klass())->bottom_klass();
}
if (resolved_klass->oop_is_instance()) {
if (resolved_klass->is_instance_klass()) {
return Reflection::verify_class_access(accessing_klass(), resolved_klass(), true);
}
return true;
@ -383,9 +383,9 @@ instanceKlassHandle JVMCIEnv::get_instance_klass_for_declared_method_holder(Klas
// For the case of <array>.clone(), the method holder can be an ArrayKlass*
// instead of an InstanceKlass*. For that case simply pretend that the
// declared holder is Object.clone since that's where the call will bottom out.
if (method_holder->oop_is_instance()) {
if (method_holder->is_instance_klass()) {
return instanceKlassHandle(method_holder());
} else if (method_holder->oop_is_array()) {
} else if (method_holder->is_array_klass()) {
return instanceKlassHandle(SystemDictionary::Object_klass());
} else {
ShouldNotReachHere();

View File

@ -124,7 +124,7 @@ JRT_BLOCK_ENTRY(void, JVMCIRuntime::new_array(JavaThread* thread, Klass* array_k
// (This may have to change if this code changes!)
assert(array_klass->is_klass(), "not a class");
oop obj;
if (array_klass->oop_is_typeArray()) {
if (array_klass->is_typeArray_klass()) {
BasicType elt_type = TypeArrayKlass::cast(array_klass)->element_type();
obj = oopFactory::new_typeArray(elt_type, length, CHECK);
} else {

View File

@ -321,7 +321,7 @@ public:
void do_cinfo(KlassInfoEntry* cie) {
// ignore array classes
if (cie->klass()->oop_is_instance()) {
if (cie->klass()->is_instance_klass()) {
_elements->append(cie);
}
}
@ -543,8 +543,8 @@ void KlassInfoHisto::print_class_stats(outputStream* st,
} else {
int super_index = -1;
// Print the stats for this class.
if (k->oop_is_instance()) {
Klass* super = ((InstanceKlass*)k)->java_super();
if (k->is_instance_klass()) {
Klass* super = k->super();
if (super) {
KlassInfoEntry* super_e = _cit->lookup(super);
if (super_e) {

View File

@ -90,7 +90,7 @@ void MetaspaceShared::serialize(SerializeClosure* soc) {
static GrowableArray<Klass*>* _global_klass_objects;
static void collect_classes(Klass* k) {
_global_klass_objects->append_if_missing(k);
if (k->oop_is_instance()) {
if (k->is_instance_klass()) {
// Add in the array classes too
InstanceKlass* ik = InstanceKlass::cast(k);
ik->array_klasses_do(collect_classes);
@ -126,7 +126,7 @@ static void rewrite_nofast_bytecode(Method* method) {
static void rewrite_nofast_bytecodes_and_calculate_fingerprints() {
for (int i = 0; i < _global_klass_objects->length(); i++) {
Klass* k = _global_klass_objects->at(i);
if (k->oop_is_instance()) {
if (k->is_instance_klass()) {
InstanceKlass* ik = InstanceKlass::cast(k);
for (int i = 0; i < ik->methods()->length(); i++) {
Method* m = ik->methods()->at(i);
@ -199,9 +199,9 @@ static void patch_klass_vtables(void** vtbl_list, void* new_vtable_start) {
int n = _global_klass_objects->length();
for (int i = 0; i < n; i++) {
Klass* obj = _global_klass_objects->at(i);
// Note oop_is_instance() is a virtual call. After patching vtables
// Note is_instance_klass() is a virtual call in debug. After patching vtables
// all virtual calls on the dummy vtables will restore the original!
if (obj->oop_is_instance()) {
if (obj->is_instance_klass()) {
InstanceKlass* ik = InstanceKlass::cast(obj);
*(void**)ik = find_matching_vtbl_ptr(vtbl_list, new_vtable_start, ik);
ConstantPool* cp = ik->constants();
@ -482,12 +482,12 @@ void VM_PopulateDumpSharedSpace::doit() {
int num_type_array = 0, num_obj_array = 0, num_inst = 0;
for (int i = 0; i < _global_klass_objects->length(); i++) {
Klass* k = _global_klass_objects->at(i);
if (k->oop_is_instance()) {
if (k->is_instance_klass()) {
num_inst ++;
} else if (k->oop_is_objArray()) {
} else if (k->is_objArray_klass()) {
num_obj_array ++;
} else {
assert(k->oop_is_typeArray(), "sanity");
assert(k->is_typeArray_klass(), "sanity");
num_type_array ++;
}
}
@ -679,7 +679,7 @@ void VM_PopulateDumpSharedSpace::doit() {
void MetaspaceShared::link_one_shared_class(Klass* obj, TRAPS) {
Klass* k = obj;
if (k->oop_is_instance()) {
if (k->is_instance_klass()) {
InstanceKlass* ik = InstanceKlass::cast(k);
// Link the class to cause the bytecodes to be rewritten and the
// cpcache to be created. Class verification is done according
@ -690,7 +690,7 @@ void MetaspaceShared::link_one_shared_class(Klass* obj, TRAPS) {
}
void MetaspaceShared::check_one_shared_class(Klass* k) {
if (k->oop_is_instance() && InstanceKlass::cast(k)->check_sharing_error_state()) {
if (k->is_instance_klass() && InstanceKlass::cast(k)->check_sharing_error_state()) {
_check_classes_made_progress = true;
}
}

View File

@ -81,7 +81,7 @@ typeArrayOop oopFactory::new_typeArray_nozero(BasicType type, int length, TRAPS)
objArrayOop oopFactory::new_objArray(Klass* klass, int length, TRAPS) {
assert(klass->is_klass(), "must be instance class");
if (klass->oop_is_array()) {
if (klass->is_array_klass()) {
return ArrayKlass::cast(klass)->allocate_arrayArray(1, length, THREAD);
} else {
return InstanceKlass::cast(klass)->allocate_objArray(1, length, THREAD);

View File

@ -545,7 +545,7 @@ void Universe::reinitialize_vtable_of(KlassHandle k_h, TRAPS) {
Klass* ko = k_h();
klassVtable* vt = ko->vtable();
if (vt) vt->initialize_vtable(false, CHECK);
if (ko->oop_is_instance()) {
if (ko->is_instance_klass()) {
for (KlassHandle s_h(THREAD, ko->subklass());
s_h() != NULL;
s_h = KlassHandle(THREAD, s_h()->next_sibling())) {

View File

@ -50,7 +50,7 @@ class ArrayKlass: public Klass {
public:
// Testing operation
bool oop_is_array_slow() const { return true; }
DEBUG_ONLY(bool is_array_klass_slow() const { return true; })
// Instance variables
int dimension() const { return _dimension; }
@ -86,8 +86,8 @@ class ArrayKlass: public Klass {
// Casting from Klass*
static ArrayKlass* cast(Klass* k) {
assert(k->oop_is_array(), "cast to ArrayKlass");
return (ArrayKlass*) k;
assert(k->is_array_klass(), "cast to ArrayKlass");
return static_cast<ArrayKlass*>(k);
}
GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots);

View File

@ -269,7 +269,7 @@ Klass* ConstantPool::klass_at_impl(const constantPoolHandle& this_cp, int which,
ClassLoaderData* this_key = this_cp->pool_holder()->class_loader_data();
this_key->record_dependency(k(), CHECK_NULL); // Can throw OOM
if (TraceClassResolution && !k->oop_is_array()) {
if (TraceClassResolution && !k->is_array_klass()) {
// skip resolving the constant pool so that this code gets
// called the next time some bytecodes refer to this class.
trace_class_resolution(this_cp, k);
@ -435,14 +435,14 @@ int ConstantPool::remap_instruction_operand_from_cache(int operand) {
void ConstantPool::verify_constant_pool_resolve(const constantPoolHandle& this_cp, KlassHandle k, TRAPS) {
if (k->oop_is_instance() || k->oop_is_objArray()) {
if (k->is_instance_klass() || k->is_objArray_klass()) {
instanceKlassHandle holder (THREAD, this_cp->pool_holder());
Klass* elem = k->oop_is_instance() ? k() : ObjArrayKlass::cast(k())->bottom_klass();
Klass* elem = k->is_instance_klass() ? k() : ObjArrayKlass::cast(k())->bottom_klass();
KlassHandle element (THREAD, elem);
// The element type could be a typeArray - we only need the access check if it is
// an reference to another class
if (element->oop_is_instance()) {
if (element->is_instance_klass()) {
LinkResolver::check_klass_accessability(holder, element, CHECK);
}
}
@ -1843,7 +1843,7 @@ void ConstantPool::preload_and_initialize_all_classes(ConstantPool* obj, TRAPS)
if (cp->tag_at(i).is_unresolved_klass()) {
// This will force loading of the class
Klass* klass = cp->klass_at(i, CHECK);
if (klass->oop_is_instance()) {
if (klass->is_instance_klass()) {
// Force initialization of class
InstanceKlass::cast(klass)->initialize(CHECK);
}

View File

@ -394,7 +394,7 @@ Method* ConstantPoolCacheEntry::method_if_resolved(const constantPoolHandle& cpo
int holder_index = cpool->uncached_klass_ref_index_at(constant_pool_index());
if (cpool->tag_at(holder_index).is_klass()) {
Klass* klass = cpool->resolved_klass_at(holder_index);
if (!klass->oop_is_instance())
if (!klass->is_instance_klass())
klass = SystemDictionary::Object_klass();
return InstanceKlass::cast(klass)->method_at_vtable(f2_as_index());
}

View File

@ -2324,7 +2324,7 @@ const char* InstanceKlass::signature_name() const {
// different verisons of is_same_class_package
bool InstanceKlass::is_same_class_package(Klass* class2) {
if (class2->oop_is_objArray()) {
if (class2->is_objArray_klass()) {
class2 = ObjArrayKlass::cast(class2)->bottom_klass();
}
oop classloader2 = class2->class_loader();
@ -2424,7 +2424,7 @@ Klass* InstanceKlass::compute_enclosing_class_impl(instanceKlassHandle self,
bool InstanceKlass::is_same_package_member_impl(instanceKlassHandle class1,
Klass* class2_oop, TRAPS) {
if (class2_oop == class1()) return true;
if (!class2_oop->oop_is_instance()) return false;
if (!class2_oop->is_instance_klass()) return false;
instanceKlassHandle class2(THREAD, class2_oop);
// must be in same package before we try anything else
@ -2967,7 +2967,7 @@ void InstanceKlass::oop_print_on(oop obj, outputStream* st) {
st->print_cr(BULLET"fake entry for oop_size: %d", java_lang_Class::oop_size(obj));
st->print_cr(BULLET"fake entry for static_oop_field_count: %d", java_lang_Class::static_oop_field_count(obj));
Klass* real_klass = java_lang_Class::as_Klass(obj);
if (real_klass != NULL && real_klass->oop_is_instance()) {
if (real_klass != NULL && real_klass->is_instance_klass()) {
InstanceKlass::cast(real_klass)->do_local_static_fields(&print_field);
}
} else if (this == SystemDictionary::MethodType_klass()) {

View File

@ -908,7 +908,9 @@ public:
bool compute_is_subtype_of(Klass* k);
bool can_be_primary_super_slow() const;
int oop_size(oop obj) const { return size_helper(); }
bool oop_is_instance_slow() const { return true; }
// slow because it's a virtual call and used for verifying the layout_helper.
// Using the layout_helper bits, we can call is_instance_klass without a virtual call.
DEBUG_ONLY(bool is_instance_klass_slow() const { return true; })
// Iterators
void do_local_static_fields(FieldClosure* cl);
@ -923,7 +925,7 @@ public:
// Casting from Klass*
static InstanceKlass* cast(Klass* k) {
assert(k != NULL, "k should not be null");
assert(k->oop_is_instance(), "cast to InstanceKlass");
assert(k->is_instance_klass(), "cast to InstanceKlass");
return static_cast<InstanceKlass*>(k);
}

View File

@ -40,7 +40,7 @@
int InstanceMirrorKlass::_offset_of_static_fields = 0;
int InstanceMirrorKlass::instance_size(KlassHandle k) {
if (k() != NULL && k->oop_is_instance()) {
if (k() != NULL && k->is_instance_klass()) {
return align_object_size(size_helper() + InstanceKlass::cast(k())->static_field_size());
}
return size_helper();
@ -65,7 +65,7 @@ int InstanceMirrorKlass::oop_size(oop obj) const {
int InstanceMirrorKlass::compute_static_oop_field_count(oop obj) {
Klass* k = java_lang_Class::as_Klass(obj);
if (k != NULL && k->oop_is_instance()) {
if (k != NULL && k->is_instance_klass()) {
return InstanceKlass::cast(k)->static_oop_field_count();
}
return 0;

View File

@ -60,7 +60,7 @@ void InstanceMirrorKlass::oop_oop_iterate(oop obj, OopClosureType* closure) {
Klass* klass = java_lang_Class::as_Klass(obj);
// We'll get NULL for primitive mirrors.
if (klass != NULL) {
if (klass->oop_is_instance() && InstanceKlass::cast(klass)->is_anonymous()) {
if (klass->is_instance_klass() && InstanceKlass::cast(klass)->is_anonymous()) {
// An anonymous class doesn't have its own class loader, so when handling
// the java mirror for an anonymous class we need to make sure its class
// loader data is claimed, this is done by calling do_cld explicitly.

View File

@ -82,8 +82,9 @@ void InstanceRefKlass::oop_verify_on(oop obj, outputStream* st) {
// Verify next field
oop next = java_lang_ref_Reference::next(obj);
if (next != NULL) {
guarantee(next->is_oop(), "next field verify failed");
guarantee(next->is_instanceRef(), "next field verify failed");
guarantee(next->is_oop(), "next field should be an oop");
guarantee(next->is_instance(), "next field should be an instance");
guarantee(InstanceKlass::cast(next->klass())->is_reference_instance_klass(), "next field verify failed");
}
}

View File

@ -348,7 +348,7 @@ GrowableArray<Klass*>* Klass::compute_secondary_supers(int num_extra_slots) {
InstanceKlass* Klass::superklass() const {
assert(super() == NULL || super()->oop_is_instance(), "must be instance klass");
assert(super() == NULL || super()->is_instance_klass(), "must be instance klass");
return _super == NULL ? NULL : InstanceKlass::cast(_super);
}
@ -440,7 +440,7 @@ void Klass::clean_weak_klass_links(BoolObjectClosure* is_alive, bool clean_alive
}
// Clean the implementors list and method data.
if (clean_alive_klasses && current->oop_is_instance()) {
if (clean_alive_klasses && current->is_instance_klass()) {
InstanceKlass* ik = InstanceKlass::cast(current);
ik->clean_weak_instanceklass_links(is_alive);
}
@ -560,7 +560,7 @@ oop Klass::class_loader() const { return class_loader_data()->class_loader(); }
// In product mode, this function doesn't have virtual function calls so
// there might be some performance advantage to handling InstanceKlass here.
const char* Klass::external_name() const {
if (oop_is_instance()) {
if (is_instance_klass()) {
const InstanceKlass* ik = static_cast<const InstanceKlass*>(this);
if (ik->is_anonymous()) {
intptr_t hash = 0;
@ -695,7 +695,7 @@ bool Klass::verify_vtable_index(int i) {
}
bool Klass::verify_itable_index(int i) {
assert(oop_is_instance(), "");
assert(is_instance_klass(), "");
int method_count = klassItable::method_count_for_interface(this);
assert(i >= 0 && i < method_count, "index out of bounds");
return true;
@ -711,11 +711,11 @@ class TestKlass {
public:
static void test_oop_is_instanceClassLoader() {
Klass* klass = SystemDictionary::ClassLoader_klass();
guarantee(klass->oop_is_instance(), "assert");
guarantee(klass->is_instance_klass(), "assert");
guarantee(InstanceKlass::cast(klass)->is_class_loader_instance_klass(), "test failed");
klass = SystemDictionary::String_klass();
guarantee(!klass->oop_is_instance() ||
guarantee(!klass->is_instance_klass() ||
!InstanceKlass::cast(klass)->is_class_loader_instance_klass(),
"test failed");
}
@ -725,4 +725,4 @@ void TestKlass_test() {
TestKlass::test_oop_is_instanceClassLoader();
}
#endif
#endif // PRODUCT

View File

@ -474,11 +474,13 @@ protected:
virtual const char* signature_name() const;
// type testing operations
#ifdef ASSERT
protected:
virtual bool oop_is_instance_slow() const { return false; }
virtual bool oop_is_array_slow() const { return false; }
virtual bool oop_is_objArray_slow() const { return false; }
virtual bool oop_is_typeArray_slow() const { return false; }
virtual bool is_instance_klass_slow() const { return false; }
virtual bool is_array_klass_slow() const { return false; }
virtual bool is_objArray_klass_slow() const { return false; }
virtual bool is_typeArray_klass_slow() const { return false; }
#endif // ASSERT
public:
// Fast non-virtual versions
@ -492,18 +494,18 @@ protected:
}
public:
#endif
inline bool oop_is_instance() const { return assert_same_query(
layout_helper_is_instance(layout_helper()),
oop_is_instance_slow()); }
inline bool oop_is_array() const { return assert_same_query(
inline bool is_instance_klass() const { return assert_same_query(
layout_helper_is_instance(layout_helper()),
is_instance_klass_slow()); }
inline bool is_array_klass() const { return assert_same_query(
layout_helper_is_array(layout_helper()),
oop_is_array_slow()); }
inline bool oop_is_objArray() const { return assert_same_query(
is_array_klass_slow()); }
inline bool is_objArray_klass() const { return assert_same_query(
layout_helper_is_objArray(layout_helper()),
oop_is_objArray_slow()); }
inline bool oop_is_typeArray() const { return assert_same_query(
is_objArray_klass_slow()); }
inline bool is_typeArray_klass() const { return assert_same_query(
layout_helper_is_typeArray(layout_helper()),
oop_is_typeArray_slow()); }
is_typeArray_klass_slow()); }
#undef assert_same_query
// Access flags

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -30,7 +30,7 @@
#include "oops/markOop.hpp"
inline void Klass::set_prototype_header(markOop header) {
assert(!header->has_bias_pattern() || oop_is_instance(), "biased locking currently only supported for Java instances");
assert(!header->has_bias_pattern() || is_instance_klass(), "biased locking currently only supported for Java instances");
_prototype_header = header;
}

View File

@ -152,7 +152,7 @@ void klassVtable::initialize_vtable(bool checkconstraints, TRAPS) {
KlassHandle super (THREAD, klass()->java_super());
int nofNewEntries = 0;
if (PrintVtables && !klass()->oop_is_array()) {
if (PrintVtables && !klass()->is_array_klass()) {
ResourceMark rm(THREAD);
tty->print_cr("Initializing: %s", _klass->name()->as_C_string());
}
@ -170,10 +170,10 @@ void klassVtable::initialize_vtable(bool checkconstraints, TRAPS) {
}
int super_vtable_len = initialize_from_super(super);
if (klass()->oop_is_array()) {
if (klass()->is_array_klass()) {
assert(super_vtable_len == _length, "arrays shouldn't introduce new methods");
} else {
assert(_klass->oop_is_instance(), "must be InstanceKlass");
assert(_klass->is_instance_klass(), "must be InstanceKlass");
Array<Method*>* methods = ik()->methods();
int len = methods->length();
@ -312,7 +312,7 @@ bool klassVtable::update_inherited_vtable(InstanceKlass* klass, methodHandle tar
bool checkconstraints, TRAPS) {
ResourceMark rm;
bool allocate_new = true;
assert(klass->oop_is_instance(), "must be InstanceKlass");
assert(klass->is_instance_klass(), "must be InstanceKlass");
Array<int>* def_vtable_indices = NULL;
bool is_default = false;
@ -1110,7 +1110,7 @@ int klassItable::assign_itable_indices_for_interface(Klass* klass) {
}
int klassItable::method_count_for_interface(Klass* interf) {
assert(interf->oop_is_instance(), "must be");
assert(interf->is_instance_klass(), "must be");
assert(interf->is_interface(), "must be");
Array<Method*>* methods = InstanceKlass::cast(interf)->methods();
int nof_methods = methods->length();
@ -1527,11 +1527,11 @@ class VtableStats : AllStatic {
klassVtable* vt = kl->vtable();
if (vt == NULL) return;
no_klasses++;
if (kl->oop_is_instance()) {
if (kl->is_instance_klass()) {
no_instance_klasses++;
kl->array_klasses_do(do_class);
}
if (kl->oop_is_array()) {
if (kl->is_array_klass()) {
no_array_klasses++;
sum_of_array_vtable_len += vt->length();
}

View File

@ -1175,7 +1175,7 @@ methodHandle Method::make_method_handle_intrinsic(vmIntrinsics::ID iid,
Klass* Method::check_non_bcp_klass(Klass* klass) {
if (klass != NULL && klass->class_loader() != NULL) {
if (klass->oop_is_objArray())
if (klass->is_objArray_klass())
klass = ObjArrayKlass::cast(klass)->bottom_klass();
return klass;
}

View File

@ -102,7 +102,7 @@ Klass* ObjArrayKlass::allocate_objArray_klass(ClassLoaderData* loader_data,
// Create type name for klass.
Symbol* name = NULL;
if (!element_klass->oop_is_instance() ||
if (!element_klass->is_instance_klass() ||
(name = InstanceKlass::cast(element_klass())->array_name()) == NULL) {
ResourceMark rm(THREAD);
@ -111,17 +111,17 @@ Klass* ObjArrayKlass::allocate_objArray_klass(ClassLoaderData* loader_data,
char *new_str = NEW_RESOURCE_ARRAY(char, len + 4);
int idx = 0;
new_str[idx++] = '[';
if (element_klass->oop_is_instance()) { // it could be an array or simple type
if (element_klass->is_instance_klass()) { // it could be an array or simple type
new_str[idx++] = 'L';
}
memcpy(&new_str[idx], name_str, len * sizeof(char));
idx += len;
if (element_klass->oop_is_instance()) {
if (element_klass->is_instance_klass()) {
new_str[idx++] = ';';
}
new_str[idx++] = '\0';
name = SymbolTable::new_permanent_symbol(new_str, CHECK_0);
if (element_klass->oop_is_instance()) {
if (element_klass->is_instance_klass()) {
InstanceKlass* ik = InstanceKlass::cast(element_klass());
ik->set_array_name(name);
}
@ -150,18 +150,18 @@ ObjArrayKlass::ObjArrayKlass(int n, KlassHandle element_klass, Symbol* name) : A
name->decrement_refcount();
Klass* bk;
if (element_klass->oop_is_objArray()) {
if (element_klass->is_objArray_klass()) {
bk = ObjArrayKlass::cast(element_klass())->bottom_klass();
} else {
bk = element_klass();
}
assert(bk != NULL && (bk->oop_is_instance() || bk->oop_is_typeArray()), "invalid bottom klass");
assert(bk != NULL && (bk->is_instance_klass() || bk->is_typeArray_klass()), "invalid bottom klass");
this->set_bottom_klass(bk);
this->set_class_loader_data(bk->class_loader_data());
this->set_layout_helper(array_layout_helper(T_OBJECT));
assert(this->oop_is_array(), "sanity");
assert(this->oop_is_objArray(), "sanity");
assert(this->is_array_klass(), "sanity");
assert(this->is_objArray_klass(), "sanity");
}
int ObjArrayKlass::oop_size(oop obj) const {
@ -336,7 +336,7 @@ Klass* ObjArrayKlass::array_klass_impl(bool or_null, int n, TRAPS) {
ak->set_lower_dimension(this);
OrderAccess::storestore();
set_higher_dimension(ak);
assert(ak->oop_is_objArray(), "incorrect initialization of ObjArrayKlass");
assert(ak->is_objArray_klass(), "incorrect initialization of ObjArrayKlass");
}
}
} else {
@ -386,7 +386,7 @@ GrowableArray<Klass*>* ObjArrayKlass::compute_secondary_supers(int num_extra_slo
}
bool ObjArrayKlass::compute_is_subtype_of(Klass* k) {
if (!k->oop_is_objArray())
if (!k->is_objArray_klass())
return ArrayKlass::compute_is_subtype_of(k);
ObjArrayKlass* oak = ObjArrayKlass::cast(k);
@ -484,7 +484,7 @@ void ObjArrayKlass::verify_on(outputStream* st) {
guarantee(element_klass()->is_klass(), "should be klass");
guarantee(bottom_klass()->is_klass(), "should be klass");
Klass* bk = bottom_klass();
guarantee(bk->oop_is_instance() || bk->oop_is_typeArray(), "invalid bottom klass");
guarantee(bk->is_instance_klass() || bk->is_typeArray_klass(), "invalid bottom klass");
}
void ObjArrayKlass::oop_verify_on(oop obj, outputStream* st) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -60,7 +60,7 @@ class ObjArrayKlass : public ArrayKlass {
bool can_be_primary_super_slow() const;
GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots);
bool compute_is_subtype_of(Klass* k);
bool oop_is_objArray_slow() const { return true; }
DEBUG_ONLY(bool is_objArray_klass_slow() const { return true; })
int oop_size(oop obj) const;
// Allocation
@ -91,8 +91,8 @@ class ObjArrayKlass : public ArrayKlass {
public:
// Casting from Klass*
static ObjArrayKlass* cast(Klass* k) {
assert(k->oop_is_objArray(), "cast to ObjArrayKlass");
return (ObjArrayKlass*) k;
assert(k->is_objArray_klass(), "cast to ObjArrayKlass");
return static_cast<ObjArrayKlass*>(k);
}
// Sizing

View File

@ -129,9 +129,6 @@ void VerifyOopClosure::do_oop(narrowOop* p) { VerifyOopClosure::do_oop_work(p);
// type test operations that doesn't require inclusion of oop.inline.hpp.
bool oopDesc::is_instance_noinline() const { return is_instance(); }
bool oopDesc::is_instanceMirror_noinline() const { return is_instanceMirror(); }
bool oopDesc::is_instanceClassLoader_noline() const { return is_instanceClassLoader(); }
bool oopDesc::is_instanceRef_noline() const { return is_instanceRef(); }
bool oopDesc::is_array_noinline() const { return is_array(); }
bool oopDesc::is_objArray_noinline() const { return is_objArray(); }
bool oopDesc::is_typeArray_noinline() const { return is_typeArray(); }

View File

@ -110,18 +110,12 @@ class oopDesc {
// type test operations (inlined in oop.inline.hpp)
bool is_instance() const;
bool is_instanceMirror() const;
bool is_instanceClassLoader() const;
bool is_instanceRef() const;
bool is_array() const;
bool is_objArray() const;
bool is_typeArray() const;
// type test operations that don't require inclusion of oop.inline.hpp.
bool is_instance_noinline() const;
bool is_instanceMirror_noinline() const;
bool is_instanceClassLoader_noline() const;
bool is_instanceRef_noline() const;
bool is_array_noinline() const;
bool is_objArray_noinline() const;
bool is_typeArray_noinline() const;

View File

@ -127,27 +127,12 @@ inline void oopDesc::init_mark() { set_mark(markOopDesc::proto
inline bool oopDesc::is_a(Klass* k) const { return klass()->is_subtype_of(k); }
inline bool oopDesc::is_instance() const {
return klass()->oop_is_instance();
return klass()->is_instance_klass();
}
inline bool oopDesc::is_instanceClassLoader() const {
Klass* k = klass();
return k->oop_is_instance() && InstanceKlass::cast(k)->is_class_loader_instance_klass();
}
inline bool oopDesc::is_instanceMirror() const {
Klass* k = klass();
return k->oop_is_instance() && InstanceKlass::cast(k)->is_mirror_instance_klass();
}
inline bool oopDesc::is_instanceRef() const {
Klass* k = klass();
return k->oop_is_instance() && InstanceKlass::cast(k)->is_reference_instance_klass();
}
inline bool oopDesc::is_array() const { return klass()->oop_is_array(); }
inline bool oopDesc::is_objArray() const { return klass()->oop_is_objArray(); }
inline bool oopDesc::is_typeArray() const { return klass()->oop_is_typeArray(); }
inline bool oopDesc::is_array() const { return klass()->is_array_klass(); }
inline bool oopDesc::is_objArray() const { return klass()->is_objArray_klass(); }
inline bool oopDesc::is_typeArray() const { return klass()->is_typeArray_klass(); }
inline void* oopDesc::field_base(int offset) const { return (void*)&((char*)this)[offset]; }
@ -724,7 +709,7 @@ inline void oopDesc::pc_follow_contents(ParCompactionManager* cm) {
inline void oopDesc::pc_update_contents() {
Klass* k = klass();
if (!k->oop_is_typeArray()) {
if (!k->is_typeArray_klass()) {
// It might contain oops beyond the header, so take the virtual call.
k->oop_pc_update_pointers(this);
}
@ -733,7 +718,7 @@ inline void oopDesc::pc_update_contents() {
inline void oopDesc::ps_push_contents(PSPromotionManager* pm) {
Klass* k = klass();
if (!k->oop_is_typeArray()) {
if (!k->is_typeArray_klass()) {
// It might contain oops beyond the header, so take the virtual call.
k->oop_ps_push_contents(this, pm);
}

View File

@ -43,7 +43,7 @@
#include "utilities/macros.hpp"
bool TypeArrayKlass::compute_is_subtype_of(Klass* k) {
if (!k->oop_is_typeArray()) {
if (!k->is_typeArray_klass()) {
return ArrayKlass::compute_is_subtype_of(k);
}
@ -86,8 +86,8 @@ TypeArrayKlass* TypeArrayKlass::allocate(ClassLoaderData* loader_data, BasicType
TypeArrayKlass::TypeArrayKlass(BasicType type, Symbol* name) : ArrayKlass(name) {
set_layout_helper(array_layout_helper(type));
assert(oop_is_array(), "sanity");
assert(oop_is_typeArray(), "sanity");
assert(is_array_klass(), "sanity");
assert(is_typeArray_klass(), "sanity");
set_max_length(arrayOopDesc::max_array_length(type));
assert(size() >= TypeArrayKlass::header_size(), "bad size");
@ -181,7 +181,7 @@ Klass* TypeArrayKlass::array_klass_impl(bool or_null, int n, TRAPS) {
h_ak->set_lower_dimension(this);
OrderAccess::storestore();
set_higher_dimension(h_ak);
assert(h_ak->oop_is_objArray(), "incorrect initialization of ObjArrayKlass");
assert(h_ak->is_objArray_klass(), "incorrect initialization of ObjArrayKlass");
}
}
} else {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -47,7 +47,7 @@ class TypeArrayKlass : public ArrayKlass {
void set_max_length(jint m) { _max_length = m; }
// testers
bool oop_is_typeArray_slow() const { return true; }
DEBUG_ONLY(bool is_typeArray_klass_slow() const { return true; })
// klass allocation
static TypeArrayKlass* create_klass(BasicType type, const char* name_str,
@ -122,8 +122,8 @@ class TypeArrayKlass : public ArrayKlass {
public:
// Casting from Klass*
static TypeArrayKlass* cast(Klass* k) {
assert(k->oop_is_typeArray(), "cast to TypeArrayKlass");
return (TypeArrayKlass*) k;
assert(k->is_typeArray_klass(), "cast to TypeArrayKlass");
return static_cast<TypeArrayKlass*>(k);
}
// Naming

View File

@ -260,7 +260,7 @@ JRT_BLOCK_ENTRY(void, OptoRuntime::new_array_C(Klass* array_type, int len, JavaT
// Scavenge and allocate an instance.
oop result;
if (array_type->oop_is_typeArray()) {
if (array_type->is_typeArray_klass()) {
// The oopFactory likes to work with the element type.
// (We could bypass the oopFactory, since it doesn't add much value.)
BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type();
@ -298,7 +298,7 @@ JRT_BLOCK_ENTRY(void, OptoRuntime::new_array_nozero_C(Klass* array_type, int len
// Scavenge and allocate an instance.
oop result;
assert(array_type->oop_is_typeArray(), "should be called only for type array");
assert(array_type->is_typeArray_klass(), "should be called only for type array");
// The oopFactory likes to work with the element type.
BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type();
result = oopFactory::new_typeArray_nozero(elem_type, len, THREAD);

View File

@ -563,7 +563,7 @@ JNI_ENTRY(jclass, jni_GetSuperclass(JNIEnv *env, jclass sub))
// return mirror for superclass
Klass* super = k->java_super();
// super2 is the value computed by the compiler's getSuperClass intrinsic:
debug_only(Klass* super2 = ( k->oop_is_array()
debug_only(Klass* super2 = ( k->is_array_klass()
? SystemDictionary::Object_klass()
: k->super() ) );
assert(super == super2,
@ -1344,14 +1344,14 @@ static jmethodID get_method_id(JNIEnv *env, jclass clazz, const char *name_str,
if (name == vmSymbols::object_initializer_name() ||
name == vmSymbols::class_initializer_name()) {
// Never search superclasses for constructors
if (klass->oop_is_instance()) {
if (klass->is_instance_klass()) {
m = InstanceKlass::cast(klass())->find_method(name, signature);
} else {
m = NULL;
}
} else {
m = klass->lookup_method(name, signature);
if (m == NULL && klass->oop_is_instance()) {
if (m == NULL && klass->is_instance_klass()) {
m = InstanceKlass::cast(klass())->lookup_method_in_ordered_interfaces(name, signature);
}
}
@ -2038,7 +2038,7 @@ JNI_ENTRY(jfieldID, jni_GetFieldID(JNIEnv *env, jclass clazz,
k()->initialize(CHECK_NULL);
fieldDescriptor fd;
if (!k()->oop_is_instance() ||
if (!k()->is_instance_klass() ||
!InstanceKlass::cast(k())->find_field(fieldname, signame, false, &fd)) {
THROW_MSG_0(vmSymbols::java_lang_NoSuchFieldError(), (char*) name);
}
@ -2292,7 +2292,7 @@ JNI_ENTRY(jfieldID, jni_GetStaticFieldID(JNIEnv *env, jclass clazz,
k()->initialize(CHECK_NULL);
fieldDescriptor fd;
if (!k()->oop_is_instance() ||
if (!k()->is_instance_klass() ||
!InstanceKlass::cast(k())->find_field(fieldname, signame, true, &fd)) {
THROW_MSG_0(vmSymbols::java_lang_NoSuchFieldError(), (char*) name);
}
@ -3045,7 +3045,7 @@ JNI_ENTRY(jint, jni_UnregisterNatives(JNIEnv *env, jclass clazz))
HOTSPOT_JNI_UNREGISTERNATIVES_ENTRY(env, clazz);
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz));
//%note jni_2
if (k->oop_is_instance()) {
if (k->is_instance_klass()) {
for (int index = 0; index < InstanceKlass::cast(k)->methods()->length(); index++) {
Method* m = InstanceKlass::cast(k)->methods()->at(index);
if (m->is_native()) {

View File

@ -514,7 +514,7 @@ void jniCheck::validate_throwable_klass(JavaThread* thr, Klass* klass) {
ASSERT_OOPS_ALLOWED;
assert(klass != NULL, "klass argument must have a value");
if (!klass->oop_is_instance() ||
if (!klass->is_instance_klass() ||
!InstanceKlass::cast(klass)->is_subclass_of(SystemDictionary::Throwable_klass())) {
ReportJNIFatalError(thr, fatal_class_not_a_throwable_class);
}

View File

@ -1022,10 +1022,10 @@ JVM_ENTRY(jobjectArray, JVM_GetClassInterfaces(JNIEnv *env, jclass cls))
KlassHandle klass(thread, java_lang_Class::as_Klass(mirror));
// Figure size of result array
int size;
if (klass->oop_is_instance()) {
if (klass->is_instance_klass()) {
size = InstanceKlass::cast(klass())->local_interfaces()->length();
} else {
assert(klass->oop_is_objArray() || klass->oop_is_typeArray(), "Illegal mirror klass");
assert(klass->is_objArray_klass() || klass->is_typeArray_klass(), "Illegal mirror klass");
size = 2;
}
@ -1033,7 +1033,7 @@ JVM_ENTRY(jobjectArray, JVM_GetClassInterfaces(JNIEnv *env, jclass cls))
objArrayOop r = oopFactory::new_objArray(SystemDictionary::Class_klass(), size, CHECK_NULL);
objArrayHandle result (THREAD, r);
// Fill in result
if (klass->oop_is_instance()) {
if (klass->is_instance_klass()) {
// Regular instance klass, fill in all local interfaces
for (int index = 0; index < size; index++) {
Klass* k = InstanceKlass::cast(klass())->local_interfaces()->at(index);
@ -1056,7 +1056,7 @@ JVM_QUICK_ENTRY(jboolean, JVM_IsInterface(JNIEnv *env, jclass cls))
}
Klass* k = java_lang_Class::as_Klass(mirror);
jboolean result = k->is_interface();
assert(!result || k->oop_is_instance(),
assert(!result || k->is_instance_klass(),
"all interfaces are instance types");
// The compiler intrinsic for isInterface tests the
// Klass::_access_flags bits in the same way.
@ -1097,7 +1097,7 @@ JVM_ENTRY(void, JVM_SetClassSigners(JNIEnv *env, jclass cls, jobjectArray signer
// Signers are only set once, ClassLoader.java, and thus shouldn't
// be called with an array. Only the bootstrap loader creates arrays.
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
if (k->oop_is_instance()) {
if (k->is_instance_klass()) {
java_lang_Class::set_signers(k->java_mirror(), objArrayOop(JNIHandles::resolve(signers)));
}
}
@ -1356,7 +1356,7 @@ JVM_END
JVM_QUICK_ENTRY(jboolean, JVM_IsArrayClass(JNIEnv *env, jclass cls))
JVMWrapper("JVM_IsArrayClass");
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
return (k != NULL) && k->oop_is_array() ? true : false;
return (k != NULL) && k->is_array_klass() ? true : false;
JVM_END
@ -1389,7 +1389,7 @@ JVM_ENTRY(jobjectArray, JVM_GetDeclaredClasses(JNIEnv *env, jclass ofClass))
// of an InstanceKlass
if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass)) ||
! java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass))->oop_is_instance()) {
! java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass))->is_instance_klass()) {
oop result = oopFactory::new_objArray(SystemDictionary::Class_klass(), 0, CHECK_NULL);
return (jobjectArray)JNIHandles::make_local(env, result);
}
@ -1453,7 +1453,7 @@ JVM_ENTRY(jclass, JVM_GetDeclaringClass(JNIEnv *env, jclass ofClass))
{
// ofClass is a reference to a java_lang_Class object.
if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass)) ||
! java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass))->oop_is_instance()) {
! java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass))->is_instance_klass()) {
return NULL;
}
@ -1471,7 +1471,7 @@ JVM_ENTRY(jstring, JVM_GetSimpleBinaryName(JNIEnv *env, jclass cls))
{
oop mirror = JNIHandles::resolve_non_null(cls);
if (java_lang_Class::is_primitive(mirror) ||
!java_lang_Class::as_Klass(mirror)->oop_is_instance()) {
!java_lang_Class::as_Klass(mirror)->is_instance_klass()) {
return NULL;
}
instanceKlassHandle k(THREAD, InstanceKlass::cast(java_lang_Class::as_Klass(mirror)));
@ -1496,7 +1496,7 @@ JVM_ENTRY(jstring, JVM_GetClassSignature(JNIEnv *env, jclass cls))
// Return null for arrays and primatives
if (!java_lang_Class::is_primitive(JNIHandles::resolve(cls))) {
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls));
if (k->oop_is_instance()) {
if (k->is_instance_klass()) {
Symbol* sym = InstanceKlass::cast(k)->generic_signature();
if (sym == NULL) return NULL;
Handle str = java_lang_String::create_from_symbol(sym, CHECK_NULL);
@ -1514,7 +1514,7 @@ JVM_ENTRY(jbyteArray, JVM_GetClassAnnotations(JNIEnv *env, jclass cls))
// Return null for arrays and primitives
if (!java_lang_Class::is_primitive(JNIHandles::resolve(cls))) {
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls));
if (k->oop_is_instance()) {
if (k->is_instance_klass()) {
typeArrayOop a = Annotations::make_java_array(InstanceKlass::cast(k)->class_annotations(), CHECK_NULL);
return (jbyteArray) JNIHandles::make_local(env, a);
}
@ -1584,7 +1584,7 @@ JVM_ENTRY(jbyteArray, JVM_GetClassTypeAnnotations(JNIEnv *env, jclass cls))
// Return null for arrays and primitives
if (!java_lang_Class::is_primitive(JNIHandles::resolve(cls))) {
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls));
if (k->oop_is_instance()) {
if (k->is_instance_klass()) {
AnnotationArray* type_annotations = InstanceKlass::cast(k)->class_type_annotations();
if (type_annotations != NULL) {
typeArrayOop a = Annotations::make_java_array(type_annotations, CHECK_NULL);
@ -1693,7 +1693,7 @@ JVM_ENTRY(jobjectArray, JVM_GetClassDeclaredFields(JNIEnv *env, jclass ofClass,
// Exclude primitive types and array types
if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass)) ||
java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass))->oop_is_array()) {
java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass))->is_array_klass()) {
// Return empty array
oop res = oopFactory::new_objArray(SystemDictionary::reflect_Field_klass(), 0, CHECK_NULL);
return (jobjectArray) JNIHandles::make_local(env, res);
@ -1767,7 +1767,7 @@ static jobjectArray get_class_declared_methods_helper(
// Exclude primitive types and array types
if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass))
|| java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass))->oop_is_array()) {
|| java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass))->is_array_klass()) {
// Return empty array
oop res = oopFactory::new_objArray(klass, 0, CHECK_NULL);
return (jobjectArray) JNIHandles::make_local(env, res);
@ -1868,7 +1868,7 @@ JVM_ENTRY(jobject, JVM_GetClassConstantPool(JNIEnv *env, jclass cls))
// Return null for primitives and arrays
if (!java_lang_Class::is_primitive(JNIHandles::resolve_non_null(cls))) {
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
if (k->oop_is_instance()) {
if (k->is_instance_klass()) {
instanceKlassHandle k_h(THREAD, k);
Handle jcp = sun_reflect_ConstantPool::create(CHECK_NULL);
sun_reflect_ConstantPool::set_cp(jcp(), k_h->constants());
@ -2136,8 +2136,8 @@ JVM_ENTRY(jboolean, JVM_DesiredAssertionStatus(JNIEnv *env, jclass unused, jclas
if (java_lang_Class::is_primitive(r)) return false;
Klass* k = java_lang_Class::as_Klass(r);
assert(k->oop_is_instance(), "must be an instance klass");
if (! k->oop_is_instance()) return false;
assert(k->is_instance_klass(), "must be an instance klass");
if (!k->is_instance_klass()) return false;
ResourceMark rm(THREAD);
const char* name = k->name()->as_C_string();
@ -2182,12 +2182,12 @@ JVM_QUICK_ENTRY(void, JVM_GetClassCPTypes(JNIEnv *env, jclass cls, unsigned char
k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread);
// types will have length zero if this is not an InstanceKlass
// (length is determined by call to JVM_GetClassCPEntriesCount)
if (k->oop_is_instance()) {
if (k->is_instance_klass()) {
ConstantPool* cp = InstanceKlass::cast(k)->constants();
for (int index = cp->length() - 1; index >= 0; index--) {
constantTag tag = cp->tag_at(index);
types[index] = (tag.is_unresolved_klass()) ? JVM_CONSTANT_Class : tag.value();
}
}
}
JVM_END
@ -2196,9 +2196,7 @@ JVM_QUICK_ENTRY(jint, JVM_GetClassCPEntriesCount(JNIEnv *env, jclass cls))
JVMWrapper("JVM_GetClassCPEntriesCount");
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread);
if (!k->oop_is_instance())
return 0;
return InstanceKlass::cast(k)->constants()->length();
return (!k->is_instance_klass()) ? 0 : InstanceKlass::cast(k)->constants()->length();
JVM_END
@ -2206,9 +2204,7 @@ JVM_QUICK_ENTRY(jint, JVM_GetClassFieldsCount(JNIEnv *env, jclass cls))
JVMWrapper("JVM_GetClassFieldsCount");
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread);
if (!k->oop_is_instance())
return 0;
return InstanceKlass::cast(k)->java_fields_count();
return (!k->is_instance_klass()) ? 0 : InstanceKlass::cast(k)->java_fields_count();
JVM_END
@ -2216,9 +2212,7 @@ JVM_QUICK_ENTRY(jint, JVM_GetClassMethodsCount(JNIEnv *env, jclass cls))
JVMWrapper("JVM_GetClassMethodsCount");
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread);
if (!k->oop_is_instance())
return 0;
return InstanceKlass::cast(k)->methods()->length();
return (!k->is_instance_klass()) ? 0 : InstanceKlass::cast(k)->methods()->length();
JVM_END
@ -3476,7 +3470,7 @@ jclass find_class_from_class_loader(JNIEnv* env, Symbol* name, jboolean init,
KlassHandle klass_handle(THREAD, klass);
// Check if we should initialize the class
if (init && klass_handle->oop_is_instance()) {
if (init && klass_handle->is_instance_klass()) {
klass_handle->initialize(CHECK_NULL);
}
return (jclass) JNIHandles::make_local(env, klass_handle->java_mirror());
@ -3624,7 +3618,7 @@ JVM_ENTRY(jobjectArray, JVM_GetEnclosingMethodInfo(JNIEnv *env, jclass ofClass))
return NULL;
}
Klass* k = java_lang_Class::as_Klass(mirror());
if (!k->oop_is_instance()) {
if (!k->is_instance_klass()) {
return NULL;
}
instanceKlassHandle ik_h(THREAD, k);

View File

@ -2139,7 +2139,7 @@ JvmtiEnv::GetClassSignature(oop k_mirror, char** signature_ptr, char** generic_p
}
if (generic_ptr != NULL) {
*generic_ptr = NULL;
if (!isPrimitive && k->oop_is_instance()) {
if (!isPrimitive && k->is_instance_klass()) {
Symbol* soo = InstanceKlass::cast(k)->generic_signature();
if (soo != NULL) {
const char *gen_sig = soo->as_C_string();
@ -2188,7 +2188,7 @@ JvmtiEnv::GetSourceFileName(oop k_mirror, char** source_name_ptr) {
Klass* k_klass = java_lang_Class::as_Klass(k_mirror);
NULL_CHECK(k_klass, JVMTI_ERROR_INVALID_CLASS);
if (!k_klass->oop_is_instance()) {
if (!k_klass->is_instance_klass()) {
return JVMTI_ERROR_ABSENT_INFORMATION;
}
@ -2256,7 +2256,7 @@ JvmtiEnv::GetClassMethods(oop k_mirror, jint* method_count_ptr, jmethodID** meth
return JVMTI_ERROR_CLASS_NOT_PREPARED;
}
if (!k->oop_is_instance()) {
if (!k->is_instance_klass()) {
*method_count_ptr = 0;
*methods_ptr = (jmethodID*) jvmtiMalloc(0 * sizeof(jmethodID));
return JVMTI_ERROR_NONE;
@ -2340,7 +2340,7 @@ JvmtiEnv::GetClassFields(oop k_mirror, jint* field_count_ptr, jfieldID** fields_
return JVMTI_ERROR_CLASS_NOT_PREPARED;
}
if (!k->oop_is_instance()) {
if (!k->is_instance_klass()) {
*field_count_ptr = 0;
*fields_ptr = (jfieldID*) jvmtiMalloc(0 * sizeof(jfieldID));
return JVMTI_ERROR_NONE;
@ -2394,7 +2394,7 @@ JvmtiEnv::GetImplementedInterfaces(oop k_mirror, jint* interface_count_ptr, jcla
if (!(k->jvmti_class_status() & (JVMTI_CLASS_STATUS_PREPARED|JVMTI_CLASS_STATUS_ARRAY) ))
return JVMTI_ERROR_CLASS_NOT_PREPARED;
if (!k->oop_is_instance()) {
if (!k->is_instance_klass()) {
*interface_count_ptr = 0;
*interfaces_ptr = (jclass*) jvmtiMalloc(0 * sizeof(jclass));
return JVMTI_ERROR_NONE;
@ -2528,7 +2528,7 @@ JvmtiEnv::IsArrayClass(oop k_mirror, jboolean* is_array_class_ptr) {
bool result = false;
if (!java_lang_Class::is_primitive(k_mirror)) {
Klass* k = java_lang_Class::as_Klass(k_mirror);
if (k != NULL && k->oop_is_array()) {
if (k != NULL && k->is_array_klass()) {
result = true;
}
}
@ -2576,7 +2576,7 @@ JvmtiEnv::GetSourceDebugExtension(oop k_mirror, char** source_debug_extension_pt
}
Klass* k = java_lang_Class::as_Klass(k_mirror);
NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS);
if (!k->oop_is_instance()) {
if (!k->is_instance_klass()) {
return JVMTI_ERROR_ABSENT_INFORMATION;
}
char* sde = InstanceKlass::cast(k)->source_debug_extension();

View File

@ -199,7 +199,7 @@ bool VM_RedefineClasses::is_modifiable_class(oop klass_mirror) {
}
Klass* the_class_oop = java_lang_Class::as_Klass(klass_mirror);
// classes for arrays cannot be redefined
if (the_class_oop == NULL || !the_class_oop->oop_is_instance()) {
if (the_class_oop == NULL || !the_class_oop->is_instance_klass()) {
return false;
}
return true;
@ -3339,10 +3339,10 @@ void VM_RedefineClasses::AdjustCpoolCacheAndVtable::do_klass(Klass* k) {
// If the class being redefined is java.lang.Object, we need to fix all
// array class vtables also
if (k->oop_is_array() && _the_class_oop == SystemDictionary::Object_klass()) {
if (k->is_array_klass() && _the_class_oop == SystemDictionary::Object_klass()) {
k->vtable()->adjust_method_entries(the_class, &trace_name_printed);
} else if (k->oop_is_instance()) {
} else if (k->is_instance_klass()) {
HandleMark hm(_thread);
InstanceKlass *ik = InstanceKlass::cast(k);
@ -3443,7 +3443,7 @@ void VM_RedefineClasses::AdjustCpoolCacheAndVtable::do_klass(Klass* k) {
// Clean method data for this class
void VM_RedefineClasses::MethodDataCleaner::do_klass(Klass* k) {
if (k->oop_is_instance()) {
if (k->is_instance_klass()) {
InstanceKlass *ik = InstanceKlass::cast(k);
// Clean MethodData of this class's methods so they don't refer to
// old methods that are no longer running.
@ -4131,7 +4131,7 @@ void VM_RedefineClasses::increment_class_counter(InstanceKlass *ik, TRAPS) {
for (Klass *subk = ik->subklass(); subk != NULL;
subk = subk->next_sibling()) {
if (subk->oop_is_instance()) {
if (subk->is_instance_klass()) {
// Only update instanceKlasses
InstanceKlass *subik = InstanceKlass::cast(subk);
// recursively do subclasses of the current subclass
@ -4158,7 +4158,7 @@ void VM_RedefineClasses::CheckClass::do_klass(Klass* k) {
no_old_methods = false;
}
if (k->oop_is_instance()) {
if (k->is_instance_klass()) {
HandleMark hm(_thread);
InstanceKlass *ik = InstanceKlass::cast(k);

View File

@ -1118,7 +1118,7 @@ static jint invoke_primitive_field_callback_for_static_fields
Klass* klass = java_lang_Class::as_Klass(obj);
// ignore classes for object and type arrays
if (!klass->oop_is_instance()) {
if (!klass->is_instance_klass()) {
return 0;
}
@ -2569,7 +2569,7 @@ class SimpleRootsClosure : public OopClosure {
// SystemDictionary::always_strong_oops_do reports the application
// class loader as a root. We want this root to be reported as
// a root kind of "OTHER" rather than "SYSTEM_CLASS".
if (!o->is_instanceMirror()) {
if (!o->is_instance() || !InstanceKlass::cast(o->klass())->is_mirror_instance_klass()) {
kind = JVMTI_HEAP_REFERENCE_OTHER;
}
}
@ -2821,7 +2821,7 @@ inline bool VM_HeapWalkOperation::iterate_over_class(oop java_class) {
int i;
Klass* klass = java_lang_Class::as_Klass(java_class);
if (klass->oop_is_instance()) {
if (klass->is_instance_klass()) {
InstanceKlass* ik = InstanceKlass::cast(klass);
// Ignore the class if it hasn't been initialized yet

View File

@ -148,7 +148,7 @@ oop MethodHandles::init_MemberName(Handle mname, Handle target) {
oop clazz = java_lang_reflect_Field::clazz(target_oop); // fd.field_holder()
int slot = java_lang_reflect_Field::slot(target_oop); // fd.index()
KlassHandle k(thread, java_lang_Class::as_Klass(clazz));
if (!k.is_null() && k->oop_is_instance()) {
if (!k.is_null() && k->is_instance_klass()) {
fieldDescriptor fd(InstanceKlass::cast(k()), slot);
oop mname2 = init_field_MemberName(mname, fd);
if (mname2 != NULL) {
@ -164,7 +164,7 @@ oop MethodHandles::init_MemberName(Handle mname, Handle target) {
oop clazz = java_lang_reflect_Method::clazz(target_oop);
int slot = java_lang_reflect_Method::slot(target_oop);
KlassHandle k(thread, java_lang_Class::as_Klass(clazz));
if (!k.is_null() && k->oop_is_instance()) {
if (!k.is_null() && k->is_instance_klass()) {
Method* m = InstanceKlass::cast(k())->method_with_idnum(slot);
if (m == NULL || is_signature_polymorphic(m->intrinsic_id()))
return NULL; // do not resolve unless there is a concrete signature
@ -175,7 +175,7 @@ oop MethodHandles::init_MemberName(Handle mname, Handle target) {
oop clazz = java_lang_reflect_Constructor::clazz(target_oop);
int slot = java_lang_reflect_Constructor::slot(target_oop);
KlassHandle k(thread, java_lang_Class::as_Klass(clazz));
if (!k.is_null() && k->oop_is_instance()) {
if (!k.is_null() && k->is_instance_klass()) {
Method* m = InstanceKlass::cast(k())->method_with_idnum(slot);
if (m == NULL) return NULL;
CallInfo info(m, k());
@ -637,8 +637,8 @@ Handle MethodHandles::resolve_MemberName(Handle mname, KlassHandle caller, TRAPS
{
Klass* defc_klass = java_lang_Class::as_Klass(defc_oop());
if (defc_klass == NULL) return empty; // a primitive; no resolution possible
if (!defc_klass->oop_is_instance()) {
if (!defc_klass->oop_is_array()) return empty;
if (!defc_klass->is_instance_klass()) {
if (!defc_klass->is_array_klass()) return empty;
defc_klass = SystemDictionary::Object_klass();
}
defc = instanceKlassHandle(THREAD, defc_klass);
@ -804,7 +804,7 @@ void MethodHandles::expand_MemberName(Handle mname, int suppress, TRAPS) {
case IS_FIELD:
{
assert(vmtarget->is_klass(), "field vmtarget is Klass*");
if (!((Klass*) vmtarget)->oop_is_instance()) break;
if (!((Klass*) vmtarget)->is_instance_klass()) break;
instanceKlassHandle defc(THREAD, (Klass*) vmtarget);
DEBUG_ONLY(vmtarget = NULL); // safety
bool is_static = ((flags & JVM_ACC_STATIC) != 0);
@ -841,7 +841,7 @@ int MethodHandles::find_MemberNames(KlassHandle k,
Thread* thread = Thread::current();
if (k.is_null() || !k->oop_is_instance()) return -1;
if (k.is_null() || !k->is_instance_klass()) return -1;
int rfill = 0, rlimit = results->length(), rskip = skip;
// overflow measurement:
@ -1164,12 +1164,12 @@ JVM_ENTRY(jobject, MHN_resolve_Mem(JNIEnv *env, jobject igcls, jobject mname_jh,
if (VerifyMethodHandles && caller_jh != NULL &&
java_lang_invoke_MemberName::clazz(mname()) != NULL) {
Klass* reference_klass = java_lang_Class::as_Klass(java_lang_invoke_MemberName::clazz(mname()));
if (reference_klass != NULL && reference_klass->oop_is_objArray()) {
if (reference_klass != NULL && reference_klass->is_objArray_klass()) {
reference_klass = ObjArrayKlass::cast(reference_klass)->bottom_klass();
}
// Reflection::verify_class_access can only handle instance classes.
if (reference_klass != NULL && reference_klass->oop_is_instance()) {
if (reference_klass != NULL && reference_klass->is_instance_klass()) {
// Emulate LinkResolver::check_klass_accessability.
Klass* caller = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(caller_jh));
if (!Reflection::verify_class_access(caller,

View File

@ -766,12 +766,12 @@ static void getBaseAndScale(int& base, int& scale, jclass acls, TRAPS) {
}
oop mirror = JNIHandles::resolve_non_null(acls);
Klass* k = java_lang_Class::as_Klass(mirror);
if (k == NULL || !k->oop_is_array()) {
if (k == NULL || !k->is_array_klass()) {
THROW(vmSymbols::java_lang_InvalidClassException());
} else if (k->oop_is_objArray()) {
} else if (k->is_objArray_klass()) {
base = arrayOopDesc::base_offset_in_bytes(T_OBJECT);
scale = heapOopSize;
} else if (k->oop_is_typeArray()) {
} else if (k->is_typeArray_klass()) {
TypeArrayKlass* tak = TypeArrayKlass::cast(k);
base = tak->array_header_in_bytes();
assert(base == arrayOopDesc::base_offset_in_bytes(tak->element_type()), "array_header_size semantics ok");

View File

@ -283,7 +283,7 @@ void CounterDecay::decay() {
CounterHalfLifeTime);
for (int i = 0; i < classes_per_tick; i++) {
Klass* k = SystemDictionary::try_get_next_class();
if (k != NULL && k->oop_is_instance()) {
if (k != NULL && k->is_instance_klass()) {
InstanceKlass::cast(k)->methods_do(do_method);
}
}

View File

@ -758,15 +758,15 @@ bool Deoptimization::realloc_objects(JavaThread* thread, frame* fr, GrowableArra
KlassHandle k(java_lang_Class::as_Klass(sv->klass()->as_ConstantOopReadValue()->value()()));
oop obj = NULL;
if (k->oop_is_instance()) {
if (k->is_instance_klass()) {
InstanceKlass* ik = InstanceKlass::cast(k());
obj = ik->allocate_instance(THREAD);
} else if (k->oop_is_typeArray()) {
} else if (k->is_typeArray_klass()) {
TypeArrayKlass* ak = TypeArrayKlass::cast(k());
assert(sv->field_size() % type2size[ak->element_type()] == 0, "non-integral array length");
int len = sv->field_size() / type2size[ak->element_type()];
obj = ak->allocate(len, THREAD);
} else if (k->oop_is_objArray()) {
} else if (k->is_objArray_klass()) {
ObjArrayKlass* ak = ObjArrayKlass::cast(k());
obj = ak->allocate(sv->field_size(), THREAD);
}
@ -1010,13 +1010,13 @@ void Deoptimization::reassign_fields(frame* fr, RegisterMap* reg_map, GrowableAr
continue;
}
if (k->oop_is_instance()) {
if (k->is_instance_klass()) {
InstanceKlass* ik = InstanceKlass::cast(k());
reassign_fields_by_klass(ik, fr, reg_map, sv, 0, obj(), skip_internal);
} else if (k->oop_is_typeArray()) {
} else if (k->is_typeArray_klass()) {
TypeArrayKlass* ak = TypeArrayKlass::cast(k());
reassign_type_array_elements(fr, reg_map, sv, (typeArrayOop) obj(), ak->element_type());
} else if (k->oop_is_objArray()) {
} else if (k->is_objArray_klass()) {
reassign_object_array_elements(fr, reg_map, sv, (objArrayOop) obj());
}
}

View File

@ -212,7 +212,8 @@ ResetNoHandleMark::~ResetNoHandleMark() {
}
bool instanceKlassHandle::is_instanceKlass(const Klass* k) {
return k->oop_is_instance();
// Need this to avoid circular include dependency
return k->is_instance_klass();
}
#endif

View File

@ -330,7 +330,7 @@ arrayOop Reflection::reflect_new_array(oop element_mirror, jint length, TRAPS) {
return TypeArrayKlass::cast(tak)->allocate(length, THREAD);
} else {
Klass* k = java_lang_Class::as_Klass(element_mirror);
if (k->oop_is_array() && ArrayKlass::cast(k)->dimension() >= MAX_DIM) {
if (k->is_array_klass() && ArrayKlass::cast(k)->dimension() >= MAX_DIM) {
THROW_0(vmSymbols::java_lang_IllegalArgumentException());
}
return oopFactory::new_objArray(k, length, THREAD);
@ -366,7 +366,7 @@ arrayOop Reflection::reflect_new_multi_array(oop element_mirror, typeArrayOop di
klass = basic_type_mirror_to_arrayklass(element_mirror, CHECK_NULL);
} else {
klass = java_lang_Class::as_Klass(element_mirror);
if (klass->oop_is_array()) {
if (klass->is_array_klass()) {
int k_dim = ArrayKlass::cast(klass)->dimension();
if (k_dim + len > MAX_DIM) {
THROW_0(vmSymbols::java_lang_IllegalArgumentException());
@ -387,7 +387,7 @@ oop Reflection::array_component_type(oop mirror, TRAPS) {
}
Klass* klass = java_lang_Class::as_Klass(mirror);
if (!klass->oop_is_array()) {
if (!klass->is_array_klass()) {
return NULL;
}
@ -395,14 +395,14 @@ oop Reflection::array_component_type(oop mirror, TRAPS) {
#ifdef ASSERT
oop result2 = NULL;
if (ArrayKlass::cast(klass)->dimension() == 1) {
if (klass->oop_is_typeArray()) {
if (klass->is_typeArray_klass()) {
result2 = basic_type_arrayklass_to_mirror(klass, CHECK_NULL);
} else {
result2 = ObjArrayKlass::cast(klass)->element_klass()->java_mirror();
}
} else {
Klass* lower_dim = ArrayKlass::cast(klass)->lower_dimension();
assert(lower_dim->oop_is_array(), "just checking");
assert(lower_dim->is_array_klass(), "just checking");
result2 = lower_dim->java_mirror();
}
assert(result == result2, "results must be consistent");
@ -495,7 +495,7 @@ bool Reflection::verify_field_access(Klass* current_class,
}
Klass* host_class = current_class;
while (host_class->oop_is_instance() &&
while (host_class->is_instance_klass() &&
InstanceKlass::cast(host_class)->is_anonymous()) {
Klass* next_host_class = InstanceKlass::cast(host_class)->host_klass();
if (next_host_class == NULL) break;

View File

@ -1142,7 +1142,7 @@ Handle SharedRuntime::find_callee_info_helper(JavaThread* thread,
callee->is_method_handle_intrinsic() ||
callee->is_compiled_lambda_form(),
"actual receiver must be subclass of static receiver klass");
if (receiver_klass->oop_is_instance()) {
if (receiver_klass->is_instance_klass()) {
if (InstanceKlass::cast(receiver_klass())->is_not_initialized()) {
tty->print_cr("ERROR: Klass not yet initialized!!");
receiver_klass()->print();

View File

@ -164,7 +164,7 @@ size_t ClassLoadingService::compute_class_size(InstanceKlass* k) {
class_size += k->size();
if (k->oop_is_instance()) {
if (k->is_instance_klass()) {
class_size += k->methods()->size();
// FIXME: Need to count the contents of methods
class_size += k->constants()->size();

View File

@ -940,7 +940,7 @@ void DumperSupport::dump_class_and_array_classes(DumpWriter* writer, Klass* k) {
k = k->array_klass_or_null();
while (k != NULL) {
Klass* klass = k;
assert(klass->oop_is_objArray(), "not an ObjArrayKlass");
assert(klass->is_objArray_klass(), "not an ObjArrayKlass");
writer->write_u1(HPROF_GC_CLASS_DUMP);
writer->write_classID(klass);
@ -1124,7 +1124,7 @@ void DumperSupport::dump_stack_frame(DumpWriter* writer,
writer->write_symbolID(m->name()); // method's name
writer->write_symbolID(m->signature()); // method's signature
assert(m->method_holder()->oop_is_instance(), "not InstanceKlass");
assert(m->method_holder()->is_instance_klass(), "not InstanceKlass");
writer->write_symbolID(m->method_holder()->source_file_name()); // source file name
writer->write_u4(class_serial_num); // class serial number
writer->write_u4((u4) line_number); // line number
@ -1246,7 +1246,7 @@ class StickyClassDumper : public KlassClosure {
_writer = writer;
}
void do_klass(Klass* k) {
if (k->oop_is_instance()) {
if (k->is_instance_klass()) {
InstanceKlass* ik = InstanceKlass::cast(k);
writer()->write_u1(HPROF_GC_ROOT_STICKY_CLASS);
writer()->write_classID(ik);
@ -1551,7 +1551,7 @@ void VM_HeapDumper::do_load_class(Klass* k) {
// writes a HPROF_GC_CLASS_DUMP record for the given class
void VM_HeapDumper::do_class_dump(Klass* k) {
if (k->oop_is_instance()) {
if (k->is_instance_klass()) {
DumperSupport::dump_class_and_array_classes(writer(), k);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -57,13 +57,13 @@ class ServiceUtil : public AllStatic {
if (k->is_klass()) {
// if it's a class for an object, an object array, or
// primitive (type) array then it's visible.
if (k->oop_is_instance()) {
if (k->is_instance_klass()) {
return true;
}
if (k->oop_is_objArray()) {
if (k->is_objArray_klass()) {
return true;
}
if (k->oop_is_typeArray()) {
if (k->is_typeArray_klass()) {
return true;
}
}