145 } else { 146 return 0; 147 } 148 } 149 #endif // INCLUDE_AOT 150 151 void CompiledDirectStaticCall::set_to_interpreted(const methodHandle& callee, address entry) { 152 address stub = find_stub(false /* is_aot */); 153 guarantee(stub != NULL, "stub not found"); 154 155 if (TraceICs) { 156 ResourceMark rm; 157 tty->print_cr("CompiledDirectStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s", 158 p2i(instruction_address()), 159 callee->name_and_sig_as_C_string()); 160 } 161 162 // Creation also verifies the object. 163 NativeMovConstReg* method_holder 164 = nativeMovConstReg_at(stub + NativeInstruction::instruction_size); 165 #ifndef PRODUCT 166 NativeGeneralJump* jump = nativeGeneralJump_at(method_holder->next_instruction_address()); 167 168 // read the value once 169 volatile intptr_t data = method_holder->data(); 170 assert(data == 0 || data == (intptr_t)callee(), 171 "a) MT-unsafe modification of inline cache"); 172 assert(data == 0 || jump->jump_destination() == entry, 173 "b) MT-unsafe modification of inline cache"); 174 #endif 175 // Update stub. 176 method_holder->set_data((intptr_t)callee()); 177 NativeGeneralJump::insert_unconditional(method_holder->next_instruction_address(), entry); 178 ICache::invalidate_range(stub, to_interp_stub_size()); 179 // Update jump to call. 180 set_destination_mt_safe(stub); 181 } 182 183 void CompiledDirectStaticCall::set_stub_to_clean(static_stub_Relocation* static_stub) { 184 // Reset stub. 185 address stub = static_stub->addr(); 186 assert(stub != NULL, "stub not found"); 187 assert(CompiledICLocker::is_safe(stub), "mt unsafe call"); 188 // Creation also verifies the object. 189 NativeMovConstReg* method_holder 190 = nativeMovConstReg_at(stub + NativeInstruction::instruction_size); 191 method_holder->set_data(0); 192 } 193 194 //----------------------------------------------------------------------------- | 145 } else { 146 return 0; 147 } 148 } 149 #endif // INCLUDE_AOT 150 151 void CompiledDirectStaticCall::set_to_interpreted(const methodHandle& callee, address entry) { 152 address stub = find_stub(false /* is_aot */); 153 guarantee(stub != NULL, "stub not found"); 154 155 if (TraceICs) { 156 ResourceMark rm; 157 tty->print_cr("CompiledDirectStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s", 158 p2i(instruction_address()), 159 callee->name_and_sig_as_C_string()); 160 } 161 162 // Creation also verifies the object. 163 NativeMovConstReg* method_holder 164 = nativeMovConstReg_at(stub + NativeInstruction::instruction_size); 165 166 #ifdef ASSERT 167 NativeGeneralJump* jump = nativeGeneralJump_at(method_holder->next_instruction_address()); 168 169 // A generated lambda form might be deleted from the Lambdaform 170 // cache in MethodTypeForm. If a jit compiled lambdaform method 171 // becomes not entrant and the cache access returns null, the new 172 // resolve will lead to a new generated LambdaForm. 173 Method* volatile old_method = reinterpret_cast<Method*>(method_holder->data()); 174 assert(old_method == NULL || old_method == callee() || 175 callee->is_compiled_lambda_form() || 176 !old_method->method_holder()->is_loader_alive() || 177 old_method->is_old(), // may be race patching deoptimized nmethod due to redefinition. 178 "a) MT-unsafe modification of inline cache"); 179 180 volatile address destination = jump->jump_destination(); 181 assert(destination == (address)-1 || destination == entry, 182 "b) MT-unsafe modification of inline cache"); 183 #endif 184 185 // Update stub. 186 method_holder->set_data((intptr_t)callee()); 187 NativeGeneralJump::insert_unconditional(method_holder->next_instruction_address(), entry); 188 ICache::invalidate_range(stub, to_interp_stub_size()); 189 // Update jump to call. 190 set_destination_mt_safe(stub); 191 } 192 193 void CompiledDirectStaticCall::set_stub_to_clean(static_stub_Relocation* static_stub) { 194 // Reset stub. 195 address stub = static_stub->addr(); 196 assert(stub != NULL, "stub not found"); 197 assert(CompiledICLocker::is_safe(stub), "mt unsafe call"); 198 // Creation also verifies the object. 199 NativeMovConstReg* method_holder 200 = nativeMovConstReg_at(stub + NativeInstruction::instruction_size); 201 method_holder->set_data(0); 202 } 203 204 //----------------------------------------------------------------------------- |