Fri, 09 Nov 2012 16:45:20 -0800
Merge
1.1 --- a/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java Fri Nov 09 19:24:31 2012 -0500 1.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java Fri Nov 09 16:45:20 2012 -0800 1.3 @@ -121,7 +121,7 @@ 1.4 Address addr = cache.getValue(getAddress()); 1.5 return (ConstantPoolCache) VMObjectFactory.newObject(ConstantPoolCache.class, addr); 1.6 } 1.7 - public Klass getPoolHolder() { return (Klass) poolHolder.getValue(this); } 1.8 + public InstanceKlass getPoolHolder() { return (InstanceKlass)poolHolder.getValue(this); } 1.9 public int getLength() { return (int)length.getValue(getAddress()); } 1.10 public Oop getResolvedReferences() { 1.11 Address handle = resolvedReferences.getValue(getAddress());
2.1 --- a/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java Fri Nov 09 19:24:31 2012 -0500 2.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java Fri Nov 09 16:45:20 2012 -0800 2.3 @@ -177,7 +177,7 @@ 2.4 bci. It is required that there is currently a bytecode at this 2.5 bci. */ 2.6 public int getOrigBytecodeAt(int bci) { 2.7 - BreakpointInfo bp = ((InstanceKlass) getMethodHolder()).getBreakpoints(); 2.8 + BreakpointInfo bp = getMethodHolder().getBreakpoints(); 2.9 for (; bp != null; bp = bp.getNext()) { 2.10 if (bp.match(this, bci)) { 2.11 return bp.getOrigBytecode(); 2.12 @@ -238,7 +238,7 @@ 2.13 } 2.14 2.15 // Method holder (the Klass holding this method) 2.16 - public Klass getMethodHolder() { return getConstants().getPoolHolder(); } 2.17 + public InstanceKlass getMethodHolder() { return getConstants().getPoolHolder(); } 2.18 2.19 // Access flags 2.20 public boolean isPublic() { return getAccessFlagsObj().isPublic(); }
3.1 --- a/src/cpu/sparc/vm/sharedRuntime_sparc.cpp Fri Nov 09 19:24:31 2012 -0500 3.2 +++ b/src/cpu/sparc/vm/sharedRuntime_sparc.cpp Fri Nov 09 16:45:20 2012 -0800 3.3 @@ -2322,7 +2322,7 @@ 3.4 // Pre-load a static method's oop into O1. Used both by locking code and 3.5 // the normal JNI call code. 3.6 if (method->is_static() && !is_critical_native) { 3.7 - __ set_oop_constant(JNIHandles::make_local(Klass::cast(method->method_holder())->java_mirror()), O1); 3.8 + __ set_oop_constant(JNIHandles::make_local(method->method_holder()->java_mirror()), O1); 3.9 3.10 // Now handlize the static class mirror in O1. It's known not-null. 3.11 __ st_ptr(O1, SP, klass_offset + STACK_BIAS);
4.1 --- a/src/cpu/x86/vm/sharedRuntime_x86_32.cpp Fri Nov 09 19:24:31 2012 -0500 4.2 +++ b/src/cpu/x86/vm/sharedRuntime_x86_32.cpp Fri Nov 09 16:45:20 2012 -0800 4.3 @@ -1936,7 +1936,7 @@ 4.4 if (method->is_static() && !is_critical_native) { 4.5 4.6 // load opp into a register 4.7 - __ movoop(oop_handle_reg, JNIHandles::make_local(Klass::cast(method->method_holder())->java_mirror())); 4.8 + __ movoop(oop_handle_reg, JNIHandles::make_local(method->method_holder()->java_mirror())); 4.9 4.10 // Now handlize the static class mirror it's known not-null. 4.11 __ movptr(Address(rsp, klass_offset), oop_handle_reg);
5.1 --- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Fri Nov 09 19:24:31 2012 -0500 5.2 +++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Fri Nov 09 16:45:20 2012 -0800 5.3 @@ -2179,7 +2179,7 @@ 5.4 if (method->is_static() && !is_critical_native) { 5.5 5.6 // load oop into a register 5.7 - __ movoop(oop_handle_reg, JNIHandles::make_local(Klass::cast(method->method_holder())->java_mirror())); 5.8 + __ movoop(oop_handle_reg, JNIHandles::make_local(method->method_holder()->java_mirror())); 5.9 5.10 // Now handlize the static class mirror it's known not-null. 5.11 __ movptr(Address(rsp, klass_offset), oop_handle_reg);
6.1 --- a/src/share/vm/ci/ciEnv.cpp Fri Nov 09 19:24:31 2012 -0500 6.2 +++ b/src/share/vm/ci/ciEnv.cpp Fri Nov 09 16:45:20 2012 -0800 6.3 @@ -768,8 +768,8 @@ 6.4 Method* m = lookup_method(accessor->get_instanceKlass(), lookup, name_sym, sig_sym, bc); 6.5 if (m != NULL && 6.6 (bc == Bytecodes::_invokestatic 6.7 - ? InstanceKlass::cast(m->method_holder())->is_not_initialized() 6.8 - : !InstanceKlass::cast(m->method_holder())->is_loaded())) { 6.9 + ? m->method_holder()->is_not_initialized() 6.10 + : !m->method_holder()->is_loaded())) { 6.11 m = NULL; 6.12 } 6.13 if (m != NULL) { 6.14 @@ -1056,7 +1056,7 @@ 6.15 method_name, 6.16 entry_bci); 6.17 } 6.18 - InstanceKlass::cast(method->method_holder())->add_osr_nmethod(nm); 6.19 + method->method_holder()->add_osr_nmethod(nm); 6.20 6.21 } 6.22 }
7.1 --- a/src/share/vm/ci/ciMethod.cpp Fri Nov 09 19:24:31 2012 -0500 7.2 +++ b/src/share/vm/ci/ciMethod.cpp Fri Nov 09 16:45:20 2012 -0800 7.3 @@ -105,7 +105,7 @@ 7.4 CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops()); 7.5 } 7.6 7.7 - if (InstanceKlass::cast(h_m()->method_holder())->is_linked()) { 7.8 + if (h_m()->method_holder()->is_linked()) { 7.9 _can_be_statically_bound = h_m()->can_be_statically_bound(); 7.10 } else { 7.11 // Have to use a conservative value in this case. 7.12 @@ -188,7 +188,7 @@ 7.13 7.14 // Revert any breakpoint bytecodes in ci's copy 7.15 if (me->number_of_breakpoints() > 0) { 7.16 - BreakpointInfo* bp = InstanceKlass::cast(me->method_holder())->breakpoints(); 7.17 + BreakpointInfo* bp = me->method_holder()->breakpoints(); 7.18 for (; bp != NULL; bp = bp->next()) { 7.19 if (bp->match(me)) { 7.20 code_at_put(bp->bci(), bp->orig_bytecode());
8.1 --- a/src/share/vm/classfile/classFileParser.cpp Fri Nov 09 19:24:31 2012 -0500 8.2 +++ b/src/share/vm/classfile/classFileParser.cpp Fri Nov 09 16:45:20 2012 -0800 8.3 @@ -4193,7 +4193,7 @@ 8.4 } 8.5 8.6 // continue to look from super_m's holder's super. 8.7 - k = InstanceKlass::cast(super_m->method_holder())->super(); 8.8 + k = super_m->method_holder()->super(); 8.9 continue; 8.10 } 8.11
9.1 --- a/src/share/vm/classfile/javaClasses.cpp Fri Nov 09 19:24:31 2012 -0500 9.2 +++ b/src/share/vm/classfile/javaClasses.cpp Fri Nov 09 16:45:20 2012 -0800 9.3 @@ -1156,7 +1156,7 @@ 9.4 // Print stack trace element to resource allocated buffer 9.5 char* java_lang_Throwable::print_stack_element_to_buffer(Method* method, int bci) { 9.6 // Get strings and string lengths 9.7 - InstanceKlass* klass = InstanceKlass::cast(method->method_holder()); 9.8 + InstanceKlass* klass = method->method_holder(); 9.9 const char* klass_name = klass->external_name(); 9.10 int buf_len = (int)strlen(klass_name); 9.11 char* source_file_name; 9.12 @@ -1747,14 +1747,14 @@ 9.13 Handle element = ik->allocate_instance_handle(CHECK_0); 9.14 // Fill in class name 9.15 ResourceMark rm(THREAD); 9.16 - const char* str = InstanceKlass::cast(method->method_holder())->external_name(); 9.17 + const char* str = method->method_holder()->external_name(); 9.18 oop classname = StringTable::intern((char*) str, CHECK_0); 9.19 java_lang_StackTraceElement::set_declaringClass(element(), classname); 9.20 // Fill in method name 9.21 oop methodname = StringTable::intern(method->name(), CHECK_0); 9.22 java_lang_StackTraceElement::set_methodName(element(), methodname); 9.23 // Fill in source file name 9.24 - Symbol* source = InstanceKlass::cast(method->method_holder())->source_file_name(); 9.25 + Symbol* source = method->method_holder()->source_file_name(); 9.26 if (ShowHiddenFrames && source == NULL) 9.27 source = vmSymbols::unknown_class_name(); 9.28 oop filename = StringTable::intern(source, CHECK_0);
10.1 --- a/src/share/vm/classfile/verifier.cpp Fri Nov 09 19:24:31 2012 -0500 10.2 +++ b/src/share/vm/classfile/verifier.cpp Fri Nov 09 16:45:20 2012 -0800 10.3 @@ -446,7 +446,7 @@ 10.4 bytecode_name = "<illegal>"; 10.5 } 10.6 } 10.7 - InstanceKlass* ik = InstanceKlass::cast(method->method_holder()); 10.8 + InstanceKlass* ik = method->method_holder(); 10.9 ss->indent().print_cr("Location:"); 10.10 streamIndentor si2(ss); 10.11 ss->indent().print_cr("%s.%s%s @%d: %s", 10.12 @@ -1850,7 +1850,7 @@ 10.13 if ((index <= 0) || (index >= nconstants)) { 10.14 verify_error(ErrorContext::bad_cp_index(bci, index), 10.15 "Illegal constant pool index %d in class %s", 10.16 - index, InstanceKlass::cast(cp->pool_holder())->external_name()); 10.17 + index, cp->pool_holder()->external_name()); 10.18 return; 10.19 } 10.20 } 10.21 @@ -1869,7 +1869,7 @@ 10.22 if ((types & (1 << tag)) == 0) { 10.23 verify_error(ErrorContext::bad_cp_index(bci, index), 10.24 "Illegal type at constant pool entry %d in class %s", 10.25 - index, InstanceKlass::cast(cp->pool_holder())->external_name()); 10.26 + index, cp->pool_holder()->external_name()); 10.27 return; 10.28 } 10.29 } 10.30 @@ -1881,7 +1881,7 @@ 10.31 if (!tag.is_klass() && !tag.is_unresolved_klass()) { 10.32 verify_error(ErrorContext::bad_cp_index(bci, index), 10.33 "Illegal type at constant pool entry %d in class %s", 10.34 - index, InstanceKlass::cast(cp->pool_holder())->external_name()); 10.35 + index, cp->pool_holder()->external_name()); 10.36 return; 10.37 } 10.38 }
11.1 --- a/src/share/vm/classfile/vmSymbols.cpp Fri Nov 09 19:24:31 2012 -0500 11.2 +++ b/src/share/vm/classfile/vmSymbols.cpp Fri Nov 09 16:45:20 2012 -0800 11.3 @@ -507,7 +507,7 @@ 11.4 } 11.5 11.6 void vmIntrinsics::verify_method(ID actual_id, Method* m) { 11.7 - Symbol* mk = Klass::cast(m->method_holder())->name(); 11.8 + Symbol* mk = m->method_holder()->name(); 11.9 ID declared_id = match_method_with_klass(m, mk); 11.10 11.11 if (declared_id == actual_id) return; // success
12.1 --- a/src/share/vm/code/compiledIC.cpp Fri Nov 09 19:24:31 2012 -0500 12.2 +++ b/src/share/vm/code/compiledIC.cpp Fri Nov 09 16:45:20 2012 -0800 12.3 @@ -191,8 +191,8 @@ 12.4 int index = klassItable::compute_itable_index(call_info->resolved_method()()); 12.5 entry = VtableStubs::create_stub(false, index, method()); 12.6 assert(entry != NULL, "entry not computed"); 12.7 - Klass* k = call_info->resolved_method()->method_holder(); 12.8 - assert(Klass::cast(k)->is_interface(), "sanity check"); 12.9 + InstanceKlass* k = call_info->resolved_method()->method_holder(); 12.10 + assert(k->is_interface(), "sanity check"); 12.11 InlineCacheBuffer::create_transition_stub(this, k, entry); 12.12 } else { 12.13 // Can be different than method->vtable_index(), due to package-private etc.
13.1 --- a/src/share/vm/code/dependencies.cpp Fri Nov 09 19:24:31 2012 -0500 13.2 +++ b/src/share/vm/code/dependencies.cpp Fri Nov 09 16:45:20 2012 -0800 13.3 @@ -829,7 +829,7 @@ 13.4 } 13.5 if ( !Dependencies::is_concrete_method(lm) 13.6 && !Dependencies::is_concrete_method(m) 13.7 - && Klass::cast(lm->method_holder())->is_subtype_of(m->method_holder())) 13.8 + && lm->method_holder()->is_subtype_of(m->method_holder())) 13.9 // Method m is overridden by lm, but both are non-concrete. 13.10 return true; 13.11 }
14.1 --- a/src/share/vm/code/nmethod.cpp Fri Nov 09 19:24:31 2012 -0500 14.2 +++ b/src/share/vm/code/nmethod.cpp Fri Nov 09 16:45:20 2012 -0800 14.3 @@ -1263,7 +1263,7 @@ 14.4 assert(_entry_bci != InvocationEntryBci, "wrong kind of nmethod"); 14.5 // Remove from list of active nmethods 14.6 if (method() != NULL) 14.7 - InstanceKlass::cast(method()->method_holder())->remove_osr_nmethod(this); 14.8 + method()->method_holder()->remove_osr_nmethod(this); 14.9 // Set entry as invalid 14.10 _entry_bci = InvalidOSREntryBci; 14.11 }
15.1 --- a/src/share/vm/compiler/compileBroker.cpp Fri Nov 09 19:24:31 2012 -0500 15.2 +++ b/src/share/vm/compiler/compileBroker.cpp Fri Nov 09 16:45:20 2012 -0800 15.3 @@ -1051,7 +1051,7 @@ 15.4 guarantee(!method->is_abstract(), "cannot compile abstract methods"); 15.5 assert(method->method_holder()->oop_is_instance(), 15.6 "sanity check"); 15.7 - assert(!InstanceKlass::cast(method->method_holder())->is_not_initialized(), 15.8 + assert(!method->method_holder()->is_not_initialized(), 15.9 "method holder must be initialized"); 15.10 assert(!method->is_method_handle_intrinsic(), "do not enqueue these guys"); 15.11 15.12 @@ -1206,7 +1206,7 @@ 15.13 assert(method->method_holder()->oop_is_instance(), "not an instance method"); 15.14 assert(osr_bci == InvocationEntryBci || (0 <= osr_bci && osr_bci < method->code_size()), "bci out of range"); 15.15 assert(!method->is_abstract() && (osr_bci == InvocationEntryBci || !method->is_native()), "cannot compile abstract/native methods"); 15.16 - assert(!InstanceKlass::cast(method->method_holder())->is_not_initialized(), "method holder must be initialized"); 15.17 + assert(!method->method_holder()->is_not_initialized(), "method holder must be initialized"); 15.18 15.19 if (!TieredCompilation) { 15.20 comp_level = CompLevel_highest_tier;
16.1 --- a/src/share/vm/compiler/compilerOracle.cpp Fri Nov 09 19:24:31 2012 -0500 16.2 +++ b/src/share/vm/compiler/compilerOracle.cpp Fri Nov 09 16:45:20 2012 -0800 16.3 @@ -67,7 +67,7 @@ 16.4 16.5 // utility method 16.6 MethodMatcher* find(methodHandle method) { 16.7 - Symbol* class_name = Klass::cast(method->method_holder())->name(); 16.8 + Symbol* class_name = method->method_holder()->name(); 16.9 Symbol* method_name = method->name(); 16.10 for (MethodMatcher* current = this; current != NULL; current = current->_next) { 16.11 if (match(class_name, current->class_name(), current->_class_mode) && 16.12 @@ -624,7 +624,7 @@ 16.13 assert(has_command_file(), "command file must be specified"); 16.14 fileStream stream(fopen(cc_file(), "at")); 16.15 stream.print("exclude "); 16.16 - Klass::cast(method->method_holder())->name()->print_symbol_on(&stream); 16.17 + method->method_holder()->name()->print_symbol_on(&stream); 16.18 stream.print("."); 16.19 method->name()->print_symbol_on(&stream); 16.20 method->signature()->print_symbol_on(&stream);
17.1 --- a/src/share/vm/interpreter/linkResolver.cpp Fri Nov 09 19:24:31 2012 -0500 17.2 +++ b/src/share/vm/interpreter/linkResolver.cpp Fri Nov 09 16:45:20 2012 -0800 17.3 @@ -133,7 +133,7 @@ 17.4 // don't force compilation, resolve was on behalf of compiler 17.5 return; 17.6 } 17.7 - if (InstanceKlass::cast(selected_method->method_holder())->is_not_initialized()) { 17.8 + if (selected_method->method_holder()->is_not_initialized()) { 17.9 // 'is_not_initialized' means not only '!is_initialized', but also that 17.10 // initialization has not been started yet ('!being_initialized') 17.11 // Do not force compilation of methods in uninitialized classes. 17.12 @@ -466,7 +466,7 @@ 17.13 17.14 // check loader constraints 17.15 Handle loader (THREAD, InstanceKlass::cast(current_klass())->class_loader()); 17.16 - Handle class_loader (THREAD, InstanceKlass::cast(resolved_method->method_holder())->class_loader()); 17.17 + Handle class_loader (THREAD, resolved_method->method_holder()->class_loader()); 17.18 { 17.19 ResourceMark rm(THREAD); 17.20 char* failed_type_name = 17.21 @@ -528,7 +528,7 @@ 17.22 if (check_access) { 17.23 HandleMark hm(THREAD); 17.24 Handle loader (THREAD, InstanceKlass::cast(current_klass())->class_loader()); 17.25 - Handle class_loader (THREAD, InstanceKlass::cast(resolved_method->method_holder())->class_loader()); 17.26 + Handle class_loader (THREAD, resolved_method->method_holder()->class_loader()); 17.27 { 17.28 ResourceMark rm(THREAD); 17.29 char* failed_type_name = 17.30 @@ -910,12 +910,12 @@ 17.31 17.32 // Virtual methods cannot be resolved before its klass has been linked, for otherwise the Method*'s 17.33 // has not been rewritten, and the vtable initialized. 17.34 - assert(InstanceKlass::cast(resolved_method->method_holder())->is_linked(), "must be linked"); 17.35 + assert(resolved_method->method_holder()->is_linked(), "must be linked"); 17.36 17.37 // Virtual methods cannot be resolved before its klass has been linked, for otherwise the Method*'s 17.38 // has not been rewritten, and the vtable initialized. Make sure to do this after the nullcheck, since 17.39 // a missing receiver might result in a bogus lookup. 17.40 - assert(InstanceKlass::cast(resolved_method->method_holder())->is_linked(), "must be linked"); 17.41 + assert(resolved_method->method_holder()->is_linked(), "must be linked"); 17.42 17.43 // do lookup based on receiver klass using the vtable index 17.44 if (resolved_method->method_holder()->is_interface()) { // miranda method
18.1 --- a/src/share/vm/oops/constMethod.cpp Fri Nov 09 19:24:31 2012 -0500 18.2 +++ b/src/share/vm/oops/constMethod.cpp Fri Nov 09 16:45:20 2012 -0800 18.3 @@ -113,8 +113,7 @@ 18.4 } 18.5 18.6 Method* ConstMethod::method() const { 18.7 - return InstanceKlass::cast(_constants->pool_holder())->method_with_idnum( 18.8 - _method_idnum); 18.9 + return _constants->pool_holder()->method_with_idnum(_method_idnum); 18.10 } 18.11 18.12 // linenumber table - note that length is unknown until decompression,
19.1 --- a/src/share/vm/oops/constantPool.cpp Fri Nov 09 19:24:31 2012 -0500 19.2 +++ b/src/share/vm/oops/constantPool.cpp Fri Nov 09 16:45:20 2012 -0800 19.3 @@ -228,7 +228,7 @@ 19.4 } else { 19.5 do_resolve = true; 19.6 name = this_oop->unresolved_klass_at(which); 19.7 - loader = Handle(THREAD, InstanceKlass::cast(this_oop->pool_holder())->class_loader()); 19.8 + loader = Handle(THREAD, this_oop->pool_holder()->class_loader()); 19.9 } 19.10 } 19.11 } // unlocking constantPool 19.12 @@ -247,7 +247,7 @@ 19.13 19.14 if (do_resolve) { 19.15 // this_oop must be unlocked during resolve_or_fail 19.16 - oop protection_domain = Klass::cast(this_oop->pool_holder())->protection_domain(); 19.17 + oop protection_domain = this_oop->pool_holder()->protection_domain(); 19.18 Handle h_prot (THREAD, protection_domain); 19.19 Klass* k_oop = SystemDictionary::resolve_or_fail(name, loader, h_prot, true, THREAD); 19.20 KlassHandle k; 19.21 @@ -315,7 +315,7 @@ 19.22 vframeStream vfst(JavaThread::current()); 19.23 if (!vfst.at_end()) { 19.24 line_number = vfst.method()->line_number_from_bci(vfst.bci()); 19.25 - Symbol* s = InstanceKlass::cast(vfst.method()->method_holder())->source_file_name(); 19.26 + Symbol* s = vfst.method()->method_holder()->source_file_name(); 19.27 if (s != NULL) { 19.28 source_file = s->as_C_string(); 19.29 } 19.30 @@ -325,11 +325,11 @@ 19.31 // only print something if the classes are different 19.32 if (source_file != NULL) { 19.33 tty->print("RESOLVE %s %s %s:%d\n", 19.34 - InstanceKlass::cast(this_oop->pool_holder())->external_name(), 19.35 + this_oop->pool_holder()->external_name(), 19.36 InstanceKlass::cast(k())->external_name(), source_file, line_number); 19.37 } else { 19.38 tty->print("RESOLVE %s %s\n", 19.39 - InstanceKlass::cast(this_oop->pool_holder())->external_name(), 19.40 + this_oop->pool_holder()->external_name(), 19.41 InstanceKlass::cast(k())->external_name()); 19.42 } 19.43 } 19.44 @@ -339,7 +339,7 @@ 19.45 // Only updated constant pool - if it is resolved. 19.46 do_resolve = this_oop->tag_at(which).is_unresolved_klass(); 19.47 if (do_resolve) { 19.48 - ClassLoaderData* this_key = InstanceKlass::cast(this_oop->pool_holder())->class_loader_data(); 19.49 + ClassLoaderData* this_key = this_oop->pool_holder()->class_loader_data(); 19.50 if (!this_key->is_the_null_class_loader_data()) { 19.51 this_key->record_dependency(k(), CHECK_NULL); // Can throw OOM 19.52 } 19.53 @@ -367,8 +367,8 @@ 19.54 assert(entry.is_unresolved(), "must be either symbol or klass"); 19.55 Thread *thread = Thread::current(); 19.56 Symbol* name = entry.get_symbol(); 19.57 - oop loader = InstanceKlass::cast(this_oop->pool_holder())->class_loader(); 19.58 - oop protection_domain = Klass::cast(this_oop->pool_holder())->protection_domain(); 19.59 + oop loader = this_oop->pool_holder()->class_loader(); 19.60 + oop protection_domain = this_oop->pool_holder()->protection_domain(); 19.61 Handle h_prot (thread, protection_domain); 19.62 Handle h_loader (thread, loader); 19.63 Klass* k = SystemDictionary::find(name, h_loader, h_prot, thread); 19.64 @@ -409,8 +409,8 @@ 19.65 } else { 19.66 assert(entry.is_unresolved(), "must be either symbol or klass"); 19.67 Symbol* name = entry.get_symbol(); 19.68 - oop loader = InstanceKlass::cast(this_oop->pool_holder())->class_loader(); 19.69 - oop protection_domain = Klass::cast(this_oop->pool_holder())->protection_domain(); 19.70 + oop loader = this_oop->pool_holder()->class_loader(); 19.71 + oop protection_domain = this_oop->pool_holder()->protection_domain(); 19.72 Handle h_loader(THREAD, loader); 19.73 Handle h_prot (THREAD, protection_domain); 19.74 KlassHandle k(THREAD, SystemDictionary::find(name, h_loader, h_prot, THREAD)); 19.75 @@ -1790,7 +1790,7 @@ 19.76 assert(cp_patches->at(index).is_null(), 19.77 err_msg("Unused constant pool patch at %d in class file %s", 19.78 index, 19.79 - InstanceKlass::cast(pool_holder())->external_name())); 19.80 + pool_holder()->external_name())); 19.81 } 19.82 #endif // ASSERT 19.83 } 19.84 @@ -1948,7 +1948,7 @@ 19.85 st->print(" for "); 19.86 pool_holder()->print_value_on(st); 19.87 if (pool_holder() != NULL) { 19.88 - bool extra = (InstanceKlass::cast(pool_holder())->constants() != this); 19.89 + bool extra = (pool_holder()->constants() != this); 19.90 if (extra) st->print(" (extra)"); 19.91 } 19.92 if (cache() != NULL) {
20.1 --- a/src/share/vm/oops/constantPool.hpp Fri Nov 09 19:24:31 2012 -0500 20.2 +++ b/src/share/vm/oops/constantPool.hpp Fri Nov 09 16:45:20 2012 -0800 20.3 @@ -86,8 +86,8 @@ 20.4 friend class Universe; // For null constructor 20.5 private: 20.6 Array<u1>* _tags; // the tag array describing the constant pool's contents 20.7 - ConstantPoolCache* _cache; // the cache holding interpreter runtime information 20.8 - Klass* _pool_holder; // the corresponding class 20.9 + ConstantPoolCache* _cache; // the cache holding interpreter runtime information 20.10 + InstanceKlass* _pool_holder; // the corresponding class 20.11 Array<u2>* _operands; // for variable-sized (InvokeDynamic) nodes, usually empty 20.12 20.13 // Array of resolved objects from the constant pool and map from resolved 20.14 @@ -193,9 +193,9 @@ 20.15 void set_on_stack(const bool value); 20.16 20.17 // Klass holding pool 20.18 - Klass* pool_holder() const { return _pool_holder; } 20.19 - void set_pool_holder(Klass* k) { _pool_holder = k; } 20.20 - Klass** pool_holder_addr() { return &_pool_holder; } 20.21 + InstanceKlass* pool_holder() const { return _pool_holder; } 20.22 + void set_pool_holder(InstanceKlass* k) { _pool_holder = k; } 20.23 + InstanceKlass** pool_holder_addr() { return &_pool_holder; } 20.24 20.25 // Interpreter runtime support 20.26 ConstantPoolCache* cache() const { return _cache; }
21.1 --- a/src/share/vm/oops/cpCache.cpp Fri Nov 09 19:24:31 2012 -0500 21.2 +++ b/src/share/vm/oops/cpCache.cpp Fri Nov 09 16:45:20 2012 -0800 21.3 @@ -231,8 +231,8 @@ 21.4 21.5 21.6 void ConstantPoolCacheEntry::set_interface_call(methodHandle method, int index) { 21.7 - Klass* interf = method->method_holder(); 21.8 - assert(InstanceKlass::cast(interf)->is_interface(), "must be an interface"); 21.9 + InstanceKlass* interf = method->method_holder(); 21.10 + assert(interf->is_interface(), "must be an interface"); 21.11 assert(!method->is_final_method(), "interfaces do not have final methods; cannot link to one here"); 21.12 set_f1(interf); 21.13 set_f2(index); 21.14 @@ -421,7 +421,7 @@ 21.15 if (!(*trace_name_printed)) { 21.16 // RC_TRACE_MESG macro has an embedded ResourceMark 21.17 RC_TRACE_MESG(("adjust: name=%s", 21.18 - Klass::cast(old_method->method_holder())->external_name())); 21.19 + old_method->method_holder()->external_name())); 21.20 *trace_name_printed = true; 21.21 } 21.22 // RC_TRACE macro has an embedded ResourceMark 21.23 @@ -449,7 +449,7 @@ 21.24 if (!(*trace_name_printed)) { 21.25 // RC_TRACE_MESG macro has an embedded ResourceMark 21.26 RC_TRACE_MESG(("adjust: name=%s", 21.27 - Klass::cast(old_method->method_holder())->external_name())); 21.28 + old_method->method_holder()->external_name())); 21.29 *trace_name_printed = true; 21.30 } 21.31 // RC_TRACE macro has an embedded ResourceMark
22.1 --- a/src/share/vm/oops/klassVtable.cpp Fri Nov 09 19:24:31 2012 -0500 22.2 +++ b/src/share/vm/oops/klassVtable.cpp Fri Nov 09 16:45:20 2012 -0800 22.3 @@ -307,7 +307,7 @@ 22.4 if (super_method->name() == name && super_method->signature() == signature) { 22.5 22.6 // get super_klass for method_holder for the found method 22.7 - InstanceKlass* super_klass = InstanceKlass::cast(super_method->method_holder()); 22.8 + InstanceKlass* super_klass = super_method->method_holder(); 22.9 22.10 if ((super_klass->is_override(super_method, target_loader, target_classname, THREAD)) || 22.11 ((klass->major_version() >= VTABLE_TRANSITIVE_OVERRIDE_VERSION) 22.12 @@ -452,7 +452,7 @@ 22.13 } 22.14 // get the class holding the matching method 22.15 // make sure you use that class for is_override 22.16 - InstanceKlass* superk = InstanceKlass::cast(super_method->method_holder()); 22.17 + InstanceKlass* superk = super_method->method_holder(); 22.18 // we want only instance method matches 22.19 // pretend private methods are not in the super vtable 22.20 // since we do override around them: e.g. a.m pub/b.m private/c.m pub, 22.21 @@ -630,7 +630,7 @@ 22.22 if (!(*trace_name_printed)) { 22.23 // RC_TRACE_MESG macro has an embedded ResourceMark 22.24 RC_TRACE_MESG(("adjust: name=%s", 22.25 - Klass::cast(old_method->method_holder())->external_name())); 22.26 + old_method->method_holder()->external_name())); 22.27 *trace_name_printed = true; 22.28 } 22.29 // RC_TRACE macro has an embedded ResourceMark 22.30 @@ -745,7 +745,7 @@ 22.31 Method* target = klass->uncached_lookup_method(method_name, method_signature); 22.32 while (target != NULL && target->is_static()) { 22.33 // continue with recursive lookup through the superclass 22.34 - Klass* super = Klass::cast(target->method_holder())->super(); 22.35 + Klass* super = target->method_holder()->super(); 22.36 target = (super == NULL) ? (Method*)NULL : Klass::cast(super)->uncached_lookup_method(method_name, method_signature); 22.37 } 22.38 if (target == NULL || !target->is_public() || target->is_abstract()) { 22.39 @@ -755,7 +755,7 @@ 22.40 // if checkconstraints requested 22.41 methodHandle target_h (THREAD, target); // preserve across gc 22.42 if (checkconstraints) { 22.43 - Handle method_holder_loader (THREAD, InstanceKlass::cast(target->method_holder())->class_loader()); 22.44 + Handle method_holder_loader (THREAD, target->method_holder()->class_loader()); 22.45 if (method_holder_loader() != interface_loader()) { 22.46 ResourceMark rm(THREAD); 22.47 char* failed_type_name = 22.48 @@ -825,7 +825,7 @@ 22.49 if (!(*trace_name_printed)) { 22.50 // RC_TRACE_MESG macro has an embedded ResourceMark 22.51 RC_TRACE_MESG(("adjust: name=%s", 22.52 - Klass::cast(old_method->method_holder())->external_name())); 22.53 + old_method->method_holder()->external_name())); 22.54 *trace_name_printed = true; 22.55 } 22.56 // RC_TRACE macro has an embedded ResourceMark 22.57 @@ -960,9 +960,9 @@ 22.58 22.59 // m must be a method in an interface 22.60 int klassItable::compute_itable_index(Method* m) { 22.61 - Klass* intf = m->method_holder(); 22.62 - assert(InstanceKlass::cast(intf)->is_interface(), "sanity check"); 22.63 - Array<Method*>* methods = InstanceKlass::cast(intf)->methods(); 22.64 + InstanceKlass* intf = m->method_holder(); 22.65 + assert(intf->is_interface(), "sanity check"); 22.66 + Array<Method*>* methods = intf->methods(); 22.67 int index = 0; 22.68 while(methods->at(index) != m) { 22.69 index++;
23.1 --- a/src/share/vm/oops/method.cpp Fri Nov 09 19:24:31 2012 -0500 23.2 +++ b/src/share/vm/oops/method.cpp Fri Nov 09 16:45:20 2012 -0800 23.3 @@ -243,12 +243,12 @@ 23.4 warning("oopmap should only be accessed by the " 23.5 "VM, GC task or CMS threads (or during debugging)"); 23.6 InterpreterOopMap local_mask; 23.7 - InstanceKlass::cast(method_holder())->mask_for(h_this, bci, &local_mask); 23.8 + method_holder()->mask_for(h_this, bci, &local_mask); 23.9 local_mask.print(); 23.10 } 23.11 } 23.12 #endif 23.13 - InstanceKlass::cast(method_holder())->mask_for(h_this, bci, mask); 23.14 + method_holder()->mask_for(h_this, bci, mask); 23.15 return; 23.16 } 23.17 23.18 @@ -523,7 +523,7 @@ 23.19 bool Method::is_final_method() const { 23.20 // %%% Should return true for private methods also, 23.21 // since there is no way to override them. 23.22 - return is_final() || Klass::cast(method_holder())->is_final(); 23.23 + return is_final() || method_holder()->is_final(); 23.24 } 23.25 23.26 23.27 @@ -555,7 +555,7 @@ 23.28 23.29 bool Method::has_valid_initializer_flags() const { 23.30 return (is_static() || 23.31 - InstanceKlass::cast(method_holder())->major_version() < 51); 23.32 + method_holder()->major_version() < 51); 23.33 } 23.34 23.35 bool Method::is_static_initializer() const { 23.36 @@ -617,7 +617,7 @@ 23.37 if( constants()->tag_at(klass_index).is_unresolved_klass() ) { 23.38 Thread *thread = Thread::current(); 23.39 Symbol* klass_name = constants()->klass_name_at(klass_index); 23.40 - Handle loader(thread, InstanceKlass::cast(method_holder())->class_loader()); 23.41 + Handle loader(thread, method_holder()->class_loader()); 23.42 Handle prot (thread, Klass::cast(method_holder())->protection_domain()); 23.43 return SystemDictionary::find(klass_name, loader, prot, thread) != NULL; 23.44 } else { 23.45 @@ -935,7 +935,7 @@ 23.46 23.47 // If method is an interface, we skip it - except if it 23.48 // is a miranda method 23.49 - if (InstanceKlass::cast(method_holder())->is_interface()) { 23.50 + if (method_holder()->is_interface()) { 23.51 // Check that method is not a miranda method 23.52 if (ik->lookup_method(name(), signature()) == NULL) { 23.53 // No implementation exist - so miranda method 23.54 @@ -1020,7 +1020,7 @@ 23.55 ConstantPool* cp_oop = ConstantPool::allocate(loader_data, cp_length, CHECK_(empty)); 23.56 cp = constantPoolHandle(THREAD, cp_oop); 23.57 } 23.58 - cp->set_pool_holder(holder()); 23.59 + cp->set_pool_holder(InstanceKlass::cast(holder())); 23.60 cp->symbol_at_put(_imcp_invoke_name, name); 23.61 cp->symbol_at_put(_imcp_invoke_signature, signature); 23.62 cp->set_preresolution(); 23.63 @@ -1237,8 +1237,8 @@ 23.64 return false; 23.65 } 23.66 bool sig_is_loaded = true; 23.67 - Handle class_loader(THREAD, InstanceKlass::cast(m->method_holder())->class_loader()); 23.68 - Handle protection_domain(THREAD, Klass::cast(m->method_holder())->protection_domain()); 23.69 + Handle class_loader(THREAD, m->method_holder()->class_loader()); 23.70 + Handle protection_domain(THREAD, m->method_holder()->protection_domain()); 23.71 ResourceMark rm(THREAD); 23.72 Symbol* signature = m->signature(); 23.73 for(SignatureStream ss(signature); !ss.is_done(); ss.next()) { 23.74 @@ -1264,8 +1264,8 @@ 23.75 } 23.76 23.77 bool Method::has_unloaded_classes_in_signature(methodHandle m, TRAPS) { 23.78 - Handle class_loader(THREAD, InstanceKlass::cast(m->method_holder())->class_loader()); 23.79 - Handle protection_domain(THREAD, Klass::cast(m->method_holder())->protection_domain()); 23.80 + Handle class_loader(THREAD, m->method_holder()->class_loader()); 23.81 + Handle protection_domain(THREAD, m->method_holder()->protection_domain()); 23.82 ResourceMark rm(THREAD); 23.83 Symbol* signature = m->signature(); 23.84 for(SignatureStream ss(signature); !ss.is_done(); ss.next()) { 23.85 @@ -1472,7 +1472,7 @@ 23.86 23.87 23.88 Bytecodes::Code Method::orig_bytecode_at(int bci) const { 23.89 - BreakpointInfo* bp = InstanceKlass::cast(method_holder())->breakpoints(); 23.90 + BreakpointInfo* bp = method_holder()->breakpoints(); 23.91 for (; bp != NULL; bp = bp->next()) { 23.92 if (bp->match(this, bci)) { 23.93 return bp->orig_bytecode(); 23.94 @@ -1484,7 +1484,7 @@ 23.95 23.96 void Method::set_orig_bytecode_at(int bci, Bytecodes::Code code) { 23.97 assert(code != Bytecodes::_breakpoint, "cannot patch breakpoints this way"); 23.98 - BreakpointInfo* bp = InstanceKlass::cast(method_holder())->breakpoints(); 23.99 + BreakpointInfo* bp = method_holder()->breakpoints(); 23.100 for (; bp != NULL; bp = bp->next()) { 23.101 if (bp->match(this, bci)) { 23.102 bp->set_orig_bytecode(code); 23.103 @@ -1494,7 +1494,7 @@ 23.104 } 23.105 23.106 void Method::set_breakpoint(int bci) { 23.107 - InstanceKlass* ik = InstanceKlass::cast(method_holder()); 23.108 + InstanceKlass* ik = method_holder(); 23.109 BreakpointInfo *bp = new BreakpointInfo(this, bci); 23.110 bp->set_next(ik->breakpoints()); 23.111 ik->set_breakpoints(bp); 23.112 @@ -1503,7 +1503,7 @@ 23.113 } 23.114 23.115 static void clear_matches(Method* m, int bci) { 23.116 - InstanceKlass* ik = InstanceKlass::cast(m->method_holder()); 23.117 + InstanceKlass* ik = m->method_holder(); 23.118 BreakpointInfo* prev_bp = NULL; 23.119 BreakpointInfo* next_bp; 23.120 for (BreakpointInfo* bp = ik->breakpoints(); bp != NULL; bp = next_bp) { 23.121 @@ -1786,7 +1786,7 @@ 23.122 bool Method::is_method_id(jmethodID mid) { 23.123 Method* m = resolve_jmethod_id(mid); 23.124 assert(m != NULL, "should be called with non-null method"); 23.125 - InstanceKlass* ik = InstanceKlass::cast(m->method_holder()); 23.126 + InstanceKlass* ik = m->method_holder(); 23.127 ClassLoaderData* cld = ik->class_loader_data(); 23.128 if (cld->jmethod_ids() == NULL) return false; 23.129 return (cld->jmethod_ids()->contains((Method**)mid));
24.1 --- a/src/share/vm/oops/method.hpp Fri Nov 09 19:24:31 2012 -0500 24.2 +++ b/src/share/vm/oops/method.hpp Fri Nov 09 16:45:20 2012 -0800 24.3 @@ -209,21 +209,21 @@ 24.4 24.5 // annotations support 24.6 AnnotationArray* annotations() const { 24.7 - InstanceKlass* ik = InstanceKlass::cast(method_holder()); 24.8 + InstanceKlass* ik = method_holder(); 24.9 if (ik->annotations() == NULL) { 24.10 return NULL; 24.11 } 24.12 return ik->annotations()->get_method_annotations_of(method_idnum()); 24.13 } 24.14 AnnotationArray* parameter_annotations() const { 24.15 - InstanceKlass* ik = InstanceKlass::cast(method_holder()); 24.16 + InstanceKlass* ik = method_holder(); 24.17 if (ik->annotations() == NULL) { 24.18 return NULL; 24.19 } 24.20 return ik->annotations()->get_method_parameter_annotations_of(method_idnum()); 24.21 } 24.22 AnnotationArray* annotation_default() const { 24.23 - InstanceKlass* ik = InstanceKlass::cast(method_holder()); 24.24 + InstanceKlass* ik = method_holder(); 24.25 if (ik->annotations() == NULL) { 24.26 return NULL; 24.27 } 24.28 @@ -496,7 +496,7 @@ 24.29 { return constMethod()->compressed_linenumber_table(); } 24.30 24.31 // method holder (the Klass* holding this method) 24.32 - Klass* method_holder() const { return constants()->pool_holder(); } 24.33 + InstanceKlass* method_holder() const { return constants()->pool_holder(); } 24.34 24.35 void compute_size_of_parameters(Thread *thread); // word size of parameters (receiver if any + arguments) 24.36 Symbol* klass_name() const; // returns the name of the method holder 24.37 @@ -697,18 +697,18 @@ 24.38 24.39 // Get this method's jmethodID -- allocate if it doesn't exist 24.40 jmethodID jmethod_id() { methodHandle this_h(this); 24.41 - return InstanceKlass::get_jmethod_id(InstanceKlass::cast(method_holder()), this_h); } 24.42 + return InstanceKlass::get_jmethod_id(method_holder(), this_h); } 24.43 24.44 // Lookup the jmethodID for this method. Return NULL if not found. 24.45 // NOTE that this function can be called from a signal handler 24.46 // (see AsyncGetCallTrace support for Forte Analyzer) and this 24.47 // needs to be async-safe. No allocation should be done and 24.48 // so handles are not used to avoid deadlock. 24.49 - jmethodID find_jmethod_id_or_null() { return InstanceKlass::cast(method_holder())->jmethod_id_or_null(this); } 24.50 + jmethodID find_jmethod_id_or_null() { return method_holder()->jmethod_id_or_null(this); } 24.51 24.52 // JNI static invoke cached itable index accessors 24.53 - int cached_itable_index() { return InstanceKlass::cast(method_holder())->cached_itable_index(method_idnum()); } 24.54 - void set_cached_itable_index(int index) { InstanceKlass::cast(method_holder())->set_cached_itable_index(method_idnum(), index); } 24.55 + int cached_itable_index() { return method_holder()->cached_itable_index(method_idnum()); } 24.56 + void set_cached_itable_index(int index) { method_holder()->set_cached_itable_index(method_idnum(), index); } 24.57 24.58 // Support for inlining of intrinsic methods 24.59 vmIntrinsics::ID intrinsic_id() const { return (vmIntrinsics::ID) _intrinsic_id; } 24.60 @@ -734,11 +734,11 @@ 24.61 24.62 // On-stack replacement support 24.63 bool has_osr_nmethod(int level, bool match_level) { 24.64 - return InstanceKlass::cast(method_holder())->lookup_osr_nmethod(this, InvocationEntryBci, level, match_level) != NULL; 24.65 + return method_holder()->lookup_osr_nmethod(this, InvocationEntryBci, level, match_level) != NULL; 24.66 } 24.67 24.68 nmethod* lookup_osr_nmethod_for(int bci, int level, bool match_level) { 24.69 - return InstanceKlass::cast(method_holder())->lookup_osr_nmethod(this, bci, level, match_level); 24.70 + return method_holder()->lookup_osr_nmethod(this, bci, level, match_level); 24.71 } 24.72 24.73 // Inline cache support
25.1 --- a/src/share/vm/prims/jni.cpp Fri Nov 09 19:24:31 2012 -0500 25.2 +++ b/src/share/vm/prims/jni.cpp Fri Nov 09 16:45:20 2012 -0800 25.3 @@ -2985,7 +2985,7 @@ 25.4 } 25.5 25.6 // A jfieldID for a static field is a JNIid specifying the field holder and the offset within the Klass* 25.7 - JNIid* id = InstanceKlass::cast(fd.field_holder())->jni_id_for(fd.offset()); 25.8 + JNIid* id = fd.field_holder()->jni_id_for(fd.offset()); 25.9 debug_only(id->set_is_static_field_id();) 25.10 25.11 debug_only(id->verify(fd.field_holder())); 25.12 @@ -4016,7 +4016,7 @@ 25.13 if (PrintJNIResolving) { 25.14 ResourceMark rm(THREAD); 25.15 tty->print_cr("[Registering JNI native method %s.%s]", 25.16 - Klass::cast(method->method_holder())->external_name(), 25.17 + method->method_holder()->external_name(), 25.18 method->name()->as_C_string()); 25.19 } 25.20 return true;
26.1 --- a/src/share/vm/prims/jvm.cpp Fri Nov 09 19:24:31 2012 -0500 26.2 +++ b/src/share/vm/prims/jvm.cpp Fri Nov 09 16:45:20 2012 -0800 26.3 @@ -125,7 +125,7 @@ 26.4 int line_number = -1; 26.5 const char * source_file = NULL; 26.6 const char * trace = "explicit"; 26.7 - Klass* caller = NULL; 26.8 + InstanceKlass* caller = NULL; 26.9 JavaThread* jthread = JavaThread::current(); 26.10 if (jthread->has_last_Java_frame()) { 26.11 vframeStream vfst(jthread); 26.12 @@ -153,17 +153,17 @@ 26.13 // that caller, otherwise keep quiet since this should be picked up elsewhere. 26.14 bool found_it = false; 26.15 if (!vfst.at_end() && 26.16 - InstanceKlass::cast(vfst.method()->method_holder())->name() == vmSymbols::java_lang_Class() && 26.17 + vfst.method()->method_holder()->name() == vmSymbols::java_lang_Class() && 26.18 vfst.method()->name() == vmSymbols::forName0_name()) { 26.19 vfst.next(); 26.20 if (!vfst.at_end() && 26.21 - InstanceKlass::cast(vfst.method()->method_holder())->name() == vmSymbols::java_lang_Class() && 26.22 + vfst.method()->method_holder()->name() == vmSymbols::java_lang_Class() && 26.23 vfst.method()->name() == vmSymbols::forName_name()) { 26.24 vfst.next(); 26.25 found_it = true; 26.26 } 26.27 } else if (last_caller != NULL && 26.28 - InstanceKlass::cast(last_caller->method_holder())->name() == 26.29 + last_caller->method_holder()->name() == 26.30 vmSymbols::java_lang_ClassLoader() && 26.31 (last_caller->name() == vmSymbols::loadClassInternal_name() || 26.32 last_caller->name() == vmSymbols::loadClass_name())) { 26.33 @@ -182,7 +182,7 @@ 26.34 // show method name if it's a native method 26.35 trace = vfst.method()->name_and_sig_as_C_string(); 26.36 } 26.37 - Symbol* s = InstanceKlass::cast(caller)->source_file_name(); 26.38 + Symbol* s = caller->source_file_name(); 26.39 if (s != NULL) { 26.40 source_file = s->as_C_string(); 26.41 } 26.42 @@ -190,8 +190,8 @@ 26.43 } 26.44 if (caller != NULL) { 26.45 if (to_class != caller) { 26.46 - const char * from = Klass::cast(caller)->external_name(); 26.47 - const char * to = Klass::cast(to_class)->external_name(); 26.48 + const char * from = caller->external_name(); 26.49 + const char * to = to_class->external_name(); 26.50 // print in a single call to reduce interleaving between threads 26.51 if (source_file != NULL) { 26.52 tty->print("RESOLVE %s %s %s:%d (%s)\n", from, to, source_file, line_number, trace); 26.53 @@ -1228,7 +1228,7 @@ 26.54 privileged_context = Handle(thread, thread->privileged_stack_top()->privileged_context()); 26.55 protection_domain = thread->privileged_stack_top()->protection_domain(); 26.56 } else { 26.57 - protection_domain = InstanceKlass::cast(method->method_holder())->protection_domain(); 26.58 + protection_domain = method->method_holder()->protection_domain(); 26.59 } 26.60 26.61 if ((previous_protection_domain != protection_domain) && (protection_domain != NULL)) { 26.62 @@ -3048,10 +3048,10 @@ 26.63 26.64 Method* m = vfst.method(); 26.65 if (!m->is_native()) { 26.66 - Klass* holder = m->method_holder(); 26.67 - oop loader = InstanceKlass::cast(holder)->class_loader(); 26.68 + InstanceKlass* holder = m->method_holder(); 26.69 + oop loader = holder->class_loader(); 26.70 if (loader != NULL && !java_lang_ClassLoader::is_trusted_loader(loader)) { 26.71 - return (jclass) JNIHandles::make_local(env, Klass::cast(holder)->java_mirror()); 26.72 + return (jclass) JNIHandles::make_local(env, holder->java_mirror()); 26.73 } 26.74 } 26.75 } 26.76 @@ -3071,9 +3071,9 @@ 26.77 26.78 Method* m = vfst.method(); 26.79 if (!m->is_native()) { 26.80 - Klass* holder = m->method_holder(); 26.81 + InstanceKlass* holder = m->method_holder(); 26.82 assert(holder->is_klass(), "just checking"); 26.83 - oop loader = InstanceKlass::cast(holder)->class_loader(); 26.84 + oop loader = holder->class_loader(); 26.85 if (loader != NULL && !java_lang_ClassLoader::is_trusted_loader(loader)) { 26.86 return JNIHandles::make_local(env, loader); 26.87 } 26.88 @@ -3148,9 +3148,9 @@ 26.89 26.90 for(vframeStream vfst(thread); !vfst.at_end(); vfst.next()) { 26.91 if (!vfst.method()->is_native()) { 26.92 - Klass* holder = vfst.method()->method_holder(); 26.93 + InstanceKlass* holder = vfst.method()->method_holder(); 26.94 assert(holder->is_klass(), "just checking"); 26.95 - if (InstanceKlass::cast(holder)->name() == class_name_sym) { 26.96 + if (holder->name() == class_name_sym) { 26.97 return depth; 26.98 } 26.99 depth++; 26.100 @@ -3171,9 +3171,9 @@ 26.101 26.102 Method* m = vfst.method(); 26.103 if (!m->is_native()) { 26.104 - Klass* holder = m->method_holder(); 26.105 + InstanceKlass* holder = m->method_holder(); 26.106 assert(holder->is_klass(), "just checking"); 26.107 - oop loader = InstanceKlass::cast(holder)->class_loader(); 26.108 + oop loader = holder->class_loader(); 26.109 if (loader != NULL && !java_lang_ClassLoader::is_trusted_loader(loader)) { 26.110 return depth; 26.111 } 26.112 @@ -3322,8 +3322,7 @@ 26.113 for (vframeStream vfst(thread); !vfst.at_end(); vfst.next()) { 26.114 // UseNewReflection 26.115 vfst.skip_reflection_related_frames(); // Only needed for 1.4 reflection 26.116 - Klass* holder = vfst.method()->method_holder(); 26.117 - oop loader = InstanceKlass::cast(holder)->class_loader(); 26.118 + oop loader = vfst.method()->method_holder()->class_loader(); 26.119 if (loader != NULL) { 26.120 return JNIHandles::make_local(env, loader); 26.121 } 26.122 @@ -3365,9 +3364,9 @@ 26.123 !vfst.at_end() && loader == NULL; 26.124 vfst.next()) { 26.125 if (!vfst.method()->is_native()) { 26.126 - Klass* holder = vfst.method()->method_holder(); 26.127 - loader = InstanceKlass::cast(holder)->class_loader(); 26.128 - protection_domain = InstanceKlass::cast(holder)->protection_domain(); 26.129 + InstanceKlass* holder = vfst.method()->method_holder(); 26.130 + loader = holder->class_loader(); 26.131 + protection_domain = holder->protection_domain(); 26.132 } 26.133 } 26.134 } else {
27.1 --- a/src/share/vm/prims/jvmtiClassFileReconstituter.cpp Fri Nov 09 19:24:31 2012 -0500 27.2 +++ b/src/share/vm/prims/jvmtiClassFileReconstituter.cpp Fri Nov 09 16:45:20 2012 -0800 27.3 @@ -228,7 +228,7 @@ 27.4 27.5 write_attribute_name_index("Code"); 27.6 write_u4(size); 27.7 - write_u2(method->max_stack()); 27.8 + write_u2(method->verifier_max_stack()); 27.9 write_u2(method->max_locals()); 27.10 write_u4(code_size); 27.11 copy_bytecodes(method, (unsigned char*)writeable_address(code_size)); 27.12 @@ -753,7 +753,7 @@ 27.13 27.14 unsigned char* p = bytecodes; 27.15 Bytecodes::Code code; 27.16 - bool is_rewritten = InstanceKlass::cast(mh->method_holder())->is_rewritten(); 27.17 + bool is_rewritten = mh->method_holder()->is_rewritten(); 27.18 27.19 while ((code = bs.next()) >= 0) { 27.20 assert(Bytecodes::is_java_code(code), "sanity check");
28.1 --- a/src/share/vm/prims/jvmtiEnv.cpp Fri Nov 09 19:24:31 2012 -0500 28.2 +++ b/src/share/vm/prims/jvmtiEnv.cpp Fri Nov 09 16:45:20 2012 -0800 28.3 @@ -2822,7 +2822,7 @@ 28.4 JavaThread* current_thread = JavaThread::current(); 28.5 28.6 // does the klass have any local variable information? 28.7 - InstanceKlass* ik = InstanceKlass::cast(method_oop->method_holder()); 28.8 + InstanceKlass* ik = method_oop->method_holder(); 28.9 if (!ik->access_flags().has_localvariable_table()) { 28.10 return (JVMTI_ERROR_ABSENT_INFORMATION); 28.11 }
29.1 --- a/src/share/vm/prims/methodHandles.cpp Fri Nov 09 19:24:31 2012 -0500 29.2 +++ b/src/share/vm/prims/methodHandles.cpp Fri Nov 09 16:45:20 2012 -0800 29.3 @@ -233,7 +233,7 @@ 29.4 methodHandle m = info.resolved_method(); 29.5 KlassHandle defc = info.resolved_klass(); 29.6 int vmindex = -1; 29.7 - if (defc->is_interface() && Klass::cast(m->method_holder())->is_interface()) { 29.8 + if (defc->is_interface() && m->method_holder()->is_interface()) { 29.9 // LinkResolver does not report itable indexes! (fix this?) 29.10 vmindex = klassItable::compute_itable_index(m()); 29.11 } else if (m->can_be_statically_bound()) { 29.12 @@ -749,8 +749,8 @@ 29.13 DEBUG_ONLY(vmtarget = NULL); // safety 29.14 if (m.is_null()) break; 29.15 if (!have_defc) { 29.16 - Klass* defc = m->method_holder(); 29.17 - java_lang_invoke_MemberName::set_clazz(mname(), Klass::cast(defc)->java_mirror()); 29.18 + InstanceKlass* defc = m->method_holder(); 29.19 + java_lang_invoke_MemberName::set_clazz(mname(), defc->java_mirror()); 29.20 } 29.21 if (!have_name) { 29.22 //not java_lang_String::create_from_symbol; let's intern member names
30.1 --- a/src/share/vm/prims/nativeLookup.cpp Fri Nov 09 19:24:31 2012 -0500 30.2 +++ b/src/share/vm/prims/nativeLookup.cpp Fri Nov 09 16:45:20 2012 -0800 30.3 @@ -165,8 +165,7 @@ 30.4 // Note: It is critical for bootstrapping that Java_java_lang_ClassLoader_00024NativeLibrary_find 30.5 // gets found the first time around - otherwise an infinite loop can occure. This is 30.6 // another VM/library dependency 30.7 - Handle loader(THREAD, 30.8 - InstanceKlass::cast(method->method_holder())->class_loader()); 30.9 + Handle loader(THREAD, method->method_holder()->class_loader()); 30.10 if (loader.is_null()) { 30.11 entry = lookup_special_native(jni_name); 30.12 if (entry == NULL) { 30.13 @@ -393,7 +392,7 @@ 30.14 if (PrintJNIResolving) { 30.15 ResourceMark rm(THREAD); 30.16 tty->print_cr("[Dynamic-linking native method %s.%s ... JNI]", 30.17 - Klass::cast(method->method_holder())->external_name(), 30.18 + method->method_holder()->external_name(), 30.19 method->name()->as_C_string()); 30.20 } 30.21 }
31.1 --- a/src/share/vm/runtime/compilationPolicy.cpp Fri Nov 09 19:24:31 2012 -0500 31.2 +++ b/src/share/vm/runtime/compilationPolicy.cpp Fri Nov 09 16:45:20 2012 -0800 31.3 @@ -627,7 +627,7 @@ 31.4 // negative filter: should send NOT be inlined? returns NULL (--> inline) or rejection msg 31.5 if (m->is_abstract()) return (_msg = "abstract method"); 31.6 // note: we allow ik->is_abstract() 31.7 - if (!InstanceKlass::cast(m->method_holder())->is_initialized()) return (_msg = "method holder not initialized"); 31.8 + if (!m->method_holder()->is_initialized()) return (_msg = "method holder not initialized"); 31.9 if (m->is_native()) return (_msg = "native method"); 31.10 nmethod* m_code = m->code(); 31.11 if (m_code != NULL && m_code->code_size() > InlineSmallCode)
32.1 --- a/src/share/vm/runtime/deoptimization.cpp Fri Nov 09 19:24:31 2012 -0500 32.2 +++ b/src/share/vm/runtime/deoptimization.cpp Fri Nov 09 16:45:20 2012 -0800 32.3 @@ -1191,12 +1191,12 @@ 32.4 32.5 if (!constant_pool->tag_at(index).is_symbol()) return; 32.6 32.7 - Handle class_loader (THREAD, InstanceKlass::cast(constant_pool->pool_holder())->class_loader()); 32.8 + Handle class_loader (THREAD, constant_pool->pool_holder()->class_loader()); 32.9 Symbol* symbol = constant_pool->symbol_at(index); 32.10 32.11 // class name? 32.12 if (symbol->byte_at(0) != '(') { 32.13 - Handle protection_domain (THREAD, Klass::cast(constant_pool->pool_holder())->protection_domain()); 32.14 + Handle protection_domain (THREAD, constant_pool->pool_holder()->protection_domain()); 32.15 SystemDictionary::resolve_or_null(symbol, class_loader, protection_domain, CHECK); 32.16 return; 32.17 } 32.18 @@ -1206,7 +1206,7 @@ 32.19 for (SignatureStream ss(symbol); !ss.is_done(); ss.next()) { 32.20 if (ss.is_object()) { 32.21 Symbol* class_name = ss.as_symbol(CHECK); 32.22 - Handle protection_domain (THREAD, Klass::cast(constant_pool->pool_holder())->protection_domain()); 32.23 + Handle protection_domain (THREAD, constant_pool->pool_holder()->protection_domain()); 32.24 SystemDictionary::resolve_or_null(class_name, class_loader, protection_domain, CHECK); 32.25 } 32.26 }
33.1 --- a/src/share/vm/runtime/fieldDescriptor.cpp Fri Nov 09 19:24:31 2012 -0500 33.2 +++ b/src/share/vm/runtime/fieldDescriptor.cpp Fri Nov 09 16:45:20 2012 -0800 33.3 @@ -36,7 +36,7 @@ 33.4 33.5 33.6 oop fieldDescriptor::loader() const { 33.7 - return InstanceKlass::cast(_cp->pool_holder())->class_loader(); 33.8 + return _cp->pool_holder()->class_loader(); 33.9 } 33.10 33.11 Symbol* fieldDescriptor::generic_signature() const { 33.12 @@ -45,7 +45,7 @@ 33.13 } 33.14 33.15 int idx = 0; 33.16 - InstanceKlass* ik = InstanceKlass::cast(field_holder()); 33.17 + InstanceKlass* ik = field_holder(); 33.18 for (AllFieldStream fs(ik); !fs.done(); fs.next()) { 33.19 if (idx == _index) { 33.20 return fs.generic_signature(); 33.21 @@ -58,7 +58,7 @@ 33.22 } 33.23 33.24 AnnotationArray* fieldDescriptor::annotations() const { 33.25 - InstanceKlass* ik = InstanceKlass::cast(field_holder()); 33.26 + InstanceKlass* ik = field_holder(); 33.27 Array<AnnotationArray*>* md = ik->fields_annotations(); 33.28 if (md == NULL) 33.29 return NULL;
34.1 --- a/src/share/vm/runtime/fieldDescriptor.hpp Fri Nov 09 19:24:31 2012 -0500 34.2 +++ b/src/share/vm/runtime/fieldDescriptor.hpp Fri Nov 09 16:45:20 2012 -0800 34.3 @@ -43,12 +43,12 @@ 34.4 34.5 // update the access_flags for the field in the klass 34.6 void update_klass_field_access_flag() { 34.7 - InstanceKlass* ik = InstanceKlass::cast(field_holder()); 34.8 + InstanceKlass* ik = field_holder(); 34.9 ik->field(index())->set_access_flags(_access_flags.as_short()); 34.10 } 34.11 34.12 FieldInfo* field() const { 34.13 - InstanceKlass* ik = InstanceKlass::cast(field_holder()); 34.14 + InstanceKlass* ik = field_holder(); 34.15 return ik->field(_index); 34.16 } 34.17 34.18 @@ -59,46 +59,46 @@ 34.19 Symbol* signature() const { 34.20 return field()->signature(_cp); 34.21 } 34.22 - Klass* field_holder() const { return _cp->pool_holder(); } 34.23 - ConstantPool* constants() const { return _cp(); } 34.24 - AccessFlags access_flags() const { return _access_flags; } 34.25 - oop loader() const; 34.26 + InstanceKlass* field_holder() const { return _cp->pool_holder(); } 34.27 + ConstantPool* constants() const { return _cp(); } 34.28 + AccessFlags access_flags() const { return _access_flags; } 34.29 + oop loader() const; 34.30 // Offset (in words) of field from start of instanceOop / Klass* 34.31 - int offset() const { return field()->offset(); } 34.32 - Symbol* generic_signature() const; 34.33 - int index() const { return _index; } 34.34 - AnnotationArray* annotations() const; 34.35 + int offset() const { return field()->offset(); } 34.36 + Symbol* generic_signature() const; 34.37 + int index() const { return _index; } 34.38 + AnnotationArray* annotations() const; 34.39 34.40 // Initial field value 34.41 - bool has_initial_value() const { return field()->initval_index() != 0; } 34.42 - int initial_value_index() const { return field()->initval_index(); } 34.43 + bool has_initial_value() const { return field()->initval_index() != 0; } 34.44 + int initial_value_index() const { return field()->initval_index(); } 34.45 constantTag initial_value_tag() const; // The tag will return true on one of is_int(), is_long(), is_single(), is_double() 34.46 - jint int_initial_value() const; 34.47 - jlong long_initial_value() const; 34.48 - jfloat float_initial_value() const; 34.49 - jdouble double_initial_value() const; 34.50 - oop string_initial_value(TRAPS) const; 34.51 + jint int_initial_value() const; 34.52 + jlong long_initial_value() const; 34.53 + jfloat float_initial_value() const; 34.54 + jdouble double_initial_value() const; 34.55 + oop string_initial_value(TRAPS) const; 34.56 34.57 // Field signature type 34.58 - BasicType field_type() const { return FieldType::basic_type(signature()); } 34.59 + BasicType field_type() const { return FieldType::basic_type(signature()); } 34.60 34.61 // Access flags 34.62 - bool is_public() const { return access_flags().is_public(); } 34.63 - bool is_private() const { return access_flags().is_private(); } 34.64 - bool is_protected() const { return access_flags().is_protected(); } 34.65 - bool is_package_private() const { return !is_public() && !is_private() && !is_protected(); } 34.66 + bool is_public() const { return access_flags().is_public(); } 34.67 + bool is_private() const { return access_flags().is_private(); } 34.68 + bool is_protected() const { return access_flags().is_protected(); } 34.69 + bool is_package_private() const { return !is_public() && !is_private() && !is_protected(); } 34.70 34.71 - bool is_static() const { return access_flags().is_static(); } 34.72 - bool is_final() const { return access_flags().is_final(); } 34.73 - bool is_volatile() const { return access_flags().is_volatile(); } 34.74 - bool is_transient() const { return access_flags().is_transient(); } 34.75 + bool is_static() const { return access_flags().is_static(); } 34.76 + bool is_final() const { return access_flags().is_final(); } 34.77 + bool is_volatile() const { return access_flags().is_volatile(); } 34.78 + bool is_transient() const { return access_flags().is_transient(); } 34.79 34.80 - bool is_synthetic() const { return access_flags().is_synthetic(); } 34.81 + bool is_synthetic() const { return access_flags().is_synthetic(); } 34.82 34.83 - bool is_field_access_watched() const { return access_flags().is_field_access_watched(); } 34.84 + bool is_field_access_watched() const { return access_flags().is_field_access_watched(); } 34.85 bool is_field_modification_watched() const 34.86 - { return access_flags().is_field_modification_watched(); } 34.87 - bool has_generic_signature() const { return access_flags().field_has_generic_signature(); } 34.88 + { return access_flags().is_field_modification_watched(); } 34.89 + bool has_generic_signature() const { return access_flags().field_has_generic_signature(); } 34.90 34.91 void set_is_field_access_watched(const bool value) { 34.92 _access_flags.set_is_field_access_watched(value);
35.1 --- a/src/share/vm/runtime/javaCalls.cpp Fri Nov 09 19:24:31 2012 -0500 35.2 +++ b/src/share/vm/runtime/javaCalls.cpp Fri Nov 09 16:45:20 2012 -0800 35.3 @@ -189,7 +189,7 @@ 35.4 assert(method->name() == vmSymbols::object_initializer_name(), "Should only be called for default constructor"); 35.5 assert(method->signature() == vmSymbols::void_method_signature(), "Should only be called for default constructor"); 35.6 35.7 - InstanceKlass* ik = InstanceKlass::cast(method->method_holder()); 35.8 + InstanceKlass* ik = method->method_holder(); 35.9 if (ik->is_initialized() && ik->has_vanilla_constructor()) { 35.10 // safe to skip constructor call 35.11 } else { 35.12 @@ -344,11 +344,11 @@ 35.13 35.14 35.15 #ifdef ASSERT 35.16 - { Klass* holder = method->method_holder(); 35.17 + { InstanceKlass* holder = method->method_holder(); 35.18 // A klass might not be initialized since JavaCall's might be used during the executing of 35.19 // the <clinit>. For example, a Thread.start might start executing on an object that is 35.20 // not fully initialized! (bad Java programming style) 35.21 - assert(InstanceKlass::cast(holder)->is_linked(), "rewritting must have taken place"); 35.22 + assert(holder->is_linked(), "rewritting must have taken place"); 35.23 } 35.24 #endif 35.25
36.1 --- a/src/share/vm/runtime/mutexLocker.cpp Fri Nov 09 19:24:31 2012 -0500 36.2 +++ b/src/share/vm/runtime/mutexLocker.cpp Fri Nov 09 16:45:20 2012 -0800 36.3 @@ -140,6 +140,7 @@ 36.4 Monitor* JfrMsg_lock = NULL; 36.5 Mutex* JfrBuffer_lock = NULL; 36.6 Mutex* JfrStream_lock = NULL; 36.7 +Monitor* PeriodicTask_lock = NULL; 36.8 36.9 #define MAX_NUM_MUTEX 128 36.10 static Monitor * _mutex_array[MAX_NUM_MUTEX]; 36.11 @@ -285,6 +286,7 @@ 36.12 def(JfrMsg_lock , Monitor, nonleaf+2, true); 36.13 def(JfrBuffer_lock , Mutex, nonleaf+3, true); 36.14 def(JfrStream_lock , Mutex, nonleaf+4, true); 36.15 + def(PeriodicTask_lock , Monitor, nonleaf+5, true); 36.16 } 36.17 36.18 GCMutexLocker::GCMutexLocker(Monitor * mutex) {
37.1 --- a/src/share/vm/runtime/mutexLocker.hpp Fri Nov 09 19:24:31 2012 -0500 37.2 +++ b/src/share/vm/runtime/mutexLocker.hpp Fri Nov 09 16:45:20 2012 -0800 37.3 @@ -142,6 +142,7 @@ 37.4 extern Monitor* JfrMsg_lock; // protects JFR messaging 37.5 extern Mutex* JfrBuffer_lock; // protects JFR buffer operations 37.6 extern Mutex* JfrStream_lock; // protects JFR stream access 37.7 +extern Monitor* PeriodicTask_lock; // protects the periodic task structure 37.8 37.9 // A MutexLocker provides mutual exclusion with respect to a given mutex 37.10 // for the scope which contains the locker. The lock is an OS lock, not
38.1 --- a/src/share/vm/runtime/reflection.cpp Fri Nov 09 19:24:31 2012 -0500 38.2 +++ b/src/share/vm/runtime/reflection.cpp Fri Nov 09 16:45:20 2012 -0800 38.3 @@ -56,14 +56,14 @@ 38.4 vframeStream vfst(jthread); 38.5 // skip over any frames belonging to java.lang.Class 38.6 while (!vfst.at_end() && 38.7 - InstanceKlass::cast(vfst.method()->method_holder())->name() == vmSymbols::java_lang_Class()) { 38.8 + vfst.method()->method_holder()->name() == vmSymbols::java_lang_Class()) { 38.9 vfst.next(); 38.10 } 38.11 if (!vfst.at_end()) { 38.12 // this frame is a likely suspect 38.13 caller = vfst.method()->method_holder(); 38.14 line_number = vfst.method()->line_number_from_bci(vfst.bci()); 38.15 - Symbol* s = InstanceKlass::cast(vfst.method()->method_holder())->source_file_name(); 38.16 + Symbol* s = vfst.method()->method_holder()->source_file_name(); 38.17 if (s != NULL) { 38.18 source_file = s->as_C_string(); 38.19 } 38.20 @@ -642,8 +642,8 @@ 38.21 case T_OBJECT: 38.22 case T_ARRAY: 38.23 Symbol* name = ss->as_symbol(CHECK_NULL); 38.24 - oop loader = InstanceKlass::cast(method->method_holder())->class_loader(); 38.25 - oop protection_domain = InstanceKlass::cast(method->method_holder())->protection_domain(); 38.26 + oop loader = method->method_holder()->class_loader(); 38.27 + oop protection_domain = method->method_holder()->protection_domain(); 38.28 Klass* k = SystemDictionary::resolve_or_fail( 38.29 name, 38.30 Handle(THREAD, loader), 38.31 @@ -714,7 +714,7 @@ 38.32 assert(!method()->is_initializer() || 38.33 (for_constant_pool_access && method()->is_static()) || 38.34 (method()->name() == vmSymbols::class_initializer_name() 38.35 - && Klass::cast(method()->method_holder())->is_interface() && JDK_Version::is_jdk12x_version()), "should call new_constructor instead"); 38.36 + && method()->method_holder()->is_interface() && JDK_Version::is_jdk12x_version()), "should call new_constructor instead"); 38.37 instanceKlassHandle holder (THREAD, method->method_holder()); 38.38 int slot = method->method_idnum(); 38.39 38.40 @@ -832,7 +832,7 @@ 38.41 Handle type = new_type(signature, holder, CHECK_NULL); 38.42 Handle rh = java_lang_reflect_Field::create(CHECK_NULL); 38.43 38.44 - java_lang_reflect_Field::set_clazz(rh(), Klass::cast(fd->field_holder())->java_mirror()); 38.45 + java_lang_reflect_Field::set_clazz(rh(), fd->field_holder()->java_mirror()); 38.46 java_lang_reflect_Field::set_slot(rh(), fd->index()); 38.47 java_lang_reflect_Field::set_name(rh(), name()); 38.48 java_lang_reflect_Field::set_type(rh(), type()); 38.49 @@ -900,7 +900,7 @@ 38.50 method = reflected_method; 38.51 } else { 38.52 // resolve based on the receiver 38.53 - if (InstanceKlass::cast(reflected_method->method_holder())->is_interface()) { 38.54 + if (reflected_method->method_holder()->is_interface()) { 38.55 // resolve interface call 38.56 if (ReflectionWrapResolutionErrors) { 38.57 // new default: 6531596
39.1 --- a/src/share/vm/runtime/task.cpp Fri Nov 09 19:24:31 2012 -0500 39.2 +++ b/src/share/vm/runtime/task.cpp Fri Nov 09 16:45:20 2012 -0800 39.3 @@ -61,7 +61,7 @@ 39.4 } 39.5 #endif 39.6 39.7 -void PeriodicTask::real_time_tick(size_t delay_time) { 39.8 +void PeriodicTask::real_time_tick(int delay_time) { 39.9 #ifndef PRODUCT 39.10 if (ProfilerCheckIntervals) { 39.11 _ticks++; 39.12 @@ -73,19 +73,39 @@ 39.13 _intervalHistogram[ms]++; 39.14 } 39.15 #endif 39.16 - int orig_num_tasks = _num_tasks; 39.17 - for(int index = 0; index < _num_tasks; index++) { 39.18 - _tasks[index]->execute_if_pending(delay_time); 39.19 - if (_num_tasks < orig_num_tasks) { // task dis-enrolled itself 39.20 - index--; // re-do current slot as it has changed 39.21 - orig_num_tasks = _num_tasks; 39.22 + 39.23 + { 39.24 + MutexLockerEx ml(PeriodicTask_lock, Mutex::_no_safepoint_check_flag); 39.25 + int orig_num_tasks = _num_tasks; 39.26 + 39.27 + for(int index = 0; index < _num_tasks; index++) { 39.28 + _tasks[index]->execute_if_pending(delay_time); 39.29 + if (_num_tasks < orig_num_tasks) { // task dis-enrolled itself 39.30 + index--; // re-do current slot as it has changed 39.31 + orig_num_tasks = _num_tasks; 39.32 + } 39.33 } 39.34 } 39.35 } 39.36 39.37 +int PeriodicTask::time_to_wait() { 39.38 + MutexLockerEx ml(PeriodicTask_lock->owned_by_self() ? 39.39 + NULL : PeriodicTask_lock, Mutex::_no_safepoint_check_flag); 39.40 + 39.41 + if (_num_tasks == 0) { 39.42 + return 0; // sleep until shutdown or a task is enrolled 39.43 + } 39.44 + 39.45 + int delay = _tasks[0]->time_to_next_interval(); 39.46 + for (int index = 1; index < _num_tasks; index++) { 39.47 + delay = MIN2(delay, _tasks[index]->time_to_next_interval()); 39.48 + } 39.49 + return delay; 39.50 +} 39.51 + 39.52 39.53 PeriodicTask::PeriodicTask(size_t interval_time) : 39.54 - _counter(0), _interval(interval_time) { 39.55 + _counter(0), _interval((int) interval_time) { 39.56 // Sanity check the interval time 39.57 assert(_interval >= PeriodicTask::min_interval && 39.58 _interval <= PeriodicTask::max_interval && 39.59 @@ -94,33 +114,40 @@ 39.60 } 39.61 39.62 PeriodicTask::~PeriodicTask() { 39.63 - if (is_enrolled()) 39.64 - disenroll(); 39.65 -} 39.66 - 39.67 -bool PeriodicTask::is_enrolled() const { 39.68 - for(int index = 0; index < _num_tasks; index++) 39.69 - if (_tasks[index] == this) return true; 39.70 - return false; 39.71 + disenroll(); 39.72 } 39.73 39.74 void PeriodicTask::enroll() { 39.75 - assert(WatcherThread::watcher_thread() == NULL, "dynamic enrollment of tasks not yet supported"); 39.76 + MutexLockerEx ml(PeriodicTask_lock->owned_by_self() ? 39.77 + NULL : PeriodicTask_lock, Mutex::_no_safepoint_check_flag); 39.78 39.79 - if (_num_tasks == PeriodicTask::max_tasks) 39.80 + if (_num_tasks == PeriodicTask::max_tasks) { 39.81 fatal("Overflow in PeriodicTask table"); 39.82 + } 39.83 _tasks[_num_tasks++] = this; 39.84 + 39.85 + WatcherThread* thread = WatcherThread::watcher_thread(); 39.86 + if (thread) { 39.87 + thread->unpark(); 39.88 + } else { 39.89 + WatcherThread::start(); 39.90 + } 39.91 } 39.92 39.93 void PeriodicTask::disenroll() { 39.94 - assert(WatcherThread::watcher_thread() == NULL || 39.95 - Thread::current() == WatcherThread::watcher_thread(), 39.96 - "dynamic disenrollment currently only handled from WatcherThread from within task() method"); 39.97 + MutexLockerEx ml(PeriodicTask_lock->owned_by_self() ? 39.98 + NULL : PeriodicTask_lock, Mutex::_no_safepoint_check_flag); 39.99 39.100 int index; 39.101 - for(index = 0; index < _num_tasks && _tasks[index] != this; index++); 39.102 - if (index == _num_tasks) return; 39.103 + for(index = 0; index < _num_tasks && _tasks[index] != this; index++) 39.104 + ; 39.105 + 39.106 + if (index == _num_tasks) { 39.107 + return; 39.108 + } 39.109 + 39.110 _num_tasks--; 39.111 + 39.112 for (; index < _num_tasks; index++) { 39.113 _tasks[index] = _tasks[index+1]; 39.114 }
40.1 --- a/src/share/vm/runtime/task.hpp Fri Nov 09 19:24:31 2012 -0500 40.2 +++ b/src/share/vm/runtime/task.hpp Fri Nov 09 16:45:20 2012 -0800 40.3 @@ -49,12 +49,12 @@ 40.4 static int num_tasks() { return _num_tasks; } 40.5 40.6 private: 40.7 - size_t _counter; 40.8 - const size_t _interval; 40.9 + int _counter; 40.10 + const int _interval; 40.11 40.12 static int _num_tasks; 40.13 static PeriodicTask* _tasks[PeriodicTask::max_tasks]; 40.14 - static void real_time_tick(size_t delay_time); 40.15 + static void real_time_tick(int delay_time); 40.16 40.17 #ifndef PRODUCT 40.18 static elapsedTimer _timer; // measures time between ticks 40.19 @@ -69,51 +69,36 @@ 40.20 PeriodicTask(size_t interval_time); // interval is in milliseconds of elapsed time 40.21 ~PeriodicTask(); 40.22 40.23 - // Tells whether is enrolled 40.24 - bool is_enrolled() const; 40.25 - 40.26 // Make the task active 40.27 - // NOTE: this may only be called before the WatcherThread has been started 40.28 + // For dynamic enrollment at the time T, the task will execute somewhere 40.29 + // between T and T + interval_time. 40.30 void enroll(); 40.31 40.32 // Make the task deactive 40.33 - // NOTE: this may only be called either while the WatcherThread is 40.34 - // inactive or by a task from within its task() method. One-shot or 40.35 - // several-shot tasks may be implemented this way. 40.36 void disenroll(); 40.37 40.38 - void execute_if_pending(size_t delay_time) { 40.39 - _counter += delay_time; 40.40 - if (_counter >= _interval) { 40.41 + void execute_if_pending(int delay_time) { 40.42 + // make sure we don't overflow 40.43 + jlong tmp = (jlong) _counter + (jlong) delay_time; 40.44 + 40.45 + if (tmp >= (jlong) _interval) { 40.46 _counter = 0; 40.47 task(); 40.48 + } else { 40.49 + _counter += delay_time; 40.50 } 40.51 } 40.52 40.53 // Returns how long (time in milliseconds) before the next time we should 40.54 // execute this task. 40.55 - size_t time_to_next_interval() const { 40.56 + int time_to_next_interval() const { 40.57 assert(_interval > _counter, "task counter greater than interval?"); 40.58 return _interval - _counter; 40.59 } 40.60 40.61 // Calculate when the next periodic task will fire. 40.62 // Called by the WatcherThread's run method. 40.63 - // This assumes that periodic tasks aren't entering the system 40.64 - // dynamically, except for during startup. 40.65 - static size_t time_to_wait() { 40.66 - if (_num_tasks == 0) { 40.67 - // Don't wait any more; shut down the thread since we don't 40.68 - // currently support dynamic enrollment. 40.69 - return 0; 40.70 - } 40.71 - 40.72 - size_t delay = _tasks[0]->time_to_next_interval(); 40.73 - for (int index = 1; index < _num_tasks; index++) { 40.74 - delay = MIN2(delay, _tasks[index]->time_to_next_interval()); 40.75 - } 40.76 - return delay; 40.77 - } 40.78 + static int time_to_wait(); 40.79 40.80 // The task to perform at each period 40.81 virtual void task() = 0;
41.1 --- a/src/share/vm/runtime/thread.cpp Fri Nov 09 19:24:31 2012 -0500 41.2 +++ b/src/share/vm/runtime/thread.cpp Fri Nov 09 16:45:20 2012 -0800 41.3 @@ -1217,6 +1217,7 @@ 41.4 // timer interrupts exists on the platform. 41.5 41.6 WatcherThread* WatcherThread::_watcher_thread = NULL; 41.7 +bool WatcherThread::_startable = false; 41.8 volatile bool WatcherThread::_should_terminate = false; 41.9 41.10 WatcherThread::WatcherThread() : Thread() { 41.11 @@ -1237,6 +1238,55 @@ 41.12 } 41.13 } 41.14 41.15 +int WatcherThread::sleep() const { 41.16 + MutexLockerEx ml(PeriodicTask_lock, Mutex::_no_safepoint_check_flag); 41.17 + 41.18 + // remaining will be zero if there are no tasks, 41.19 + // causing the WatcherThread to sleep until a task is 41.20 + // enrolled 41.21 + int remaining = PeriodicTask::time_to_wait(); 41.22 + int time_slept = 0; 41.23 + 41.24 + // we expect this to timeout - we only ever get unparked when 41.25 + // we should terminate or when a new task has been enrolled 41.26 + OSThreadWaitState osts(this->osthread(), false /* not Object.wait() */); 41.27 + 41.28 + jlong time_before_loop = os::javaTimeNanos(); 41.29 + 41.30 + for (;;) { 41.31 + bool timedout = PeriodicTask_lock->wait(Mutex::_no_safepoint_check_flag, remaining); 41.32 + jlong now = os::javaTimeNanos(); 41.33 + 41.34 + if (remaining == 0) { 41.35 + // if we didn't have any tasks we could have waited for a long time 41.36 + // consider the time_slept zero and reset time_before_loop 41.37 + time_slept = 0; 41.38 + time_before_loop = now; 41.39 + } else { 41.40 + // need to recalulate since we might have new tasks in _tasks 41.41 + time_slept = (int) ((now - time_before_loop) / 1000000); 41.42 + } 41.43 + 41.44 + // Change to task list or spurious wakeup of some kind 41.45 + if (timedout || _should_terminate) { 41.46 + break; 41.47 + } 41.48 + 41.49 + remaining = PeriodicTask::time_to_wait(); 41.50 + if (remaining == 0) { 41.51 + // Last task was just disenrolled so loop around and wait until 41.52 + // another task gets enrolled 41.53 + continue; 41.54 + } 41.55 + 41.56 + remaining -= time_slept; 41.57 + if (remaining <= 0) 41.58 + break; 41.59 + } 41.60 + 41.61 + return time_slept; 41.62 +} 41.63 + 41.64 void WatcherThread::run() { 41.65 assert(this == watcher_thread(), "just checking"); 41.66 41.67 @@ -1249,26 +1299,7 @@ 41.68 41.69 // Calculate how long it'll be until the next PeriodicTask work 41.70 // should be done, and sleep that amount of time. 41.71 - size_t time_to_wait = PeriodicTask::time_to_wait(); 41.72 - 41.73 - // we expect this to timeout - we only ever get unparked when 41.74 - // we should terminate 41.75 - { 41.76 - OSThreadWaitState osts(this->osthread(), false /* not Object.wait() */); 41.77 - 41.78 - jlong prev_time = os::javaTimeNanos(); 41.79 - for (;;) { 41.80 - int res= _SleepEvent->park(time_to_wait); 41.81 - if (res == OS_TIMEOUT || _should_terminate) 41.82 - break; 41.83 - // spurious wakeup of some kind 41.84 - jlong now = os::javaTimeNanos(); 41.85 - time_to_wait -= (now - prev_time) / 1000000; 41.86 - if (time_to_wait <= 0) 41.87 - break; 41.88 - prev_time = now; 41.89 - } 41.90 - } 41.91 + int time_waited = sleep(); 41.92 41.93 if (is_error_reported()) { 41.94 // A fatal error has happened, the error handler(VMError::report_and_die) 41.95 @@ -1298,13 +1329,7 @@ 41.96 } 41.97 } 41.98 41.99 - PeriodicTask::real_time_tick(time_to_wait); 41.100 - 41.101 - // If we have no more tasks left due to dynamic disenrollment, 41.102 - // shut down the thread since we don't currently support dynamic enrollment 41.103 - if (PeriodicTask::num_tasks() == 0) { 41.104 - _should_terminate = true; 41.105 - } 41.106 + PeriodicTask::real_time_tick(time_waited); 41.107 } 41.108 41.109 // Signal that it is terminated 41.110 @@ -1319,22 +1344,33 @@ 41.111 } 41.112 41.113 void WatcherThread::start() { 41.114 - if (watcher_thread() == NULL) { 41.115 + assert(PeriodicTask_lock->owned_by_self(), "PeriodicTask_lock required"); 41.116 + 41.117 + if (watcher_thread() == NULL && _startable) { 41.118 _should_terminate = false; 41.119 // Create the single instance of WatcherThread 41.120 new WatcherThread(); 41.121 } 41.122 } 41.123 41.124 +void WatcherThread::make_startable() { 41.125 + assert(PeriodicTask_lock->owned_by_self(), "PeriodicTask_lock required"); 41.126 + _startable = true; 41.127 +} 41.128 + 41.129 void WatcherThread::stop() { 41.130 + { 41.131 + MutexLockerEx ml(PeriodicTask_lock, Mutex::_no_safepoint_check_flag); 41.132 + _should_terminate = true; 41.133 + OrderAccess::fence(); // ensure WatcherThread sees update in main loop 41.134 + 41.135 + WatcherThread* watcher = watcher_thread(); 41.136 + if (watcher != NULL) 41.137 + watcher->unpark(); 41.138 + } 41.139 + 41.140 // it is ok to take late safepoints here, if needed 41.141 MutexLocker mu(Terminator_lock); 41.142 - _should_terminate = true; 41.143 - OrderAccess::fence(); // ensure WatcherThread sees update in main loop 41.144 - 41.145 - Thread* watcher = watcher_thread(); 41.146 - if (watcher != NULL) 41.147 - watcher->_SleepEvent->unpark(); 41.148 41.149 while(watcher_thread() != NULL) { 41.150 // This wait should make safepoint checks, wait without a timeout, 41.151 @@ -1352,6 +1388,11 @@ 41.152 } 41.153 } 41.154 41.155 +void WatcherThread::unpark() { 41.156 + MutexLockerEx ml(PeriodicTask_lock->owned_by_self() ? NULL : PeriodicTask_lock, Mutex::_no_safepoint_check_flag); 41.157 + PeriodicTask_lock->notify(); 41.158 +} 41.159 + 41.160 void WatcherThread::print_on(outputStream* st) const { 41.161 st->print("\"%s\" ", name()); 41.162 Thread::print_on(st); 41.163 @@ -3658,12 +3699,18 @@ 41.164 } 41.165 } 41.166 41.167 - // Start up the WatcherThread if there are any periodic tasks 41.168 - // NOTE: All PeriodicTasks should be registered by now. If they 41.169 - // aren't, late joiners might appear to start slowly (we might 41.170 - // take a while to process their first tick). 41.171 - if (PeriodicTask::num_tasks() > 0) { 41.172 - WatcherThread::start(); 41.173 + { 41.174 + MutexLockerEx ml(PeriodicTask_lock, Mutex::_no_safepoint_check_flag); 41.175 + // Make sure the watcher thread can be started by WatcherThread::start() 41.176 + // or by dynamic enrollment. 41.177 + WatcherThread::make_startable(); 41.178 + // Start up the WatcherThread if there are any periodic tasks 41.179 + // NOTE: All PeriodicTasks should be registered by now. If they 41.180 + // aren't, late joiners might appear to start slowly (we might 41.181 + // take a while to process their first tick). 41.182 + if (PeriodicTask::num_tasks() > 0) { 41.183 + WatcherThread::start(); 41.184 + } 41.185 } 41.186 41.187 // Give os specific code one last chance to start
42.1 --- a/src/share/vm/runtime/thread.hpp Fri Nov 09 19:24:31 2012 -0500 42.2 +++ b/src/share/vm/runtime/thread.hpp Fri Nov 09 16:45:20 2012 -0800 42.3 @@ -722,6 +722,7 @@ 42.4 private: 42.5 static WatcherThread* _watcher_thread; 42.6 42.7 + static bool _startable; 42.8 volatile static bool _should_terminate; // updated without holding lock 42.9 public: 42.10 enum SomeConstants { 42.11 @@ -738,6 +739,7 @@ 42.12 char* name() const { return (char*)"VM Periodic Task Thread"; } 42.13 void print_on(outputStream* st) const; 42.14 void print() const { print_on(tty); } 42.15 + void unpark(); 42.16 42.17 // Returns the single instance of WatcherThread 42.18 static WatcherThread* watcher_thread() { return _watcher_thread; } 42.19 @@ -745,6 +747,12 @@ 42.20 // Create and start the single instance of WatcherThread, or stop it on shutdown 42.21 static void start(); 42.22 static void stop(); 42.23 + // Only allow start once the VM is sufficiently initialized 42.24 + // Otherwise the first task to enroll will trigger the start 42.25 + static void make_startable(); 42.26 + 42.27 + private: 42.28 + int sleep() const; 42.29 }; 42.30 42.31
43.1 --- a/src/share/vm/runtime/vframe.cpp Fri Nov 09 19:24:31 2012 -0500 43.2 +++ b/src/share/vm/runtime/vframe.cpp Fri Nov 09 16:45:20 2012 -0800 43.3 @@ -161,7 +161,7 @@ 43.4 // If this is the first frame, and java.lang.Object.wait(...) then print out the receiver. 43.5 if (frame_count == 0) { 43.6 if (method()->name() == vmSymbols::wait_name() && 43.7 - InstanceKlass::cast(method()->method_holder())->name() == vmSymbols::java_lang_Object()) { 43.8 + method()->method_holder()->name() == vmSymbols::java_lang_Object()) { 43.9 StackValueCollection* locs = locals(); 43.10 if (!locs->is_empty()) { 43.11 StackValue* sv = locs->at(0); 43.12 @@ -407,7 +407,7 @@ 43.13 if (Universe::reflect_invoke_cache()->is_same_method(method())) { 43.14 // This is Method.invoke() -- skip it 43.15 } else if (use_new_reflection && 43.16 - Klass::cast(method()->method_holder()) 43.17 + method()->method_holder() 43.18 ->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass())) { 43.19 // This is an auxilary frame -- skip it 43.20 } else if (method()->is_method_handle_intrinsic() || 43.21 @@ -471,8 +471,8 @@ 43.22 void vframeStreamCommon::skip_reflection_related_frames() { 43.23 while (!at_end() && 43.24 (JDK_Version::is_gte_jdk14x_version() && UseNewReflection && 43.25 - (Klass::cast(method()->method_holder())->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass()) || 43.26 - Klass::cast(method()->method_holder())->is_subclass_of(SystemDictionary::reflect_ConstructorAccessorImpl_klass())))) { 43.27 + (method()->method_holder()->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass()) || 43.28 + method()->method_holder()->is_subclass_of(SystemDictionary::reflect_ConstructorAccessorImpl_klass())))) { 43.29 next(); 43.30 } 43.31 } 43.32 @@ -547,13 +547,13 @@ 43.33 43.34 void javaVFrame::print_value() const { 43.35 Method* m = method(); 43.36 - Klass* k = m->method_holder(); 43.37 + InstanceKlass* k = m->method_holder(); 43.38 tty->print_cr("frame( sp=" INTPTR_FORMAT ", unextended_sp=" INTPTR_FORMAT ", fp=" INTPTR_FORMAT ", pc=" INTPTR_FORMAT ")", 43.39 _fr.sp(), _fr.unextended_sp(), _fr.fp(), _fr.pc()); 43.40 tty->print("%s.%s", Klass::cast(k)->internal_name(), m->name()->as_C_string()); 43.41 43.42 if (!m->is_native()) { 43.43 - Symbol* source_name = InstanceKlass::cast(k)->source_file_name(); 43.44 + Symbol* source_name = k->source_file_name(); 43.45 int line_number = m->line_number_from_bci(bci()); 43.46 if (source_name != NULL && (line_number != -1)) { 43.47 tty->print("(%s:%d)", source_name->as_C_string(), line_number);
44.1 --- a/src/share/vm/runtime/vmStructs.cpp Fri Nov 09 19:24:31 2012 -0500 44.2 +++ b/src/share/vm/runtime/vmStructs.cpp Fri Nov 09 16:45:20 2012 -0800 44.3 @@ -289,7 +289,7 @@ 44.4 nonstatic_field(CompiledICHolder, _holder_klass, Klass*) \ 44.5 nonstatic_field(ConstantPool, _tags, Array<u1>*) \ 44.6 nonstatic_field(ConstantPool, _cache, ConstantPoolCache*) \ 44.7 - nonstatic_field(ConstantPool, _pool_holder, Klass*) \ 44.8 + nonstatic_field(ConstantPool, _pool_holder, InstanceKlass*) \ 44.9 nonstatic_field(ConstantPool, _operands, Array<u2>*) \ 44.10 nonstatic_field(ConstantPool, _length, int) \ 44.11 nonstatic_field(ConstantPool, _resolved_references, jobject) \
45.1 --- a/src/share/vm/services/heapDumper.cpp Fri Nov 09 19:24:31 2012 -0500 45.2 +++ b/src/share/vm/services/heapDumper.cpp Fri Nov 09 16:45:20 2012 -0800 45.3 @@ -1117,8 +1117,8 @@ 45.4 writer->write_symbolID(m->name()); // method's name 45.5 writer->write_symbolID(m->signature()); // method's signature 45.6 45.7 - assert(Klass::cast(m->method_holder())->oop_is_instance(), "not InstanceKlass"); 45.8 - writer->write_symbolID(InstanceKlass::cast(m->method_holder())->source_file_name()); // source file name 45.9 + assert(m->method_holder()->oop_is_instance(), "not InstanceKlass"); 45.10 + writer->write_symbolID(m->method_holder()->source_file_name()); // source file name 45.11 writer->write_u4(class_serial_num); // class serial number 45.12 writer->write_u4((u4) line_number); // line number 45.13 }