Mon, 28 Oct 2013 17:32:02 -0700
Merge
1.1 --- a/src/cpu/sparc/vm/cppInterpreter_sparc.cpp Fri Oct 25 13:43:39 2013 -0700 1.2 +++ b/src/cpu/sparc/vm/cppInterpreter_sparc.cpp Mon Oct 28 17:32:02 2013 -0700 1.3 @@ -365,7 +365,7 @@ 1.4 return entry; 1.5 } 1.6 1.7 -address CppInterpreter::return_entry(TosState state, int length) { 1.8 +address CppInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) { 1.9 // make it look good in the debugger 1.10 return CAST_FROM_FN_PTR(address, RecursiveInterpreterActivation) + frame::pc_return_offset; 1.11 }
2.1 --- a/src/cpu/sparc/vm/templateInterpreter_sparc.cpp Fri Oct 25 13:43:39 2013 -0700 2.2 +++ b/src/cpu/sparc/vm/templateInterpreter_sparc.cpp Mon Oct 28 17:32:02 2013 -0700 2.3 @@ -153,13 +153,9 @@ 2.4 } 2.5 2.6 2.7 -address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step) { 2.8 - TosState incoming_state = state; 2.9 +address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step, size_t index_size) { 2.10 + address entry = __ pc(); 2.11 2.12 - Label cont; 2.13 - address compiled_entry = __ pc(); 2.14 - 2.15 - address entry = __ pc(); 2.16 #if !defined(_LP64) && defined(COMPILER2) 2.17 // All return values are where we want them, except for Longs. C2 returns 2.18 // longs in G1 in the 32-bit build whereas the interpreter wants them in O0/O1. 2.19 @@ -170,14 +166,12 @@ 2.20 // do this here. Unfortunately if we did a rethrow we'd see an machepilog node 2.21 // first which would move g1 -> O0/O1 and destroy the exception we were throwing. 2.22 2.23 - if (incoming_state == ltos) { 2.24 + if (state == ltos) { 2.25 __ srl (G1, 0, O1); 2.26 __ srlx(G1, 32, O0); 2.27 } 2.28 #endif // !_LP64 && COMPILER2 2.29 2.30 - __ bind(cont); 2.31 - 2.32 // The callee returns with the stack possibly adjusted by adapter transition 2.33 // We remove that possible adjustment here. 2.34 // All interpreter local registers are untouched. Any result is passed back 2.35 @@ -186,29 +180,18 @@ 2.36 2.37 __ mov(Llast_SP, SP); // Remove any adapter added stack space. 2.38 2.39 - Label L_got_cache, L_giant_index; 2.40 const Register cache = G3_scratch; 2.41 - const Register size = G1_scratch; 2.42 - if (EnableInvokeDynamic) { 2.43 - __ ldub(Address(Lbcp, 0), G1_scratch); // Load current bytecode. 2.44 - __ cmp_and_br_short(G1_scratch, Bytecodes::_invokedynamic, Assembler::equal, Assembler::pn, L_giant_index); 2.45 - } 2.46 - __ get_cache_and_index_at_bcp(cache, G1_scratch, 1); 2.47 - __ bind(L_got_cache); 2.48 - __ ld_ptr(cache, ConstantPoolCache::base_offset() + 2.49 - ConstantPoolCacheEntry::flags_offset(), size); 2.50 - __ and3(size, 0xFF, size); // argument size in words 2.51 - __ sll(size, Interpreter::logStackElementSize, size); // each argument size in bytes 2.52 - __ add(Lesp, size, Lesp); // pop arguments 2.53 + const Register index = G1_scratch; 2.54 + __ get_cache_and_index_at_bcp(cache, index, 1, index_size); 2.55 + 2.56 + const Register flags = cache; 2.57 + __ ld_ptr(cache, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset(), flags); 2.58 + const Register parameter_size = flags; 2.59 + __ and3(flags, ConstantPoolCacheEntry::parameter_size_mask, parameter_size); // argument size in words 2.60 + __ sll(parameter_size, Interpreter::logStackElementSize, parameter_size); // each argument size in bytes 2.61 + __ add(Lesp, parameter_size, Lesp); // pop arguments 2.62 __ dispatch_next(state, step); 2.63 2.64 - // out of the main line of code... 2.65 - if (EnableInvokeDynamic) { 2.66 - __ bind(L_giant_index); 2.67 - __ get_cache_and_index_at_bcp(cache, G1_scratch, 1, sizeof(u4)); 2.68 - __ ba_short(L_got_cache); 2.69 - } 2.70 - 2.71 return entry; 2.72 } 2.73
3.1 --- a/src/cpu/sparc/vm/templateTable_sparc.cpp Fri Oct 25 13:43:39 2013 -0700 3.2 +++ b/src/cpu/sparc/vm/templateTable_sparc.cpp Mon Oct 28 17:32:02 2013 -0700 3.3 @@ -2932,9 +2932,7 @@ 3.4 ConstantPoolCacheEntry::verify_tos_state_shift(); 3.5 // load return address 3.6 { 3.7 - const address table_addr = (is_invokeinterface || is_invokedynamic) ? 3.8 - (address)Interpreter::return_5_addrs_by_index_table() : 3.9 - (address)Interpreter::return_3_addrs_by_index_table(); 3.10 + const address table_addr = (address) Interpreter::invoke_return_entry_table_for(code); 3.11 AddressLiteral table(table_addr); 3.12 __ set(table, temp); 3.13 __ sll(ra, LogBytesPerWord, ra); 3.14 @@ -2984,7 +2982,7 @@ 3.15 __ verify_oop(O0_recv); 3.16 3.17 // get return address 3.18 - AddressLiteral table(Interpreter::return_3_addrs_by_index_table()); 3.19 + AddressLiteral table(Interpreter::invoke_return_entry_table()); 3.20 __ set(table, Rtemp); 3.21 __ srl(Rret, ConstantPoolCacheEntry::tos_state_shift, Rret); // get return type 3.22 // Make sure we don't need to mask Rret after the above shift 3.23 @@ -3026,7 +3024,7 @@ 3.24 __ profile_final_call(O4); 3.25 3.26 // get return address 3.27 - AddressLiteral table(Interpreter::return_3_addrs_by_index_table()); 3.28 + AddressLiteral table(Interpreter::invoke_return_entry_table()); 3.29 __ set(table, Rtemp); 3.30 __ srl(Rret, ConstantPoolCacheEntry::tos_state_shift, Rret); // get return type 3.31 // Make sure we don't need to mask Rret after the above shift
4.1 --- a/src/cpu/x86/vm/cppInterpreter_x86.cpp Fri Oct 25 13:43:39 2013 -0700 4.2 +++ b/src/cpu/x86/vm/cppInterpreter_x86.cpp Mon Oct 28 17:32:02 2013 -0700 4.3 @@ -367,7 +367,7 @@ 4.4 return entry; 4.5 } 4.6 4.7 -address CppInterpreter::return_entry(TosState state, int length) { 4.8 +address CppInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) { 4.9 // make it look good in the debugger 4.10 return CAST_FROM_FN_PTR(address, RecursiveInterpreterActivation); 4.11 }
5.1 --- a/src/cpu/x86/vm/templateInterpreter_x86_32.cpp Fri Oct 25 13:43:39 2013 -0700 5.2 +++ b/src/cpu/x86/vm/templateInterpreter_x86_32.cpp Mon Oct 28 17:32:02 2013 -0700 5.3 @@ -150,13 +150,12 @@ 5.4 } 5.5 5.6 5.7 -address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step) { 5.8 - TosState incoming_state = state; 5.9 +address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step, size_t index_size) { 5.10 address entry = __ pc(); 5.11 5.12 #ifdef COMPILER2 5.13 // The FPU stack is clean if UseSSE >= 2 but must be cleaned in other cases 5.14 - if ((incoming_state == ftos && UseSSE < 1) || (incoming_state == dtos && UseSSE < 2)) { 5.15 + if ((state == ftos && UseSSE < 1) || (state == dtos && UseSSE < 2)) { 5.16 for (int i = 1; i < 8; i++) { 5.17 __ ffree(i); 5.18 } 5.19 @@ -164,7 +163,7 @@ 5.20 __ empty_FPU_stack(); 5.21 } 5.22 #endif 5.23 - if ((incoming_state == ftos && UseSSE < 1) || (incoming_state == dtos && UseSSE < 2)) { 5.24 + if ((state == ftos && UseSSE < 1) || (state == dtos && UseSSE < 2)) { 5.25 __ MacroAssembler::verify_FPU(1, "generate_return_entry_for compiled"); 5.26 } else { 5.27 __ MacroAssembler::verify_FPU(0, "generate_return_entry_for compiled"); 5.28 @@ -172,12 +171,12 @@ 5.29 5.30 // In SSE mode, interpreter returns FP results in xmm0 but they need 5.31 // to end up back on the FPU so it can operate on them. 5.32 - if (incoming_state == ftos && UseSSE >= 1) { 5.33 + if (state == ftos && UseSSE >= 1) { 5.34 __ subptr(rsp, wordSize); 5.35 __ movflt(Address(rsp, 0), xmm0); 5.36 __ fld_s(Address(rsp, 0)); 5.37 __ addptr(rsp, wordSize); 5.38 - } else if (incoming_state == dtos && UseSSE >= 2) { 5.39 + } else if (state == dtos && UseSSE >= 2) { 5.40 __ subptr(rsp, 2*wordSize); 5.41 __ movdbl(Address(rsp, 0), xmm0); 5.42 __ fld_d(Address(rsp, 0)); 5.43 @@ -194,33 +193,22 @@ 5.44 __ restore_bcp(); 5.45 __ restore_locals(); 5.46 5.47 - if (incoming_state == atos) { 5.48 + if (state == atos) { 5.49 Register mdp = rbx; 5.50 Register tmp = rcx; 5.51 __ profile_return_type(mdp, rax, tmp); 5.52 } 5.53 5.54 - Label L_got_cache, L_giant_index; 5.55 - if (EnableInvokeDynamic) { 5.56 - __ cmpb(Address(rsi, 0), Bytecodes::_invokedynamic); 5.57 - __ jcc(Assembler::equal, L_giant_index); 5.58 - } 5.59 - __ get_cache_and_index_at_bcp(rbx, rcx, 1, sizeof(u2)); 5.60 - __ bind(L_got_cache); 5.61 - __ movl(rbx, Address(rbx, rcx, 5.62 - Address::times_ptr, ConstantPoolCache::base_offset() + 5.63 - ConstantPoolCacheEntry::flags_offset())); 5.64 - __ andptr(rbx, 0xFF); 5.65 - __ lea(rsp, Address(rsp, rbx, Interpreter::stackElementScale())); 5.66 + const Register cache = rbx; 5.67 + const Register index = rcx; 5.68 + __ get_cache_and_index_at_bcp(cache, index, 1, index_size); 5.69 + 5.70 + const Register flags = cache; 5.71 + __ movl(flags, Address(cache, index, Address::times_ptr, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset())); 5.72 + __ andl(flags, ConstantPoolCacheEntry::parameter_size_mask); 5.73 + __ lea(rsp, Address(rsp, flags, Interpreter::stackElementScale())); 5.74 __ dispatch_next(state, step); 5.75 5.76 - // out of the main line of code... 5.77 - if (EnableInvokeDynamic) { 5.78 - __ bind(L_giant_index); 5.79 - __ get_cache_and_index_at_bcp(rbx, rcx, 1, sizeof(u4)); 5.80 - __ jmp(L_got_cache); 5.81 - } 5.82 - 5.83 return entry; 5.84 } 5.85
6.1 --- a/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Fri Oct 25 13:43:39 2013 -0700 6.2 +++ b/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Mon Oct 28 17:32:02 2013 -0700 6.3 @@ -166,7 +166,7 @@ 6.4 } 6.5 6.6 6.7 -address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step) { 6.8 +address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step, size_t index_size) { 6.9 address entry = __ pc(); 6.10 6.11 // Restore stack bottom in case i2c adjusted stack 6.12 @@ -183,28 +183,16 @@ 6.13 __ profile_return_type(mdp, rax, tmp); 6.14 } 6.15 6.16 - Label L_got_cache, L_giant_index; 6.17 - if (EnableInvokeDynamic) { 6.18 - __ cmpb(Address(r13, 0), Bytecodes::_invokedynamic); 6.19 - __ jcc(Assembler::equal, L_giant_index); 6.20 - } 6.21 - __ get_cache_and_index_at_bcp(rbx, rcx, 1, sizeof(u2)); 6.22 - __ bind(L_got_cache); 6.23 - __ movl(rbx, Address(rbx, rcx, 6.24 - Address::times_ptr, 6.25 - in_bytes(ConstantPoolCache::base_offset()) + 6.26 - 3 * wordSize)); 6.27 - __ andl(rbx, 0xFF); 6.28 - __ lea(rsp, Address(rsp, rbx, Address::times_8)); 6.29 + const Register cache = rbx; 6.30 + const Register index = rcx; 6.31 + __ get_cache_and_index_at_bcp(cache, index, 1, index_size); 6.32 + 6.33 + const Register flags = cache; 6.34 + __ movl(flags, Address(cache, index, Address::times_ptr, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset())); 6.35 + __ andl(flags, ConstantPoolCacheEntry::parameter_size_mask); 6.36 + __ lea(rsp, Address(rsp, flags, Interpreter::stackElementScale())); 6.37 __ dispatch_next(state, step); 6.38 6.39 - // out of the main line of code... 6.40 - if (EnableInvokeDynamic) { 6.41 - __ bind(L_giant_index); 6.42 - __ get_cache_and_index_at_bcp(rbx, rcx, 1, sizeof(u4)); 6.43 - __ jmp(L_got_cache); 6.44 - } 6.45 - 6.46 return entry; 6.47 } 6.48
7.1 --- a/src/cpu/x86/vm/templateTable_x86_32.cpp Fri Oct 25 13:43:39 2013 -0700 7.2 +++ b/src/cpu/x86/vm/templateTable_x86_32.cpp Mon Oct 28 17:32:02 2013 -0700 7.3 @@ -2925,9 +2925,7 @@ 7.4 ConstantPoolCacheEntry::verify_tos_state_shift(); 7.5 // load return address 7.6 { 7.7 - const address table_addr = (is_invokeinterface || is_invokedynamic) ? 7.8 - (address)Interpreter::return_5_addrs_by_index_table() : 7.9 - (address)Interpreter::return_3_addrs_by_index_table(); 7.10 + const address table_addr = (address) Interpreter::invoke_return_entry_table_for(code); 7.11 ExternalAddress table(table_addr); 7.12 __ movptr(flags, ArrayAddress(table, Address(noreg, flags, Address::times_ptr))); 7.13 }
8.1 --- a/src/cpu/x86/vm/templateTable_x86_64.cpp Fri Oct 25 13:43:39 2013 -0700 8.2 +++ b/src/cpu/x86/vm/templateTable_x86_64.cpp Mon Oct 28 17:32:02 2013 -0700 8.3 @@ -2980,9 +2980,7 @@ 8.4 ConstantPoolCacheEntry::verify_tos_state_shift(); 8.5 // load return address 8.6 { 8.7 - const address table_addr = (is_invokeinterface || is_invokedynamic) ? 8.8 - (address)Interpreter::return_5_addrs_by_index_table() : 8.9 - (address)Interpreter::return_3_addrs_by_index_table(); 8.10 + const address table_addr = (address) Interpreter::invoke_return_entry_table_for(code); 8.11 ExternalAddress table(table_addr); 8.12 __ lea(rscratch1, table); 8.13 __ movptr(flags, Address(rscratch1, flags, Address::times_ptr));
9.1 --- a/src/cpu/zero/vm/cppInterpreter_zero.cpp Fri Oct 25 13:43:39 2013 -0700 9.2 +++ b/src/cpu/zero/vm/cppInterpreter_zero.cpp Mon Oct 28 17:32:02 2013 -0700 9.3 @@ -1006,7 +1006,7 @@ 9.4 istate->set_stack_limit(stack_base - method->max_stack() - 1); 9.5 } 9.6 9.7 -address CppInterpreter::return_entry(TosState state, int length) { 9.8 +address CppInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) { 9.9 ShouldNotCallThis(); 9.10 return NULL; 9.11 }
10.1 --- a/src/cpu/zero/vm/globals_zero.hpp Fri Oct 25 13:43:39 2013 -0700 10.2 +++ b/src/cpu/zero/vm/globals_zero.hpp Mon Oct 28 17:32:02 2013 -0700 10.3 @@ -57,6 +57,8 @@ 10.4 // GC Ergo Flags 10.5 define_pd_global(uintx, CMSYoungGenPerWorker, 16*M); // default max size of CMS young gen, per GC worker thread 10.6 10.7 +define_pd_global(uintx, TypeProfileLevel, 0); 10.8 + 10.9 #define ARCH_FLAGS(develop, product, diagnostic, experimental, notproduct) 10.10 10.11 #endif // CPU_ZERO_VM_GLOBALS_ZERO_HPP
11.1 --- a/src/share/vm/compiler/compileBroker.cpp Fri Oct 25 13:43:39 2013 -0700 11.2 +++ b/src/share/vm/compiler/compileBroker.cpp Mon Oct 28 17:32:02 2013 -0700 11.3 @@ -780,6 +780,10 @@ 11.4 void CompileBroker::compilation_init() { 11.5 _last_method_compiled[0] = '\0'; 11.6 11.7 + // No need to initialize compilation system if we do not use it. 11.8 + if (!UseCompiler) { 11.9 + return; 11.10 + } 11.11 #ifndef SHARK 11.12 // Set the interface to the current compiler(s). 11.13 int c1_count = CompilationPolicy::policy()->compiler_count(CompLevel_simple);
12.1 --- a/src/share/vm/interpreter/abstractInterpreter.hpp Fri Oct 25 13:43:39 2013 -0700 12.2 +++ b/src/share/vm/interpreter/abstractInterpreter.hpp Mon Oct 28 17:32:02 2013 -0700 12.3 @@ -158,8 +158,8 @@ 12.4 // Runtime support 12.5 12.6 // length = invoke bytecode length (to advance to next bytecode) 12.7 - static address deopt_entry (TosState state, int length) { ShouldNotReachHere(); return NULL; } 12.8 - static address return_entry (TosState state, int length) { ShouldNotReachHere(); return NULL; } 12.9 + static address deopt_entry(TosState state, int length) { ShouldNotReachHere(); return NULL; } 12.10 + static address return_entry(TosState state, int length, Bytecodes::Code code) { ShouldNotReachHere(); return NULL; } 12.11 12.12 static address rethrow_exception_entry() { return _rethrow_exception_entry; } 12.13
13.1 --- a/src/share/vm/interpreter/cppInterpreter.hpp Fri Oct 25 13:43:39 2013 -0700 13.2 +++ b/src/share/vm/interpreter/cppInterpreter.hpp Mon Oct 28 17:32:02 2013 -0700 13.3 @@ -78,7 +78,7 @@ 13.4 static address stack_result_to_stack(int index) { return _stack_to_stack[index]; } 13.5 static address stack_result_to_native(int index) { return _stack_to_native_abi[index]; } 13.6 13.7 - static address return_entry (TosState state, int length); 13.8 + static address return_entry (TosState state, int length, Bytecodes::Code code); 13.9 static address deopt_entry (TosState state, int length); 13.10 13.11 #ifdef TARGET_ARCH_x86
14.1 --- a/src/share/vm/interpreter/interpreter.cpp Fri Oct 25 13:43:39 2013 -0700 14.2 +++ b/src/share/vm/interpreter/interpreter.cpp Mon Oct 28 17:32:02 2013 -0700 14.3 @@ -329,15 +329,21 @@ 14.4 //------------------------------------------------------------------------------------------------------------------------ 14.5 // Deoptimization support 14.6 14.7 -// If deoptimization happens, this function returns the point of next bytecode to continue execution 14.8 +/** 14.9 + * If a deoptimization happens, this function returns the point of next bytecode to continue execution. 14.10 + */ 14.11 address AbstractInterpreter::deopt_continue_after_entry(Method* method, address bcp, int callee_parameters, bool is_top_frame) { 14.12 assert(method->contains(bcp), "just checkin'"); 14.13 - Bytecodes::Code code = Bytecodes::java_code_at(method, bcp); 14.14 + 14.15 + // Get the original and rewritten bytecode. 14.16 + Bytecodes::Code code = Bytecodes::java_code_at(method, bcp); 14.17 assert(!Interpreter::bytecode_should_reexecute(code), "should not reexecute"); 14.18 - int bci = method->bci_from(bcp); 14.19 - int length = -1; // initial value for debugging 14.20 + 14.21 + const int bci = method->bci_from(bcp); 14.22 + 14.23 // compute continuation length 14.24 - length = Bytecodes::length_at(method, bcp); 14.25 + const int length = Bytecodes::length_at(method, bcp); 14.26 + 14.27 // compute result type 14.28 BasicType type = T_ILLEGAL; 14.29 14.30 @@ -393,7 +399,7 @@ 14.31 return 14.32 is_top_frame 14.33 ? Interpreter::deopt_entry (as_TosState(type), length) 14.34 - : Interpreter::return_entry(as_TosState(type), length); 14.35 + : Interpreter::return_entry(as_TosState(type), length, code); 14.36 } 14.37 14.38 // If deoptimization happens, this function returns the point where the interpreter reexecutes
15.1 --- a/src/share/vm/interpreter/templateInterpreter.cpp Fri Oct 25 13:43:39 2013 -0700 15.2 +++ b/src/share/vm/interpreter/templateInterpreter.cpp Mon Oct 28 17:32:02 2013 -0700 15.3 @@ -184,8 +184,9 @@ 15.4 EntryPoint TemplateInterpreter::_continuation_entry; 15.5 EntryPoint TemplateInterpreter::_safept_entry; 15.6 15.7 -address TemplateInterpreter::_return_3_addrs_by_index[TemplateInterpreter::number_of_return_addrs]; 15.8 -address TemplateInterpreter::_return_5_addrs_by_index[TemplateInterpreter::number_of_return_addrs]; 15.9 +address TemplateInterpreter::_invoke_return_entry[TemplateInterpreter::number_of_return_addrs]; 15.10 +address TemplateInterpreter::_invokeinterface_return_entry[TemplateInterpreter::number_of_return_addrs]; 15.11 +address TemplateInterpreter::_invokedynamic_return_entry[TemplateInterpreter::number_of_return_addrs]; 15.12 15.13 DispatchTable TemplateInterpreter::_active_table; 15.14 DispatchTable TemplateInterpreter::_normal_table; 15.15 @@ -237,22 +238,37 @@ 15.16 #endif // !PRODUCT 15.17 15.18 { CodeletMark cm(_masm, "return entry points"); 15.19 + const int index_size = sizeof(u2); 15.20 for (int i = 0; i < Interpreter::number_of_return_entries; i++) { 15.21 Interpreter::_return_entry[i] = 15.22 EntryPoint( 15.23 - generate_return_entry_for(itos, i), 15.24 - generate_return_entry_for(itos, i), 15.25 - generate_return_entry_for(itos, i), 15.26 - generate_return_entry_for(atos, i), 15.27 - generate_return_entry_for(itos, i), 15.28 - generate_return_entry_for(ltos, i), 15.29 - generate_return_entry_for(ftos, i), 15.30 - generate_return_entry_for(dtos, i), 15.31 - generate_return_entry_for(vtos, i) 15.32 + generate_return_entry_for(itos, i, index_size), 15.33 + generate_return_entry_for(itos, i, index_size), 15.34 + generate_return_entry_for(itos, i, index_size), 15.35 + generate_return_entry_for(atos, i, index_size), 15.36 + generate_return_entry_for(itos, i, index_size), 15.37 + generate_return_entry_for(ltos, i, index_size), 15.38 + generate_return_entry_for(ftos, i, index_size), 15.39 + generate_return_entry_for(dtos, i, index_size), 15.40 + generate_return_entry_for(vtos, i, index_size) 15.41 ); 15.42 } 15.43 } 15.44 15.45 + { CodeletMark cm(_masm, "invoke return entry points"); 15.46 + const TosState states[] = {itos, itos, itos, itos, ltos, ftos, dtos, atos, vtos}; 15.47 + const int invoke_length = Bytecodes::length_for(Bytecodes::_invokestatic); 15.48 + const int invokeinterface_length = Bytecodes::length_for(Bytecodes::_invokeinterface); 15.49 + const int invokedynamic_length = Bytecodes::length_for(Bytecodes::_invokedynamic); 15.50 + 15.51 + for (int i = 0; i < Interpreter::number_of_return_addrs; i++) { 15.52 + TosState state = states[i]; 15.53 + Interpreter::_invoke_return_entry[i] = generate_return_entry_for(state, invoke_length, sizeof(u2)); 15.54 + Interpreter::_invokeinterface_return_entry[i] = generate_return_entry_for(state, invokeinterface_length, sizeof(u2)); 15.55 + Interpreter::_invokedynamic_return_entry[i] = generate_return_entry_for(state, invokedynamic_length, sizeof(u4)); 15.56 + } 15.57 + } 15.58 + 15.59 { CodeletMark cm(_masm, "earlyret entry points"); 15.60 Interpreter::_earlyret_entry = 15.61 EntryPoint( 15.62 @@ -298,13 +314,6 @@ 15.63 } 15.64 } 15.65 15.66 - for (int j = 0; j < number_of_states; j++) { 15.67 - const TosState states[] = {btos, ctos, stos, itos, ltos, ftos, dtos, atos, vtos}; 15.68 - int index = Interpreter::TosState_as_index(states[j]); 15.69 - Interpreter::_return_3_addrs_by_index[index] = Interpreter::return_entry(states[j], 3); 15.70 - Interpreter::_return_5_addrs_by_index[index] = Interpreter::return_entry(states[j], 5); 15.71 - } 15.72 - 15.73 { CodeletMark cm(_masm, "continuation entry points"); 15.74 Interpreter::_continuation_entry = 15.75 EntryPoint( 15.76 @@ -534,9 +543,46 @@ 15.77 //------------------------------------------------------------------------------------------------------------------------ 15.78 // Entry points 15.79 15.80 -address TemplateInterpreter::return_entry(TosState state, int length) { 15.81 +/** 15.82 + * Returns the return entry table for the given invoke bytecode. 15.83 + */ 15.84 +address* TemplateInterpreter::invoke_return_entry_table_for(Bytecodes::Code code) { 15.85 + switch (code) { 15.86 + case Bytecodes::_invokestatic: 15.87 + case Bytecodes::_invokespecial: 15.88 + case Bytecodes::_invokevirtual: 15.89 + case Bytecodes::_invokehandle: 15.90 + return Interpreter::invoke_return_entry_table(); 15.91 + case Bytecodes::_invokeinterface: 15.92 + return Interpreter::invokeinterface_return_entry_table(); 15.93 + case Bytecodes::_invokedynamic: 15.94 + return Interpreter::invokedynamic_return_entry_table(); 15.95 + default: 15.96 + fatal(err_msg("invalid bytecode: %s", Bytecodes::name(code))); 15.97 + return NULL; 15.98 + } 15.99 +} 15.100 + 15.101 +/** 15.102 + * Returns the return entry address for the given top-of-stack state and bytecode. 15.103 + */ 15.104 +address TemplateInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) { 15.105 guarantee(0 <= length && length < Interpreter::number_of_return_entries, "illegal length"); 15.106 - return _return_entry[length].entry(state); 15.107 + const int index = TosState_as_index(state); 15.108 + switch (code) { 15.109 + case Bytecodes::_invokestatic: 15.110 + case Bytecodes::_invokespecial: 15.111 + case Bytecodes::_invokevirtual: 15.112 + case Bytecodes::_invokehandle: 15.113 + return _invoke_return_entry[index]; 15.114 + case Bytecodes::_invokeinterface: 15.115 + return _invokeinterface_return_entry[index]; 15.116 + case Bytecodes::_invokedynamic: 15.117 + return _invokedynamic_return_entry[index]; 15.118 + default: 15.119 + assert(!Bytecodes::is_invoke(code), err_msg("invoke instructions should be handled separately: %s", Bytecodes::name(code))); 15.120 + return _return_entry[length].entry(state); 15.121 + } 15.122 } 15.123 15.124
16.1 --- a/src/share/vm/interpreter/templateInterpreter.hpp Fri Oct 25 13:43:39 2013 -0700 16.2 +++ b/src/share/vm/interpreter/templateInterpreter.hpp Mon Oct 28 17:32:02 2013 -0700 16.3 @@ -120,8 +120,9 @@ 16.4 static EntryPoint _continuation_entry; 16.5 static EntryPoint _safept_entry; 16.6 16.7 - static address _return_3_addrs_by_index[number_of_return_addrs]; // for invokevirtual return entries 16.8 - static address _return_5_addrs_by_index[number_of_return_addrs]; // for invokeinterface return entries 16.9 + static address _invoke_return_entry[number_of_return_addrs]; // for invokestatic, invokespecial, invokevirtual return entries 16.10 + static address _invokeinterface_return_entry[number_of_return_addrs]; // for invokeinterface return entries 16.11 + static address _invokedynamic_return_entry[number_of_return_addrs]; // for invokedynamic return entries 16.12 16.13 static DispatchTable _active_table; // the active dispatch table (used by the interpreter for dispatch) 16.14 static DispatchTable _normal_table; // the normal dispatch table (used to set the active table in normal mode) 16.15 @@ -161,12 +162,15 @@ 16.16 static address* normal_table() { return _normal_table.table_for(); } 16.17 16.18 // Support for invokes 16.19 - static address* return_3_addrs_by_index_table() { return _return_3_addrs_by_index; } 16.20 - static address* return_5_addrs_by_index_table() { return _return_5_addrs_by_index; } 16.21 - static int TosState_as_index(TosState state); // computes index into return_3_entry_by_index table 16.22 + static address* invoke_return_entry_table() { return _invoke_return_entry; } 16.23 + static address* invokeinterface_return_entry_table() { return _invokeinterface_return_entry; } 16.24 + static address* invokedynamic_return_entry_table() { return _invokedynamic_return_entry; } 16.25 + static int TosState_as_index(TosState state); 16.26 16.27 - static address return_entry (TosState state, int length); 16.28 - static address deopt_entry (TosState state, int length); 16.29 + static address* invoke_return_entry_table_for(Bytecodes::Code code); 16.30 + 16.31 + static address deopt_entry(TosState state, int length); 16.32 + static address return_entry(TosState state, int length, Bytecodes::Code code); 16.33 16.34 // Safepoint support 16.35 static void notice_safepoints(); // stops the thread when reaching a safepoint
17.1 --- a/src/share/vm/interpreter/templateInterpreterGenerator.hpp Fri Oct 25 13:43:39 2013 -0700 17.2 +++ b/src/share/vm/interpreter/templateInterpreterGenerator.hpp Mon Oct 28 17:32:02 2013 -0700 17.3 @@ -53,7 +53,7 @@ 17.4 address generate_ClassCastException_handler(); 17.5 address generate_ArrayIndexOutOfBounds_handler(const char* name); 17.6 address generate_continuation_for(TosState state); 17.7 - address generate_return_entry_for(TosState state, int step); 17.8 + address generate_return_entry_for(TosState state, int step, size_t index_size); 17.9 address generate_earlyret_entry_for(TosState state); 17.10 address generate_deopt_entry_for(TosState state, int step); 17.11 address generate_safept_entry_for(TosState state, address runtime_entry);
18.1 --- a/src/share/vm/oops/method.cpp Fri Oct 25 13:43:39 2013 -0700 18.2 +++ b/src/share/vm/oops/method.cpp Mon Oct 28 17:32:02 2013 -0700 18.3 @@ -1515,7 +1515,10 @@ 18.4 return bp->orig_bytecode(); 18.5 } 18.6 } 18.7 - ShouldNotReachHere(); 18.8 + { 18.9 + ResourceMark rm; 18.10 + fatal(err_msg("no original bytecode found in %s at bci %d", name_and_sig_as_C_string(), bci)); 18.11 + } 18.12 return Bytecodes::_shouldnotreachhere; 18.13 } 18.14
19.1 --- a/src/share/vm/opto/postaloc.cpp Fri Oct 25 13:43:39 2013 -0700 19.2 +++ b/src/share/vm/opto/postaloc.cpp Mon Oct 28 17:32:02 2013 -0700 19.3 @@ -97,7 +97,8 @@ 19.4 static bool expected_yanked_node(Node *old, Node *orig_old) { 19.5 // This code is expected only next original nodes: 19.6 // - load from constant table node which may have next data input nodes: 19.7 - // MachConstantBase, Phi, MachTemp, MachSpillCopy 19.8 + // MachConstantBase, MachTemp, MachSpillCopy 19.9 + // - Phi nodes that are considered Junk 19.10 // - load constant node which may have next data input nodes: 19.11 // MachTemp, MachSpillCopy 19.12 // - MachSpillCopy 19.13 @@ -112,7 +113,9 @@ 19.14 return (old == orig_old); 19.15 } else if (old->is_MachTemp()) { 19.16 return orig_old->is_Con(); 19.17 - } else if (old->is_Phi() || old->is_MachConstantBase()) { 19.18 + } else if (old->is_Phi()) { // Junk phi's 19.19 + return true; 19.20 + } else if (old->is_MachConstantBase()) { 19.21 return (orig_old->is_Con() && orig_old->is_MachConstant()); 19.22 } 19.23 return false; 19.24 @@ -522,11 +525,9 @@ 19.25 u = u ? NodeSentinel : x; // Capture unique input, or NodeSentinel for 2nd input 19.26 } 19.27 if (u != NodeSentinel) { // Junk Phi. Remove 19.28 - block->remove_node(j--); 19.29 + phi->replace_by(u); 19.30 + j -= yank_if_dead(phi, block, &value, ®nd); 19.31 phi_dex--; 19.32 - _cfg.unmap_node_from_block(phi); 19.33 - phi->replace_by(u); 19.34 - phi->disconnect_inputs(NULL, C); 19.35 continue; 19.36 } 19.37 // Note that if value[pidx] exists, then we merged no new values here
20.1 --- a/src/share/vm/opto/type.cpp Fri Oct 25 13:43:39 2013 -0700 20.2 +++ b/src/share/vm/opto/type.cpp Mon Oct 28 17:32:02 2013 -0700 20.3 @@ -2787,13 +2787,11 @@ 20.4 20.5 //-----------------------------filter------------------------------------------ 20.6 // Do not allow interface-vs.-noninterface joins to collapse to top. 20.7 -const Type *TypeOopPtr::filter( const Type *kills ) const { 20.8 +const Type *TypeOopPtr::filter(const Type *kills) const { 20.9 20.10 const Type* ft = join(kills); 20.11 const TypeInstPtr* ftip = ft->isa_instptr(); 20.12 const TypeInstPtr* ktip = kills->isa_instptr(); 20.13 - const TypeKlassPtr* ftkp = ft->isa_klassptr(); 20.14 - const TypeKlassPtr* ktkp = kills->isa_klassptr(); 20.15 20.16 if (ft->empty()) { 20.17 // Check for evil case of 'this' being a class and 'kills' expecting an 20.18 @@ -2807,8 +2805,6 @@ 20.19 // uplift the type. 20.20 if (!empty() && ktip != NULL && ktip->is_loaded() && ktip->klass()->is_interface()) 20.21 return kills; // Uplift to interface 20.22 - if (!empty() && ktkp != NULL && ktkp->klass()->is_loaded() && ktkp->klass()->is_interface()) 20.23 - return kills; // Uplift to interface 20.24 20.25 return Type::TOP; // Canonical empty value 20.26 } 20.27 @@ -2825,14 +2821,6 @@ 20.28 assert(!ftip->klass_is_exact(), "interface could not be exact"); 20.29 return ktip->cast_to_ptr_type(ftip->ptr()); 20.30 } 20.31 - // Interface klass type could be exact in opposite to interface type, 20.32 - // return it here instead of incorrect Constant ptr J/L/Object (6894807). 20.33 - if (ftkp != NULL && ktkp != NULL && 20.34 - ftkp->is_loaded() && ftkp->klass()->is_interface() && 20.35 - !ftkp->klass_is_exact() && // Keep exact interface klass 20.36 - ktkp->is_loaded() && !ktkp->klass()->is_interface()) { 20.37 - return ktkp->cast_to_ptr_type(ftkp->ptr()); 20.38 - } 20.39 20.40 return ft; 20.41 } 20.42 @@ -4385,6 +4373,33 @@ 20.43 return (_offset == 0) && !below_centerline(_ptr); 20.44 } 20.45 20.46 +// Do not allow interface-vs.-noninterface joins to collapse to top. 20.47 +const Type *TypeKlassPtr::filter(const Type *kills) const { 20.48 + // logic here mirrors the one from TypeOopPtr::filter. See comments 20.49 + // there. 20.50 + const Type* ft = join(kills); 20.51 + const TypeKlassPtr* ftkp = ft->isa_klassptr(); 20.52 + const TypeKlassPtr* ktkp = kills->isa_klassptr(); 20.53 + 20.54 + if (ft->empty()) { 20.55 + if (!empty() && ktkp != NULL && ktkp->klass()->is_loaded() && ktkp->klass()->is_interface()) 20.56 + return kills; // Uplift to interface 20.57 + 20.58 + return Type::TOP; // Canonical empty value 20.59 + } 20.60 + 20.61 + // Interface klass type could be exact in opposite to interface type, 20.62 + // return it here instead of incorrect Constant ptr J/L/Object (6894807). 20.63 + if (ftkp != NULL && ktkp != NULL && 20.64 + ftkp->is_loaded() && ftkp->klass()->is_interface() && 20.65 + !ftkp->klass_is_exact() && // Keep exact interface klass 20.66 + ktkp->is_loaded() && !ktkp->klass()->is_interface()) { 20.67 + return ktkp->cast_to_ptr_type(ftkp->ptr()); 20.68 + } 20.69 + 20.70 + return ft; 20.71 +} 20.72 + 20.73 //----------------------compute_klass------------------------------------------ 20.74 // Compute the defining klass for this class 20.75 ciKlass* TypeAryPtr::compute_klass(DEBUG_ONLY(bool verify)) const {
21.1 --- a/src/share/vm/opto/type.hpp Fri Oct 25 13:43:39 2013 -0700 21.2 +++ b/src/share/vm/opto/type.hpp Mon Oct 28 17:32:02 2013 -0700 21.3 @@ -63,7 +63,7 @@ 21.4 class TypeOopPtr; 21.5 class TypeInstPtr; 21.6 class TypeAryPtr; 21.7 -class TypeKlassPtr; 21.8 +class TypeKlassPtr; 21.9 class TypeMetadataPtr; 21.10 21.11 //------------------------------Type------------------------------------------- 21.12 @@ -1202,6 +1202,9 @@ 21.13 21.14 virtual intptr_t get_con() const; 21.15 21.16 + // Do not allow interface-vs.-noninterface joins to collapse to top. 21.17 + virtual const Type *filter( const Type *kills ) const; 21.18 + 21.19 // Convenience common pre-built types. 21.20 static const TypeKlassPtr* OBJECT; // Not-null object klass or below 21.21 static const TypeKlassPtr* OBJECT_OR_NULL; // Maybe-null version of same
22.1 --- a/src/share/vm/runtime/handles.cpp Fri Oct 25 13:43:39 2013 -0700 22.2 +++ b/src/share/vm/runtime/handles.cpp Mon Oct 28 17:32:02 2013 -0700 22.3 @@ -45,7 +45,7 @@ 22.4 oop* HandleArea::allocate_handle(oop obj) { 22.5 assert(_handle_mark_nesting > 1, "memory leak: allocating handle outside HandleMark"); 22.6 assert(_no_handle_mark_nesting == 0, "allocating handle inside NoHandleMark"); 22.7 - assert(obj->is_oop(), "sanity check"); 22.8 + assert(obj->is_oop(), err_msg("not an oop: " INTPTR_FORMAT, (intptr_t*) obj)); 22.9 return real_allocate_handle(obj); 22.10 } 22.11
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 23.2 +++ b/test/compiler/startup/StartupOutput.java Mon Oct 28 17:32:02 2013 -0700 23.3 @@ -0,0 +1,44 @@ 23.4 +/* 23.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 23.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 23.7 + * 23.8 + * This code is free software; you can redistribute it and/or modify it 23.9 + * under the terms of the GNU General Public License version 2 only, as 23.10 + * published by the Free Software Foundation. 23.11 + * 23.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 23.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 23.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23.15 + * version 2 for more details (a copy is included in the LICENSE file that 23.16 + * accompanied this code). 23.17 + * 23.18 + * You should have received a copy of the GNU General Public License version 23.19 + * 2 along with this work; if not, write to the Free Software Foundation, 23.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 23.21 + * 23.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 23.23 + * or visit www.oracle.com if you need additional information or have any 23.24 + * questions. 23.25 + */ 23.26 + 23.27 +/* 23.28 + * @test 23.29 + * @bug 8026949 23.30 + * @summary Test ensures correct VM output during startup 23.31 + * @library ../../testlibrary 23.32 + * 23.33 + */ 23.34 +import com.oracle.java.testlibrary.*; 23.35 + 23.36 +public class StartupOutput { 23.37 + public static void main(String[] args) throws Exception { 23.38 + ProcessBuilder pb; 23.39 + OutputAnalyzer out; 23.40 + 23.41 + pb = ProcessTools.createJavaProcessBuilder("-Xint", "-XX:+DisplayVMOutputToStdout", "-version"); 23.42 + out = new OutputAnalyzer(pb.start()); 23.43 + out.shouldNotContain("no space to run compilers"); 23.44 + 23.45 + out.shouldHaveExitValue(0); 23.46 + } 23.47 +}