Merge
This commit is contained in:
commit
ddec2a3aed
@ -374,7 +374,7 @@ JRT_END
|
||||
|
||||
JRT_ENTRY(void, Runtime1::throw_array_store_exception(JavaThread* thread, oopDesc* obj))
|
||||
ResourceMark rm(thread);
|
||||
const char* klass_name = Klass::cast(obj->klass())->external_name();
|
||||
const char* klass_name = obj->klass()->external_name();
|
||||
SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_ArrayStoreException(), klass_name);
|
||||
JRT_END
|
||||
|
||||
@ -631,7 +631,7 @@ JRT_ENTRY(void, Runtime1::throw_class_cast_exception(JavaThread* thread, oopDesc
|
||||
NOT_PRODUCT(_throw_class_cast_exception_count++;)
|
||||
ResourceMark rm(thread);
|
||||
char* message = SharedRuntime::generate_class_cast_message(
|
||||
thread, Klass::cast(object->klass())->external_name());
|
||||
thread, object->klass()->external_name());
|
||||
SharedRuntime::throw_and_post_jvmti_exception(
|
||||
thread, vmSymbols::java_lang_ClassCastException(), message);
|
||||
JRT_END
|
||||
@ -876,7 +876,7 @@ JRT_ENTRY(void, Runtime1::patch_code(JavaThread* thread, Runtime1::StubID stub_i
|
||||
case Bytecodes::_anewarray:
|
||||
{ Bytecode_anewarray anew(caller_method(), caller_method->bcp_from(bci));
|
||||
Klass* ek = caller_method->constants()->klass_at(anew.index(), CHECK);
|
||||
k = Klass::cast(ek)->array_klass(CHECK);
|
||||
k = ek->array_klass(CHECK);
|
||||
}
|
||||
break;
|
||||
case Bytecodes::_ldc:
|
||||
@ -1236,7 +1236,7 @@ template <class T> int obj_arraycopy_work(oopDesc* src, T* src_addr,
|
||||
} else {
|
||||
Klass* bound = ObjArrayKlass::cast(dst->klass())->element_klass();
|
||||
Klass* stype = ObjArrayKlass::cast(src->klass())->element_klass();
|
||||
if (stype == bound || Klass::cast(stype)->is_subtype_of(bound)) {
|
||||
if (stype == bound || stype->is_subtype_of(bound)) {
|
||||
// Elements are guaranteed to be subtypes, so no check necessary
|
||||
bs->write_ref_array_pre(dst_addr, length);
|
||||
Copy::conjoint_oops_atomic(src_addr, dst_addr, length);
|
||||
|
@ -427,7 +427,7 @@ ciKlass* ciEnv::get_klass_by_name_impl(ciKlass* accessing_klass,
|
||||
for (int i = cpool->length() - 1; i >= 1; i--) {
|
||||
if (cpool->tag_at(i).is_klass()) {
|
||||
Klass* kls = cpool->resolved_klass_at(i);
|
||||
if (Klass::cast(kls)->name() == sym) {
|
||||
if (kls->name() == sym) {
|
||||
found_klass = KlassHandle(THREAD, kls);
|
||||
break;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ ciType::ciType(BasicType basic_type) : ciMetadata() {
|
||||
}
|
||||
|
||||
ciType::ciType(KlassHandle k) : ciMetadata(k()) {
|
||||
_basic_type = Klass::cast(k())->oop_is_array() ? T_ARRAY : T_OBJECT;
|
||||
_basic_type = k()->oop_is_array() ? T_ARRAY : T_OBJECT;
|
||||
}
|
||||
|
||||
|
||||
|
@ -824,7 +824,7 @@ Array<Klass*>* ClassFileParser::parse_interfaces(constantPoolHandle cp,
|
||||
interf = KlassHandle(THREAD, k);
|
||||
}
|
||||
|
||||
if (!Klass::cast(interf())->is_interface()) {
|
||||
if (!interf()->is_interface()) {
|
||||
THROW_MSG_(vmSymbols::java_lang_IncompatibleClassChangeError(), "Implementing class", NULL);
|
||||
}
|
||||
if (InstanceKlass::cast(interf())->has_default_methods()) {
|
||||
@ -3831,7 +3831,7 @@ instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name,
|
||||
if (TraceClassResolution) {
|
||||
ResourceMark rm;
|
||||
// print out the superclass.
|
||||
const char * from = Klass::cast(this_klass())->external_name();
|
||||
const char * from = this_klass()->external_name();
|
||||
if (this_klass->java_super() != NULL) {
|
||||
tty->print("RESOLVE %s %s (super)\n", from, InstanceKlass::cast(this_klass->java_super())->external_name());
|
||||
}
|
||||
@ -3982,13 +3982,13 @@ void ClassFileParser::set_precomputed_flags(instanceKlassHandle k) {
|
||||
// java.lang.Object has empty default constructor
|
||||
k->set_has_vanilla_constructor();
|
||||
} else {
|
||||
if (Klass::cast(super)->has_vanilla_constructor() &&
|
||||
if (super->has_vanilla_constructor() &&
|
||||
_has_vanilla_constructor) {
|
||||
k->set_has_vanilla_constructor();
|
||||
}
|
||||
#ifdef ASSERT
|
||||
bool v = false;
|
||||
if (Klass::cast(super)->has_vanilla_constructor()) {
|
||||
if (super->has_vanilla_constructor()) {
|
||||
Method* constructor = k->find_method(vmSymbols::object_initializer_name(
|
||||
), vmSymbols::void_method_signature());
|
||||
if (constructor != NULL && constructor->is_vanilla_constructor()) {
|
||||
@ -4130,7 +4130,7 @@ void ClassFileParser::check_super_interface_access(instanceKlassHandle this_klas
|
||||
int lng = local_interfaces->length();
|
||||
for (int i = lng - 1; i >= 0; i--) {
|
||||
Klass* k = local_interfaces->at(i);
|
||||
assert (k != NULL && Klass::cast(k)->is_interface(), "invalid interface");
|
||||
assert (k != NULL && k->is_interface(), "invalid interface");
|
||||
if (!Reflection::verify_class_access(this_klass(), k, false)) {
|
||||
ResourceMark rm(THREAD);
|
||||
Exceptions::fthrow(
|
||||
|
@ -346,7 +346,7 @@ void Dictionary::add_klass(Symbol* class_name, ClassLoaderData* loader_data,
|
||||
KlassHandle obj) {
|
||||
assert_locked_or_safepoint(SystemDictionary_lock);
|
||||
assert(obj() != NULL, "adding NULL obj");
|
||||
assert(Klass::cast(obj())->name() == class_name, "sanity check on name");
|
||||
assert(obj()->name() == class_name, "sanity check on name");
|
||||
|
||||
unsigned int hash = compute_hash(class_name, loader_data);
|
||||
int index = hash_to_index(hash);
|
||||
@ -553,7 +553,7 @@ void Dictionary::print() {
|
||||
bool is_defining_class =
|
||||
(loader_data == InstanceKlass::cast(e)->class_loader_data());
|
||||
tty->print("%s%s", is_defining_class ? " " : "^",
|
||||
Klass::cast(e)->external_name());
|
||||
e->external_name());
|
||||
|
||||
tty->print(", loader ");
|
||||
loader_data->print_value();
|
||||
@ -575,7 +575,7 @@ void Dictionary::verify() {
|
||||
probe = probe->next()) {
|
||||
Klass* e = probe->klass();
|
||||
ClassLoaderData* loader_data = probe->loader_data();
|
||||
guarantee(Klass::cast(e)->oop_is_instance(),
|
||||
guarantee(e->oop_is_instance(),
|
||||
"Verify of system dictionary failed");
|
||||
// class loader must be present; a null class loader is the
|
||||
// boostrap loader
|
||||
|
@ -561,7 +561,7 @@ oop java_lang_Class::create_mirror(KlassHandle k, TRAPS) {
|
||||
assert(k->oop_is_objArray(), "Must be");
|
||||
Klass* element_klass = ObjArrayKlass::cast(k())->element_klass();
|
||||
assert(element_klass != NULL, "Must have an element klass");
|
||||
comp_mirror = Klass::cast(element_klass)->java_mirror();
|
||||
comp_mirror = element_klass->java_mirror();
|
||||
}
|
||||
assert(comp_mirror.not_null(), "must have a mirror");
|
||||
|
||||
@ -644,8 +644,8 @@ 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 = Klass::cast(k)->oop_is_instance();
|
||||
name = Klass::cast(k)->name();
|
||||
is_instance = k->oop_is_instance();
|
||||
name = k->name();
|
||||
}
|
||||
if (name == NULL) {
|
||||
st->print("<null>");
|
||||
@ -667,12 +667,12 @@ 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 (!Klass::cast(k)->oop_is_instance()) {
|
||||
name = Klass::cast(k)->name();
|
||||
if (!k->oop_is_instance()) {
|
||||
name = k->name();
|
||||
name->increment_refcount();
|
||||
} else {
|
||||
ResourceMark rm;
|
||||
const char* sigstr = Klass::cast(k)->signature_name();
|
||||
const char* sigstr = k->signature_name();
|
||||
int siglen = (int) strlen(sigstr);
|
||||
if (!intern_if_not_found) {
|
||||
name = SymbolTable::probe(sigstr, siglen);
|
||||
@ -687,13 +687,13 @@ Symbol* java_lang_Class::as_signature(oop java_class, bool intern_if_not_found,
|
||||
|
||||
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() && Klass::cast(k)->oop_is_array(), "should be array klass");
|
||||
assert(k == NULL || k->is_klass() && k->oop_is_array(), "should be array klass");
|
||||
return k;
|
||||
}
|
||||
|
||||
|
||||
void java_lang_Class::set_array_klass(oop java_class, Klass* klass) {
|
||||
assert(klass->is_klass() && Klass::cast(klass)->oop_is_array(), "should be array klass");
|
||||
assert(klass->is_klass() && klass->oop_is_array(), "should be array klass");
|
||||
java_class->metadata_field_put(_array_klass_offset, klass);
|
||||
}
|
||||
|
||||
|
@ -914,7 +914,7 @@ class java_lang_invoke_MethodHandle: AllStatic {
|
||||
|
||||
// Testers
|
||||
static bool is_subclass(Klass* klass) {
|
||||
return Klass::cast(klass)->is_subclass_of(SystemDictionary::MethodHandle_klass());
|
||||
return klass->is_subclass_of(SystemDictionary::MethodHandle_klass());
|
||||
}
|
||||
static bool is_instance(oop obj) {
|
||||
return obj != NULL && is_subclass(obj->klass());
|
||||
@ -944,7 +944,7 @@ class java_lang_invoke_LambdaForm: AllStatic {
|
||||
// Testers
|
||||
static bool is_subclass(Klass* klass) {
|
||||
return SystemDictionary::LambdaForm_klass() != NULL &&
|
||||
Klass::cast(klass)->is_subclass_of(SystemDictionary::LambdaForm_klass());
|
||||
klass->is_subclass_of(SystemDictionary::LambdaForm_klass());
|
||||
}
|
||||
static bool is_instance(oop obj) {
|
||||
return obj != NULL && is_subclass(obj->klass());
|
||||
@ -1006,7 +1006,7 @@ class java_lang_invoke_MemberName: AllStatic {
|
||||
|
||||
// Testers
|
||||
static bool is_subclass(Klass* klass) {
|
||||
return Klass::cast(klass)->is_subclass_of(SystemDictionary::MemberName_klass());
|
||||
return klass->is_subclass_of(SystemDictionary::MemberName_klass());
|
||||
}
|
||||
static bool is_instance(oop obj) {
|
||||
return obj != NULL && is_subclass(obj->klass());
|
||||
@ -1092,7 +1092,7 @@ public:
|
||||
|
||||
// Testers
|
||||
static bool is_subclass(Klass* klass) {
|
||||
return Klass::cast(klass)->is_subclass_of(SystemDictionary::CallSite_klass());
|
||||
return klass->is_subclass_of(SystemDictionary::CallSite_klass());
|
||||
}
|
||||
static bool is_instance(oop obj) {
|
||||
return obj != NULL && is_subclass(obj->klass());
|
||||
@ -1162,7 +1162,7 @@ class java_lang_ClassLoader : AllStatic {
|
||||
|
||||
// Testers
|
||||
static bool is_subclass(Klass* klass) {
|
||||
return Klass::cast(klass)->is_subclass_of(SystemDictionary::ClassLoader_klass());
|
||||
return klass->is_subclass_of(SystemDictionary::ClassLoader_klass());
|
||||
}
|
||||
static bool is_instance(oop obj) {
|
||||
return obj != NULL && is_subclass(obj->klass());
|
||||
|
@ -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 (Klass::cast(p->klass())->oop_is_instance() && !InstanceKlass::cast(p->klass())->is_loaded()) {
|
||||
if (p->klass()->oop_is_instance() && !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;
|
||||
|
@ -45,7 +45,7 @@ PlaceholderEntry* PlaceholderTable::new_entry(int hash, Symbol* name,
|
||||
entry->set_loadInstanceThreadQ(NULL);
|
||||
entry->set_defineThreadQ(NULL);
|
||||
entry->set_definer(NULL);
|
||||
entry->set_instanceKlass(NULL);
|
||||
entry->set_instance_klass(NULL);
|
||||
return entry;
|
||||
}
|
||||
|
||||
@ -188,7 +188,7 @@ void PlaceholderTable::classes_do(KlassClosure* f) {
|
||||
void PlaceholderEntry::classes_do(KlassClosure* closure) {
|
||||
assert(klassname() != NULL, "should have a non-null klass");
|
||||
if (_instanceKlass != NULL) {
|
||||
closure->do_klass(InstanceKlass());
|
||||
closure->do_klass(instance_klass());
|
||||
}
|
||||
}
|
||||
|
||||
@ -220,9 +220,9 @@ void PlaceholderEntry::print() const {
|
||||
tty->print(", definer ");
|
||||
definer()->print_value();
|
||||
}
|
||||
if (InstanceKlass() != NULL) {
|
||||
if (instance_klass() != NULL) {
|
||||
tty->print(", InstanceKlass ");
|
||||
InstanceKlass()->print_value();
|
||||
instance_klass()->print_value();
|
||||
}
|
||||
tty->print("\n");
|
||||
tty->print("loadInstanceThreadQ threads:");
|
||||
@ -241,9 +241,9 @@ void PlaceholderEntry::verify() const {
|
||||
guarantee(loader_data() != NULL, "Must have been setup.");
|
||||
guarantee(loader_data()->class_loader() == NULL || loader_data()->class_loader()->is_instance(),
|
||||
"checking type of _loader");
|
||||
guarantee(InstanceKlass() == NULL
|
||||
|| Klass::cast(InstanceKlass())->oop_is_instance(),
|
||||
"checking type of InstanceKlass result");
|
||||
guarantee(instance_klass() == NULL
|
||||
|| instance_klass()->oop_is_instance(),
|
||||
"checking type of instance_klass result");
|
||||
}
|
||||
|
||||
void PlaceholderTable::verify() {
|
||||
|
@ -191,8 +191,8 @@ class PlaceholderEntry : public HashtableEntry<Symbol*, mtClass> {
|
||||
Thread* definer() const {return _definer; }
|
||||
void set_definer(Thread* definer) { _definer = definer; }
|
||||
|
||||
Klass* InstanceKlass() const {return _instanceKlass; }
|
||||
void set_instanceKlass(Klass* InstanceKlass) { _instanceKlass = InstanceKlass; }
|
||||
Klass* instance_klass() const {return _instanceKlass; }
|
||||
void set_instance_klass(Klass* ik) { _instanceKlass = ik; }
|
||||
|
||||
SeenThread* superThreadQ() const { return _superThreadQ; }
|
||||
void set_superThreadQ(SeenThread* SeenThread) { _superThreadQ = SeenThread; }
|
||||
|
@ -262,19 +262,14 @@ public:
|
||||
// The string table
|
||||
static StringTable* the_table() { return _the_table; }
|
||||
|
||||
// Size of one bucket in the string table. Used when checking for rollover.
|
||||
static uint bucket_size() { return sizeof(HashtableBucket<mtSymbol>); }
|
||||
|
||||
static void create_table() {
|
||||
assert(_the_table == NULL, "One string table allowed.");
|
||||
_the_table = new StringTable();
|
||||
}
|
||||
|
||||
static void create_table(HashtableBucket<mtSymbol>* t, int length,
|
||||
int number_of_entries) {
|
||||
assert(_the_table == NULL, "One string table allowed.");
|
||||
assert((size_t)length == StringTableSize * sizeof(HashtableBucket<mtSymbol>),
|
||||
"bad shared string size.");
|
||||
_the_table = new StringTable(t, number_of_entries);
|
||||
}
|
||||
|
||||
// GC support
|
||||
// Delete pointers to otherwise-unreachable objects.
|
||||
static void unlink(BoolObjectClosure* cl);
|
||||
|
@ -240,7 +240,7 @@ Klass* SystemDictionary::resolve_array_class_or_null(Symbol* class_name,
|
||||
protection_domain,
|
||||
CHECK_NULL);
|
||||
if (k != NULL) {
|
||||
k = Klass::cast(k)->array_klass(fd.dimension(), CHECK_NULL);
|
||||
k = k->array_klass(fd.dimension(), CHECK_NULL);
|
||||
}
|
||||
} else {
|
||||
k = Universe::typeArrayKlassObj(t);
|
||||
@ -328,8 +328,8 @@ Klass* SystemDictionary::resolve_super_or_fail(Symbol* child_name,
|
||||
if ((childk != NULL ) && (is_superclass) &&
|
||||
((quicksuperk = InstanceKlass::cast(childk)->super()) != NULL) &&
|
||||
|
||||
((Klass::cast(quicksuperk)->name() == class_name) &&
|
||||
(Klass::cast(quicksuperk)->class_loader() == class_loader()))) {
|
||||
((quicksuperk->name() == class_name) &&
|
||||
(quicksuperk->class_loader() == class_loader()))) {
|
||||
return quicksuperk;
|
||||
} else {
|
||||
PlaceholderEntry* probe = placeholders()->get_entry(p_index, p_hash, child_name, loader_data);
|
||||
@ -928,7 +928,7 @@ Klass* SystemDictionary::find_instance_or_array_klass(Symbol* class_name,
|
||||
k = SystemDictionary::find(fd.object_key(), class_loader, protection_domain, THREAD);
|
||||
}
|
||||
if (k != NULL) {
|
||||
k = Klass::cast(k)->array_klass_or_null(fd.dimension());
|
||||
k = k->array_klass_or_null(fd.dimension());
|
||||
}
|
||||
} else {
|
||||
k = find(class_name, class_loader, protection_domain, THREAD);
|
||||
@ -1537,7 +1537,7 @@ instanceKlassHandle SystemDictionary::find_or_define_instance_class(Symbol* clas
|
||||
// Only special cases allow parallel defines and can use other thread's results
|
||||
// Other cases fall through, and may run into duplicate defines
|
||||
// caught by finding an entry in the SystemDictionary
|
||||
if ((UnsyncloadClass || is_parallelDefine(class_loader)) && (probe->InstanceKlass() != NULL)) {
|
||||
if ((UnsyncloadClass || is_parallelDefine(class_loader)) && (probe->instance_klass() != NULL)) {
|
||||
probe->remove_seen_thread(THREAD, PlaceholderTable::DEFINE_CLASS);
|
||||
placeholders()->find_and_remove(p_index, p_hash, name_h, loader_data, THREAD);
|
||||
SystemDictionary_lock->notify_all();
|
||||
@ -1545,7 +1545,7 @@ instanceKlassHandle SystemDictionary::find_or_define_instance_class(Symbol* clas
|
||||
Klass* check = find_class(d_index, d_hash, name_h, loader_data);
|
||||
assert(check != NULL, "definer missed recording success");
|
||||
#endif
|
||||
return(instanceKlassHandle(THREAD, probe->InstanceKlass()));
|
||||
return(instanceKlassHandle(THREAD, probe->instance_klass()));
|
||||
} else {
|
||||
// This thread will define the class (even if earlier thread tried and had an error)
|
||||
probe->set_definer(THREAD);
|
||||
@ -1566,7 +1566,7 @@ instanceKlassHandle SystemDictionary::find_or_define_instance_class(Symbol* clas
|
||||
linkage_exception = Handle(THREAD,PENDING_EXCEPTION);
|
||||
CLEAR_PENDING_EXCEPTION;
|
||||
} else {
|
||||
probe->set_instanceKlass(k());
|
||||
probe->set_instance_klass(k());
|
||||
}
|
||||
probe->set_definer(NULL);
|
||||
probe->remove_seen_thread(THREAD, PlaceholderTable::DEFINE_CLASS);
|
||||
@ -2149,7 +2149,7 @@ Klass* SystemDictionary::find_constrained_instance_or_array_klass(
|
||||
}
|
||||
// If element class already loaded, allocate array klass
|
||||
if (klass != NULL) {
|
||||
klass = Klass::cast(klass)->array_klass_or_null(fd.dimension());
|
||||
klass = klass->array_klass_or_null(fd.dimension());
|
||||
}
|
||||
} else {
|
||||
MutexLocker mu(SystemDictionary_lock, THREAD);
|
||||
@ -2466,9 +2466,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 (Klass::cast(sel_klass)->oop_is_objArray())
|
||||
if (sel_klass->oop_is_objArray())
|
||||
sel_klass = ObjArrayKlass::cast(sel_klass)->bottom_klass();
|
||||
if (Klass::cast(sel_klass)->oop_is_instance()) {
|
||||
if (sel_klass->oop_is_instance()) {
|
||||
KlassHandle sel_kh(THREAD, sel_klass);
|
||||
LinkResolver::check_klass_accessability(accessing_klass, sel_kh, CHECK_(empty));
|
||||
}
|
||||
|
@ -552,7 +552,7 @@ void Dependencies::print_dependency(DepType dept, int nargs, DepArgument args[],
|
||||
}
|
||||
tty->print(" %s = %s", what, (put_star? "*": ""));
|
||||
if (arg.is_klass())
|
||||
tty->print("%s", Klass::cast((Klass*)arg.metadata_value())->external_name());
|
||||
tty->print("%s", ((Klass*)arg.metadata_value())->external_name());
|
||||
else if (arg.is_method())
|
||||
((Method*)arg.metadata_value())->print_value();
|
||||
else
|
||||
@ -563,7 +563,7 @@ void Dependencies::print_dependency(DepType dept, int nargs, DepArgument args[],
|
||||
bool put_star = !Dependencies::is_concrete_klass(witness);
|
||||
tty->print_cr(" witness = %s%s",
|
||||
(put_star? "*": ""),
|
||||
Klass::cast(witness)->external_name());
|
||||
witness->external_name());
|
||||
}
|
||||
}
|
||||
|
||||
@ -809,7 +809,7 @@ class ClassHierarchyWalker {
|
||||
if (!(m->is_public() || m->is_protected()))
|
||||
// The override story is complex when packages get involved.
|
||||
return true; // Must punt the assertion to true.
|
||||
Klass* k = Klass::cast(ctxk);
|
||||
Klass* k = ctxk;
|
||||
Method* lm = k->lookup_method(m->name(), m->signature());
|
||||
if (lm == NULL && k->oop_is_instance()) {
|
||||
// It might be an abstract interface method, devoid of mirandas.
|
||||
@ -836,7 +836,7 @@ class ClassHierarchyWalker {
|
||||
}
|
||||
ResourceMark rm;
|
||||
tty->print_cr("Dependency method not found in the associated context:");
|
||||
tty->print_cr(" context = %s", Klass::cast(ctxk)->external_name());
|
||||
tty->print_cr(" context = %s", ctxk->external_name());
|
||||
tty->print( " method = "); m->print_short_name(tty); tty->cr();
|
||||
if (lm != NULL) {
|
||||
tty->print( " found = "); lm->print_short_name(tty); tty->cr();
|
||||
@ -1011,7 +1011,7 @@ Klass* ClassHierarchyWalker::find_witness_in(KlassDepChange& changes,
|
||||
for (int i = 0; i < num_participants(); i++) {
|
||||
Klass* part = participant(i);
|
||||
if (part == NULL) continue;
|
||||
assert(changes.involves_context(part) == Klass::cast(new_type)->is_subtype_of(part),
|
||||
assert(changes.involves_context(part) == new_type->is_subtype_of(part),
|
||||
"correct marking of participants, b/c new_type is unique");
|
||||
if (changes.involves_context(part)) {
|
||||
// new guy is protected from this check by previous participant
|
||||
@ -1147,7 +1147,7 @@ Klass* ClassHierarchyWalker::find_witness_anywhere(Klass* context_type,
|
||||
|
||||
|
||||
bool Dependencies::is_concrete_klass(Klass* k) {
|
||||
if (Klass::cast(k)->is_abstract()) return false;
|
||||
if (k->is_abstract()) return false;
|
||||
// %%% We could treat classes which are concrete but
|
||||
// have not yet been instantiated as virtually abstract.
|
||||
// This would require a deoptimization barrier on first instantiation.
|
||||
@ -1706,12 +1706,12 @@ KlassDepChange::~KlassDepChange() {
|
||||
}
|
||||
|
||||
bool KlassDepChange::involves_context(Klass* k) {
|
||||
if (k == NULL || !Klass::cast(k)->oop_is_instance()) {
|
||||
if (k == NULL || !k->oop_is_instance()) {
|
||||
return false;
|
||||
}
|
||||
InstanceKlass* ik = InstanceKlass::cast(k);
|
||||
bool is_contained = ik->is_marked_dependent();
|
||||
assert(is_contained == Klass::cast(new_type())->is_subtype_of(k),
|
||||
assert(is_contained == new_type()->is_subtype_of(k),
|
||||
"correct marking of potential context types");
|
||||
return is_contained;
|
||||
}
|
||||
|
@ -2568,9 +2568,8 @@ void nmethod::print_dependencies() {
|
||||
deps.print_dependency();
|
||||
Klass* ctxk = deps.context_type();
|
||||
if (ctxk != NULL) {
|
||||
Klass* k = Klass::cast(ctxk);
|
||||
if (k->oop_is_instance() && ((InstanceKlass*)k)->is_dependent_nmethod(this)) {
|
||||
tty->print_cr(" [nmethod<=klass]%s", k->external_name());
|
||||
if (ctxk->oop_is_instance() && ((InstanceKlass*)ctxk)->is_dependent_nmethod(this)) {
|
||||
tty->print_cr(" [nmethod<=klass]%s", ctxk->external_name());
|
||||
}
|
||||
}
|
||||
deps.log_dependency(); // put it into the xml log also
|
||||
|
@ -353,7 +353,7 @@ void decode_env::print_address(address adr) {
|
||||
obj->print_value_on(st);
|
||||
if (st->count() == c) {
|
||||
// No output. (Can happen in product builds.)
|
||||
st->print("(a %s)", Klass::cast(obj->klass())->external_name());
|
||||
st->print("(a %s)", obj->klass()->external_name());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -2043,8 +2043,8 @@ run:
|
||||
if (objKlassOop != klassOf &&
|
||||
!objKlassOop->is_subtype_of(klassOf)) {
|
||||
ResourceMark rm(THREAD);
|
||||
const char* objName = Klass::cast(objKlassOop)->external_name();
|
||||
const char* klassName = Klass::cast(klassOf)->external_name();
|
||||
const char* objName = objKlassOop->external_name();
|
||||
const char* klassName = klassOf->external_name();
|
||||
char* message = SharedRuntime::generate_class_cast_message(
|
||||
objName, klassName);
|
||||
VM_JAVA_ERROR(vmSymbols::java_lang_ClassCastException(), message);
|
||||
|
@ -312,7 +312,7 @@ IRT_END
|
||||
|
||||
IRT_ENTRY(void, InterpreterRuntime::create_klass_exception(JavaThread* thread, char* name, oopDesc* obj))
|
||||
ResourceMark rm(thread);
|
||||
const char* klass_name = Klass::cast(obj->klass())->external_name();
|
||||
const char* klass_name = obj->klass()->external_name();
|
||||
// lookup exception klass
|
||||
TempNewSymbol s = SymbolTable::new_symbol(name, CHECK);
|
||||
if (ProfileTraps) {
|
||||
@ -341,7 +341,7 @@ IRT_ENTRY(void, InterpreterRuntime::throw_ClassCastException(
|
||||
|
||||
ResourceMark rm(thread);
|
||||
char* message = SharedRuntime::generate_class_cast_message(
|
||||
thread, Klass::cast(obj->klass())->external_name());
|
||||
thread, obj->klass()->external_name());
|
||||
|
||||
if (ProfileTraps) {
|
||||
note_trap(thread, Deoptimization::Reason_class_check, CHECK);
|
||||
|
@ -203,7 +203,7 @@ void LinkResolver::lookup_instance_method_in_klasses(methodHandle& result, Klass
|
||||
Method* result_oop = klass->uncached_lookup_method(name, signature);
|
||||
result = methodHandle(THREAD, result_oop);
|
||||
while (!result.is_null() && result->is_static()) {
|
||||
klass = KlassHandle(THREAD, Klass::cast(result->method_holder())->super());
|
||||
klass = KlassHandle(THREAD, result->method_holder()->super());
|
||||
result = methodHandle(THREAD, klass->uncached_lookup_method(name, signature));
|
||||
}
|
||||
}
|
||||
@ -428,7 +428,7 @@ void LinkResolver::resolve_method(methodHandle& resolved_method, KlassHandle res
|
||||
// 3. method lookup failed
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_MSG_CAUSE(vmSymbols::java_lang_NoSuchMethodError(),
|
||||
Method::name_and_sig_as_C_string(Klass::cast(resolved_klass()),
|
||||
Method::name_and_sig_as_C_string(resolved_klass(),
|
||||
method_name,
|
||||
method_signature),
|
||||
nested_exception);
|
||||
@ -448,7 +448,7 @@ void LinkResolver::resolve_method(methodHandle& resolved_method, KlassHandle res
|
||||
if (resolved_method->is_abstract() && !resolved_klass->is_abstract()) {
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(),
|
||||
Method::name_and_sig_as_C_string(Klass::cast(resolved_klass()),
|
||||
Method::name_and_sig_as_C_string(resolved_klass(),
|
||||
method_name,
|
||||
method_signature));
|
||||
}
|
||||
@ -477,7 +477,7 @@ void LinkResolver::resolve_method(methodHandle& resolved_method, KlassHandle res
|
||||
" \"%s\" the class loader (instance of %s) of the current class, %s,"
|
||||
" and the class loader (instance of %s) for resolved class, %s, have"
|
||||
" different Class objects for the type %s used in the signature";
|
||||
char* sig = Method::name_and_sig_as_C_string(Klass::cast(resolved_klass()),method_name,method_signature);
|
||||
char* sig = Method::name_and_sig_as_C_string(resolved_klass(),method_name,method_signature);
|
||||
const char* loader1 = SystemDictionary::loader_name(loader());
|
||||
char* current = InstanceKlass::cast(current_klass())->name()->as_C_string();
|
||||
const char* loader2 = SystemDictionary::loader_name(class_loader());
|
||||
@ -505,7 +505,7 @@ void LinkResolver::resolve_interface_method(methodHandle& resolved_method,
|
||||
if (!resolved_klass->is_interface()) {
|
||||
ResourceMark rm(THREAD);
|
||||
char buf[200];
|
||||
jio_snprintf(buf, sizeof(buf), "Found class %s, but interface was expected", Klass::cast(resolved_klass())->external_name());
|
||||
jio_snprintf(buf, sizeof(buf), "Found class %s, but interface was expected", resolved_klass()->external_name());
|
||||
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
|
||||
}
|
||||
|
||||
@ -519,7 +519,7 @@ void LinkResolver::resolve_interface_method(methodHandle& resolved_method,
|
||||
// no method found
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_MSG(vmSymbols::java_lang_NoSuchMethodError(),
|
||||
Method::name_and_sig_as_C_string(Klass::cast(resolved_klass()),
|
||||
Method::name_and_sig_as_C_string(resolved_klass(),
|
||||
method_name,
|
||||
method_signature));
|
||||
}
|
||||
@ -540,7 +540,7 @@ void LinkResolver::resolve_interface_method(methodHandle& resolved_method,
|
||||
"current class, %s, and the class loader (instance of %s) for "
|
||||
"resolved class, %s, have different Class objects for the type %s "
|
||||
"used in the signature";
|
||||
char* sig = Method::name_and_sig_as_C_string(Klass::cast(resolved_klass()),method_name,method_signature);
|
||||
char* sig = Method::name_and_sig_as_C_string(resolved_klass(),method_name,method_signature);
|
||||
const char* loader1 = SystemDictionary::loader_name(loader());
|
||||
char* current = InstanceKlass::cast(current_klass())->name()->as_C_string();
|
||||
const char* loader2 = SystemDictionary::loader_name(class_loader());
|
||||
@ -627,7 +627,7 @@ void LinkResolver::resolve_field(FieldAccessInfo& result, constantPoolHandle poo
|
||||
if (is_static != fd.is_static()) {
|
||||
ResourceMark rm(THREAD);
|
||||
char msg[200];
|
||||
jio_snprintf(msg, sizeof(msg), "Expected %s field %s.%s", is_static ? "static" : "non-static", Klass::cast(resolved_klass())->external_name(), fd.name()->as_C_string());
|
||||
jio_snprintf(msg, sizeof(msg), "Expected %s field %s.%s", is_static ? "static" : "non-static", resolved_klass()->external_name(), fd.name()->as_C_string());
|
||||
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), msg);
|
||||
}
|
||||
|
||||
@ -701,7 +701,7 @@ void LinkResolver::resolve_static_call(CallInfo& result, KlassHandle& resolved_k
|
||||
bool check_access, bool initialize_class, TRAPS) {
|
||||
methodHandle resolved_method;
|
||||
linktime_resolve_static_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, check_access, CHECK);
|
||||
resolved_klass = KlassHandle(THREAD, Klass::cast(resolved_method->method_holder()));
|
||||
resolved_klass = KlassHandle(THREAD, resolved_method->method_holder());
|
||||
|
||||
// Initialize klass (this should only happen if everything is ok)
|
||||
if (initialize_class && resolved_klass->should_be_initialized()) {
|
||||
@ -725,7 +725,7 @@ void LinkResolver::linktime_resolve_static_method(methodHandle& resolved_method,
|
||||
if (!resolved_method->is_static()) {
|
||||
ResourceMark rm(THREAD);
|
||||
char buf[200];
|
||||
jio_snprintf(buf, sizeof(buf), "Expected static method %s", Method::name_and_sig_as_C_string(Klass::cast(resolved_klass()),
|
||||
jio_snprintf(buf, sizeof(buf), "Expected static method %s", Method::name_and_sig_as_C_string(resolved_klass(),
|
||||
resolved_method->name(),
|
||||
resolved_method->signature()));
|
||||
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
|
||||
@ -789,7 +789,7 @@ void LinkResolver::linktime_resolve_special_method(methodHandle& resolved_method
|
||||
char buf[200];
|
||||
jio_snprintf(buf, sizeof(buf),
|
||||
"Expecting non-static method %s",
|
||||
Method::name_and_sig_as_C_string(Klass::cast(resolved_klass()),
|
||||
Method::name_and_sig_as_C_string(resolved_klass(),
|
||||
resolved_method->name(),
|
||||
resolved_method->signature()));
|
||||
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
|
||||
@ -829,7 +829,7 @@ void LinkResolver::runtime_resolve_special_method(CallInfo& result, methodHandle
|
||||
if (sel_method.is_null()) {
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(),
|
||||
Method::name_and_sig_as_C_string(Klass::cast(resolved_klass()),
|
||||
Method::name_and_sig_as_C_string(resolved_klass(),
|
||||
resolved_method->name(),
|
||||
resolved_method->signature()));
|
||||
}
|
||||
@ -840,7 +840,7 @@ void LinkResolver::runtime_resolve_special_method(CallInfo& result, methodHandle
|
||||
if (sel_method->is_static()) {
|
||||
ResourceMark rm(THREAD);
|
||||
char buf[200];
|
||||
jio_snprintf(buf, sizeof(buf), "Expecting non-static method %s", Method::name_and_sig_as_C_string(Klass::cast(resolved_klass()),
|
||||
jio_snprintf(buf, sizeof(buf), "Expecting non-static method %s", Method::name_and_sig_as_C_string(resolved_klass(),
|
||||
resolved_method->name(),
|
||||
resolved_method->signature()));
|
||||
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
|
||||
@ -850,7 +850,7 @@ void LinkResolver::runtime_resolve_special_method(CallInfo& result, methodHandle
|
||||
if (sel_method->is_abstract()) {
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(),
|
||||
Method::name_and_sig_as_C_string(Klass::cast(resolved_klass()),
|
||||
Method::name_and_sig_as_C_string(resolved_klass(),
|
||||
sel_method->name(),
|
||||
sel_method->signature()));
|
||||
}
|
||||
@ -881,7 +881,7 @@ void LinkResolver::linktime_resolve_virtual_method(methodHandle &resolved_method
|
||||
if (resolved_method->is_static()) {
|
||||
ResourceMark rm(THREAD);
|
||||
char buf[200];
|
||||
jio_snprintf(buf, sizeof(buf), "Expecting non-static method %s", Method::name_and_sig_as_C_string(Klass::cast(resolved_klass()),
|
||||
jio_snprintf(buf, sizeof(buf), "Expecting non-static method %s", Method::name_and_sig_as_C_string(resolved_klass(),
|
||||
resolved_method->name(),
|
||||
resolved_method->signature()));
|
||||
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
|
||||
@ -950,7 +950,7 @@ void LinkResolver::runtime_resolve_virtual_method(CallInfo& result,
|
||||
if (selected_method.is_null()) {
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(),
|
||||
Method::name_and_sig_as_C_string(Klass::cast(resolved_klass()),
|
||||
Method::name_and_sig_as_C_string(resolved_klass(),
|
||||
resolved_method->name(),
|
||||
resolved_method->signature()));
|
||||
}
|
||||
@ -959,7 +959,7 @@ void LinkResolver::runtime_resolve_virtual_method(CallInfo& result,
|
||||
if (check_null_and_abstract && selected_method->is_abstract()) {
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(),
|
||||
Method::name_and_sig_as_C_string(Klass::cast(resolved_klass()),
|
||||
Method::name_and_sig_as_C_string(resolved_klass(),
|
||||
selected_method->name(),
|
||||
selected_method->signature()));
|
||||
}
|
||||
@ -999,8 +999,8 @@ void LinkResolver::runtime_resolve_interface_method(CallInfo& result, methodHand
|
||||
ResourceMark rm(THREAD);
|
||||
char buf[200];
|
||||
jio_snprintf(buf, sizeof(buf), "Class %s does not implement the requested interface %s",
|
||||
(Klass::cast(recv_klass()))->external_name(),
|
||||
(Klass::cast(resolved_klass()))->external_name());
|
||||
recv_klass()->external_name(),
|
||||
resolved_klass()->external_name());
|
||||
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
|
||||
}
|
||||
// do lookup based on receiver klass
|
||||
@ -1012,7 +1012,7 @@ void LinkResolver::runtime_resolve_interface_method(CallInfo& result, methodHand
|
||||
if (sel_method.is_null()) {
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(),
|
||||
Method::name_and_sig_as_C_string(Klass::cast(recv_klass()),
|
||||
Method::name_and_sig_as_C_string(recv_klass(),
|
||||
resolved_method->name(),
|
||||
resolved_method->signature()));
|
||||
}
|
||||
@ -1020,7 +1020,7 @@ void LinkResolver::runtime_resolve_interface_method(CallInfo& result, methodHand
|
||||
if (!sel_method->is_public()) {
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_MSG(vmSymbols::java_lang_IllegalAccessError(),
|
||||
Method::name_and_sig_as_C_string(Klass::cast(recv_klass()),
|
||||
Method::name_and_sig_as_C_string(recv_klass(),
|
||||
sel_method->name(),
|
||||
sel_method->signature()));
|
||||
}
|
||||
@ -1028,7 +1028,7 @@ void LinkResolver::runtime_resolve_interface_method(CallInfo& result, methodHand
|
||||
if (check_null_and_abstract && sel_method->is_abstract()) {
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(),
|
||||
Method::name_and_sig_as_C_string(Klass::cast(recv_klass()),
|
||||
Method::name_and_sig_as_C_string(recv_klass(),
|
||||
sel_method->name(),
|
||||
sel_method->signature()));
|
||||
}
|
||||
|
@ -431,7 +431,7 @@ void VM_PopulateDumpSharedSpace::doit() {
|
||||
}
|
||||
|
||||
static void link_shared_classes(Klass* obj, TRAPS) {
|
||||
Klass* k = Klass::cast(obj);
|
||||
Klass* k = obj;
|
||||
if (k->oop_is_instance()) {
|
||||
InstanceKlass* ik = (InstanceKlass*) k;
|
||||
// Link the class to cause the bytecodes to be rewritten and the
|
||||
|
@ -346,7 +346,7 @@ void Universe::genesis(TRAPS) {
|
||||
// ---
|
||||
// New
|
||||
// Have already been initialized.
|
||||
Klass::cast(_objectArrayKlassObj)->append_to_sibling_list();
|
||||
_objectArrayKlassObj->append_to_sibling_list();
|
||||
|
||||
// Compute is_jdk version flags.
|
||||
// Only 1.3 or later has the java.lang.Shutdown class.
|
||||
|
@ -67,7 +67,7 @@ oop ArrayKlass::multi_allocate(int rank, jint* sizes, TRAPS) {
|
||||
Method* ArrayKlass::uncached_lookup_method(Symbol* name, Symbol* signature) const {
|
||||
// There are no methods in an array klass but the super class (Object) has some
|
||||
assert(super(), "super klass must be present");
|
||||
return Klass::cast(super())->uncached_lookup_method(name, signature);
|
||||
return super()->uncached_lookup_method(name, signature);
|
||||
}
|
||||
|
||||
ArrayKlass::ArrayKlass(Symbol* name) {
|
||||
|
@ -371,7 +371,7 @@ Method* ConstantPoolCacheEntry::method_if_resolved(constantPoolHandle cpool) {
|
||||
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::cast(klass)->oop_is_instance())
|
||||
if (!klass->oop_is_instance())
|
||||
klass = SystemDictionary::Object_klass();
|
||||
return InstanceKlass::cast(klass)->method_at_vtable(f2_as_index());
|
||||
}
|
||||
|
@ -727,8 +727,8 @@ void InstanceKlass::initialize_impl(instanceKlassHandle this_oop, TRAPS) {
|
||||
|
||||
// Step 7
|
||||
Klass* super_klass = this_oop->super();
|
||||
if (super_klass != NULL && !this_oop->is_interface() && Klass::cast(super_klass)->should_be_initialized()) {
|
||||
Klass::cast(super_klass)->initialize(THREAD);
|
||||
if (super_klass != NULL && !this_oop->is_interface() && super_klass->should_be_initialized()) {
|
||||
super_klass->initialize(THREAD);
|
||||
|
||||
if (HAS_PENDING_EXCEPTION) {
|
||||
Handle e(THREAD, PENDING_EXCEPTION);
|
||||
@ -924,7 +924,7 @@ GrowableArray<Klass*>* InstanceKlass::compute_secondary_supers(int num_extra_slo
|
||||
}
|
||||
|
||||
bool InstanceKlass::compute_is_subtype_of(Klass* k) {
|
||||
if (Klass::cast(k)->is_interface()) {
|
||||
if (k->is_interface()) {
|
||||
return implements_interface(k);
|
||||
} else {
|
||||
return Klass::compute_is_subtype_of(k);
|
||||
@ -933,7 +933,7 @@ bool InstanceKlass::compute_is_subtype_of(Klass* k) {
|
||||
|
||||
bool InstanceKlass::implements_interface(Klass* k) const {
|
||||
if (this == k) return true;
|
||||
assert(Klass::cast(k)->is_interface(), "should be an interface class");
|
||||
assert(k->is_interface(), "should be an interface class");
|
||||
for (int i = 0; i < transitive_interfaces()->length(); i++) {
|
||||
if (transitive_interfaces()->at(i) == k) {
|
||||
return true;
|
||||
@ -1107,7 +1107,7 @@ Klass* InstanceKlass::find_interface_field(Symbol* name, Symbol* sig, fieldDescr
|
||||
const int n = local_interfaces()->length();
|
||||
for (int i = 0; i < n; i++) {
|
||||
Klass* intf1 = local_interfaces()->at(i);
|
||||
assert(Klass::cast(intf1)->is_interface(), "just checking type");
|
||||
assert(intf1->is_interface(), "just checking type");
|
||||
// search for field in current interface
|
||||
if (InstanceKlass::cast(intf1)->find_local_field(name, sig, fd)) {
|
||||
assert(fd->is_static(), "interface field must be static");
|
||||
@ -1178,7 +1178,7 @@ bool InstanceKlass::find_field_from_offset(int offset, bool is_static, fieldDesc
|
||||
if (InstanceKlass::cast(klass)->find_local_field_from_offset(offset, is_static, fd)) {
|
||||
return true;
|
||||
}
|
||||
klass = Klass::cast(klass)->super();
|
||||
klass = klass->super();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -2366,19 +2366,19 @@ const char* InstanceKlass::signature_name() const {
|
||||
bool InstanceKlass::is_same_class_package(Klass* class2) {
|
||||
Klass* class1 = this;
|
||||
oop classloader1 = InstanceKlass::cast(class1)->class_loader();
|
||||
Symbol* classname1 = Klass::cast(class1)->name();
|
||||
Symbol* classname1 = class1->name();
|
||||
|
||||
if (Klass::cast(class2)->oop_is_objArray()) {
|
||||
if (class2->oop_is_objArray()) {
|
||||
class2 = ObjArrayKlass::cast(class2)->bottom_klass();
|
||||
}
|
||||
oop classloader2;
|
||||
if (Klass::cast(class2)->oop_is_instance()) {
|
||||
if (class2->oop_is_instance()) {
|
||||
classloader2 = InstanceKlass::cast(class2)->class_loader();
|
||||
} else {
|
||||
assert(Klass::cast(class2)->oop_is_typeArray(), "should be type array");
|
||||
assert(class2->oop_is_typeArray(), "should be type array");
|
||||
classloader2 = NULL;
|
||||
}
|
||||
Symbol* classname2 = Klass::cast(class2)->name();
|
||||
Symbol* classname2 = class2->name();
|
||||
|
||||
return InstanceKlass::is_same_class_package(classloader1, classname1,
|
||||
classloader2, classname2);
|
||||
@ -2387,7 +2387,7 @@ bool InstanceKlass::is_same_class_package(Klass* class2) {
|
||||
bool InstanceKlass::is_same_class_package(oop classloader2, Symbol* classname2) {
|
||||
Klass* class1 = this;
|
||||
oop classloader1 = InstanceKlass::cast(class1)->class_loader();
|
||||
Symbol* classname1 = Klass::cast(class1)->name();
|
||||
Symbol* classname1 = class1->name();
|
||||
|
||||
return InstanceKlass::is_same_class_package(classloader1, classname1,
|
||||
classloader2, classname2);
|
||||
@ -2478,7 +2478,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 (!Klass::cast(class2_oop)->oop_is_instance()) return false;
|
||||
if (!class2_oop->oop_is_instance()) return false;
|
||||
instanceKlassHandle class2(THREAD, class2_oop);
|
||||
|
||||
// must be in same package before we try anything else
|
||||
@ -3011,7 +3011,7 @@ void InstanceKlass::verify_on(outputStream* st) {
|
||||
if (im != NULL) {
|
||||
guarantee(is_interface(), "only interfaces should have implementor set");
|
||||
guarantee(im->is_klass(), "should be klass");
|
||||
guarantee(!Klass::cast(im)->is_interface() || im == this,
|
||||
guarantee(!im->is_interface() || im == this,
|
||||
"implementors cannot be interfaces");
|
||||
}
|
||||
|
||||
@ -3020,7 +3020,7 @@ void InstanceKlass::verify_on(outputStream* st) {
|
||||
Array<Klass*>* local_interfaces = this->local_interfaces();
|
||||
for (int j = 0; j < local_interfaces->length(); j++) {
|
||||
Klass* e = local_interfaces->at(j);
|
||||
guarantee(e->is_klass() && Klass::cast(e)->is_interface(), "invalid local interface");
|
||||
guarantee(e->is_klass() && e->is_interface(), "invalid local interface");
|
||||
}
|
||||
}
|
||||
|
||||
@ -3029,7 +3029,7 @@ void InstanceKlass::verify_on(outputStream* st) {
|
||||
Array<Klass*>* transitive_interfaces = this->transitive_interfaces();
|
||||
for (int j = 0; j < transitive_interfaces->length(); j++) {
|
||||
Klass* e = transitive_interfaces->at(j);
|
||||
guarantee(e->is_klass() && Klass::cast(e)->is_interface(), "invalid transitive interface");
|
||||
guarantee(e->is_klass() && e->is_interface(), "invalid transitive interface");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ bool Klass::is_subclass_of(Klass* k) const {
|
||||
|
||||
while (t != NULL) {
|
||||
if (t == k) return true;
|
||||
t = Klass::cast(t)->super();
|
||||
t = t->super();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -243,16 +243,16 @@ void Klass::initialize_supers(Klass* k, TRAPS) {
|
||||
juint j = super_depth();
|
||||
assert(j == my_depth, "computed accessor gets right answer");
|
||||
Klass* t = this;
|
||||
while (!Klass::cast(t)->can_be_primary_super()) {
|
||||
t = Klass::cast(t)->super();
|
||||
j = Klass::cast(t)->super_depth();
|
||||
while (!t->can_be_primary_super()) {
|
||||
t = t->super();
|
||||
j = t->super_depth();
|
||||
}
|
||||
for (juint j1 = j+1; j1 < primary_super_limit(); j1++) {
|
||||
assert(primary_super_of_depth(j1) == NULL, "super list padding");
|
||||
}
|
||||
while (t != NULL) {
|
||||
assert(primary_super_of_depth(j) == t, "super list initialization");
|
||||
t = Klass::cast(t)->super();
|
||||
t = t->super();
|
||||
--j;
|
||||
}
|
||||
assert(j == (juint)-1, "correct depth count");
|
||||
@ -333,7 +333,7 @@ GrowableArray<Klass*>* Klass::compute_secondary_supers(int num_extra_slots) {
|
||||
|
||||
|
||||
Klass* Klass::subklass() const {
|
||||
return _subklass == NULL ? NULL : Klass::cast(_subklass);
|
||||
return _subklass == NULL ? NULL : _subklass;
|
||||
}
|
||||
|
||||
InstanceKlass* Klass::superklass() const {
|
||||
@ -342,7 +342,7 @@ InstanceKlass* Klass::superklass() const {
|
||||
}
|
||||
|
||||
Klass* Klass::next_sibling() const {
|
||||
return _next_sibling == NULL ? NULL : Klass::cast(_next_sibling);
|
||||
return _next_sibling == NULL ? NULL : _next_sibling;
|
||||
}
|
||||
|
||||
void Klass::set_subklass(Klass* s) {
|
||||
|
@ -422,12 +422,6 @@ class Klass : public Metadata {
|
||||
// if not, throw either an Error or an Exception.
|
||||
virtual void check_valid_for_instantiation(bool throwError, TRAPS);
|
||||
|
||||
// Casting
|
||||
static Klass* cast(Klass* k) {
|
||||
assert(k->is_klass(), "cast to Klass");
|
||||
return k;
|
||||
}
|
||||
|
||||
// array copying
|
||||
virtual void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS);
|
||||
|
||||
|
@ -746,7 +746,7 @@ void klassItable::initialize_itable_for_interface(int method_table_offset, Klass
|
||||
while (target != NULL && target->is_static()) {
|
||||
// continue with recursive lookup through the superclass
|
||||
Klass* super = target->method_holder()->super();
|
||||
target = (super == NULL) ? (Method*)NULL : Klass::cast(super)->uncached_lookup_method(method_name, method_signature);
|
||||
target = (super == NULL) ? (Method*)NULL : super->uncached_lookup_method(method_name, method_signature);
|
||||
}
|
||||
if (target == NULL || !target->is_public() || target->is_abstract()) {
|
||||
// Entry do not resolve. Leave it empty
|
||||
@ -852,7 +852,7 @@ void visit_all_interfaces(Array<Klass*>* transitive_intf, InterfaceVisiterClosur
|
||||
// Handle array argument
|
||||
for(int i = 0; i < transitive_intf->length(); i++) {
|
||||
Klass* intf = transitive_intf->at(i);
|
||||
assert(Klass::cast(intf)->is_interface(), "sanity check");
|
||||
assert(intf->is_interface(), "sanity check");
|
||||
|
||||
// Find no. of methods excluding a <clinit>
|
||||
int method_count = InstanceKlass::cast(intf)->methods()->length();
|
||||
|
@ -152,11 +152,11 @@ address Method::get_c2i_unverified_entry() {
|
||||
}
|
||||
|
||||
char* Method::name_and_sig_as_C_string() const {
|
||||
return name_and_sig_as_C_string(Klass::cast(constants()->pool_holder()), name(), signature());
|
||||
return name_and_sig_as_C_string(constants()->pool_holder(), name(), signature());
|
||||
}
|
||||
|
||||
char* Method::name_and_sig_as_C_string(char* buf, int size) const {
|
||||
return name_and_sig_as_C_string(Klass::cast(constants()->pool_holder()), name(), signature(), buf, size);
|
||||
return name_and_sig_as_C_string(constants()->pool_holder(), name(), signature(), buf, size);
|
||||
}
|
||||
|
||||
char* Method::name_and_sig_as_C_string(Klass* klass, Symbol* method_name, Symbol* signature) {
|
||||
@ -578,8 +578,8 @@ objArrayHandle Method::resolved_checked_exceptions_impl(Method* this_oop, TRAPS)
|
||||
for (int i = 0; i < length; i++) {
|
||||
CheckedExceptionElement* table = h_this->checked_exceptions_start(); // recompute on each iteration, not gc safe
|
||||
Klass* k = h_this->constants()->klass_at(table[i].class_cp_index, CHECK_(objArrayHandle()));
|
||||
assert(Klass::cast(k)->is_subclass_of(SystemDictionary::Throwable_klass()), "invalid exception class");
|
||||
mirrors->obj_at_put(i, Klass::cast(k)->java_mirror());
|
||||
assert(k->is_subclass_of(SystemDictionary::Throwable_klass()), "invalid exception class");
|
||||
mirrors->obj_at_put(i, k->java_mirror());
|
||||
}
|
||||
return mirrors;
|
||||
}
|
||||
@ -618,7 +618,7 @@ bool Method::is_klass_loaded_by_klass_index(int klass_index) const {
|
||||
Thread *thread = Thread::current();
|
||||
Symbol* klass_name = constants()->klass_name_at(klass_index);
|
||||
Handle loader(thread, method_holder()->class_loader());
|
||||
Handle prot (thread, Klass::cast(method_holder())->protection_domain());
|
||||
Handle prot (thread, method_holder()->protection_domain());
|
||||
return SystemDictionary::find(klass_name, loader, prot, thread) != NULL;
|
||||
} else {
|
||||
return true;
|
||||
@ -1067,8 +1067,8 @@ methodHandle Method::make_method_handle_intrinsic(vmIntrinsics::ID iid,
|
||||
}
|
||||
|
||||
Klass* Method::check_non_bcp_klass(Klass* klass) {
|
||||
if (klass != NULL && Klass::cast(klass)->class_loader() != NULL) {
|
||||
if (Klass::cast(klass)->oop_is_objArray())
|
||||
if (klass != NULL && klass->class_loader() != NULL) {
|
||||
if (klass->oop_is_objArray())
|
||||
klass = ObjArrayKlass::cast(klass)->bottom_klass();
|
||||
return klass;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ Klass* ObjArrayKlass::allocate_objArray_klass(ClassLoaderData* loader_data,
|
||||
Array<Klass*>* element_supers = element_klass->secondary_supers();
|
||||
for( int i = element_supers->length()-1; i >= 0; i-- ) {
|
||||
Klass* elem_super = element_supers->at(i);
|
||||
if (Klass::cast(elem_super)->array_klass_or_null() == NULL) {
|
||||
if (elem_super->array_klass_or_null() == NULL) {
|
||||
supers_exist = false;
|
||||
break;
|
||||
}
|
||||
@ -172,7 +172,7 @@ ObjArrayKlass::ObjArrayKlass(int n, KlassHandle element_klass, Symbol* name) : A
|
||||
} else {
|
||||
bk = element_klass();
|
||||
}
|
||||
assert(bk != NULL && (Klass::cast(bk)->oop_is_instance() || Klass::cast(bk)->oop_is_typeArray()), "invalid bottom klass");
|
||||
assert(bk != NULL && (bk->oop_is_instance() || bk->oop_is_typeArray()), "invalid bottom klass");
|
||||
this->set_bottom_klass(bk);
|
||||
this->set_class_loader_data(bk->class_loader_data());
|
||||
|
||||
@ -254,7 +254,7 @@ template <class T> void ObjArrayKlass::do_copy(arrayOop s, T* src,
|
||||
// We have to make sure all elements conform to the destination array
|
||||
Klass* bound = ObjArrayKlass::cast(d->klass())->element_klass();
|
||||
Klass* stype = ObjArrayKlass::cast(s->klass())->element_klass();
|
||||
if (stype == bound || Klass::cast(stype)->is_subtype_of(bound)) {
|
||||
if (stype == bound || stype->is_subtype_of(bound)) {
|
||||
// elements are guaranteed to be subtypes, so no check necessary
|
||||
bs->write_ref_array_pre(dst, length);
|
||||
Copy::conjoint_oops_atomic(src, dst, length);
|
||||
@ -271,7 +271,7 @@ template <class T> void ObjArrayKlass::do_copy(arrayOop s, T* src,
|
||||
oop new_val = element_is_null ? oop(NULL)
|
||||
: oopDesc::decode_heap_oop_not_null(element);
|
||||
if (element_is_null ||
|
||||
Klass::cast((new_val->klass()))->is_subtype_of(bound)) {
|
||||
(new_val->klass())->is_subtype_of(bound)) {
|
||||
bs->write_ref_field_pre(p, new_val);
|
||||
*p = *from;
|
||||
} else {
|
||||
@ -381,7 +381,7 @@ bool ObjArrayKlass::can_be_primary_super_slow() const {
|
||||
|
||||
GrowableArray<Klass*>* ObjArrayKlass::compute_secondary_supers(int num_extra_slots) {
|
||||
// interfaces = { cloneable_klass, serializable_klass, elemSuper[], ... };
|
||||
Array<Klass*>* elem_supers = Klass::cast(element_klass())->secondary_supers();
|
||||
Array<Klass*>* elem_supers = element_klass()->secondary_supers();
|
||||
int num_elem_supers = elem_supers == NULL ? 0 : elem_supers->length();
|
||||
int num_secondaries = num_extra_slots + 2 + num_elem_supers;
|
||||
if (num_secondaries == 2) {
|
||||
@ -411,7 +411,7 @@ bool ObjArrayKlass::compute_is_subtype_of(Klass* k) {
|
||||
}
|
||||
|
||||
void ObjArrayKlass::initialize(TRAPS) {
|
||||
Klass::cast(bottom_klass())->initialize(THREAD); // dispatches to either InstanceKlass or TypeArrayKlass
|
||||
bottom_klass()->initialize(THREAD); // dispatches to either InstanceKlass or TypeArrayKlass
|
||||
}
|
||||
|
||||
#define ObjArrayKlass_SPECIALIZED_OOP_ITERATE(T, a, p, do_oop) \
|
||||
@ -607,7 +607,7 @@ jint ObjArrayKlass::compute_modifier_flags(TRAPS) const {
|
||||
return JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC;
|
||||
}
|
||||
// Return the flags of the bottom element type.
|
||||
jint element_flags = Klass::cast(bottom_klass())->compute_modifier_flags(CHECK_0);
|
||||
jint element_flags = bottom_klass()->compute_modifier_flags(CHECK_0);
|
||||
|
||||
return (element_flags & (JVM_ACC_PUBLIC | JVM_ACC_PRIVATE | JVM_ACC_PROTECTED))
|
||||
| (JVM_ACC_ABSTRACT | JVM_ACC_FINAL);
|
||||
@ -686,7 +686,7 @@ void ObjArrayKlass::verify_on(outputStream* st) {
|
||||
guarantee(element_klass()->is_klass(), "should be klass");
|
||||
guarantee(bottom_klass()->is_metadata(), "should be in metaspace");
|
||||
guarantee(bottom_klass()->is_klass(), "should be klass");
|
||||
Klass* bk = Klass::cast(bottom_klass());
|
||||
Klass* bk = bottom_klass();
|
||||
guarantee(bk->oop_is_instance() || bk->oop_is_typeArray(), "invalid bottom klass");
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ class ObjArrayKlass : public ArrayKlass {
|
||||
void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS);
|
||||
|
||||
// Compute protection domain
|
||||
oop protection_domain() { return Klass::cast(bottom_klass())->protection_domain(); }
|
||||
oop protection_domain() { return bottom_klass()->protection_domain(); }
|
||||
|
||||
private:
|
||||
// Either oop or narrowOop depending on UseCompressedOops.
|
||||
|
@ -236,7 +236,7 @@ JRT_BLOCK_ENTRY(void, OptoRuntime::new_instance_C(Klass* klass, JavaThread* thre
|
||||
assert(check_compiled_frame(thread), "incorrect caller");
|
||||
|
||||
// These checks are cheap to make and support reflective allocation.
|
||||
int lh = Klass::cast(klass)->layout_helper();
|
||||
int lh = klass->layout_helper();
|
||||
if (Klass::layout_helper_needs_slow_path(lh)
|
||||
|| !InstanceKlass::cast(klass)->is_initialized()) {
|
||||
KlassHandle kh(THREAD, klass);
|
||||
@ -283,7 +283,7 @@ JRT_BLOCK_ENTRY(void, OptoRuntime::new_array_C(Klass* array_type, int len, JavaT
|
||||
// Scavenge and allocate an instance.
|
||||
oop result;
|
||||
|
||||
if (Klass::cast(array_type)->oop_is_typeArray()) {
|
||||
if (array_type->oop_is_typeArray()) {
|
||||
// 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();
|
||||
@ -321,7 +321,7 @@ JRT_BLOCK_ENTRY(void, OptoRuntime::new_array_nozero_C(Klass* array_type, int len
|
||||
// Scavenge and allocate an instance.
|
||||
oop result;
|
||||
|
||||
assert(Klass::cast(array_type)->oop_is_typeArray(), "should be called only for type array");
|
||||
assert(array_type->oop_is_typeArray(), "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);
|
||||
|
@ -234,13 +234,13 @@ bool jfieldIDWorkaround::is_valid_jfieldID(Klass* k, jfieldID id) {
|
||||
intptr_t jfieldIDWorkaround::encode_klass_hash(Klass* k, intptr_t offset) {
|
||||
if (offset <= small_offset_mask) {
|
||||
Klass* field_klass = k;
|
||||
Klass* super_klass = Klass::cast(field_klass)->super();
|
||||
Klass* super_klass = field_klass->super();
|
||||
// With compressed oops the most super class with nonstatic fields would
|
||||
// be the owner of fields embedded in the header.
|
||||
while (InstanceKlass::cast(super_klass)->has_nonstatic_fields() &&
|
||||
InstanceKlass::cast(super_klass)->contains_field_offset(offset)) {
|
||||
field_klass = super_klass; // super contains the field also
|
||||
super_klass = Klass::cast(field_klass)->super();
|
||||
super_klass = field_klass->super();
|
||||
}
|
||||
debug_only(No_Safepoint_Verifier nosafepoint;)
|
||||
uintptr_t klass_hash = field_klass->identity_hash();
|
||||
@ -250,7 +250,7 @@ intptr_t jfieldIDWorkaround::encode_klass_hash(Klass* k, intptr_t offset) {
|
||||
#ifndef PRODUCT
|
||||
{
|
||||
ResourceMark rm;
|
||||
warning("VerifyJNIFields: long offset %d in %s", offset, Klass::cast(k)->external_name());
|
||||
warning("VerifyJNIFields: long offset %d in %s", offset, k->external_name());
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@ -266,7 +266,7 @@ bool jfieldIDWorkaround::klass_hash_ok(Klass* k, jfieldID id) {
|
||||
// Could use a non-blocking query for identity_hash here...
|
||||
if ((k->identity_hash() & klass_mask) == klass_hash)
|
||||
return true;
|
||||
k = Klass::cast(k)->super();
|
||||
k = k->super();
|
||||
} while (k != NULL);
|
||||
return false;
|
||||
}
|
||||
@ -284,7 +284,7 @@ void jfieldIDWorkaround::verify_instance_jfieldID(Klass* k, jfieldID id) {
|
||||
#ifndef PRODUCT
|
||||
if (Verbose) {
|
||||
ResourceMark rm;
|
||||
warning("VerifyJNIFields: unverified offset %d for %s", offset, Klass::cast(k)->external_name());
|
||||
warning("VerifyJNIFields: unverified offset %d for %s", offset, k->external_name());
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@ -416,7 +416,7 @@ JNI_ENTRY(jclass, jni_DefineClass(JNIEnv *env, const char *name, jobject loaderR
|
||||
}
|
||||
|
||||
cls = (jclass)JNIHandles::make_local(
|
||||
env, Klass::cast(k)->java_mirror());
|
||||
env, k->java_mirror());
|
||||
return cls;
|
||||
JNI_END
|
||||
|
||||
@ -537,7 +537,7 @@ JNI_ENTRY(jmethodID, jni_FromReflectedMethod(JNIEnv *env, jobject method))
|
||||
|
||||
KlassHandle k1(THREAD, k);
|
||||
// Make sure class is initialized before handing id's out to methods
|
||||
Klass::cast(k1())->initialize(CHECK_NULL);
|
||||
k1()->initialize(CHECK_NULL);
|
||||
Method* m = InstanceKlass::cast(k1())->method_with_idnum(slot);
|
||||
ret = m==NULL? NULL : m->jmethod_id(); // return NULL if reflected method deleted
|
||||
return ret;
|
||||
@ -570,7 +570,7 @@ JNI_ENTRY(jfieldID, jni_FromReflectedField(JNIEnv *env, jobject field))
|
||||
|
||||
KlassHandle k1(THREAD, k);
|
||||
// Make sure class is initialized before handing id's out to fields
|
||||
Klass::cast(k1())->initialize(CHECK_NULL);
|
||||
k1()->initialize(CHECK_NULL);
|
||||
|
||||
// First check if this is a static field
|
||||
if (modifiers & JVM_ACC_STATIC) {
|
||||
@ -649,17 +649,17 @@ JNI_ENTRY(jclass, jni_GetSuperclass(JNIEnv *env, jclass sub))
|
||||
// interfaces return NULL
|
||||
// proper classes return Klass::super()
|
||||
Klass* k = java_lang_Class::as_Klass(mirror);
|
||||
if (Klass::cast(k)->is_interface()) return NULL;
|
||||
if (k->is_interface()) return NULL;
|
||||
|
||||
// return mirror for superclass
|
||||
Klass* super = Klass::cast(k)->java_super();
|
||||
Klass* super = k->java_super();
|
||||
// super2 is the value computed by the compiler's getSuperClass intrinsic:
|
||||
debug_only(Klass* super2 = ( Klass::cast(k)->oop_is_array()
|
||||
debug_only(Klass* super2 = ( k->oop_is_array()
|
||||
? SystemDictionary::Object_klass()
|
||||
: Klass::cast(k)->super() ) );
|
||||
: k->super() ) );
|
||||
assert(super == super2,
|
||||
"java_super computation depends on interface, array, other super");
|
||||
obj = (super == NULL) ? NULL : (jclass) JNIHandles::make_local(Klass::cast(super)->java_mirror());
|
||||
obj = (super == NULL) ? NULL : (jclass) JNIHandles::make_local(super->java_mirror());
|
||||
return obj;
|
||||
JNI_END
|
||||
|
||||
@ -687,7 +687,7 @@ JNI_QUICK_ENTRY(jboolean, jni_IsAssignableFrom(JNIEnv *env, jclass sub, jclass s
|
||||
Klass* sub_klass = java_lang_Class::as_Klass(sub_mirror);
|
||||
Klass* super_klass = java_lang_Class::as_Klass(super_mirror);
|
||||
assert(sub_klass != NULL && super_klass != NULL, "invalid arguments to jni_IsAssignableFrom");
|
||||
jboolean ret = Klass::cast(sub_klass)->is_subtype_of(super_klass) ?
|
||||
jboolean ret = sub_klass->is_subtype_of(super_klass) ?
|
||||
JNI_TRUE : JNI_FALSE;
|
||||
#ifndef USDT2
|
||||
DTRACE_PROBE1(hotspot_jni, IsAssignableFrom__return, ret);
|
||||
@ -821,7 +821,7 @@ JNI_ENTRY_NO_PRESERVE(void, jni_ExceptionDescribe(JNIEnv *env))
|
||||
ResourceMark rm(THREAD);
|
||||
jio_fprintf(defaultStream::error_stream(),
|
||||
". Uncaught exception of type %s.",
|
||||
Klass::cast(ex->klass())->external_name());
|
||||
ex->klass()->external_name());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1359,7 +1359,7 @@ static void jni_invoke_nonstatic(JNIEnv *env, JavaValue* result, jobject receive
|
||||
Method* m = Method::resolve_jmethod_id(method_id);
|
||||
number_of_parameters = m->size_of_parameters();
|
||||
Klass* holder = m->method_holder();
|
||||
if (!(Klass::cast(holder))->is_interface()) {
|
||||
if (!(holder)->is_interface()) {
|
||||
// non-interface call -- for that little speed boost, don't handlize
|
||||
debug_only(No_Safepoint_Verifier nosafepoint;)
|
||||
if (call_type == JNI_VIRTUAL) {
|
||||
@ -1424,7 +1424,7 @@ static void jni_invoke_nonstatic(JNIEnv *env, JavaValue* result, jobject receive
|
||||
|
||||
static instanceOop alloc_object(jclass clazz, TRAPS) {
|
||||
KlassHandle k(THREAD, java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz)));
|
||||
Klass::cast(k())->check_valid_for_instantiation(false, CHECK_NULL);
|
||||
k()->check_valid_for_instantiation(false, CHECK_NULL);
|
||||
InstanceKlass::cast(k())->initialize(CHECK_NULL);
|
||||
instanceOop ih = InstanceKlass::cast(k())->allocate_instance(THREAD);
|
||||
return ih;
|
||||
@ -1546,7 +1546,7 @@ JNI_ENTRY(jclass, jni_GetObjectClass(JNIEnv *env, jobject obj))
|
||||
#endif /* USDT2 */
|
||||
Klass* k = JNIHandles::resolve_non_null(obj)->klass();
|
||||
jclass ret =
|
||||
(jclass) JNIHandles::make_local(env, Klass::cast(k)->java_mirror());
|
||||
(jclass) JNIHandles::make_local(env, k->java_mirror());
|
||||
#ifndef USDT2
|
||||
DTRACE_PROBE1(hotspot_jni, GetObjectClass__return, ret);
|
||||
#else /* USDT2 */
|
||||
@ -1611,7 +1611,7 @@ static jmethodID get_method_id(JNIEnv *env, jclass clazz, const char *name_str,
|
||||
|
||||
// Make sure class is linked and initialized before handing id's out to
|
||||
// Method*s.
|
||||
Klass::cast(klass())->initialize(CHECK_NULL);
|
||||
klass()->initialize(CHECK_NULL);
|
||||
|
||||
Method* m;
|
||||
if (name == vmSymbols::object_initializer_name() ||
|
||||
@ -2427,7 +2427,7 @@ JNI_ENTRY(ResultType, \
|
||||
JNI_ArgumentPusherVaArg ap(methodID, args); \
|
||||
/* Make sure class is initialized before trying to invoke its method */ \
|
||||
KlassHandle k(THREAD, java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls))); \
|
||||
Klass::cast(k())->initialize(CHECK_0); \
|
||||
k()->initialize(CHECK_0); \
|
||||
jni_invoke_static(env, &jvalue, NULL, JNI_STATIC, methodID, &ap, CHECK_0); \
|
||||
va_end(args); \
|
||||
ret = jvalue.get_##ResultType(); \
|
||||
@ -2612,10 +2612,10 @@ JNI_ENTRY(jfieldID, jni_GetFieldID(JNIEnv *env, jclass clazz,
|
||||
KlassHandle k(THREAD,
|
||||
java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz)));
|
||||
// Make sure class is initialized before handing id's out to fields
|
||||
Klass::cast(k())->initialize(CHECK_NULL);
|
||||
k()->initialize(CHECK_NULL);
|
||||
|
||||
fieldDescriptor fd;
|
||||
if (!Klass::cast(k())->oop_is_instance() ||
|
||||
if (!k()->oop_is_instance() ||
|
||||
!InstanceKlass::cast(k())->find_field(fieldname, signame, false, &fd)) {
|
||||
THROW_MSG_0(vmSymbols::java_lang_NoSuchFieldError(), (char*) name);
|
||||
}
|
||||
@ -2977,10 +2977,10 @@ JNI_ENTRY(jfieldID, jni_GetStaticFieldID(JNIEnv *env, jclass clazz,
|
||||
KlassHandle k(THREAD,
|
||||
java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz)));
|
||||
// Make sure class is initialized before handing id's out to static fields
|
||||
Klass::cast(k())->initialize(CHECK_NULL);
|
||||
k()->initialize(CHECK_NULL);
|
||||
|
||||
fieldDescriptor fd;
|
||||
if (!Klass::cast(k())->oop_is_instance() ||
|
||||
if (!k()->oop_is_instance() ||
|
||||
!InstanceKlass::cast(k())->find_field(fieldname, signame, true, &fd)) {
|
||||
THROW_MSG_0(vmSymbols::java_lang_NoSuchFieldError(), (char*) name);
|
||||
}
|
||||
@ -3440,7 +3440,7 @@ JNI_ENTRY(jobjectArray, jni_NewObjectArray(JNIEnv *env, jsize length, jclass ele
|
||||
jobjectArray ret = NULL;
|
||||
DT_RETURN_MARK(NewObjectArray, jobjectArray, (const jobjectArray&)ret);
|
||||
KlassHandle ek(THREAD, java_lang_Class::as_Klass(JNIHandles::resolve_non_null(elementClass)));
|
||||
Klass* ako = Klass::cast(ek())->array_klass(CHECK_NULL);
|
||||
Klass* ako = ek()->array_klass(CHECK_NULL);
|
||||
KlassHandle ak = KlassHandle(THREAD, ako);
|
||||
ObjArrayKlass::cast(ak())->initialize(CHECK_NULL);
|
||||
objArrayOop result = ObjArrayKlass::cast(ak())->allocate(length, CHECK_NULL);
|
||||
@ -3971,7 +3971,7 @@ static Method* find_prefixed_native(KlassHandle k,
|
||||
if (trial_name == NULL) {
|
||||
continue; // no such symbol, so this prefix wasn't used, try the next prefix
|
||||
}
|
||||
method = Klass::cast(k())->lookup_method(trial_name, signature);
|
||||
method = k()->lookup_method(trial_name, signature);
|
||||
if (method == NULL) {
|
||||
continue; // signature doesn't match, try the next prefix
|
||||
}
|
||||
@ -3988,12 +3988,12 @@ static Method* find_prefixed_native(KlassHandle k,
|
||||
}
|
||||
|
||||
static bool register_native(KlassHandle k, Symbol* name, Symbol* signature, address entry, TRAPS) {
|
||||
Method* method = Klass::cast(k())->lookup_method(name, signature);
|
||||
Method* method = k()->lookup_method(name, signature);
|
||||
if (method == NULL) {
|
||||
ResourceMark rm;
|
||||
stringStream st;
|
||||
st.print("Method %s name or signature does not match",
|
||||
Method::name_and_sig_as_C_string(Klass::cast(k()), name, signature));
|
||||
Method::name_and_sig_as_C_string(k(), name, signature));
|
||||
THROW_MSG_(vmSymbols::java_lang_NoSuchMethodError(), st.as_string(), false);
|
||||
}
|
||||
if (!method->is_native()) {
|
||||
@ -4003,7 +4003,7 @@ static bool register_native(KlassHandle k, Symbol* name, Symbol* signature, addr
|
||||
ResourceMark rm;
|
||||
stringStream st;
|
||||
st.print("Method %s is not declared as native",
|
||||
Method::name_and_sig_as_C_string(Klass::cast(k()), name, signature));
|
||||
Method::name_and_sig_as_C_string(k(), name, signature));
|
||||
THROW_MSG_(vmSymbols::java_lang_NoSuchMethodError(), st.as_string(), false);
|
||||
}
|
||||
}
|
||||
@ -4059,7 +4059,7 @@ JNI_ENTRY(jint, jni_RegisterNatives(JNIEnv *env, jclass clazz,
|
||||
if (name == NULL || signature == NULL) {
|
||||
ResourceMark rm;
|
||||
stringStream st;
|
||||
st.print("Method %s.%s%s not found", Klass::cast(h_k())->external_name(), meth_name, meth_sig);
|
||||
st.print("Method %s.%s%s not found", h_k()->external_name(), meth_name, meth_sig);
|
||||
// Must return negative value on failure
|
||||
THROW_MSG_(vmSymbols::java_lang_NoSuchMethodError(), st.as_string(), -1);
|
||||
}
|
||||
@ -4085,7 +4085,7 @@ JNI_ENTRY(jint, jni_UnregisterNatives(JNIEnv *env, jclass clazz))
|
||||
#endif /* USDT2 */
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz));
|
||||
//%note jni_2
|
||||
if (Klass::cast(k)->oop_is_instance()) {
|
||||
if (k->oop_is_instance()) {
|
||||
for (int index = 0; index < InstanceKlass::cast(k)->methods()->length(); index++) {
|
||||
Method* m = InstanceKlass::cast(k)->methods()->at(index);
|
||||
if (m->is_native()) {
|
||||
|
@ -383,7 +383,7 @@ void jniCheck::validate_throwable_klass(JavaThread* thr, Klass* klass) {
|
||||
ASSERT_OOPS_ALLOWED;
|
||||
assert(klass != NULL, "klass argument must have a value");
|
||||
|
||||
if (!Klass::cast(klass)->oop_is_instance() ||
|
||||
if (!klass->oop_is_instance() ||
|
||||
!InstanceKlass::cast(klass)->is_subclass_of(SystemDictionary::Throwable_klass())) {
|
||||
ReportJNIFatalError(thr, fatal_class_not_a_throwable_class);
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ JVM_ENTRY(void, JVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src
|
||||
assert(s->is_oop(), "JVM_ArrayCopy: src not an oop");
|
||||
assert(d->is_oop(), "JVM_ArrayCopy: dst not an oop");
|
||||
// Do copy
|
||||
Klass::cast(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
|
||||
|
||||
|
||||
@ -675,7 +675,7 @@ JVM_END
|
||||
JVM_ENTRY(jclass, JVM_GetCallerClass(JNIEnv* env, int depth))
|
||||
JVMWrapper("JVM_GetCallerClass");
|
||||
Klass* k = thread->security_get_caller_class(depth);
|
||||
return (k == NULL) ? NULL : (jclass) JNIHandles::make_local(env, Klass::cast(k)->java_mirror());
|
||||
return (k == NULL) ? NULL : (jclass) JNIHandles::make_local(env, k->java_mirror());
|
||||
JVM_END
|
||||
|
||||
|
||||
@ -739,7 +739,7 @@ JVM_ENTRY(jclass, JVM_FindClassFromBootLoader(JNIEnv* env,
|
||||
if (TraceClassResolution) {
|
||||
trace_class_resolution(k);
|
||||
}
|
||||
return (jclass) JNIHandles::make_local(env, Klass::cast(k)->java_mirror());
|
||||
return (jclass) JNIHandles::make_local(env, k->java_mirror());
|
||||
JVM_END
|
||||
|
||||
JVM_ENTRY(jclass, JVM_FindClassFromClassLoader(JNIEnv* env, const char* name,
|
||||
@ -785,8 +785,8 @@ JVM_ENTRY(jclass, JVM_FindClassFromClass(JNIEnv *env, const char *name,
|
||||
oop class_loader = NULL;
|
||||
oop protection_domain = NULL;
|
||||
if (from_class != NULL) {
|
||||
class_loader = Klass::cast(from_class)->class_loader();
|
||||
protection_domain = Klass::cast(from_class)->protection_domain();
|
||||
class_loader = from_class->class_loader();
|
||||
protection_domain = from_class->protection_domain();
|
||||
}
|
||||
Handle h_loader(THREAD, class_loader);
|
||||
Handle h_prot (THREAD, protection_domain);
|
||||
@ -798,11 +798,11 @@ JVM_ENTRY(jclass, JVM_FindClassFromClass(JNIEnv *env, const char *name,
|
||||
ResourceMark rm;
|
||||
oop from_mirror = JNIHandles::resolve_non_null(from);
|
||||
Klass* from_class = java_lang_Class::as_Klass(from_mirror);
|
||||
const char * from_name = Klass::cast(from_class)->external_name();
|
||||
const char * from_name = from_class->external_name();
|
||||
|
||||
oop mirror = JNIHandles::resolve_non_null(result);
|
||||
Klass* to_class = java_lang_Class::as_Klass(mirror);
|
||||
const char * to = Klass::cast(to_class)->external_name();
|
||||
const char * to = to_class->external_name();
|
||||
tty->print("RESOLVE %s %s (verification)\n", from_name, to);
|
||||
}
|
||||
|
||||
@ -875,7 +875,7 @@ static jclass jvm_define_class_common(JNIEnv *env, const char *name,
|
||||
trace_class_resolution(k);
|
||||
}
|
||||
|
||||
return (jclass) JNIHandles::make_local(env, Klass::cast(k)->java_mirror());
|
||||
return (jclass) JNIHandles::make_local(env, k->java_mirror());
|
||||
}
|
||||
|
||||
|
||||
@ -936,7 +936,7 @@ JVM_ENTRY(jclass, JVM_FindLoadedClass(JNIEnv *env, jobject loader, jstring name)
|
||||
CHECK_NULL);
|
||||
|
||||
return (k == NULL) ? NULL :
|
||||
(jclass) JNIHandles::make_local(env, Klass::cast(k)->java_mirror());
|
||||
(jclass) JNIHandles::make_local(env, k->java_mirror());
|
||||
JVM_END
|
||||
|
||||
|
||||
@ -954,7 +954,7 @@ JVM_ENTRY(jstring, JVM_GetClassName(JNIEnv *env, jclass cls))
|
||||
// Consider caching interned string in Klass
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls));
|
||||
assert(k->is_klass(), "just checking");
|
||||
name = Klass::cast(k)->external_name();
|
||||
name = k->external_name();
|
||||
}
|
||||
oop result = StringTable::intern((char*) name, CHECK_NULL);
|
||||
return (jstring) JNIHandles::make_local(env, result);
|
||||
@ -991,12 +991,12 @@ JVM_ENTRY(jobjectArray, JVM_GetClassInterfaces(JNIEnv *env, jclass cls))
|
||||
// Regular instance klass, fill in all local interfaces
|
||||
for (int index = 0; index < size; index++) {
|
||||
Klass* k = InstanceKlass::cast(klass())->local_interfaces()->at(index);
|
||||
result->obj_at_put(index, Klass::cast(k)->java_mirror());
|
||||
result->obj_at_put(index, k->java_mirror());
|
||||
}
|
||||
} else {
|
||||
// All arrays implement java.lang.Cloneable and java.io.Serializable
|
||||
result->obj_at_put(0, Klass::cast(SystemDictionary::Cloneable_klass())->java_mirror());
|
||||
result->obj_at_put(1, Klass::cast(SystemDictionary::Serializable_klass())->java_mirror());
|
||||
result->obj_at_put(0, SystemDictionary::Cloneable_klass()->java_mirror());
|
||||
result->obj_at_put(1, SystemDictionary::Serializable_klass()->java_mirror());
|
||||
}
|
||||
return (jobjectArray) JNIHandles::make_local(env, result());
|
||||
JVM_END
|
||||
@ -1008,7 +1008,7 @@ JVM_ENTRY(jobject, JVM_GetClassLoader(JNIEnv *env, jclass cls))
|
||||
return NULL;
|
||||
}
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
|
||||
oop loader = Klass::cast(k)->class_loader();
|
||||
oop loader = k->class_loader();
|
||||
return JNIHandles::make_local(env, loader);
|
||||
JVM_END
|
||||
|
||||
@ -1020,8 +1020,8 @@ JVM_QUICK_ENTRY(jboolean, JVM_IsInterface(JNIEnv *env, jclass cls))
|
||||
return JNI_FALSE;
|
||||
}
|
||||
Klass* k = java_lang_Class::as_Klass(mirror);
|
||||
jboolean result = Klass::cast(k)->is_interface();
|
||||
assert(!result || Klass::cast(k)->oop_is_instance(),
|
||||
jboolean result = k->is_interface();
|
||||
assert(!result || k->oop_is_instance(),
|
||||
"all interfaces are instance types");
|
||||
// The compiler intrinsic for isInterface tests the
|
||||
// Klass::_access_flags bits in the same way.
|
||||
@ -1039,7 +1039,7 @@ JVM_ENTRY(jobjectArray, JVM_GetClassSigners(JNIEnv *env, jclass cls))
|
||||
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
|
||||
objArrayOop signers = NULL;
|
||||
if (Klass::cast(k)->oop_is_instance()) {
|
||||
if (k->oop_is_instance()) {
|
||||
signers = InstanceKlass::cast(k)->signers();
|
||||
}
|
||||
|
||||
@ -1066,7 +1066,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 (Klass::cast(k)->oop_is_instance()) {
|
||||
if (k->oop_is_instance()) {
|
||||
InstanceKlass::cast(k)->set_signers(objArrayOop(JNIHandles::resolve(signers)));
|
||||
}
|
||||
}
|
||||
@ -1085,7 +1085,7 @@ JVM_ENTRY(jobject, JVM_GetProtectionDomain(JNIEnv *env, jclass cls))
|
||||
}
|
||||
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls));
|
||||
return (jobject) JNIHandles::make_local(env, Klass::cast(k)->protection_domain());
|
||||
return (jobject) JNIHandles::make_local(env, k->protection_domain());
|
||||
JVM_END
|
||||
|
||||
|
||||
@ -1101,7 +1101,7 @@ JVM_ENTRY(void, JVM_SetProtectionDomain(JNIEnv *env, jclass cls, jobject protect
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls));
|
||||
|
||||
// cls won't be an array, as this called only from ClassLoader.defineClass
|
||||
if (Klass::cast(k)->oop_is_instance()) {
|
||||
if (k->oop_is_instance()) {
|
||||
oop pd = JNIHandles::resolve(protection_domain);
|
||||
assert(pd == NULL || pd->is_oop(), "just checking");
|
||||
InstanceKlass::cast(k)->set_protection_domain(pd);
|
||||
@ -1124,7 +1124,7 @@ JVM_ENTRY(jobject, JVM_DoPrivileged(JNIEnv *env, jclass cls, jobject action, job
|
||||
Handle object (THREAD, JNIHandles::resolve(action));
|
||||
|
||||
// get run() method
|
||||
Method* m_oop = Klass::cast(object->klass())->uncached_lookup_method(
|
||||
Method* m_oop = object->klass()->uncached_lookup_method(
|
||||
vmSymbols::run_method_name(),
|
||||
vmSymbols::void_object_signature());
|
||||
methodHandle m (THREAD, m_oop);
|
||||
@ -1267,7 +1267,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) && Klass::cast(k)->oop_is_array() ? true : false;
|
||||
return (k != NULL) && k->oop_is_array() ? true : false;
|
||||
JVM_END
|
||||
|
||||
|
||||
@ -1293,7 +1293,7 @@ JVM_ENTRY(jint, JVM_GetClassModifiers(JNIEnv *env, jclass cls))
|
||||
return JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC;
|
||||
}
|
||||
|
||||
Klass* k = Klass::cast(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls)));
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
|
||||
debug_only(int computed_modifiers = k->compute_modifier_flags(CHECK_0));
|
||||
assert(k->modifier_flags() == computed_modifiers, "modifiers cache is OK");
|
||||
return k->modifier_flags();
|
||||
@ -1308,7 +1308,7 @@ JVM_ENTRY(jobjectArray, JVM_GetDeclaredClasses(JNIEnv *env, jclass ofClass))
|
||||
// of an InstanceKlass
|
||||
|
||||
if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass)) ||
|
||||
! Klass::cast(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass)))->oop_is_instance()) {
|
||||
! java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass))->oop_is_instance()) {
|
||||
oop result = oopFactory::new_objArray(SystemDictionary::Class_klass(), 0, CHECK_NULL);
|
||||
return (jobjectArray)JNIHandles::make_local(env, result);
|
||||
}
|
||||
@ -1372,7 +1372,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)) ||
|
||||
! Klass::cast(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass)))->oop_is_instance()) {
|
||||
! java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass))->oop_is_instance()) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1382,7 +1382,7 @@ JVM_ENTRY(jclass, JVM_GetDeclaringClass(JNIEnv *env, jclass ofClass))
|
||||
)->compute_enclosing_class(&inner_is_member, CHECK_NULL);
|
||||
if (outer_klass == NULL) return NULL; // already a top-level class
|
||||
if (!inner_is_member) return NULL; // an anonymous class (inside a method)
|
||||
return (jclass) JNIHandles::make_local(env, Klass::cast(outer_klass)->java_mirror());
|
||||
return (jclass) JNIHandles::make_local(env, outer_klass->java_mirror());
|
||||
}
|
||||
JVM_END
|
||||
|
||||
@ -1452,7 +1452,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 (Klass::cast(k)->oop_is_instance()) {
|
||||
if (k->oop_is_instance()) {
|
||||
Symbol* sym = InstanceKlass::cast(k)->generic_signature();
|
||||
if (sym == NULL) return NULL;
|
||||
Handle str = java_lang_String::create_from_symbol(sym, CHECK_NULL);
|
||||
@ -1470,7 +1470,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 (Klass::cast(k)->oop_is_instance()) {
|
||||
if (k->oop_is_instance()) {
|
||||
typeArrayOop a = Annotations::make_java_array(InstanceKlass::cast(k)->class_annotations(), CHECK_NULL);
|
||||
return (jbyteArray) JNIHandles::make_local(env, a);
|
||||
}
|
||||
@ -1583,7 +1583,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)) ||
|
||||
Klass::cast(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass)))->oop_is_array()) {
|
||||
java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass))->oop_is_array()) {
|
||||
// Return empty array
|
||||
oop res = oopFactory::new_objArray(SystemDictionary::reflect_Field_klass(), 0, CHECK_NULL);
|
||||
return (jobjectArray) JNIHandles::make_local(env, res);
|
||||
@ -1646,7 +1646,7 @@ JVM_ENTRY(jobjectArray, JVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass,
|
||||
|
||||
// Exclude primitive types and array types
|
||||
if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass))
|
||||
|| Klass::cast(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass)))->oop_is_array()) {
|
||||
|| java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass))->oop_is_array()) {
|
||||
// Return empty array
|
||||
oop res = oopFactory::new_objArray(SystemDictionary::reflect_Method_klass(), 0, CHECK_NULL);
|
||||
return (jobjectArray) JNIHandles::make_local(env, res);
|
||||
@ -1698,7 +1698,7 @@ JVM_ENTRY(jobjectArray, JVM_GetClassDeclaredConstructors(JNIEnv *env, jclass ofC
|
||||
|
||||
// Exclude primitive types and array types
|
||||
if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass))
|
||||
|| Klass::cast(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass)))->oop_is_array()) {
|
||||
|| java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass))->oop_is_array()) {
|
||||
// Return empty array
|
||||
oop res = oopFactory::new_objArray(SystemDictionary::reflect_Constructor_klass(), 0 , CHECK_NULL);
|
||||
return (jobjectArray) JNIHandles::make_local(env, res);
|
||||
@ -1751,7 +1751,7 @@ JVM_ENTRY(jint, JVM_GetClassAccessFlags(JNIEnv *env, jclass cls))
|
||||
return JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC;
|
||||
}
|
||||
|
||||
Klass* k = Klass::cast(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls)));
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
|
||||
return k->access_flags().as_int() & JVM_ACC_WRITTEN_FLAGS;
|
||||
}
|
||||
JVM_END
|
||||
@ -1767,7 +1767,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 (Klass::cast(k)->oop_is_instance()) {
|
||||
if (k->oop_is_instance()) {
|
||||
instanceKlassHandle k_h(THREAD, k);
|
||||
Handle jcp = sun_reflect_ConstantPool::create(CHECK_NULL);
|
||||
sun_reflect_ConstantPool::set_cp(jcp(), k_h->constants());
|
||||
@ -2043,12 +2043,12 @@ 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(Klass::cast(k)->oop_is_instance(), "must be an instance klass");
|
||||
if (! Klass::cast(k)->oop_is_instance()) return false;
|
||||
assert(k->oop_is_instance(), "must be an instance klass");
|
||||
if (! k->oop_is_instance()) return false;
|
||||
|
||||
ResourceMark rm(THREAD);
|
||||
const char* name = Klass::cast(k)->name()->as_C_string();
|
||||
bool system_class = Klass::cast(k)->class_loader() == NULL;
|
||||
const char* name = k->name()->as_C_string();
|
||||
bool system_class = k->class_loader() == NULL;
|
||||
return JavaAssertions::enabled(name, system_class);
|
||||
|
||||
JVM_END
|
||||
@ -2079,7 +2079,7 @@ JVM_ENTRY(const char*, JVM_GetClassNameUTF(JNIEnv *env, jclass cls))
|
||||
JVMWrapper("JVM_GetClassNameUTF");
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
|
||||
k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread);
|
||||
return Klass::cast(k)->name()->as_utf8();
|
||||
return k->name()->as_utf8();
|
||||
JVM_END
|
||||
|
||||
|
||||
@ -2089,7 +2089,7 @@ 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 (Klass::cast(k)->oop_is_instance()) {
|
||||
if (k->oop_is_instance()) {
|
||||
ConstantPool* cp = InstanceKlass::cast(k)->constants();
|
||||
for (int index = cp->length() - 1; index >= 0; index--) {
|
||||
constantTag tag = cp->tag_at(index);
|
||||
@ -2103,7 +2103,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 (!Klass::cast(k)->oop_is_instance())
|
||||
if (!k->oop_is_instance())
|
||||
return 0;
|
||||
return InstanceKlass::cast(k)->constants()->length();
|
||||
JVM_END
|
||||
@ -2113,7 +2113,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 (!Klass::cast(k)->oop_is_instance())
|
||||
if (!k->oop_is_instance())
|
||||
return 0;
|
||||
return InstanceKlass::cast(k)->java_fields_count();
|
||||
JVM_END
|
||||
@ -2123,7 +2123,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 (!Klass::cast(k)->oop_is_instance())
|
||||
if (!k->oop_is_instance())
|
||||
return 0;
|
||||
return InstanceKlass::cast(k)->methods()->length();
|
||||
JVM_END
|
||||
@ -3123,7 +3123,7 @@ JVM_ENTRY(jobjectArray, JVM_GetClassContext(JNIEnv *env))
|
||||
// Fill in mirrors corresponding to method holders
|
||||
int index = 0;
|
||||
while (first != NULL) {
|
||||
result->obj_at_put(index++, Klass::cast(first->klass())->java_mirror());
|
||||
result->obj_at_put(index++, first->klass()->java_mirror());
|
||||
first = first->next;
|
||||
}
|
||||
assert(index == depth, "just checking");
|
||||
@ -3217,7 +3217,7 @@ bool force_verify_field_access(Klass* current_class, Klass* field_class, AccessF
|
||||
|
||||
if (access.is_protected()) {
|
||||
// See if current_class is a subclass of field_class
|
||||
if (Klass::cast(current_class)->is_subclass_of(field_class)) {
|
||||
if (current_class->is_subclass_of(field_class)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -3241,8 +3241,8 @@ JVM_ENTRY(jobject, JVM_AllocateNewObject(JNIEnv *env, jobject receiver, jclass c
|
||||
}
|
||||
|
||||
// Arrays not allowed here, must use JVM_AllocateNewArray
|
||||
if (Klass::cast(java_lang_Class::as_Klass(curr_mirror))->oop_is_array() ||
|
||||
Klass::cast(java_lang_Class::as_Klass(init_mirror))->oop_is_array()) {
|
||||
if (java_lang_Class::as_Klass(curr_mirror)->oop_is_array() ||
|
||||
java_lang_Class::as_Klass(init_mirror)->oop_is_array()) {
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_0(vmSymbols::java_lang_InvalidClassException());
|
||||
}
|
||||
@ -3264,7 +3264,7 @@ JVM_ENTRY(jobject, JVM_AllocateNewObject(JNIEnv *env, jobject receiver, jclass c
|
||||
if (m.is_null()) {
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_MSG_0(vmSymbols::java_lang_NoSuchMethodError(),
|
||||
Method::name_and_sig_as_C_string(Klass::cast(init_klass()),
|
||||
Method::name_and_sig_as_C_string(init_klass(),
|
||||
vmSymbols::object_initializer_name(),
|
||||
vmSymbols::void_method_signature()));
|
||||
}
|
||||
@ -4245,7 +4245,7 @@ JVM_ENTRY(jobjectArray, JVM_GetEnclosingMethodInfo(JNIEnv *env, jclass ofClass))
|
||||
return NULL;
|
||||
}
|
||||
Klass* k = java_lang_Class::as_Klass(mirror());
|
||||
if (!Klass::cast(k)->oop_is_instance()) {
|
||||
if (!k->oop_is_instance()) {
|
||||
return NULL;
|
||||
}
|
||||
instanceKlassHandle ik_h(THREAD, k);
|
||||
@ -4256,7 +4256,7 @@ JVM_ENTRY(jobjectArray, JVM_GetEnclosingMethodInfo(JNIEnv *env, jclass ofClass))
|
||||
objArrayOop dest_o = oopFactory::new_objArray(SystemDictionary::Object_klass(), 3, CHECK_NULL);
|
||||
objArrayHandle dest(THREAD, dest_o);
|
||||
Klass* enc_k = ik_h->constants()->klass_at(encl_method_class_idx, CHECK_NULL);
|
||||
dest->obj_at_put(0, Klass::cast(enc_k)->java_mirror());
|
||||
dest->obj_at_put(0, enc_k->java_mirror());
|
||||
int encl_method_method_idx = ik_h->enclosing_method_method_index();
|
||||
if (encl_method_method_idx != 0) {
|
||||
Symbol* sym = ik_h->constants()->symbol_at(
|
||||
|
@ -228,7 +228,7 @@ void JvmtiClassFileReconstituter::write_code_attribute(methodHandle method) {
|
||||
|
||||
write_attribute_name_index("Code");
|
||||
write_u4(size);
|
||||
write_u2(method->max_stack());
|
||||
write_u2(method->verifier_max_stack());
|
||||
write_u2(method->max_locals());
|
||||
write_u4(code_size);
|
||||
copy_bytecodes(method, (unsigned char*)writeable_address(code_size));
|
||||
|
@ -2116,7 +2116,7 @@ JvmtiEnv::GetClassSignature(oop k_mirror, char** signature_ptr, char** generic_p
|
||||
result[0] = tchar;
|
||||
result[1] = '\0';
|
||||
} else {
|
||||
const char* class_sig = Klass::cast(k)->signature_name();
|
||||
const char* class_sig = k->signature_name();
|
||||
result = (char *) jvmtiMalloc(strlen(class_sig)+1);
|
||||
strcpy(result, class_sig);
|
||||
}
|
||||
@ -2124,7 +2124,7 @@ JvmtiEnv::GetClassSignature(oop k_mirror, char** signature_ptr, char** generic_p
|
||||
}
|
||||
if (generic_ptr != NULL) {
|
||||
*generic_ptr = NULL;
|
||||
if (!isPrimitive && Klass::cast(k)->oop_is_instance()) {
|
||||
if (!isPrimitive && k->oop_is_instance()) {
|
||||
Symbol* soo = InstanceKlass::cast(k)->generic_signature();
|
||||
if (soo != NULL) {
|
||||
const char *gen_sig = soo->as_C_string();
|
||||
@ -2155,7 +2155,7 @@ JvmtiEnv::GetClassStatus(oop k_mirror, jint* status_ptr) {
|
||||
} else {
|
||||
Klass* k = java_lang_Class::as_Klass(k_mirror);
|
||||
NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS);
|
||||
result = Klass::cast(k)->jvmti_class_status();
|
||||
result = k->jvmti_class_status();
|
||||
}
|
||||
*status_ptr = result;
|
||||
|
||||
@ -2173,7 +2173,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 (!Klass::cast(k_klass)->oop_is_instance()) {
|
||||
if (!k_klass->oop_is_instance()) {
|
||||
return JVMTI_ERROR_ABSENT_INFORMATION;
|
||||
}
|
||||
|
||||
@ -2200,7 +2200,7 @@ JvmtiEnv::GetClassModifiers(oop k_mirror, jint* modifiers_ptr) {
|
||||
if (!java_lang_Class::is_primitive(k_mirror)) {
|
||||
Klass* k = java_lang_Class::as_Klass(k_mirror);
|
||||
NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS);
|
||||
result = Klass::cast(k)->compute_modifier_flags(current_thread);
|
||||
result = k->compute_modifier_flags(current_thread);
|
||||
JavaThread* THREAD = current_thread; // pass to macros
|
||||
if (HAS_PENDING_EXCEPTION) {
|
||||
CLEAR_PENDING_EXCEPTION;
|
||||
@ -2208,7 +2208,7 @@ JvmtiEnv::GetClassModifiers(oop k_mirror, jint* modifiers_ptr) {
|
||||
};
|
||||
|
||||
// Reset the deleted ACC_SUPER bit ( deleted in compute_modifier_flags()).
|
||||
if(Klass::cast(k)->is_super()) {
|
||||
if(k->is_super()) {
|
||||
result |= JVM_ACC_SUPER;
|
||||
}
|
||||
} else {
|
||||
@ -2237,11 +2237,11 @@ JvmtiEnv::GetClassMethods(oop k_mirror, jint* method_count_ptr, jmethodID** meth
|
||||
NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS);
|
||||
|
||||
// Return CLASS_NOT_PREPARED error as per JVMTI spec.
|
||||
if (!(Klass::cast(k)->jvmti_class_status() & (JVMTI_CLASS_STATUS_PREPARED|JVMTI_CLASS_STATUS_ARRAY) )) {
|
||||
if (!(k->jvmti_class_status() & (JVMTI_CLASS_STATUS_PREPARED|JVMTI_CLASS_STATUS_ARRAY) )) {
|
||||
return JVMTI_ERROR_CLASS_NOT_PREPARED;
|
||||
}
|
||||
|
||||
if (!Klass::cast(k)->oop_is_instance()) {
|
||||
if (!k->oop_is_instance()) {
|
||||
*method_count_ptr = 0;
|
||||
*methods_ptr = (jmethodID*) jvmtiMalloc(0 * sizeof(jmethodID));
|
||||
return JVMTI_ERROR_NONE;
|
||||
@ -2293,11 +2293,11 @@ JvmtiEnv::GetClassFields(oop k_mirror, jint* field_count_ptr, jfieldID** fields_
|
||||
NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS);
|
||||
|
||||
// Return CLASS_NOT_PREPARED error as per JVMTI spec.
|
||||
if (!(Klass::cast(k)->jvmti_class_status() & (JVMTI_CLASS_STATUS_PREPARED|JVMTI_CLASS_STATUS_ARRAY) )) {
|
||||
if (!(k->jvmti_class_status() & (JVMTI_CLASS_STATUS_PREPARED|JVMTI_CLASS_STATUS_ARRAY) )) {
|
||||
return JVMTI_ERROR_CLASS_NOT_PREPARED;
|
||||
}
|
||||
|
||||
if (!Klass::cast(k)->oop_is_instance()) {
|
||||
if (!k->oop_is_instance()) {
|
||||
*field_count_ptr = 0;
|
||||
*fields_ptr = (jfieldID*) jvmtiMalloc(0 * sizeof(jfieldID));
|
||||
return JVMTI_ERROR_NONE;
|
||||
@ -2348,10 +2348,10 @@ JvmtiEnv::GetImplementedInterfaces(oop k_mirror, jint* interface_count_ptr, jcla
|
||||
NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS);
|
||||
|
||||
// Return CLASS_NOT_PREPARED error as per JVMTI spec.
|
||||
if (!(Klass::cast(k)->jvmti_class_status() & (JVMTI_CLASS_STATUS_PREPARED|JVMTI_CLASS_STATUS_ARRAY) ))
|
||||
if (!(k->jvmti_class_status() & (JVMTI_CLASS_STATUS_PREPARED|JVMTI_CLASS_STATUS_ARRAY) ))
|
||||
return JVMTI_ERROR_CLASS_NOT_PREPARED;
|
||||
|
||||
if (!Klass::cast(k)->oop_is_instance()) {
|
||||
if (!k->oop_is_instance()) {
|
||||
*interface_count_ptr = 0;
|
||||
*interfaces_ptr = (jclass*) jvmtiMalloc(0 * sizeof(jclass));
|
||||
return JVMTI_ERROR_NONE;
|
||||
@ -2363,8 +2363,8 @@ JvmtiEnv::GetImplementedInterfaces(oop k_mirror, jint* interface_count_ptr, jcla
|
||||
for (int i_index = 0; i_index < result_length; i_index += 1) {
|
||||
Klass* klass_at = interface_list->at(i_index);
|
||||
assert(klass_at->is_klass(), "interfaces must be Klass*s");
|
||||
assert(Klass::cast(klass_at)->is_interface(), "interfaces must be interfaces");
|
||||
oop mirror_at = Klass::cast(klass_at)->java_mirror();
|
||||
assert(klass_at->is_interface(), "interfaces must be interfaces");
|
||||
oop mirror_at = klass_at->java_mirror();
|
||||
Handle handle_at = Handle(current_thread, mirror_at);
|
||||
result_list[i_index] = (jclass) jni_reference(handle_at);
|
||||
}
|
||||
@ -2468,7 +2468,7 @@ JvmtiEnv::IsInterface(oop k_mirror, jboolean* is_interface_ptr) {
|
||||
bool result = false;
|
||||
if (!java_lang_Class::is_primitive(k_mirror)) {
|
||||
Klass* k = java_lang_Class::as_Klass(k_mirror);
|
||||
if (k != NULL && Klass::cast(k)->is_interface()) {
|
||||
if (k != NULL && k->is_interface()) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
@ -2487,7 +2487,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 && Klass::cast(k)->oop_is_array()) {
|
||||
if (k != NULL && k->oop_is_array()) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
@ -2512,7 +2512,7 @@ JvmtiEnv::GetClassLoader(oop k_mirror, jobject* classloader_ptr) {
|
||||
Klass* k = java_lang_Class::as_Klass(k_mirror);
|
||||
NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS);
|
||||
|
||||
oop result_oop = Klass::cast(k)->class_loader();
|
||||
oop result_oop = k->class_loader();
|
||||
if (result_oop == NULL) {
|
||||
*classloader_ptr = (jclass) jni_reference(Handle());
|
||||
return JVMTI_ERROR_NONE;
|
||||
@ -2535,7 +2535,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 (!Klass::cast(k)->oop_is_instance()) {
|
||||
if (!k->oop_is_instance()) {
|
||||
return JVMTI_ERROR_ABSENT_INFORMATION;
|
||||
}
|
||||
char* sde = InstanceKlass::cast(k)->source_debug_extension();
|
||||
|
@ -590,7 +590,7 @@ JvmtiEnvBase::vframeFor(JavaThread* java_thread, jint depth) {
|
||||
jclass
|
||||
JvmtiEnvBase::get_jni_class_non_null(Klass* k) {
|
||||
assert(k != NULL, "k != NULL");
|
||||
return (jclass)jni_reference(Klass::cast(k)->java_mirror());
|
||||
return (jclass)jni_reference(k->java_mirror());
|
||||
}
|
||||
|
||||
#ifndef JVMTI_KERNEL
|
||||
@ -1365,7 +1365,7 @@ JvmtiEnvBase::check_top_frame(JavaThread* current_thread, JavaThread* java_threa
|
||||
// Method return type signature.
|
||||
char* ty_sign = 1 + strchr(signature->as_C_string(), ')');
|
||||
|
||||
if (!VM_GetOrSetLocal::is_assignable(ty_sign, Klass::cast(ob_kh()), current_thread)) {
|
||||
if (!VM_GetOrSetLocal::is_assignable(ty_sign, ob_kh(), current_thread)) {
|
||||
return JVMTI_ERROR_TYPE_MISMATCH;
|
||||
}
|
||||
*ret_ob_h = ob_h;
|
||||
|
@ -196,7 +196,7 @@ public:
|
||||
jobject to_jobject(oop obj) { return JNIHandles::make_local(_thread,obj); }
|
||||
#endif
|
||||
|
||||
jclass to_jclass(Klass* klass) { return (klass == NULL ? NULL : (jclass)to_jobject(Klass::cast(klass)->java_mirror())); }
|
||||
jclass to_jclass(Klass* klass) { return (klass == NULL ? NULL : (jclass)to_jobject(klass->java_mirror())); }
|
||||
|
||||
jmethodID to_jmethodID(methodHandle method) { return method->jmethod_id(); }
|
||||
|
||||
@ -920,7 +920,7 @@ void JvmtiExport::post_class_load(JavaThread *thread, Klass* klass) {
|
||||
if (ets->is_enabled(JVMTI_EVENT_CLASS_LOAD)) {
|
||||
EVT_TRACE(JVMTI_EVENT_CLASS_LOAD, ("JVMTI [%s] Evt Class Load sent %s",
|
||||
JvmtiTrace::safe_get_thread_name(thread),
|
||||
kh()==NULL? "NULL" : Klass::cast(kh())->external_name() ));
|
||||
kh()==NULL? "NULL" : kh()->external_name() ));
|
||||
|
||||
JvmtiEnv *env = ets->get_env();
|
||||
JvmtiClassEventMark jem(thread, kh());
|
||||
@ -949,7 +949,7 @@ void JvmtiExport::post_class_prepare(JavaThread *thread, Klass* klass) {
|
||||
if (ets->is_enabled(JVMTI_EVENT_CLASS_PREPARE)) {
|
||||
EVT_TRACE(JVMTI_EVENT_CLASS_PREPARE, ("JVMTI [%s] Evt Class Prepare sent %s",
|
||||
JvmtiTrace::safe_get_thread_name(thread),
|
||||
kh()==NULL? "NULL" : Klass::cast(kh())->external_name() ));
|
||||
kh()==NULL? "NULL" : kh()->external_name() ));
|
||||
|
||||
JvmtiEnv *env = ets->get_env();
|
||||
JvmtiClassEventMark jem(thread, kh());
|
||||
@ -979,12 +979,12 @@ void JvmtiExport::post_class_unload(Klass* klass) {
|
||||
for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) {
|
||||
if (env->is_enabled((jvmtiEvent)EXT_EVENT_CLASS_UNLOAD)) {
|
||||
EVT_TRACE(EXT_EVENT_CLASS_UNLOAD, ("JVMTI [?] Evt Class Unload sent %s",
|
||||
kh()==NULL? "NULL" : Klass::cast(kh())->external_name() ));
|
||||
kh()==NULL? "NULL" : kh()->external_name() ));
|
||||
|
||||
// do everything manually, since this is a proxy - needs special care
|
||||
JNIEnv* jni_env = real_thread->jni_environment();
|
||||
jthread jt = (jthread)JNIHandles::make_local(real_thread, real_thread->threadObj());
|
||||
jclass jk = (jclass)JNIHandles::make_local(real_thread, Klass::cast(kh())->java_mirror());
|
||||
jclass jk = (jclass)JNIHandles::make_local(real_thread, kh()->java_mirror());
|
||||
|
||||
// Before we call the JVMTI agent, we have to set the state in the
|
||||
// thread for which we are proxying.
|
||||
@ -2121,7 +2121,7 @@ void JvmtiExport::post_vm_object_alloc(JavaThread *thread, oop object) {
|
||||
if (env->is_enabled(JVMTI_EVENT_VM_OBJECT_ALLOC)) {
|
||||
EVT_TRACE(JVMTI_EVENT_VM_OBJECT_ALLOC, ("JVMTI [%s] Evt vmobject alloc sent %s",
|
||||
JvmtiTrace::safe_get_thread_name(thread),
|
||||
object==NULL? "NULL" : Klass::cast(java_lang_Class::as_Klass(object))->external_name()));
|
||||
object==NULL? "NULL" : java_lang_Class::as_Klass(object)->external_name()));
|
||||
|
||||
JvmtiVMObjectAllocEventMark jem(thread, h());
|
||||
JvmtiJavaThreadEventTransition jet(thread);
|
||||
|
@ -169,7 +169,7 @@ class JvmtiGetLoadedClassesClosure : public StackObj {
|
||||
static void increment(Klass* k) {
|
||||
JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this();
|
||||
if (that->get_initiatingLoader() == NULL) {
|
||||
for (Klass* l = k; l != NULL; l = Klass::cast(l)->array_klass_or_null()) {
|
||||
for (Klass* l = k; l != NULL; l = l->array_klass_or_null()) {
|
||||
that->set_count(that->get_count() + 1);
|
||||
}
|
||||
} else if (k != NULL) {
|
||||
@ -182,7 +182,7 @@ class JvmtiGetLoadedClassesClosure : public StackObj {
|
||||
JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this();
|
||||
oop class_loader = loader_data->class_loader();
|
||||
if (class_loader == JNIHandles::resolve(that->get_initiatingLoader())) {
|
||||
for (Klass* l = k; l != NULL; l = Klass::cast(l)->array_klass_or_null()) {
|
||||
for (Klass* l = k; l != NULL; l = l->array_klass_or_null()) {
|
||||
that->set_count(that->get_count() + 1);
|
||||
}
|
||||
}
|
||||
@ -200,14 +200,14 @@ class JvmtiGetLoadedClassesClosure : public StackObj {
|
||||
JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this();
|
||||
if (that->available()) {
|
||||
if (that->get_initiatingLoader() == NULL) {
|
||||
for (Klass* l = k; l != NULL; l = Klass::cast(l)->array_klass_or_null()) {
|
||||
oop mirror = Klass::cast(l)->java_mirror();
|
||||
for (Klass* l = k; l != NULL; l = l->array_klass_or_null()) {
|
||||
oop mirror = l->java_mirror();
|
||||
that->set_element(that->get_index(), mirror);
|
||||
that->set_index(that->get_index() + 1);
|
||||
}
|
||||
} else if (k != NULL) {
|
||||
// if initiating loader not null, just include the instance with 1 dimension
|
||||
oop mirror = Klass::cast(k)->java_mirror();
|
||||
oop mirror = k->java_mirror();
|
||||
that->set_element(that->get_index(), mirror);
|
||||
that->set_index(that->get_index() + 1);
|
||||
}
|
||||
@ -219,8 +219,8 @@ class JvmtiGetLoadedClassesClosure : public StackObj {
|
||||
if (that->available()) {
|
||||
oop class_loader = loader_data->class_loader();
|
||||
if (class_loader == JNIHandles::resolve(that->get_initiatingLoader())) {
|
||||
for (Klass* l = k; l != NULL; l = Klass::cast(l)->array_klass_or_null()) {
|
||||
oop mirror = Klass::cast(l)->java_mirror();
|
||||
for (Klass* l = k; l != NULL; l = l->array_klass_or_null()) {
|
||||
oop mirror = l->java_mirror();
|
||||
that->set_element(that->get_index(), mirror);
|
||||
that->set_index(that->get_index() + 1);
|
||||
}
|
||||
@ -234,7 +234,7 @@ class JvmtiGetLoadedClassesClosure : public StackObj {
|
||||
static void increment_for_basic_type_arrays(Klass* k) {
|
||||
JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this();
|
||||
assert(that != NULL, "no JvmtiGetLoadedClassesClosure");
|
||||
for (Klass* l = k; l != NULL; l = Klass::cast(l)->array_klass_or_null()) {
|
||||
for (Klass* l = k; l != NULL; l = l->array_klass_or_null()) {
|
||||
that->set_count(that->get_count() + 1);
|
||||
}
|
||||
}
|
||||
@ -244,8 +244,8 @@ class JvmtiGetLoadedClassesClosure : public StackObj {
|
||||
JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this();
|
||||
assert(that != NULL, "no JvmtiGetLoadedClassesClosure");
|
||||
assert(that->available(), "no list");
|
||||
for (Klass* l = k; l != NULL; l = Klass::cast(l)->array_klass_or_null()) {
|
||||
oop mirror = Klass::cast(l)->java_mirror();
|
||||
for (Klass* l = k; l != NULL; l = l->array_klass_or_null()) {
|
||||
oop mirror = l->java_mirror();
|
||||
that->set_element(that->get_index(), mirror);
|
||||
that->set_index(that->get_index() + 1);
|
||||
}
|
||||
|
@ -641,14 +641,14 @@ bool VM_GetOrSetLocal::is_assignable(const char* ty_sign, Klass* klass, Thread*
|
||||
int super_depth = klass->super_depth();
|
||||
int idx;
|
||||
for (idx = 0; idx < super_depth; idx++) {
|
||||
if (Klass::cast(klass->primary_super_of_depth(idx))->name() == ty_sym) {
|
||||
if (klass->primary_super_of_depth(idx)->name() == ty_sym) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Compare secondary supers
|
||||
Array<Klass*>* sec_supers = klass->secondary_supers();
|
||||
for (idx = 0; idx < sec_supers->length(); idx++) {
|
||||
if (Klass::cast((Klass*) sec_supers->at(idx))->name() == ty_sym) {
|
||||
if (((Klass*) sec_supers->at(idx))->name() == ty_sym) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -726,7 +726,7 @@ bool VM_GetOrSetLocal::check_slot_type(javaVFrame* jvf) {
|
||||
KlassHandle ob_kh = KlassHandle(cur_thread, obj->klass());
|
||||
NULL_CHECK(ob_kh, (_result = JVMTI_ERROR_INVALID_OBJECT, false));
|
||||
|
||||
if (!is_assignable(signature, Klass::cast(ob_kh()), cur_thread)) {
|
||||
if (!is_assignable(signature, ob_kh(), cur_thread)) {
|
||||
_result = JVMTI_ERROR_TYPE_MISMATCH;
|
||||
return false;
|
||||
}
|
||||
|
@ -222,7 +222,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 || !Klass::cast(the_class_oop)->oop_is_instance()) {
|
||||
if (the_class_oop == NULL || !the_class_oop->oop_is_instance()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -573,8 +573,8 @@ jvmtiError VM_RedefineClasses::compare_and_normalize_class_versions(
|
||||
// Check for NULL superclass first since this might be java.lang.Object
|
||||
if (the_class->super() != scratch_class->super() &&
|
||||
(the_class->super() == NULL || scratch_class->super() == NULL ||
|
||||
Klass::cast(the_class->super())->name() !=
|
||||
Klass::cast(scratch_class->super())->name())) {
|
||||
the_class->super()->name() !=
|
||||
scratch_class->super()->name())) {
|
||||
return JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED;
|
||||
}
|
||||
|
||||
@ -592,8 +592,8 @@ jvmtiError VM_RedefineClasses::compare_and_normalize_class_versions(
|
||||
return JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED;
|
||||
}
|
||||
for (i = 0; i < n_intfs; i++) {
|
||||
if (Klass::cast(k_interfaces->at(i))->name() !=
|
||||
Klass::cast(k_new_interfaces->at(i))->name()) {
|
||||
if (k_interfaces->at(i)->name() !=
|
||||
k_new_interfaces->at(i)->name()) {
|
||||
return JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED;
|
||||
}
|
||||
}
|
||||
@ -2684,7 +2684,7 @@ void VM_RedefineClasses::adjust_cpool_cache_and_vtable(Klass* k_oop,
|
||||
// interface, then we have to call adjust_method_entries() for
|
||||
// every InstanceKlass that has an itable since there isn't a
|
||||
// subclass relationship between an interface and an InstanceKlass.
|
||||
if (ik->itable_length() > 0 && (Klass::cast(_the_class_oop)->is_interface()
|
||||
if (ik->itable_length() > 0 && (_the_class_oop->is_interface()
|
||||
|| ik->is_subclass_of(_the_class_oop))) {
|
||||
// ik->itable() creates a wrapper object; rm cleans it up
|
||||
ResourceMark rm(THREAD);
|
||||
@ -2929,7 +2929,7 @@ class TransferNativeFunctionRegistration {
|
||||
Symbol* signature) {
|
||||
TempNewSymbol name_symbol = SymbolTable::probe(name_str, (int)name_len);
|
||||
if (name_symbol != NULL) {
|
||||
Method* method = Klass::cast(the_class())->lookup_method(name_symbol, signature);
|
||||
Method* method = the_class()->lookup_method(name_symbol, signature);
|
||||
if (method != NULL) {
|
||||
// Even if prefixed, intermediate methods must exist.
|
||||
if (method->is_native()) {
|
||||
|
@ -2774,7 +2774,7 @@ inline bool VM_HeapWalkOperation::iterate_over_array(oop o) {
|
||||
// a type array references its class
|
||||
inline bool VM_HeapWalkOperation::iterate_over_type_array(oop o) {
|
||||
Klass* k = o->klass();
|
||||
oop mirror = Klass::cast(k)->java_mirror();
|
||||
oop mirror = k->java_mirror();
|
||||
if (!CallbackInvoker::report_class_reference(o, mirror)) {
|
||||
return false;
|
||||
}
|
||||
@ -2823,7 +2823,7 @@ inline bool VM_HeapWalkOperation::iterate_over_class(oop java_class) {
|
||||
// super (only if something more interesting than java.lang.Object)
|
||||
Klass* java_super = ik->java_super();
|
||||
if (java_super != NULL && java_super != SystemDictionary::Object_klass()) {
|
||||
oop super = Klass::cast(java_super)->java_mirror();
|
||||
oop super = java_super->java_mirror();
|
||||
if (!CallbackInvoker::report_superclass_reference(mirror, super)) {
|
||||
return false;
|
||||
}
|
||||
@ -2865,7 +2865,7 @@ inline bool VM_HeapWalkOperation::iterate_over_class(oop java_class) {
|
||||
// If the entry is non-null it is resolved.
|
||||
if (entry == NULL) continue;
|
||||
} else {
|
||||
entry = Klass::cast(pool->resolved_klass_at(i))->java_mirror();
|
||||
entry = pool->resolved_klass_at(i)->java_mirror();
|
||||
}
|
||||
if (!CallbackInvoker::report_constant_pool_reference(mirror, entry, (jint)i)) {
|
||||
return false;
|
||||
@ -2879,7 +2879,7 @@ inline bool VM_HeapWalkOperation::iterate_over_class(oop java_class) {
|
||||
// but are specified by IterateOverReachableObjects and must be reported).
|
||||
Array<Klass*>* interfaces = ik->local_interfaces();
|
||||
for (i = 0; i < interfaces->length(); i++) {
|
||||
oop interf = Klass::cast((Klass*)interfaces->at(i))->java_mirror();
|
||||
oop interf = ((Klass*)interfaces->at(i))->java_mirror();
|
||||
if (interf == NULL) {
|
||||
continue;
|
||||
}
|
||||
@ -2928,7 +2928,7 @@ inline bool VM_HeapWalkOperation::iterate_over_class(oop java_class) {
|
||||
// references from the class).
|
||||
inline bool VM_HeapWalkOperation::iterate_over_object(oop o) {
|
||||
// reference to the class
|
||||
if (!CallbackInvoker::report_class_reference(o, Klass::cast(o->klass())->java_mirror())) {
|
||||
if (!CallbackInvoker::report_class_reference(o, o->klass()->java_mirror())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -292,7 +292,7 @@ const char * JvmtiTrace::get_class_name(oop k_mirror) {
|
||||
if (k_oop == NULL) {
|
||||
return "INVALID";
|
||||
}
|
||||
return Klass::cast(k_oop)->external_name();
|
||||
return k_oop->external_name();
|
||||
}
|
||||
|
||||
#endif /*JVMTI_TRACE */
|
||||
|
@ -138,7 +138,7 @@ oop MethodHandles::init_MemberName(oop mname_oop, oop target_oop) {
|
||||
oop clazz = java_lang_reflect_Method::clazz(target_oop);
|
||||
int slot = java_lang_reflect_Method::slot(target_oop);
|
||||
Klass* k = java_lang_Class::as_Klass(clazz);
|
||||
if (k != NULL && Klass::cast(k)->oop_is_instance()) {
|
||||
if (k != NULL && k->oop_is_instance()) {
|
||||
Method* m = InstanceKlass::cast(k)->method_with_idnum(slot);
|
||||
return init_method_MemberName(mname_oop, m, true, k);
|
||||
}
|
||||
@ -146,7 +146,7 @@ oop MethodHandles::init_MemberName(oop mname_oop, oop target_oop) {
|
||||
oop clazz = java_lang_reflect_Constructor::clazz(target_oop);
|
||||
int slot = java_lang_reflect_Constructor::slot(target_oop);
|
||||
Klass* k = java_lang_Class::as_Klass(clazz);
|
||||
if (k != NULL && Klass::cast(k)->oop_is_instance()) {
|
||||
if (k != NULL && k->oop_is_instance()) {
|
||||
Method* m = InstanceKlass::cast(k)->method_with_idnum(slot);
|
||||
return init_method_MemberName(mname_oop, m, false, k);
|
||||
}
|
||||
@ -187,14 +187,14 @@ oop MethodHandles::init_method_MemberName(oop mname_oop, Method* m, bool do_disp
|
||||
} else if (mods.is_static()) {
|
||||
flags |= IS_METHOD | (JVM_REF_invokeStatic << REFERENCE_KIND_SHIFT);
|
||||
} else if (receiver_limit != mklass &&
|
||||
!Klass::cast(receiver_limit)->is_subtype_of(mklass)) {
|
||||
!receiver_limit->is_subtype_of(mklass)) {
|
||||
return NULL; // bad receiver limit
|
||||
} else if (Klass::cast(receiver_limit)->is_interface() &&
|
||||
Klass::cast(mklass)->is_interface()) {
|
||||
} else if (receiver_limit->is_interface() &&
|
||||
mklass->is_interface()) {
|
||||
flags |= IS_METHOD | (JVM_REF_invokeInterface << REFERENCE_KIND_SHIFT);
|
||||
receiver_limit = mklass; // ignore passed-in limit; interfaces are interconvertible
|
||||
vmindex = klassItable::compute_itable_index(m);
|
||||
} else if (mklass != receiver_limit && Klass::cast(mklass)->is_interface()) {
|
||||
} else if (mklass != receiver_limit && mklass->is_interface()) {
|
||||
flags |= IS_METHOD | (JVM_REF_invokeVirtual << REFERENCE_KIND_SHIFT);
|
||||
// it is a miranda method, so m->vtable_index is not what we want
|
||||
ResourceMark rm;
|
||||
@ -210,7 +210,7 @@ oop MethodHandles::init_method_MemberName(oop mname_oop, Method* m, bool do_disp
|
||||
java_lang_invoke_MemberName::set_flags(mname_oop, flags);
|
||||
java_lang_invoke_MemberName::set_vmtarget(mname_oop, m);
|
||||
java_lang_invoke_MemberName::set_vmindex(mname_oop, vmindex); // vtable/itable index
|
||||
java_lang_invoke_MemberName::set_clazz(mname_oop, Klass::cast(receiver_limit)->java_mirror());
|
||||
java_lang_invoke_MemberName::set_clazz(mname_oop, receiver_limit->java_mirror());
|
||||
// Note: name and type can be lazily computed by resolve_MemberName,
|
||||
// if Java code needs them as resolved String and MethodType objects.
|
||||
// The clazz must be eagerly stored, because it provides a GC
|
||||
@ -258,7 +258,7 @@ oop MethodHandles::init_field_MemberName(oop mname_oop, Klass* field_holder,
|
||||
java_lang_invoke_MemberName::set_flags(mname_oop, flags);
|
||||
java_lang_invoke_MemberName::set_vmtarget(mname_oop, vmtarget);
|
||||
java_lang_invoke_MemberName::set_vmindex(mname_oop, vmindex);
|
||||
java_lang_invoke_MemberName::set_clazz(mname_oop, Klass::cast(field_holder)->java_mirror());
|
||||
java_lang_invoke_MemberName::set_clazz(mname_oop, field_holder->java_mirror());
|
||||
if (name != NULL)
|
||||
java_lang_invoke_MemberName::set_name(mname_oop, name);
|
||||
if (type != NULL)
|
||||
@ -299,7 +299,7 @@ bool MethodHandles::is_method_handle_invoke_name(Klass* klass, Symbol* name) {
|
||||
// The following test will fail spuriously during bootstrap of MethodHandle itself:
|
||||
// if (klass != SystemDictionary::MethodHandle_klass())
|
||||
// Test the name instead:
|
||||
if (Klass::cast(klass)->name() != vmSymbols::java_lang_invoke_MethodHandle())
|
||||
if (klass->name() != vmSymbols::java_lang_invoke_MethodHandle())
|
||||
return false;
|
||||
Symbol* poly_sig = vmSymbols::object_array_object_signature();
|
||||
Method* m = InstanceKlass::cast(klass)->find_method(name, poly_sig);
|
||||
@ -363,7 +363,7 @@ vmIntrinsics::ID MethodHandles::signature_polymorphic_name_id(Symbol* name) {
|
||||
|
||||
vmIntrinsics::ID MethodHandles::signature_polymorphic_name_id(Klass* klass, Symbol* name) {
|
||||
if (klass != NULL &&
|
||||
Klass::cast(klass)->name() == vmSymbols::java_lang_invoke_MethodHandle()) {
|
||||
klass->name() == vmSymbols::java_lang_invoke_MethodHandle()) {
|
||||
vmIntrinsics::ID iid = signature_polymorphic_name_id(name);
|
||||
if (iid != vmIntrinsics::_none)
|
||||
return iid;
|
||||
@ -539,7 +539,7 @@ void MethodHandles::print_as_basic_type_signature_on(outputStream* st,
|
||||
|
||||
|
||||
static oop object_java_mirror() {
|
||||
return Klass::cast(SystemDictionary::Object_klass())->java_mirror();
|
||||
return SystemDictionary::Object_klass()->java_mirror();
|
||||
}
|
||||
|
||||
static oop field_name_or_null(Symbol* s) {
|
||||
@ -560,9 +560,9 @@ static oop field_signature_type_or_null(Symbol* s) {
|
||||
if (s == vmSymbols::object_signature()) {
|
||||
return object_java_mirror();
|
||||
} else if (s == vmSymbols::class_signature()) {
|
||||
return Klass::cast(SystemDictionary::Class_klass())->java_mirror();
|
||||
return SystemDictionary::Class_klass()->java_mirror();
|
||||
} else if (s == vmSymbols::string_signature()) {
|
||||
return Klass::cast(SystemDictionary::String_klass())->java_mirror();
|
||||
return SystemDictionary::String_klass()->java_mirror();
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
@ -603,8 +603,8 @@ Handle MethodHandles::resolve_MemberName(Handle mname, TRAPS) {
|
||||
{
|
||||
Klass* defc_klass = java_lang_Class::as_Klass(defc_oop());
|
||||
if (defc_klass == NULL) return empty; // a primitive; no resolution possible
|
||||
if (!Klass::cast(defc_klass)->oop_is_instance()) {
|
||||
if (!Klass::cast(defc_klass)->oop_is_array()) return empty;
|
||||
if (!defc_klass->oop_is_instance()) {
|
||||
if (!defc_klass->oop_is_array()) return empty;
|
||||
defc_klass = SystemDictionary::Object_klass();
|
||||
}
|
||||
defc = instanceKlassHandle(THREAD, defc_klass);
|
||||
@ -767,7 +767,7 @@ void MethodHandles::expand_MemberName(Handle mname, int suppress, TRAPS) {
|
||||
{
|
||||
// This is taken from LinkResolver::resolve_field, sans access checks.
|
||||
assert(vmtarget->is_klass(), "field vmtarget is Klass*");
|
||||
if (!Klass::cast((Klass*) vmtarget)->oop_is_instance()) break;
|
||||
if (!((Klass*) vmtarget)->oop_is_instance()) break;
|
||||
instanceKlassHandle defc(THREAD, (Klass*) vmtarget);
|
||||
DEBUG_ONLY(vmtarget = NULL); // safety
|
||||
bool is_static = ((flags & JVM_ACC_STATIC) != 0);
|
||||
@ -805,7 +805,7 @@ int MethodHandles::find_MemberNames(Klass* k,
|
||||
|
||||
// %%% take caller into account!
|
||||
|
||||
if (k == NULL || !Klass::cast(k)->oop_is_instance()) return -1;
|
||||
if (k == NULL || !k->oop_is_instance()) return -1;
|
||||
|
||||
int rfill = 0, rlimit = results->length(), rskip = skip;
|
||||
// overflow measurement:
|
||||
@ -1032,7 +1032,7 @@ JVM_ENTRY(jobject, MHN_resolve_Mem(JNIEnv *env, jobject igcls, jobject mname_jh,
|
||||
if (!Reflection::verify_class_access(caller,
|
||||
reference_klass,
|
||||
true)) {
|
||||
THROW_MSG_NULL(vmSymbols::java_lang_InternalError(), Klass::cast(reference_klass)->external_name());
|
||||
THROW_MSG_NULL(vmSymbols::java_lang_InternalError(), reference_klass->external_name());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1108,7 +1108,7 @@ JVM_ENTRY(jobject, MHN_getMemberVMInfo(JNIEnv *env, jobject igcls, jobject mname
|
||||
if (vmtarget == NULL) {
|
||||
x = NULL;
|
||||
} else if (vmtarget->is_klass()) {
|
||||
x = Klass::cast((Klass*) vmtarget)->java_mirror();
|
||||
x = ((Klass*) vmtarget)->java_mirror();
|
||||
} else if (vmtarget->is_method()) {
|
||||
Handle mname2 = MethodHandles::new_MemberName(CHECK_NULL);
|
||||
x = MethodHandles::init_method_MemberName(mname2(), (Method*)vmtarget, false, NULL);
|
||||
@ -1237,7 +1237,7 @@ JVM_ENTRY(void, JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass MHN_class))
|
||||
if (SystemDictionary::MethodHandle_klass() == NULL) {
|
||||
enable_MH = false;
|
||||
} else {
|
||||
oop mirror = Klass::cast(SystemDictionary::MethodHandle_klass())->java_mirror();
|
||||
oop mirror = SystemDictionary::MethodHandle_klass()->java_mirror();
|
||||
MH_class = (jclass) JNIHandles::make_local(env, mirror);
|
||||
}
|
||||
|
||||
|
@ -349,7 +349,7 @@ address NativeLookup::lookup_entry_prefixed(methodHandle method, bool& in_base_l
|
||||
TempNewSymbol wrapper_symbol = SymbolTable::probe(wrapper_name, wrapper_name_len);
|
||||
if (wrapper_symbol != NULL) {
|
||||
KlassHandle kh(method->method_holder());
|
||||
Method* wrapper_method = Klass::cast(kh())->lookup_method(wrapper_symbol,
|
||||
Method* wrapper_method = kh()->lookup_method(wrapper_symbol,
|
||||
method->signature());
|
||||
if (wrapper_method != NULL && !wrapper_method->is_native()) {
|
||||
// we found a wrapper method, use its native entry
|
||||
|
@ -771,7 +771,7 @@ UNSAFE_ENTRY(void, Unsafe_EnsureClassInitialized(JNIEnv *env, jobject unsafe, jo
|
||||
oop mirror = JNIHandles::resolve_non_null(clazz);
|
||||
|
||||
Klass* klass = java_lang_Class::as_Klass(mirror);
|
||||
if (klass != NULL && Klass::cast(klass)->should_be_initialized()) {
|
||||
if (klass != NULL && klass->should_be_initialized()) {
|
||||
InstanceKlass* k = InstanceKlass::cast(klass);
|
||||
k->initialize(CHECK);
|
||||
}
|
||||
@ -785,7 +785,7 @@ UNSAFE_ENTRY(jboolean, Unsafe_ShouldBeInitialized(JNIEnv *env, jobject unsafe, j
|
||||
}
|
||||
oop mirror = JNIHandles::resolve_non_null(clazz);
|
||||
Klass* klass = java_lang_Class::as_Klass(mirror);
|
||||
if (klass != NULL && Klass::cast(klass)->should_be_initialized()) {
|
||||
if (klass != NULL && klass->should_be_initialized()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "classfile/javaAssertions.hpp"
|
||||
#include "classfile/symbolTable.hpp"
|
||||
#include "compiler/compilerOracle.hpp"
|
||||
#include "memory/allocation.inline.hpp"
|
||||
#include "memory/cardTableRS.hpp"
|
||||
@ -1844,6 +1845,11 @@ bool Arguments::check_vm_args_consistency() {
|
||||
status = status && verify_percentage(MinHeapFreeRatio, "MinHeapFreeRatio");
|
||||
status = status && verify_percentage(MaxHeapFreeRatio, "MaxHeapFreeRatio");
|
||||
|
||||
// Divide by bucket size to prevent a large size from causing rollover when
|
||||
// calculating amount of memory needed to be allocated for the String table.
|
||||
status = status && verify_interval(StringTableSize, defaultStringTableSize,
|
||||
(max_uintx / StringTable::bucket_size()), "StringTable size");
|
||||
|
||||
if (MinHeapFreeRatio > MaxHeapFreeRatio) {
|
||||
jio_fprintf(defaultStream::error_stream(),
|
||||
"MinHeapFreeRatio (" UINTX_FORMAT ") must be less than or "
|
||||
|
@ -39,7 +39,7 @@ static GrowableArray<Handle>* _preserved_oop_stack = NULL;
|
||||
static GrowableArray<markOop>* _preserved_mark_stack = NULL;
|
||||
|
||||
static void enable_biased_locking(Klass* k) {
|
||||
Klass::cast(k)->set_prototype_header(markOopDesc::biased_locking_prototype());
|
||||
k->set_prototype_header(markOopDesc::biased_locking_prototype());
|
||||
}
|
||||
|
||||
class VM_EnableBiasedLocking: public VM_Operation {
|
||||
@ -149,7 +149,7 @@ static BiasedLocking::Condition revoke_bias(oop obj, bool allow_rebias, bool is_
|
||||
if (TraceBiasedLocking) {
|
||||
ResourceMark rm;
|
||||
tty->print_cr(" (Skipping revocation of object of type %s because it's no longer biased)",
|
||||
Klass::cast(obj->klass())->external_name());
|
||||
obj->klass()->external_name());
|
||||
}
|
||||
return BiasedLocking::NOT_BIASED;
|
||||
}
|
||||
@ -161,7 +161,7 @@ static BiasedLocking::Condition revoke_bias(oop obj, bool allow_rebias, bool is_
|
||||
if (TraceBiasedLocking && (Verbose || !is_bulk)) {
|
||||
ResourceMark rm;
|
||||
tty->print_cr("Revoking bias of object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s , prototype header " INTPTR_FORMAT " , allow rebias %d , requesting thread " INTPTR_FORMAT,
|
||||
(intptr_t) obj, (intptr_t) mark, Klass::cast(obj->klass())->external_name(), (intptr_t) Klass::cast(obj->klass())->prototype_header(), (allow_rebias ? 1 : 0), (intptr_t) requesting_thread);
|
||||
(intptr_t) obj, (intptr_t) mark, obj->klass()->external_name(), (intptr_t) obj->klass()->prototype_header(), (allow_rebias ? 1 : 0), (intptr_t) requesting_thread);
|
||||
}
|
||||
|
||||
JavaThread* biased_thread = mark->biased_locker();
|
||||
@ -326,7 +326,7 @@ static BiasedLocking::Condition bulk_revoke_or_rebias_at_safepoint(oop o,
|
||||
tty->print_cr("* Beginning bulk revocation (kind == %s) because of object "
|
||||
INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s",
|
||||
(bulk_rebias ? "rebias" : "revoke"),
|
||||
(intptr_t) o, (intptr_t) o->mark(), Klass::cast(o->klass())->external_name());
|
||||
(intptr_t) o, (intptr_t) o->mark(), o->klass()->external_name());
|
||||
}
|
||||
|
||||
jlong cur_time = os::javaTimeMillis();
|
||||
@ -334,7 +334,7 @@ static BiasedLocking::Condition bulk_revoke_or_rebias_at_safepoint(oop o,
|
||||
|
||||
|
||||
Klass* k_o = o->klass();
|
||||
Klass* klass = Klass::cast(k_o);
|
||||
Klass* klass = k_o;
|
||||
|
||||
if (bulk_rebias) {
|
||||
// Use the epoch in the klass of the object to implicitly revoke
|
||||
@ -546,7 +546,7 @@ BiasedLocking::Condition BiasedLocking::revoke_and_rebias(Handle obj, bool attem
|
||||
return BIAS_REVOKED;
|
||||
}
|
||||
} else if (mark->has_bias_pattern()) {
|
||||
Klass* k = Klass::cast(obj->klass());
|
||||
Klass* k = obj->klass();
|
||||
markOop prototype_header = k->prototype_header();
|
||||
if (!prototype_header->has_bias_pattern()) {
|
||||
// This object has a stale bias from before the bulk revocation
|
||||
@ -590,7 +590,7 @@ BiasedLocking::Condition BiasedLocking::revoke_and_rebias(Handle obj, bool attem
|
||||
if (heuristics == HR_NOT_BIASED) {
|
||||
return NOT_BIASED;
|
||||
} else if (heuristics == HR_SINGLE_REVOKE) {
|
||||
Klass *k = Klass::cast(obj->klass());
|
||||
Klass *k = obj->klass();
|
||||
markOop prototype_header = k->prototype_header();
|
||||
if (mark->biased_locker() == THREAD &&
|
||||
prototype_header->bias_epoch() == mark->bias_epoch()) {
|
||||
|
@ -3613,7 +3613,7 @@ class CommandLineFlags {
|
||||
diagnostic(bool, PrintDTraceDOF, false, \
|
||||
"Print the DTrace DOF passed to the system for JSDT probes") \
|
||||
\
|
||||
product(uintx, StringTableSize, 1009, \
|
||||
product(uintx, StringTableSize, defaultStringTableSize, \
|
||||
"Number of buckets in the interned String table") \
|
||||
\
|
||||
develop(bool, TraceDefaultMethods, false, \
|
||||
|
@ -582,7 +582,9 @@ void* os::malloc(size_t size, MEMFLAGS memflags, address caller) {
|
||||
// if NULL is returned the calling functions assume out of memory.
|
||||
size = 1;
|
||||
}
|
||||
|
||||
if (size > size + space_before + space_after) { // Check for rollover.
|
||||
return NULL;
|
||||
}
|
||||
NOT_PRODUCT(if (MallocVerifyInterval > 0) check_heap());
|
||||
u_char* ptr = (u_char*)::malloc(size + space_before + space_after);
|
||||
|
||||
|
@ -70,8 +70,8 @@ static void trace_class_resolution(Klass* to_class) {
|
||||
}
|
||||
}
|
||||
if (caller != NULL) {
|
||||
const char * from = Klass::cast(caller)->external_name();
|
||||
const char * to = Klass::cast(to_class)->external_name();
|
||||
const char * from = caller->external_name();
|
||||
const char * to = to_class->external_name();
|
||||
// print in a single call to reduce interleaving between threads
|
||||
if (source_file != NULL) {
|
||||
tty->print("RESOLVE %s %s %s:%d (reflection)\n", from, to, source_file, line_number);
|
||||
@ -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 (Klass::cast(k)->oop_is_array() && ArrayKlass::cast(k)->dimension() >= MAX_DIM) {
|
||||
if (k->oop_is_array() && 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::cast(klass)->oop_is_array()) {
|
||||
if (klass->oop_is_array()) {
|
||||
int k_dim = ArrayKlass::cast(klass)->dimension();
|
||||
if (k_dim + len > MAX_DIM) {
|
||||
THROW_0(vmSymbols::java_lang_IllegalArgumentException());
|
||||
@ -374,7 +374,7 @@ arrayOop Reflection::reflect_new_multi_array(oop element_mirror, typeArrayOop di
|
||||
dim += k_dim;
|
||||
}
|
||||
}
|
||||
klass = Klass::cast(klass)->array_klass(dim, CHECK_NULL);
|
||||
klass = klass->array_klass(dim, CHECK_NULL);
|
||||
oop obj = ArrayKlass::cast(klass)->multi_allocate(len, dimensions, THREAD);
|
||||
assert(obj->is_array(), "just checking");
|
||||
return arrayOop(obj);
|
||||
@ -387,7 +387,7 @@ oop Reflection::array_component_type(oop mirror, TRAPS) {
|
||||
}
|
||||
|
||||
Klass* klass = java_lang_Class::as_Klass(mirror);
|
||||
if (!Klass::cast(klass)->oop_is_array()) {
|
||||
if (!klass->oop_is_array()) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -395,15 +395,15 @@ oop Reflection::array_component_type(oop mirror, TRAPS) {
|
||||
#ifdef ASSERT
|
||||
oop result2 = NULL;
|
||||
if (ArrayKlass::cast(klass)->dimension() == 1) {
|
||||
if (Klass::cast(klass)->oop_is_typeArray()) {
|
||||
if (klass->oop_is_typeArray()) {
|
||||
result2 = basic_type_arrayklass_to_mirror(klass, CHECK_NULL);
|
||||
} else {
|
||||
result2 = Klass::cast(ObjArrayKlass::cast(klass)->element_klass())->java_mirror();
|
||||
result2 = ObjArrayKlass::cast(klass)->element_klass()->java_mirror();
|
||||
}
|
||||
} else {
|
||||
Klass* lower_dim = ArrayKlass::cast(klass)->lower_dimension();
|
||||
assert(Klass::cast(lower_dim)->oop_is_array(), "just checking");
|
||||
result2 = Klass::cast(lower_dim)->java_mirror();
|
||||
assert(lower_dim->oop_is_array(), "just checking");
|
||||
result2 = lower_dim->java_mirror();
|
||||
}
|
||||
assert(result == result2, "results must be consistent");
|
||||
#endif //ASSERT
|
||||
@ -442,7 +442,7 @@ bool Reflection::reflect_check_access(Klass* field_class, AccessFlags acc, Klass
|
||||
if (acc.is_protected()) {
|
||||
if (target_class != client_class) {
|
||||
if (!is_same_class_package(client_class, field_class)) {
|
||||
if (!Klass::cast(target_class)->is_subclass_of(client_class)) {
|
||||
if (!target_class->is_subclass_of(client_class)) {
|
||||
THROW_(vmSymbols::java_lang_IllegalAccessException(), false);
|
||||
}
|
||||
}
|
||||
@ -468,7 +468,7 @@ bool Reflection::verify_class_access(Klass* current_class, Klass* new_class, boo
|
||||
// sun/reflect/MagicAccessorImpl subclasses to succeed trivially.
|
||||
if ( JDK_Version::is_gte_jdk14x_version()
|
||||
&& UseNewReflection
|
||||
&& Klass::cast(current_class)->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) {
|
||||
&& current_class->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -546,12 +546,12 @@ bool Reflection::verify_field_access(Klass* current_class,
|
||||
if (access.is_protected()) {
|
||||
if (!protected_restriction) {
|
||||
// See if current_class is a subclass of field_class
|
||||
if (Klass::cast(current_class)->is_subclass_of(field_class)) {
|
||||
if (current_class->is_subclass_of(field_class)) {
|
||||
if (access.is_static() || // static fields are ok, see 6622385
|
||||
current_class == resolved_class ||
|
||||
field_class == resolved_class ||
|
||||
Klass::cast(current_class)->is_subclass_of(resolved_class) ||
|
||||
Klass::cast(resolved_class)->is_subclass_of(current_class)) {
|
||||
current_class->is_subclass_of(resolved_class) ||
|
||||
resolved_class->is_subclass_of(current_class)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -566,7 +566,7 @@ bool Reflection::verify_field_access(Klass* current_class,
|
||||
// sun/reflect/MagicAccessorImpl subclasses to succeed trivially.
|
||||
if ( JDK_Version::is_gte_jdk14x_version()
|
||||
&& UseNewReflection
|
||||
&& Klass::cast(current_class)->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) {
|
||||
&& current_class->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -693,7 +693,7 @@ Handle Reflection::new_type(Symbol* signature, KlassHandle k, TRAPS) {
|
||||
}
|
||||
|
||||
oop loader = InstanceKlass::cast(k())->class_loader();
|
||||
oop protection_domain = Klass::cast(k())->protection_domain();
|
||||
oop protection_domain = k()->protection_domain();
|
||||
Klass* result = SystemDictionary::resolve_or_fail(signature,
|
||||
Handle(THREAD, loader),
|
||||
Handle(THREAD, protection_domain),
|
||||
@ -703,7 +703,7 @@ Handle Reflection::new_type(Symbol* signature, KlassHandle k, TRAPS) {
|
||||
trace_class_resolution(result);
|
||||
}
|
||||
|
||||
oop nt = Klass::cast(result)->java_mirror();
|
||||
oop nt = result->java_mirror();
|
||||
return Handle(THREAD, nt);
|
||||
}
|
||||
|
||||
@ -937,7 +937,7 @@ oop Reflection::invoke(instanceKlassHandle klass, methodHandle reflected_method,
|
||||
ResourceMark rm(THREAD);
|
||||
Handle h_origexception = Exceptions::new_exception(THREAD,
|
||||
vmSymbols::java_lang_AbstractMethodError(),
|
||||
Method::name_and_sig_as_C_string(Klass::cast(target_klass()),
|
||||
Method::name_and_sig_as_C_string(target_klass(),
|
||||
method->name(),
|
||||
method->signature()));
|
||||
JavaCallArguments args(h_origexception);
|
||||
@ -947,7 +947,7 @@ oop Reflection::invoke(instanceKlassHandle klass, methodHandle reflected_method,
|
||||
} else {
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_MSG_0(vmSymbols::java_lang_AbstractMethodError(),
|
||||
Method::name_and_sig_as_C_string(Klass::cast(target_klass()),
|
||||
Method::name_and_sig_as_C_string(target_klass(),
|
||||
method->name(),
|
||||
method->signature()));
|
||||
}
|
||||
@ -962,7 +962,7 @@ oop Reflection::invoke(instanceKlassHandle klass, methodHandle reflected_method,
|
||||
if (method.is_null()) {
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_MSG_0(vmSymbols::java_lang_NoSuchMethodError(),
|
||||
Method::name_and_sig_as_C_string(Klass::cast(klass()),
|
||||
Method::name_and_sig_as_C_string(klass(),
|
||||
reflected_method->name(),
|
||||
reflected_method->signature()));
|
||||
}
|
||||
|
@ -1775,7 +1775,7 @@ JRT_ENTRY(void, SharedRuntime::slow_arraycopy_C(oopDesc* src, jint src_pos,
|
||||
// The copy_array mechanism is awkward and could be removed, but
|
||||
// the compilers don't call this function except as a last resort,
|
||||
// so it probably doesn't matter.
|
||||
Klass::cast(src->klass())->copy_array((arrayOopDesc*)src, src_pos,
|
||||
src->klass()->copy_array((arrayOopDesc*)src, src_pos,
|
||||
(arrayOopDesc*)dest, dest_pos,
|
||||
length, thread);
|
||||
}
|
||||
@ -1788,8 +1788,8 @@ char* SharedRuntime::generate_class_cast_message(
|
||||
vframeStream vfst(thread, true);
|
||||
assert(!vfst.at_end(), "Java frame must exist");
|
||||
Bytecode_checkcast cc(vfst.method(), vfst.method()->bcp_from(vfst.bci()));
|
||||
Klass* targetKlass = Klass::cast(vfst.method()->constants()->klass_at(
|
||||
cc.index(), thread));
|
||||
Klass* targetKlass = vfst.method()->constants()->klass_at(
|
||||
cc.index(), thread);
|
||||
return generate_class_cast_message(objName, targetKlass->external_name());
|
||||
}
|
||||
|
||||
|
@ -354,7 +354,7 @@ oop SignatureStream::as_java_mirror(Handle class_loader, Handle protection_domai
|
||||
return Universe::java_mirror(type());
|
||||
Klass* klass = as_klass(class_loader, protection_domain, failure_mode, CHECK_NULL);
|
||||
if (klass == NULL) return NULL;
|
||||
return Klass::cast(klass)->java_mirror();
|
||||
return klass->java_mirror();
|
||||
}
|
||||
|
||||
Symbol* SignatureStream::as_symbol_or_null() {
|
||||
|
@ -1323,7 +1323,7 @@ ObjectMonitor * ATTR ObjectSynchronizer::inflate (Thread * Self, oop object) {
|
||||
ResourceMark rm;
|
||||
tty->print_cr("Inflating object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s",
|
||||
(intptr_t) object, (intptr_t) object->mark(),
|
||||
Klass::cast(object->klass())->external_name());
|
||||
object->klass()->external_name());
|
||||
}
|
||||
}
|
||||
return m ;
|
||||
@ -1373,7 +1373,7 @@ ObjectMonitor * ATTR ObjectSynchronizer::inflate (Thread * Self, oop object) {
|
||||
ResourceMark rm;
|
||||
tty->print_cr("Inflating object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s",
|
||||
(intptr_t) object, (intptr_t) object->mark(),
|
||||
Klass::cast(object->klass())->external_name());
|
||||
object->klass()->external_name());
|
||||
}
|
||||
}
|
||||
return m ;
|
||||
@ -1440,7 +1440,7 @@ bool ObjectSynchronizer::deflate_monitor(ObjectMonitor* mid, oop obj,
|
||||
if (obj->is_instance()) {
|
||||
ResourceMark rm;
|
||||
tty->print_cr("Deflating object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s",
|
||||
(intptr_t) obj, (intptr_t) obj->mark(), Klass::cast(obj->klass())->external_name());
|
||||
(intptr_t) obj, (intptr_t) obj->mark(), obj->klass()->external_name());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1785,7 +1785,7 @@ void JavaThread::exit(bool destroy_vm, ExitType exit_type) {
|
||||
jio_fprintf(defaultStream::error_stream(),
|
||||
"\nException: %s thrown from the UncaughtExceptionHandler"
|
||||
" in thread \"%s\"\n",
|
||||
Klass::cast(pending_exception()->klass())->external_name(),
|
||||
pending_exception()->klass()->external_name(),
|
||||
get_thread_name());
|
||||
CLEAR_PENDING_EXCEPTION;
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ static void print_locked_object_class_name(outputStream* st, Handle obj, const c
|
||||
Klass* target_klass = java_lang_Class::as_Klass(obj());
|
||||
st->print_cr("(a java.lang.Class for %s)", InstanceKlass::cast(target_klass)->external_name());
|
||||
} else {
|
||||
Klass* k = Klass::cast(obj->klass());
|
||||
Klass* k = obj->klass();
|
||||
st->print_cr("(a %s)", k->external_name());
|
||||
}
|
||||
}
|
||||
@ -172,7 +172,7 @@ void javaVFrame::print_lock_info_on(outputStream* st, int frame_count) {
|
||||
}
|
||||
} else if (thread()->current_park_blocker() != NULL) {
|
||||
oop obj = thread()->current_park_blocker();
|
||||
Klass* k = Klass::cast(obj->klass());
|
||||
Klass* k = obj->klass();
|
||||
st->print_cr("\t- %s <" INTPTR_FORMAT "> (a %s)", "parking to wait for ", (address)obj, k->external_name());
|
||||
}
|
||||
}
|
||||
@ -550,7 +550,7 @@ void javaVFrame::print_value() const {
|
||||
InstanceKlass* k = m->method_holder();
|
||||
tty->print_cr("frame( sp=" INTPTR_FORMAT ", unextended_sp=" INTPTR_FORMAT ", fp=" INTPTR_FORMAT ", pc=" INTPTR_FORMAT ")",
|
||||
_fr.sp(), _fr.unextended_sp(), _fr.fp(), _fr.pc());
|
||||
tty->print("%s.%s", Klass::cast(k)->internal_name(), m->name()->as_C_string());
|
||||
tty->print("%s.%s", k->internal_name(), m->name()->as_C_string());
|
||||
|
||||
if (!m->is_native()) {
|
||||
Symbol* source_name = k->source_file_name();
|
||||
|
@ -135,7 +135,7 @@ public:
|
||||
// The spec is unclear at this point to count array klasses or not
|
||||
// and also indirect creation of array of super class and secondaries
|
||||
//
|
||||
// for (Klass* l = k; l != NULL; l = Klass::cast(l)->array_klass_or_null()) {
|
||||
// for (Klass* l = k; l != NULL; l = l->array_klass_or_null()) {
|
||||
// KlassHandle h(_current_thread, l);
|
||||
// _loaded_classes->append(h);
|
||||
// }
|
||||
|
@ -879,7 +879,7 @@ void DumperSupport::dump_instance(DumpWriter* writer, oop o) {
|
||||
writer->write_u4(STACK_TRACE_ID);
|
||||
|
||||
// class ID
|
||||
writer->write_classID(Klass::cast(k));
|
||||
writer->write_classID(k);
|
||||
|
||||
// number of bytes that follow
|
||||
writer->write_u4(instance_size(k) );
|
||||
@ -891,7 +891,7 @@ void DumperSupport::dump_instance(DumpWriter* writer, oop o) {
|
||||
// creates HPROF_GC_CLASS_DUMP record for the given class and each of
|
||||
// its array classes
|
||||
void DumperSupport::dump_class_and_array_classes(DumpWriter* writer, Klass* k) {
|
||||
Klass* klass = Klass::cast(k);
|
||||
Klass* klass = k;
|
||||
assert(klass->oop_is_instance(), "not an InstanceKlass");
|
||||
InstanceKlass* ik = (InstanceKlass*)klass;
|
||||
|
||||
@ -906,7 +906,7 @@ void DumperSupport::dump_class_and_array_classes(DumpWriter* writer, Klass* k) {
|
||||
if (java_super == NULL) {
|
||||
writer->write_objectID(oop(NULL));
|
||||
} else {
|
||||
writer->write_classID(Klass::cast(java_super));
|
||||
writer->write_classID(java_super);
|
||||
}
|
||||
|
||||
writer->write_objectID(ik->class_loader());
|
||||
@ -932,7 +932,7 @@ void DumperSupport::dump_class_and_array_classes(DumpWriter* writer, Klass* k) {
|
||||
// array classes
|
||||
k = klass->array_klass_or_null();
|
||||
while (k != NULL) {
|
||||
Klass* klass = Klass::cast(k);
|
||||
Klass* klass = k;
|
||||
assert(klass->oop_is_objArray(), "not an ObjArrayKlass");
|
||||
|
||||
writer->write_u1(HPROF_GC_CLASS_DUMP);
|
||||
@ -942,7 +942,7 @@ void DumperSupport::dump_class_and_array_classes(DumpWriter* writer, Klass* k) {
|
||||
// super class of array classes is java.lang.Object
|
||||
java_super = klass->java_super();
|
||||
assert(java_super != NULL, "checking");
|
||||
writer->write_classID(Klass::cast(java_super));
|
||||
writer->write_classID(java_super);
|
||||
|
||||
writer->write_objectID(ik->class_loader());
|
||||
writer->write_objectID(ik->signers());
|
||||
@ -965,7 +965,7 @@ void DumperSupport::dump_class_and_array_classes(DumpWriter* writer, Klass* k) {
|
||||
void DumperSupport::dump_basic_type_array_class(DumpWriter* writer, Klass* k) {
|
||||
// array classes
|
||||
while (k != NULL) {
|
||||
Klass* klass = Klass::cast(k);
|
||||
Klass* klass = k;
|
||||
|
||||
writer->write_u1(HPROF_GC_CLASS_DUMP);
|
||||
writer->write_classID(klass);
|
||||
@ -974,7 +974,7 @@ void DumperSupport::dump_basic_type_array_class(DumpWriter* writer, Klass* k) {
|
||||
// super class of array classes is java.lang.Object
|
||||
Klass* java_super = klass->java_super();
|
||||
assert(java_super != NULL, "checking");
|
||||
writer->write_classID(Klass::cast(java_super));
|
||||
writer->write_classID(java_super);
|
||||
|
||||
writer->write_objectID(oop(NULL)); // loader
|
||||
writer->write_objectID(oop(NULL)); // signers
|
||||
@ -1001,7 +1001,7 @@ void DumperSupport::dump_object_array(DumpWriter* writer, objArrayOop array) {
|
||||
writer->write_u4((u4)array->length());
|
||||
|
||||
// array class ID
|
||||
writer->write_classID(Klass::cast(array->klass()));
|
||||
writer->write_classID(array->klass());
|
||||
|
||||
// [id]* elements
|
||||
for (int index=0; index<array->length(); index++) {
|
||||
@ -1525,7 +1525,7 @@ void VM_HeapDumper::do_load_class(Klass* k) {
|
||||
writer()->write_u4(++class_serial_num);
|
||||
|
||||
// class ID
|
||||
Klass* klass = Klass::cast(k);
|
||||
Klass* klass = k;
|
||||
writer()->write_classID(klass);
|
||||
|
||||
// add the Klass* and class serial number pair
|
||||
@ -1796,7 +1796,7 @@ void VM_HeapDumper::dump_stack_traces() {
|
||||
// write fake frame that makes it look like the thread, which caused OOME,
|
||||
// is in the OutOfMemoryError zero-parameter constructor
|
||||
if (thread == _oome_thread && _oome_constructor != NULL) {
|
||||
int oome_serial_num = _klass_map->find(Klass::cast(_oome_constructor->method_holder()));
|
||||
int oome_serial_num = _klass_map->find(_oome_constructor->method_holder());
|
||||
// the class serial number starts from 1
|
||||
assert(oome_serial_num > 0, "OutOfMemoryError class not found");
|
||||
DumperSupport::dump_stack_frame(writer(), ++frame_serial_num, oome_serial_num,
|
||||
@ -1806,7 +1806,7 @@ void VM_HeapDumper::dump_stack_traces() {
|
||||
for (int j=0; j < depth; j++) {
|
||||
StackFrameInfo* frame = stack_trace->stack_frame_at(j);
|
||||
Method* m = frame->method();
|
||||
int class_serial_num = _klass_map->find(Klass::cast(m->method_holder()));
|
||||
int class_serial_num = _klass_map->find(m->method_holder());
|
||||
// the class serial number starts from 1
|
||||
assert(class_serial_num > 0, "class not found");
|
||||
DumperSupport::dump_stack_frame(writer(), ++frame_serial_num, class_serial_num, m, frame->bci());
|
||||
|
@ -1417,7 +1417,7 @@ JVM_ENTRY(jobjectArray, jmm_GetLoadedClasses(JNIEnv *env))
|
||||
|
||||
for (int i = 0; i < num_classes; i++) {
|
||||
KlassHandle kh = lce.get_klass(i);
|
||||
oop mirror = Klass::cast(kh())->java_mirror();
|
||||
oop mirror = kh()->java_mirror();
|
||||
classes_ah->obj_at_put(i, mirror);
|
||||
}
|
||||
|
||||
|
@ -115,17 +115,25 @@ bool MemBaseline::baseline_malloc_summary(const MemPointerArray* malloc_records)
|
||||
while (malloc_ptr != NULL) {
|
||||
index = flag2index(FLAGS_TO_MEMORY_TYPE(malloc_ptr->flags()));
|
||||
size_t size = malloc_ptr->size();
|
||||
_total_malloced += size;
|
||||
_malloc_data[index].inc(size);
|
||||
if (MemPointerRecord::is_arena_record(malloc_ptr->flags())) {
|
||||
// see if arena size record present
|
||||
MemPointerRecord* next_malloc_ptr = (MemPointerRecordEx*)malloc_itr.peek_next();
|
||||
if (MemPointerRecord::is_arena_size_record(next_malloc_ptr->flags())) {
|
||||
assert(next_malloc_ptr->is_size_record_of_arena(malloc_ptr), "arena records do not match");
|
||||
size = next_malloc_ptr->size();
|
||||
_arena_data[index].inc(size);
|
||||
used_arena_size += size;
|
||||
malloc_itr.next();
|
||||
if (malloc_ptr->is_arena_memory_record()) {
|
||||
// We do have anonymous arenas, they are either used as value objects,
|
||||
// which are embedded inside other objects, or used as stack objects.
|
||||
_arena_data[index].inc(size);
|
||||
used_arena_size += size;
|
||||
} else {
|
||||
_total_malloced += size;
|
||||
_malloc_data[index].inc(size);
|
||||
if (malloc_ptr->is_arena_record()) {
|
||||
// see if arena memory record present
|
||||
MemPointerRecord* next_malloc_ptr = (MemPointerRecordEx*)malloc_itr.peek_next();
|
||||
if (next_malloc_ptr->is_arena_memory_record()) {
|
||||
assert(next_malloc_ptr->is_memory_record_of_arena(malloc_ptr),
|
||||
"Arena records do not match");
|
||||
size = next_malloc_ptr->size();
|
||||
_arena_data[index].inc(size);
|
||||
used_arena_size += size;
|
||||
malloc_itr.next();
|
||||
}
|
||||
}
|
||||
}
|
||||
malloc_ptr = (MemPointerRecordEx*)malloc_itr.next();
|
||||
@ -193,7 +201,7 @@ bool MemBaseline::baseline_malloc_details(const MemPointerArray* malloc_records)
|
||||
|
||||
// baseline memory that is totaled over 1 KB
|
||||
while (malloc_ptr != NULL) {
|
||||
if (!MemPointerRecord::is_arena_size_record(malloc_ptr->flags())) {
|
||||
if (!MemPointerRecord::is_arena_memory_record(malloc_ptr->flags())) {
|
||||
// skip thread stacks
|
||||
if (!IS_MEMORY_TYPE(malloc_ptr->flags(), mtThreadStack)) {
|
||||
if (malloc_callsite.addr() != malloc_ptr->pc()) {
|
||||
|
@ -165,7 +165,7 @@ public:
|
||||
return (flags & (otArena | tag_size)) == otArena;
|
||||
}
|
||||
|
||||
inline static bool is_arena_size_record(MEMFLAGS flags) {
|
||||
inline static bool is_arena_memory_record(MEMFLAGS flags) {
|
||||
return (flags & (otArena | tag_size)) == (otArena | tag_size);
|
||||
}
|
||||
|
||||
@ -256,8 +256,8 @@ public:
|
||||
}
|
||||
|
||||
// if this record records a size information of an arena
|
||||
inline bool is_arena_size_record() const {
|
||||
return is_arena_size_record(_flags);
|
||||
inline bool is_arena_memory_record() const {
|
||||
return is_arena_memory_record(_flags);
|
||||
}
|
||||
|
||||
// if this pointer represents an address to an arena object
|
||||
@ -266,8 +266,8 @@ public:
|
||||
}
|
||||
|
||||
// if this record represents a size information of specific arena
|
||||
inline bool is_size_record_of_arena(const MemPointerRecord* arena_rc) {
|
||||
assert(is_arena_size_record(), "not size record");
|
||||
inline bool is_memory_record_of_arena(const MemPointerRecord* arena_rc) {
|
||||
assert(is_arena_memory_record(), "not size record");
|
||||
assert(arena_rc->is_arena_record(), "not arena record");
|
||||
return (arena_rc->addr() + sizeof(void*)) == addr();
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ void decode_pointer_record(MemPointerRecord* rec) {
|
||||
tty->print_cr(" (tag)");
|
||||
}
|
||||
} else {
|
||||
if (rec->is_arena_size_record()) {
|
||||
if (rec->is_arena_memory_record()) {
|
||||
tty->print_cr(" (arena size)");
|
||||
} else if (rec->is_allocation_record()) {
|
||||
tty->print_cr(" (malloc)");
|
||||
@ -123,20 +123,31 @@ bool VMMemPointerIterator::insert_record_after(MemPointerRecord* rec) {
|
||||
// in different types.
|
||||
bool VMMemPointerIterator::add_reserved_region(MemPointerRecord* rec) {
|
||||
assert(rec->is_allocation_record(), "Sanity check");
|
||||
VMMemRegion* cur = (VMMemRegion*)current();
|
||||
VMMemRegion* reserved_region = (VMMemRegion*)current();
|
||||
|
||||
// we don't have anything yet
|
||||
if (cur == NULL) {
|
||||
if (reserved_region == NULL) {
|
||||
return insert_record(rec);
|
||||
}
|
||||
|
||||
assert(cur->is_reserved_region(), "Sanity check");
|
||||
assert(reserved_region->is_reserved_region(), "Sanity check");
|
||||
// duplicated records
|
||||
if (cur->is_same_region(rec)) {
|
||||
if (reserved_region->is_same_region(rec)) {
|
||||
return true;
|
||||
}
|
||||
assert(cur->base() > rec->addr(), "Just check: locate()");
|
||||
assert(!cur->overlaps_region(rec), "overlapping reserved regions");
|
||||
// Overlapping stack regions indicate that a JNI thread failed to
|
||||
// detach from the VM before exiting. This leaks the JavaThread object.
|
||||
if (CheckJNICalls) {
|
||||
guarantee(FLAGS_TO_MEMORY_TYPE(reserved_region->flags()) != mtThreadStack ||
|
||||
!reserved_region->overlaps_region(rec),
|
||||
"Attached JNI thread exited without being detached");
|
||||
}
|
||||
// otherwise, we should not have overlapping reserved regions
|
||||
assert(FLAGS_TO_MEMORY_TYPE(reserved_region->flags()) == mtThreadStack ||
|
||||
reserved_region->base() > rec->addr(), "Just check: locate()");
|
||||
assert(FLAGS_TO_MEMORY_TYPE(reserved_region->flags()) == mtThreadStack ||
|
||||
!reserved_region->overlaps_region(rec), "overlapping reserved regions");
|
||||
|
||||
return insert_record(rec);
|
||||
}
|
||||
|
||||
@ -390,21 +401,31 @@ MemSnapshot::~MemSnapshot() {
|
||||
}
|
||||
}
|
||||
|
||||
void MemSnapshot::copy_pointer(MemPointerRecord* dest, const MemPointerRecord* src) {
|
||||
|
||||
void MemSnapshot::copy_seq_pointer(MemPointerRecord* dest, const MemPointerRecord* src) {
|
||||
assert(dest != NULL && src != NULL, "Just check");
|
||||
assert(dest->addr() == src->addr(), "Just check");
|
||||
assert(dest->seq() > 0 && src->seq() > 0, "not sequenced");
|
||||
|
||||
MEMFLAGS flags = dest->flags();
|
||||
if (MemTracker::track_callsite()) {
|
||||
*(SeqMemPointerRecordEx*)dest = *(SeqMemPointerRecordEx*)src;
|
||||
} else {
|
||||
*(SeqMemPointerRecord*)dest = *(SeqMemPointerRecord*)src;
|
||||
}
|
||||
}
|
||||
|
||||
void MemSnapshot::assign_pointer(MemPointerRecord*dest, const MemPointerRecord* src) {
|
||||
assert(src != NULL && dest != NULL, "Just check");
|
||||
assert(dest->seq() == 0 && src->seq() >0, "cast away sequence");
|
||||
|
||||
if (MemTracker::track_callsite()) {
|
||||
*(MemPointerRecordEx*)dest = *(MemPointerRecordEx*)src;
|
||||
} else {
|
||||
*dest = *src;
|
||||
*(MemPointerRecord*)dest = *(MemPointerRecord*)src;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// merge a per-thread memory recorder to the staging area
|
||||
// merge a recorder to the staging area
|
||||
bool MemSnapshot::merge(MemRecorder* rec) {
|
||||
assert(rec != NULL && !rec->out_of_memory(), "Just check");
|
||||
|
||||
@ -412,71 +433,45 @@ bool MemSnapshot::merge(MemRecorder* rec) {
|
||||
|
||||
MutexLockerEx lock(_lock, true);
|
||||
MemPointerIterator malloc_staging_itr(_staging_area.malloc_data());
|
||||
MemPointerRecord *p1, *p2;
|
||||
p1 = (MemPointerRecord*) itr.current();
|
||||
while (p1 != NULL) {
|
||||
if (p1->is_vm_pointer()) {
|
||||
MemPointerRecord* incoming_rec = (MemPointerRecord*) itr.current();
|
||||
MemPointerRecord* matched_rec;
|
||||
|
||||
while (incoming_rec != NULL) {
|
||||
if (incoming_rec->is_vm_pointer()) {
|
||||
// we don't do anything with virtual memory records during merge
|
||||
if (!_staging_area.vm_data()->append(p1)) {
|
||||
if (!_staging_area.vm_data()->append(incoming_rec)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// locate matched record and/or also position the iterator to proper
|
||||
// location for this incoming record.
|
||||
p2 = (MemPointerRecord*)malloc_staging_itr.locate(p1->addr());
|
||||
// we have not seen this memory block, so just add to staging area
|
||||
if (p2 == NULL) {
|
||||
if (!malloc_staging_itr.insert(p1)) {
|
||||
matched_rec = (MemPointerRecord*)malloc_staging_itr.locate(incoming_rec->addr());
|
||||
// we have not seen this memory block in this generation,
|
||||
// so just add to staging area
|
||||
if (matched_rec == NULL) {
|
||||
if (!malloc_staging_itr.insert(incoming_rec)) {
|
||||
return false;
|
||||
}
|
||||
} else if (p1->addr() == p2->addr()) {
|
||||
MemPointerRecord* staging_next = (MemPointerRecord*)malloc_staging_itr.peek_next();
|
||||
// a memory block can have many tagging records, find right one to replace or
|
||||
// right position to insert
|
||||
while (staging_next != NULL && staging_next->addr() == p1->addr()) {
|
||||
if ((staging_next->flags() & MemPointerRecord::tag_masks) <=
|
||||
(p1->flags() & MemPointerRecord::tag_masks)) {
|
||||
p2 = (MemPointerRecord*)malloc_staging_itr.next();
|
||||
staging_next = (MemPointerRecord*)malloc_staging_itr.peek_next();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else if (incoming_rec->addr() == matched_rec->addr()) {
|
||||
// whoever has higher sequence number wins
|
||||
if (incoming_rec->seq() > matched_rec->seq()) {
|
||||
copy_seq_pointer(matched_rec, incoming_rec);
|
||||
}
|
||||
int df = (p1->flags() & MemPointerRecord::tag_masks) -
|
||||
(p2->flags() & MemPointerRecord::tag_masks);
|
||||
if (df == 0) {
|
||||
assert(p1->seq() > 0, "not sequenced");
|
||||
assert(p2->seq() > 0, "not sequenced");
|
||||
if (p1->seq() > p2->seq()) {
|
||||
copy_pointer(p2, p1);
|
||||
}
|
||||
} else if (df < 0) {
|
||||
if (!malloc_staging_itr.insert(p1)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!malloc_staging_itr.insert_after(p1)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (p1->addr() < p2->addr()) {
|
||||
if (!malloc_staging_itr.insert(p1)) {
|
||||
} else if (incoming_rec->addr() < matched_rec->addr()) {
|
||||
if (!malloc_staging_itr.insert(incoming_rec)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!malloc_staging_itr.insert_after(p1)) {
|
||||
return false;
|
||||
}
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
}
|
||||
p1 = (MemPointerRecord*)itr.next();
|
||||
incoming_rec = (MemPointerRecord*)itr.next();
|
||||
}
|
||||
NOT_PRODUCT(void check_staging_data();)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// promote data to next generation
|
||||
bool MemSnapshot::promote() {
|
||||
assert(_alloc_ptrs != NULL && _vm_ptrs != NULL, "Just check");
|
||||
@ -507,20 +502,25 @@ bool MemSnapshot::promote_malloc_records(MemPointerArrayIterator* itr) {
|
||||
// found matched memory block
|
||||
if (matched_rec != NULL && new_rec->addr() == matched_rec->addr()) {
|
||||
// snapshot already contains 'live' records
|
||||
assert(matched_rec->is_allocation_record() || matched_rec->is_arena_size_record(),
|
||||
assert(matched_rec->is_allocation_record() || matched_rec->is_arena_memory_record(),
|
||||
"Sanity check");
|
||||
// update block states
|
||||
if (new_rec->is_allocation_record() || new_rec->is_arena_size_record()) {
|
||||
copy_pointer(matched_rec, new_rec);
|
||||
if (new_rec->is_allocation_record()) {
|
||||
assign_pointer(matched_rec, new_rec);
|
||||
} else if (new_rec->is_arena_memory_record()) {
|
||||
if (new_rec->size() == 0) {
|
||||
// remove size record once size drops to 0
|
||||
malloc_snapshot_itr.remove();
|
||||
} else {
|
||||
assign_pointer(matched_rec, new_rec);
|
||||
}
|
||||
} else {
|
||||
// a deallocation record
|
||||
assert(new_rec->is_deallocation_record(), "Sanity check");
|
||||
// an arena record can be followed by a size record, we need to remove both
|
||||
if (matched_rec->is_arena_record()) {
|
||||
MemPointerRecord* next = (MemPointerRecord*)malloc_snapshot_itr.peek_next();
|
||||
if (next->is_arena_size_record()) {
|
||||
// it has to match the arena record
|
||||
assert(next->is_size_record_of_arena(matched_rec), "Sanity check");
|
||||
if (next->is_arena_memory_record() && next->is_memory_record_of_arena(matched_rec)) {
|
||||
malloc_snapshot_itr.remove();
|
||||
}
|
||||
}
|
||||
@ -528,17 +528,13 @@ bool MemSnapshot::promote_malloc_records(MemPointerArrayIterator* itr) {
|
||||
malloc_snapshot_itr.remove();
|
||||
}
|
||||
} else {
|
||||
// it is a new record, insert into snapshot
|
||||
if (new_rec->is_arena_size_record()) {
|
||||
MemPointerRecord* prev = (MemPointerRecord*)malloc_snapshot_itr.peek_prev();
|
||||
if (prev == NULL || !prev->is_arena_record() || !new_rec->is_size_record_of_arena(prev)) {
|
||||
// no matched arena record, ignore the size record
|
||||
new_rec = NULL;
|
||||
}
|
||||
// don't insert size 0 record
|
||||
if (new_rec->is_arena_memory_record() && new_rec->size() == 0) {
|
||||
new_rec = NULL;
|
||||
}
|
||||
// only 'live' record can go into snapshot
|
||||
|
||||
if (new_rec != NULL) {
|
||||
if (new_rec->is_allocation_record() || new_rec->is_arena_size_record()) {
|
||||
if (new_rec->is_allocation_record() || new_rec->is_arena_memory_record()) {
|
||||
if (matched_rec != NULL && new_rec->addr() > matched_rec->addr()) {
|
||||
if (!malloc_snapshot_itr.insert_after(new_rec)) {
|
||||
return false;
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "services/memBaseline.hpp"
|
||||
#include "services/memPtrArray.hpp"
|
||||
|
||||
|
||||
// Snapshot pointer array iterator
|
||||
|
||||
// The pointer array contains malloc-ed pointers
|
||||
@ -165,39 +164,58 @@ class VMMemPointerIterator : public MemPointerIterator {
|
||||
};
|
||||
|
||||
class MallocRecordIterator : public MemPointerArrayIterator {
|
||||
protected:
|
||||
private:
|
||||
MemPointerArrayIteratorImpl _itr;
|
||||
|
||||
|
||||
|
||||
public:
|
||||
MallocRecordIterator(MemPointerArray* arr) : _itr(arr) {
|
||||
}
|
||||
|
||||
virtual MemPointer* current() const {
|
||||
MemPointerRecord* cur = (MemPointerRecord*)_itr.current();
|
||||
assert(cur == NULL || !cur->is_vm_pointer(), "seek error");
|
||||
MemPointerRecord* next = (MemPointerRecord*)_itr.peek_next();
|
||||
if (next == NULL || next->addr() != cur->addr()) {
|
||||
return cur;
|
||||
} else {
|
||||
assert(!cur->is_vm_pointer(), "Sanity check");
|
||||
assert(cur->is_allocation_record() && next->is_deallocation_record(),
|
||||
"sorting order");
|
||||
assert(cur->seq() != next->seq(), "Sanity check");
|
||||
return cur->seq() > next->seq() ? cur : next;
|
||||
#ifdef ASSERT
|
||||
MemPointer* cur_rec = _itr.current();
|
||||
if (cur_rec != NULL) {
|
||||
MemPointer* prev_rec = _itr.peek_prev();
|
||||
MemPointer* next_rec = _itr.peek_next();
|
||||
assert(prev_rec == NULL || prev_rec->addr() < cur_rec->addr(), "Sorting order");
|
||||
assert(next_rec == NULL || next_rec->addr() > cur_rec->addr(), "Sorting order");
|
||||
}
|
||||
#endif
|
||||
return _itr.current();
|
||||
}
|
||||
|
||||
virtual MemPointer* next() {
|
||||
MemPointerRecord* cur = (MemPointerRecord*)_itr.current();
|
||||
assert(cur == NULL || !cur->is_vm_pointer(), "Sanity check");
|
||||
MemPointerRecord* next = (MemPointerRecord*)_itr.next();
|
||||
if (next == NULL) {
|
||||
return NULL;
|
||||
MemPointerRecord* next_rec = (MemPointerRecord*)_itr.next();
|
||||
// arena memory record is a special case, which we have to compare
|
||||
// sequence number against its associated arena record.
|
||||
if (next_rec != NULL && next_rec->is_arena_memory_record()) {
|
||||
MemPointerRecord* prev_rec = (MemPointerRecord*)_itr.peek_prev();
|
||||
// if there is an associated arena record, it has to be previous
|
||||
// record because of sorting order (by address) - NMT generates a pseudo address
|
||||
// for arena's size record by offsetting arena's address, that guarantees
|
||||
// the order of arena record and it's size record.
|
||||
if (prev_rec != NULL && prev_rec->is_arena_record() &&
|
||||
next_rec->is_memory_record_of_arena(prev_rec)) {
|
||||
if (prev_rec->seq() > next_rec->seq()) {
|
||||
// Skip this arena memory record
|
||||
// Two scenarios:
|
||||
// - if the arena record is an allocation record, this early
|
||||
// size record must be leftover by previous arena,
|
||||
// and the last size record should have size = 0.
|
||||
// - if the arena record is a deallocation record, this
|
||||
// size record should be its cleanup record, which should
|
||||
// also have size = 0. In other world, arena alway reset
|
||||
// its size before gone (see Arena's destructor)
|
||||
assert(next_rec->size() == 0, "size not reset");
|
||||
return _itr.next();
|
||||
} else {
|
||||
assert(prev_rec->is_allocation_record(),
|
||||
"Arena size record ahead of allocation record");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cur->addr() == next->addr()) {
|
||||
next = (MemPointerRecord*)_itr.next();
|
||||
}
|
||||
return current();
|
||||
return next_rec;
|
||||
}
|
||||
|
||||
MemPointer* peek_next() const { ShouldNotReachHere(); return NULL; }
|
||||
@ -213,9 +231,12 @@ class MallocRecordIterator : public MemPointerArrayIterator {
|
||||
// still chances seeing duplicated records during promotion.
|
||||
// We want to use the record with higher sequence number, because it has
|
||||
// more accurate callsite pc.
|
||||
class VMRecordIterator : public MallocRecordIterator {
|
||||
class VMRecordIterator : public MemPointerArrayIterator {
|
||||
private:
|
||||
MemPointerArrayIteratorImpl _itr;
|
||||
|
||||
public:
|
||||
VMRecordIterator(MemPointerArray* arr) : MallocRecordIterator(arr) {
|
||||
VMRecordIterator(MemPointerArray* arr) : _itr(arr) {
|
||||
MemPointerRecord* cur = (MemPointerRecord*)_itr.current();
|
||||
MemPointerRecord* next = (MemPointerRecord*)_itr.peek_next();
|
||||
while (next != NULL) {
|
||||
@ -256,6 +277,12 @@ class VMRecordIterator : public MallocRecordIterator {
|
||||
return cur;
|
||||
}
|
||||
|
||||
MemPointer* peek_next() const { ShouldNotReachHere(); return NULL; }
|
||||
MemPointer* peek_prev() const { ShouldNotReachHere(); return NULL; }
|
||||
void remove() { ShouldNotReachHere(); }
|
||||
bool insert(MemPointer* ptr) { ShouldNotReachHere(); return false; }
|
||||
bool insert_after(MemPointer* ptr) { ShouldNotReachHere(); return false; }
|
||||
|
||||
private:
|
||||
bool is_duplicated_record(MemPointerRecord* p1, MemPointerRecord* p2) const {
|
||||
bool ret = (p1->addr() == p2->addr() && p1->size() == p2->size() && p1->flags() == p2->flags());
|
||||
@ -348,8 +375,10 @@ class MemSnapshot : public CHeapObj<mtNMT> {
|
||||
DEBUG_ONLY( void dump_all_vm_pointers();)
|
||||
|
||||
private:
|
||||
// copy pointer data from src to dest
|
||||
void copy_pointer(MemPointerRecord* dest, const MemPointerRecord* src);
|
||||
// copy sequenced pointer from src to dest
|
||||
void copy_seq_pointer(MemPointerRecord* dest, const MemPointerRecord* src);
|
||||
// assign a sequenced pointer to non-sequenced pointer
|
||||
void assign_pointer(MemPointerRecord*dest, const MemPointerRecord* src);
|
||||
|
||||
bool promote_malloc_records(MemPointerArrayIterator* itr);
|
||||
bool promote_virtual_memory_records(MemPointerArrayIterator* itr);
|
||||
|
@ -284,14 +284,14 @@ class MemTracker : AllStatic {
|
||||
}
|
||||
}
|
||||
|
||||
// record arena size
|
||||
// record arena memory size
|
||||
static inline void record_arena_size(address addr, size_t size) {
|
||||
// we add a positive offset to arena address, so we can have arena size record
|
||||
// we add a positive offset to arena address, so we can have arena memory record
|
||||
// sorted after arena record
|
||||
if (is_on() && !UseMallocOnly) {
|
||||
assert(addr != NULL, "Sanity check");
|
||||
create_memory_record((addr + sizeof(void*)), MemPointerRecord::arena_size_tag(), size,
|
||||
0, NULL);
|
||||
DEBUG_CALLER_PC, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,14 +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.
|
||||
Klass* klass = k;
|
||||
if (Klass::cast(klass)->oop_is_instance()) {
|
||||
if (k->oop_is_instance()) {
|
||||
return true;
|
||||
}
|
||||
if (Klass::cast(klass)->oop_is_objArray()) {
|
||||
if (k->oop_is_objArray()) {
|
||||
return true;
|
||||
}
|
||||
if (Klass::cast(klass)->oop_is_typeArray()) {
|
||||
if (k->oop_is_typeArray()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -327,6 +327,12 @@ typedef jlong s8;
|
||||
const int max_method_code_size = 64*K - 1; // JVM spec, 2nd ed. section 4.8.1 (p.134)
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Minimum StringTableSize value
|
||||
|
||||
const int defaultStringTableSize=1009;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// HotSwap - for JVMTI aka Class File Replacement and PopFrame
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user