8000725: NPG: method_holder() and pool_holder() and pool_holder field should be InstanceKlass

Change types of above methods and field to InstanceKlass and remove unneeded casts from the source files.

Reviewed-by: dholmes, coleenp, zgu
This commit is contained in:
Harold Seigel 2012-11-06 15:09:37 -05:00 committed by Coleen Phillimore
parent e1d995ab86
commit 7fee66f152
39 changed files with 176 additions and 179 deletions

View File

@ -121,7 +121,7 @@ public class ConstantPool extends Metadata implements ClassConstants {
Address addr = cache.getValue(getAddress()); Address addr = cache.getValue(getAddress());
return (ConstantPoolCache) VMObjectFactory.newObject(ConstantPoolCache.class, addr); return (ConstantPoolCache) VMObjectFactory.newObject(ConstantPoolCache.class, addr);
} }
public Klass getPoolHolder() { return (Klass) poolHolder.getValue(this); } public InstanceKlass getPoolHolder() { return (InstanceKlass)poolHolder.getValue(this); }
public int getLength() { return (int)length.getValue(getAddress()); } public int getLength() { return (int)length.getValue(getAddress()); }
public Oop getResolvedReferences() { public Oop getResolvedReferences() {
Address handle = resolvedReferences.getValue(getAddress()); Address handle = resolvedReferences.getValue(getAddress());

View File

@ -177,7 +177,7 @@ public class Method extends Metadata {
bci. It is required that there is currently a bytecode at this bci. It is required that there is currently a bytecode at this
bci. */ bci. */
public int getOrigBytecodeAt(int bci) { public int getOrigBytecodeAt(int bci) {
BreakpointInfo bp = ((InstanceKlass) getMethodHolder()).getBreakpoints(); BreakpointInfo bp = getMethodHolder().getBreakpoints();
for (; bp != null; bp = bp.getNext()) { for (; bp != null; bp = bp.getNext()) {
if (bp.match(this, bci)) { if (bp.match(this, bci)) {
return bp.getOrigBytecode(); return bp.getOrigBytecode();
@ -238,7 +238,7 @@ public class Method extends Metadata {
} }
// Method holder (the Klass holding this method) // Method holder (the Klass holding this method)
public Klass getMethodHolder() { return getConstants().getPoolHolder(); } public InstanceKlass getMethodHolder() { return getConstants().getPoolHolder(); }
// Access flags // Access flags
public boolean isPublic() { return getAccessFlagsObj().isPublic(); } public boolean isPublic() { return getAccessFlagsObj().isPublic(); }

View File

@ -2322,7 +2322,7 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
// Pre-load a static method's oop into O1. Used both by locking code and // Pre-load a static method's oop into O1. Used both by locking code and
// the normal JNI call code. // the normal JNI call code.
if (method->is_static() && !is_critical_native) { if (method->is_static() && !is_critical_native) {
__ set_oop_constant(JNIHandles::make_local(Klass::cast(method->method_holder())->java_mirror()), O1); __ set_oop_constant(JNIHandles::make_local(method->method_holder()->java_mirror()), O1);
// Now handlize the static class mirror in O1. It's known not-null. // Now handlize the static class mirror in O1. It's known not-null.
__ st_ptr(O1, SP, klass_offset + STACK_BIAS); __ st_ptr(O1, SP, klass_offset + STACK_BIAS);

View File

@ -1936,7 +1936,7 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
if (method->is_static() && !is_critical_native) { if (method->is_static() && !is_critical_native) {
// load opp into a register // load opp into a register
__ movoop(oop_handle_reg, JNIHandles::make_local(Klass::cast(method->method_holder())->java_mirror())); __ movoop(oop_handle_reg, JNIHandles::make_local(method->method_holder()->java_mirror()));
// Now handlize the static class mirror it's known not-null. // Now handlize the static class mirror it's known not-null.
__ movptr(Address(rsp, klass_offset), oop_handle_reg); __ movptr(Address(rsp, klass_offset), oop_handle_reg);

View File

@ -2179,7 +2179,7 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
if (method->is_static() && !is_critical_native) { if (method->is_static() && !is_critical_native) {
// load oop into a register // load oop into a register
__ movoop(oop_handle_reg, JNIHandles::make_local(Klass::cast(method->method_holder())->java_mirror())); __ movoop(oop_handle_reg, JNIHandles::make_local(method->method_holder()->java_mirror()));
// Now handlize the static class mirror it's known not-null. // Now handlize the static class mirror it's known not-null.
__ movptr(Address(rsp, klass_offset), oop_handle_reg); __ movptr(Address(rsp, klass_offset), oop_handle_reg);

View File

@ -768,8 +768,8 @@ ciMethod* ciEnv::get_method_by_index_impl(constantPoolHandle cpool,
Method* m = lookup_method(accessor->get_instanceKlass(), lookup, name_sym, sig_sym, bc); Method* m = lookup_method(accessor->get_instanceKlass(), lookup, name_sym, sig_sym, bc);
if (m != NULL && if (m != NULL &&
(bc == Bytecodes::_invokestatic (bc == Bytecodes::_invokestatic
? InstanceKlass::cast(m->method_holder())->is_not_initialized() ? m->method_holder()->is_not_initialized()
: !InstanceKlass::cast(m->method_holder())->is_loaded())) { : !m->method_holder()->is_loaded())) {
m = NULL; m = NULL;
} }
if (m != NULL) { if (m != NULL) {
@ -1056,7 +1056,7 @@ void ciEnv::register_method(ciMethod* target,
method_name, method_name,
entry_bci); entry_bci);
} }
InstanceKlass::cast(method->method_holder())->add_osr_nmethod(nm); method->method_holder()->add_osr_nmethod(nm);
} }
} }

View File

@ -105,7 +105,7 @@ ciMethod::ciMethod(methodHandle h_m) : ciMetadata(h_m()) {
CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops()); CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops());
} }
if (InstanceKlass::cast(h_m()->method_holder())->is_linked()) { if (h_m()->method_holder()->is_linked()) {
_can_be_statically_bound = h_m()->can_be_statically_bound(); _can_be_statically_bound = h_m()->can_be_statically_bound();
} else { } else {
// Have to use a conservative value in this case. // Have to use a conservative value in this case.
@ -188,7 +188,7 @@ void ciMethod::load_code() {
// Revert any breakpoint bytecodes in ci's copy // Revert any breakpoint bytecodes in ci's copy
if (me->number_of_breakpoints() > 0) { if (me->number_of_breakpoints() > 0) {
BreakpointInfo* bp = InstanceKlass::cast(me->method_holder())->breakpoints(); BreakpointInfo* bp = me->method_holder()->breakpoints();
for (; bp != NULL; bp = bp->next()) { for (; bp != NULL; bp = bp->next()) {
if (bp->match(me)) { if (bp->match(me)) {
code_at_put(bp->bci(), bp->orig_bytecode()); code_at_put(bp->bci(), bp->orig_bytecode());

View File

@ -4193,7 +4193,7 @@ void ClassFileParser::check_final_method_override(instanceKlassHandle this_klass
} }
// continue to look from super_m's holder's super. // continue to look from super_m's holder's super.
k = InstanceKlass::cast(super_m->method_holder())->super(); k = super_m->method_holder()->super();
continue; continue;
} }

View File

@ -1156,7 +1156,7 @@ void java_lang_Throwable::print(Handle throwable, outputStream* st) {
// Print stack trace element to resource allocated buffer // Print stack trace element to resource allocated buffer
char* java_lang_Throwable::print_stack_element_to_buffer(Method* method, int bci) { char* java_lang_Throwable::print_stack_element_to_buffer(Method* method, int bci) {
// Get strings and string lengths // Get strings and string lengths
InstanceKlass* klass = InstanceKlass::cast(method->method_holder()); InstanceKlass* klass = method->method_holder();
const char* klass_name = klass->external_name(); const char* klass_name = klass->external_name();
int buf_len = (int)strlen(klass_name); int buf_len = (int)strlen(klass_name);
char* source_file_name; char* source_file_name;
@ -1747,14 +1747,14 @@ oop java_lang_StackTraceElement::create(methodHandle method, int bci, TRAPS) {
Handle element = ik->allocate_instance_handle(CHECK_0); Handle element = ik->allocate_instance_handle(CHECK_0);
// Fill in class name // Fill in class name
ResourceMark rm(THREAD); ResourceMark rm(THREAD);
const char* str = InstanceKlass::cast(method->method_holder())->external_name(); const char* str = method->method_holder()->external_name();
oop classname = StringTable::intern((char*) str, CHECK_0); oop classname = StringTable::intern((char*) str, CHECK_0);
java_lang_StackTraceElement::set_declaringClass(element(), classname); java_lang_StackTraceElement::set_declaringClass(element(), classname);
// Fill in method name // Fill in method name
oop methodname = StringTable::intern(method->name(), CHECK_0); oop methodname = StringTable::intern(method->name(), CHECK_0);
java_lang_StackTraceElement::set_methodName(element(), methodname); java_lang_StackTraceElement::set_methodName(element(), methodname);
// Fill in source file name // Fill in source file name
Symbol* source = InstanceKlass::cast(method->method_holder())->source_file_name(); Symbol* source = method->method_holder()->source_file_name();
if (ShowHiddenFrames && source == NULL) if (ShowHiddenFrames && source == NULL)
source = vmSymbols::unknown_class_name(); source = vmSymbols::unknown_class_name();
oop filename = StringTable::intern(source, CHECK_0); oop filename = StringTable::intern(source, CHECK_0);

View File

@ -446,7 +446,7 @@ void ErrorContext::location_details(outputStream* ss, Method* method) const {
bytecode_name = "<illegal>"; bytecode_name = "<illegal>";
} }
} }
InstanceKlass* ik = InstanceKlass::cast(method->method_holder()); InstanceKlass* ik = method->method_holder();
ss->indent().print_cr("Location:"); ss->indent().print_cr("Location:");
streamIndentor si2(ss); streamIndentor si2(ss);
ss->indent().print_cr("%s.%s%s @%d: %s", ss->indent().print_cr("%s.%s%s @%d: %s",
@ -1850,7 +1850,7 @@ void ClassVerifier::verify_cp_index(
if ((index <= 0) || (index >= nconstants)) { if ((index <= 0) || (index >= nconstants)) {
verify_error(ErrorContext::bad_cp_index(bci, index), verify_error(ErrorContext::bad_cp_index(bci, index),
"Illegal constant pool index %d in class %s", "Illegal constant pool index %d in class %s",
index, InstanceKlass::cast(cp->pool_holder())->external_name()); index, cp->pool_holder()->external_name());
return; return;
} }
} }
@ -1869,7 +1869,7 @@ void ClassVerifier::verify_cp_type(
if ((types & (1 << tag)) == 0) { if ((types & (1 << tag)) == 0) {
verify_error(ErrorContext::bad_cp_index(bci, index), verify_error(ErrorContext::bad_cp_index(bci, index),
"Illegal type at constant pool entry %d in class %s", "Illegal type at constant pool entry %d in class %s",
index, InstanceKlass::cast(cp->pool_holder())->external_name()); index, cp->pool_holder()->external_name());
return; return;
} }
} }
@ -1881,7 +1881,7 @@ void ClassVerifier::verify_cp_class_type(
if (!tag.is_klass() && !tag.is_unresolved_klass()) { if (!tag.is_klass() && !tag.is_unresolved_klass()) {
verify_error(ErrorContext::bad_cp_index(bci, index), verify_error(ErrorContext::bad_cp_index(bci, index),
"Illegal type at constant pool entry %d in class %s", "Illegal type at constant pool entry %d in class %s",
index, InstanceKlass::cast(cp->pool_holder())->external_name()); index, cp->pool_holder()->external_name());
return; return;
} }
} }

View File

@ -507,7 +507,7 @@ static vmIntrinsics::ID match_method_with_klass(Method* m, Symbol* mk) {
} }
void vmIntrinsics::verify_method(ID actual_id, Method* m) { void vmIntrinsics::verify_method(ID actual_id, Method* m) {
Symbol* mk = Klass::cast(m->method_holder())->name(); Symbol* mk = m->method_holder()->name();
ID declared_id = match_method_with_klass(m, mk); ID declared_id = match_method_with_klass(m, mk);
if (declared_id == actual_id) return; // success if (declared_id == actual_id) return; // success

View File

@ -191,8 +191,8 @@ void CompiledIC::set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecod
int index = klassItable::compute_itable_index(call_info->resolved_method()()); int index = klassItable::compute_itable_index(call_info->resolved_method()());
entry = VtableStubs::create_stub(false, index, method()); entry = VtableStubs::create_stub(false, index, method());
assert(entry != NULL, "entry not computed"); assert(entry != NULL, "entry not computed");
Klass* k = call_info->resolved_method()->method_holder(); InstanceKlass* k = call_info->resolved_method()->method_holder();
assert(Klass::cast(k)->is_interface(), "sanity check"); assert(k->is_interface(), "sanity check");
InlineCacheBuffer::create_transition_stub(this, k, entry); InlineCacheBuffer::create_transition_stub(this, k, entry);
} else { } else {
// Can be different than method->vtable_index(), due to package-private etc. // Can be different than method->vtable_index(), due to package-private etc.

View File

@ -829,7 +829,7 @@ class ClassHierarchyWalker {
} }
if ( !Dependencies::is_concrete_method(lm) if ( !Dependencies::is_concrete_method(lm)
&& !Dependencies::is_concrete_method(m) && !Dependencies::is_concrete_method(m)
&& Klass::cast(lm->method_holder())->is_subtype_of(m->method_holder())) && lm->method_holder()->is_subtype_of(m->method_holder()))
// Method m is overridden by lm, but both are non-concrete. // Method m is overridden by lm, but both are non-concrete.
return true; return true;
} }

View File

@ -1263,7 +1263,7 @@ void nmethod::invalidate_osr_method() {
assert(_entry_bci != InvocationEntryBci, "wrong kind of nmethod"); assert(_entry_bci != InvocationEntryBci, "wrong kind of nmethod");
// Remove from list of active nmethods // Remove from list of active nmethods
if (method() != NULL) if (method() != NULL)
InstanceKlass::cast(method()->method_holder())->remove_osr_nmethod(this); method()->method_holder()->remove_osr_nmethod(this);
// Set entry as invalid // Set entry as invalid
_entry_bci = InvalidOSREntryBci; _entry_bci = InvalidOSREntryBci;
} }

View File

@ -1051,7 +1051,7 @@ void CompileBroker::compile_method_base(methodHandle method,
guarantee(!method->is_abstract(), "cannot compile abstract methods"); guarantee(!method->is_abstract(), "cannot compile abstract methods");
assert(method->method_holder()->oop_is_instance(), assert(method->method_holder()->oop_is_instance(),
"sanity check"); "sanity check");
assert(!InstanceKlass::cast(method->method_holder())->is_not_initialized(), assert(!method->method_holder()->is_not_initialized(),
"method holder must be initialized"); "method holder must be initialized");
assert(!method->is_method_handle_intrinsic(), "do not enqueue these guys"); assert(!method->is_method_handle_intrinsic(), "do not enqueue these guys");
@ -1206,7 +1206,7 @@ nmethod* CompileBroker::compile_method(methodHandle method, int osr_bci,
assert(method->method_holder()->oop_is_instance(), "not an instance method"); assert(method->method_holder()->oop_is_instance(), "not an instance method");
assert(osr_bci == InvocationEntryBci || (0 <= osr_bci && osr_bci < method->code_size()), "bci out of range"); assert(osr_bci == InvocationEntryBci || (0 <= osr_bci && osr_bci < method->code_size()), "bci out of range");
assert(!method->is_abstract() && (osr_bci == InvocationEntryBci || !method->is_native()), "cannot compile abstract/native methods"); assert(!method->is_abstract() && (osr_bci == InvocationEntryBci || !method->is_native()), "cannot compile abstract/native methods");
assert(!InstanceKlass::cast(method->method_holder())->is_not_initialized(), "method holder must be initialized"); assert(!method->method_holder()->is_not_initialized(), "method holder must be initialized");
if (!TieredCompilation) { if (!TieredCompilation) {
comp_level = CompLevel_highest_tier; comp_level = CompLevel_highest_tier;

View File

@ -67,7 +67,7 @@ class MethodMatcher : public CHeapObj<mtCompiler> {
// utility method // utility method
MethodMatcher* find(methodHandle method) { MethodMatcher* find(methodHandle method) {
Symbol* class_name = Klass::cast(method->method_holder())->name(); Symbol* class_name = method->method_holder()->name();
Symbol* method_name = method->name(); Symbol* method_name = method->name();
for (MethodMatcher* current = this; current != NULL; current = current->_next) { for (MethodMatcher* current = this; current != NULL; current = current->_next) {
if (match(class_name, current->class_name(), current->_class_mode) && if (match(class_name, current->class_name(), current->_class_mode) &&
@ -624,7 +624,7 @@ void CompilerOracle::append_exclude_to_file(methodHandle method) {
assert(has_command_file(), "command file must be specified"); assert(has_command_file(), "command file must be specified");
fileStream stream(fopen(cc_file(), "at")); fileStream stream(fopen(cc_file(), "at"));
stream.print("exclude "); stream.print("exclude ");
Klass::cast(method->method_holder())->name()->print_symbol_on(&stream); method->method_holder()->name()->print_symbol_on(&stream);
stream.print("."); stream.print(".");
method->name()->print_symbol_on(&stream); method->name()->print_symbol_on(&stream);
method->signature()->print_symbol_on(&stream); method->signature()->print_symbol_on(&stream);

View File

@ -133,7 +133,7 @@ void CallInfo::set_common(KlassHandle resolved_klass, KlassHandle selected_klass
// don't force compilation, resolve was on behalf of compiler // don't force compilation, resolve was on behalf of compiler
return; return;
} }
if (InstanceKlass::cast(selected_method->method_holder())->is_not_initialized()) { if (selected_method->method_holder()->is_not_initialized()) {
// 'is_not_initialized' means not only '!is_initialized', but also that // 'is_not_initialized' means not only '!is_initialized', but also that
// initialization has not been started yet ('!being_initialized') // initialization has not been started yet ('!being_initialized')
// Do not force compilation of methods in uninitialized classes. // Do not force compilation of methods in uninitialized classes.
@ -466,7 +466,7 @@ void LinkResolver::resolve_method(methodHandle& resolved_method, KlassHandle res
// check loader constraints // check loader constraints
Handle loader (THREAD, InstanceKlass::cast(current_klass())->class_loader()); Handle loader (THREAD, InstanceKlass::cast(current_klass())->class_loader());
Handle class_loader (THREAD, InstanceKlass::cast(resolved_method->method_holder())->class_loader()); Handle class_loader (THREAD, resolved_method->method_holder()->class_loader());
{ {
ResourceMark rm(THREAD); ResourceMark rm(THREAD);
char* failed_type_name = char* failed_type_name =
@ -528,7 +528,7 @@ void LinkResolver::resolve_interface_method(methodHandle& resolved_method,
if (check_access) { if (check_access) {
HandleMark hm(THREAD); HandleMark hm(THREAD);
Handle loader (THREAD, InstanceKlass::cast(current_klass())->class_loader()); Handle loader (THREAD, InstanceKlass::cast(current_klass())->class_loader());
Handle class_loader (THREAD, InstanceKlass::cast(resolved_method->method_holder())->class_loader()); Handle class_loader (THREAD, resolved_method->method_holder()->class_loader());
{ {
ResourceMark rm(THREAD); ResourceMark rm(THREAD);
char* failed_type_name = char* failed_type_name =
@ -910,12 +910,12 @@ void LinkResolver::runtime_resolve_virtual_method(CallInfo& result,
// Virtual methods cannot be resolved before its klass has been linked, for otherwise the Method*'s // Virtual methods cannot be resolved before its klass has been linked, for otherwise the Method*'s
// has not been rewritten, and the vtable initialized. // has not been rewritten, and the vtable initialized.
assert(InstanceKlass::cast(resolved_method->method_holder())->is_linked(), "must be linked"); assert(resolved_method->method_holder()->is_linked(), "must be linked");
// Virtual methods cannot be resolved before its klass has been linked, for otherwise the Method*'s // Virtual methods cannot be resolved before its klass has been linked, for otherwise the Method*'s
// has not been rewritten, and the vtable initialized. Make sure to do this after the nullcheck, since // has not been rewritten, and the vtable initialized. Make sure to do this after the nullcheck, since
// a missing receiver might result in a bogus lookup. // a missing receiver might result in a bogus lookup.
assert(InstanceKlass::cast(resolved_method->method_holder())->is_linked(), "must be linked"); assert(resolved_method->method_holder()->is_linked(), "must be linked");
// do lookup based on receiver klass using the vtable index // do lookup based on receiver klass using the vtable index
if (resolved_method->method_holder()->is_interface()) { // miranda method if (resolved_method->method_holder()->is_interface()) { // miranda method

View File

@ -113,8 +113,7 @@ int ConstMethod::size(int code_size,
} }
Method* ConstMethod::method() const { Method* ConstMethod::method() const {
return InstanceKlass::cast(_constants->pool_holder())->method_with_idnum( return _constants->pool_holder()->method_with_idnum(_method_idnum);
_method_idnum);
} }
// linenumber table - note that length is unknown until decompression, // linenumber table - note that length is unknown until decompression,

View File

@ -228,7 +228,7 @@ Klass* ConstantPool::klass_at_impl(constantPoolHandle this_oop, int which, TRAPS
} else { } else {
do_resolve = true; do_resolve = true;
name = this_oop->unresolved_klass_at(which); name = this_oop->unresolved_klass_at(which);
loader = Handle(THREAD, InstanceKlass::cast(this_oop->pool_holder())->class_loader()); loader = Handle(THREAD, this_oop->pool_holder()->class_loader());
} }
} }
} // unlocking constantPool } // unlocking constantPool
@ -247,7 +247,7 @@ Klass* ConstantPool::klass_at_impl(constantPoolHandle this_oop, int which, TRAPS
if (do_resolve) { if (do_resolve) {
// this_oop must be unlocked during resolve_or_fail // this_oop must be unlocked during resolve_or_fail
oop protection_domain = Klass::cast(this_oop->pool_holder())->protection_domain(); oop protection_domain = this_oop->pool_holder()->protection_domain();
Handle h_prot (THREAD, protection_domain); Handle h_prot (THREAD, protection_domain);
Klass* k_oop = SystemDictionary::resolve_or_fail(name, loader, h_prot, true, THREAD); Klass* k_oop = SystemDictionary::resolve_or_fail(name, loader, h_prot, true, THREAD);
KlassHandle k; KlassHandle k;
@ -315,7 +315,7 @@ Klass* ConstantPool::klass_at_impl(constantPoolHandle this_oop, int which, TRAPS
vframeStream vfst(JavaThread::current()); vframeStream vfst(JavaThread::current());
if (!vfst.at_end()) { if (!vfst.at_end()) {
line_number = vfst.method()->line_number_from_bci(vfst.bci()); line_number = vfst.method()->line_number_from_bci(vfst.bci());
Symbol* s = InstanceKlass::cast(vfst.method()->method_holder())->source_file_name(); Symbol* s = vfst.method()->method_holder()->source_file_name();
if (s != NULL) { if (s != NULL) {
source_file = s->as_C_string(); source_file = s->as_C_string();
} }
@ -325,11 +325,11 @@ Klass* ConstantPool::klass_at_impl(constantPoolHandle this_oop, int which, TRAPS
// only print something if the classes are different // only print something if the classes are different
if (source_file != NULL) { if (source_file != NULL) {
tty->print("RESOLVE %s %s %s:%d\n", tty->print("RESOLVE %s %s %s:%d\n",
InstanceKlass::cast(this_oop->pool_holder())->external_name(), this_oop->pool_holder()->external_name(),
InstanceKlass::cast(k())->external_name(), source_file, line_number); InstanceKlass::cast(k())->external_name(), source_file, line_number);
} else { } else {
tty->print("RESOLVE %s %s\n", tty->print("RESOLVE %s %s\n",
InstanceKlass::cast(this_oop->pool_holder())->external_name(), this_oop->pool_holder()->external_name(),
InstanceKlass::cast(k())->external_name()); InstanceKlass::cast(k())->external_name());
} }
} }
@ -339,7 +339,7 @@ Klass* ConstantPool::klass_at_impl(constantPoolHandle this_oop, int which, TRAPS
// Only updated constant pool - if it is resolved. // Only updated constant pool - if it is resolved.
do_resolve = this_oop->tag_at(which).is_unresolved_klass(); do_resolve = this_oop->tag_at(which).is_unresolved_klass();
if (do_resolve) { if (do_resolve) {
ClassLoaderData* this_key = InstanceKlass::cast(this_oop->pool_holder())->class_loader_data(); ClassLoaderData* this_key = this_oop->pool_holder()->class_loader_data();
if (!this_key->is_the_null_class_loader_data()) { if (!this_key->is_the_null_class_loader_data()) {
this_key->record_dependency(k(), CHECK_NULL); // Can throw OOM this_key->record_dependency(k(), CHECK_NULL); // Can throw OOM
} }
@ -367,8 +367,8 @@ Klass* ConstantPool::klass_at_if_loaded(constantPoolHandle this_oop, int which)
assert(entry.is_unresolved(), "must be either symbol or klass"); assert(entry.is_unresolved(), "must be either symbol or klass");
Thread *thread = Thread::current(); Thread *thread = Thread::current();
Symbol* name = entry.get_symbol(); Symbol* name = entry.get_symbol();
oop loader = InstanceKlass::cast(this_oop->pool_holder())->class_loader(); oop loader = this_oop->pool_holder()->class_loader();
oop protection_domain = Klass::cast(this_oop->pool_holder())->protection_domain(); oop protection_domain = this_oop->pool_holder()->protection_domain();
Handle h_prot (thread, protection_domain); Handle h_prot (thread, protection_domain);
Handle h_loader (thread, loader); Handle h_loader (thread, loader);
Klass* k = SystemDictionary::find(name, h_loader, h_prot, thread); Klass* k = SystemDictionary::find(name, h_loader, h_prot, thread);
@ -409,8 +409,8 @@ Klass* ConstantPool::klass_ref_at_if_loaded_check(constantPoolHandle this_oop, i
} else { } else {
assert(entry.is_unresolved(), "must be either symbol or klass"); assert(entry.is_unresolved(), "must be either symbol or klass");
Symbol* name = entry.get_symbol(); Symbol* name = entry.get_symbol();
oop loader = InstanceKlass::cast(this_oop->pool_holder())->class_loader(); oop loader = this_oop->pool_holder()->class_loader();
oop protection_domain = Klass::cast(this_oop->pool_holder())->protection_domain(); oop protection_domain = this_oop->pool_holder()->protection_domain();
Handle h_loader(THREAD, loader); Handle h_loader(THREAD, loader);
Handle h_prot (THREAD, protection_domain); Handle h_prot (THREAD, protection_domain);
KlassHandle k(THREAD, SystemDictionary::find(name, h_loader, h_prot, THREAD)); KlassHandle k(THREAD, SystemDictionary::find(name, h_loader, h_prot, THREAD));
@ -1790,7 +1790,7 @@ void ConstantPool::patch_resolved_references(
assert(cp_patches->at(index).is_null(), assert(cp_patches->at(index).is_null(),
err_msg("Unused constant pool patch at %d in class file %s", err_msg("Unused constant pool patch at %d in class file %s",
index, index,
InstanceKlass::cast(pool_holder())->external_name())); pool_holder()->external_name()));
} }
#endif // ASSERT #endif // ASSERT
} }
@ -1948,7 +1948,7 @@ void ConstantPool::print_value_on(outputStream* st) const {
st->print(" for "); st->print(" for ");
pool_holder()->print_value_on(st); pool_holder()->print_value_on(st);
if (pool_holder() != NULL) { if (pool_holder() != NULL) {
bool extra = (InstanceKlass::cast(pool_holder())->constants() != this); bool extra = (pool_holder()->constants() != this);
if (extra) st->print(" (extra)"); if (extra) st->print(" (extra)");
} }
if (cache() != NULL) { if (cache() != NULL) {

View File

@ -87,7 +87,7 @@ class ConstantPool : public Metadata {
private: private:
Array<u1>* _tags; // the tag array describing the constant pool's contents Array<u1>* _tags; // the tag array describing the constant pool's contents
ConstantPoolCache* _cache; // the cache holding interpreter runtime information ConstantPoolCache* _cache; // the cache holding interpreter runtime information
Klass* _pool_holder; // the corresponding class InstanceKlass* _pool_holder; // the corresponding class
Array<u2>* _operands; // for variable-sized (InvokeDynamic) nodes, usually empty Array<u2>* _operands; // for variable-sized (InvokeDynamic) nodes, usually empty
// Array of resolved objects from the constant pool and map from resolved // Array of resolved objects from the constant pool and map from resolved
@ -193,9 +193,9 @@ class ConstantPool : public Metadata {
void set_on_stack(const bool value); void set_on_stack(const bool value);
// Klass holding pool // Klass holding pool
Klass* pool_holder() const { return _pool_holder; } InstanceKlass* pool_holder() const { return _pool_holder; }
void set_pool_holder(Klass* k) { _pool_holder = k; } void set_pool_holder(InstanceKlass* k) { _pool_holder = k; }
Klass** pool_holder_addr() { return &_pool_holder; } InstanceKlass** pool_holder_addr() { return &_pool_holder; }
// Interpreter runtime support // Interpreter runtime support
ConstantPoolCache* cache() const { return _cache; } ConstantPoolCache* cache() const { return _cache; }

View File

@ -231,8 +231,8 @@ void ConstantPoolCacheEntry::set_method(Bytecodes::Code invoke_code,
void ConstantPoolCacheEntry::set_interface_call(methodHandle method, int index) { void ConstantPoolCacheEntry::set_interface_call(methodHandle method, int index) {
Klass* interf = method->method_holder(); InstanceKlass* interf = method->method_holder();
assert(InstanceKlass::cast(interf)->is_interface(), "must be an interface"); assert(interf->is_interface(), "must be an interface");
assert(!method->is_final_method(), "interfaces do not have final methods; cannot link to one here"); assert(!method->is_final_method(), "interfaces do not have final methods; cannot link to one here");
set_f1(interf); set_f1(interf);
set_f2(index); set_f2(index);
@ -421,7 +421,7 @@ bool ConstantPoolCacheEntry::adjust_method_entry(Method* old_method,
if (!(*trace_name_printed)) { if (!(*trace_name_printed)) {
// RC_TRACE_MESG macro has an embedded ResourceMark // RC_TRACE_MESG macro has an embedded ResourceMark
RC_TRACE_MESG(("adjust: name=%s", RC_TRACE_MESG(("adjust: name=%s",
Klass::cast(old_method->method_holder())->external_name())); old_method->method_holder()->external_name()));
*trace_name_printed = true; *trace_name_printed = true;
} }
// RC_TRACE macro has an embedded ResourceMark // RC_TRACE macro has an embedded ResourceMark
@ -449,7 +449,7 @@ bool ConstantPoolCacheEntry::adjust_method_entry(Method* old_method,
if (!(*trace_name_printed)) { if (!(*trace_name_printed)) {
// RC_TRACE_MESG macro has an embedded ResourceMark // RC_TRACE_MESG macro has an embedded ResourceMark
RC_TRACE_MESG(("adjust: name=%s", RC_TRACE_MESG(("adjust: name=%s",
Klass::cast(old_method->method_holder())->external_name())); old_method->method_holder()->external_name()));
*trace_name_printed = true; *trace_name_printed = true;
} }
// RC_TRACE macro has an embedded ResourceMark // RC_TRACE macro has an embedded ResourceMark

View File

@ -307,7 +307,7 @@ bool klassVtable::update_inherited_vtable(InstanceKlass* klass, methodHandle tar
if (super_method->name() == name && super_method->signature() == signature) { if (super_method->name() == name && super_method->signature() == signature) {
// get super_klass for method_holder for the found method // get super_klass for method_holder for the found method
InstanceKlass* super_klass = InstanceKlass::cast(super_method->method_holder()); InstanceKlass* super_klass = super_method->method_holder();
if ((super_klass->is_override(super_method, target_loader, target_classname, THREAD)) || if ((super_klass->is_override(super_method, target_loader, target_classname, THREAD)) ||
((klass->major_version() >= VTABLE_TRANSITIVE_OVERRIDE_VERSION) ((klass->major_version() >= VTABLE_TRANSITIVE_OVERRIDE_VERSION)
@ -452,7 +452,7 @@ bool klassVtable::needs_new_vtable_entry(methodHandle target_method,
} }
// get the class holding the matching method // get the class holding the matching method
// make sure you use that class for is_override // make sure you use that class for is_override
InstanceKlass* superk = InstanceKlass::cast(super_method->method_holder()); InstanceKlass* superk = super_method->method_holder();
// we want only instance method matches // we want only instance method matches
// pretend private methods are not in the super vtable // pretend private methods are not in the super vtable
// since we do override around them: e.g. a.m pub/b.m private/c.m pub, // since we do override around them: e.g. a.m pub/b.m private/c.m pub,
@ -630,7 +630,7 @@ void klassVtable::adjust_method_entries(Method** old_methods, Method** new_metho
if (!(*trace_name_printed)) { if (!(*trace_name_printed)) {
// RC_TRACE_MESG macro has an embedded ResourceMark // RC_TRACE_MESG macro has an embedded ResourceMark
RC_TRACE_MESG(("adjust: name=%s", RC_TRACE_MESG(("adjust: name=%s",
Klass::cast(old_method->method_holder())->external_name())); old_method->method_holder()->external_name()));
*trace_name_printed = true; *trace_name_printed = true;
} }
// RC_TRACE macro has an embedded ResourceMark // RC_TRACE macro has an embedded ResourceMark
@ -745,7 +745,7 @@ void klassItable::initialize_itable_for_interface(int method_table_offset, Klass
Method* target = klass->uncached_lookup_method(method_name, method_signature); Method* target = klass->uncached_lookup_method(method_name, method_signature);
while (target != NULL && target->is_static()) { while (target != NULL && target->is_static()) {
// continue with recursive lookup through the superclass // continue with recursive lookup through the superclass
Klass* super = Klass::cast(target->method_holder())->super(); 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 : Klass::cast(super)->uncached_lookup_method(method_name, method_signature);
} }
if (target == NULL || !target->is_public() || target->is_abstract()) { if (target == NULL || !target->is_public() || target->is_abstract()) {
@ -755,7 +755,7 @@ void klassItable::initialize_itable_for_interface(int method_table_offset, Klass
// if checkconstraints requested // if checkconstraints requested
methodHandle target_h (THREAD, target); // preserve across gc methodHandle target_h (THREAD, target); // preserve across gc
if (checkconstraints) { if (checkconstraints) {
Handle method_holder_loader (THREAD, InstanceKlass::cast(target->method_holder())->class_loader()); Handle method_holder_loader (THREAD, target->method_holder()->class_loader());
if (method_holder_loader() != interface_loader()) { if (method_holder_loader() != interface_loader()) {
ResourceMark rm(THREAD); ResourceMark rm(THREAD);
char* failed_type_name = char* failed_type_name =
@ -825,7 +825,7 @@ void klassItable::adjust_method_entries(Method** old_methods, Method** new_metho
if (!(*trace_name_printed)) { if (!(*trace_name_printed)) {
// RC_TRACE_MESG macro has an embedded ResourceMark // RC_TRACE_MESG macro has an embedded ResourceMark
RC_TRACE_MESG(("adjust: name=%s", RC_TRACE_MESG(("adjust: name=%s",
Klass::cast(old_method->method_holder())->external_name())); old_method->method_holder()->external_name()));
*trace_name_printed = true; *trace_name_printed = true;
} }
// RC_TRACE macro has an embedded ResourceMark // RC_TRACE macro has an embedded ResourceMark
@ -960,9 +960,9 @@ void klassItable::setup_itable_offset_table(instanceKlassHandle klass) {
// m must be a method in an interface // m must be a method in an interface
int klassItable::compute_itable_index(Method* m) { int klassItable::compute_itable_index(Method* m) {
Klass* intf = m->method_holder(); InstanceKlass* intf = m->method_holder();
assert(InstanceKlass::cast(intf)->is_interface(), "sanity check"); assert(intf->is_interface(), "sanity check");
Array<Method*>* methods = InstanceKlass::cast(intf)->methods(); Array<Method*>* methods = intf->methods();
int index = 0; int index = 0;
while(methods->at(index) != m) { while(methods->at(index) != m) {
index++; index++;

View File

@ -243,12 +243,12 @@ void Method::mask_for(int bci, InterpreterOopMap* mask) {
warning("oopmap should only be accessed by the " warning("oopmap should only be accessed by the "
"VM, GC task or CMS threads (or during debugging)"); "VM, GC task or CMS threads (or during debugging)");
InterpreterOopMap local_mask; InterpreterOopMap local_mask;
InstanceKlass::cast(method_holder())->mask_for(h_this, bci, &local_mask); method_holder()->mask_for(h_this, bci, &local_mask);
local_mask.print(); local_mask.print();
} }
} }
#endif #endif
InstanceKlass::cast(method_holder())->mask_for(h_this, bci, mask); method_holder()->mask_for(h_this, bci, mask);
return; return;
} }
@ -523,7 +523,7 @@ bool Method::compute_has_loops_flag() {
bool Method::is_final_method() const { bool Method::is_final_method() const {
// %%% Should return true for private methods also, // %%% Should return true for private methods also,
// since there is no way to override them. // since there is no way to override them.
return is_final() || Klass::cast(method_holder())->is_final(); return is_final() || method_holder()->is_final();
} }
@ -555,7 +555,7 @@ bool Method::is_initializer() const {
bool Method::has_valid_initializer_flags() const { bool Method::has_valid_initializer_flags() const {
return (is_static() || return (is_static() ||
InstanceKlass::cast(method_holder())->major_version() < 51); method_holder()->major_version() < 51);
} }
bool Method::is_static_initializer() const { bool Method::is_static_initializer() const {
@ -617,7 +617,7 @@ bool Method::is_klass_loaded_by_klass_index(int klass_index) const {
if( constants()->tag_at(klass_index).is_unresolved_klass() ) { if( constants()->tag_at(klass_index).is_unresolved_klass() ) {
Thread *thread = Thread::current(); Thread *thread = Thread::current();
Symbol* klass_name = constants()->klass_name_at(klass_index); Symbol* klass_name = constants()->klass_name_at(klass_index);
Handle loader(thread, InstanceKlass::cast(method_holder())->class_loader()); Handle loader(thread, method_holder()->class_loader());
Handle prot (thread, Klass::cast(method_holder())->protection_domain()); Handle prot (thread, Klass::cast(method_holder())->protection_domain());
return SystemDictionary::find(klass_name, loader, prot, thread) != NULL; return SystemDictionary::find(klass_name, loader, prot, thread) != NULL;
} else { } else {
@ -935,7 +935,7 @@ bool Method::is_overridden_in(Klass* k) const {
// If method is an interface, we skip it - except if it // If method is an interface, we skip it - except if it
// is a miranda method // is a miranda method
if (InstanceKlass::cast(method_holder())->is_interface()) { if (method_holder()->is_interface()) {
// Check that method is not a miranda method // Check that method is not a miranda method
if (ik->lookup_method(name(), signature()) == NULL) { if (ik->lookup_method(name(), signature()) == NULL) {
// No implementation exist - so miranda method // No implementation exist - so miranda method
@ -1020,7 +1020,7 @@ methodHandle Method::make_method_handle_intrinsic(vmIntrinsics::ID iid,
ConstantPool* cp_oop = ConstantPool::allocate(loader_data, cp_length, CHECK_(empty)); ConstantPool* cp_oop = ConstantPool::allocate(loader_data, cp_length, CHECK_(empty));
cp = constantPoolHandle(THREAD, cp_oop); cp = constantPoolHandle(THREAD, cp_oop);
} }
cp->set_pool_holder(holder()); cp->set_pool_holder(InstanceKlass::cast(holder()));
cp->symbol_at_put(_imcp_invoke_name, name); cp->symbol_at_put(_imcp_invoke_name, name);
cp->symbol_at_put(_imcp_invoke_signature, signature); cp->symbol_at_put(_imcp_invoke_signature, signature);
cp->set_preresolution(); cp->set_preresolution();
@ -1237,8 +1237,8 @@ bool Method::load_signature_classes(methodHandle m, TRAPS) {
return false; return false;
} }
bool sig_is_loaded = true; bool sig_is_loaded = true;
Handle class_loader(THREAD, InstanceKlass::cast(m->method_holder())->class_loader()); Handle class_loader(THREAD, m->method_holder()->class_loader());
Handle protection_domain(THREAD, Klass::cast(m->method_holder())->protection_domain()); Handle protection_domain(THREAD, m->method_holder()->protection_domain());
ResourceMark rm(THREAD); ResourceMark rm(THREAD);
Symbol* signature = m->signature(); Symbol* signature = m->signature();
for(SignatureStream ss(signature); !ss.is_done(); ss.next()) { for(SignatureStream ss(signature); !ss.is_done(); ss.next()) {
@ -1264,8 +1264,8 @@ bool Method::load_signature_classes(methodHandle m, TRAPS) {
} }
bool Method::has_unloaded_classes_in_signature(methodHandle m, TRAPS) { bool Method::has_unloaded_classes_in_signature(methodHandle m, TRAPS) {
Handle class_loader(THREAD, InstanceKlass::cast(m->method_holder())->class_loader()); Handle class_loader(THREAD, m->method_holder()->class_loader());
Handle protection_domain(THREAD, Klass::cast(m->method_holder())->protection_domain()); Handle protection_domain(THREAD, m->method_holder()->protection_domain());
ResourceMark rm(THREAD); ResourceMark rm(THREAD);
Symbol* signature = m->signature(); Symbol* signature = m->signature();
for(SignatureStream ss(signature); !ss.is_done(); ss.next()) { for(SignatureStream ss(signature); !ss.is_done(); ss.next()) {
@ -1472,7 +1472,7 @@ bool CompressedLineNumberReadStream::read_pair() {
Bytecodes::Code Method::orig_bytecode_at(int bci) const { Bytecodes::Code Method::orig_bytecode_at(int bci) const {
BreakpointInfo* bp = InstanceKlass::cast(method_holder())->breakpoints(); BreakpointInfo* bp = method_holder()->breakpoints();
for (; bp != NULL; bp = bp->next()) { for (; bp != NULL; bp = bp->next()) {
if (bp->match(this, bci)) { if (bp->match(this, bci)) {
return bp->orig_bytecode(); return bp->orig_bytecode();
@ -1484,7 +1484,7 @@ Bytecodes::Code Method::orig_bytecode_at(int bci) const {
void Method::set_orig_bytecode_at(int bci, Bytecodes::Code code) { void Method::set_orig_bytecode_at(int bci, Bytecodes::Code code) {
assert(code != Bytecodes::_breakpoint, "cannot patch breakpoints this way"); assert(code != Bytecodes::_breakpoint, "cannot patch breakpoints this way");
BreakpointInfo* bp = InstanceKlass::cast(method_holder())->breakpoints(); BreakpointInfo* bp = method_holder()->breakpoints();
for (; bp != NULL; bp = bp->next()) { for (; bp != NULL; bp = bp->next()) {
if (bp->match(this, bci)) { if (bp->match(this, bci)) {
bp->set_orig_bytecode(code); bp->set_orig_bytecode(code);
@ -1494,7 +1494,7 @@ void Method::set_orig_bytecode_at(int bci, Bytecodes::Code code) {
} }
void Method::set_breakpoint(int bci) { void Method::set_breakpoint(int bci) {
InstanceKlass* ik = InstanceKlass::cast(method_holder()); InstanceKlass* ik = method_holder();
BreakpointInfo *bp = new BreakpointInfo(this, bci); BreakpointInfo *bp = new BreakpointInfo(this, bci);
bp->set_next(ik->breakpoints()); bp->set_next(ik->breakpoints());
ik->set_breakpoints(bp); ik->set_breakpoints(bp);
@ -1503,7 +1503,7 @@ void Method::set_breakpoint(int bci) {
} }
static void clear_matches(Method* m, int bci) { static void clear_matches(Method* m, int bci) {
InstanceKlass* ik = InstanceKlass::cast(m->method_holder()); InstanceKlass* ik = m->method_holder();
BreakpointInfo* prev_bp = NULL; BreakpointInfo* prev_bp = NULL;
BreakpointInfo* next_bp; BreakpointInfo* next_bp;
for (BreakpointInfo* bp = ik->breakpoints(); bp != NULL; bp = next_bp) { for (BreakpointInfo* bp = ik->breakpoints(); bp != NULL; bp = next_bp) {
@ -1786,7 +1786,7 @@ void Method::change_method_associated_with_jmethod_id(jmethodID jmid, Method* ne
bool Method::is_method_id(jmethodID mid) { bool Method::is_method_id(jmethodID mid) {
Method* m = resolve_jmethod_id(mid); Method* m = resolve_jmethod_id(mid);
assert(m != NULL, "should be called with non-null method"); assert(m != NULL, "should be called with non-null method");
InstanceKlass* ik = InstanceKlass::cast(m->method_holder()); InstanceKlass* ik = m->method_holder();
ClassLoaderData* cld = ik->class_loader_data(); ClassLoaderData* cld = ik->class_loader_data();
if (cld->jmethod_ids() == NULL) return false; if (cld->jmethod_ids() == NULL) return false;
return (cld->jmethod_ids()->contains((Method**)mid)); return (cld->jmethod_ids()->contains((Method**)mid));

View File

@ -209,21 +209,21 @@ class Method : public Metadata {
// annotations support // annotations support
AnnotationArray* annotations() const { AnnotationArray* annotations() const {
InstanceKlass* ik = InstanceKlass::cast(method_holder()); InstanceKlass* ik = method_holder();
if (ik->annotations() == NULL) { if (ik->annotations() == NULL) {
return NULL; return NULL;
} }
return ik->annotations()->get_method_annotations_of(method_idnum()); return ik->annotations()->get_method_annotations_of(method_idnum());
} }
AnnotationArray* parameter_annotations() const { AnnotationArray* parameter_annotations() const {
InstanceKlass* ik = InstanceKlass::cast(method_holder()); InstanceKlass* ik = method_holder();
if (ik->annotations() == NULL) { if (ik->annotations() == NULL) {
return NULL; return NULL;
} }
return ik->annotations()->get_method_parameter_annotations_of(method_idnum()); return ik->annotations()->get_method_parameter_annotations_of(method_idnum());
} }
AnnotationArray* annotation_default() const { AnnotationArray* annotation_default() const {
InstanceKlass* ik = InstanceKlass::cast(method_holder()); InstanceKlass* ik = method_holder();
if (ik->annotations() == NULL) { if (ik->annotations() == NULL) {
return NULL; return NULL;
} }
@ -496,7 +496,7 @@ class Method : public Metadata {
{ return constMethod()->compressed_linenumber_table(); } { return constMethod()->compressed_linenumber_table(); }
// method holder (the Klass* holding this method) // method holder (the Klass* holding this method)
Klass* method_holder() const { return constants()->pool_holder(); } InstanceKlass* method_holder() const { return constants()->pool_holder(); }
void compute_size_of_parameters(Thread *thread); // word size of parameters (receiver if any + arguments) void compute_size_of_parameters(Thread *thread); // word size of parameters (receiver if any + arguments)
Symbol* klass_name() const; // returns the name of the method holder Symbol* klass_name() const; // returns the name of the method holder
@ -697,18 +697,18 @@ class Method : public Metadata {
// Get this method's jmethodID -- allocate if it doesn't exist // Get this method's jmethodID -- allocate if it doesn't exist
jmethodID jmethod_id() { methodHandle this_h(this); jmethodID jmethod_id() { methodHandle this_h(this);
return InstanceKlass::get_jmethod_id(InstanceKlass::cast(method_holder()), this_h); } return InstanceKlass::get_jmethod_id(method_holder(), this_h); }
// Lookup the jmethodID for this method. Return NULL if not found. // Lookup the jmethodID for this method. Return NULL if not found.
// NOTE that this function can be called from a signal handler // NOTE that this function can be called from a signal handler
// (see AsyncGetCallTrace support for Forte Analyzer) and this // (see AsyncGetCallTrace support for Forte Analyzer) and this
// needs to be async-safe. No allocation should be done and // needs to be async-safe. No allocation should be done and
// so handles are not used to avoid deadlock. // so handles are not used to avoid deadlock.
jmethodID find_jmethod_id_or_null() { return InstanceKlass::cast(method_holder())->jmethod_id_or_null(this); } jmethodID find_jmethod_id_or_null() { return method_holder()->jmethod_id_or_null(this); }
// JNI static invoke cached itable index accessors // JNI static invoke cached itable index accessors
int cached_itable_index() { return InstanceKlass::cast(method_holder())->cached_itable_index(method_idnum()); } int cached_itable_index() { return method_holder()->cached_itable_index(method_idnum()); }
void set_cached_itable_index(int index) { InstanceKlass::cast(method_holder())->set_cached_itable_index(method_idnum(), index); } void set_cached_itable_index(int index) { method_holder()->set_cached_itable_index(method_idnum(), index); }
// Support for inlining of intrinsic methods // Support for inlining of intrinsic methods
vmIntrinsics::ID intrinsic_id() const { return (vmIntrinsics::ID) _intrinsic_id; } vmIntrinsics::ID intrinsic_id() const { return (vmIntrinsics::ID) _intrinsic_id; }
@ -734,11 +734,11 @@ class Method : public Metadata {
// On-stack replacement support // On-stack replacement support
bool has_osr_nmethod(int level, bool match_level) { bool has_osr_nmethod(int level, bool match_level) {
return InstanceKlass::cast(method_holder())->lookup_osr_nmethod(this, InvocationEntryBci, level, match_level) != NULL; return method_holder()->lookup_osr_nmethod(this, InvocationEntryBci, level, match_level) != NULL;
} }
nmethod* lookup_osr_nmethod_for(int bci, int level, bool match_level) { nmethod* lookup_osr_nmethod_for(int bci, int level, bool match_level) {
return InstanceKlass::cast(method_holder())->lookup_osr_nmethod(this, bci, level, match_level); return method_holder()->lookup_osr_nmethod(this, bci, level, match_level);
} }
// Inline cache support // Inline cache support

View File

@ -2985,7 +2985,7 @@ JNI_ENTRY(jfieldID, jni_GetStaticFieldID(JNIEnv *env, jclass clazz,
} }
// A jfieldID for a static field is a JNIid specifying the field holder and the offset within the Klass* // A jfieldID for a static field is a JNIid specifying the field holder and the offset within the Klass*
JNIid* id = InstanceKlass::cast(fd.field_holder())->jni_id_for(fd.offset()); JNIid* id = fd.field_holder()->jni_id_for(fd.offset());
debug_only(id->set_is_static_field_id();) debug_only(id->set_is_static_field_id();)
debug_only(id->verify(fd.field_holder())); debug_only(id->verify(fd.field_holder()));
@ -4016,7 +4016,7 @@ static bool register_native(KlassHandle k, Symbol* name, Symbol* signature, addr
if (PrintJNIResolving) { if (PrintJNIResolving) {
ResourceMark rm(THREAD); ResourceMark rm(THREAD);
tty->print_cr("[Registering JNI native method %s.%s]", tty->print_cr("[Registering JNI native method %s.%s]",
Klass::cast(method->method_holder())->external_name(), method->method_holder()->external_name(),
method->name()->as_C_string()); method->name()->as_C_string());
} }
return true; return true;

View File

@ -125,7 +125,7 @@ static void trace_class_resolution_impl(Klass* to_class, TRAPS) {
int line_number = -1; int line_number = -1;
const char * source_file = NULL; const char * source_file = NULL;
const char * trace = "explicit"; const char * trace = "explicit";
Klass* caller = NULL; InstanceKlass* caller = NULL;
JavaThread* jthread = JavaThread::current(); JavaThread* jthread = JavaThread::current();
if (jthread->has_last_Java_frame()) { if (jthread->has_last_Java_frame()) {
vframeStream vfst(jthread); vframeStream vfst(jthread);
@ -153,17 +153,17 @@ static void trace_class_resolution_impl(Klass* to_class, TRAPS) {
// that caller, otherwise keep quiet since this should be picked up elsewhere. // that caller, otherwise keep quiet since this should be picked up elsewhere.
bool found_it = false; bool found_it = false;
if (!vfst.at_end() && if (!vfst.at_end() &&
InstanceKlass::cast(vfst.method()->method_holder())->name() == vmSymbols::java_lang_Class() && vfst.method()->method_holder()->name() == vmSymbols::java_lang_Class() &&
vfst.method()->name() == vmSymbols::forName0_name()) { vfst.method()->name() == vmSymbols::forName0_name()) {
vfst.next(); vfst.next();
if (!vfst.at_end() && if (!vfst.at_end() &&
InstanceKlass::cast(vfst.method()->method_holder())->name() == vmSymbols::java_lang_Class() && vfst.method()->method_holder()->name() == vmSymbols::java_lang_Class() &&
vfst.method()->name() == vmSymbols::forName_name()) { vfst.method()->name() == vmSymbols::forName_name()) {
vfst.next(); vfst.next();
found_it = true; found_it = true;
} }
} else if (last_caller != NULL && } else if (last_caller != NULL &&
InstanceKlass::cast(last_caller->method_holder())->name() == last_caller->method_holder()->name() ==
vmSymbols::java_lang_ClassLoader() && vmSymbols::java_lang_ClassLoader() &&
(last_caller->name() == vmSymbols::loadClassInternal_name() || (last_caller->name() == vmSymbols::loadClassInternal_name() ||
last_caller->name() == vmSymbols::loadClass_name())) { last_caller->name() == vmSymbols::loadClass_name())) {
@ -182,7 +182,7 @@ static void trace_class_resolution_impl(Klass* to_class, TRAPS) {
// show method name if it's a native method // show method name if it's a native method
trace = vfst.method()->name_and_sig_as_C_string(); trace = vfst.method()->name_and_sig_as_C_string();
} }
Symbol* s = InstanceKlass::cast(caller)->source_file_name(); Symbol* s = caller->source_file_name();
if (s != NULL) { if (s != NULL) {
source_file = s->as_C_string(); source_file = s->as_C_string();
} }
@ -190,8 +190,8 @@ static void trace_class_resolution_impl(Klass* to_class, TRAPS) {
} }
if (caller != NULL) { if (caller != NULL) {
if (to_class != caller) { if (to_class != caller) {
const char * from = Klass::cast(caller)->external_name(); const char * from = caller->external_name();
const char * to = Klass::cast(to_class)->external_name(); const char * to = to_class->external_name();
// print in a single call to reduce interleaving between threads // print in a single call to reduce interleaving between threads
if (source_file != NULL) { if (source_file != NULL) {
tty->print("RESOLVE %s %s %s:%d (%s)\n", from, to, source_file, line_number, trace); tty->print("RESOLVE %s %s %s:%d (%s)\n", from, to, source_file, line_number, trace);
@ -1228,7 +1228,7 @@ JVM_ENTRY(jobject, JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls))
privileged_context = Handle(thread, thread->privileged_stack_top()->privileged_context()); privileged_context = Handle(thread, thread->privileged_stack_top()->privileged_context());
protection_domain = thread->privileged_stack_top()->protection_domain(); protection_domain = thread->privileged_stack_top()->protection_domain();
} else { } else {
protection_domain = InstanceKlass::cast(method->method_holder())->protection_domain(); protection_domain = method->method_holder()->protection_domain();
} }
if ((previous_protection_domain != protection_domain) && (protection_domain != NULL)) { if ((previous_protection_domain != protection_domain) && (protection_domain != NULL)) {
@ -3048,10 +3048,10 @@ JVM_ENTRY(jclass, JVM_CurrentLoadedClass(JNIEnv *env))
Method* m = vfst.method(); Method* m = vfst.method();
if (!m->is_native()) { if (!m->is_native()) {
Klass* holder = m->method_holder(); InstanceKlass* holder = m->method_holder();
oop loader = InstanceKlass::cast(holder)->class_loader(); oop loader = holder->class_loader();
if (loader != NULL && !java_lang_ClassLoader::is_trusted_loader(loader)) { if (loader != NULL && !java_lang_ClassLoader::is_trusted_loader(loader)) {
return (jclass) JNIHandles::make_local(env, Klass::cast(holder)->java_mirror()); return (jclass) JNIHandles::make_local(env, holder->java_mirror());
} }
} }
} }
@ -3071,9 +3071,9 @@ JVM_ENTRY(jobject, JVM_CurrentClassLoader(JNIEnv *env))
Method* m = vfst.method(); Method* m = vfst.method();
if (!m->is_native()) { if (!m->is_native()) {
Klass* holder = m->method_holder(); InstanceKlass* holder = m->method_holder();
assert(holder->is_klass(), "just checking"); assert(holder->is_klass(), "just checking");
oop loader = InstanceKlass::cast(holder)->class_loader(); oop loader = holder->class_loader();
if (loader != NULL && !java_lang_ClassLoader::is_trusted_loader(loader)) { if (loader != NULL && !java_lang_ClassLoader::is_trusted_loader(loader)) {
return JNIHandles::make_local(env, loader); return JNIHandles::make_local(env, loader);
} }
@ -3148,9 +3148,9 @@ JVM_ENTRY(jint, JVM_ClassDepth(JNIEnv *env, jstring name))
for(vframeStream vfst(thread); !vfst.at_end(); vfst.next()) { for(vframeStream vfst(thread); !vfst.at_end(); vfst.next()) {
if (!vfst.method()->is_native()) { if (!vfst.method()->is_native()) {
Klass* holder = vfst.method()->method_holder(); InstanceKlass* holder = vfst.method()->method_holder();
assert(holder->is_klass(), "just checking"); assert(holder->is_klass(), "just checking");
if (InstanceKlass::cast(holder)->name() == class_name_sym) { if (holder->name() == class_name_sym) {
return depth; return depth;
} }
depth++; depth++;
@ -3171,9 +3171,9 @@ JVM_ENTRY(jint, JVM_ClassLoaderDepth(JNIEnv *env))
Method* m = vfst.method(); Method* m = vfst.method();
if (!m->is_native()) { if (!m->is_native()) {
Klass* holder = m->method_holder(); InstanceKlass* holder = m->method_holder();
assert(holder->is_klass(), "just checking"); assert(holder->is_klass(), "just checking");
oop loader = InstanceKlass::cast(holder)->class_loader(); oop loader = holder->class_loader();
if (loader != NULL && !java_lang_ClassLoader::is_trusted_loader(loader)) { if (loader != NULL && !java_lang_ClassLoader::is_trusted_loader(loader)) {
return depth; return depth;
} }
@ -3322,8 +3322,7 @@ JVM_ENTRY(jobject, JVM_LatestUserDefinedLoader(JNIEnv *env))
for (vframeStream vfst(thread); !vfst.at_end(); vfst.next()) { for (vframeStream vfst(thread); !vfst.at_end(); vfst.next()) {
// UseNewReflection // UseNewReflection
vfst.skip_reflection_related_frames(); // Only needed for 1.4 reflection vfst.skip_reflection_related_frames(); // Only needed for 1.4 reflection
Klass* holder = vfst.method()->method_holder(); oop loader = vfst.method()->method_holder()->class_loader();
oop loader = InstanceKlass::cast(holder)->class_loader();
if (loader != NULL) { if (loader != NULL) {
return JNIHandles::make_local(env, loader); return JNIHandles::make_local(env, loader);
} }
@ -3365,9 +3364,9 @@ JVM_ENTRY(jclass, JVM_LoadClass0(JNIEnv *env, jobject receiver,
!vfst.at_end() && loader == NULL; !vfst.at_end() && loader == NULL;
vfst.next()) { vfst.next()) {
if (!vfst.method()->is_native()) { if (!vfst.method()->is_native()) {
Klass* holder = vfst.method()->method_holder(); InstanceKlass* holder = vfst.method()->method_holder();
loader = InstanceKlass::cast(holder)->class_loader(); loader = holder->class_loader();
protection_domain = InstanceKlass::cast(holder)->protection_domain(); protection_domain = holder->protection_domain();
} }
} }
} else { } else {

View File

@ -753,7 +753,7 @@ void JvmtiClassFileReconstituter::copy_bytecodes(methodHandle mh,
unsigned char* p = bytecodes; unsigned char* p = bytecodes;
Bytecodes::Code code; Bytecodes::Code code;
bool is_rewritten = InstanceKlass::cast(mh->method_holder())->is_rewritten(); bool is_rewritten = mh->method_holder()->is_rewritten();
while ((code = bs.next()) >= 0) { while ((code = bs.next()) >= 0) {
assert(Bytecodes::is_java_code(code), "sanity check"); assert(Bytecodes::is_java_code(code), "sanity check");

View File

@ -2822,7 +2822,7 @@ JvmtiEnv::GetLocalVariableTable(Method* method_oop, jint* entry_count_ptr, jvmti
JavaThread* current_thread = JavaThread::current(); JavaThread* current_thread = JavaThread::current();
// does the klass have any local variable information? // does the klass have any local variable information?
InstanceKlass* ik = InstanceKlass::cast(method_oop->method_holder()); InstanceKlass* ik = method_oop->method_holder();
if (!ik->access_flags().has_localvariable_table()) { if (!ik->access_flags().has_localvariable_table()) {
return (JVMTI_ERROR_ABSENT_INFORMATION); return (JVMTI_ERROR_ABSENT_INFORMATION);
} }

View File

@ -233,7 +233,7 @@ Handle MethodHandles::init_method_MemberName(oop mname_oop, CallInfo& info, TRAP
methodHandle m = info.resolved_method(); methodHandle m = info.resolved_method();
KlassHandle defc = info.resolved_klass(); KlassHandle defc = info.resolved_klass();
int vmindex = -1; int vmindex = -1;
if (defc->is_interface() && Klass::cast(m->method_holder())->is_interface()) { if (defc->is_interface() && m->method_holder()->is_interface()) {
// LinkResolver does not report itable indexes! (fix this?) // LinkResolver does not report itable indexes! (fix this?)
vmindex = klassItable::compute_itable_index(m()); vmindex = klassItable::compute_itable_index(m());
} else if (m->can_be_statically_bound()) { } else if (m->can_be_statically_bound()) {
@ -749,8 +749,8 @@ void MethodHandles::expand_MemberName(Handle mname, int suppress, TRAPS) {
DEBUG_ONLY(vmtarget = NULL); // safety DEBUG_ONLY(vmtarget = NULL); // safety
if (m.is_null()) break; if (m.is_null()) break;
if (!have_defc) { if (!have_defc) {
Klass* defc = m->method_holder(); InstanceKlass* defc = m->method_holder();
java_lang_invoke_MemberName::set_clazz(mname(), Klass::cast(defc)->java_mirror()); java_lang_invoke_MemberName::set_clazz(mname(), defc->java_mirror());
} }
if (!have_name) { if (!have_name) {
//not java_lang_String::create_from_symbol; let's intern member names //not java_lang_String::create_from_symbol; let's intern member names

View File

@ -165,8 +165,7 @@ address NativeLookup::lookup_style(methodHandle method, char* pure_name, const c
// Note: It is critical for bootstrapping that Java_java_lang_ClassLoader_00024NativeLibrary_find // Note: It is critical for bootstrapping that Java_java_lang_ClassLoader_00024NativeLibrary_find
// gets found the first time around - otherwise an infinite loop can occure. This is // gets found the first time around - otherwise an infinite loop can occure. This is
// another VM/library dependency // another VM/library dependency
Handle loader(THREAD, Handle loader(THREAD, method->method_holder()->class_loader());
InstanceKlass::cast(method->method_holder())->class_loader());
if (loader.is_null()) { if (loader.is_null()) {
entry = lookup_special_native(jni_name); entry = lookup_special_native(jni_name);
if (entry == NULL) { if (entry == NULL) {
@ -393,7 +392,7 @@ address NativeLookup::lookup(methodHandle method, bool& in_base_library, TRAPS)
if (PrintJNIResolving) { if (PrintJNIResolving) {
ResourceMark rm(THREAD); ResourceMark rm(THREAD);
tty->print_cr("[Dynamic-linking native method %s.%s ... JNI]", tty->print_cr("[Dynamic-linking native method %s.%s ... JNI]",
Klass::cast(method->method_holder())->external_name(), method->method_holder()->external_name(),
method->name()->as_C_string()); method->name()->as_C_string());
} }
} }

View File

@ -627,7 +627,7 @@ const char* StackWalkCompPolicy::shouldNotInline(methodHandle m) {
// negative filter: should send NOT be inlined? returns NULL (--> inline) or rejection msg // negative filter: should send NOT be inlined? returns NULL (--> inline) or rejection msg
if (m->is_abstract()) return (_msg = "abstract method"); if (m->is_abstract()) return (_msg = "abstract method");
// note: we allow ik->is_abstract() // note: we allow ik->is_abstract()
if (!InstanceKlass::cast(m->method_holder())->is_initialized()) return (_msg = "method holder not initialized"); if (!m->method_holder()->is_initialized()) return (_msg = "method holder not initialized");
if (m->is_native()) return (_msg = "native method"); if (m->is_native()) return (_msg = "native method");
nmethod* m_code = m->code(); nmethod* m_code = m->code();
if (m_code != NULL && m_code->code_size() > InlineSmallCode) if (m_code != NULL && m_code->code_size() > InlineSmallCode)

View File

@ -1191,12 +1191,12 @@ void Deoptimization::load_class_by_index(constantPoolHandle constant_pool, int i
if (!constant_pool->tag_at(index).is_symbol()) return; if (!constant_pool->tag_at(index).is_symbol()) return;
Handle class_loader (THREAD, InstanceKlass::cast(constant_pool->pool_holder())->class_loader()); Handle class_loader (THREAD, constant_pool->pool_holder()->class_loader());
Symbol* symbol = constant_pool->symbol_at(index); Symbol* symbol = constant_pool->symbol_at(index);
// class name? // class name?
if (symbol->byte_at(0) != '(') { if (symbol->byte_at(0) != '(') {
Handle protection_domain (THREAD, Klass::cast(constant_pool->pool_holder())->protection_domain()); Handle protection_domain (THREAD, constant_pool->pool_holder()->protection_domain());
SystemDictionary::resolve_or_null(symbol, class_loader, protection_domain, CHECK); SystemDictionary::resolve_or_null(symbol, class_loader, protection_domain, CHECK);
return; return;
} }
@ -1206,7 +1206,7 @@ void Deoptimization::load_class_by_index(constantPoolHandle constant_pool, int i
for (SignatureStream ss(symbol); !ss.is_done(); ss.next()) { for (SignatureStream ss(symbol); !ss.is_done(); ss.next()) {
if (ss.is_object()) { if (ss.is_object()) {
Symbol* class_name = ss.as_symbol(CHECK); Symbol* class_name = ss.as_symbol(CHECK);
Handle protection_domain (THREAD, Klass::cast(constant_pool->pool_holder())->protection_domain()); Handle protection_domain (THREAD, constant_pool->pool_holder()->protection_domain());
SystemDictionary::resolve_or_null(class_name, class_loader, protection_domain, CHECK); SystemDictionary::resolve_or_null(class_name, class_loader, protection_domain, CHECK);
} }
} }

View File

@ -36,7 +36,7 @@
oop fieldDescriptor::loader() const { oop fieldDescriptor::loader() const {
return InstanceKlass::cast(_cp->pool_holder())->class_loader(); return _cp->pool_holder()->class_loader();
} }
Symbol* fieldDescriptor::generic_signature() const { Symbol* fieldDescriptor::generic_signature() const {
@ -45,7 +45,7 @@ Symbol* fieldDescriptor::generic_signature() const {
} }
int idx = 0; int idx = 0;
InstanceKlass* ik = InstanceKlass::cast(field_holder()); InstanceKlass* ik = field_holder();
for (AllFieldStream fs(ik); !fs.done(); fs.next()) { for (AllFieldStream fs(ik); !fs.done(); fs.next()) {
if (idx == _index) { if (idx == _index) {
return fs.generic_signature(); return fs.generic_signature();
@ -58,7 +58,7 @@ Symbol* fieldDescriptor::generic_signature() const {
} }
AnnotationArray* fieldDescriptor::annotations() const { AnnotationArray* fieldDescriptor::annotations() const {
InstanceKlass* ik = InstanceKlass::cast(field_holder()); InstanceKlass* ik = field_holder();
Array<AnnotationArray*>* md = ik->fields_annotations(); Array<AnnotationArray*>* md = ik->fields_annotations();
if (md == NULL) if (md == NULL)
return NULL; return NULL;

View File

@ -43,12 +43,12 @@ class fieldDescriptor VALUE_OBJ_CLASS_SPEC {
// update the access_flags for the field in the klass // update the access_flags for the field in the klass
void update_klass_field_access_flag() { void update_klass_field_access_flag() {
InstanceKlass* ik = InstanceKlass::cast(field_holder()); InstanceKlass* ik = field_holder();
ik->field(index())->set_access_flags(_access_flags.as_short()); ik->field(index())->set_access_flags(_access_flags.as_short());
} }
FieldInfo* field() const { FieldInfo* field() const {
InstanceKlass* ik = InstanceKlass::cast(field_holder()); InstanceKlass* ik = field_holder();
return ik->field(_index); return ik->field(_index);
} }
@ -59,7 +59,7 @@ class fieldDescriptor VALUE_OBJ_CLASS_SPEC {
Symbol* signature() const { Symbol* signature() const {
return field()->signature(_cp); return field()->signature(_cp);
} }
Klass* field_holder() const { return _cp->pool_holder(); } InstanceKlass* field_holder() const { return _cp->pool_holder(); }
ConstantPool* constants() const { return _cp(); } ConstantPool* constants() const { return _cp(); }
AccessFlags access_flags() const { return _access_flags; } AccessFlags access_flags() const { return _access_flags; }
oop loader() const; oop loader() const;

View File

@ -189,7 +189,7 @@ void JavaCalls::call_default_constructor(JavaThread* thread, methodHandle method
assert(method->name() == vmSymbols::object_initializer_name(), "Should only be called for default constructor"); assert(method->name() == vmSymbols::object_initializer_name(), "Should only be called for default constructor");
assert(method->signature() == vmSymbols::void_method_signature(), "Should only be called for default constructor"); assert(method->signature() == vmSymbols::void_method_signature(), "Should only be called for default constructor");
InstanceKlass* ik = InstanceKlass::cast(method->method_holder()); InstanceKlass* ik = method->method_holder();
if (ik->is_initialized() && ik->has_vanilla_constructor()) { if (ik->is_initialized() && ik->has_vanilla_constructor()) {
// safe to skip constructor call // safe to skip constructor call
} else { } else {
@ -344,11 +344,11 @@ void JavaCalls::call_helper(JavaValue* result, methodHandle* m, JavaCallArgument
#ifdef ASSERT #ifdef ASSERT
{ Klass* holder = method->method_holder(); { InstanceKlass* holder = method->method_holder();
// A klass might not be initialized since JavaCall's might be used during the executing of // A klass might not be initialized since JavaCall's might be used during the executing of
// the <clinit>. For example, a Thread.start might start executing on an object that is // the <clinit>. For example, a Thread.start might start executing on an object that is
// not fully initialized! (bad Java programming style) // not fully initialized! (bad Java programming style)
assert(InstanceKlass::cast(holder)->is_linked(), "rewritting must have taken place"); assert(holder->is_linked(), "rewritting must have taken place");
} }
#endif #endif

View File

@ -56,14 +56,14 @@ static void trace_class_resolution(Klass* to_class) {
vframeStream vfst(jthread); vframeStream vfst(jthread);
// skip over any frames belonging to java.lang.Class // skip over any frames belonging to java.lang.Class
while (!vfst.at_end() && while (!vfst.at_end() &&
InstanceKlass::cast(vfst.method()->method_holder())->name() == vmSymbols::java_lang_Class()) { vfst.method()->method_holder()->name() == vmSymbols::java_lang_Class()) {
vfst.next(); vfst.next();
} }
if (!vfst.at_end()) { if (!vfst.at_end()) {
// this frame is a likely suspect // this frame is a likely suspect
caller = vfst.method()->method_holder(); caller = vfst.method()->method_holder();
line_number = vfst.method()->line_number_from_bci(vfst.bci()); line_number = vfst.method()->line_number_from_bci(vfst.bci());
Symbol* s = InstanceKlass::cast(vfst.method()->method_holder())->source_file_name(); Symbol* s = vfst.method()->method_holder()->source_file_name();
if (s != NULL) { if (s != NULL) {
source_file = s->as_C_string(); source_file = s->as_C_string();
} }
@ -642,8 +642,8 @@ oop get_mirror_from_signature(methodHandle method, SignatureStream* ss, TRAPS) {
case T_OBJECT: case T_OBJECT:
case T_ARRAY: case T_ARRAY:
Symbol* name = ss->as_symbol(CHECK_NULL); Symbol* name = ss->as_symbol(CHECK_NULL);
oop loader = InstanceKlass::cast(method->method_holder())->class_loader(); oop loader = method->method_holder()->class_loader();
oop protection_domain = InstanceKlass::cast(method->method_holder())->protection_domain(); oop protection_domain = method->method_holder()->protection_domain();
Klass* k = SystemDictionary::resolve_or_fail( Klass* k = SystemDictionary::resolve_or_fail(
name, name,
Handle(THREAD, loader), Handle(THREAD, loader),
@ -714,7 +714,7 @@ oop Reflection::new_method(methodHandle method, bool intern_name, bool for_const
assert(!method()->is_initializer() || assert(!method()->is_initializer() ||
(for_constant_pool_access && method()->is_static()) || (for_constant_pool_access && method()->is_static()) ||
(method()->name() == vmSymbols::class_initializer_name() (method()->name() == vmSymbols::class_initializer_name()
&& Klass::cast(method()->method_holder())->is_interface() && JDK_Version::is_jdk12x_version()), "should call new_constructor instead"); && method()->method_holder()->is_interface() && JDK_Version::is_jdk12x_version()), "should call new_constructor instead");
instanceKlassHandle holder (THREAD, method->method_holder()); instanceKlassHandle holder (THREAD, method->method_holder());
int slot = method->method_idnum(); int slot = method->method_idnum();
@ -832,7 +832,7 @@ oop Reflection::new_field(fieldDescriptor* fd, bool intern_name, TRAPS) {
Handle type = new_type(signature, holder, CHECK_NULL); Handle type = new_type(signature, holder, CHECK_NULL);
Handle rh = java_lang_reflect_Field::create(CHECK_NULL); Handle rh = java_lang_reflect_Field::create(CHECK_NULL);
java_lang_reflect_Field::set_clazz(rh(), Klass::cast(fd->field_holder())->java_mirror()); java_lang_reflect_Field::set_clazz(rh(), fd->field_holder()->java_mirror());
java_lang_reflect_Field::set_slot(rh(), fd->index()); java_lang_reflect_Field::set_slot(rh(), fd->index());
java_lang_reflect_Field::set_name(rh(), name()); java_lang_reflect_Field::set_name(rh(), name());
java_lang_reflect_Field::set_type(rh(), type()); java_lang_reflect_Field::set_type(rh(), type());
@ -900,7 +900,7 @@ oop Reflection::invoke(instanceKlassHandle klass, methodHandle reflected_method,
method = reflected_method; method = reflected_method;
} else { } else {
// resolve based on the receiver // resolve based on the receiver
if (InstanceKlass::cast(reflected_method->method_holder())->is_interface()) { if (reflected_method->method_holder()->is_interface()) {
// resolve interface call // resolve interface call
if (ReflectionWrapResolutionErrors) { if (ReflectionWrapResolutionErrors) {
// new default: 6531596 // new default: 6531596

View File

@ -161,7 +161,7 @@ void javaVFrame::print_lock_info_on(outputStream* st, int frame_count) {
// If this is the first frame, and java.lang.Object.wait(...) then print out the receiver. // If this is the first frame, and java.lang.Object.wait(...) then print out the receiver.
if (frame_count == 0) { if (frame_count == 0) {
if (method()->name() == vmSymbols::wait_name() && if (method()->name() == vmSymbols::wait_name() &&
InstanceKlass::cast(method()->method_holder())->name() == vmSymbols::java_lang_Object()) { method()->method_holder()->name() == vmSymbols::java_lang_Object()) {
StackValueCollection* locs = locals(); StackValueCollection* locs = locals();
if (!locs->is_empty()) { if (!locs->is_empty()) {
StackValue* sv = locs->at(0); StackValue* sv = locs->at(0);
@ -407,7 +407,7 @@ void vframeStreamCommon::security_get_caller_frame(int depth) {
if (Universe::reflect_invoke_cache()->is_same_method(method())) { if (Universe::reflect_invoke_cache()->is_same_method(method())) {
// This is Method.invoke() -- skip it // This is Method.invoke() -- skip it
} else if (use_new_reflection && } else if (use_new_reflection &&
Klass::cast(method()->method_holder()) method()->method_holder()
->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass())) { ->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass())) {
// This is an auxilary frame -- skip it // This is an auxilary frame -- skip it
} else if (method()->is_method_handle_intrinsic() || } else if (method()->is_method_handle_intrinsic() ||
@ -471,8 +471,8 @@ void vframeStreamCommon::skip_prefixed_method_and_wrappers() {
void vframeStreamCommon::skip_reflection_related_frames() { void vframeStreamCommon::skip_reflection_related_frames() {
while (!at_end() && while (!at_end() &&
(JDK_Version::is_gte_jdk14x_version() && UseNewReflection && (JDK_Version::is_gte_jdk14x_version() && UseNewReflection &&
(Klass::cast(method()->method_holder())->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass()) || (method()->method_holder()->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass()) ||
Klass::cast(method()->method_holder())->is_subclass_of(SystemDictionary::reflect_ConstructorAccessorImpl_klass())))) { method()->method_holder()->is_subclass_of(SystemDictionary::reflect_ConstructorAccessorImpl_klass())))) {
next(); next();
} }
} }
@ -547,13 +547,13 @@ void javaVFrame::print() {
void javaVFrame::print_value() const { void javaVFrame::print_value() const {
Method* m = method(); Method* m = method();
Klass* k = m->method_holder(); InstanceKlass* k = m->method_holder();
tty->print_cr("frame( sp=" INTPTR_FORMAT ", unextended_sp=" INTPTR_FORMAT ", fp=" INTPTR_FORMAT ", pc=" INTPTR_FORMAT ")", 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()); _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", Klass::cast(k)->internal_name(), m->name()->as_C_string());
if (!m->is_native()) { if (!m->is_native()) {
Symbol* source_name = InstanceKlass::cast(k)->source_file_name(); Symbol* source_name = k->source_file_name();
int line_number = m->line_number_from_bci(bci()); int line_number = m->line_number_from_bci(bci());
if (source_name != NULL && (line_number != -1)) { if (source_name != NULL && (line_number != -1)) {
tty->print("(%s:%d)", source_name->as_C_string(), line_number); tty->print("(%s:%d)", source_name->as_C_string(), line_number);

View File

@ -289,7 +289,7 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary;
nonstatic_field(CompiledICHolder, _holder_klass, Klass*) \ nonstatic_field(CompiledICHolder, _holder_klass, Klass*) \
nonstatic_field(ConstantPool, _tags, Array<u1>*) \ nonstatic_field(ConstantPool, _tags, Array<u1>*) \
nonstatic_field(ConstantPool, _cache, ConstantPoolCache*) \ nonstatic_field(ConstantPool, _cache, ConstantPoolCache*) \
nonstatic_field(ConstantPool, _pool_holder, Klass*) \ nonstatic_field(ConstantPool, _pool_holder, InstanceKlass*) \
nonstatic_field(ConstantPool, _operands, Array<u2>*) \ nonstatic_field(ConstantPool, _operands, Array<u2>*) \
nonstatic_field(ConstantPool, _length, int) \ nonstatic_field(ConstantPool, _length, int) \
nonstatic_field(ConstantPool, _resolved_references, jobject) \ nonstatic_field(ConstantPool, _resolved_references, jobject) \

View File

@ -1117,8 +1117,8 @@ void DumperSupport::dump_stack_frame(DumpWriter* writer,
writer->write_symbolID(m->name()); // method's name writer->write_symbolID(m->name()); // method's name
writer->write_symbolID(m->signature()); // method's signature writer->write_symbolID(m->signature()); // method's signature
assert(Klass::cast(m->method_holder())->oop_is_instance(), "not InstanceKlass"); assert(m->method_holder()->oop_is_instance(), "not InstanceKlass");
writer->write_symbolID(InstanceKlass::cast(m->method_holder())->source_file_name()); // source file name writer->write_symbolID(m->method_holder()->source_file_name()); // source file name
writer->write_u4(class_serial_num); // class serial number writer->write_u4(class_serial_num); // class serial number
writer->write_u4((u4) line_number); // line number writer->write_u4((u4) line_number); // line number
} }