Thu, 19 Sep 2013 18:01:39 +0200
Merge
1.1 --- a/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java Thu Sep 19 09:34:20 2013 +0200 1.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java Thu Sep 19 18:01:39 2013 +0200 1.3 @@ -1213,6 +1213,7 @@ 1.4 } 1.5 HotSpotTypeDataBase db = (HotSpotTypeDataBase)agent.getTypeDataBase(); 1.6 if (t.countTokens() == 1) { 1.7 + String name = t.nextToken(); 1.8 out.println("intConstant " + name + " " + db.lookupIntConstant(name)); 1.9 } else if (t.countTokens() == 0) { 1.10 Iterator i = db.getIntConstants(); 1.11 @@ -1235,6 +1236,7 @@ 1.12 } 1.13 HotSpotTypeDataBase db = (HotSpotTypeDataBase)agent.getTypeDataBase(); 1.14 if (t.countTokens() == 1) { 1.15 + String name = t.nextToken(); 1.16 out.println("longConstant " + name + " " + db.lookupLongConstant(name)); 1.17 } else if (t.countTokens() == 0) { 1.18 Iterator i = db.getLongConstants();
2.1 --- a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Thu Sep 19 09:34:20 2013 +0200 2.2 +++ b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Thu Sep 19 18:01:39 2013 +0200 2.3 @@ -1724,14 +1724,6 @@ 2.4 } 2.5 2.6 assert_different_registers(obj, k_RInfo, klass_RInfo); 2.7 - if (!k->is_loaded()) { 2.8 - klass2reg_with_patching(k_RInfo, op->info_for_patch()); 2.9 - } else { 2.10 -#ifdef _LP64 2.11 - __ mov_metadata(k_RInfo, k->constant_encoding()); 2.12 -#endif // _LP64 2.13 - } 2.14 - assert(obj != k_RInfo, "must be different"); 2.15 2.16 __ cmpptr(obj, (int32_t)NULL_WORD); 2.17 if (op->should_profile()) { 2.18 @@ -1748,6 +1740,14 @@ 2.19 } else { 2.20 __ jcc(Assembler::equal, *obj_is_null); 2.21 } 2.22 + 2.23 + if (!k->is_loaded()) { 2.24 + klass2reg_with_patching(k_RInfo, op->info_for_patch()); 2.25 + } else { 2.26 +#ifdef _LP64 2.27 + __ mov_metadata(k_RInfo, k->constant_encoding()); 2.28 +#endif // _LP64 2.29 + } 2.30 __ verify_oop(obj); 2.31 2.32 if (op->fast_check()) {
3.1 --- a/src/cpu/x86/vm/templateInterpreter_x86.hpp Thu Sep 19 09:34:20 2013 +0200 3.2 +++ b/src/cpu/x86/vm/templateInterpreter_x86.hpp Thu Sep 19 18:01:39 2013 +0200 3.3 @@ -34,9 +34,9 @@ 3.4 // Run with +PrintInterpreter to get the VM to print out the size. 3.5 // Max size with JVMTI 3.6 #ifdef AMD64 3.7 - const static int InterpreterCodeSize = 200 * 1024; 3.8 + const static int InterpreterCodeSize = 208 * 1024; 3.9 #else 3.10 - const static int InterpreterCodeSize = 168 * 1024; 3.11 + const static int InterpreterCodeSize = 176 * 1024; 3.12 #endif // AMD64 3.13 3.14 #endif // CPU_X86_VM_TEMPLATEINTERPRETER_X86_HPP
4.1 --- a/src/share/tools/LogCompilation/README Thu Sep 19 09:34:20 2013 +0200 4.2 +++ b/src/share/tools/LogCompilation/README Thu Sep 19 18:01:39 2013 +0200 4.3 @@ -4,14 +4,14 @@ 4.4 requires a 1.5 JDK to build and simply typing make should build it. 4.5 4.6 It produces a jar file, logc.jar, that can be run on the 4.7 -hotspot.log from LogCompilation output like this: 4.8 +HotSpot log (by default, hotspot_pid{pid}.log) from LogCompilation output like this: 4.9 4.10 - java -jar logc.jar hotspot.log 4.11 + java -jar logc.jar hotspot_pid1234.log 4.12 4.13 This will produce something like the normal PrintCompilation output. 4.14 Adding the -i option with also report inlining like PrintInlining. 4.15 4.16 -More information about the LogCompilation output can be found at 4.17 +More information about the LogCompilation output can be found at 4.18 4.19 https://wikis.oracle.com/display/HotSpotInternals/LogCompilation+overview 4.20 https://wikis.oracle.com/display/HotSpotInternals/PrintCompilation
5.1 --- a/src/share/vm/c1/c1_Runtime1.cpp Thu Sep 19 09:34:20 2013 +0200 5.2 +++ b/src/share/vm/c1/c1_Runtime1.cpp Thu Sep 19 18:01:39 2013 +0200 5.3 @@ -709,10 +709,10 @@ 5.4 Bytecodes::Code code = field_access.code(); 5.5 5.6 // We must load class, initialize class and resolvethe field 5.7 - FieldAccessInfo result; // initialize class if needed 5.8 + fieldDescriptor result; // initialize class if needed 5.9 constantPoolHandle constants(THREAD, caller->constants()); 5.10 - LinkResolver::resolve_field(result, constants, field_access.index(), Bytecodes::java_code(code), false, CHECK_NULL); 5.11 - return result.klass()(); 5.12 + LinkResolver::resolve_field_access(result, constants, field_access.index(), Bytecodes::java_code(code), CHECK_NULL); 5.13 + return result.field_holder(); 5.14 } 5.15 5.16 5.17 @@ -826,11 +826,11 @@ 5.18 if (stub_id == Runtime1::access_field_patching_id) { 5.19 5.20 Bytecode_field field_access(caller_method, bci); 5.21 - FieldAccessInfo result; // initialize class if needed 5.22 + fieldDescriptor result; // initialize class if needed 5.23 Bytecodes::Code code = field_access.code(); 5.24 constantPoolHandle constants(THREAD, caller_method->constants()); 5.25 - LinkResolver::resolve_field(result, constants, field_access.index(), Bytecodes::java_code(code), false, CHECK); 5.26 - patch_field_offset = result.field_offset(); 5.27 + LinkResolver::resolve_field_access(result, constants, field_access.index(), Bytecodes::java_code(code), CHECK); 5.28 + patch_field_offset = result.offset(); 5.29 5.30 // If we're patching a field which is volatile then at compile it 5.31 // must not have been know to be volatile, so the generated code
6.1 --- a/src/share/vm/ci/ciField.cpp Thu Sep 19 09:34:20 2013 +0200 6.2 +++ b/src/share/vm/ci/ciField.cpp Thu Sep 19 18:01:39 2013 +0200 6.3 @@ -1,5 +1,5 @@ 6.4 /* 6.5 - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 6.6 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 6.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6.8 * 6.9 * This code is free software; you can redistribute it and/or modify it 6.10 @@ -75,7 +75,6 @@ 6.11 6.12 assert(klass->get_instanceKlass()->is_linked(), "must be linked before using its constan-pool"); 6.13 6.14 - _cp_index = index; 6.15 constantPoolHandle cpool(thread, klass->get_instanceKlass()->constants()); 6.16 6.17 // Get the field's name, signature, and type. 6.18 @@ -116,7 +115,7 @@ 6.19 // The declared holder of this field may not have been loaded. 6.20 // Bail out with partial field information. 6.21 if (!holder_is_accessible) { 6.22 - // _cp_index and _type have already been set. 6.23 + // _type has already been set. 6.24 // The default values for _flags and _constant_value will suffice. 6.25 // We need values for _holder, _offset, and _is_constant, 6.26 _holder = declared_holder; 6.27 @@ -146,8 +145,6 @@ 6.28 ciField::ciField(fieldDescriptor *fd): _known_to_link_with_put(NULL), _known_to_link_with_get(NULL) { 6.29 ASSERT_IN_VM; 6.30 6.31 - _cp_index = -1; 6.32 - 6.33 // Get the field's name, signature, and type. 6.34 ciEnv* env = CURRENT_ENV; 6.35 _name = env->get_symbol(fd->name()); 6.36 @@ -351,12 +348,11 @@ 6.37 } 6.38 } 6.39 6.40 - FieldAccessInfo result; 6.41 - constantPoolHandle c_pool(THREAD, 6.42 - accessing_klass->get_instanceKlass()->constants()); 6.43 - LinkResolver::resolve_field(result, c_pool, _cp_index, 6.44 - Bytecodes::java_code(bc), 6.45 - true, false, KILL_COMPILE_ON_FATAL_(false)); 6.46 + fieldDescriptor result; 6.47 + LinkResolver::resolve_field(result, _holder->get_instanceKlass(), 6.48 + _name->get_symbol(), _signature->get_symbol(), 6.49 + accessing_klass->get_Klass(), bc, true, false, 6.50 + KILL_COMPILE_ON_FATAL_(false)); 6.51 6.52 // update the hit-cache, unless there is a problem with memory scoping: 6.53 if (accessing_klass->is_shared() || !is_shared()) {
7.1 --- a/src/share/vm/ci/ciField.hpp Thu Sep 19 09:34:20 2013 +0200 7.2 +++ b/src/share/vm/ci/ciField.hpp Thu Sep 19 18:01:39 2013 +0200 7.3 @@ -1,5 +1,5 @@ 7.4 /* 7.5 - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 7.6 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 7.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7.8 * 7.9 * This code is free software; you can redistribute it and/or modify it 7.10 @@ -53,9 +53,6 @@ 7.11 ciInstanceKlass* _known_to_link_with_get; 7.12 ciConstant _constant_value; 7.13 7.14 - // Used for will_link 7.15 - int _cp_index; 7.16 - 7.17 ciType* compute_type(); 7.18 ciType* compute_type_impl(); 7.19
8.1 --- a/src/share/vm/ci/ciInstanceKlass.cpp Thu Sep 19 09:34:20 2013 +0200 8.2 +++ b/src/share/vm/ci/ciInstanceKlass.cpp Thu Sep 19 18:01:39 2013 +0200 8.3 @@ -1,5 +1,5 @@ 8.4 /* 8.5 - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 8.6 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 8.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8.8 * 8.9 * This code is free software; you can redistribute it and/or modify it 8.10 @@ -522,8 +522,7 @@ 8.11 8.12 for (JavaFieldStream fs(k); !fs.done(); fs.next()) { 8.13 if (fs.access_flags().is_static()) continue; 8.14 - fieldDescriptor fd; 8.15 - fd.initialize(k, fs.index()); 8.16 + fieldDescriptor& fd = fs.field_descriptor(); 8.17 ciField* field = new (arena) ciField(&fd); 8.18 fields->append(field); 8.19 }
9.1 --- a/src/share/vm/ci/ciMethod.cpp Thu Sep 19 09:34:20 2013 +0200 9.2 +++ b/src/share/vm/ci/ciMethod.cpp Thu Sep 19 18:01:39 2013 +0200 9.3 @@ -286,7 +286,10 @@ 9.4 check_is_loaded(); 9.5 assert(holder()->is_linked(), "must be linked"); 9.6 VM_ENTRY_MARK; 9.7 - return klassItable::compute_itable_index(get_Method()); 9.8 + Method* m = get_Method(); 9.9 + if (!m->has_itable_index()) 9.10 + return Method::nonvirtual_vtable_index; 9.11 + return m->itable_index(); 9.12 } 9.13 #endif // SHARK 9.14 9.15 @@ -1137,6 +1140,10 @@ 9.16 // ------------------------------------------------------------------ 9.17 // ciMethod::check_call 9.18 bool ciMethod::check_call(int refinfo_index, bool is_static) const { 9.19 + // This method is used only in C2 from InlineTree::ok_to_inline, 9.20 + // and is only used under -Xcomp or -XX:CompileTheWorld. 9.21 + // It appears to fail when applied to an invokeinterface call site. 9.22 + // FIXME: Remove this method and resolve_method_statically; refactor to use the other LinkResolver entry points. 9.23 VM_ENTRY_MARK; 9.24 { 9.25 EXCEPTION_MARK;
10.1 --- a/src/share/vm/ci/ciSymbol.hpp Thu Sep 19 09:34:20 2013 +0200 10.2 +++ b/src/share/vm/ci/ciSymbol.hpp Thu Sep 19 18:01:39 2013 +0200 10.3 @@ -1,5 +1,5 @@ 10.4 /* 10.5 - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 10.6 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 10.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.8 * 10.9 * This code is free software; you can redistribute it and/or modify it 10.10 @@ -44,6 +44,7 @@ 10.11 friend class ciInstanceKlass; 10.12 friend class ciSignature; 10.13 friend class ciMethod; 10.14 + friend class ciField; 10.15 friend class ciObjArrayKlass; 10.16 10.17 private:
11.1 --- a/src/share/vm/classfile/classFileParser.cpp Thu Sep 19 09:34:20 2013 +0200 11.2 +++ b/src/share/vm/classfile/classFileParser.cpp Thu Sep 19 18:01:39 2013 +0200 11.3 @@ -3995,9 +3995,8 @@ 11.4 this_klass->set_has_final_method(); 11.5 } 11.6 this_klass->copy_method_ordering(method_ordering, CHECK_NULL); 11.7 - // The InstanceKlass::_methods_jmethod_ids cache and the 11.8 - // InstanceKlass::_methods_cached_itable_indices cache are 11.9 - // both managed on the assumption that the initial cache 11.10 + // The InstanceKlass::_methods_jmethod_ids cache 11.11 + // is managed on the assumption that the initial cache 11.12 // size is equal to the number of methods in the class. If 11.13 // that changes, then InstanceKlass::idnum_can_increment() 11.14 // has to be changed accordingly.
12.1 --- a/src/share/vm/classfile/classLoader.cpp Thu Sep 19 09:34:20 2013 +0200 12.2 +++ b/src/share/vm/classfile/classLoader.cpp Thu Sep 19 18:01:39 2013 +0200 12.3 @@ -1319,6 +1319,25 @@ 12.4 // The CHECK at the caller will propagate the exception out 12.5 } 12.6 12.7 +/** 12.8 + * Returns if the given method should be compiled when doing compile-the-world. 12.9 + * 12.10 + * TODO: This should be a private method in a CompileTheWorld class. 12.11 + */ 12.12 +static bool can_be_compiled(methodHandle m, int comp_level) { 12.13 + assert(CompileTheWorld, "must be"); 12.14 + 12.15 + // It's not valid to compile a native wrapper for MethodHandle methods 12.16 + // that take a MemberName appendix since the bytecode signature is not 12.17 + // correct. 12.18 + vmIntrinsics::ID iid = m->intrinsic_id(); 12.19 + if (MethodHandles::is_signature_polymorphic(iid) && MethodHandles::has_member_arg(iid)) { 12.20 + return false; 12.21 + } 12.22 + 12.23 + return CompilationPolicy::can_be_compiled(m, comp_level); 12.24 +} 12.25 + 12.26 void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) { 12.27 int len = (int)strlen(name); 12.28 if (len > 6 && strcmp(".class", name + len - 6) == 0) { 12.29 @@ -1362,8 +1381,7 @@ 12.30 int comp_level = CompilationPolicy::policy()->initial_compile_level(); 12.31 for (int n = 0; n < k->methods()->length(); n++) { 12.32 methodHandle m (THREAD, k->methods()->at(n)); 12.33 - if (CompilationPolicy::can_be_compiled(m, comp_level)) { 12.34 - 12.35 + if (can_be_compiled(m, comp_level)) { 12.36 if (++_codecache_sweep_counter == CompileTheWorldSafepointInterval) { 12.37 // Give sweeper a chance to keep up with CTW 12.38 VM_ForceSafepoint op; 12.39 @@ -1375,7 +1393,7 @@ 12.40 methodHandle(), 0, "CTW", THREAD); 12.41 if (HAS_PENDING_EXCEPTION) { 12.42 clear_pending_exception_if_not_oom(CHECK); 12.43 - tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_class_counter, m->name()->as_C_string()); 12.44 + tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_class_counter, m->name_and_sig_as_C_string()); 12.45 } else { 12.46 _compile_the_world_method_counter++; 12.47 } 12.48 @@ -1391,11 +1409,13 @@ 12.49 methodHandle(), 0, "CTW", THREAD); 12.50 if (HAS_PENDING_EXCEPTION) { 12.51 clear_pending_exception_if_not_oom(CHECK); 12.52 - tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_class_counter, m->name()->as_C_string()); 12.53 + tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_class_counter, m->name_and_sig_as_C_string()); 12.54 } else { 12.55 _compile_the_world_method_counter++; 12.56 } 12.57 } 12.58 + } else { 12.59 + tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_class_counter, m->name_and_sig_as_C_string()); 12.60 } 12.61 12.62 nmethod* nm = m->code();
13.1 --- a/src/share/vm/code/compiledIC.cpp Thu Sep 19 09:34:20 2013 +0200 13.2 +++ b/src/share/vm/code/compiledIC.cpp Thu Sep 19 18:01:39 2013 +0200 13.3 @@ -1,5 +1,5 @@ 13.4 /* 13.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 13.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 13.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 13.8 * 13.9 * This code is free software; you can redistribute it and/or modify it 13.10 @@ -161,31 +161,36 @@ 13.11 13.12 13.13 void CompiledIC::set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS) { 13.14 - methodHandle method = call_info->selected_method(); 13.15 - bool is_invoke_interface = (bytecode == Bytecodes::_invokeinterface && !call_info->has_vtable_index()); 13.16 assert(CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), ""); 13.17 assert(!is_optimized(), "cannot set an optimized virtual call to megamorphic"); 13.18 assert(is_call_to_compiled() || is_call_to_interpreted(), "going directly to megamorphic?"); 13.19 13.20 address entry; 13.21 - if (is_invoke_interface) { 13.22 - int index = klassItable::compute_itable_index(call_info->resolved_method()()); 13.23 - entry = VtableStubs::create_stub(false, index, method()); 13.24 + if (call_info->call_kind() == CallInfo::itable_call) { 13.25 + assert(bytecode == Bytecodes::_invokeinterface, ""); 13.26 + int itable_index = call_info->itable_index(); 13.27 + entry = VtableStubs::find_itable_stub(itable_index); 13.28 +#ifdef ASSERT 13.29 assert(entry != NULL, "entry not computed"); 13.30 + int index = call_info->resolved_method()->itable_index(); 13.31 + assert(index == itable_index, "CallInfo pre-computes this"); 13.32 +#endif //ASSERT 13.33 InstanceKlass* k = call_info->resolved_method()->method_holder(); 13.34 - assert(k->is_interface(), "sanity check"); 13.35 + assert(k->verify_itable_index(itable_index), "sanity check"); 13.36 InlineCacheBuffer::create_transition_stub(this, k, entry); 13.37 } else { 13.38 - // Can be different than method->vtable_index(), due to package-private etc. 13.39 + assert(call_info->call_kind() == CallInfo::vtable_call, "either itable or vtable"); 13.40 + // Can be different than selected_method->vtable_index(), due to package-private etc. 13.41 int vtable_index = call_info->vtable_index(); 13.42 - entry = VtableStubs::create_stub(true, vtable_index, method()); 13.43 - InlineCacheBuffer::create_transition_stub(this, method(), entry); 13.44 + assert(call_info->resolved_klass()->verify_vtable_index(vtable_index), "sanity check"); 13.45 + entry = VtableStubs::find_vtable_stub(vtable_index); 13.46 + InlineCacheBuffer::create_transition_stub(this, NULL, entry); 13.47 } 13.48 13.49 if (TraceICs) { 13.50 ResourceMark rm; 13.51 tty->print_cr ("IC@" INTPTR_FORMAT ": to megamorphic %s entry: " INTPTR_FORMAT, 13.52 - instruction_address(), method->print_value_string(), entry); 13.53 + instruction_address(), call_info->selected_method()->print_value_string(), entry); 13.54 } 13.55 13.56 // We can't check this anymore. With lazy deopt we could have already
14.1 --- a/src/share/vm/code/vtableStubs.cpp Thu Sep 19 09:34:20 2013 +0200 14.2 +++ b/src/share/vm/code/vtableStubs.cpp Thu Sep 19 18:01:39 2013 +0200 14.3 @@ -111,7 +111,7 @@ 14.4 } 14.5 14.6 14.7 -address VtableStubs::create_stub(bool is_vtable_stub, int vtable_index, Method* method) { 14.8 +address VtableStubs::find_stub(bool is_vtable_stub, int vtable_index) { 14.9 assert(vtable_index >= 0, "must be positive"); 14.10 14.11 VtableStub* s = ShareVtableStubs ? lookup(is_vtable_stub, vtable_index) : NULL;
15.1 --- a/src/share/vm/code/vtableStubs.hpp Thu Sep 19 09:34:20 2013 +0200 15.2 +++ b/src/share/vm/code/vtableStubs.hpp Thu Sep 19 18:01:39 2013 +0200 15.3 @@ -121,9 +121,11 @@ 15.4 static VtableStub* lookup (bool is_vtable_stub, int vtable_index); 15.5 static void enter (bool is_vtable_stub, int vtable_index, VtableStub* s); 15.6 static inline uint hash (bool is_vtable_stub, int vtable_index); 15.7 + static address find_stub (bool is_vtable_stub, int vtable_index); 15.8 15.9 public: 15.10 - static address create_stub(bool is_vtable_stub, int vtable_index, Method* method); // return the entry point of a stub for this call 15.11 + static address find_vtable_stub(int vtable_index) { return find_stub(true, vtable_index); } 15.12 + static address find_itable_stub(int itable_index) { return find_stub(false, itable_index); } 15.13 static bool is_entry_point(address pc); // is pc a vtable stub entry point? 15.14 static bool contains(address pc); // is pc within any stub? 15.15 static VtableStub* stub_containing(address pc); // stub containing pc or NULL
16.1 --- a/src/share/vm/gc_implementation/g1/ptrQueue.hpp Thu Sep 19 09:34:20 2013 +0200 16.2 +++ b/src/share/vm/gc_implementation/g1/ptrQueue.hpp Thu Sep 19 18:01:39 2013 +0200 16.3 @@ -38,6 +38,7 @@ 16.4 16.5 class PtrQueueSet; 16.6 class PtrQueue VALUE_OBJ_CLASS_SPEC { 16.7 + friend class VMStructs; 16.8 16.9 protected: 16.10 // The ptr queue set to which this queue belongs.
17.1 --- a/src/share/vm/gc_implementation/g1/vmStructs_g1.hpp Thu Sep 19 09:34:20 2013 +0200 17.2 +++ b/src/share/vm/gc_implementation/g1/vmStructs_g1.hpp Thu Sep 19 18:01:39 2013 +0200 17.3 @@ -31,7 +31,8 @@ 17.4 17.5 #define VM_STRUCTS_G1(nonstatic_field, static_field) \ 17.6 \ 17.7 - static_field(HeapRegion, GrainBytes, size_t) \ 17.8 + static_field(HeapRegion, GrainBytes, size_t) \ 17.9 + static_field(HeapRegion, LogOfHRGrainBytes, int) \ 17.10 \ 17.11 nonstatic_field(HeapRegionSeq, _regions, HeapRegion**) \ 17.12 nonstatic_field(HeapRegionSeq, _length, uint) \
18.1 --- a/src/share/vm/interpreter/interpreterRuntime.cpp Thu Sep 19 09:34:20 2013 +0200 18.2 +++ b/src/share/vm/interpreter/interpreterRuntime.cpp Thu Sep 19 18:01:39 2013 +0200 18.3 @@ -496,15 +496,15 @@ 18.4 18.5 IRT_ENTRY(void, InterpreterRuntime::resolve_get_put(JavaThread* thread, Bytecodes::Code bytecode)) 18.6 // resolve field 18.7 - FieldAccessInfo info; 18.8 + fieldDescriptor info; 18.9 constantPoolHandle pool(thread, method(thread)->constants()); 18.10 bool is_put = (bytecode == Bytecodes::_putfield || bytecode == Bytecodes::_putstatic); 18.11 bool is_static = (bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic); 18.12 18.13 { 18.14 JvmtiHideSingleStepping jhss(thread); 18.15 - LinkResolver::resolve_field(info, pool, get_index_u2_cpcache(thread, bytecode), 18.16 - bytecode, false, CHECK); 18.17 + LinkResolver::resolve_field_access(info, pool, get_index_u2_cpcache(thread, bytecode), 18.18 + bytecode, CHECK); 18.19 } // end JvmtiHideSingleStepping 18.20 18.21 // check if link resolution caused cpCache to be updated 18.22 @@ -524,7 +524,7 @@ 18.23 // class is intitialized. This is required so that access to the static 18.24 // field will call the initialization function every time until the class 18.25 // is completely initialized ala. in 2.17.5 in JVM Specification. 18.26 - InstanceKlass *klass = InstanceKlass::cast(info.klass()()); 18.27 + InstanceKlass* klass = InstanceKlass::cast(info.field_holder()); 18.28 bool uninitialized_static = ((bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic) && 18.29 !klass->is_initialized()); 18.30 Bytecodes::Code get_code = (Bytecodes::Code)0; 18.31 @@ -539,9 +539,9 @@ 18.32 cache_entry(thread)->set_field( 18.33 get_code, 18.34 put_code, 18.35 - info.klass(), 18.36 - info.field_index(), 18.37 - info.field_offset(), 18.38 + info.field_holder(), 18.39 + info.index(), 18.40 + info.offset(), 18.41 state, 18.42 info.access_flags().is_final(), 18.43 info.access_flags().is_volatile(), 18.44 @@ -686,29 +686,55 @@ 18.45 if (already_resolved(thread)) return; 18.46 18.47 if (bytecode == Bytecodes::_invokeinterface) { 18.48 - 18.49 if (TraceItables && Verbose) { 18.50 ResourceMark rm(thread); 18.51 tty->print_cr("Resolving: klass: %s to method: %s", info.resolved_klass()->name()->as_C_string(), info.resolved_method()->name()->as_C_string()); 18.52 } 18.53 + } 18.54 +#ifdef ASSERT 18.55 + if (bytecode == Bytecodes::_invokeinterface) { 18.56 if (info.resolved_method()->method_holder() == 18.57 SystemDictionary::Object_klass()) { 18.58 // NOTE: THIS IS A FIX FOR A CORNER CASE in the JVM spec 18.59 - // (see also cpCacheOop.cpp for details) 18.60 + // (see also CallInfo::set_interface for details) 18.61 + assert(info.call_kind() == CallInfo::vtable_call || 18.62 + info.call_kind() == CallInfo::direct_call, ""); 18.63 methodHandle rm = info.resolved_method(); 18.64 assert(rm->is_final() || info.has_vtable_index(), 18.65 "should have been set already"); 18.66 - cache_entry(thread)->set_method(bytecode, rm, info.vtable_index()); 18.67 + } else if (!info.resolved_method()->has_itable_index()) { 18.68 + // Resolved something like CharSequence.toString. Use vtable not itable. 18.69 + assert(info.call_kind() != CallInfo::itable_call, ""); 18.70 } else { 18.71 // Setup itable entry 18.72 - int index = klassItable::compute_itable_index(info.resolved_method()()); 18.73 - cache_entry(thread)->set_interface_call(info.resolved_method(), index); 18.74 + assert(info.call_kind() == CallInfo::itable_call, ""); 18.75 + int index = info.resolved_method()->itable_index(); 18.76 + assert(info.itable_index() == index, ""); 18.77 } 18.78 } else { 18.79 - cache_entry(thread)->set_method( 18.80 + assert(info.call_kind() == CallInfo::direct_call || 18.81 + info.call_kind() == CallInfo::vtable_call, ""); 18.82 + } 18.83 +#endif 18.84 + switch (info.call_kind()) { 18.85 + case CallInfo::direct_call: 18.86 + cache_entry(thread)->set_direct_call( 18.87 + bytecode, 18.88 + info.resolved_method()); 18.89 + break; 18.90 + case CallInfo::vtable_call: 18.91 + cache_entry(thread)->set_vtable_call( 18.92 bytecode, 18.93 info.resolved_method(), 18.94 info.vtable_index()); 18.95 + break; 18.96 + case CallInfo::itable_call: 18.97 + cache_entry(thread)->set_itable_call( 18.98 + bytecode, 18.99 + info.resolved_method(), 18.100 + info.itable_index()); 18.101 + break; 18.102 + default: ShouldNotReachHere(); 18.103 } 18.104 } 18.105 IRT_END
19.1 --- a/src/share/vm/interpreter/linkResolver.cpp Thu Sep 19 09:34:20 2013 +0200 19.2 +++ b/src/share/vm/interpreter/linkResolver.cpp Thu Sep 19 18:01:39 2013 +0200 19.3 @@ -46,19 +46,6 @@ 19.4 #include "runtime/thread.inline.hpp" 19.5 #include "runtime/vmThread.hpp" 19.6 19.7 -//------------------------------------------------------------------------------------------------------------------------ 19.8 -// Implementation of FieldAccessInfo 19.9 - 19.10 -void FieldAccessInfo::set(KlassHandle klass, Symbol* name, int field_index, int field_offset, 19.11 -BasicType field_type, AccessFlags access_flags) { 19.12 - _klass = klass; 19.13 - _name = name; 19.14 - _field_index = field_index; 19.15 - _field_offset = field_offset; 19.16 - _field_type = field_type; 19.17 - _access_flags = access_flags; 19.18 -} 19.19 - 19.20 19.21 //------------------------------------------------------------------------------------------------------------------------ 19.22 // Implementation of CallInfo 19.23 @@ -66,26 +53,25 @@ 19.24 19.25 void CallInfo::set_static(KlassHandle resolved_klass, methodHandle resolved_method, TRAPS) { 19.26 int vtable_index = Method::nonvirtual_vtable_index; 19.27 - set_common(resolved_klass, resolved_klass, resolved_method, resolved_method, vtable_index, CHECK); 19.28 + set_common(resolved_klass, resolved_klass, resolved_method, resolved_method, CallInfo::direct_call, vtable_index, CHECK); 19.29 } 19.30 19.31 19.32 -void CallInfo::set_interface(KlassHandle resolved_klass, KlassHandle selected_klass, methodHandle resolved_method, methodHandle selected_method, TRAPS) { 19.33 +void CallInfo::set_interface(KlassHandle resolved_klass, KlassHandle selected_klass, methodHandle resolved_method, methodHandle selected_method, int itable_index, TRAPS) { 19.34 // This is only called for interface methods. If the resolved_method 19.35 // comes from java/lang/Object, it can be the subject of a virtual call, so 19.36 // we should pick the vtable index from the resolved method. 19.37 - // Other than that case, there is no valid vtable index to specify. 19.38 - int vtable_index = Method::invalid_vtable_index; 19.39 - if (resolved_method->method_holder() == SystemDictionary::Object_klass()) { 19.40 - assert(resolved_method->vtable_index() == selected_method->vtable_index(), "sanity check"); 19.41 - vtable_index = resolved_method->vtable_index(); 19.42 - } 19.43 - set_common(resolved_klass, selected_klass, resolved_method, selected_method, vtable_index, CHECK); 19.44 + // In that case, the caller must call set_virtual instead of set_interface. 19.45 + assert(resolved_method->method_holder()->is_interface(), ""); 19.46 + assert(itable_index == resolved_method()->itable_index(), ""); 19.47 + set_common(resolved_klass, selected_klass, resolved_method, selected_method, CallInfo::itable_call, itable_index, CHECK); 19.48 } 19.49 19.50 void CallInfo::set_virtual(KlassHandle resolved_klass, KlassHandle selected_klass, methodHandle resolved_method, methodHandle selected_method, int vtable_index, TRAPS) { 19.51 assert(vtable_index >= 0 || vtable_index == Method::nonvirtual_vtable_index, "valid index"); 19.52 - set_common(resolved_klass, selected_klass, resolved_method, selected_method, vtable_index, CHECK); 19.53 + assert(vtable_index < 0 || !resolved_method->has_vtable_index() || vtable_index == resolved_method->vtable_index(), ""); 19.54 + CallKind kind = (vtable_index >= 0 && !resolved_method->can_be_statically_bound() ? CallInfo::vtable_call : CallInfo::direct_call); 19.55 + set_common(resolved_klass, selected_klass, resolved_method, selected_method, kind, vtable_index, CHECK); 19.56 assert(!resolved_method->is_compiled_lambda_form(), "these must be handled via an invokehandle call"); 19.57 } 19.58 19.59 @@ -98,20 +84,29 @@ 19.60 resolved_method->is_compiled_lambda_form(), 19.61 "linkMethod must return one of these"); 19.62 int vtable_index = Method::nonvirtual_vtable_index; 19.63 - assert(resolved_method->vtable_index() == vtable_index, ""); 19.64 - set_common(resolved_klass, resolved_klass, resolved_method, resolved_method, vtable_index, CHECK); 19.65 + assert(!resolved_method->has_vtable_index(), ""); 19.66 + set_common(resolved_klass, resolved_klass, resolved_method, resolved_method, CallInfo::direct_call, vtable_index, CHECK); 19.67 _resolved_appendix = resolved_appendix; 19.68 _resolved_method_type = resolved_method_type; 19.69 } 19.70 19.71 -void CallInfo::set_common(KlassHandle resolved_klass, KlassHandle selected_klass, methodHandle resolved_method, methodHandle selected_method, int vtable_index, TRAPS) { 19.72 +void CallInfo::set_common(KlassHandle resolved_klass, 19.73 + KlassHandle selected_klass, 19.74 + methodHandle resolved_method, 19.75 + methodHandle selected_method, 19.76 + CallKind kind, 19.77 + int index, 19.78 + TRAPS) { 19.79 assert(resolved_method->signature() == selected_method->signature(), "signatures must correspond"); 19.80 _resolved_klass = resolved_klass; 19.81 _selected_klass = selected_klass; 19.82 _resolved_method = resolved_method; 19.83 _selected_method = selected_method; 19.84 - _vtable_index = vtable_index; 19.85 + _call_kind = kind; 19.86 + _call_index = index; 19.87 _resolved_appendix = Handle(); 19.88 + DEBUG_ONLY(verify()); // verify before making side effects 19.89 + 19.90 if (CompilationPolicy::must_be_compiled(selected_method)) { 19.91 // This path is unusual, mostly used by the '-Xcomp' stress test mode. 19.92 19.93 @@ -138,6 +133,65 @@ 19.94 } 19.95 } 19.96 19.97 +// utility query for unreflecting a method 19.98 +CallInfo::CallInfo(Method* resolved_method, Klass* resolved_klass) { 19.99 + Klass* resolved_method_holder = resolved_method->method_holder(); 19.100 + if (resolved_klass == NULL) { // 2nd argument defaults to holder of 1st 19.101 + resolved_klass = resolved_method_holder; 19.102 + } 19.103 + _resolved_klass = resolved_klass; 19.104 + _selected_klass = resolved_klass; 19.105 + _resolved_method = resolved_method; 19.106 + _selected_method = resolved_method; 19.107 + // classify: 19.108 + CallKind kind = CallInfo::unknown_kind; 19.109 + int index = resolved_method->vtable_index(); 19.110 + if (resolved_method->can_be_statically_bound()) { 19.111 + kind = CallInfo::direct_call; 19.112 + } else if (!resolved_method_holder->is_interface()) { 19.113 + // Could be an Object method inherited into an interface, but still a vtable call. 19.114 + kind = CallInfo::vtable_call; 19.115 + } else if (!resolved_klass->is_interface()) { 19.116 + // A miranda method. Compute the vtable index. 19.117 + ResourceMark rm; 19.118 + klassVtable* vt = InstanceKlass::cast(resolved_klass)->vtable(); 19.119 + index = vt->index_of_miranda(resolved_method->name(), 19.120 + resolved_method->signature()); 19.121 + kind = CallInfo::vtable_call; 19.122 + } else { 19.123 + // A regular interface call. 19.124 + kind = CallInfo::itable_call; 19.125 + index = resolved_method->itable_index(); 19.126 + } 19.127 + assert(index == Method::nonvirtual_vtable_index || index >= 0, err_msg("bad index %d", index)); 19.128 + _call_kind = kind; 19.129 + _call_index = index; 19.130 + _resolved_appendix = Handle(); 19.131 + DEBUG_ONLY(verify()); 19.132 +} 19.133 + 19.134 +#ifdef ASSERT 19.135 +void CallInfo::verify() { 19.136 + switch (call_kind()) { // the meaning and allowed value of index depends on kind 19.137 + case CallInfo::direct_call: 19.138 + if (_call_index == Method::nonvirtual_vtable_index) break; 19.139 + // else fall through to check vtable index: 19.140 + case CallInfo::vtable_call: 19.141 + assert(resolved_klass()->verify_vtable_index(_call_index), ""); 19.142 + break; 19.143 + case CallInfo::itable_call: 19.144 + assert(resolved_method()->method_holder()->verify_itable_index(_call_index), ""); 19.145 + break; 19.146 + case CallInfo::unknown_kind: 19.147 + assert(call_kind() != CallInfo::unknown_kind, "CallInfo must be set"); 19.148 + break; 19.149 + default: 19.150 + fatal(err_msg_res("Unexpected call kind %d", call_kind())); 19.151 + } 19.152 +} 19.153 +#endif //ASSERT 19.154 + 19.155 + 19.156 19.157 //------------------------------------------------------------------------------------------------------------------------ 19.158 // Klass resolution 19.159 @@ -163,13 +217,6 @@ 19.160 result = KlassHandle(THREAD, result_oop); 19.161 } 19.162 19.163 -void LinkResolver::resolve_klass_no_update(KlassHandle& result, constantPoolHandle pool, int index, TRAPS) { 19.164 - Klass* result_oop = 19.165 - ConstantPool::klass_ref_at_if_loaded_check(pool, index, CHECK); 19.166 - result = KlassHandle(THREAD, result_oop); 19.167 -} 19.168 - 19.169 - 19.170 //------------------------------------------------------------------------------------------------------------------------ 19.171 // Method resolution 19.172 // 19.173 @@ -360,7 +407,12 @@ 19.174 19.175 void LinkResolver::resolve_method_statically(methodHandle& resolved_method, KlassHandle& resolved_klass, 19.176 Bytecodes::Code code, constantPoolHandle pool, int index, TRAPS) { 19.177 - 19.178 + // This method is used only 19.179 + // (1) in C2 from InlineTree::ok_to_inline (via ciMethod::check_call), 19.180 + // and 19.181 + // (2) in Bytecode_invoke::static_target 19.182 + // It appears to fail when applied to an invokeinterface call site. 19.183 + // FIXME: Remove this method and ciMethod::check_call; refactor to use the other LinkResolver entry points. 19.184 // resolve klass 19.185 if (code == Bytecodes::_invokedynamic) { 19.186 resolved_klass = SystemDictionary::MethodHandle_klass(); 19.187 @@ -580,45 +632,49 @@ 19.188 } 19.189 } 19.190 19.191 -void LinkResolver::resolve_field(FieldAccessInfo& result, constantPoolHandle pool, int index, Bytecodes::Code byte, bool check_only, TRAPS) { 19.192 - resolve_field(result, pool, index, byte, check_only, true, CHECK); 19.193 +void LinkResolver::resolve_field_access(fieldDescriptor& result, constantPoolHandle pool, int index, Bytecodes::Code byte, TRAPS) { 19.194 + // Load these early in case the resolve of the containing klass fails 19.195 + Symbol* field = pool->name_ref_at(index); 19.196 + Symbol* sig = pool->signature_ref_at(index); 19.197 + 19.198 + // resolve specified klass 19.199 + KlassHandle resolved_klass; 19.200 + resolve_klass(resolved_klass, pool, index, CHECK); 19.201 + 19.202 + KlassHandle current_klass(THREAD, pool->pool_holder()); 19.203 + resolve_field(result, resolved_klass, field, sig, current_klass, byte, true, true, CHECK); 19.204 } 19.205 19.206 -void LinkResolver::resolve_field(FieldAccessInfo& result, constantPoolHandle pool, int index, Bytecodes::Code byte, bool check_only, bool update_pool, TRAPS) { 19.207 +void LinkResolver::resolve_field(fieldDescriptor& fd, KlassHandle resolved_klass, Symbol* field, Symbol* sig, 19.208 + KlassHandle current_klass, Bytecodes::Code byte, bool check_access, bool initialize_class, 19.209 + TRAPS) { 19.210 assert(byte == Bytecodes::_getstatic || byte == Bytecodes::_putstatic || 19.211 - byte == Bytecodes::_getfield || byte == Bytecodes::_putfield, "bad bytecode"); 19.212 + byte == Bytecodes::_getfield || byte == Bytecodes::_putfield || 19.213 + (byte == Bytecodes::_nop && !check_access), "bad field access bytecode"); 19.214 19.215 bool is_static = (byte == Bytecodes::_getstatic || byte == Bytecodes::_putstatic); 19.216 bool is_put = (byte == Bytecodes::_putfield || byte == Bytecodes::_putstatic); 19.217 19.218 - // resolve specified klass 19.219 - KlassHandle resolved_klass; 19.220 - if (update_pool) { 19.221 - resolve_klass(resolved_klass, pool, index, CHECK); 19.222 - } else { 19.223 - resolve_klass_no_update(resolved_klass, pool, index, CHECK); 19.224 - } 19.225 - // Load these early in case the resolve of the containing klass fails 19.226 - Symbol* field = pool->name_ref_at(index); 19.227 - Symbol* sig = pool->signature_ref_at(index); 19.228 // Check if there's a resolved klass containing the field 19.229 - if( resolved_klass.is_null() ) { 19.230 + if (resolved_klass.is_null()) { 19.231 ResourceMark rm(THREAD); 19.232 THROW_MSG(vmSymbols::java_lang_NoSuchFieldError(), field->as_C_string()); 19.233 } 19.234 19.235 // Resolve instance field 19.236 - fieldDescriptor fd; // find_field initializes fd if found 19.237 KlassHandle sel_klass(THREAD, InstanceKlass::cast(resolved_klass())->find_field(field, sig, &fd)); 19.238 // check if field exists; i.e., if a klass containing the field def has been selected 19.239 - if (sel_klass.is_null()){ 19.240 + if (sel_klass.is_null()) { 19.241 ResourceMark rm(THREAD); 19.242 THROW_MSG(vmSymbols::java_lang_NoSuchFieldError(), field->as_C_string()); 19.243 } 19.244 19.245 + if (!check_access) 19.246 + // Access checking may be turned off when calling from within the VM. 19.247 + return; 19.248 + 19.249 // check access 19.250 - KlassHandle ref_klass(THREAD, pool->pool_holder()); 19.251 - check_field_accessability(ref_klass, resolved_klass, sel_klass, fd, CHECK); 19.252 + check_field_accessability(current_klass, resolved_klass, sel_klass, fd, CHECK); 19.253 19.254 // check for errors 19.255 if (is_static != fd.is_static()) { 19.256 @@ -629,7 +685,7 @@ 19.257 } 19.258 19.259 // Final fields can only be accessed from its own class. 19.260 - if (is_put && fd.access_flags().is_final() && sel_klass() != pool->pool_holder()) { 19.261 + if (is_put && fd.access_flags().is_final() && sel_klass() != current_klass()) { 19.262 THROW(vmSymbols::java_lang_IllegalAccessError()); 19.263 } 19.264 19.265 @@ -639,19 +695,18 @@ 19.266 // 19.267 // note 2: we don't want to force initialization if we are just checking 19.268 // if the field access is legal; e.g., during compilation 19.269 - if (is_static && !check_only) { 19.270 + if (is_static && initialize_class) { 19.271 sel_klass->initialize(CHECK); 19.272 } 19.273 19.274 - { 19.275 + if (sel_klass() != current_klass()) { 19.276 HandleMark hm(THREAD); 19.277 - Handle ref_loader (THREAD, InstanceKlass::cast(ref_klass())->class_loader()); 19.278 + Handle ref_loader (THREAD, InstanceKlass::cast(current_klass())->class_loader()); 19.279 Handle sel_loader (THREAD, InstanceKlass::cast(sel_klass())->class_loader()); 19.280 - Symbol* signature_ref = pool->signature_ref_at(index); 19.281 { 19.282 ResourceMark rm(THREAD); 19.283 Symbol* failed_type_symbol = 19.284 - SystemDictionary::check_signature_loaders(signature_ref, 19.285 + SystemDictionary::check_signature_loaders(sig, 19.286 ref_loader, sel_loader, 19.287 false, 19.288 CHECK); 19.289 @@ -677,9 +732,6 @@ 19.290 19.291 // return information. note that the klass is set to the actual klass containing the 19.292 // field, otherwise access of static fields in superclasses will not work. 19.293 - KlassHandle holder (THREAD, fd.field_holder()); 19.294 - Symbol* name = fd.name(); 19.295 - result.set(holder, name, fd.index(), fd.offset(), fd.field_type(), fd.access_flags()); 19.296 } 19.297 19.298 19.299 @@ -907,10 +959,6 @@ 19.300 } 19.301 19.302 // Virtual methods cannot be resolved before its klass has been linked, for otherwise the Method*'s 19.303 - // has not been rewritten, and the vtable initialized. 19.304 - assert(resolved_method->method_holder()->is_linked(), "must be linked"); 19.305 - 19.306 - // Virtual methods cannot be resolved before its klass has been linked, for otherwise the Method*'s 19.307 // has not been rewritten, and the vtable initialized. Make sure to do this after the nullcheck, since 19.308 // a missing receiver might result in a bogus lookup. 19.309 assert(resolved_method->method_holder()->is_linked(), "must be linked"); 19.310 @@ -920,6 +968,7 @@ 19.311 vtable_index = vtable_index_of_miranda_method(resolved_klass, 19.312 resolved_method->name(), 19.313 resolved_method->signature(), CHECK); 19.314 + 19.315 assert(vtable_index >= 0 , "we should have valid vtable index at this point"); 19.316 19.317 InstanceKlass* inst = InstanceKlass::cast(recv_klass()); 19.318 @@ -927,6 +976,7 @@ 19.319 } else { 19.320 // at this point we are sure that resolved_method is virtual and not 19.321 // a miranda method; therefore, it must have a valid vtable index. 19.322 + assert(!resolved_method->has_itable_index(), ""); 19.323 vtable_index = resolved_method->vtable_index(); 19.324 // We could get a negative vtable_index for final methods, 19.325 // because as an optimization they are they are never put in the vtable, 19.326 @@ -1006,6 +1056,12 @@ 19.327 lookup_instance_method_in_klasses(sel_method, recv_klass, 19.328 resolved_method->name(), 19.329 resolved_method->signature(), CHECK); 19.330 + if (sel_method.is_null() && !check_null_and_abstract) { 19.331 + // In theory this is a harmless placeholder value, but 19.332 + // in practice leaving in null affects the nsk default method tests. 19.333 + // This needs further study. 19.334 + sel_method = resolved_method; 19.335 + } 19.336 // check if method exists 19.337 if (sel_method.is_null()) { 19.338 ResourceMark rm(THREAD); 19.339 @@ -1046,7 +1102,14 @@ 19.340 sel_method->signature())); 19.341 } 19.342 // setup result 19.343 - result.set_interface(resolved_klass, recv_klass, resolved_method, sel_method, CHECK); 19.344 + if (!resolved_method->has_itable_index()) { 19.345 + int vtable_index = resolved_method->vtable_index(); 19.346 + assert(vtable_index == sel_method->vtable_index(), "sanity check"); 19.347 + result.set_virtual(resolved_klass, recv_klass, resolved_method, sel_method, vtable_index, CHECK); 19.348 + return; 19.349 + } 19.350 + int itable_index = resolved_method()->itable_index(); 19.351 + result.set_interface(resolved_klass, recv_klass, resolved_method, sel_method, itable_index, CHECK); 19.352 } 19.353 19.354 19.355 @@ -1293,7 +1356,8 @@ 19.356 } 19.357 19.358 if (TraceMethodHandles) { 19.359 - tty->print_cr("resolve_invokedynamic #%d %s %s", 19.360 + ResourceMark rm(THREAD); 19.361 + tty->print_cr("resolve_invokedynamic #%d %s %s", 19.362 ConstantPool::decode_invokedynamic_index(index), 19.363 method_name->as_C_string(), method_signature->as_C_string()); 19.364 tty->print(" BSM info: "); bootstrap_specifier->print(); 19.365 @@ -1342,9 +1406,16 @@ 19.366 //------------------------------------------------------------------------------------------------------------------------ 19.367 #ifndef PRODUCT 19.368 19.369 -void FieldAccessInfo::print() { 19.370 +void CallInfo::print() { 19.371 ResourceMark rm; 19.372 - tty->print_cr("Field %s@%d", name()->as_C_string(), field_offset()); 19.373 + const char* kindstr = "unknown"; 19.374 + switch (_call_kind) { 19.375 + case direct_call: kindstr = "direct"; break; 19.376 + case vtable_call: kindstr = "vtable"; break; 19.377 + case itable_call: kindstr = "itable"; break; 19.378 + } 19.379 + tty->print_cr("Call %s@%d %s", kindstr, _call_index, 19.380 + _resolved_method.is_null() ? "(none)" : _resolved_method->name_and_sig_as_C_string()); 19.381 } 19.382 19.383 #endif
20.1 --- a/src/share/vm/interpreter/linkResolver.hpp Thu Sep 19 09:34:20 2013 +0200 20.2 +++ b/src/share/vm/interpreter/linkResolver.hpp Thu Sep 19 18:01:39 2013 +0200 20.3 @@ -1,5 +1,5 @@ 20.4 /* 20.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 20.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 20.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 20.8 * 20.9 * This code is free software; you can redistribute it and/or modify it 20.10 @@ -30,63 +30,54 @@ 20.11 20.12 // All the necessary definitions for run-time link resolution. 20.13 20.14 -// LinkInfo & its subclasses provide all the information gathered 20.15 -// for a particular link after resolving it. A link is any reference 20.16 +// CallInfo provides all the information gathered for a particular 20.17 +// linked call site after resolving it. A link is any reference 20.18 // made from within the bytecodes of a method to an object outside of 20.19 // that method. If the info is invalid, the link has not been resolved 20.20 // successfully. 20.21 20.22 -class LinkInfo VALUE_OBJ_CLASS_SPEC { 20.23 -}; 20.24 - 20.25 - 20.26 -// Link information for getfield/putfield & getstatic/putstatic bytecodes. 20.27 - 20.28 -class FieldAccessInfo: public LinkInfo { 20.29 - protected: 20.30 - KlassHandle _klass; 20.31 - Symbol* _name; 20.32 - AccessFlags _access_flags; 20.33 - int _field_index; // original index in the klass 20.34 - int _field_offset; 20.35 - BasicType _field_type; 20.36 - 20.37 +class CallInfo VALUE_OBJ_CLASS_SPEC { 20.38 public: 20.39 - void set(KlassHandle klass, Symbol* name, int field_index, int field_offset, 20.40 - BasicType field_type, AccessFlags access_flags); 20.41 - KlassHandle klass() const { return _klass; } 20.42 - Symbol* name() const { return _name; } 20.43 - int field_index() const { return _field_index; } 20.44 - int field_offset() const { return _field_offset; } 20.45 - BasicType field_type() const { return _field_type; } 20.46 - AccessFlags access_flags() const { return _access_flags; } 20.47 - 20.48 - // debugging 20.49 - void print() PRODUCT_RETURN; 20.50 -}; 20.51 - 20.52 - 20.53 -// Link information for all calls. 20.54 - 20.55 -class CallInfo: public LinkInfo { 20.56 + // Ways that a method call might be selected (or not) based on receiver type. 20.57 + // Note that an invokevirtual instruction might be linked with no_dispatch, 20.58 + // and an invokeinterface instruction might be linked with any of the three options 20.59 + enum CallKind { 20.60 + direct_call, // jump into resolved_method (must be concrete) 20.61 + vtable_call, // select recv.klass.method_at_vtable(index) 20.62 + itable_call, // select recv.klass.method_at_itable(resolved_method.holder, index) 20.63 + unknown_kind = -1 20.64 + }; 20.65 private: 20.66 - KlassHandle _resolved_klass; // static receiver klass 20.67 + KlassHandle _resolved_klass; // static receiver klass, resolved from a symbolic reference 20.68 KlassHandle _selected_klass; // dynamic receiver class (same as static, or subklass) 20.69 methodHandle _resolved_method; // static target method 20.70 methodHandle _selected_method; // dynamic (actual) target method 20.71 - int _vtable_index; // vtable index of selected method 20.72 + CallKind _call_kind; // kind of call (static(=bytecode static/special + 20.73 + // others inferred), vtable, itable) 20.74 + int _call_index; // vtable or itable index of selected class method (if any) 20.75 Handle _resolved_appendix; // extra argument in constant pool (if CPCE::has_appendix) 20.76 Handle _resolved_method_type; // MethodType (for invokedynamic and invokehandle call sites) 20.77 20.78 void set_static( KlassHandle resolved_klass, methodHandle resolved_method , TRAPS); 20.79 - void set_interface(KlassHandle resolved_klass, KlassHandle selected_klass, methodHandle resolved_method, methodHandle selected_method , TRAPS); 20.80 + void set_interface(KlassHandle resolved_klass, KlassHandle selected_klass, methodHandle resolved_method, methodHandle selected_method, int itable_index , TRAPS); 20.81 void set_virtual( KlassHandle resolved_klass, KlassHandle selected_klass, methodHandle resolved_method, methodHandle selected_method, int vtable_index , TRAPS); 20.82 void set_handle( methodHandle resolved_method, Handle resolved_appendix, Handle resolved_method_type, TRAPS); 20.83 - void set_common( KlassHandle resolved_klass, KlassHandle selected_klass, methodHandle resolved_method, methodHandle selected_method, int vtable_index , TRAPS); 20.84 + void set_common( KlassHandle resolved_klass, KlassHandle selected_klass, methodHandle resolved_method, methodHandle selected_method, CallKind kind, int index, TRAPS); 20.85 20.86 friend class LinkResolver; 20.87 20.88 public: 20.89 + CallInfo() { 20.90 +#ifndef PRODUCT 20.91 + _call_kind = CallInfo::unknown_kind; 20.92 + _call_index = Method::garbage_vtable_index; 20.93 +#endif //PRODUCT 20.94 + } 20.95 + 20.96 + // utility to extract an effective CallInfo from a method and an optional receiver limit 20.97 + // does not queue the method for compilation 20.98 + CallInfo(Method* resolved_method, Klass* resolved_klass = NULL); 20.99 + 20.100 KlassHandle resolved_klass() const { return _resolved_klass; } 20.101 KlassHandle selected_klass() const { return _selected_klass; } 20.102 methodHandle resolved_method() const { return _resolved_method; } 20.103 @@ -95,21 +86,43 @@ 20.104 Handle resolved_method_type() const { return _resolved_method_type; } 20.105 20.106 BasicType result_type() const { return selected_method()->result_type(); } 20.107 - bool has_vtable_index() const { return _vtable_index >= 0; } 20.108 - bool is_statically_bound() const { return _vtable_index == Method::nonvirtual_vtable_index; } 20.109 + CallKind call_kind() const { return _call_kind; } 20.110 + int call_index() const { return _call_index; } 20.111 int vtable_index() const { 20.112 // Even for interface calls the vtable index could be non-negative. 20.113 // See CallInfo::set_interface. 20.114 assert(has_vtable_index() || is_statically_bound(), ""); 20.115 - return _vtable_index; 20.116 + assert(call_kind() == vtable_call || call_kind() == direct_call, ""); 20.117 + // The returned value is < 0 if the call is statically bound. 20.118 + // But, the returned value may be >= 0 even if the kind is direct_call. 20.119 + // It is up to the caller to decide which way to go. 20.120 + return _call_index; 20.121 } 20.122 + int itable_index() const { 20.123 + assert(call_kind() == itable_call, ""); 20.124 + // The returned value is always >= 0, a valid itable index. 20.125 + return _call_index; 20.126 + } 20.127 + 20.128 + // debugging 20.129 +#ifdef ASSERT 20.130 + bool has_vtable_index() const { return _call_index >= 0 && _call_kind != CallInfo::itable_call; } 20.131 + bool is_statically_bound() const { return _call_index == Method::nonvirtual_vtable_index; } 20.132 +#endif //ASSERT 20.133 + void verify() PRODUCT_RETURN; 20.134 + void print() PRODUCT_RETURN; 20.135 }; 20.136 20.137 +// Link information for getfield/putfield & getstatic/putstatic bytecodes 20.138 +// is represented using a fieldDescriptor. 20.139 20.140 // The LinkResolver is used to resolve constant-pool references at run-time. 20.141 // It does all necessary link-time checks & throws exceptions if necessary. 20.142 20.143 class LinkResolver: AllStatic { 20.144 + friend class klassVtable; 20.145 + friend class klassItable; 20.146 + 20.147 private: 20.148 static void lookup_method_in_klasses (methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, TRAPS); 20.149 static void lookup_instance_method_in_klasses (methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, TRAPS); 20.150 @@ -120,7 +133,6 @@ 20.151 static int vtable_index_of_miranda_method(KlassHandle klass, Symbol* name, Symbol* signature, TRAPS); 20.152 20.153 static void resolve_klass (KlassHandle& result, constantPoolHandle pool, int index, TRAPS); 20.154 - static void resolve_klass_no_update (KlassHandle& result, constantPoolHandle pool, int index, TRAPS); // no update of constantPool entry 20.155 20.156 static void resolve_pool (KlassHandle& resolved_klass, Symbol*& method_name, Symbol*& method_signature, KlassHandle& current_klass, constantPoolHandle pool, int index, TRAPS); 20.157 20.158 @@ -148,9 +160,16 @@ 20.159 Bytecodes::Code code, constantPoolHandle pool, int index, TRAPS); 20.160 20.161 // runtime/static resolving for fields 20.162 - static void resolve_field(FieldAccessInfo& result, constantPoolHandle pool, int index, Bytecodes::Code byte, bool check_only, TRAPS); 20.163 - // takes an extra bool argument "update_pool" to decide whether to update the constantPool during klass resolution. 20.164 - static void resolve_field(FieldAccessInfo& result, constantPoolHandle pool, int index, Bytecodes::Code byte, bool check_only, bool update_pool, TRAPS); 20.165 + static void resolve_field_access(fieldDescriptor& result, constantPoolHandle pool, int index, Bytecodes::Code byte, TRAPS); 20.166 + static void resolve_field(fieldDescriptor& result, KlassHandle resolved_klass, Symbol* field_name, Symbol* field_signature, 20.167 + KlassHandle current_klass, Bytecodes::Code access_kind, bool check_access, bool initialize_class, TRAPS); 20.168 + 20.169 + // source of access_kind codes: 20.170 + static Bytecodes::Code field_access_kind(bool is_static, bool is_put) { 20.171 + return (is_static 20.172 + ? (is_put ? Bytecodes::_putstatic : Bytecodes::_getstatic) 20.173 + : (is_put ? Bytecodes::_putfield : Bytecodes::_getfield )); 20.174 + } 20.175 20.176 // runtime resolving: 20.177 // resolved_klass = specified class (i.e., static receiver class)
21.1 --- a/src/share/vm/memory/universe.cpp Thu Sep 19 09:34:20 2013 +0200 21.2 +++ b/src/share/vm/memory/universe.cpp Thu Sep 19 18:01:39 2013 +0200 21.3 @@ -602,7 +602,7 @@ 21.4 } 21.5 } 21.6 21.7 -static intptr_t non_oop_bits = 0; 21.8 +intptr_t Universe::_non_oop_bits = 0; 21.9 21.10 void* Universe::non_oop_word() { 21.11 // Neither the high bits nor the low bits of this value is allowed 21.12 @@ -616,11 +616,11 @@ 21.13 // Using the OS-supplied non-memory-address word (usually 0 or -1) 21.14 // will take care of the high bits, however many there are. 21.15 21.16 - if (non_oop_bits == 0) { 21.17 - non_oop_bits = (intptr_t)os::non_memory_address_word() | 1; 21.18 + if (_non_oop_bits == 0) { 21.19 + _non_oop_bits = (intptr_t)os::non_memory_address_word() | 1; 21.20 } 21.21 21.22 - return (void*)non_oop_bits; 21.23 + return (void*)_non_oop_bits; 21.24 } 21.25 21.26 jint universe_init() {
22.1 --- a/src/share/vm/memory/universe.hpp Thu Sep 19 09:34:20 2013 +0200 22.2 +++ b/src/share/vm/memory/universe.hpp Thu Sep 19 18:01:39 2013 +0200 22.3 @@ -179,6 +179,8 @@ 22.4 // The particular choice of collected heap. 22.5 static CollectedHeap* _collectedHeap; 22.6 22.7 + static intptr_t _non_oop_bits; 22.8 + 22.9 // For UseCompressedOops. 22.10 static struct NarrowPtrStruct _narrow_oop; 22.11 // For UseCompressedClassPointers.
23.1 --- a/src/share/vm/oops/constantPool.cpp Thu Sep 19 09:34:20 2013 +0200 23.2 +++ b/src/share/vm/oops/constantPool.cpp Thu Sep 19 18:01:39 2013 +0200 23.3 @@ -396,32 +396,6 @@ 23.4 } 23.5 23.6 23.7 -// This is an interface for the compiler that allows accessing non-resolved entries 23.8 -// in the constant pool - but still performs the validations tests. Must be used 23.9 -// in a pre-parse of the compiler - to determine what it can do and not do. 23.10 -// Note: We cannot update the ConstantPool from the vm_thread. 23.11 -Klass* ConstantPool::klass_ref_at_if_loaded_check(constantPoolHandle this_oop, int index, TRAPS) { 23.12 - int which = this_oop->klass_ref_index_at(index); 23.13 - CPSlot entry = this_oop->slot_at(which); 23.14 - if (entry.is_resolved()) { 23.15 - assert(entry.get_klass()->is_klass(), "must be"); 23.16 - return entry.get_klass(); 23.17 - } else { 23.18 - assert(entry.is_unresolved(), "must be either symbol or klass"); 23.19 - Symbol* name = entry.get_symbol(); 23.20 - oop loader = this_oop->pool_holder()->class_loader(); 23.21 - oop protection_domain = this_oop->pool_holder()->protection_domain(); 23.22 - Handle h_loader(THREAD, loader); 23.23 - Handle h_prot (THREAD, protection_domain); 23.24 - KlassHandle k(THREAD, SystemDictionary::find(name, h_loader, h_prot, THREAD)); 23.25 - 23.26 - // Do access check for klasses 23.27 - if( k.not_null() ) verify_constant_pool_resolve(this_oop, k, CHECK_NULL); 23.28 - return k(); 23.29 - } 23.30 -} 23.31 - 23.32 - 23.33 Method* ConstantPool::method_at_if_loaded(constantPoolHandle cpool, 23.34 int which) { 23.35 if (cpool->cache() == NULL) return NULL; // nothing to load yet
24.1 --- a/src/share/vm/oops/constantPool.hpp Thu Sep 19 09:34:20 2013 +0200 24.2 +++ b/src/share/vm/oops/constantPool.hpp Thu Sep 19 18:01:39 2013 +0200 24.3 @@ -730,8 +730,6 @@ 24.4 static oop method_type_at_if_loaded (constantPoolHandle this_oop, int which); 24.5 static Klass* klass_at_if_loaded (constantPoolHandle this_oop, int which); 24.6 static Klass* klass_ref_at_if_loaded (constantPoolHandle this_oop, int which); 24.7 - // Same as above - but does LinkResolving. 24.8 - static Klass* klass_ref_at_if_loaded_check(constantPoolHandle this_oop, int which, TRAPS); 24.9 24.10 // Routines currently used for annotations (only called by jvm.cpp) but which might be used in the 24.11 // future by other Java code. These take constant pool indices rather than
25.1 --- a/src/share/vm/oops/cpCache.cpp Thu Sep 19 09:34:20 2013 +0200 25.2 +++ b/src/share/vm/oops/cpCache.cpp Thu Sep 19 18:01:39 2013 +0200 25.3 @@ -140,9 +140,10 @@ 25.4 err_msg("size must not change: parameter_size=%d, value=%d", parameter_size(), value)); 25.5 } 25.6 25.7 -void ConstantPoolCacheEntry::set_method(Bytecodes::Code invoke_code, 25.8 - methodHandle method, 25.9 - int vtable_index) { 25.10 +void ConstantPoolCacheEntry::set_direct_or_vtable_call(Bytecodes::Code invoke_code, 25.11 + methodHandle method, 25.12 + int vtable_index) { 25.13 + bool is_vtable_call = (vtable_index >= 0); // FIXME: split this method on this boolean 25.14 assert(method->interpreter_entry() != NULL, "should have been set at this point"); 25.15 assert(!method->is_obsolete(), "attempt to write obsolete method to cpCache"); 25.16 25.17 @@ -160,7 +161,8 @@ 25.18 // ...and fall through as if we were handling invokevirtual: 25.19 case Bytecodes::_invokevirtual: 25.20 { 25.21 - if (method->can_be_statically_bound()) { 25.22 + if (!is_vtable_call) { 25.23 + assert(method->can_be_statically_bound(), ""); 25.24 // set_f2_as_vfinal_method checks if is_vfinal flag is true. 25.25 set_method_flags(as_TosState(method->result_type()), 25.26 ( 1 << is_vfinal_shift) | 25.27 @@ -169,6 +171,7 @@ 25.28 method()->size_of_parameters()); 25.29 set_f2_as_vfinal_method(method()); 25.30 } else { 25.31 + assert(!method->can_be_statically_bound(), ""); 25.32 assert(vtable_index >= 0, "valid index"); 25.33 assert(!method->is_final_method(), "sanity"); 25.34 set_method_flags(as_TosState(method->result_type()), 25.35 @@ -182,6 +185,7 @@ 25.36 25.37 case Bytecodes::_invokespecial: 25.38 case Bytecodes::_invokestatic: 25.39 + assert(!is_vtable_call, ""); 25.40 // Note: Read and preserve the value of the is_vfinal flag on any 25.41 // invokevirtual bytecode shared with this constant pool cache entry. 25.42 // It is cheap and safe to consult is_vfinal() at all times. 25.43 @@ -232,8 +236,22 @@ 25.44 NOT_PRODUCT(verify(tty)); 25.45 } 25.46 25.47 +void ConstantPoolCacheEntry::set_direct_call(Bytecodes::Code invoke_code, methodHandle method) { 25.48 + int index = Method::nonvirtual_vtable_index; 25.49 + // index < 0; FIXME: inline and customize set_direct_or_vtable_call 25.50 + set_direct_or_vtable_call(invoke_code, method, index); 25.51 +} 25.52 25.53 -void ConstantPoolCacheEntry::set_interface_call(methodHandle method, int index) { 25.54 +void ConstantPoolCacheEntry::set_vtable_call(Bytecodes::Code invoke_code, methodHandle method, int index) { 25.55 + // either the method is a miranda or its holder should accept the given index 25.56 + assert(method->method_holder()->is_interface() || method->method_holder()->verify_vtable_index(index), ""); 25.57 + // index >= 0; FIXME: inline and customize set_direct_or_vtable_call 25.58 + set_direct_or_vtable_call(invoke_code, method, index); 25.59 +} 25.60 + 25.61 +void ConstantPoolCacheEntry::set_itable_call(Bytecodes::Code invoke_code, methodHandle method, int index) { 25.62 + assert(method->method_holder()->verify_itable_index(index), ""); 25.63 + assert(invoke_code == Bytecodes::_invokeinterface, ""); 25.64 InstanceKlass* interf = method->method_holder(); 25.65 assert(interf->is_interface(), "must be an interface"); 25.66 assert(!method->is_final_method(), "interfaces do not have final methods; cannot link to one here");
26.1 --- a/src/share/vm/oops/cpCache.hpp Thu Sep 19 09:34:20 2013 +0200 26.2 +++ b/src/share/vm/oops/cpCache.hpp Thu Sep 19 18:01:39 2013 +0200 26.3 @@ -219,15 +219,29 @@ 26.4 Klass* root_klass // needed by the GC to dirty the klass 26.5 ); 26.6 26.7 - void set_method( // sets entry to resolved method entry 26.8 + private: 26.9 + void set_direct_or_vtable_call( 26.10 Bytecodes::Code invoke_code, // the bytecode used for invoking the method 26.11 methodHandle method, // the method/prototype if any (NULL, otherwise) 26.12 int vtable_index // the vtable index if any, else negative 26.13 ); 26.14 26.15 - void set_interface_call( 26.16 - methodHandle method, // Resolved method 26.17 - int index // Method index into interface 26.18 + public: 26.19 + void set_direct_call( // sets entry to exact concrete method entry 26.20 + Bytecodes::Code invoke_code, // the bytecode used for invoking the method 26.21 + methodHandle method // the method to call 26.22 + ); 26.23 + 26.24 + void set_vtable_call( // sets entry to vtable index 26.25 + Bytecodes::Code invoke_code, // the bytecode used for invoking the method 26.26 + methodHandle method, // resolved method which declares the vtable index 26.27 + int vtable_index // the vtable index 26.28 + ); 26.29 + 26.30 + void set_itable_call( 26.31 + Bytecodes::Code invoke_code, // the bytecode used; must be invokeinterface 26.32 + methodHandle method, // the resolved interface method 26.33 + int itable_index // index into itable for the method 26.34 ); 26.35 26.36 void set_method_handle(
27.1 --- a/src/share/vm/oops/fieldStreams.hpp Thu Sep 19 09:34:20 2013 +0200 27.2 +++ b/src/share/vm/oops/fieldStreams.hpp Thu Sep 19 18:01:39 2013 +0200 27.3 @@ -1,5 +1,5 @@ 27.4 /* 27.5 - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. 27.6 + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. 27.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 27.8 * 27.9 * This code is free software; you can redistribute it and/or modify it 27.10 @@ -27,6 +27,7 @@ 27.11 27.12 #include "oops/instanceKlass.hpp" 27.13 #include "oops/fieldInfo.hpp" 27.14 +#include "runtime/fieldDescriptor.hpp" 27.15 27.16 // The is the base class for iteration over the fields array 27.17 // describing the declared fields in the class. Several subclasses 27.18 @@ -43,8 +44,10 @@ 27.19 int _index; 27.20 int _limit; 27.21 int _generic_signature_slot; 27.22 + fieldDescriptor _fd_buf; 27.23 27.24 FieldInfo* field() const { return FieldInfo::from_field_array(_fields, _index); } 27.25 + InstanceKlass* field_holder() const { return _constants->pool_holder(); } 27.26 27.27 int init_generic_signature_start_slot() { 27.28 int length = _fields->length(); 27.29 @@ -102,6 +105,7 @@ 27.30 _index = 0; 27.31 _limit = klass->java_fields_count(); 27.32 init_generic_signature_start_slot(); 27.33 + assert(klass == field_holder(), ""); 27.34 } 27.35 FieldStreamBase(instanceKlassHandle klass) { 27.36 _fields = klass->fields(); 27.37 @@ -109,6 +113,7 @@ 27.38 _index = 0; 27.39 _limit = klass->java_fields_count(); 27.40 init_generic_signature_start_slot(); 27.41 + assert(klass == field_holder(), ""); 27.42 } 27.43 27.44 // accessors 27.45 @@ -180,6 +185,12 @@ 27.46 return field()->contended_group(); 27.47 } 27.48 27.49 + // bridge to a heavier API: 27.50 + fieldDescriptor& field_descriptor() const { 27.51 + fieldDescriptor& field = const_cast<fieldDescriptor&>(_fd_buf); 27.52 + field.reinitialize(field_holder(), _index); 27.53 + return field; 27.54 + } 27.55 }; 27.56 27.57 // Iterate over only the internal fields
28.1 --- a/src/share/vm/oops/instanceKlass.cpp Thu Sep 19 09:34:20 2013 +0200 28.2 +++ b/src/share/vm/oops/instanceKlass.cpp Thu Sep 19 18:01:39 2013 +0200 28.3 @@ -286,7 +286,6 @@ 28.4 init_previous_versions(); 28.5 set_generic_signature_index(0); 28.6 release_set_methods_jmethod_ids(NULL); 28.7 - release_set_methods_cached_itable_indices(NULL); 28.8 set_annotations(NULL); 28.9 set_jvmti_cached_class_field_map(NULL); 28.10 set_initial_method_idnum(0); 28.11 @@ -1149,7 +1148,7 @@ 28.12 Symbol* f_name = fs.name(); 28.13 Symbol* f_sig = fs.signature(); 28.14 if (f_name == name && f_sig == sig) { 28.15 - fd->initialize(const_cast<InstanceKlass*>(this), fs.index()); 28.16 + fd->reinitialize(const_cast<InstanceKlass*>(this), fs.index()); 28.17 return true; 28.18 } 28.19 } 28.20 @@ -1218,7 +1217,7 @@ 28.21 bool InstanceKlass::find_local_field_from_offset(int offset, bool is_static, fieldDescriptor* fd) const { 28.22 for (JavaFieldStream fs(this); !fs.done(); fs.next()) { 28.23 if (fs.offset() == offset) { 28.24 - fd->initialize(const_cast<InstanceKlass*>(this), fs.index()); 28.25 + fd->reinitialize(const_cast<InstanceKlass*>(this), fs.index()); 28.26 if (fd->is_static() == is_static) return true; 28.27 } 28.28 } 28.29 @@ -1251,8 +1250,7 @@ 28.30 void InstanceKlass::do_local_static_fields(FieldClosure* cl) { 28.31 for (JavaFieldStream fs(this); !fs.done(); fs.next()) { 28.32 if (fs.access_flags().is_static()) { 28.33 - fieldDescriptor fd; 28.34 - fd.initialize(this, fs.index()); 28.35 + fieldDescriptor& fd = fs.field_descriptor(); 28.36 cl->do_field(&fd); 28.37 } 28.38 } 28.39 @@ -1268,8 +1266,7 @@ 28.40 void InstanceKlass::do_local_static_fields_impl(instanceKlassHandle this_oop, void f(fieldDescriptor* fd, TRAPS), TRAPS) { 28.41 for (JavaFieldStream fs(this_oop()); !fs.done(); fs.next()) { 28.42 if (fs.access_flags().is_static()) { 28.43 - fieldDescriptor fd; 28.44 - fd.initialize(this_oop(), fs.index()); 28.45 + fieldDescriptor& fd = fs.field_descriptor(); 28.46 f(&fd, CHECK); 28.47 } 28.48 } 28.49 @@ -1291,7 +1288,7 @@ 28.50 int* fields_sorted = NEW_C_HEAP_ARRAY(int, 2*(length+1), mtClass); 28.51 int j = 0; 28.52 for (int i = 0; i < length; i += 1) { 28.53 - fd.initialize(this, i); 28.54 + fd.reinitialize(this, i); 28.55 if (!fd.is_static()) { 28.56 fields_sorted[j + 0] = fd.offset(); 28.57 fields_sorted[j + 1] = i; 28.58 @@ -1303,7 +1300,7 @@ 28.59 // _sort_Fn is defined in growableArray.hpp. 28.60 qsort(fields_sorted, length/2, 2*sizeof(int), (_sort_Fn)compare_fields_by_offset); 28.61 for (int i = 0; i < length; i += 2) { 28.62 - fd.initialize(this, fields_sorted[i + 1]); 28.63 + fd.reinitialize(this, fields_sorted[i + 1]); 28.64 assert(!fd.is_static() && fd.offset() == fields_sorted[i], "only nonstatic fields"); 28.65 cl->do_field(&fd); 28.66 } 28.67 @@ -1686,87 +1683,6 @@ 28.68 } 28.69 28.70 28.71 -// Cache an itable index 28.72 -void InstanceKlass::set_cached_itable_index(size_t idnum, int index) { 28.73 - int* indices = methods_cached_itable_indices_acquire(); 28.74 - int* to_dealloc_indices = NULL; 28.75 - 28.76 - // We use a double-check locking idiom here because this cache is 28.77 - // performance sensitive. In the normal system, this cache only 28.78 - // transitions from NULL to non-NULL which is safe because we use 28.79 - // release_set_methods_cached_itable_indices() to advertise the 28.80 - // new cache. A partially constructed cache should never be seen 28.81 - // by a racing thread. Cache reads and writes proceed without a 28.82 - // lock, but creation of the cache itself requires no leaks so a 28.83 - // lock is generally acquired in that case. 28.84 - // 28.85 - // If the RedefineClasses() API has been used, then this cache can 28.86 - // grow and we'll have transitions from non-NULL to bigger non-NULL. 28.87 - // Cache creation requires no leaks and we require safety between all 28.88 - // cache accesses and freeing of the old cache so a lock is generally 28.89 - // acquired when the RedefineClasses() API has been used. 28.90 - 28.91 - if (indices == NULL || idnum_can_increment()) { 28.92 - // we need a cache or the cache can grow 28.93 - MutexLocker ml(JNICachedItableIndex_lock); 28.94 - // reacquire the cache to see if another thread already did the work 28.95 - indices = methods_cached_itable_indices_acquire(); 28.96 - size_t length = 0; 28.97 - // cache size is stored in element[0], other elements offset by one 28.98 - if (indices == NULL || (length = (size_t)indices[0]) <= idnum) { 28.99 - size_t size = MAX2(idnum+1, (size_t)idnum_allocated_count()); 28.100 - int* new_indices = NEW_C_HEAP_ARRAY(int, size+1, mtClass); 28.101 - new_indices[0] = (int)size; 28.102 - // copy any existing entries 28.103 - size_t i; 28.104 - for (i = 0; i < length; i++) { 28.105 - new_indices[i+1] = indices[i+1]; 28.106 - } 28.107 - // Set all the rest to -1 28.108 - for (i = length; i < size; i++) { 28.109 - new_indices[i+1] = -1; 28.110 - } 28.111 - if (indices != NULL) { 28.112 - // We have an old cache to delete so save it for after we 28.113 - // drop the lock. 28.114 - to_dealloc_indices = indices; 28.115 - } 28.116 - release_set_methods_cached_itable_indices(indices = new_indices); 28.117 - } 28.118 - 28.119 - if (idnum_can_increment()) { 28.120 - // this cache can grow so we have to write to it safely 28.121 - indices[idnum+1] = index; 28.122 - } 28.123 - } else { 28.124 - CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops()); 28.125 - } 28.126 - 28.127 - if (!idnum_can_increment()) { 28.128 - // The cache cannot grow and this JNI itable index value does not 28.129 - // have to be unique like a jmethodID. If there is a race to set it, 28.130 - // it doesn't matter. 28.131 - indices[idnum+1] = index; 28.132 - } 28.133 - 28.134 - if (to_dealloc_indices != NULL) { 28.135 - // we allocated a new cache so free the old one 28.136 - FreeHeap(to_dealloc_indices); 28.137 - } 28.138 -} 28.139 - 28.140 - 28.141 -// Retrieve a cached itable index 28.142 -int InstanceKlass::cached_itable_index(size_t idnum) { 28.143 - int* indices = methods_cached_itable_indices_acquire(); 28.144 - if (indices != NULL && ((size_t)indices[0]) > idnum) { 28.145 - // indices exist and are long enough, retrieve possible cached 28.146 - return indices[idnum+1]; 28.147 - } 28.148 - return -1; 28.149 -} 28.150 - 28.151 - 28.152 // 28.153 // Walk the list of dependent nmethods searching for nmethods which 28.154 // are dependent on the changes that were passed in and mark them for 28.155 @@ -2326,12 +2242,6 @@ 28.156 } 28.157 } 28.158 28.159 - int* indices = methods_cached_itable_indices_acquire(); 28.160 - if (indices != (int*)NULL) { 28.161 - release_set_methods_cached_itable_indices(NULL); 28.162 - FreeHeap(indices); 28.163 - } 28.164 - 28.165 // release dependencies 28.166 nmethodBucket* b = _dependencies; 28.167 _dependencies = NULL; 28.168 @@ -2782,6 +2692,18 @@ 28.169 "allocated", "loaded", "linked", "being_initialized", "fully_initialized", "initialization_error" 28.170 }; 28.171 28.172 +static void print_vtable(intptr_t* start, int len, outputStream* st) { 28.173 + for (int i = 0; i < len; i++) { 28.174 + intptr_t e = start[i]; 28.175 + st->print("%d : " INTPTR_FORMAT, i, e); 28.176 + if (e != 0 && ((Metadata*)e)->is_metaspace_object()) { 28.177 + st->print(" "); 28.178 + ((Metadata*)e)->print_value_on(st); 28.179 + } 28.180 + st->cr(); 28.181 + } 28.182 +} 28.183 + 28.184 void InstanceKlass::print_on(outputStream* st) const { 28.185 assert(is_klass(), "must be klass"); 28.186 Klass::print_on(st); 28.187 @@ -2816,7 +2738,7 @@ 28.188 28.189 st->print(BULLET"arrays: "); array_klasses()->print_value_on_maybe_null(st); st->cr(); 28.190 st->print(BULLET"methods: "); methods()->print_value_on(st); st->cr(); 28.191 - if (Verbose) { 28.192 + if (Verbose || WizardMode) { 28.193 Array<Method*>* method_array = methods(); 28.194 for(int i = 0; i < method_array->length(); i++) { 28.195 st->print("%d : ", i); method_array->at(i)->print_value(); st->cr(); 28.196 @@ -2874,7 +2796,9 @@ 28.197 st->print(BULLET"inner classes: "); inner_classes()->print_value_on(st); st->cr(); 28.198 st->print(BULLET"java mirror: "); java_mirror()->print_value_on(st); st->cr(); 28.199 st->print(BULLET"vtable length %d (start addr: " INTPTR_FORMAT ")", vtable_length(), start_of_vtable()); st->cr(); 28.200 + if (vtable_length() > 0 && (Verbose || WizardMode)) print_vtable(start_of_vtable(), vtable_length(), st); 28.201 st->print(BULLET"itable length %d (start addr: " INTPTR_FORMAT ")", itable_length(), start_of_itable()); st->cr(); 28.202 + if (itable_length() > 0 && (Verbose || WizardMode)) print_vtable(start_of_itable(), itable_length(), st); 28.203 st->print_cr(BULLET"---- static fields (%d words):", static_field_size()); 28.204 FieldPrinter print_static_field(st); 28.205 ((InstanceKlass*)this)->do_local_static_fields(&print_static_field); 28.206 @@ -2896,6 +2820,7 @@ 28.207 28.208 void InstanceKlass::print_value_on(outputStream* st) const { 28.209 assert(is_klass(), "must be klass"); 28.210 + if (Verbose || WizardMode) access_flags().print_on(st); 28.211 name()->print_value_on(st); 28.212 } 28.213
29.1 --- a/src/share/vm/oops/instanceKlass.hpp Thu Sep 19 09:34:20 2013 +0200 29.2 +++ b/src/share/vm/oops/instanceKlass.hpp Thu Sep 19 18:01:39 2013 +0200 29.3 @@ -245,7 +245,6 @@ 29.4 MemberNameTable* _member_names; // Member names 29.5 JNIid* _jni_ids; // First JNI identifier for static fields in this class 29.6 jmethodID* _methods_jmethod_ids; // jmethodIDs corresponding to method_idnum, or NULL if none 29.7 - int* _methods_cached_itable_indices; // itable_index cache for JNI invoke corresponding to methods idnum, or NULL 29.8 nmethodBucket* _dependencies; // list of dependent nmethods 29.9 nmethod* _osr_nmethods_head; // Head of list of on-stack replacement nmethods for this class 29.10 BreakpointInfo* _breakpoints; // bpt lists, managed by Method* 29.11 @@ -690,10 +689,6 @@ 29.12 size_t *length_p, jmethodID* id_p); 29.13 jmethodID jmethod_id_or_null(Method* method); 29.14 29.15 - // cached itable index support 29.16 - void set_cached_itable_index(size_t idnum, int index); 29.17 - int cached_itable_index(size_t idnum); 29.18 - 29.19 // annotations support 29.20 Annotations* annotations() const { return _annotations; } 29.21 void set_annotations(Annotations* anno) { _annotations = anno; } 29.22 @@ -994,11 +989,6 @@ 29.23 void release_set_methods_jmethod_ids(jmethodID* jmeths) 29.24 { OrderAccess::release_store_ptr(&_methods_jmethod_ids, jmeths); } 29.25 29.26 - int* methods_cached_itable_indices_acquire() const 29.27 - { return (int*)OrderAccess::load_ptr_acquire(&_methods_cached_itable_indices); } 29.28 - void release_set_methods_cached_itable_indices(int* indices) 29.29 - { OrderAccess::release_store_ptr(&_methods_cached_itable_indices, indices); } 29.30 - 29.31 // Lock during initialization 29.32 public: 29.33 // Lock for (1) initialization; (2) access to the ConstantPool of this class.
30.1 --- a/src/share/vm/oops/klass.cpp Thu Sep 19 09:34:20 2013 +0200 30.2 +++ b/src/share/vm/oops/klass.cpp Thu Sep 19 18:01:39 2013 +0200 30.3 @@ -674,13 +674,23 @@ 30.4 30.5 #ifndef PRODUCT 30.6 30.7 -void Klass::verify_vtable_index(int i) { 30.8 +bool Klass::verify_vtable_index(int i) { 30.9 if (oop_is_instance()) { 30.10 - assert(i>=0 && i<((InstanceKlass*)this)->vtable_length()/vtableEntry::size(), "index out of bounds"); 30.11 + int limit = ((InstanceKlass*)this)->vtable_length()/vtableEntry::size(); 30.12 + assert(i >= 0 && i < limit, err_msg("index %d out of bounds %d", i, limit)); 30.13 } else { 30.14 assert(oop_is_array(), "Must be"); 30.15 - assert(i>=0 && i<((ArrayKlass*)this)->vtable_length()/vtableEntry::size(), "index out of bounds"); 30.16 + int limit = ((ArrayKlass*)this)->vtable_length()/vtableEntry::size(); 30.17 + assert(i >= 0 && i < limit, err_msg("index %d out of bounds %d", i, limit)); 30.18 } 30.19 + return true; 30.20 +} 30.21 + 30.22 +bool Klass::verify_itable_index(int i) { 30.23 + assert(oop_is_instance(), ""); 30.24 + int method_count = klassItable::method_count_for_interface(this); 30.25 + assert(i >= 0 && i < method_count, "index out of bounds"); 30.26 + return true; 30.27 } 30.28 30.29 #endif
31.1 --- a/src/share/vm/oops/klass.hpp Thu Sep 19 09:34:20 2013 +0200 31.2 +++ b/src/share/vm/oops/klass.hpp Thu Sep 19 18:01:39 2013 +0200 31.3 @@ -699,7 +699,8 @@ 31.4 void verify(bool check_dictionary = true) { verify_on(tty, check_dictionary); } 31.5 31.6 #ifndef PRODUCT 31.7 - void verify_vtable_index(int index); 31.8 + bool verify_vtable_index(int index); 31.9 + bool verify_itable_index(int index); 31.10 #endif 31.11 31.12 virtual void oop_verify_on(oop obj, outputStream* st);
32.1 --- a/src/share/vm/oops/klassVtable.cpp Thu Sep 19 09:34:20 2013 +0200 32.2 +++ b/src/share/vm/oops/klassVtable.cpp Thu Sep 19 18:01:39 2013 +0200 32.3 @@ -47,11 +47,12 @@ 32.4 32.5 32.6 // this function computes the vtable size (including the size needed for miranda 32.7 -// methods) and the number of miranda methods in this class 32.8 +// methods) and the number of miranda methods in this class. 32.9 // Note on Miranda methods: Let's say there is a class C that implements 32.10 -// interface I. Let's say there is a method m in I that neither C nor any 32.11 -// of its super classes implement (i.e there is no method of any access, with 32.12 -// the same name and signature as m), then m is a Miranda method which is 32.13 +// interface I, and none of C's superclasses implements I. 32.14 +// Let's say there is an abstract method m in I that neither C 32.15 +// nor any of its super classes implement (i.e there is no method of any access, 32.16 +// with the same name and signature as m), then m is a Miranda method which is 32.17 // entered as a public abstract method in C's vtable. From then on it should 32.18 // treated as any other public method in C for method over-ride purposes. 32.19 void klassVtable::compute_vtable_size_and_num_mirandas( 32.20 @@ -111,10 +112,13 @@ 32.21 } 32.22 32.23 int klassVtable::index_of(Method* m, int len) const { 32.24 - assert(m->vtable_index() >= 0, "do not ask this of non-vtable methods"); 32.25 + assert(m->has_vtable_index(), "do not ask this of non-vtable methods"); 32.26 return m->vtable_index(); 32.27 } 32.28 32.29 +// Copy super class's vtable to the first part (prefix) of this class's vtable, 32.30 +// and return the number of entries copied. Expects that 'super' is the Java 32.31 +// super class (arrays can have "array" super classes that must be skipped). 32.32 int klassVtable::initialize_from_super(KlassHandle super) { 32.33 if (super.is_null()) { 32.34 return 0; 32.35 @@ -139,14 +143,14 @@ 32.36 } 32.37 } 32.38 32.39 -// Revised lookup semantics introduced 1.3 (Kestral beta) 32.40 +// 32.41 +// Revised lookup semantics introduced 1.3 (Kestrel beta) 32.42 void klassVtable::initialize_vtable(bool checkconstraints, TRAPS) { 32.43 32.44 // Note: Arrays can have intermediate array supers. Use java_super to skip them. 32.45 KlassHandle super (THREAD, klass()->java_super()); 32.46 int nofNewEntries = 0; 32.47 32.48 - 32.49 if (PrintVtables && !klass()->oop_is_array()) { 32.50 ResourceMark rm(THREAD); 32.51 tty->print_cr("Initializing: %s", _klass->name()->as_C_string()); 32.52 @@ -174,8 +178,10 @@ 32.53 int len = methods->length(); 32.54 int initialized = super_vtable_len; 32.55 32.56 - // update_inherited_vtable can stop for gc - ensure using handles 32.57 + // Check each of this class's methods against super; 32.58 + // if override, replace in copy of super vtable, otherwise append to end 32.59 for (int i = 0; i < len; i++) { 32.60 + // update_inherited_vtable can stop for gc - ensure using handles 32.61 HandleMark hm(THREAD); 32.62 assert(methods->at(i)->is_method(), "must be a Method*"); 32.63 methodHandle mh(THREAD, methods->at(i)); 32.64 @@ -189,11 +195,11 @@ 32.65 } 32.66 } 32.67 32.68 - // add miranda methods; it will also update the value of initialized 32.69 - fill_in_mirandas(&initialized); 32.70 + // add miranda methods to end of vtable. 32.71 + initialized = fill_in_mirandas(initialized); 32.72 32.73 // In class hierarchies where the accessibility is not increasing (i.e., going from private -> 32.74 - // package_private -> publicprotected), the vtable might actually be smaller than our initial 32.75 + // package_private -> public/protected), the vtable might actually be smaller than our initial 32.76 // calculation. 32.77 assert(initialized <= _length, "vtable initialization failed"); 32.78 for(;initialized < _length; initialized++) { 32.79 @@ -248,14 +254,8 @@ 32.80 return superk; 32.81 } 32.82 32.83 -// Methods that are "effectively" final don't need vtable entries. 32.84 -bool method_is_effectively_final( 32.85 - AccessFlags klass_flags, methodHandle target) { 32.86 - return target->is_final() || klass_flags.is_final() && !target->is_overpass(); 32.87 -} 32.88 - 32.89 // Update child's copy of super vtable for overrides 32.90 -// OR return true if a new vtable entry is required 32.91 +// OR return true if a new vtable entry is required. 32.92 // Only called for InstanceKlass's, i.e. not for arrays 32.93 // If that changed, could not use _klass as handle for klass 32.94 bool klassVtable::update_inherited_vtable(InstanceKlass* klass, methodHandle target_method, int super_vtable_len, 32.95 @@ -263,6 +263,7 @@ 32.96 ResourceMark rm; 32.97 bool allocate_new = true; 32.98 assert(klass->oop_is_instance(), "must be InstanceKlass"); 32.99 + assert(klass == target_method()->method_holder(), "caller resp."); 32.100 32.101 // Initialize the method's vtable index to "nonvirtual". 32.102 // If we allocate a vtable entry, we will update it to a non-negative number. 32.103 @@ -273,11 +274,17 @@ 32.104 return false; 32.105 } 32.106 32.107 - if (method_is_effectively_final(klass->access_flags(), target_method)) { 32.108 + if (target_method->is_final_method(klass->access_flags())) { 32.109 // a final method never needs a new entry; final methods can be statically 32.110 // resolved and they have to be present in the vtable only if they override 32.111 // a super's method, in which case they re-use its entry 32.112 allocate_new = false; 32.113 + } else if (klass->is_interface()) { 32.114 + allocate_new = false; // see note below in needs_new_vtable_entry 32.115 + // An interface never allocates new vtable slots, only inherits old ones. 32.116 + // This method will either be assigned its own itable index later, 32.117 + // or be assigned an inherited vtable index in the loop below. 32.118 + target_method()->set_vtable_index(Method::pending_itable_index); 32.119 } 32.120 32.121 // we need a new entry if there is no superclass 32.122 @@ -411,8 +418,14 @@ 32.123 Symbol* classname, 32.124 AccessFlags class_flags, 32.125 TRAPS) { 32.126 + if (class_flags.is_interface()) { 32.127 + // Interfaces do not use vtables, so there is no point to assigning 32.128 + // a vtable index to any of their methods. If we refrain from doing this, 32.129 + // we can use Method::_vtable_index to hold the itable index 32.130 + return false; 32.131 + } 32.132 32.133 - if (method_is_effectively_final(class_flags, target_method) || 32.134 + if (target_method->is_final_method(class_flags) || 32.135 // a final method never needs a new entry; final methods can be statically 32.136 // resolved and they have to be present in the vtable only if they override 32.137 // a super's method, in which case they re-use its entry 32.138 @@ -500,7 +513,8 @@ 32.139 return Method::invalid_vtable_index; 32.140 } 32.141 32.142 -// check if an entry is miranda 32.143 +// check if an entry at an index is miranda 32.144 +// requires that method m at entry be declared ("held") by an interface. 32.145 bool klassVtable::is_miranda_entry_at(int i) { 32.146 Method* m = method_at(i); 32.147 Klass* method_holder = m->method_holder(); 32.148 @@ -516,7 +530,9 @@ 32.149 return false; 32.150 } 32.151 32.152 -// check if a method is a miranda method, given a class's methods table and it's super 32.153 +// check if a method is a miranda method, given a class's methods table and its super 32.154 +// "miranda" means not static, not defined by this class, and not defined 32.155 +// in super unless it is private and therefore inaccessible to this class. 32.156 // the caller must make sure that the method belongs to an interface implemented by the class 32.157 bool klassVtable::is_miranda(Method* m, Array<Method*>* class_methods, Klass* super) { 32.158 if (m->is_static()) { 32.159 @@ -541,6 +557,14 @@ 32.160 return false; 32.161 } 32.162 32.163 +// Scans current_interface_methods for miranda methods that do not 32.164 +// already appear in new_mirandas and are also not defined-and-non-private 32.165 +// in super (superclass). These mirandas are added to all_mirandas if it is 32.166 +// not null; in addition, those that are not duplicates of miranda methods 32.167 +// inherited by super from its interfaces are added to new_mirandas. 32.168 +// Thus, new_mirandas will be the set of mirandas that this class introduces, 32.169 +// all_mirandas will be the set of all mirandas applicable to this class 32.170 +// including all defined in superclasses. 32.171 void klassVtable::add_new_mirandas_to_lists( 32.172 GrowableArray<Method*>* new_mirandas, GrowableArray<Method*>* all_mirandas, 32.173 Array<Method*>* current_interface_methods, Array<Method*>* class_methods, 32.174 @@ -599,17 +623,22 @@ 32.175 } 32.176 } 32.177 32.178 -// fill in mirandas 32.179 -void klassVtable::fill_in_mirandas(int* initialized) { 32.180 +// Discover miranda methods ("miranda" = "interface abstract, no binding"), 32.181 +// and append them into the vtable starting at index initialized, 32.182 +// return the new value of initialized. 32.183 +int klassVtable::fill_in_mirandas(int initialized) { 32.184 GrowableArray<Method*> mirandas(20); 32.185 get_mirandas(&mirandas, NULL, ik()->super(), ik()->methods(), 32.186 ik()->local_interfaces()); 32.187 for (int i = 0; i < mirandas.length(); i++) { 32.188 - put_method_at(mirandas.at(i), *initialized); 32.189 - ++(*initialized); 32.190 + put_method_at(mirandas.at(i), initialized); 32.191 + ++initialized; 32.192 } 32.193 + return initialized; 32.194 } 32.195 32.196 +// Copy this class's vtable to the vtable beginning at start. 32.197 +// Used to copy superclass vtable to prefix of subclass's vtable. 32.198 void klassVtable::copy_vtable_to(vtableEntry* start) { 32.199 Copy::disjoint_words((HeapWord*)table(), (HeapWord*)start, _length * vtableEntry::size()); 32.200 } 32.201 @@ -723,6 +752,12 @@ 32.202 32.203 // Initialization 32.204 void klassItable::initialize_itable(bool checkconstraints, TRAPS) { 32.205 + if (_klass->is_interface()) { 32.206 + // This needs to go after vtable indexes are assigned but 32.207 + // before implementors need to know the number of itable indexes. 32.208 + assign_itable_indexes_for_interface(_klass()); 32.209 + } 32.210 + 32.211 // Cannot be setup doing bootstrapping, interfaces don't have 32.212 // itables, and klass with only ones entry have empty itables 32.213 if (Universe::is_bootstrapping() || 32.214 @@ -754,45 +789,89 @@ 32.215 } 32.216 32.217 32.218 +inline bool interface_method_needs_itable_index(Method* m) { 32.219 + if (m->is_static()) return false; // e.g., Stream.empty 32.220 + if (m->is_initializer()) return false; // <init> or <clinit> 32.221 + // If an interface redeclares a method from java.lang.Object, 32.222 + // it should already have a vtable index, don't touch it. 32.223 + // e.g., CharSequence.toString (from initialize_vtable) 32.224 + // if (m->has_vtable_index()) return false; // NO! 32.225 + return true; 32.226 +} 32.227 + 32.228 +int klassItable::assign_itable_indexes_for_interface(Klass* klass) { 32.229 + // an interface does not have an itable, but its methods need to be numbered 32.230 + if (TraceItables) tty->print_cr("%3d: Initializing itable for interface %s", ++initialize_count, 32.231 + klass->name()->as_C_string()); 32.232 + Array<Method*>* methods = InstanceKlass::cast(klass)->methods(); 32.233 + int nof_methods = methods->length(); 32.234 + int ime_num = 0; 32.235 + for (int i = 0; i < nof_methods; i++) { 32.236 + Method* m = methods->at(i); 32.237 + if (interface_method_needs_itable_index(m)) { 32.238 + assert(!m->is_final_method(), "no final interface methods"); 32.239 + // If m is already assigned a vtable index, do not disturb it. 32.240 + if (!m->has_vtable_index()) { 32.241 + assert(m->vtable_index() == Method::pending_itable_index, "set by initialize_vtable"); 32.242 + m->set_itable_index(ime_num); 32.243 + // Progress to next itable entry 32.244 + ime_num++; 32.245 + } 32.246 + } 32.247 + } 32.248 + assert(ime_num == method_count_for_interface(klass), "proper sizing"); 32.249 + return ime_num; 32.250 +} 32.251 + 32.252 +int klassItable::method_count_for_interface(Klass* interf) { 32.253 + assert(interf->oop_is_instance(), "must be"); 32.254 + assert(interf->is_interface(), "must be"); 32.255 + Array<Method*>* methods = InstanceKlass::cast(interf)->methods(); 32.256 + int nof_methods = methods->length(); 32.257 + while (nof_methods > 0) { 32.258 + Method* m = methods->at(nof_methods-1); 32.259 + if (m->has_itable_index()) { 32.260 + int length = m->itable_index() + 1; 32.261 +#ifdef ASSERT 32.262 + while (nof_methods = 0) { 32.263 + m = methods->at(--nof_methods); 32.264 + assert(!m->has_itable_index() || m->itable_index() < length, ""); 32.265 + } 32.266 +#endif //ASSERT 32.267 + return length; // return the rightmost itable index, plus one 32.268 + } 32.269 + nof_methods -= 1; 32.270 + } 32.271 + // no methods have itable indexes 32.272 + return 0; 32.273 +} 32.274 + 32.275 + 32.276 void klassItable::initialize_itable_for_interface(int method_table_offset, KlassHandle interf_h, bool checkconstraints, TRAPS) { 32.277 Array<Method*>* methods = InstanceKlass::cast(interf_h())->methods(); 32.278 int nof_methods = methods->length(); 32.279 HandleMark hm; 32.280 - KlassHandle klass = _klass; 32.281 assert(nof_methods > 0, "at least one method must exist for interface to be in vtable"); 32.282 Handle interface_loader (THREAD, InstanceKlass::cast(interf_h())->class_loader()); 32.283 - int ime_num = 0; 32.284 32.285 - // Skip first Method* if it is a class initializer 32.286 - int i = methods->at(0)->is_static_initializer() ? 1 : 0; 32.287 - 32.288 - // m, method_name, method_signature, klass reset each loop so they 32.289 - // don't need preserving across check_signature_loaders call 32.290 - // methods needs a handle in case of gc from check_signature_loaders 32.291 - for(; i < nof_methods; i++) { 32.292 + int ime_count = method_count_for_interface(interf_h()); 32.293 + for (int i = 0; i < nof_methods; i++) { 32.294 Method* m = methods->at(i); 32.295 - Symbol* method_name = m->name(); 32.296 - Symbol* method_signature = m->signature(); 32.297 - 32.298 - // This is same code as in Linkresolver::lookup_instance_method_in_klasses 32.299 - Method* target = klass->uncached_lookup_method(method_name, method_signature); 32.300 - while (target != NULL && target->is_static()) { 32.301 - // continue with recursive lookup through the superclass 32.302 - Klass* super = target->method_holder()->super(); 32.303 - target = (super == NULL) ? (Method*)NULL : super->uncached_lookup_method(method_name, method_signature); 32.304 + methodHandle target; 32.305 + if (m->has_itable_index()) { 32.306 + LinkResolver::lookup_instance_method_in_klasses(target, _klass, m->name(), m->signature(), CHECK); 32.307 } 32.308 if (target == NULL || !target->is_public() || target->is_abstract()) { 32.309 // Entry do not resolve. Leave it empty 32.310 } else { 32.311 // Entry did resolve, check loader constraints before initializing 32.312 // if checkconstraints requested 32.313 - methodHandle target_h (THREAD, target); // preserve across gc 32.314 if (checkconstraints) { 32.315 Handle method_holder_loader (THREAD, target->method_holder()->class_loader()); 32.316 if (method_holder_loader() != interface_loader()) { 32.317 ResourceMark rm(THREAD); 32.318 Symbol* failed_type_symbol = 32.319 - SystemDictionary::check_signature_loaders(method_signature, 32.320 + SystemDictionary::check_signature_loaders(m->signature(), 32.321 method_holder_loader, 32.322 interface_loader, 32.323 true, CHECK); 32.324 @@ -803,9 +882,9 @@ 32.325 "and the class loader (instance of %s) for interface " 32.326 "%s have different Class objects for the type %s " 32.327 "used in the signature"; 32.328 - char* sig = target_h()->name_and_sig_as_C_string(); 32.329 + char* sig = target()->name_and_sig_as_C_string(); 32.330 const char* loader1 = SystemDictionary::loader_name(method_holder_loader()); 32.331 - char* current = klass->name()->as_C_string(); 32.332 + char* current = _klass->name()->as_C_string(); 32.333 const char* loader2 = SystemDictionary::loader_name(interface_loader()); 32.334 char* iface = InstanceKlass::cast(interf_h())->name()->as_C_string(); 32.335 char* failed_type_name = failed_type_symbol->as_C_string(); 32.336 @@ -821,10 +900,10 @@ 32.337 } 32.338 32.339 // ime may have moved during GC so recalculate address 32.340 - itableOffsetEntry::method_entry(_klass(), method_table_offset)[ime_num].initialize(target_h()); 32.341 + int ime_num = m->itable_index(); 32.342 + assert(ime_num < ime_count, "oob"); 32.343 + itableOffsetEntry::method_entry(_klass(), method_table_offset)[ime_num].initialize(target()); 32.344 } 32.345 - // Progress to next entry 32.346 - ime_num++; 32.347 } 32.348 } 32.349 32.350 @@ -913,20 +992,22 @@ 32.351 virtual void doit(Klass* intf, int method_count) = 0; 32.352 }; 32.353 32.354 -// Visit all interfaces with at-least one method (excluding <clinit>) 32.355 +// Visit all interfaces with at least one itable method 32.356 void visit_all_interfaces(Array<Klass*>* transitive_intf, InterfaceVisiterClosure *blk) { 32.357 // Handle array argument 32.358 for(int i = 0; i < transitive_intf->length(); i++) { 32.359 Klass* intf = transitive_intf->at(i); 32.360 assert(intf->is_interface(), "sanity check"); 32.361 32.362 - // Find no. of methods excluding a <clinit> 32.363 - int method_count = InstanceKlass::cast(intf)->methods()->length(); 32.364 - if (method_count > 0) { 32.365 - Method* m = InstanceKlass::cast(intf)->methods()->at(0); 32.366 - assert(m != NULL && m->is_method(), "sanity check"); 32.367 - if (m->name() == vmSymbols::object_initializer_name()) { 32.368 - method_count--; 32.369 + // Find no. of itable methods 32.370 + int method_count = 0; 32.371 + // method_count = klassItable::method_count_for_interface(intf); 32.372 + Array<Method*>* methods = InstanceKlass::cast(intf)->methods(); 32.373 + if (methods->length() > 0) { 32.374 + for (int i = methods->length(); --i >= 0; ) { 32.375 + if (interface_method_needs_itable_index(methods->at(i))) { 32.376 + method_count++; 32.377 + } 32.378 } 32.379 } 32.380 32.381 @@ -1024,40 +1105,26 @@ 32.382 } 32.383 32.384 32.385 -// m must be a method in an interface 32.386 -int klassItable::compute_itable_index(Method* m) { 32.387 - InstanceKlass* intf = m->method_holder(); 32.388 - assert(intf->is_interface(), "sanity check"); 32.389 - Array<Method*>* methods = intf->methods(); 32.390 - int index = 0; 32.391 - while(methods->at(index) != m) { 32.392 - index++; 32.393 - assert(index < methods->length(), "should find index for resolve_invoke"); 32.394 - } 32.395 - // Adjust for <clinit>, which is left out of table if first method 32.396 - if (methods->length() > 0 && methods->at(0)->is_static_initializer()) { 32.397 - index--; 32.398 - } 32.399 - return index; 32.400 -} 32.401 - 32.402 - 32.403 -// inverse to compute_itable_index 32.404 +// inverse to itable_index 32.405 Method* klassItable::method_for_itable_index(Klass* intf, int itable_index) { 32.406 assert(InstanceKlass::cast(intf)->is_interface(), "sanity check"); 32.407 + assert(intf->verify_itable_index(itable_index), ""); 32.408 Array<Method*>* methods = InstanceKlass::cast(intf)->methods(); 32.409 32.410 - int index = itable_index; 32.411 - // Adjust for <clinit>, which is left out of table if first method 32.412 - if (methods->length() > 0 && methods->at(0)->is_static_initializer()) { 32.413 - index++; 32.414 - } 32.415 - 32.416 - if (itable_index < 0 || index >= methods->length()) 32.417 + if (itable_index < 0 || itable_index >= method_count_for_interface(intf)) 32.418 return NULL; // help caller defend against bad indexes 32.419 32.420 + int index = itable_index; 32.421 Method* m = methods->at(index); 32.422 - assert(compute_itable_index(m) == itable_index, "correct inverse"); 32.423 + int index2 = -1; 32.424 + while (!m->has_itable_index() || 32.425 + (index2 = m->itable_index()) != itable_index) { 32.426 + assert(index2 < itable_index, "monotonic"); 32.427 + if (++index == methods->length()) 32.428 + return NULL; 32.429 + m = methods->at(index); 32.430 + } 32.431 + assert(m->itable_index() == itable_index, "correct inverse"); 32.432 32.433 return m; 32.434 }
33.1 --- a/src/share/vm/oops/klassVtable.hpp Thu Sep 19 09:34:20 2013 +0200 33.2 +++ b/src/share/vm/oops/klassVtable.hpp Thu Sep 19 18:01:39 2013 +0200 33.3 @@ -124,7 +124,7 @@ 33.4 33.5 // support for miranda methods 33.6 bool is_miranda_entry_at(int i); 33.7 - void fill_in_mirandas(int* initialized); 33.8 + int fill_in_mirandas(int initialized); 33.9 static bool is_miranda(Method* m, Array<Method*>* class_methods, Klass* super); 33.10 static void add_new_mirandas_to_lists( 33.11 GrowableArray<Method*>* new_mirandas, 33.12 @@ -150,6 +150,8 @@ 33.13 // from_compiled_code_entry_point -> nmethod entry point 33.14 // from_interpreter_entry_point -> i2cadapter 33.15 class vtableEntry VALUE_OBJ_CLASS_SPEC { 33.16 + friend class VMStructs; 33.17 + 33.18 public: 33.19 // size in words 33.20 static int size() { 33.21 @@ -288,12 +290,12 @@ 33.22 #endif // INCLUDE_JVMTI 33.23 33.24 // Setup of itable 33.25 + static int assign_itable_indexes_for_interface(Klass* klass); 33.26 + static int method_count_for_interface(Klass* klass); 33.27 static int compute_itable_size(Array<Klass*>* transitive_interfaces); 33.28 static void setup_itable_offset_table(instanceKlassHandle klass); 33.29 33.30 // Resolving of method to index 33.31 - static int compute_itable_index(Method* m); 33.32 - // ...and back again: 33.33 static Method* method_for_itable_index(Klass* klass, int itable_index); 33.34 33.35 // Debugging/Statistics
34.1 --- a/src/share/vm/oops/method.cpp Thu Sep 19 09:34:20 2013 +0200 34.2 +++ b/src/share/vm/oops/method.cpp Thu Sep 19 18:01:39 2013 +0200 34.3 @@ -509,24 +509,31 @@ 34.4 return _access_flags.has_loops(); 34.5 } 34.6 34.7 +bool Method::is_final_method(AccessFlags class_access_flags) const { 34.8 + // or "does_not_require_vtable_entry" 34.9 + // overpass can occur, is not final (reuses vtable entry) 34.10 + // private methods get vtable entries for backward class compatibility. 34.11 + if (is_overpass()) return false; 34.12 + return is_final() || class_access_flags.is_final(); 34.13 +} 34.14 34.15 bool Method::is_final_method() const { 34.16 - // %%% Should return true for private methods also, 34.17 - // since there is no way to override them. 34.18 - return is_final() || method_holder()->is_final(); 34.19 + return is_final_method(method_holder()->access_flags()); 34.20 } 34.21 34.22 - 34.23 -bool Method::is_strict_method() const { 34.24 - return is_strict(); 34.25 -} 34.26 - 34.27 - 34.28 -bool Method::can_be_statically_bound() const { 34.29 - if (is_final_method()) return true; 34.30 +bool Method::can_be_statically_bound(AccessFlags class_access_flags) const { 34.31 + if (is_final_method(class_access_flags)) return true; 34.32 +#ifdef ASSERT 34.33 + bool is_nonv = (vtable_index() == nonvirtual_vtable_index); 34.34 + if (class_access_flags.is_interface()) assert(is_nonv == is_static(), err_msg("is_nonv=%s", is_nonv)); 34.35 +#endif 34.36 + assert(valid_vtable_index() || valid_itable_index(), "method must be linked before we ask this question"); 34.37 return vtable_index() == nonvirtual_vtable_index; 34.38 } 34.39 34.40 +bool Method::can_be_statically_bound() const { 34.41 + return can_be_statically_bound(method_holder()->access_flags()); 34.42 +} 34.43 34.44 bool Method::is_accessor() const { 34.45 if (code_size() != 5) return false; 34.46 @@ -967,7 +974,7 @@ 34.47 34.48 assert(ik->is_subclass_of(method_holder()), "should be subklass"); 34.49 assert(ik->vtable() != NULL, "vtable should exist"); 34.50 - if (vtable_index() == nonvirtual_vtable_index) { 34.51 + if (!has_vtable_index()) { 34.52 return false; 34.53 } else { 34.54 Method* vt_m = ik->method_at_vtable(vtable_index()); 34.55 @@ -1959,7 +1966,7 @@ 34.56 34.57 void Method::print_value_on(outputStream* st) const { 34.58 assert(is_method(), "must be method"); 34.59 - st->print_cr(internal_name()); 34.60 + st->print(internal_name()); 34.61 print_address_on(st); 34.62 st->print(" "); 34.63 name()->print_value_on(st); 34.64 @@ -1967,6 +1974,7 @@ 34.65 signature()->print_value_on(st); 34.66 st->print(" in "); 34.67 method_holder()->print_value_on(st); 34.68 + if (WizardMode) st->print("#%d", _vtable_index); 34.69 if (WizardMode) st->print("[%d,%d]", size_of_parameters(), max_locals()); 34.70 if (WizardMode && code() != NULL) st->print(" ((nmethod*)%p)", code()); 34.71 }
35.1 --- a/src/share/vm/oops/method.hpp Thu Sep 19 09:34:20 2013 +0200 35.2 +++ b/src/share/vm/oops/method.hpp Thu Sep 19 18:01:39 2013 +0200 35.3 @@ -448,16 +448,22 @@ 35.4 enum VtableIndexFlag { 35.5 // Valid vtable indexes are non-negative (>= 0). 35.6 // These few negative values are used as sentinels. 35.7 - highest_unused_vtable_index_value = -5, 35.8 + itable_index_max = -10, // first itable index, growing downward 35.9 + pending_itable_index = -9, // itable index will be assigned 35.10 invalid_vtable_index = -4, // distinct from any valid vtable index 35.11 garbage_vtable_index = -3, // not yet linked; no vtable layout yet 35.12 nonvirtual_vtable_index = -2 // there is no need for vtable dispatch 35.13 // 6330203 Note: Do not use -1, which was overloaded with many meanings. 35.14 }; 35.15 DEBUG_ONLY(bool valid_vtable_index() const { return _vtable_index >= nonvirtual_vtable_index; }) 35.16 - int vtable_index() const { assert(valid_vtable_index(), ""); 35.17 - return _vtable_index; } 35.18 + bool has_vtable_index() const { return _vtable_index >= 0; } 35.19 + int vtable_index() const { return _vtable_index; } 35.20 void set_vtable_index(int index) { _vtable_index = index; } 35.21 + DEBUG_ONLY(bool valid_itable_index() const { return _vtable_index <= pending_itable_index; }) 35.22 + bool has_itable_index() const { return _vtable_index <= itable_index_max; } 35.23 + int itable_index() const { assert(valid_itable_index(), ""); 35.24 + return itable_index_max - _vtable_index; } 35.25 + void set_itable_index(int index) { _vtable_index = itable_index_max - index; assert(valid_itable_index(), ""); } 35.26 35.27 // interpreter entry 35.28 address interpreter_entry() const { return _i2i_entry; } 35.29 @@ -560,10 +566,11 @@ 35.30 35.31 // checks method and its method holder 35.32 bool is_final_method() const; 35.33 - bool is_strict_method() const; 35.34 + bool is_final_method(AccessFlags class_access_flags) const; 35.35 35.36 // true if method needs no dynamic dispatch (final and/or no vtable entry) 35.37 bool can_be_statically_bound() const; 35.38 + bool can_be_statically_bound(AccessFlags class_access_flags) const; 35.39 35.40 // returns true if the method has any backward branches. 35.41 bool has_loops() { 35.42 @@ -740,10 +747,6 @@ 35.43 // so handles are not used to avoid deadlock. 35.44 jmethodID find_jmethod_id_or_null() { return method_holder()->jmethod_id_or_null(this); } 35.45 35.46 - // JNI static invoke cached itable index accessors 35.47 - int cached_itable_index() { return method_holder()->cached_itable_index(method_idnum()); } 35.48 - void set_cached_itable_index(int index) { method_holder()->set_cached_itable_index(method_idnum(), index); } 35.49 - 35.50 // Support for inlining of intrinsic methods 35.51 vmIntrinsics::ID intrinsic_id() const { return (vmIntrinsics::ID) _intrinsic_id; } 35.52 void set_intrinsic_id(vmIntrinsics::ID id) { _intrinsic_id = (u1) id; }
36.1 --- a/src/share/vm/oops/methodData.hpp Thu Sep 19 09:34:20 2013 +0200 36.2 +++ b/src/share/vm/oops/methodData.hpp Thu Sep 19 18:01:39 2013 +0200 36.3 @@ -72,6 +72,8 @@ 36.4 // 36.5 // Overlay for generic profiling data. 36.6 class DataLayout VALUE_OBJ_CLASS_SPEC { 36.7 + friend class VMStructs; 36.8 + 36.9 private: 36.10 // Every data layout begins with a header. This header 36.11 // contains a tag, which is used to indicate the size/layout
37.1 --- a/src/share/vm/oops/symbol.hpp Thu Sep 19 09:34:20 2013 +0200 37.2 +++ b/src/share/vm/oops/symbol.hpp Thu Sep 19 18:01:39 2013 +0200 37.3 @@ -45,7 +45,7 @@ 37.4 // in the SymbolTable bucket (the _literal field in HashtableEntry) 37.5 // that points to the Symbol. All other stores of a Symbol* 37.6 // to a field of a persistent variable (e.g., the _name filed in 37.7 -// FieldAccessInfo or _ptr in a CPSlot) is reference counted. 37.8 +// fieldDescriptor or _ptr in a CPSlot) is reference counted. 37.9 // 37.10 // 1) The lookup of a "name" in the SymbolTable either creates a Symbol F for 37.11 // "name" and returns a pointer to F or finds a pre-existing Symbol F for
38.1 --- a/src/share/vm/opto/chaitin.cpp Thu Sep 19 09:34:20 2013 +0200 38.2 +++ b/src/share/vm/opto/chaitin.cpp Thu Sep 19 18:01:39 2013 +0200 38.3 @@ -122,40 +122,23 @@ 38.4 return score; 38.5 } 38.6 38.7 -LRG_List::LRG_List( uint max ) : _cnt(max), _max(max), _lidxs(NEW_RESOURCE_ARRAY(uint,max)) { 38.8 - memset( _lidxs, 0, sizeof(uint)*max ); 38.9 -} 38.10 - 38.11 -void LRG_List::extend( uint nidx, uint lidx ) { 38.12 - _nesting.check(); 38.13 - if( nidx >= _max ) { 38.14 - uint size = 16; 38.15 - while( size <= nidx ) size <<=1; 38.16 - _lidxs = REALLOC_RESOURCE_ARRAY( uint, _lidxs, _max, size ); 38.17 - _max = size; 38.18 - } 38.19 - while( _cnt <= nidx ) 38.20 - _lidxs[_cnt++] = 0; 38.21 - _lidxs[nidx] = lidx; 38.22 -} 38.23 - 38.24 #define NUMBUCKS 3 38.25 38.26 // Straight out of Tarjan's union-find algorithm 38.27 uint LiveRangeMap::find_compress(uint lrg) { 38.28 uint cur = lrg; 38.29 - uint next = _uf_map[cur]; 38.30 + uint next = _uf_map.at(cur); 38.31 while (next != cur) { // Scan chain of equivalences 38.32 assert( next < cur, "always union smaller"); 38.33 cur = next; // until find a fixed-point 38.34 - next = _uf_map[cur]; 38.35 + next = _uf_map.at(cur); 38.36 } 38.37 38.38 // Core of union-find algorithm: update chain of 38.39 // equivalences to be equal to the root. 38.40 while (lrg != next) { 38.41 - uint tmp = _uf_map[lrg]; 38.42 - _uf_map.map(lrg, next); 38.43 + uint tmp = _uf_map.at(lrg); 38.44 + _uf_map.at_put(lrg, next); 38.45 lrg = tmp; 38.46 } 38.47 return lrg; 38.48 @@ -165,10 +148,10 @@ 38.49 void LiveRangeMap::reset_uf_map(uint max_lrg_id) { 38.50 _max_lrg_id= max_lrg_id; 38.51 // Force the Union-Find mapping to be at least this large 38.52 - _uf_map.extend(_max_lrg_id, 0); 38.53 + _uf_map.at_put_grow(_max_lrg_id, 0); 38.54 // Initialize it to be the ID mapping. 38.55 for (uint i = 0; i < _max_lrg_id; ++i) { 38.56 - _uf_map.map(i, i); 38.57 + _uf_map.at_put(i, i); 38.58 } 38.59 } 38.60 38.61 @@ -176,12 +159,12 @@ 38.62 // the Union-Find mapping after this call. 38.63 void LiveRangeMap::compress_uf_map_for_nodes() { 38.64 // For all Nodes, compress mapping 38.65 - uint unique = _names.Size(); 38.66 + uint unique = _names.length(); 38.67 for (uint i = 0; i < unique; ++i) { 38.68 - uint lrg = _names[i]; 38.69 + uint lrg = _names.at(i); 38.70 uint compressed_lrg = find(lrg); 38.71 if (lrg != compressed_lrg) { 38.72 - _names.map(i, compressed_lrg); 38.73 + _names.at_put(i, compressed_lrg); 38.74 } 38.75 } 38.76 } 38.77 @@ -198,11 +181,11 @@ 38.78 return lrg; 38.79 } 38.80 38.81 - uint next = _uf_map[lrg]; 38.82 + uint next = _uf_map.at(lrg); 38.83 while (next != lrg) { // Scan chain of equivalences 38.84 assert(next < lrg, "always union smaller"); 38.85 lrg = next; // until find a fixed-point 38.86 - next = _uf_map[lrg]; 38.87 + next = _uf_map.at(lrg); 38.88 } 38.89 return next; 38.90 } 38.91 @@ -215,7 +198,7 @@ 38.92 NULL 38.93 #endif 38.94 ) 38.95 - , _lrg_map(unique) 38.96 + , _lrg_map(Thread::current()->resource_area(), unique) 38.97 , _live(0) 38.98 , _spilled_once(Thread::current()->resource_area()) 38.99 , _spilled_twice(Thread::current()->resource_area()) 38.100 @@ -692,6 +675,7 @@ 38.101 _lrg_map.map(n->_idx, rm.is_NotEmpty() ? lr_counter++ : 0); 38.102 } 38.103 } 38.104 + 38.105 // Reset the Union-Find mapping to be identity 38.106 _lrg_map.reset_uf_map(lr_counter); 38.107 }
39.1 --- a/src/share/vm/opto/chaitin.hpp Thu Sep 19 09:34:20 2013 +0200 39.2 +++ b/src/share/vm/opto/chaitin.hpp Thu Sep 19 18:01:39 2013 +0200 39.3 @@ -283,8 +283,8 @@ 39.4 39.5 // Straight out of Tarjan's union-find algorithm 39.6 uint find_compress(const Node *node) { 39.7 - uint lrg_id = find_compress(_names[node->_idx]); 39.8 - _names.map(node->_idx, lrg_id); 39.9 + uint lrg_id = find_compress(_names.at(node->_idx)); 39.10 + _names.at_put(node->_idx, lrg_id); 39.11 return lrg_id; 39.12 } 39.13 39.14 @@ -305,40 +305,40 @@ 39.15 } 39.16 39.17 uint size() const { 39.18 - return _names.Size(); 39.19 + return _names.length(); 39.20 } 39.21 39.22 uint live_range_id(uint idx) const { 39.23 - return _names[idx]; 39.24 + return _names.at(idx); 39.25 } 39.26 39.27 uint live_range_id(const Node *node) const { 39.28 - return _names[node->_idx]; 39.29 + return _names.at(node->_idx); 39.30 } 39.31 39.32 uint uf_live_range_id(uint lrg_id) const { 39.33 - return _uf_map[lrg_id]; 39.34 + return _uf_map.at(lrg_id); 39.35 } 39.36 39.37 void map(uint idx, uint lrg_id) { 39.38 - _names.map(idx, lrg_id); 39.39 + _names.at_put(idx, lrg_id); 39.40 } 39.41 39.42 void uf_map(uint dst_lrg_id, uint src_lrg_id) { 39.43 - _uf_map.map(dst_lrg_id, src_lrg_id); 39.44 + _uf_map.at_put(dst_lrg_id, src_lrg_id); 39.45 } 39.46 39.47 void extend(uint idx, uint lrg_id) { 39.48 - _names.extend(idx, lrg_id); 39.49 + _names.at_put_grow(idx, lrg_id); 39.50 } 39.51 39.52 void uf_extend(uint dst_lrg_id, uint src_lrg_id) { 39.53 - _uf_map.extend(dst_lrg_id, src_lrg_id); 39.54 + _uf_map.at_put_grow(dst_lrg_id, src_lrg_id); 39.55 } 39.56 39.57 - LiveRangeMap(uint unique) 39.58 - : _names(unique) 39.59 - , _uf_map(unique) 39.60 + LiveRangeMap(Arena* arena, uint unique) 39.61 + : _names(arena, unique, unique, 0) 39.62 + , _uf_map(arena, unique, unique, 0) 39.63 , _max_lrg_id(0) {} 39.64 39.65 uint find_id( const Node *n ) { 39.66 @@ -355,14 +355,14 @@ 39.67 void compress_uf_map_for_nodes(); 39.68 39.69 uint find(uint lidx) { 39.70 - uint uf_lidx = _uf_map[lidx]; 39.71 + uint uf_lidx = _uf_map.at(lidx); 39.72 return (uf_lidx == lidx) ? uf_lidx : find_compress(lidx); 39.73 } 39.74 39.75 // Convert a Node into a Live Range Index - a lidx 39.76 uint find(const Node *node) { 39.77 uint lidx = live_range_id(node); 39.78 - uint uf_lidx = _uf_map[lidx]; 39.79 + uint uf_lidx = _uf_map.at(lidx); 39.80 return (uf_lidx == lidx) ? uf_lidx : find_compress(node); 39.81 } 39.82 39.83 @@ -371,10 +371,10 @@ 39.84 39.85 // Like Find above, but no path compress, so bad asymptotic behavior 39.86 uint find_const(const Node *node) const { 39.87 - if(node->_idx >= _names.Size()) { 39.88 + if(node->_idx >= (uint)_names.length()) { 39.89 return 0; // not mapped, usual for debug dump 39.90 } 39.91 - return find_const(_names[node->_idx]); 39.92 + return find_const(_names.at(node->_idx)); 39.93 } 39.94 }; 39.95
40.1 --- a/src/share/vm/opto/coalesce.hpp Thu Sep 19 09:34:20 2013 +0200 40.2 +++ b/src/share/vm/opto/coalesce.hpp Thu Sep 19 18:01:39 2013 +0200 40.3 @@ -29,7 +29,6 @@ 40.4 40.5 class LoopTree; 40.6 class LRG; 40.7 -class LRG_List; 40.8 class Matcher; 40.9 class PhaseIFG; 40.10 class PhaseCFG;
41.1 --- a/src/share/vm/opto/library_call.cpp Thu Sep 19 09:34:20 2013 +0200 41.2 +++ b/src/share/vm/opto/library_call.cpp Thu Sep 19 18:01:39 2013 +0200 41.3 @@ -3734,6 +3734,8 @@ 41.4 RegionNode* slow_region) { 41.5 ciMethod* method = callee(); 41.6 int vtable_index = method->vtable_index(); 41.7 + assert(vtable_index >= 0 || vtable_index == Method::nonvirtual_vtable_index, 41.8 + err_msg_res("bad index %d", vtable_index)); 41.9 // Get the Method* out of the appropriate vtable entry. 41.10 int entry_offset = (InstanceKlass::vtable_start_offset() + 41.11 vtable_index*vtableEntry::size()) * wordSize + 41.12 @@ -3784,6 +3786,8 @@ 41.13 // so the vtable index is fixed. 41.14 // No need to use the linkResolver to get it. 41.15 vtable_index = method->vtable_index(); 41.16 + assert(vtable_index >= 0 || vtable_index == Method::nonvirtual_vtable_index, 41.17 + err_msg_res("bad index %d", vtable_index)); 41.18 } 41.19 slow_call = new(C) CallDynamicJavaNode(tf, 41.20 SharedRuntime::get_resolve_virtual_call_stub(),
42.1 --- a/src/share/vm/opto/live.cpp Thu Sep 19 09:34:20 2013 +0200 42.2 +++ b/src/share/vm/opto/live.cpp Thu Sep 19 18:01:39 2013 +0200 42.3 @@ -91,7 +91,7 @@ 42.4 break; 42.5 } 42.6 42.7 - uint r = _names[n->_idx]; 42.8 + uint r = _names.at(n->_idx); 42.9 assert(!def_outside->member(r), "Use of external LRG overlaps the same LRG defined in this block"); 42.10 def->insert( r ); 42.11 use->remove( r ); 42.12 @@ -100,7 +100,7 @@ 42.13 Node *nk = n->in(k); 42.14 uint nkidx = nk->_idx; 42.15 if (_cfg.get_block_for_node(nk) != block) { 42.16 - uint u = _names[nkidx]; 42.17 + uint u = _names.at(nkidx); 42.18 use->insert(u); 42.19 DEBUG_ONLY(def_outside->insert(u);) 42.20 } 42.21 @@ -112,7 +112,7 @@ 42.22 #endif 42.23 // Remove anything defined by Phis and the block start instruction 42.24 for (uint k = i; k > 0; k--) { 42.25 - uint r = _names[block->get_node(k - 1)->_idx]; 42.26 + uint r = _names.at(block->get_node(k - 1)->_idx); 42.27 def->insert(r); 42.28 use->remove(r); 42.29 } 42.30 @@ -124,7 +124,7 @@ 42.31 42.32 // PhiNode uses go in the live-out set of prior blocks. 42.33 for (uint k = i; k > 0; k--) { 42.34 - add_liveout(p, _names[block->get_node(k-1)->in(l)->_idx], first_pass); 42.35 + add_liveout(p, _names.at(block->get_node(k-1)->in(l)->_idx), first_pass); 42.36 } 42.37 } 42.38 freeset(block); 42.39 @@ -256,7 +256,7 @@ 42.40 tty->print("LiveOut: "); _live[b->_pre_order-1].dump(); 42.41 uint cnt = b->number_of_nodes(); 42.42 for( uint i=0; i<cnt; i++ ) { 42.43 - tty->print("L%d/", _names[b->get_node(i)->_idx] ); 42.44 + tty->print("L%d/", _names.at(b->get_node(i)->_idx)); 42.45 b->get_node(i)->dump(); 42.46 } 42.47 tty->print("\n");
43.1 --- a/src/share/vm/opto/live.hpp Thu Sep 19 09:34:20 2013 +0200 43.2 +++ b/src/share/vm/opto/live.hpp Thu Sep 19 18:01:39 2013 +0200 43.3 @@ -40,27 +40,7 @@ 43.4 //------------------------------LRG_List--------------------------------------- 43.5 // Map Node indices to Live RanGe indices. 43.6 // Array lookup in the optimized case. 43.7 -class LRG_List : public ResourceObj { 43.8 - friend class VMStructs; 43.9 - uint _cnt, _max; 43.10 - uint* _lidxs; 43.11 - ReallocMark _nesting; // assertion check for reallocations 43.12 -public: 43.13 - LRG_List( uint max ); 43.14 - 43.15 - uint lookup( uint nidx ) const { 43.16 - return _lidxs[nidx]; 43.17 - } 43.18 - uint operator[] (uint nidx) const { return lookup(nidx); } 43.19 - 43.20 - void map( uint nidx, uint lidx ) { 43.21 - assert( nidx < _cnt, "oob" ); 43.22 - _lidxs[nidx] = lidx; 43.23 - } 43.24 - void extend( uint nidx, uint lidx ); 43.25 - 43.26 - uint Size() const { return _cnt; } 43.27 -}; 43.28 +typedef GrowableArray<uint> LRG_List; 43.29 43.30 //------------------------------PhaseLive-------------------------------------- 43.31 // Compute live-in/live-out
44.1 --- a/src/share/vm/prims/jni.cpp Thu Sep 19 09:34:20 2013 +0200 44.2 +++ b/src/share/vm/prims/jni.cpp Thu Sep 19 18:01:39 2013 +0200 44.3 @@ -1336,6 +1336,7 @@ 44.4 if (call_type == JNI_VIRTUAL) { 44.5 // jni_GetMethodID makes sure class is linked and initialized 44.6 // so m should have a valid vtable index. 44.7 + assert(!m->has_itable_index(), ""); 44.8 int vtbl_index = m->vtable_index(); 44.9 if (vtbl_index != Method::nonvirtual_vtable_index) { 44.10 Klass* k = h_recv->klass(); 44.11 @@ -1355,12 +1356,7 @@ 44.12 // interface call 44.13 KlassHandle h_holder(THREAD, holder); 44.14 44.15 - int itbl_index = m->cached_itable_index(); 44.16 - if (itbl_index == -1) { 44.17 - itbl_index = klassItable::compute_itable_index(m); 44.18 - m->set_cached_itable_index(itbl_index); 44.19 - // the above may have grabbed a lock, 'm' and anything non-handlized can't be used again 44.20 - } 44.21 + int itbl_index = m->itable_index(); 44.22 Klass* k = h_recv->klass(); 44.23 selected_method = InstanceKlass::cast(k)->method_at_itable(h_holder(), itbl_index, CHECK); 44.24 }
45.1 --- a/src/share/vm/prims/jvm.cpp Thu Sep 19 09:34:20 2013 +0200 45.2 +++ b/src/share/vm/prims/jvm.cpp Thu Sep 19 18:01:39 2013 +0200 45.3 @@ -1824,7 +1824,7 @@ 45.4 } 45.5 45.6 if (!publicOnly || fs.access_flags().is_public()) { 45.7 - fd.initialize(k(), fs.index()); 45.8 + fd.reinitialize(k(), fs.index()); 45.9 oop field = Reflection::new_field(&fd, UseNewReflection, CHECK_NULL); 45.10 result->obj_at_put(out_idx, field); 45.11 ++out_idx;
46.1 --- a/src/share/vm/prims/jvmtiRedefineClasses.cpp Thu Sep 19 09:34:20 2013 +0200 46.2 +++ b/src/share/vm/prims/jvmtiRedefineClasses.cpp Thu Sep 19 18:01:39 2013 +0200 46.3 @@ -2958,7 +2958,7 @@ 46.4 for (int i = 0; i < _deleted_methods_length; ++i) { 46.5 Method* old_method = _deleted_methods[i]; 46.6 46.7 - assert(old_method->vtable_index() < 0, 46.8 + assert(!old_method->has_vtable_index(), 46.9 "cannot delete methods with vtable entries");; 46.10 46.11 // Mark all deleted methods as old and obsolete
47.1 --- a/src/share/vm/prims/methodHandles.cpp Thu Sep 19 09:34:20 2013 +0200 47.2 +++ b/src/share/vm/prims/methodHandles.cpp Thu Sep 19 18:01:39 2013 +0200 47.3 @@ -127,25 +127,37 @@ 47.4 } 47.5 47.6 oop MethodHandles::init_MemberName(Handle mname, Handle target) { 47.7 + // This method is used from java.lang.invoke.MemberName constructors. 47.8 + // It fills in the new MemberName from a java.lang.reflect.Member. 47.9 Thread* thread = Thread::current(); 47.10 oop target_oop = target(); 47.11 Klass* target_klass = target_oop->klass(); 47.12 if (target_klass == SystemDictionary::reflect_Field_klass()) { 47.13 oop clazz = java_lang_reflect_Field::clazz(target_oop); // fd.field_holder() 47.14 int slot = java_lang_reflect_Field::slot(target_oop); // fd.index() 47.15 - int mods = java_lang_reflect_Field::modifiers(target_oop); 47.16 - oop type = java_lang_reflect_Field::type(target_oop); 47.17 - oop name = java_lang_reflect_Field::name(target_oop); 47.18 KlassHandle k(thread, java_lang_Class::as_Klass(clazz)); 47.19 - intptr_t offset = InstanceKlass::cast(k())->field_offset(slot); 47.20 - return init_field_MemberName(mname, k, accessFlags_from(mods), type, name, offset); 47.21 + if (!k.is_null() && k->oop_is_instance()) { 47.22 + fieldDescriptor fd(InstanceKlass::cast(k()), slot); 47.23 + oop mname2 = init_field_MemberName(mname, fd); 47.24 + if (mname2 != NULL) { 47.25 + // Since we have the reified name and type handy, add them to the result. 47.26 + if (java_lang_invoke_MemberName::name(mname2) == NULL) 47.27 + java_lang_invoke_MemberName::set_name(mname2, java_lang_reflect_Field::name(target_oop)); 47.28 + if (java_lang_invoke_MemberName::type(mname2) == NULL) 47.29 + java_lang_invoke_MemberName::set_type(mname2, java_lang_reflect_Field::type(target_oop)); 47.30 + } 47.31 + return mname2; 47.32 + } 47.33 } else if (target_klass == SystemDictionary::reflect_Method_klass()) { 47.34 oop clazz = java_lang_reflect_Method::clazz(target_oop); 47.35 int slot = java_lang_reflect_Method::slot(target_oop); 47.36 KlassHandle k(thread, java_lang_Class::as_Klass(clazz)); 47.37 if (!k.is_null() && k->oop_is_instance()) { 47.38 Method* m = InstanceKlass::cast(k())->method_with_idnum(slot); 47.39 - return init_method_MemberName(mname, m, true, k); 47.40 + if (m == NULL || is_signature_polymorphic(m->intrinsic_id())) 47.41 + return NULL; // do not resolve unless there is a concrete signature 47.42 + CallInfo info(m, k()); 47.43 + return init_method_MemberName(mname, info); 47.44 } 47.45 } else if (target_klass == SystemDictionary::reflect_Constructor_klass()) { 47.46 oop clazz = java_lang_reflect_Constructor::clazz(target_oop); 47.47 @@ -153,65 +165,50 @@ 47.48 KlassHandle k(thread, java_lang_Class::as_Klass(clazz)); 47.49 if (!k.is_null() && k->oop_is_instance()) { 47.50 Method* m = InstanceKlass::cast(k())->method_with_idnum(slot); 47.51 - return init_method_MemberName(mname, m, false, k); 47.52 - } 47.53 - } else if (target_klass == SystemDictionary::MemberName_klass()) { 47.54 - // Note: This only works if the MemberName has already been resolved. 47.55 - oop clazz = java_lang_invoke_MemberName::clazz(target_oop); 47.56 - int flags = java_lang_invoke_MemberName::flags(target_oop); 47.57 - Metadata* vmtarget=java_lang_invoke_MemberName::vmtarget(target_oop); 47.58 - intptr_t vmindex = java_lang_invoke_MemberName::vmindex(target_oop); 47.59 - KlassHandle k(thread, java_lang_Class::as_Klass(clazz)); 47.60 - int ref_kind = (flags >> REFERENCE_KIND_SHIFT) & REFERENCE_KIND_MASK; 47.61 - if (vmtarget == NULL) return NULL; // not resolved 47.62 - if ((flags & IS_FIELD) != 0) { 47.63 - assert(vmtarget->is_klass(), "field vmtarget is Klass*"); 47.64 - int basic_mods = (ref_kind_is_static(ref_kind) ? JVM_ACC_STATIC : 0); 47.65 - // FIXME: how does k (receiver_limit) contribute? 47.66 - KlassHandle k_vmtarget(thread, (Klass*)vmtarget); 47.67 - return init_field_MemberName(mname, k_vmtarget, accessFlags_from(basic_mods), NULL, NULL, vmindex); 47.68 - } else if ((flags & (IS_METHOD | IS_CONSTRUCTOR)) != 0) { 47.69 - assert(vmtarget->is_method(), "method or constructor vmtarget is Method*"); 47.70 - return init_method_MemberName(mname, (Method*)vmtarget, ref_kind_does_dispatch(ref_kind), k); 47.71 - } else { 47.72 - return NULL; 47.73 + if (m == NULL) return NULL; 47.74 + CallInfo info(m, k()); 47.75 + return init_method_MemberName(mname, info); 47.76 } 47.77 } 47.78 return NULL; 47.79 } 47.80 47.81 -oop MethodHandles::init_method_MemberName(Handle mname, Method* m, bool do_dispatch, 47.82 - KlassHandle receiver_limit_h) { 47.83 - Klass* receiver_limit = receiver_limit_h(); 47.84 - AccessFlags mods = m->access_flags(); 47.85 - int flags = (jushort)( mods.as_short() & JVM_RECOGNIZED_METHOD_MODIFIERS ); 47.86 - int vmindex = Method::nonvirtual_vtable_index; // implies never any dispatch 47.87 - Klass* mklass = m->method_holder(); 47.88 - if (receiver_limit == NULL) 47.89 - receiver_limit = mklass; 47.90 - if (m->is_initializer()) { 47.91 - flags |= IS_CONSTRUCTOR | (JVM_REF_invokeSpecial << REFERENCE_KIND_SHIFT); 47.92 - } else if (mods.is_static()) { 47.93 - flags |= IS_METHOD | (JVM_REF_invokeStatic << REFERENCE_KIND_SHIFT); 47.94 - } else if (receiver_limit != mklass && 47.95 - !receiver_limit->is_subtype_of(mklass)) { 47.96 - return NULL; // bad receiver limit 47.97 - } else if (do_dispatch && receiver_limit->is_interface() && 47.98 - mklass->is_interface()) { 47.99 +oop MethodHandles::init_method_MemberName(Handle mname, CallInfo& info) { 47.100 + assert(info.resolved_appendix().is_null(), "only normal methods here"); 47.101 + KlassHandle receiver_limit = info.resolved_klass(); 47.102 + methodHandle m = info.resolved_method(); 47.103 + int flags = (jushort)( m->access_flags().as_short() & JVM_RECOGNIZED_METHOD_MODIFIERS ); 47.104 + int vmindex = Method::invalid_vtable_index; 47.105 + 47.106 + switch (info.call_kind()) { 47.107 + case CallInfo::itable_call: 47.108 + vmindex = info.itable_index(); 47.109 + // More importantly, the itable index only works with the method holder. 47.110 + receiver_limit = m->method_holder(); 47.111 + assert(receiver_limit->verify_itable_index(vmindex), ""); 47.112 flags |= IS_METHOD | (JVM_REF_invokeInterface << REFERENCE_KIND_SHIFT); 47.113 - receiver_limit = mklass; // ignore passed-in limit; interfaces are interconvertible 47.114 - vmindex = klassItable::compute_itable_index(m); 47.115 - } else if (do_dispatch && mklass != receiver_limit && mklass->is_interface()) { 47.116 + break; 47.117 + 47.118 + case CallInfo::vtable_call: 47.119 + vmindex = info.vtable_index(); 47.120 flags |= IS_METHOD | (JVM_REF_invokeVirtual << REFERENCE_KIND_SHIFT); 47.121 - // it is a miranda method, so m->vtable_index is not what we want 47.122 - ResourceMark rm; 47.123 - klassVtable* vt = InstanceKlass::cast(receiver_limit)->vtable(); 47.124 - vmindex = vt->index_of_miranda(m->name(), m->signature()); 47.125 - } else if (!do_dispatch || m->can_be_statically_bound()) { 47.126 - flags |= IS_METHOD | (JVM_REF_invokeSpecial << REFERENCE_KIND_SHIFT); 47.127 - } else { 47.128 - flags |= IS_METHOD | (JVM_REF_invokeVirtual << REFERENCE_KIND_SHIFT); 47.129 - vmindex = m->vtable_index(); 47.130 + assert(receiver_limit->is_subtype_of(m->method_holder()), "virtual call must be type-safe"); 47.131 + break; 47.132 + 47.133 + case CallInfo::direct_call: 47.134 + vmindex = Method::nonvirtual_vtable_index; 47.135 + if (m->is_static()) { 47.136 + flags |= IS_METHOD | (JVM_REF_invokeStatic << REFERENCE_KIND_SHIFT); 47.137 + } else if (m->is_initializer()) { 47.138 + flags |= IS_CONSTRUCTOR | (JVM_REF_invokeSpecial << REFERENCE_KIND_SHIFT); 47.139 + assert(receiver_limit == m->method_holder(), "constructor call must be exactly typed"); 47.140 + } else { 47.141 + flags |= IS_METHOD | (JVM_REF_invokeSpecial << REFERENCE_KIND_SHIFT); 47.142 + assert(receiver_limit->is_subtype_of(m->method_holder()), "special call must be type-safe"); 47.143 + } 47.144 + break; 47.145 + 47.146 + default: assert(false, "bad CallInfo"); return NULL; 47.147 } 47.148 47.149 // @CallerSensitive annotation detected 47.150 @@ -221,7 +218,7 @@ 47.151 47.152 oop mname_oop = mname(); 47.153 java_lang_invoke_MemberName::set_flags( mname_oop, flags); 47.154 - java_lang_invoke_MemberName::set_vmtarget(mname_oop, m); 47.155 + java_lang_invoke_MemberName::set_vmtarget(mname_oop, m()); 47.156 java_lang_invoke_MemberName::set_vmindex( mname_oop, vmindex); // vtable/itable index 47.157 java_lang_invoke_MemberName::set_clazz( mname_oop, receiver_limit->java_mirror()); 47.158 // Note: name and type can be lazily computed by resolve_MemberName, 47.159 @@ -237,59 +234,19 @@ 47.160 return mname(); 47.161 } 47.162 47.163 -Handle MethodHandles::init_method_MemberName(Handle mname, CallInfo& info, TRAPS) { 47.164 - Handle empty; 47.165 - if (info.resolved_appendix().not_null()) { 47.166 - // The resolved MemberName must not be accompanied by an appendix argument, 47.167 - // since there is no way to bind this value into the MemberName. 47.168 - // Caller is responsible to prevent this from happening. 47.169 - THROW_MSG_(vmSymbols::java_lang_InternalError(), "appendix", empty); 47.170 - } 47.171 - methodHandle m = info.resolved_method(); 47.172 - KlassHandle defc = info.resolved_klass(); 47.173 - int vmindex = Method::invalid_vtable_index; 47.174 - if (defc->is_interface() && m->method_holder()->is_interface()) { 47.175 - // static interface methods do not reference vtable or itable 47.176 - if (m->is_static()) { 47.177 - vmindex = Method::nonvirtual_vtable_index; 47.178 - } 47.179 - // interface methods invoked via invokespecial also 47.180 - // do not reference vtable or itable. 47.181 - int ref_kind = ((java_lang_invoke_MemberName::flags(mname()) >> 47.182 - REFERENCE_KIND_SHIFT) & REFERENCE_KIND_MASK); 47.183 - if (ref_kind == JVM_REF_invokeSpecial) { 47.184 - vmindex = Method::nonvirtual_vtable_index; 47.185 - } 47.186 - // If neither m is static nor ref_kind is invokespecial, 47.187 - // set it to itable index. 47.188 - if (vmindex == Method::invalid_vtable_index) { 47.189 - // LinkResolver does not report itable indexes! (fix this?) 47.190 - vmindex = klassItable::compute_itable_index(m()); 47.191 - } 47.192 - } else if (m->can_be_statically_bound()) { 47.193 - // LinkResolver reports vtable index even for final methods! 47.194 - vmindex = Method::nonvirtual_vtable_index; 47.195 - } else { 47.196 - vmindex = info.vtable_index(); 47.197 - } 47.198 - oop res = init_method_MemberName(mname, m(), (vmindex >= 0), defc()); 47.199 - assert(res == NULL || (java_lang_invoke_MemberName::vmindex(res) == vmindex), ""); 47.200 - return Handle(THREAD, res); 47.201 -} 47.202 - 47.203 -oop MethodHandles::init_field_MemberName(Handle mname, KlassHandle field_holder, 47.204 - AccessFlags mods, oop type, oop name, 47.205 - intptr_t offset, bool is_setter) { 47.206 - int flags = (jushort)( mods.as_short() & JVM_RECOGNIZED_FIELD_MODIFIERS ); 47.207 - flags |= IS_FIELD | ((mods.is_static() ? JVM_REF_getStatic : JVM_REF_getField) << REFERENCE_KIND_SHIFT); 47.208 +oop MethodHandles::init_field_MemberName(Handle mname, fieldDescriptor& fd, bool is_setter) { 47.209 + int flags = (jushort)( fd.access_flags().as_short() & JVM_RECOGNIZED_FIELD_MODIFIERS ); 47.210 + flags |= IS_FIELD | ((fd.is_static() ? JVM_REF_getStatic : JVM_REF_getField) << REFERENCE_KIND_SHIFT); 47.211 if (is_setter) flags += ((JVM_REF_putField - JVM_REF_getField) << REFERENCE_KIND_SHIFT); 47.212 - Metadata* vmtarget = field_holder(); 47.213 - int vmindex = offset; // determines the field uniquely when combined with static bit 47.214 + Metadata* vmtarget = fd.field_holder(); 47.215 + int vmindex = fd.offset(); // determines the field uniquely when combined with static bit 47.216 oop mname_oop = mname(); 47.217 java_lang_invoke_MemberName::set_flags(mname_oop, flags); 47.218 java_lang_invoke_MemberName::set_vmtarget(mname_oop, vmtarget); 47.219 java_lang_invoke_MemberName::set_vmindex(mname_oop, vmindex); 47.220 - java_lang_invoke_MemberName::set_clazz(mname_oop, field_holder->java_mirror()); 47.221 + java_lang_invoke_MemberName::set_clazz(mname_oop, fd.field_holder()->java_mirror()); 47.222 + oop type = field_signature_type_or_null(fd.signature()); 47.223 + oop name = field_name_or_null(fd.name()); 47.224 if (name != NULL) 47.225 java_lang_invoke_MemberName::set_name(mname_oop, name); 47.226 if (type != NULL) 47.227 @@ -305,19 +262,6 @@ 47.228 return mname(); 47.229 } 47.230 47.231 -Handle MethodHandles::init_field_MemberName(Handle mname, FieldAccessInfo& info, TRAPS) { 47.232 - return Handle(); 47.233 -#if 0 // FIXME 47.234 - KlassHandle field_holder = info.klass(); 47.235 - intptr_t field_offset = info.field_offset(); 47.236 - return init_field_MemberName(mname_oop, field_holder(), 47.237 - info.access_flags(), 47.238 - type, name, 47.239 - field_offset, false /*is_setter*/); 47.240 -#endif 47.241 -} 47.242 - 47.243 - 47.244 // JVM 2.9 Special Methods: 47.245 // A method is signature polymorphic if and only if all of the following conditions hold : 47.246 // * It is declared in the java.lang.invoke.MethodHandle class. 47.247 @@ -573,12 +517,12 @@ 47.248 return SystemDictionary::Object_klass()->java_mirror(); 47.249 } 47.250 47.251 -static oop field_name_or_null(Symbol* s) { 47.252 +oop MethodHandles::field_name_or_null(Symbol* s) { 47.253 if (s == NULL) return NULL; 47.254 return StringTable::lookup(s); 47.255 } 47.256 47.257 -static oop field_signature_type_or_null(Symbol* s) { 47.258 +oop MethodHandles::field_signature_type_or_null(Symbol* s) { 47.259 if (s == NULL) return NULL; 47.260 BasicType bt = FieldType::basic_type(s); 47.261 if (is_java_primitive(bt)) { 47.262 @@ -701,7 +645,14 @@ 47.263 return empty; 47.264 } 47.265 } 47.266 - return init_method_MemberName(mname, result, THREAD); 47.267 + if (result.resolved_appendix().not_null()) { 47.268 + // The resolved MemberName must not be accompanied by an appendix argument, 47.269 + // since there is no way to bind this value into the MemberName. 47.270 + // Caller is responsible to prevent this from happening. 47.271 + THROW_MSG_(vmSymbols::java_lang_InternalError(), "appendix", empty); 47.272 + } 47.273 + oop mname2 = init_method_MemberName(mname, result); 47.274 + return Handle(THREAD, mname2); 47.275 } 47.276 case IS_CONSTRUCTOR: 47.277 { 47.278 @@ -719,22 +670,21 @@ 47.279 } 47.280 } 47.281 assert(result.is_statically_bound(), ""); 47.282 - return init_method_MemberName(mname, result, THREAD); 47.283 + oop mname2 = init_method_MemberName(mname, result); 47.284 + return Handle(THREAD, mname2); 47.285 } 47.286 case IS_FIELD: 47.287 { 47.288 - // This is taken from LinkResolver::resolve_field, sans access checks. 47.289 - fieldDescriptor fd; // find_field initializes fd if found 47.290 - KlassHandle sel_klass(THREAD, InstanceKlass::cast(defc())->find_field(name, type, &fd)); 47.291 - // check if field exists; i.e., if a klass containing the field def has been selected 47.292 - if (sel_klass.is_null()) return empty; // should not happen 47.293 - oop type = field_signature_type_or_null(fd.signature()); 47.294 - oop name = field_name_or_null(fd.name()); 47.295 - bool is_setter = (ref_kind_is_valid(ref_kind) && ref_kind_is_setter(ref_kind)); 47.296 - mname = Handle(THREAD, 47.297 - init_field_MemberName(mname, sel_klass, 47.298 - fd.access_flags(), type, name, fd.offset(), is_setter)); 47.299 - return mname; 47.300 + fieldDescriptor result; // find_field initializes fd if found 47.301 + { 47.302 + assert(!HAS_PENDING_EXCEPTION, ""); 47.303 + LinkResolver::resolve_field(result, defc, name, type, KlassHandle(), Bytecodes::_nop, false, false, THREAD); 47.304 + if (HAS_PENDING_EXCEPTION) { 47.305 + return empty; 47.306 + } 47.307 + } 47.308 + oop mname2 = init_field_MemberName(mname, result, ref_kind_is_setter(ref_kind)); 47.309 + return Handle(THREAD, mname2); 47.310 } 47.311 default: 47.312 THROW_MSG_(vmSymbols::java_lang_InternalError(), "unrecognized MemberName format", empty); 47.313 @@ -793,7 +743,6 @@ 47.314 } 47.315 case IS_FIELD: 47.316 { 47.317 - // This is taken from LinkResolver::resolve_field, sans access checks. 47.318 assert(vmtarget->is_klass(), "field vmtarget is Klass*"); 47.319 if (!((Klass*) vmtarget)->oop_is_instance()) break; 47.320 instanceKlassHandle defc(THREAD, (Klass*) vmtarget); 47.321 @@ -872,11 +821,7 @@ 47.322 Handle result(thread, results->obj_at(rfill++)); 47.323 if (!java_lang_invoke_MemberName::is_instance(result())) 47.324 return -99; // caller bug! 47.325 - oop type = field_signature_type_or_null(st.signature()); 47.326 - oop name = field_name_or_null(st.name()); 47.327 - oop saved = MethodHandles::init_field_MemberName(result, st.klass(), 47.328 - st.access_flags(), type, name, 47.329 - st.offset()); 47.330 + oop saved = MethodHandles::init_field_MemberName(result, st.field_descriptor()); 47.331 if (saved != result()) 47.332 results->obj_at_put(rfill-1, saved); // show saved instance to user 47.333 } else if (++overflow >= overflow_limit) { 47.334 @@ -926,7 +871,8 @@ 47.335 Handle result(thread, results->obj_at(rfill++)); 47.336 if (!java_lang_invoke_MemberName::is_instance(result())) 47.337 return -99; // caller bug! 47.338 - oop saved = MethodHandles::init_method_MemberName(result, m, true, NULL); 47.339 + CallInfo info(m); 47.340 + oop saved = MethodHandles::init_method_MemberName(result, info); 47.341 if (saved != result()) 47.342 results->obj_at_put(rfill-1, saved); // show saved instance to user 47.343 } else if (++overflow >= overflow_limit) { 47.344 @@ -1227,7 +1173,8 @@ 47.345 x = ((Klass*) vmtarget)->java_mirror(); 47.346 } else if (vmtarget->is_method()) { 47.347 Handle mname2 = MethodHandles::new_MemberName(CHECK_NULL); 47.348 - x = MethodHandles::init_method_MemberName(mname2, (Method*)vmtarget, false, NULL); 47.349 + CallInfo info((Method*)vmtarget); 47.350 + x = MethodHandles::init_method_MemberName(mname2, info); 47.351 } 47.352 result->obj_at_put(1, x); 47.353 return JNIHandles::make_local(env, result());
48.1 --- a/src/share/vm/prims/methodHandles.hpp Thu Sep 19 09:34:20 2013 +0200 48.2 +++ b/src/share/vm/prims/methodHandles.hpp Thu Sep 19 18:01:39 2013 +0200 48.3 @@ -49,19 +49,18 @@ 48.4 // Adapters. 48.5 static MethodHandlesAdapterBlob* _adapter_code; 48.6 48.7 + // utility functions for reifying names and types 48.8 + static oop field_name_or_null(Symbol* s); 48.9 + static oop field_signature_type_or_null(Symbol* s); 48.10 + 48.11 public: 48.12 // working with member names 48.13 static Handle resolve_MemberName(Handle mname, TRAPS); // compute vmtarget/vmindex from name/type 48.14 static void expand_MemberName(Handle mname, int suppress, TRAPS); // expand defc/name/type if missing 48.15 static Handle new_MemberName(TRAPS); // must be followed by init_MemberName 48.16 static oop init_MemberName(Handle mname_h, Handle target_h); // compute vmtarget/vmindex from target 48.17 - static oop init_method_MemberName(Handle mname_h, Method* m, bool do_dispatch, 48.18 - KlassHandle receiver_limit_h); 48.19 - static oop init_field_MemberName(Handle mname_h, KlassHandle field_holder_h, 48.20 - AccessFlags mods, oop type, oop name, 48.21 - intptr_t offset, bool is_setter = false); 48.22 - static Handle init_method_MemberName(Handle mname_h, CallInfo& info, TRAPS); 48.23 - static Handle init_field_MemberName(Handle mname_h, FieldAccessInfo& info, TRAPS); 48.24 + static oop init_field_MemberName(Handle mname_h, fieldDescriptor& fd, bool is_setter = false); 48.25 + static oop init_method_MemberName(Handle mname_h, CallInfo& info); 48.26 static int method_ref_kind(Method* m, bool do_dispatch_if_possible = true); 48.27 static int find_MemberNames(KlassHandle k, Symbol* name, Symbol* sig, 48.28 int mflags, KlassHandle caller,
49.1 --- a/src/share/vm/runtime/arguments.cpp Thu Sep 19 09:34:20 2013 +0200 49.2 +++ b/src/share/vm/runtime/arguments.cpp Thu Sep 19 18:01:39 2013 +0200 49.3 @@ -3408,6 +3408,33 @@ 49.4 return shared_archive_path; 49.5 } 49.6 49.7 +#ifndef PRODUCT 49.8 +// Determine whether LogVMOutput should be implicitly turned on. 49.9 +static bool use_vm_log() { 49.10 + if (LogCompilation || !FLAG_IS_DEFAULT(LogFile) || 49.11 + PrintCompilation || PrintInlining || PrintDependencies || PrintNativeNMethods || 49.12 + PrintDebugInfo || PrintRelocations || PrintNMethods || PrintExceptionHandlers || 49.13 + PrintAssembly || TraceDeoptimization || TraceDependencies || 49.14 + (VerifyDependencies && FLAG_IS_CMDLINE(VerifyDependencies))) { 49.15 + return true; 49.16 + } 49.17 + 49.18 +#ifdef COMPILER1 49.19 + if (PrintC1Statistics) { 49.20 + return true; 49.21 + } 49.22 +#endif // COMPILER1 49.23 + 49.24 +#ifdef COMPILER2 49.25 + if (PrintOptoAssembly || PrintOptoStatistics) { 49.26 + return true; 49.27 + } 49.28 +#endif // COMPILER2 49.29 + 49.30 + return false; 49.31 +} 49.32 +#endif // PRODUCT 49.33 + 49.34 // Parse entry point called from JNI_CreateJavaVM 49.35 49.36 jint Arguments::parse(const JavaVMInitArgs* args) { 49.37 @@ -3708,7 +3735,13 @@ 49.38 NmethodSweepFraction = 1; 49.39 } 49.40 } 49.41 -#endif 49.42 + 49.43 + if (!LogVMOutput && FLAG_IS_DEFAULT(LogVMOutput)) { 49.44 + if (use_vm_log()) { 49.45 + LogVMOutput = true; 49.46 + } 49.47 + } 49.48 +#endif // PRODUCT 49.49 49.50 if (PrintCommandLineFlags) { 49.51 CommandLineFlags::printSetFlags(tty);
50.1 --- a/src/share/vm/runtime/deoptimization.cpp Thu Sep 19 09:34:20 2013 +0200 50.2 +++ b/src/share/vm/runtime/deoptimization.cpp Thu Sep 19 18:01:39 2013 +0200 50.3 @@ -1751,7 +1751,7 @@ 50.4 else return trap_state & ~DS_RECOMPILE_BIT; 50.5 } 50.6 //---------------------------format_trap_state--------------------------------- 50.7 -// This is used for debugging and diagnostics, including hotspot.log output. 50.8 +// This is used for debugging and diagnostics, including LogFile output. 50.9 const char* Deoptimization::format_trap_state(char* buf, size_t buflen, 50.10 int trap_state) { 50.11 DeoptReason reason = trap_state_reason(trap_state); 50.12 @@ -1828,7 +1828,7 @@ 50.13 return buf; 50.14 } 50.15 50.16 -// This is used for debugging and diagnostics, including hotspot.log output. 50.17 +// This is used for debugging and diagnostics, including LogFile output. 50.18 const char* Deoptimization::format_trap_request(char* buf, size_t buflen, 50.19 int trap_request) { 50.20 jint unloaded_class_index = trap_request_index(trap_request);
51.1 --- a/src/share/vm/runtime/fieldDescriptor.cpp Thu Sep 19 09:34:20 2013 +0200 51.2 +++ b/src/share/vm/runtime/fieldDescriptor.cpp Thu Sep 19 18:01:39 2013 +0200 51.3 @@ -97,18 +97,32 @@ 51.4 return constants()->uncached_string_at(initial_value_index(), CHECK_0); 51.5 } 51.6 51.7 -void fieldDescriptor::initialize(InstanceKlass* ik, int index) { 51.8 - _cp = ik->constants(); 51.9 +void fieldDescriptor::reinitialize(InstanceKlass* ik, int index) { 51.10 + if (_cp.is_null() || field_holder() != ik) { 51.11 + _cp = constantPoolHandle(Thread::current(), ik->constants()); 51.12 + // _cp should now reference ik's constant pool; i.e., ik is now field_holder. 51.13 + assert(field_holder() == ik, "must be already initialized to this class"); 51.14 + } 51.15 FieldInfo* f = ik->field(index); 51.16 assert(!f->is_internal(), "regular Java fields only"); 51.17 51.18 _access_flags = accessFlags_from(f->access_flags()); 51.19 guarantee(f->name_index() != 0 && f->signature_index() != 0, "bad constant pool index for fieldDescriptor"); 51.20 _index = index; 51.21 + verify(); 51.22 } 51.23 51.24 #ifndef PRODUCT 51.25 51.26 +void fieldDescriptor::verify() const { 51.27 + if (_cp.is_null()) { 51.28 + assert(_index == badInt, "constructor must be called"); // see constructor 51.29 + } else { 51.30 + assert(_index >= 0, "good index"); 51.31 + assert(_index < field_holder()->java_fields_count(), "oob"); 51.32 + } 51.33 +} 51.34 + 51.35 void fieldDescriptor::print_on(outputStream* st) const { 51.36 access_flags().print_on(st); 51.37 name()->print_value_on(st);
52.1 --- a/src/share/vm/runtime/fieldDescriptor.hpp Thu Sep 19 09:34:20 2013 +0200 52.2 +++ b/src/share/vm/runtime/fieldDescriptor.hpp Thu Sep 19 18:01:39 2013 +0200 52.3 @@ -1,5 +1,5 @@ 52.4 /* 52.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 52.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 52.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 52.8 * 52.9 * This code is free software; you can redistribute it and/or modify it 52.10 @@ -53,6 +53,13 @@ 52.11 } 52.12 52.13 public: 52.14 + fieldDescriptor() { 52.15 + DEBUG_ONLY(_index = badInt); 52.16 + } 52.17 + fieldDescriptor(InstanceKlass* ik, int index) { 52.18 + DEBUG_ONLY(_index = badInt); 52.19 + reinitialize(ik, index); 52.20 + } 52.21 Symbol* name() const { 52.22 return field()->name(_cp); 52.23 } 52.24 @@ -112,12 +119,13 @@ 52.25 } 52.26 52.27 // Initialization 52.28 - void initialize(InstanceKlass* ik, int index); 52.29 + void reinitialize(InstanceKlass* ik, int index); 52.30 52.31 // Print 52.32 void print() { print_on(tty); } 52.33 void print_on(outputStream* st) const PRODUCT_RETURN; 52.34 void print_on_for(outputStream* st, oop obj) PRODUCT_RETURN; 52.35 + void verify() const PRODUCT_RETURN; 52.36 }; 52.37 52.38 #endif // SHARE_VM_RUNTIME_FIELDDESCRIPTOR_HPP
53.1 --- a/src/share/vm/runtime/globals.hpp Thu Sep 19 09:34:20 2013 +0200 53.2 +++ b/src/share/vm/runtime/globals.hpp Thu Sep 19 18:01:39 2013 +0200 53.3 @@ -880,7 +880,7 @@ 53.4 "stay alive at the expense of JVM performance") \ 53.5 \ 53.6 diagnostic(bool, LogCompilation, false, \ 53.7 - "Log compilation activity in detail to hotspot.log or LogFile") \ 53.8 + "Log compilation activity in detail to LogFile") \ 53.9 \ 53.10 product(bool, PrintCompilation, false, \ 53.11 "Print compilations") \ 53.12 @@ -2498,16 +2498,17 @@ 53.13 "Print all VM flags with default values and descriptions and exit")\ 53.14 \ 53.15 diagnostic(bool, SerializeVMOutput, true, \ 53.16 - "Use a mutex to serialize output to tty and hotspot.log") \ 53.17 + "Use a mutex to serialize output to tty and LogFile") \ 53.18 \ 53.19 diagnostic(bool, DisplayVMOutput, true, \ 53.20 "Display all VM output on the tty, independently of LogVMOutput") \ 53.21 \ 53.22 - diagnostic(bool, LogVMOutput, trueInDebug, \ 53.23 - "Save VM output to hotspot.log, or to LogFile") \ 53.24 + diagnostic(bool, LogVMOutput, false, \ 53.25 + "Save VM output to LogFile") \ 53.26 \ 53.27 diagnostic(ccstr, LogFile, NULL, \ 53.28 - "If LogVMOutput is on, save VM output to this file [hotspot.log]") \ 53.29 + "If LogVMOutput or LogCompilation is on, save VM output to " \ 53.30 + "this file [default: ./hotspot_pid%p.log] (%p replaced with pid)") \ 53.31 \ 53.32 product(ccstr, ErrorFile, NULL, \ 53.33 "If an error occurs, save the error data to this file " \
54.1 --- a/src/share/vm/runtime/mutexLocker.cpp Thu Sep 19 09:34:20 2013 +0200 54.2 +++ b/src/share/vm/runtime/mutexLocker.cpp Thu Sep 19 18:01:39 2013 +0200 54.3 @@ -45,7 +45,6 @@ 54.4 Mutex* VMStatistic_lock = NULL; 54.5 Mutex* JNIGlobalHandle_lock = NULL; 54.6 Mutex* JNIHandleBlockFreeList_lock = NULL; 54.7 -Mutex* JNICachedItableIndex_lock = NULL; 54.8 Mutex* MemberNameTable_lock = NULL; 54.9 Mutex* JmethodIdCreation_lock = NULL; 54.10 Mutex* JfieldIdCreation_lock = NULL; 54.11 @@ -253,7 +252,6 @@ 54.12 } 54.13 def(Heap_lock , Monitor, nonleaf+1, false); 54.14 def(JfieldIdCreation_lock , Mutex , nonleaf+1, true ); // jfieldID, Used in VM_Operation 54.15 - def(JNICachedItableIndex_lock , Mutex , nonleaf+1, false); // Used to cache an itable index during JNI invoke 54.16 def(MemberNameTable_lock , Mutex , nonleaf+1, false); // Used to protect MemberNameTable 54.17 54.18 def(CompiledIC_lock , Mutex , nonleaf+2, false); // locks VtableStubs_lock, InlineCacheBuffer_lock
55.1 --- a/src/share/vm/runtime/mutexLocker.hpp Thu Sep 19 09:34:20 2013 +0200 55.2 +++ b/src/share/vm/runtime/mutexLocker.hpp Thu Sep 19 18:01:39 2013 +0200 55.3 @@ -1,5 +1,5 @@ 55.4 /* 55.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 55.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 55.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 55.8 * 55.9 * This code is free software; you can redistribute it and/or modify it 55.10 @@ -50,7 +50,6 @@ 55.11 extern Mutex* VMStatistic_lock; // a lock used to guard statistics count increment 55.12 extern Mutex* JNIGlobalHandle_lock; // a lock on creating JNI global handles 55.13 extern Mutex* JNIHandleBlockFreeList_lock; // a lock on the JNI handle block free list 55.14 -extern Mutex* JNICachedItableIndex_lock; // a lock on caching an itable index during JNI invoke 55.15 extern Mutex* MemberNameTable_lock; // a lock on the MemberNameTable updates 55.16 extern Mutex* JmethodIdCreation_lock; // a lock on creating JNI method identifiers 55.17 extern Mutex* JfieldIdCreation_lock; // a lock on creating JNI static field identifiers
56.1 --- a/src/share/vm/runtime/os.hpp Thu Sep 19 09:34:20 2013 +0200 56.2 +++ b/src/share/vm/runtime/os.hpp Thu Sep 19 18:01:39 2013 +0200 56.3 @@ -91,6 +91,8 @@ 56.4 typedef void (*java_call_t)(JavaValue* value, methodHandle* method, JavaCallArguments* args, Thread* thread); 56.5 56.6 class os: AllStatic { 56.7 + friend class VMStructs; 56.8 + 56.9 public: 56.10 enum { page_sizes_max = 9 }; // Size of _page_sizes array (8 plus a sentinel) 56.11
57.1 --- a/src/share/vm/runtime/reflection.cpp Thu Sep 19 09:34:20 2013 +0200 57.2 +++ b/src/share/vm/runtime/reflection.cpp Thu Sep 19 18:01:39 2013 +0200 57.3 @@ -952,7 +952,8 @@ 57.4 } 57.5 } else { 57.6 // if the method can be overridden, we resolve using the vtable index. 57.7 - int index = reflected_method->vtable_index(); 57.8 + assert(!reflected_method->has_itable_index(), ""); 57.9 + int index = reflected_method->vtable_index(); 57.10 method = reflected_method; 57.11 if (index != Method::nonvirtual_vtable_index) { 57.12 // target_klass might be an arrayKlassOop but all vtables start at
58.1 --- a/src/share/vm/runtime/reflectionUtils.hpp Thu Sep 19 09:34:20 2013 +0200 58.2 +++ b/src/share/vm/runtime/reflectionUtils.hpp Thu Sep 19 18:01:39 2013 +0200 58.3 @@ -109,6 +109,8 @@ 58.4 private: 58.5 int length() const { return _klass->java_fields_count(); } 58.6 58.7 + fieldDescriptor _fd_buf; 58.8 + 58.9 public: 58.10 FieldStream(instanceKlassHandle klass, bool local_only, bool classes_only) 58.11 : KlassStream(klass, local_only, classes_only) { 58.12 @@ -134,6 +136,12 @@ 58.13 int offset() const { 58.14 return _klass->field_offset( index() ); 58.15 } 58.16 + // bridge to a heavier API: 58.17 + fieldDescriptor& field_descriptor() const { 58.18 + fieldDescriptor& field = const_cast<fieldDescriptor&>(_fd_buf); 58.19 + field.reinitialize(_klass(), _index); 58.20 + return field; 58.21 + } 58.22 }; 58.23 58.24 class FilteredField : public CHeapObj<mtInternal> {
59.1 --- a/src/share/vm/runtime/sweeper.cpp Thu Sep 19 09:34:20 2013 +0200 59.2 +++ b/src/share/vm/runtime/sweeper.cpp Thu Sep 19 18:01:39 2013 +0200 59.3 @@ -269,6 +269,7 @@ 59.4 // the number of nmethods changes during the sweep so the final 59.5 // stage must iterate until it there are no more nmethods. 59.6 int todo = (CodeCache::nof_nmethods() - _seen) / _invocations; 59.7 + int swept_count = 0; 59.8 59.9 assert(!SafepointSynchronize::is_at_safepoint(), "should not be in safepoint when we get here"); 59.10 assert(!CodeCache_lock->owned_by_self(), "just checking"); 59.11 @@ -278,6 +279,7 @@ 59.12 59.13 // The last invocation iterates until there are no more nmethods 59.14 for (int i = 0; (i < todo || _invocations == 1) && _current != NULL; i++) { 59.15 + swept_count++; 59.16 if (SafepointSynchronize::is_synchronizing()) { // Safepoint request 59.17 if (PrintMethodFlushing && Verbose) { 59.18 tty->print_cr("### Sweep at %d out of %d, invocation: %d, yielding to safepoint", _seen, CodeCache::nof_nmethods(), _invocations); 59.19 @@ -331,7 +333,7 @@ 59.20 event.set_endtime(sweep_end_counter); 59.21 event.set_sweepIndex(_traversals); 59.22 event.set_sweepFractionIndex(NmethodSweepFraction - _invocations + 1); 59.23 - event.set_sweptCount(todo); 59.24 + event.set_sweptCount(swept_count); 59.25 event.set_flushedCount(_flushed_count); 59.26 event.set_markedCount(_marked_count); 59.27 event.set_zombifiedCount(_zombified_count);
60.1 --- a/src/share/vm/runtime/vmStructs.cpp Thu Sep 19 09:34:20 2013 +0200 60.2 +++ b/src/share/vm/runtime/vmStructs.cpp Thu Sep 19 18:01:39 2013 +0200 60.3 @@ -315,7 +315,6 @@ 60.4 nonstatic_field(InstanceKlass, _breakpoints, BreakpointInfo*) \ 60.5 nonstatic_field(InstanceKlass, _generic_signature_index, u2) \ 60.6 nonstatic_field(InstanceKlass, _methods_jmethod_ids, jmethodID*) \ 60.7 - nonstatic_field(InstanceKlass, _methods_cached_itable_indices, int*) \ 60.8 volatile_nonstatic_field(InstanceKlass, _idnum_allocated_count, u2) \ 60.9 nonstatic_field(InstanceKlass, _annotations, Annotations*) \ 60.10 nonstatic_field(InstanceKlass, _dependencies, nmethodBucket*) \ 60.11 @@ -330,11 +329,13 @@ 60.12 nonstatic_field(Klass, _java_mirror, oop) \ 60.13 nonstatic_field(Klass, _modifier_flags, jint) \ 60.14 nonstatic_field(Klass, _super, Klass*) \ 60.15 + nonstatic_field(Klass, _subklass, Klass*) \ 60.16 nonstatic_field(Klass, _layout_helper, jint) \ 60.17 nonstatic_field(Klass, _name, Symbol*) \ 60.18 nonstatic_field(Klass, _access_flags, AccessFlags) \ 60.19 - nonstatic_field(Klass, _subklass, Klass*) \ 60.20 + nonstatic_field(Klass, _prototype_header, markOop) \ 60.21 nonstatic_field(Klass, _next_sibling, Klass*) \ 60.22 + nonstatic_field(vtableEntry, _method, Method*) \ 60.23 nonstatic_field(MethodData, _size, int) \ 60.24 nonstatic_field(MethodData, _method, Method*) \ 60.25 nonstatic_field(MethodData, _data_size, int) \ 60.26 @@ -342,10 +343,15 @@ 60.27 nonstatic_field(MethodData, _nof_decompiles, uint) \ 60.28 nonstatic_field(MethodData, _nof_overflow_recompiles, uint) \ 60.29 nonstatic_field(MethodData, _nof_overflow_traps, uint) \ 60.30 + nonstatic_field(MethodData, _trap_hist._array[0], u1) \ 60.31 nonstatic_field(MethodData, _eflags, intx) \ 60.32 nonstatic_field(MethodData, _arg_local, intx) \ 60.33 nonstatic_field(MethodData, _arg_stack, intx) \ 60.34 nonstatic_field(MethodData, _arg_returned, intx) \ 60.35 + nonstatic_field(DataLayout, _header._struct._tag, u1) \ 60.36 + nonstatic_field(DataLayout, _header._struct._flags, u1) \ 60.37 + nonstatic_field(DataLayout, _header._struct._bci, u2) \ 60.38 + nonstatic_field(DataLayout, _cells[0], intptr_t) \ 60.39 nonstatic_field(MethodCounters, _interpreter_invocation_count, int) \ 60.40 nonstatic_field(MethodCounters, _interpreter_throwout_count, u2) \ 60.41 nonstatic_field(MethodCounters, _number_of_breakpoints, u2) \ 60.42 @@ -357,6 +363,7 @@ 60.43 nonstatic_field(Method, _access_flags, AccessFlags) \ 60.44 nonstatic_field(Method, _vtable_index, int) \ 60.45 nonstatic_field(Method, _method_size, u2) \ 60.46 + nonstatic_field(Method, _intrinsic_id, u1) \ 60.47 nonproduct_nonstatic_field(Method, _compiled_invocation_count, int) \ 60.48 volatile_nonstatic_field(Method, _code, nmethod*) \ 60.49 nonstatic_field(Method, _i2i_entry, address) \ 60.50 @@ -443,12 +450,19 @@ 60.51 static_field(Universe, _bootstrapping, bool) \ 60.52 static_field(Universe, _fully_initialized, bool) \ 60.53 static_field(Universe, _verify_count, int) \ 60.54 + static_field(Universe, _non_oop_bits, intptr_t) \ 60.55 static_field(Universe, _narrow_oop._base, address) \ 60.56 static_field(Universe, _narrow_oop._shift, int) \ 60.57 static_field(Universe, _narrow_oop._use_implicit_null_checks, bool) \ 60.58 static_field(Universe, _narrow_klass._base, address) \ 60.59 static_field(Universe, _narrow_klass._shift, int) \ 60.60 \ 60.61 + /******/ \ 60.62 + /* os */ \ 60.63 + /******/ \ 60.64 + \ 60.65 + static_field(os, _polling_page, address) \ 60.66 + \ 60.67 /**********************************************************************************/ \ 60.68 /* Generation and Space hierarchies */ \ 60.69 /**********************************************************************************/ \ 60.70 @@ -456,6 +470,7 @@ 60.71 unchecked_nonstatic_field(ageTable, sizes, sizeof(ageTable::sizes)) \ 60.72 \ 60.73 nonstatic_field(BarrierSet, _max_covered_regions, int) \ 60.74 + nonstatic_field(BarrierSet, _kind, BarrierSet::Name) \ 60.75 nonstatic_field(BlockOffsetTable, _bottom, HeapWord*) \ 60.76 nonstatic_field(BlockOffsetTable, _end, HeapWord*) \ 60.77 \ 60.78 @@ -495,6 +510,7 @@ 60.79 nonstatic_field(CollectedHeap, _barrier_set, BarrierSet*) \ 60.80 nonstatic_field(CollectedHeap, _defer_initial_card_mark, bool) \ 60.81 nonstatic_field(CollectedHeap, _is_gc_active, bool) \ 60.82 + nonstatic_field(CollectedHeap, _total_collections, unsigned int) \ 60.83 nonstatic_field(CompactibleSpace, _compaction_top, HeapWord*) \ 60.84 nonstatic_field(CompactibleSpace, _first_dead, HeapWord*) \ 60.85 nonstatic_field(CompactibleSpace, _end_of_live, HeapWord*) \ 60.86 @@ -505,7 +521,7 @@ 60.87 nonstatic_field(ContiguousSpace, _saved_mark_word, HeapWord*) \ 60.88 \ 60.89 nonstatic_field(DefNewGeneration, _next_gen, Generation*) \ 60.90 - nonstatic_field(DefNewGeneration, _tenuring_threshold, uint) \ 60.91 + nonstatic_field(DefNewGeneration, _tenuring_threshold, uint) \ 60.92 nonstatic_field(DefNewGeneration, _age_table, ageTable) \ 60.93 nonstatic_field(DefNewGeneration, _eden_space, EdenSpace*) \ 60.94 nonstatic_field(DefNewGeneration, _from_space, ContiguousSpace*) \ 60.95 @@ -552,6 +568,11 @@ 60.96 nonstatic_field(ThreadLocalAllocBuffer, _desired_size, size_t) \ 60.97 nonstatic_field(ThreadLocalAllocBuffer, _refill_waste_limit, size_t) \ 60.98 static_field(ThreadLocalAllocBuffer, _target_refills, unsigned) \ 60.99 + nonstatic_field(ThreadLocalAllocBuffer, _number_of_refills, unsigned) \ 60.100 + nonstatic_field(ThreadLocalAllocBuffer, _fast_refill_waste, unsigned) \ 60.101 + nonstatic_field(ThreadLocalAllocBuffer, _slow_refill_waste, unsigned) \ 60.102 + nonstatic_field(ThreadLocalAllocBuffer, _gc_waste, unsigned) \ 60.103 + nonstatic_field(ThreadLocalAllocBuffer, _slow_allocations, unsigned) \ 60.104 nonstatic_field(VirtualSpace, _low_boundary, char*) \ 60.105 nonstatic_field(VirtualSpace, _high_boundary, char*) \ 60.106 nonstatic_field(VirtualSpace, _low, char*) \ 60.107 @@ -713,6 +734,13 @@ 60.108 \ 60.109 static_field(ClassLoaderDataGraph, _head, ClassLoaderData*) \ 60.110 \ 60.111 + /**********/ \ 60.112 + /* Arrays */ \ 60.113 + /**********/ \ 60.114 + \ 60.115 + nonstatic_field(Array<Klass*>, _length, int) \ 60.116 + nonstatic_field(Array<Klass*>, _data[0], Klass*) \ 60.117 + \ 60.118 /*******************/ \ 60.119 /* GrowableArrays */ \ 60.120 /*******************/ \ 60.121 @@ -720,7 +748,7 @@ 60.122 nonstatic_field(GenericGrowableArray, _len, int) \ 60.123 nonstatic_field(GenericGrowableArray, _max, int) \ 60.124 nonstatic_field(GenericGrowableArray, _arena, Arena*) \ 60.125 - nonstatic_field(GrowableArray<int>, _data, int*) \ 60.126 + nonstatic_field(GrowableArray<int>, _data, int*) \ 60.127 \ 60.128 /********************************/ \ 60.129 /* CodeCache (NOTE: incomplete) */ \ 60.130 @@ -763,7 +791,20 @@ 60.131 /* StubRoutines (NOTE: incomplete) */ \ 60.132 /***********************************/ \ 60.133 \ 60.134 + static_field(StubRoutines, _verify_oop_count, jint) \ 60.135 static_field(StubRoutines, _call_stub_return_address, address) \ 60.136 + static_field(StubRoutines, _aescrypt_encryptBlock, address) \ 60.137 + static_field(StubRoutines, _aescrypt_decryptBlock, address) \ 60.138 + static_field(StubRoutines, _cipherBlockChaining_encryptAESCrypt, address) \ 60.139 + static_field(StubRoutines, _cipherBlockChaining_decryptAESCrypt, address) \ 60.140 + static_field(StubRoutines, _updateBytesCRC32, address) \ 60.141 + static_field(StubRoutines, _crc_table_adr, address) \ 60.142 + \ 60.143 + /*****************/ \ 60.144 + /* SharedRuntime */ \ 60.145 + /*****************/ \ 60.146 + \ 60.147 + static_field(SharedRuntime, _ic_miss_blob, RuntimeStub*) \ 60.148 \ 60.149 /***************************************/ \ 60.150 /* PcDesc and other compiled code info */ \ 60.151 @@ -853,6 +894,7 @@ 60.152 volatile_nonstatic_field(Thread, _suspend_flags, uint32_t) \ 60.153 nonstatic_field(Thread, _active_handles, JNIHandleBlock*) \ 60.154 nonstatic_field(Thread, _tlab, ThreadLocalAllocBuffer) \ 60.155 + nonstatic_field(Thread, _allocated_bytes, jlong) \ 60.156 nonstatic_field(Thread, _current_pending_monitor, ObjectMonitor*) \ 60.157 nonstatic_field(Thread, _current_pending_monitor_is_from_java, bool) \ 60.158 nonstatic_field(Thread, _current_waiting_monitor, ObjectMonitor*) \ 60.159 @@ -866,6 +908,7 @@ 60.160 nonstatic_field(JavaThread, _pending_async_exception, oop) \ 60.161 volatile_nonstatic_field(JavaThread, _exception_oop, oop) \ 60.162 volatile_nonstatic_field(JavaThread, _exception_pc, address) \ 60.163 + volatile_nonstatic_field(JavaThread, _is_method_handle_return, int) \ 60.164 nonstatic_field(JavaThread, _is_compiling, bool) \ 60.165 nonstatic_field(JavaThread, _special_runtime_exit_condition, JavaThread::AsyncRequests) \ 60.166 nonstatic_field(JavaThread, _saved_exception_pc, address) \ 60.167 @@ -875,6 +918,8 @@ 60.168 nonstatic_field(JavaThread, _stack_size, size_t) \ 60.169 nonstatic_field(JavaThread, _vframe_array_head, vframeArray*) \ 60.170 nonstatic_field(JavaThread, _vframe_array_last, vframeArray*) \ 60.171 + nonstatic_field(JavaThread, _satb_mark_queue, ObjPtrQueue) \ 60.172 + nonstatic_field(JavaThread, _dirty_card_queue, DirtyCardQueue) \ 60.173 nonstatic_field(Thread, _resource_area, ResourceArea*) \ 60.174 nonstatic_field(CompilerThread, _env, ciEnv*) \ 60.175 \ 60.176 @@ -1187,7 +1232,7 @@ 60.177 unchecked_nonstatic_field(Array<int>, _data, sizeof(int)) \ 60.178 unchecked_nonstatic_field(Array<u1>, _data, sizeof(u1)) \ 60.179 unchecked_nonstatic_field(Array<u2>, _data, sizeof(u2)) \ 60.180 - unchecked_nonstatic_field(Array<Method*>, _data, sizeof(Method*)) \ 60.181 + unchecked_nonstatic_field(Array<Method*>, _data, sizeof(Method*)) \ 60.182 unchecked_nonstatic_field(Array<Klass*>, _data, sizeof(Klass*)) \ 60.183 \ 60.184 /*********************************/ \ 60.185 @@ -1203,7 +1248,7 @@ 60.186 /* Miscellaneous fields */ \ 60.187 /************************/ \ 60.188 \ 60.189 - nonstatic_field(CompileTask, _method, Method*) \ 60.190 + nonstatic_field(CompileTask, _method, Method*) \ 60.191 nonstatic_field(CompileTask, _osr_bci, int) \ 60.192 nonstatic_field(CompileTask, _comp_level, int) \ 60.193 nonstatic_field(CompileTask, _compile_id, uint) \ 60.194 @@ -1217,7 +1262,11 @@ 60.195 \ 60.196 nonstatic_field(vframeArrayElement, _frame, frame) \ 60.197 nonstatic_field(vframeArrayElement, _bci, int) \ 60.198 - nonstatic_field(vframeArrayElement, _method, Method*) \ 60.199 + nonstatic_field(vframeArrayElement, _method, Method*) \ 60.200 + \ 60.201 + nonstatic_field(PtrQueue, _active, bool) \ 60.202 + nonstatic_field(PtrQueue, _buf, void**) \ 60.203 + nonstatic_field(PtrQueue, _index, size_t) \ 60.204 \ 60.205 nonstatic_field(AccessFlags, _flags, jint) \ 60.206 nonstatic_field(elapsedTimer, _counter, jlong) \ 60.207 @@ -1363,7 +1412,7 @@ 60.208 /* MetadataOopDesc hierarchy (NOTE: some missing) */ \ 60.209 /**************************************************/ \ 60.210 \ 60.211 - declare_toplevel_type(CompiledICHolder) \ 60.212 + declare_toplevel_type(CompiledICHolder) \ 60.213 declare_toplevel_type(MetaspaceObj) \ 60.214 declare_type(Metadata, MetaspaceObj) \ 60.215 declare_type(Klass, Metadata) \ 60.216 @@ -1374,17 +1423,20 @@ 60.217 declare_type(InstanceClassLoaderKlass, InstanceKlass) \ 60.218 declare_type(InstanceMirrorKlass, InstanceKlass) \ 60.219 declare_type(InstanceRefKlass, InstanceKlass) \ 60.220 - declare_type(ConstantPool, Metadata) \ 60.221 - declare_type(ConstantPoolCache, MetaspaceObj) \ 60.222 - declare_type(MethodData, Metadata) \ 60.223 - declare_type(Method, Metadata) \ 60.224 - declare_type(MethodCounters, MetaspaceObj) \ 60.225 - declare_type(ConstMethod, MetaspaceObj) \ 60.226 + declare_type(ConstantPool, Metadata) \ 60.227 + declare_type(ConstantPoolCache, MetaspaceObj) \ 60.228 + declare_type(MethodData, Metadata) \ 60.229 + declare_type(Method, Metadata) \ 60.230 + declare_type(MethodCounters, MetaspaceObj) \ 60.231 + declare_type(ConstMethod, MetaspaceObj) \ 60.232 + \ 60.233 + declare_toplevel_type(vtableEntry) \ 60.234 \ 60.235 declare_toplevel_type(Symbol) \ 60.236 declare_toplevel_type(Symbol*) \ 60.237 declare_toplevel_type(volatile Metadata*) \ 60.238 \ 60.239 + declare_toplevel_type(DataLayout) \ 60.240 declare_toplevel_type(nmethodBucket) \ 60.241 \ 60.242 /********/ \ 60.243 @@ -1432,6 +1484,7 @@ 60.244 declare_type(ModRefBarrierSet, BarrierSet) \ 60.245 declare_type(CardTableModRefBS, ModRefBarrierSet) \ 60.246 declare_type(CardTableModRefBSForCTRS, CardTableModRefBS) \ 60.247 + declare_toplevel_type(BarrierSet::Name) \ 60.248 declare_toplevel_type(GenRemSet) \ 60.249 declare_type(CardTableRS, GenRemSet) \ 60.250 declare_toplevel_type(BlockOffsetSharedArray) \ 60.251 @@ -1450,6 +1503,8 @@ 60.252 declare_toplevel_type(ThreadLocalAllocBuffer) \ 60.253 declare_toplevel_type(VirtualSpace) \ 60.254 declare_toplevel_type(WaterMark) \ 60.255 + declare_toplevel_type(ObjPtrQueue) \ 60.256 + declare_toplevel_type(DirtyCardQueue) \ 60.257 \ 60.258 /* Pointers to Garbage Collection types */ \ 60.259 \ 60.260 @@ -2068,6 +2123,7 @@ 60.261 declare_toplevel_type(StubQueue*) \ 60.262 declare_toplevel_type(Thread*) \ 60.263 declare_toplevel_type(Universe) \ 60.264 + declare_toplevel_type(os) \ 60.265 declare_toplevel_type(vframeArray) \ 60.266 declare_toplevel_type(vframeArrayElement) \ 60.267 declare_toplevel_type(Annotations*) \ 60.268 @@ -2076,6 +2132,8 @@ 60.269 /* Miscellaneous types */ \ 60.270 /***************/ \ 60.271 \ 60.272 + declare_toplevel_type(PtrQueue) \ 60.273 + \ 60.274 /* freelist */ \ 60.275 declare_toplevel_type(FreeChunk*) \ 60.276 declare_toplevel_type(Metablock*) \ 60.277 @@ -2106,6 +2164,7 @@ 60.278 /* Useful globals */ \ 60.279 /******************/ \ 60.280 \ 60.281 + declare_preprocessor_constant("ASSERT", DEBUG_ONLY(1) NOT_DEBUG(0)) \ 60.282 \ 60.283 /**************/ \ 60.284 /* Stack bias */ \ 60.285 @@ -2122,6 +2181,8 @@ 60.286 declare_constant(BytesPerWord) \ 60.287 declare_constant(BytesPerLong) \ 60.288 \ 60.289 + declare_constant(LogKlassAlignmentInBytes) \ 60.290 + \ 60.291 /********************************************/ \ 60.292 /* Generation and Space Hierarchy Constants */ \ 60.293 /********************************************/ \ 60.294 @@ -2130,6 +2191,9 @@ 60.295 \ 60.296 declare_constant(BarrierSet::ModRef) \ 60.297 declare_constant(BarrierSet::CardTableModRef) \ 60.298 + declare_constant(BarrierSet::CardTableExtension) \ 60.299 + declare_constant(BarrierSet::G1SATBCT) \ 60.300 + declare_constant(BarrierSet::G1SATBCTLogging) \ 60.301 declare_constant(BarrierSet::Other) \ 60.302 \ 60.303 declare_constant(BlockOffsetSharedArray::LogN) \ 60.304 @@ -2248,8 +2312,11 @@ 60.305 declare_constant(Klass::_primary_super_limit) \ 60.306 declare_constant(Klass::_lh_instance_slow_path_bit) \ 60.307 declare_constant(Klass::_lh_log2_element_size_shift) \ 60.308 + declare_constant(Klass::_lh_log2_element_size_mask) \ 60.309 declare_constant(Klass::_lh_element_type_shift) \ 60.310 + declare_constant(Klass::_lh_element_type_mask) \ 60.311 declare_constant(Klass::_lh_header_size_shift) \ 60.312 + declare_constant(Klass::_lh_header_size_mask) \ 60.313 declare_constant(Klass::_lh_array_tag_shift) \ 60.314 declare_constant(Klass::_lh_array_tag_type_value) \ 60.315 declare_constant(Klass::_lh_array_tag_obj_value) \ 60.316 @@ -2268,6 +2335,12 @@ 60.317 declare_constant(ConstMethod::_has_default_annotations) \ 60.318 declare_constant(ConstMethod::_has_type_annotations) \ 60.319 \ 60.320 + /**************/ \ 60.321 + /* DataLayout */ \ 60.322 + /**************/ \ 60.323 + \ 60.324 + declare_constant(DataLayout::cell_size) \ 60.325 + \ 60.326 /*************************************/ \ 60.327 /* InstanceKlass enum */ \ 60.328 /*************************************/ \ 60.329 @@ -2402,6 +2475,13 @@ 60.330 declare_constant(Deoptimization::Reason_LIMIT) \ 60.331 declare_constant(Deoptimization::Reason_RECORDED_LIMIT) \ 60.332 \ 60.333 + declare_constant(Deoptimization::Action_none) \ 60.334 + declare_constant(Deoptimization::Action_maybe_recompile) \ 60.335 + declare_constant(Deoptimization::Action_reinterpret) \ 60.336 + declare_constant(Deoptimization::Action_make_not_entrant) \ 60.337 + declare_constant(Deoptimization::Action_make_not_compilable) \ 60.338 + declare_constant(Deoptimization::Action_LIMIT) \ 60.339 + \ 60.340 /*********************/ \ 60.341 /* Matcher (C2 only) */ \ 60.342 /*********************/ \ 60.343 @@ -2468,6 +2548,16 @@ 60.344 declare_constant(vmSymbols::FIRST_SID) \ 60.345 declare_constant(vmSymbols::SID_LIMIT) \ 60.346 \ 60.347 + /****************/ \ 60.348 + /* vmIntrinsics */ \ 60.349 + /****************/ \ 60.350 + \ 60.351 + declare_constant(vmIntrinsics::_invokeBasic) \ 60.352 + declare_constant(vmIntrinsics::_linkToVirtual) \ 60.353 + declare_constant(vmIntrinsics::_linkToStatic) \ 60.354 + declare_constant(vmIntrinsics::_linkToSpecial) \ 60.355 + declare_constant(vmIntrinsics::_linkToInterface) \ 60.356 + \ 60.357 /********************************/ \ 60.358 /* Calling convention constants */ \ 60.359 /********************************/ \ 60.360 @@ -2515,6 +2605,8 @@ 60.361 declare_constant(markOopDesc::biased_lock_bit_in_place) \ 60.362 declare_constant(markOopDesc::age_mask) \ 60.363 declare_constant(markOopDesc::age_mask_in_place) \ 60.364 + declare_constant(markOopDesc::epoch_mask) \ 60.365 + declare_constant(markOopDesc::epoch_mask_in_place) \ 60.366 declare_constant(markOopDesc::hash_mask) \ 60.367 declare_constant(markOopDesc::hash_mask_in_place) \ 60.368 declare_constant(markOopDesc::biased_lock_alignment) \
61.1 --- a/src/share/vm/utilities/ostream.cpp Thu Sep 19 09:34:20 2013 +0200 61.2 +++ b/src/share/vm/utilities/ostream.cpp Thu Sep 19 18:01:39 2013 +0200 61.3 @@ -792,7 +792,7 @@ 61.4 61.5 void defaultStream::init_log() { 61.6 // %%% Need a MutexLocker? 61.7 - const char* log_name = LogFile != NULL ? LogFile : "hotspot.log"; 61.8 + const char* log_name = LogFile != NULL ? LogFile : "hotspot_pid%p.log"; 61.9 const char* try_name = make_log_name(log_name, NULL); 61.10 fileStream* file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name); 61.11 if (!file->is_open()) { 61.12 @@ -803,14 +803,15 @@ 61.13 // Note: This feature is for maintainer use only. No need for L10N. 61.14 jio_print(warnbuf); 61.15 FREE_C_HEAP_ARRAY(char, try_name, mtInternal); 61.16 - try_name = make_log_name("hs_pid%p.log", os::get_temp_directory()); 61.17 + try_name = make_log_name(log_name, os::get_temp_directory()); 61.18 jio_snprintf(warnbuf, sizeof(warnbuf), 61.19 "Warning: Forcing option -XX:LogFile=%s\n", try_name); 61.20 jio_print(warnbuf); 61.21 delete file; 61.22 file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name); 61.23 - FREE_C_HEAP_ARRAY(char, try_name, mtInternal); 61.24 } 61.25 + FREE_C_HEAP_ARRAY(char, try_name, mtInternal); 61.26 + 61.27 if (file->is_open()) { 61.28 _log_file = file; 61.29 xmlStream* xs = new(ResourceObj::C_HEAP, mtInternal) xmlStream(file);
62.1 --- a/test/gc/TestVerifyDuringStartup.java Thu Sep 19 09:34:20 2013 +0200 62.2 +++ b/test/gc/TestVerifyDuringStartup.java Thu Sep 19 18:01:39 2013 +0200 62.3 @@ -48,7 +48,7 @@ 62.4 "-XX:+VerifyDuringStartup", 62.5 "-version"}); 62.6 62.7 - System.out.print("Testing:\n" + JDKToolFinder.getCurrentJDKTool("java")); 62.8 + System.out.print("Testing:\n" + JDKToolFinder.getJDKTool("java")); 62.9 for (int i = 0; i < vmOpts.size(); i += 1) { 62.10 System.out.print(" " + vmOpts.get(i)); 62.11 }
63.1 --- a/test/testlibrary/com/oracle/java/testlibrary/JDKToolFinder.java Thu Sep 19 09:34:20 2013 +0200 63.2 +++ b/test/testlibrary/com/oracle/java/testlibrary/JDKToolFinder.java Thu Sep 19 18:01:39 2013 +0200 63.3 @@ -23,7 +23,9 @@ 63.4 63.5 package com.oracle.java.testlibrary; 63.6 63.7 -import java.io.File; 63.8 +import java.io.FileNotFoundException; 63.9 +import java.nio.file.Path; 63.10 +import java.nio.file.Paths; 63.11 63.12 public final class JDKToolFinder { 63.13 63.14 @@ -32,38 +34,73 @@ 63.15 63.16 /** 63.17 * Returns the full path to an executable in jdk/bin based on System 63.18 - * property {@code compile.jdk} (set by jtreg test suite) 63.19 + * property {@code test.jdk} or {@code compile.jdk} (both are set by the jtreg test suite) 63.20 * 63.21 * @return Full path to an executable in jdk/bin 63.22 */ 63.23 public static String getJDKTool(String tool) { 63.24 - String binPath = System.getProperty("compile.jdk"); 63.25 - if (binPath == null) { 63.26 - throw new RuntimeException("System property 'compile.jdk' not set. " 63.27 - + "This property is normally set by jtreg. " 63.28 - + "When running test separately, set this property using " 63.29 - + "'-Dcompile.jdk=/path/to/jdk'."); 63.30 + 63.31 + // First try to find the executable in test.jdk 63.32 + try { 63.33 + return getTool(tool, "test.jdk"); 63.34 + } catch (FileNotFoundException e) { 63.35 + 63.36 } 63.37 - binPath += File.separatorChar + "bin" + File.separatorChar + tool; 63.38 63.39 - return binPath; 63.40 + // Now see if it's available in compile.jdk 63.41 + try { 63.42 + return getTool(tool, "compile.jdk"); 63.43 + } catch (FileNotFoundException e) { 63.44 + throw new RuntimeException("Failed to find " + tool + 63.45 + ", looked in test.jdk (" + System.getProperty("test.jdk") + 63.46 + ") and compile.jdk (" + System.getProperty("compile.jdk") + ")"); 63.47 + } 63.48 } 63.49 + 63.50 /** 63.51 - * Returns the full path to an executable in <current jdk>/bin based 63.52 - * on System property {@code test.jdk} (set by jtreg test suite) 63.53 + * Returns the full path to an executable in jdk/bin based on System 63.54 + * property {@code compile.jdk} 63.55 * 63.56 * @return Full path to an executable in jdk/bin 63.57 */ 63.58 - public static String getCurrentJDKTool(String tool) { 63.59 - String binPath = System.getProperty("test.jdk"); 63.60 - if (binPath == null) { 63.61 - throw new RuntimeException("System property 'test.jdk' not set. " 63.62 - + "This property is normally set by jtreg. " 63.63 - + "When running test separately, set this property using " 63.64 - + "'-Dtest.jdk=/path/to/jdk'."); 63.65 + public static String getCompileJDKTool(String tool) { 63.66 + try { 63.67 + return getTool(tool, "compile.jdk"); 63.68 + } catch (FileNotFoundException e) { 63.69 + throw new RuntimeException(e); 63.70 } 63.71 - binPath += File.separatorChar + "bin" + File.separatorChar + tool; 63.72 + } 63.73 63.74 - return binPath; 63.75 + /** 63.76 + * Returns the full path to an executable in jdk/bin based on System 63.77 + * property {@code test.jdk} 63.78 + * 63.79 + * @return Full path to an executable in jdk/bin 63.80 + */ 63.81 + public static String getTestJDKTool(String tool) { 63.82 + try { 63.83 + return getTool(tool, "test.jdk"); 63.84 + } catch (FileNotFoundException e) { 63.85 + throw new RuntimeException(e); 63.86 + } 63.87 + } 63.88 + 63.89 + private static String getTool(String tool, String property) throws FileNotFoundException { 63.90 + String jdkPath = System.getProperty(property); 63.91 + 63.92 + if (jdkPath == null) { 63.93 + throw new RuntimeException( 63.94 + "System property '" + property + "' not set. This property is normally set by jtreg. " 63.95 + + "When running test separately, set this property using '-D" + property + "=/path/to/jdk'."); 63.96 + } 63.97 + 63.98 + Path toolName = Paths.get("bin", tool + (Platform.isWindows() ? ".exe" : "")); 63.99 + 63.100 + Path jdkTool = Paths.get(jdkPath, toolName.toString()); 63.101 + if (!jdkTool.toFile().exists()) { 63.102 + throw new FileNotFoundException("Could not find file " + jdkTool.toAbsolutePath()); 63.103 + } 63.104 + 63.105 + return jdkTool.toAbsolutePath().toString(); 63.106 } 63.107 }