100 int CompiledStaticCall::to_interp_stub_size() { 101 return 8 * NativeInstruction::instruction_size; 102 } 103 104 void CompiledDirectStaticCall::set_to_interpreted(const methodHandle& callee, address entry) { 105 address stub = find_stub(/*is_aot*/ false); 106 guarantee(stub != NULL, "stub not found"); 107 108 if (TraceICs) { 109 ResourceMark rm; 110 tty->print_cr("CompiledDirectStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s", 111 p2i(instruction_address()), 112 callee->name_and_sig_as_C_string()); 113 } 114 115 // Creation also verifies the object. 116 NativeMovConstReg* method_holder = nativeMovConstReg_at(stub); 117 NativeJump* jump = nativeJump_at(method_holder->next_instruction_address()); 118 119 #ifdef ASSERT 120 // read the value once 121 volatile intptr_t data = method_holder->data(); 122 volatile address destination = jump->jump_destination(); 123 assert(data == 0 || data == (intptr_t)callee(), 124 "a) MT-unsafe modification of inline cache"); 125 assert(destination == (address)-1 || destination == entry, 126 "b) MT-unsafe modification of inline cache"); 127 #endif 128 129 // Update stub. 130 method_holder->set_data((intptr_t)callee()); 131 jump->set_jump_destination(entry); 132 133 ICache::invalidate_range(stub, to_interp_stub_size()); 134 135 // Update jump to call. 136 set_destination_mt_safe(stub); 137 } 138 139 void CompiledDirectStaticCall::set_stub_to_clean(static_stub_Relocation* static_stub) { 140 // Reset stub. 141 address stub = static_stub->addr(); 142 assert(stub != NULL, "stub not found"); 143 assert(CompiledICLocker::is_safe(stub), "mt unsafe call"); 144 // Creation also verifies the object. | 100 int CompiledStaticCall::to_interp_stub_size() { 101 return 8 * NativeInstruction::instruction_size; 102 } 103 104 void CompiledDirectStaticCall::set_to_interpreted(const methodHandle& callee, address entry) { 105 address stub = find_stub(/*is_aot*/ false); 106 guarantee(stub != NULL, "stub not found"); 107 108 if (TraceICs) { 109 ResourceMark rm; 110 tty->print_cr("CompiledDirectStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s", 111 p2i(instruction_address()), 112 callee->name_and_sig_as_C_string()); 113 } 114 115 // Creation also verifies the object. 116 NativeMovConstReg* method_holder = nativeMovConstReg_at(stub); 117 NativeJump* jump = nativeJump_at(method_holder->next_instruction_address()); 118 119 #ifdef ASSERT 120 // A generated lambda form might be deleted from the Lambdaform 121 // cache in MethodTypeForm. If a jit compiled lambdaform method 122 // becomes not entrant and the cache access returns null, the new 123 // resolve will lead to a new generated LambdaForm. 124 Method* old_method = reinterpret_cast<Method*>(method_holder->data()); 125 assert(old_method == NULL || old_method == callee() || 126 callee->is_compiled_lambda_form() || 127 !old_method->method_holder()->is_loader_alive() || 128 old_method->is_old(), // may be race patching deoptimized nmethod due to redefinition. 129 "a) MT-unsafe modification of inline cache"); 130 131 address destination = jump->jump_destination(); 132 assert(destination == (address)-1 || destination == entry, 133 "b) MT-unsafe modification of inline cache"); 134 #endif 135 136 // Update stub. 137 method_holder->set_data((intptr_t)callee()); 138 jump->set_jump_destination(entry); 139 140 ICache::invalidate_range(stub, to_interp_stub_size()); 141 142 // Update jump to call. 143 set_destination_mt_safe(stub); 144 } 145 146 void CompiledDirectStaticCall::set_stub_to_clean(static_stub_Relocation* static_stub) { 147 // Reset stub. 148 address stub = static_stub->addr(); 149 assert(stub != NULL, "stub not found"); 150 assert(CompiledICLocker::is_safe(stub), "mt unsafe call"); 151 // Creation also verifies the object. |