161 // Used for optimization in Compile::Shorten_branches.
162 int CompiledStaticCall::reloc_to_interp_stub() {
163 return 5;
164 }
165
166 void CompiledDirectStaticCall::set_to_interpreted(const methodHandle& callee, address entry) {
167 address stub = find_stub(/*is_aot*/ false);
168 guarantee(stub != NULL, "stub not found");
169
170 if (TraceICs) {
171 ResourceMark rm;
172 tty->print_cr("CompiledDirectStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s",
173 p2i(instruction_address()),
174 callee->name_and_sig_as_C_string());
175 }
176
177 // Creation also verifies the object.
178 NativeMovConstReg* method_holder = nativeMovConstReg_at(stub + IC_pos_in_java_to_interp_stub);
179 NativeJump* jump = nativeJump_at(method_holder->next_instruction_address());
180
181 #ifdef ASSERT
182 // read the value once
183 volatile intptr_t data = method_holder->data();
184 volatile address destination = jump->jump_destination();
185 assert(data == 0 || data == (intptr_t)callee(),
186 "a) MT-unsafe modification of inline cache");
187 assert(destination == (address)-1 || destination == entry,
188 "b) MT-unsafe modification of inline cache");
189 #endif
190
191 // Update stub.
192 method_holder->set_data((intptr_t)callee());
193 jump->set_jump_destination(entry);
194
195 // Update jump to call.
196 set_destination_mt_safe(stub);
197 }
198
199 void CompiledDirectStaticCall::set_stub_to_clean(static_stub_Relocation* static_stub) {
200 // Reset stub.
201 address stub = static_stub->addr();
202 assert(stub != NULL, "stub not found");
203 assert(CompiledICLocker::is_safe(stub), "mt unsafe call");
204 // Creation also verifies the object.
205 NativeMovConstReg* method_holder = nativeMovConstReg_at(stub + IC_pos_in_java_to_interp_stub);
206 NativeJump* jump = nativeJump_at(method_holder->next_instruction_address());
207 method_holder->set_data(0);
208 jump->set_jump_destination((address)-1);
209 }
|
161 // Used for optimization in Compile::Shorten_branches.
162 int CompiledStaticCall::reloc_to_interp_stub() {
163 return 5;
164 }
165
166 void CompiledDirectStaticCall::set_to_interpreted(const methodHandle& callee, address entry) {
167 address stub = find_stub(/*is_aot*/ false);
168 guarantee(stub != NULL, "stub not found");
169
170 if (TraceICs) {
171 ResourceMark rm;
172 tty->print_cr("CompiledDirectStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s",
173 p2i(instruction_address()),
174 callee->name_and_sig_as_C_string());
175 }
176
177 // Creation also verifies the object.
178 NativeMovConstReg* method_holder = nativeMovConstReg_at(stub + IC_pos_in_java_to_interp_stub);
179 NativeJump* jump = nativeJump_at(method_holder->next_instruction_address());
180
181 verify_mt_safe(callee, entry, method_holder, jump);
182
183 // Update stub.
184 method_holder->set_data((intptr_t)callee());
185 jump->set_jump_destination(entry);
186
187 // Update jump to call.
188 set_destination_mt_safe(stub);
189 }
190
191 void CompiledDirectStaticCall::set_stub_to_clean(static_stub_Relocation* static_stub) {
192 // Reset stub.
193 address stub = static_stub->addr();
194 assert(stub != NULL, "stub not found");
195 assert(CompiledICLocker::is_safe(stub), "mt unsafe call");
196 // Creation also verifies the object.
197 NativeMovConstReg* method_holder = nativeMovConstReg_at(stub + IC_pos_in_java_to_interp_stub);
198 NativeJump* jump = nativeJump_at(method_holder->next_instruction_address());
199 method_holder->set_data(0);
200 jump->set_jump_destination((address)-1);
201 }
|