73 __ z_br(Z_R1); 74 __ end_a_stub(); // Update current stubs pointer and restore insts_end. 75 return stub; 76 #else 77 ShouldNotReachHere(); 78 #endif 79 } 80 81 #undef __ 82 83 int CompiledStaticCall::to_interp_stub_size() { 84 return 2 * MacroAssembler::load_const_from_toc_size() + 85 2; // branch 86 } 87 88 // Relocation entries for call stub, compiled java to interpreter. 89 int CompiledStaticCall::reloc_to_interp_stub() { 90 return 5; // 4 in emit_java_to_interp + 1 in Java_Static_Call 91 } 92 93 void CompiledStaticCall::set_to_interpreted(methodHandle callee, address entry) { 94 address stub = find_stub(); 95 guarantee(stub != NULL, "stub not found"); 96 97 if (TraceICs) { 98 ResourceMark rm; 99 tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s", 100 p2i(instruction_address()), 101 callee->name_and_sig_as_C_string()); 102 } 103 104 // Creation also verifies the object. 105 NativeMovConstReg* method_holder = nativeMovConstReg_at(stub + get_IC_pos_in_java_to_interp_stub()); 106 NativeJump* jump = nativeJump_at(method_holder->next_instruction_address()); 107 108 // A generated lambda form might be deleted from the Lambdaform 109 // cache in MethodTypeForm. If a jit compiled lambdaform method 110 // becomes not entrant and the cache access returns null, the new 111 // resolve will lead to a new generated LambdaForm. 112 113 assert(method_holder->data() == 0 || method_holder->data() == (intptr_t)callee() || callee->is_compiled_lambda_form(), 114 "a) MT-unsafe modification of inline cache"); 115 assert(jump->jump_destination() == (address)-1 || jump->jump_destination() == entry, 116 "b) MT-unsafe modification of inline cache"); 117 118 // Update stub. 119 method_holder->set_data((intptr_t)callee()); 120 jump->set_jump_destination(entry); 121 122 // Update jump to call. 123 set_destination_mt_safe(stub); 124 } 125 126 void CompiledStaticCall::set_stub_to_clean(static_stub_Relocation* static_stub) { 127 assert (CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "mt unsafe call"); 128 // Reset stub. 129 address stub = static_stub->addr(); 130 assert(stub != NULL, "stub not found"); 131 // Creation also verifies the object. 132 NativeMovConstReg* method_holder = nativeMovConstReg_at(stub + get_IC_pos_in_java_to_interp_stub()); 133 NativeJump* jump = nativeJump_at(method_holder->next_instruction_address()); 134 method_holder->set_data(0); 135 jump->set_jump_destination((address)-1); 136 } 137 138 //----------------------------------------------------------------------------- 139 140 #ifndef PRODUCT 141 142 void CompiledStaticCall::verify() { 143 // Verify call. 144 NativeCall::verify(); 145 if (os::is_MP()) { 146 verify_alignment(); 147 } 148 149 // Verify stub. 150 address stub = find_stub(); 151 assert(stub != NULL, "no stub found for static call"); 152 // Creation also verifies the object. 153 NativeMovConstReg* method_holder = nativeMovConstReg_at(stub + get_IC_pos_in_java_to_interp_stub()); 154 NativeJump* jump = nativeJump_at(method_holder->next_instruction_address()); 155 156 // Verify state. 157 assert(is_clean() || is_call_to_compiled() || is_call_to_interpreted(), "sanity check"); 158 } 159 160 #endif // !PRODUCT | 73 __ z_br(Z_R1); 74 __ end_a_stub(); // Update current stubs pointer and restore insts_end. 75 return stub; 76 #else 77 ShouldNotReachHere(); 78 #endif 79 } 80 81 #undef __ 82 83 int CompiledStaticCall::to_interp_stub_size() { 84 return 2 * MacroAssembler::load_const_from_toc_size() + 85 2; // branch 86 } 87 88 // Relocation entries for call stub, compiled java to interpreter. 89 int CompiledStaticCall::reloc_to_interp_stub() { 90 return 5; // 4 in emit_java_to_interp + 1 in Java_Static_Call 91 } 92 93 void CompiledDirectStaticCall::set_to_interpreted(const methodHandle& callee, address entry) { 94 address stub = find_stub(/*is_aot*/ false); 95 guarantee(stub != NULL, "stub not found"); 96 97 if (TraceICs) { 98 ResourceMark rm; 99 tty->print_cr("CompiledDirectStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s", 100 p2i(instruction_address()), 101 callee->name_and_sig_as_C_string()); 102 } 103 104 // Creation also verifies the object. 105 NativeMovConstReg* method_holder = nativeMovConstReg_at(stub + NativeCall::get_IC_pos_in_java_to_interp_stub()); 106 NativeJump* jump = nativeJump_at(method_holder->next_instruction_address()); 107 108 // A generated lambda form might be deleted from the Lambdaform 109 // cache in MethodTypeForm. If a jit compiled lambdaform method 110 // becomes not entrant and the cache access returns null, the new 111 // resolve will lead to a new generated LambdaForm. 112 113 assert(method_holder->data() == 0 || method_holder->data() == (intptr_t)callee() || callee->is_compiled_lambda_form(), 114 "a) MT-unsafe modification of inline cache"); 115 assert(jump->jump_destination() == (address)-1 || jump->jump_destination() == entry, 116 "b) MT-unsafe modification of inline cache"); 117 118 // Update stub. 119 method_holder->set_data((intptr_t)callee()); 120 jump->set_jump_destination(entry); 121 122 // Update jump to call. 123 set_destination_mt_safe(stub); 124 } 125 126 void CompiledDirectStaticCall::set_stub_to_clean(static_stub_Relocation* static_stub) { 127 assert (CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "mt unsafe call"); 128 // Reset stub. 129 address stub = static_stub->addr(); 130 assert(stub != NULL, "stub not found"); 131 // Creation also verifies the object. 132 NativeMovConstReg* method_holder = nativeMovConstReg_at(stub + NativeCall::get_IC_pos_in_java_to_interp_stub()); 133 NativeJump* jump = nativeJump_at(method_holder->next_instruction_address()); 134 method_holder->set_data(0); 135 jump->set_jump_destination((address)-1); 136 } 137 138 //----------------------------------------------------------------------------- 139 140 #ifndef PRODUCT 141 142 void CompiledDirectStaticCall::verify() { 143 // Verify call. 144 _call->verify(); 145 if (os::is_MP()) { 146 _call->verify_alignment(); 147 } 148 149 // Verify stub. 150 address stub = find_stub(/*is_aot*/ false); 151 assert(stub != NULL, "no stub found for static call"); 152 // Creation also verifies the object. 153 NativeMovConstReg* method_holder = nativeMovConstReg_at(stub + NativeCall::get_IC_pos_in_java_to_interp_stub()); 154 NativeJump* jump = nativeJump_at(method_holder->next_instruction_address()); 155 156 // Verify state. 157 assert(is_clean() || is_call_to_compiled() || is_call_to_interpreted(), "sanity check"); 158 } 159 160 #endif // !PRODUCT |