< prev index next >

src/hotspot/cpu/x86/interp_masm_x86.cpp

Print this page

 309   save_bcp();
 310 #ifdef ASSERT
 311   {
 312     Label L;
 313     cmpptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), NULL_WORD);
 314     jcc(Assembler::equal, L);
 315     stop("InterpreterMacroAssembler::call_VM_base:"
 316          " last_sp isn't null");
 317     bind(L);
 318   }
 319 #endif /* ASSERT */
 320   // super call
 321   MacroAssembler::call_VM_base(oop_result, last_java_sp,
 322                                entry_point, number_of_arguments,
 323                                check_exceptions);
 324   // interpreter specific
 325   restore_bcp();
 326   restore_locals();
 327 }
 328 
 329 void InterpreterMacroAssembler::call_VM_preemptable(Register oop_result,
 330                                                     address entry_point,
 331                                                     Register arg_1) {
 332   assert(arg_1 == c_rarg1, "");
 333   Label resume_pc, not_preempted;
 334 
 335 #ifdef ASSERT
 336   {
 337     Label L;
 338     cmpptr(Address(r15_thread, JavaThread::preempt_alternate_return_offset()), NULL_WORD);
 339     jcc(Assembler::equal, L);
 340     stop("Should not have alternate return address set");
 341     bind(L);
 342   }
 343 #endif /* ASSERT */
 344 
 345   // Force freeze slow path.
 346   push_cont_fastpath();
 347 
 348   // Make VM call. In case of preemption set last_pc to the one we want to resume to.
 349   // Note: call_VM_helper requires last_Java_pc for anchor to be at the top of the stack.
 350   lea(rscratch1, resume_pc);
 351   push(rscratch1);
 352   MacroAssembler::call_VM_helper(oop_result, entry_point, 1, false /*check_exceptions*/);
 353   pop(rscratch1);
 354 
 355   pop_cont_fastpath();
 356 
 357   // Check if preempted.
 358   movptr(rscratch1, Address(r15_thread, JavaThread::preempt_alternate_return_offset()));
 359   cmpptr(rscratch1, NULL_WORD);
 360   jccb(Assembler::zero, not_preempted);
 361   movptr(Address(r15_thread, JavaThread::preempt_alternate_return_offset()), NULL_WORD);
 362   jmp(rscratch1);
 363 
 364   // In case of preemption, this is where we will resume once we finally acquire the monitor.
 365   bind(resume_pc);
 366   restore_after_resume(false /* is_native */);
 367 














 368   bind(not_preempted);
 369 }
 370 































 371 void InterpreterMacroAssembler::restore_after_resume(bool is_native) {
 372   lea(rscratch1, ExternalAddress(Interpreter::cont_resume_interpreter_adapter()));
 373   call(rscratch1);
 374   if (is_native) {
 375     // On resume we need to set up stack as expected.
 376     push(dtos);
 377     push(ltos);
 378   }
 379 }
 380 
 381 void InterpreterMacroAssembler::check_and_handle_popframe() {
 382   if (JvmtiExport::can_pop_frame()) {
 383     Label L;
 384     // Initiate popframe handling only if it is not already being
 385     // processed.  If the flag has the popframe_processing bit set, it
 386     // means that this code is called *during* popframe handling - we
 387     // don't want to reenter.
 388     // This method is only called just after the call into the vm in
 389     // call_VM_base, so the arg registers are available.
 390     Register pop_cond = c_rarg0;

 309   save_bcp();
 310 #ifdef ASSERT
 311   {
 312     Label L;
 313     cmpptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), NULL_WORD);
 314     jcc(Assembler::equal, L);
 315     stop("InterpreterMacroAssembler::call_VM_base:"
 316          " last_sp isn't null");
 317     bind(L);
 318   }
 319 #endif /* ASSERT */
 320   // super call
 321   MacroAssembler::call_VM_base(oop_result, last_java_sp,
 322                                entry_point, number_of_arguments,
 323                                check_exceptions);
 324   // interpreter specific
 325   restore_bcp();
 326   restore_locals();
 327 }
 328 
 329 void InterpreterMacroAssembler::call_VM_preemptable_helper(Register oop_result,
 330                                                            address entry_point,
 331                                                            int number_of_arguments,
 332                                                            bool check_exceptions) {
 333   Label resume_pc, not_preempted;
 334 
 335 #ifdef ASSERT
 336   {
 337     Label L;
 338     cmpptr(Address(r15_thread, JavaThread::preempt_alternate_return_offset()), NULL_WORD);
 339     jcc(Assembler::equal, L);
 340     stop("Should not have alternate return address set");
 341     bind(L);
 342   }
 343 #endif /* ASSERT */
 344 
 345   // Force freeze slow path.
 346   push_cont_fastpath();
 347 
 348   // Make VM call. In case of preemption set last_pc to the one we want to resume to.
 349   // Note: call_VM_helper requires last_Java_pc for anchor to be at the top of the stack.
 350   lea(rscratch1, resume_pc);
 351   push(rscratch1);
 352   MacroAssembler::call_VM_helper(oop_result, entry_point, number_of_arguments, check_exceptions);
 353   pop(rscratch1);
 354 
 355   pop_cont_fastpath();
 356 
 357   // Check if preempted.
 358   movptr(rscratch1, Address(r15_thread, JavaThread::preempt_alternate_return_offset()));
 359   cmpptr(rscratch1, NULL_WORD);
 360   jccb(Assembler::zero, not_preempted);
 361   movptr(Address(r15_thread, JavaThread::preempt_alternate_return_offset()), NULL_WORD);
 362   jmp(rscratch1);
 363 
 364   // In case of preemption, this is where we will resume once we finally acquire the monitor.
 365   bind(resume_pc);
 366   restore_after_resume(false /* is_native */);
 367 
 368   if (check_exceptions) {
 369     // check for pending exceptions (java_thread is set upon return)
 370     cmpptr(Address(r15_thread, Thread::pending_exception_offset()), NULL_WORD);
 371     Label ok;
 372     jcc(Assembler::equal, ok);
 373     jump(RuntimeAddress(StubRoutines::forward_exception_entry()));
 374     bind(ok);
 375   }
 376 
 377   // get oop result if there is one and reset the value in the thread
 378   if (oop_result->is_valid()) {
 379     get_vm_result_oop(oop_result);
 380   }
 381 
 382   bind(not_preempted);
 383 }
 384 
 385 static void pass_arg1(MacroAssembler* masm, Register arg) {
 386   if (c_rarg1 != arg ) {
 387     masm->mov(c_rarg1, arg);
 388   }
 389 }
 390 
 391 static void pass_arg2(MacroAssembler* masm, Register arg) {
 392   if (c_rarg2 != arg ) {
 393     masm->mov(c_rarg2, arg);
 394   }
 395 }
 396 
 397 void InterpreterMacroAssembler::call_VM_preemptable(Register oop_result,
 398                                          address entry_point,
 399                                          Register arg_1,
 400                                          bool check_exceptions) {
 401   pass_arg1(this, arg_1);
 402   call_VM_preemptable_helper(oop_result, entry_point, 1, check_exceptions);
 403 }
 404 
 405 void InterpreterMacroAssembler::call_VM_preemptable(Register oop_result,
 406                                          address entry_point,
 407                                          Register arg_1,
 408                                          Register arg_2,
 409                                          bool check_exceptions) {
 410   LP64_ONLY(assert_different_registers(arg_1, c_rarg2));
 411   pass_arg2(this, arg_2);
 412   pass_arg1(this, arg_1);
 413   call_VM_preemptable_helper(oop_result, entry_point, 2, check_exceptions);
 414 }
 415 
 416 void InterpreterMacroAssembler::restore_after_resume(bool is_native) {
 417   lea(rscratch1, ExternalAddress(Interpreter::cont_resume_interpreter_adapter()));
 418   call(rscratch1);
 419   if (is_native) {
 420     // On resume we need to set up stack as expected.
 421     push(dtos);
 422     push(ltos);
 423   }
 424 }
 425 
 426 void InterpreterMacroAssembler::check_and_handle_popframe() {
 427   if (JvmtiExport::can_pop_frame()) {
 428     Label L;
 429     // Initiate popframe handling only if it is not already being
 430     // processed.  If the flag has the popframe_processing bit set, it
 431     // means that this code is called *during* popframe handling - we
 432     // don't want to reenter.
 433     // This method is only called just after the call into the vm in
 434     // call_VM_base, so the arg registers are available.
 435     Register pop_cond = c_rarg0;
< prev index next >