# HG changeset patch # User coleenp # Date 1352232577 18000 # Node ID 18fb7da425345267c14c6dc1c52274e2018546d0 # Parent c284cf4781f04129b07731cc11798b990e502357 8000725: NPG: method_holder() and pool_holder() and pool_holder field should be InstanceKlass Summary: Change types of above methods and field to InstanceKlass and remove unneeded casts from the source files. Reviewed-by: dholmes, coleenp, zgu Contributed-by: harold.seigel@oracle.com diff -r c284cf4781f0 -r 18fb7da42534 agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java --- a/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java Thu Oct 04 14:55:57 2012 +0200 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java Tue Nov 06 15:09:37 2012 -0500 @@ -121,7 +121,7 @@ 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()); diff -r c284cf4781f0 -r 18fb7da42534 agent/src/share/classes/sun/jvm/hotspot/oops/Method.java --- a/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java Thu Oct 04 14:55:57 2012 +0200 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java Tue Nov 06 15:09:37 2012 -0500 @@ -177,7 +177,7 @@ 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 @@ } // 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(); } diff -r c284cf4781f0 -r 18fb7da42534 src/cpu/sparc/vm/sharedRuntime_sparc.cpp --- a/src/cpu/sparc/vm/sharedRuntime_sparc.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/cpu/sparc/vm/sharedRuntime_sparc.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -2322,7 +2322,7 @@ // 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); diff -r c284cf4781f0 -r 18fb7da42534 src/cpu/x86/vm/sharedRuntime_x86_32.cpp --- a/src/cpu/x86/vm/sharedRuntime_x86_32.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/cpu/x86/vm/sharedRuntime_x86_32.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -1936,7 +1936,7 @@ 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); diff -r c284cf4781f0 -r 18fb7da42534 src/cpu/x86/vm/sharedRuntime_x86_64.cpp --- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -2179,7 +2179,7 @@ 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); diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/ci/ciEnv.cpp --- a/src/share/vm/ci/ciEnv.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/ci/ciEnv.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -768,8 +768,8 @@ 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 @@ method_name, entry_bci); } - InstanceKlass::cast(method->method_holder())->add_osr_nmethod(nm); + method->method_holder()->add_osr_nmethod(nm); } } diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/ci/ciMethod.cpp --- a/src/share/vm/ci/ciMethod.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/ci/ciMethod.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -105,7 +105,7 @@ 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 @@ // 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()); diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/classfile/classFileParser.cpp --- a/src/share/vm/classfile/classFileParser.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/classfile/classFileParser.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -4193,7 +4193,7 @@ } // 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; } diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/classfile/javaClasses.cpp --- a/src/share/vm/classfile/javaClasses.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/classfile/javaClasses.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -1156,7 +1156,7 @@ // 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 @@ 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); diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/classfile/verifier.cpp --- a/src/share/vm/classfile/verifier.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/classfile/verifier.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -446,7 +446,7 @@ bytecode_name = ""; } } - 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 @@ 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 @@ 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 @@ 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; } } diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/classfile/vmSymbols.cpp --- a/src/share/vm/classfile/vmSymbols.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/classfile/vmSymbols.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -507,7 +507,7 @@ } 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 diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/code/compiledIC.cpp --- a/src/share/vm/code/compiledIC.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/code/compiledIC.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -191,8 +191,8 @@ 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. diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/code/dependencies.cpp --- a/src/share/vm/code/dependencies.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/code/dependencies.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -829,7 +829,7 @@ } 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; } diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/code/nmethod.cpp --- a/src/share/vm/code/nmethod.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/code/nmethod.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -1263,7 +1263,7 @@ 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; } diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/compiler/compileBroker.cpp --- a/src/share/vm/compiler/compileBroker.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/compiler/compileBroker.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -1051,7 +1051,7 @@ 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 @@ 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; diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/compiler/compilerOracle.cpp --- a/src/share/vm/compiler/compilerOracle.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/compiler/compilerOracle.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -67,7 +67,7 @@ // 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 @@ 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); diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/interpreter/linkResolver.cpp --- a/src/share/vm/interpreter/linkResolver.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/interpreter/linkResolver.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -133,7 +133,7 @@ // 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 @@ // 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 @@ 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 @@ // 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 diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/oops/constMethod.cpp --- a/src/share/vm/oops/constMethod.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/oops/constMethod.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -113,8 +113,7 @@ } 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, diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/oops/constantPool.cpp --- a/src/share/vm/oops/constantPool.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/oops/constantPool.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -228,7 +228,7 @@ } 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 @@ 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 @@ 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 @@ // 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 @@ // 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 @@ 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 @@ } 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 @@ 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 @@ 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) { diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/oops/constantPool.hpp --- a/src/share/vm/oops/constantPool.hpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/oops/constantPool.hpp Tue Nov 06 15:09:37 2012 -0500 @@ -86,8 +86,8 @@ friend class Universe; // For null constructor private: Array* _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* _operands; // for variable-sized (InvokeDynamic) nodes, usually empty // Array of resolved objects from the constant pool and map from resolved @@ -193,9 +193,9 @@ 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; } diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/oops/cpCache.cpp --- a/src/share/vm/oops/cpCache.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/oops/cpCache.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -231,8 +231,8 @@ 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 @@ 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 @@ 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 diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/oops/klassVtable.cpp --- a/src/share/vm/oops/klassVtable.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/oops/klassVtable.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -307,7 +307,7 @@ 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 @@ } // 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 @@ 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 @@ 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 @@ // 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 @@ 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 @@ // 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* methods = InstanceKlass::cast(intf)->methods(); + InstanceKlass* intf = m->method_holder(); + assert(intf->is_interface(), "sanity check"); + Array* methods = intf->methods(); int index = 0; while(methods->at(index) != m) { index++; diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/oops/method.cpp --- a/src/share/vm/oops/method.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/oops/method.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -243,12 +243,12 @@ 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::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::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 @@ 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 @@ // 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 @@ 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 @@ 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::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 @@ 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 @@ 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_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 @@ } 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 @@ 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)); diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/oops/method.hpp --- a/src/share/vm/oops/method.hpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/oops/method.hpp Tue Nov 06 15:09:37 2012 -0500 @@ -209,21 +209,21 @@ // 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 @@ { 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 @@ // 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 @@ // 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 diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/prims/jni.cpp --- a/src/share/vm/prims/jni.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/prims/jni.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -2985,7 +2985,7 @@ } // 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 @@ 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; diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/prims/jvm.cpp --- a/src/share/vm/prims/jvm.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/prims/jvm.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -125,7 +125,7 @@ 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 @@ // 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 @@ // 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 @@ } 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ !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 { diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/prims/jvmtiClassFileReconstituter.cpp --- a/src/share/vm/prims/jvmtiClassFileReconstituter.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/prims/jvmtiClassFileReconstituter.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -753,7 +753,7 @@ 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"); diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/prims/jvmtiEnv.cpp --- a/src/share/vm/prims/jvmtiEnv.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/prims/jvmtiEnv.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -2822,7 +2822,7 @@ 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); } diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/prims/methodHandles.cpp --- a/src/share/vm/prims/methodHandles.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/prims/methodHandles.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -233,7 +233,7 @@ 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 @@ 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 diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/prims/nativeLookup.cpp --- a/src/share/vm/prims/nativeLookup.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/prims/nativeLookup.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -165,8 +165,7 @@ // 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 @@ 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()); } } diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/runtime/compilationPolicy.cpp --- a/src/share/vm/runtime/compilationPolicy.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/runtime/compilationPolicy.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -627,7 +627,7 @@ // 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) diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/runtime/deoptimization.cpp --- a/src/share/vm/runtime/deoptimization.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/runtime/deoptimization.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -1191,12 +1191,12 @@ 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 @@ 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); } } diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/runtime/fieldDescriptor.cpp --- a/src/share/vm/runtime/fieldDescriptor.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/runtime/fieldDescriptor.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -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 @@ } 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 @@ } AnnotationArray* fieldDescriptor::annotations() const { - InstanceKlass* ik = InstanceKlass::cast(field_holder()); + InstanceKlass* ik = field_holder(); Array* md = ik->fields_annotations(); if (md == NULL) return NULL; diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/runtime/fieldDescriptor.hpp --- a/src/share/vm/runtime/fieldDescriptor.hpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/runtime/fieldDescriptor.hpp Tue Nov 06 15:09:37 2012 -0500 @@ -43,12 +43,12 @@ // 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 @@ 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); diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/runtime/javaCalls.cpp --- a/src/share/vm/runtime/javaCalls.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/runtime/javaCalls.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -189,7 +189,7 @@ 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 @@ #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 . 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 diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/runtime/reflection.cpp --- a/src/share/vm/runtime/reflection.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/runtime/reflection.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -56,14 +56,14 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/runtime/vframe.cpp --- a/src/share/vm/runtime/vframe.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/runtime/vframe.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -161,7 +161,7 @@ // 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 @@ 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_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_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); diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/runtime/vmStructs.cpp --- a/src/share/vm/runtime/vmStructs.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/runtime/vmStructs.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -289,7 +289,7 @@ nonstatic_field(CompiledICHolder, _holder_klass, Klass*) \ nonstatic_field(ConstantPool, _tags, Array*) \ nonstatic_field(ConstantPool, _cache, ConstantPoolCache*) \ - nonstatic_field(ConstantPool, _pool_holder, Klass*) \ + nonstatic_field(ConstantPool, _pool_holder, InstanceKlass*) \ nonstatic_field(ConstantPool, _operands, Array*) \ nonstatic_field(ConstantPool, _length, int) \ nonstatic_field(ConstantPool, _resolved_references, jobject) \ diff -r c284cf4781f0 -r 18fb7da42534 src/share/vm/services/heapDumper.cpp --- a/src/share/vm/services/heapDumper.cpp Thu Oct 04 14:55:57 2012 +0200 +++ b/src/share/vm/services/heapDumper.cpp Tue Nov 06 15:09:37 2012 -0500 @@ -1117,8 +1117,8 @@ 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 }