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());
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 Oop getResolvedReferences() {
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. */
public int getOrigBytecodeAt(int bci) {
BreakpointInfo bp = ((InstanceKlass) getMethodHolder()).getBreakpoints();
BreakpointInfo bp = getMethodHolder().getBreakpoints();
for (; bp != null; bp = bp.getNext()) {
if (bp.match(this, bci)) {
return bp.getOrigBytecode();
@ -238,7 +238,7 @@ public class Method extends Metadata {
}
// Method holder (the Klass holding this method)
public Klass getMethodHolder() { return getConstants().getPoolHolder(); }
public InstanceKlass getMethodHolder() { return getConstants().getPoolHolder(); }
// Access flags
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
// the normal JNI call code.
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.
__ 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) {
// 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.
__ 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) {
// 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.
__ 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);
if (m != NULL &&
(bc == Bytecodes::_invokestatic
? InstanceKlass::cast(m->method_holder())->is_not_initialized()
: !InstanceKlass::cast(m->method_holder())->is_loaded())) {
? m->method_holder()->is_not_initialized()
: !m->method_holder()->is_loaded())) {
m = NULL;
}
if (m != NULL) {
@ -1056,7 +1056,7 @@ void ciEnv::register_method(ciMethod* target,
method_name,
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());
}
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();
} else {
// 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
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()) {
if (bp->match(me)) {
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.
k = InstanceKlass::cast(super_m->method_holder())->super();
k = super_m->method_holder()->super();
continue;
}

View File

@ -1156,7 +1156,7 @@ void java_lang_Throwable::print(Handle throwable, outputStream* st) {
// Print stack trace element to resource allocated buffer
char* java_lang_Throwable::print_stack_element_to_buffer(Method* method, int bci) {
// Get strings and string lengths
InstanceKlass* klass = InstanceKlass::cast(method->method_holder());
InstanceKlass* klass = method->method_holder();
const char* klass_name = klass->external_name();
int buf_len = (int)strlen(klass_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);
// Fill in class name
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);
java_lang_StackTraceElement::set_declaringClass(element(), classname);
// Fill in method name
oop methodname = StringTable::intern(method->name(), CHECK_0);
java_lang_StackTraceElement::set_methodName(element(), methodname);
// 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)
source = vmSymbols::unknown_class_name();
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>";
}
}
InstanceKlass* ik = InstanceKlass::cast(method->method_holder());
InstanceKlass* ik = method->method_holder();
ss->indent().print_cr("Location:");
streamIndentor si2(ss);
ss->indent().print_cr("%s.%s%s @%d: %s",
@ -1850,7 +1850,7 @@ void ClassVerifier::verify_cp_index(
if ((index <= 0) || (index >= nconstants)) {
verify_error(ErrorContext::bad_cp_index(bci, index),
"Illegal constant pool index %d in class %s",
index, InstanceKlass::cast(cp->pool_holder())->external_name());
index, cp->pool_holder()->external_name());
return;
}
}
@ -1869,7 +1869,7 @@ void ClassVerifier::verify_cp_type(
if ((types & (1 << tag)) == 0) {
verify_error(ErrorContext::bad_cp_index(bci, index),
"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;
}
}
@ -1881,7 +1881,7 @@ void ClassVerifier::verify_cp_class_type(
if (!tag.is_klass() && !tag.is_unresolved_klass()) {
verify_error(ErrorContext::bad_cp_index(bci, index),
"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;
}
}

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) {
Symbol* mk = Klass::cast(m->method_holder())->name();
Symbol* mk = m->method_holder()->name();
ID declared_id = match_method_with_klass(m, mk);
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()());
entry = VtableStubs::create_stub(false, index, method());
assert(entry != NULL, "entry not computed");
Klass* k = call_info->resolved_method()->method_holder();
assert(Klass::cast(k)->is_interface(), "sanity check");
InstanceKlass* k = call_info->resolved_method()->method_holder();
assert(k->is_interface(), "sanity check");
InlineCacheBuffer::create_transition_stub(this, k, entry);
} else {
// 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)
&& !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.
return true;
}

View File

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

View File

@ -1051,7 +1051,7 @@ void CompileBroker::compile_method_base(methodHandle method,
guarantee(!method->is_abstract(), "cannot compile abstract methods");
assert(method->method_holder()->oop_is_instance(),
"sanity check");
assert(!InstanceKlass::cast(method->method_holder())->is_not_initialized(),
assert(!method->method_holder()->is_not_initialized(),
"method holder must be initialized");
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(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(!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) {
comp_level = CompLevel_highest_tier;

View File

@ -67,7 +67,7 @@ class MethodMatcher : public CHeapObj<mtCompiler> {
// utility 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();
for (MethodMatcher* current = this; current != NULL; current = current->_next) {
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");
fileStream stream(fopen(cc_file(), "at"));
stream.print("exclude ");
Klass::cast(method->method_holder())->name()->print_symbol_on(&stream);
method->method_holder()->name()->print_symbol_on(&stream);
stream.print(".");
method->name()->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
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
// initialization has not been started yet ('!being_initialized')
// 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
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);
char* failed_type_name =
@ -528,7 +528,7 @@ void LinkResolver::resolve_interface_method(methodHandle& resolved_method,
if (check_access) {
HandleMark hm(THREAD);
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);
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
// 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
// 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.
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
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 {
return InstanceKlass::cast(_constants->pool_holder())->method_with_idnum(
_method_idnum);
return _constants->pool_holder()->method_with_idnum(_method_idnum);
}
// 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 {
do_resolve = true;
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
@ -247,7 +247,7 @@ Klass* ConstantPool::klass_at_impl(constantPoolHandle this_oop, int which, TRAPS
if (do_resolve) {
// 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);
Klass* k_oop = SystemDictionary::resolve_or_fail(name, loader, h_prot, true, THREAD);
KlassHandle k;
@ -315,7 +315,7 @@ Klass* ConstantPool::klass_at_impl(constantPoolHandle this_oop, int which, TRAPS
vframeStream vfst(JavaThread::current());
if (!vfst.at_end()) {
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) {
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
if (source_file != NULL) {
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);
} else {
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());
}
}
@ -339,7 +339,7 @@ Klass* ConstantPool::klass_at_impl(constantPoolHandle this_oop, int which, TRAPS
// Only updated constant pool - if it is resolved.
do_resolve = this_oop->tag_at(which).is_unresolved_klass();
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()) {
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");
Thread *thread = Thread::current();
Symbol* name = entry.get_symbol();
oop loader = InstanceKlass::cast(this_oop->pool_holder())->class_loader();
oop protection_domain = Klass::cast(this_oop->pool_holder())->protection_domain();
oop loader = this_oop->pool_holder()->class_loader();
oop protection_domain = this_oop->pool_holder()->protection_domain();
Handle h_prot (thread, protection_domain);
Handle h_loader (thread, loader);
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 {
assert(entry.is_unresolved(), "must be either symbol or klass");
Symbol* name = entry.get_symbol();
oop loader = InstanceKlass::cast(this_oop->pool_holder())->class_loader();
oop protection_domain = Klass::cast(this_oop->pool_holder())->protection_domain();
oop loader = this_oop->pool_holder()->class_loader();
oop protection_domain = this_oop->pool_holder()->protection_domain();
Handle h_loader(THREAD, loader);
Handle h_prot (THREAD, protection_domain);
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(),
err_msg("Unused constant pool patch at %d in class file %s",
index,
InstanceKlass::cast(pool_holder())->external_name()));
pool_holder()->external_name()));
}
#endif // ASSERT
}
@ -1948,7 +1948,7 @@ void ConstantPool::print_value_on(outputStream* st) const {
st->print(" for ");
pool_holder()->print_value_on(st);
if (pool_holder() != NULL) {
bool extra = (InstanceKlass::cast(pool_holder())->constants() != this);
bool extra = (pool_holder()->constants() != this);
if (extra) st->print(" (extra)");
}
if (cache() != NULL) {

View File

@ -86,8 +86,8 @@ class ConstantPool : public Metadata {
friend class Universe; // For null constructor
private:
Array<u1>* _tags; // the tag array describing the constant pool's contents
ConstantPoolCache* _cache; // the cache holding interpreter runtime information
Klass* _pool_holder; // the corresponding class
ConstantPoolCache* _cache; // the cache holding interpreter runtime information
InstanceKlass* _pool_holder; // the corresponding class
Array<u2>* _operands; // for variable-sized (InvokeDynamic) nodes, usually empty
// 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);
// Klass holding pool
Klass* pool_holder() const { return _pool_holder; }
void set_pool_holder(Klass* k) { _pool_holder = k; }
Klass** pool_holder_addr() { return &_pool_holder; }
InstanceKlass* pool_holder() const { return _pool_holder; }
void set_pool_holder(InstanceKlass* k) { _pool_holder = k; }
InstanceKlass** pool_holder_addr() { return &_pool_holder; }
// Interpreter runtime support
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) {
Klass* interf = method->method_holder();
assert(InstanceKlass::cast(interf)->is_interface(), "must be an interface");
InstanceKlass* interf = method->method_holder();
assert(interf->is_interface(), "must be an interface");
assert(!method->is_final_method(), "interfaces do not have final methods; cannot link to one here");
set_f1(interf);
set_f2(index);
@ -421,7 +421,7 @@ bool ConstantPoolCacheEntry::adjust_method_entry(Method* old_method,
if (!(*trace_name_printed)) {
// RC_TRACE_MESG macro has an embedded ResourceMark
RC_TRACE_MESG(("adjust: name=%s",
Klass::cast(old_method->method_holder())->external_name()));
old_method->method_holder()->external_name()));
*trace_name_printed = true;
}
// RC_TRACE macro has an embedded ResourceMark
@ -449,7 +449,7 @@ bool ConstantPoolCacheEntry::adjust_method_entry(Method* old_method,
if (!(*trace_name_printed)) {
// RC_TRACE_MESG macro has an embedded ResourceMark
RC_TRACE_MESG(("adjust: name=%s",
Klass::cast(old_method->method_holder())->external_name()));
old_method->method_holder()->external_name()));
*trace_name_printed = true;
}
// 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) {
// 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)) ||
((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
// 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
// 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,
@ -630,7 +630,7 @@ void klassVtable::adjust_method_entries(Method** old_methods, Method** new_metho
if (!(*trace_name_printed)) {
// RC_TRACE_MESG macro has an embedded ResourceMark
RC_TRACE_MESG(("adjust: name=%s",
Klass::cast(old_method->method_holder())->external_name()));
old_method->method_holder()->external_name()));
*trace_name_printed = true;
}
// 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);
while (target != NULL && target->is_static()) {
// 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);
}
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
methodHandle target_h (THREAD, target); // preserve across gc
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()) {
ResourceMark rm(THREAD);
char* failed_type_name =
@ -825,7 +825,7 @@ void klassItable::adjust_method_entries(Method** old_methods, Method** new_metho
if (!(*trace_name_printed)) {
// RC_TRACE_MESG macro has an embedded ResourceMark
RC_TRACE_MESG(("adjust: name=%s",
Klass::cast(old_method->method_holder())->external_name()));
old_method->method_holder()->external_name()));
*trace_name_printed = true;
}
// 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
int klassItable::compute_itable_index(Method* m) {
Klass* intf = m->method_holder();
assert(InstanceKlass::cast(intf)->is_interface(), "sanity check");
Array<Method*>* methods = InstanceKlass::cast(intf)->methods();
InstanceKlass* intf = m->method_holder();
assert(intf->is_interface(), "sanity check");
Array<Method*>* methods = intf->methods();
int index = 0;
while(methods->at(index) != m) {
index++;

View File

@ -243,12 +243,12 @@ void Method::mask_for(int bci, InterpreterOopMap* mask) {
warning("oopmap should only be accessed by the "
"VM, GC task or CMS threads (or during debugging)");
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();
}
}
#endif
InstanceKlass::cast(method_holder())->mask_for(h_this, bci, mask);
method_holder()->mask_for(h_this, bci, mask);
return;
}
@ -523,7 +523,7 @@ bool Method::compute_has_loops_flag() {
bool Method::is_final_method() const {
// %%% Should return true for private methods also,
// 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 {
return (is_static() ||
InstanceKlass::cast(method_holder())->major_version() < 51);
method_holder()->major_version() < 51);
}
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() ) {
Thread *thread = Thread::current();
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());
return SystemDictionary::find(klass_name, loader, prot, thread) != NULL;
} else {
@ -935,7 +935,7 @@ bool Method::is_overridden_in(Klass* k) const {
// If method is an interface, we skip it - except if it
// is a miranda method
if (InstanceKlass::cast(method_holder())->is_interface()) {
if (method_holder()->is_interface()) {
// Check that method is not a miranda method
if (ik->lookup_method(name(), signature()) == NULL) {
// 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));
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_signature, signature);
cp->set_preresolution();
@ -1237,8 +1237,8 @@ bool Method::load_signature_classes(methodHandle m, TRAPS) {
return false;
}
bool sig_is_loaded = true;
Handle class_loader(THREAD, InstanceKlass::cast(m->method_holder())->class_loader());
Handle protection_domain(THREAD, Klass::cast(m->method_holder())->protection_domain());
Handle class_loader(THREAD, m->method_holder()->class_loader());
Handle protection_domain(THREAD, m->method_holder()->protection_domain());
ResourceMark rm(THREAD);
Symbol* signature = m->signature();
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) {
Handle class_loader(THREAD, InstanceKlass::cast(m->method_holder())->class_loader());
Handle protection_domain(THREAD, Klass::cast(m->method_holder())->protection_domain());
Handle class_loader(THREAD, m->method_holder()->class_loader());
Handle protection_domain(THREAD, m->method_holder()->protection_domain());
ResourceMark rm(THREAD);
Symbol* signature = m->signature();
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 {
BreakpointInfo* bp = InstanceKlass::cast(method_holder())->breakpoints();
BreakpointInfo* bp = method_holder()->breakpoints();
for (; bp != NULL; bp = bp->next()) {
if (bp->match(this, bci)) {
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) {
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()) {
if (bp->match(this, bci)) {
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) {
InstanceKlass* ik = InstanceKlass::cast(method_holder());
InstanceKlass* ik = method_holder();
BreakpointInfo *bp = new BreakpointInfo(this, bci);
bp->set_next(ik->breakpoints());
ik->set_breakpoints(bp);
@ -1503,7 +1503,7 @@ void Method::set_breakpoint(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* 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) {
Method* m = resolve_jmethod_id(mid);
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();
if (cld->jmethod_ids() == NULL) return false;
return (cld->jmethod_ids()->contains((Method**)mid));

View File

@ -209,21 +209,21 @@ class Method : public Metadata {
// annotations support
AnnotationArray* annotations() const {
InstanceKlass* ik = InstanceKlass::cast(method_holder());
InstanceKlass* ik = method_holder();
if (ik->annotations() == NULL) {
return NULL;
}
return ik->annotations()->get_method_annotations_of(method_idnum());
}
AnnotationArray* parameter_annotations() const {
InstanceKlass* ik = InstanceKlass::cast(method_holder());
InstanceKlass* ik = method_holder();
if (ik->annotations() == NULL) {
return NULL;
}
return ik->annotations()->get_method_parameter_annotations_of(method_idnum());
}
AnnotationArray* annotation_default() const {
InstanceKlass* ik = InstanceKlass::cast(method_holder());
InstanceKlass* ik = method_holder();
if (ik->annotations() == NULL) {
return NULL;
}
@ -496,7 +496,7 @@ class Method : public Metadata {
{ return constMethod()->compressed_linenumber_table(); }
// 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)
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
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.
// NOTE that this function can be called from a signal handler
// (see AsyncGetCallTrace support for Forte Analyzer) and this
// needs to be async-safe. No allocation should be done and
// 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
int cached_itable_index() { return InstanceKlass::cast(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); }
int cached_itable_index() { return method_holder()->cached_itable_index(method_idnum()); }
void set_cached_itable_index(int index) { method_holder()->set_cached_itable_index(method_idnum(), index); }
// Support for inlining of intrinsic methods
vmIntrinsics::ID intrinsic_id() const { return (vmIntrinsics::ID) _intrinsic_id; }
@ -734,11 +734,11 @@ class Method : public Metadata {
// On-stack replacement support
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) {
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

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*
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->verify(fd.field_holder()));
@ -4016,7 +4016,7 @@ static bool register_native(KlassHandle k, Symbol* name, Symbol* signature, addr
if (PrintJNIResolving) {
ResourceMark rm(THREAD);
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());
}
return true;

View File

@ -125,7 +125,7 @@ static void trace_class_resolution_impl(Klass* to_class, TRAPS) {
int line_number = -1;
const char * source_file = NULL;
const char * trace = "explicit";
Klass* caller = NULL;
InstanceKlass* caller = NULL;
JavaThread* jthread = JavaThread::current();
if (jthread->has_last_Java_frame()) {
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.
bool found_it = false;
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.next();
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.next();
found_it = true;
}
} else if (last_caller != NULL &&
InstanceKlass::cast(last_caller->method_holder())->name() ==
last_caller->method_holder()->name() ==
vmSymbols::java_lang_ClassLoader() &&
(last_caller->name() == vmSymbols::loadClassInternal_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
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) {
source_file = s->as_C_string();
}
@ -190,8 +190,8 @@ static void trace_class_resolution_impl(Klass* to_class, TRAPS) {
}
if (caller != NULL) {
if (to_class != caller) {
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 (%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());
protection_domain = thread->privileged_stack_top()->protection_domain();
} 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)) {
@ -3048,10 +3048,10 @@ JVM_ENTRY(jclass, JVM_CurrentLoadedClass(JNIEnv *env))
Method* m = vfst.method();
if (!m->is_native()) {
Klass* holder = m->method_holder();
oop loader = InstanceKlass::cast(holder)->class_loader();
InstanceKlass* holder = m->method_holder();
oop loader = holder->class_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();
if (!m->is_native()) {
Klass* holder = m->method_holder();
InstanceKlass* holder = m->method_holder();
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)) {
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()) {
if (!vfst.method()->is_native()) {
Klass* holder = vfst.method()->method_holder();
InstanceKlass* holder = vfst.method()->method_holder();
assert(holder->is_klass(), "just checking");
if (InstanceKlass::cast(holder)->name() == class_name_sym) {
if (holder->name() == class_name_sym) {
return depth;
}
depth++;
@ -3171,9 +3171,9 @@ JVM_ENTRY(jint, JVM_ClassLoaderDepth(JNIEnv *env))
Method* m = vfst.method();
if (!m->is_native()) {
Klass* holder = m->method_holder();
InstanceKlass* holder = m->method_holder();
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)) {
return depth;
}
@ -3322,8 +3322,7 @@ JVM_ENTRY(jobject, JVM_LatestUserDefinedLoader(JNIEnv *env))
for (vframeStream vfst(thread); !vfst.at_end(); vfst.next()) {
// UseNewReflection
vfst.skip_reflection_related_frames(); // Only needed for 1.4 reflection
Klass* holder = vfst.method()->method_holder();
oop loader = InstanceKlass::cast(holder)->class_loader();
oop loader = vfst.method()->method_holder()->class_loader();
if (loader != NULL) {
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.next()) {
if (!vfst.method()->is_native()) {
Klass* holder = vfst.method()->method_holder();
loader = InstanceKlass::cast(holder)->class_loader();
protection_domain = InstanceKlass::cast(holder)->protection_domain();
InstanceKlass* holder = vfst.method()->method_holder();
loader = holder->class_loader();
protection_domain = holder->protection_domain();
}
}
} else {

View File

@ -753,7 +753,7 @@ void JvmtiClassFileReconstituter::copy_bytecodes(methodHandle mh,
unsigned char* p = bytecodes;
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) {
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();
// 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()) {
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();
KlassHandle defc = info.resolved_klass();
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?)
vmindex = klassItable::compute_itable_index(m());
} 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
if (m.is_null()) break;
if (!have_defc) {
Klass* defc = m->method_holder();
java_lang_invoke_MemberName::set_clazz(mname(), Klass::cast(defc)->java_mirror());
InstanceKlass* defc = m->method_holder();
java_lang_invoke_MemberName::set_clazz(mname(), defc->java_mirror());
}
if (!have_name) {
//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
// gets found the first time around - otherwise an infinite loop can occure. This is
// another VM/library dependency
Handle loader(THREAD,
InstanceKlass::cast(method->method_holder())->class_loader());
Handle loader(THREAD, method->method_holder()->class_loader());
if (loader.is_null()) {
entry = lookup_special_native(jni_name);
if (entry == NULL) {
@ -393,7 +392,7 @@ address NativeLookup::lookup(methodHandle method, bool& in_base_library, TRAPS)
if (PrintJNIResolving) {
ResourceMark rm(THREAD);
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());
}
}

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
if (m->is_abstract()) return (_msg = "abstract method");
// 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");
nmethod* m_code = m->code();
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;
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);
// class name?
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);
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()) {
if (ss.is_object()) {
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);
}
}

View File

@ -36,7 +36,7 @@
oop fieldDescriptor::loader() const {
return InstanceKlass::cast(_cp->pool_holder())->class_loader();
return _cp->pool_holder()->class_loader();
}
Symbol* fieldDescriptor::generic_signature() const {
@ -45,7 +45,7 @@ Symbol* fieldDescriptor::generic_signature() const {
}
int idx = 0;
InstanceKlass* ik = InstanceKlass::cast(field_holder());
InstanceKlass* ik = field_holder();
for (AllFieldStream fs(ik); !fs.done(); fs.next()) {
if (idx == _index) {
return fs.generic_signature();
@ -58,7 +58,7 @@ Symbol* fieldDescriptor::generic_signature() const {
}
AnnotationArray* fieldDescriptor::annotations() const {
InstanceKlass* ik = InstanceKlass::cast(field_holder());
InstanceKlass* ik = field_holder();
Array<AnnotationArray*>* md = ik->fields_annotations();
if (md == 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
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());
}
FieldInfo* field() const {
InstanceKlass* ik = InstanceKlass::cast(field_holder());
InstanceKlass* ik = field_holder();
return ik->field(_index);
}
@ -59,46 +59,46 @@ class fieldDescriptor VALUE_OBJ_CLASS_SPEC {
Symbol* signature() const {
return field()->signature(_cp);
}
Klass* field_holder() const { return _cp->pool_holder(); }
ConstantPool* constants() const { return _cp(); }
AccessFlags access_flags() const { return _access_flags; }
oop loader() const;
InstanceKlass* field_holder() const { return _cp->pool_holder(); }
ConstantPool* constants() const { return _cp(); }
AccessFlags access_flags() const { return _access_flags; }
oop loader() const;
// Offset (in words) of field from start of instanceOop / Klass*
int offset() const { return field()->offset(); }
Symbol* generic_signature() const;
int index() const { return _index; }
AnnotationArray* annotations() const;
int offset() const { return field()->offset(); }
Symbol* generic_signature() const;
int index() const { return _index; }
AnnotationArray* annotations() const;
// Initial field value
bool has_initial_value() const { return field()->initval_index() != 0; }
int initial_value_index() const { return field()->initval_index(); }
bool has_initial_value() const { return field()->initval_index() != 0; }
int initial_value_index() const { return field()->initval_index(); }
constantTag initial_value_tag() const; // The tag will return true on one of is_int(), is_long(), is_single(), is_double()
jint int_initial_value() const;
jlong long_initial_value() const;
jfloat float_initial_value() const;
jdouble double_initial_value() const;
oop string_initial_value(TRAPS) const;
jint int_initial_value() const;
jlong long_initial_value() const;
jfloat float_initial_value() const;
jdouble double_initial_value() const;
oop string_initial_value(TRAPS) const;
// Field signature type
BasicType field_type() const { return FieldType::basic_type(signature()); }
BasicType field_type() const { return FieldType::basic_type(signature()); }
// Access flags
bool is_public() const { return access_flags().is_public(); }
bool is_private() const { return access_flags().is_private(); }
bool is_protected() const { return access_flags().is_protected(); }
bool is_package_private() const { return !is_public() && !is_private() && !is_protected(); }
bool is_public() const { return access_flags().is_public(); }
bool is_private() const { return access_flags().is_private(); }
bool is_protected() const { return access_flags().is_protected(); }
bool is_package_private() const { return !is_public() && !is_private() && !is_protected(); }
bool is_static() const { return access_flags().is_static(); }
bool is_final() const { return access_flags().is_final(); }
bool is_volatile() const { return access_flags().is_volatile(); }
bool is_transient() const { return access_flags().is_transient(); }
bool is_static() const { return access_flags().is_static(); }
bool is_final() const { return access_flags().is_final(); }
bool is_volatile() const { return access_flags().is_volatile(); }
bool is_transient() const { return access_flags().is_transient(); }
bool is_synthetic() const { return access_flags().is_synthetic(); }
bool is_synthetic() const { return access_flags().is_synthetic(); }
bool is_field_access_watched() const { return access_flags().is_field_access_watched(); }
bool is_field_access_watched() const { return access_flags().is_field_access_watched(); }
bool is_field_modification_watched() const
{ return access_flags().is_field_modification_watched(); }
bool has_generic_signature() const { return access_flags().field_has_generic_signature(); }
{ return access_flags().is_field_modification_watched(); }
bool has_generic_signature() const { return access_flags().field_has_generic_signature(); }
void set_is_field_access_watched(const bool value) {
_access_flags.set_is_field_access_watched(value);

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->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()) {
// safe to skip constructor call
} else {
@ -344,11 +344,11 @@ void JavaCalls::call_helper(JavaValue* result, methodHandle* m, JavaCallArgument
#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
// the <clinit>. For example, a Thread.start might start executing on an object that is
// 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

View File

@ -56,14 +56,14 @@ static void trace_class_resolution(Klass* to_class) {
vframeStream vfst(jthread);
// skip over any frames belonging to java.lang.Class
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();
}
if (!vfst.at_end()) {
// this frame is a likely suspect
caller = vfst.method()->method_holder();
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) {
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_ARRAY:
Symbol* name = ss->as_symbol(CHECK_NULL);
oop loader = InstanceKlass::cast(method->method_holder())->class_loader();
oop protection_domain = InstanceKlass::cast(method->method_holder())->protection_domain();
oop loader = method->method_holder()->class_loader();
oop protection_domain = method->method_holder()->protection_domain();
Klass* k = SystemDictionary::resolve_or_fail(
name,
Handle(THREAD, loader),
@ -714,7 +714,7 @@ oop Reflection::new_method(methodHandle method, bool intern_name, bool for_const
assert(!method()->is_initializer() ||
(for_constant_pool_access && method()->is_static()) ||
(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());
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 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_name(rh(), name());
java_lang_reflect_Field::set_type(rh(), type());
@ -900,7 +900,7 @@ oop Reflection::invoke(instanceKlassHandle klass, methodHandle reflected_method,
method = reflected_method;
} else {
// resolve based on the receiver
if (InstanceKlass::cast(reflected_method->method_holder())->is_interface()) {
if (reflected_method->method_holder()->is_interface()) {
// resolve interface call
if (ReflectionWrapResolutionErrors) {
// 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 (frame_count == 0) {
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();
if (!locs->is_empty()) {
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())) {
// This is Method.invoke() -- skip it
} else if (use_new_reflection &&
Klass::cast(method()->method_holder())
method()->method_holder()
->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass())) {
// This is an auxilary frame -- skip it
} else if (method()->is_method_handle_intrinsic() ||
@ -471,8 +471,8 @@ void vframeStreamCommon::skip_prefixed_method_and_wrappers() {
void vframeStreamCommon::skip_reflection_related_frames() {
while (!at_end() &&
(JDK_Version::is_gte_jdk14x_version() && UseNewReflection &&
(Klass::cast(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_MethodAccessorImpl_klass()) ||
method()->method_holder()->is_subclass_of(SystemDictionary::reflect_ConstructorAccessorImpl_klass())))) {
next();
}
}
@ -547,13 +547,13 @@ void javaVFrame::print() {
void javaVFrame::print_value() const {
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 ")",
_fr.sp(), _fr.unextended_sp(), _fr.fp(), _fr.pc());
tty->print("%s.%s", Klass::cast(k)->internal_name(), m->name()->as_C_string());
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());
if (source_name != NULL && (line_number != -1)) {
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(ConstantPool, _tags, Array<u1>*) \
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, _length, int) \
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->signature()); // method's signature
assert(Klass::cast(m->method_holder())->oop_is_instance(), "not InstanceKlass");
writer->write_symbolID(InstanceKlass::cast(m->method_holder())->source_file_name()); // source file name
assert(m->method_holder()->oop_is_instance(), "not InstanceKlass");
writer->write_symbolID(m->method_holder()->source_file_name()); // source file name
writer->write_u4(class_serial_num); // class serial number
writer->write_u4((u4) line_number); // line number
}