220 __ movl(flags, Address(cache, index, Address::times_ptr, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset()));
221 __ andl(flags, ConstantPoolCacheEntry::parameter_size_mask);
222 __ lea(rsp, Address(rsp, flags, Interpreter::stackElementScale()));
223
224 const Register java_thread = NOT_LP64(rcx) LP64_ONLY(r15_thread);
225 if (JvmtiExport::can_pop_frame()) {
226 NOT_LP64(__ get_thread(java_thread));
227 __ check_and_handle_popframe(java_thread);
228 }
229 if (JvmtiExport::can_force_early_return()) {
230 NOT_LP64(__ get_thread(java_thread));
231 __ check_and_handle_earlyret(java_thread);
232 }
233
234 __ dispatch_next(state, step);
235
236 return entry;
237 }
238
239
240 address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state, int step) {
241 address entry = __ pc();
242
243 #ifndef _LP64
244 if (state == ftos) {
245 __ MacroAssembler::verify_FPU(UseSSE >= 1 ? 0 : 1, "generate_deopt_entry_for in interpreter");
246 } else if (state == dtos) {
247 __ MacroAssembler::verify_FPU(UseSSE >= 2 ? 0 : 1, "generate_deopt_entry_for in interpreter");
248 }
249 #endif // _LP64
250
251 // NULL last_sp until next java call
252 __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD);
253 __ restore_bcp();
254 __ restore_locals();
255 const Register thread = NOT_LP64(rcx) LP64_ONLY(r15_thread);
256 NOT_LP64(__ get_thread(thread));
257 #if INCLUDE_JVMCI
258 // Check if we need to take lock at entry of synchronized method. This can
259 // only occur on method entry so emit it only for vtos with step 0.
260 if ((UseJVMCICompiler || UseAOT) && state == vtos && step == 0) {
274 Label L;
275 __ cmpb(Address(r15_thread, JavaThread::pending_monitorenter_offset()), 0);
276 __ jccb(Assembler::zero, L);
277 __ stop("unexpected pending monitor in deopt entry");
278 __ bind(L);
279 }
280 #endif
281 }
282 #endif
283 // handle exceptions
284 {
285 Label L;
286 __ cmpptr(Address(thread, Thread::pending_exception_offset()), (int32_t) NULL_WORD);
287 __ jcc(Assembler::zero, L);
288 __ call_VM(noreg,
289 CAST_FROM_FN_PTR(address,
290 InterpreterRuntime::throw_pending_exception));
291 __ should_not_reach_here();
292 __ bind(L);
293 }
294 __ dispatch_next(state, step);
295 return entry;
296 }
297
298 address TemplateInterpreterGenerator::generate_result_handler_for(
299 BasicType type) {
300 address entry = __ pc();
301 switch (type) {
302 case T_BOOLEAN: __ c2bool(rax); break;
303 #ifndef _LP64
304 case T_CHAR : __ andptr(rax, 0xFFFF); break;
305 #else
306 case T_CHAR : __ movzwl(rax, rax); break;
307 #endif // _LP64
308 case T_BYTE : __ sign_extend_byte(rax); break;
309 case T_SHORT : __ sign_extend_short(rax); break;
310 case T_INT : /* nothing to do */ break;
311 case T_LONG : /* nothing to do */ break;
312 case T_VOID : /* nothing to do */ break;
313 #ifndef _LP64
314 case T_DOUBLE :
|
220 __ movl(flags, Address(cache, index, Address::times_ptr, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset()));
221 __ andl(flags, ConstantPoolCacheEntry::parameter_size_mask);
222 __ lea(rsp, Address(rsp, flags, Interpreter::stackElementScale()));
223
224 const Register java_thread = NOT_LP64(rcx) LP64_ONLY(r15_thread);
225 if (JvmtiExport::can_pop_frame()) {
226 NOT_LP64(__ get_thread(java_thread));
227 __ check_and_handle_popframe(java_thread);
228 }
229 if (JvmtiExport::can_force_early_return()) {
230 NOT_LP64(__ get_thread(java_thread));
231 __ check_and_handle_earlyret(java_thread);
232 }
233
234 __ dispatch_next(state, step);
235
236 return entry;
237 }
238
239
240 address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state, int step, address continuation) {
241 address entry = __ pc();
242
243 #ifndef _LP64
244 if (state == ftos) {
245 __ MacroAssembler::verify_FPU(UseSSE >= 1 ? 0 : 1, "generate_deopt_entry_for in interpreter");
246 } else if (state == dtos) {
247 __ MacroAssembler::verify_FPU(UseSSE >= 2 ? 0 : 1, "generate_deopt_entry_for in interpreter");
248 }
249 #endif // _LP64
250
251 // NULL last_sp until next java call
252 __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD);
253 __ restore_bcp();
254 __ restore_locals();
255 const Register thread = NOT_LP64(rcx) LP64_ONLY(r15_thread);
256 NOT_LP64(__ get_thread(thread));
257 #if INCLUDE_JVMCI
258 // Check if we need to take lock at entry of synchronized method. This can
259 // only occur on method entry so emit it only for vtos with step 0.
260 if ((UseJVMCICompiler || UseAOT) && state == vtos && step == 0) {
274 Label L;
275 __ cmpb(Address(r15_thread, JavaThread::pending_monitorenter_offset()), 0);
276 __ jccb(Assembler::zero, L);
277 __ stop("unexpected pending monitor in deopt entry");
278 __ bind(L);
279 }
280 #endif
281 }
282 #endif
283 // handle exceptions
284 {
285 Label L;
286 __ cmpptr(Address(thread, Thread::pending_exception_offset()), (int32_t) NULL_WORD);
287 __ jcc(Assembler::zero, L);
288 __ call_VM(noreg,
289 CAST_FROM_FN_PTR(address,
290 InterpreterRuntime::throw_pending_exception));
291 __ should_not_reach_here();
292 __ bind(L);
293 }
294 if (continuation == NULL) {
295 __ dispatch_next(state, step);
296 } else {
297 __ jump_to_entry(continuation);
298 }
299 return entry;
300 }
301
302 address TemplateInterpreterGenerator::generate_result_handler_for(
303 BasicType type) {
304 address entry = __ pc();
305 switch (type) {
306 case T_BOOLEAN: __ c2bool(rax); break;
307 #ifndef _LP64
308 case T_CHAR : __ andptr(rax, 0xFFFF); break;
309 #else
310 case T_CHAR : __ movzwl(rax, rax); break;
311 #endif // _LP64
312 case T_BYTE : __ sign_extend_byte(rax); break;
313 case T_SHORT : __ sign_extend_short(rax); break;
314 case T_INT : /* nothing to do */ break;
315 case T_LONG : /* nothing to do */ break;
316 case T_VOID : /* nothing to do */ break;
317 #ifndef _LP64
318 case T_DOUBLE :
|