< prev index next >

src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp

Print this page




 808   // Put saved SP in another register
 809   const Register saved_sp = rax;
 810   __ movptr(saved_sp, r11);
 811 
 812   // Will jump to the compiled code just as if compiled code was doing it.
 813   // Pre-load the register-jump target early, to schedule it better.
 814   __ movptr(r11, Address(rbx, in_bytes(Method::from_compiled_offset())));
 815 
 816 #if INCLUDE_JVMCI
 817   if (EnableJVMCI || UseAOT) {
 818     // check if this call should be routed towards a specific entry point
 819     __ cmpptr(Address(r15_thread, in_bytes(JavaThread::jvmci_alternate_call_target_offset())), 0);
 820     Label no_alternative_target;
 821     __ jcc(Assembler::equal, no_alternative_target);
 822     __ movptr(r11, Address(r15_thread, in_bytes(JavaThread::jvmci_alternate_call_target_offset())));
 823     __ movptr(Address(r15_thread, in_bytes(JavaThread::jvmci_alternate_call_target_offset())), 0);
 824     __ bind(no_alternative_target);
 825   }
 826 #endif // INCLUDE_JVMCI
 827 


 828   // Now generate the shuffle code.  Pick up all register args and move the
 829   // rest through the floating point stack top.
 830   for (int i = 0; i < total_args_passed; i++) {
 831     if (sig_bt[i] == T_VOID) {
 832       // Longs and doubles are passed in native word order, but misaligned
 833       // in the 32-bit build.
 834       assert(i > 0 && (sig_bt[i-1] == T_LONG || sig_bt[i-1] == T_DOUBLE), "missing half");
 835       continue;
 836     }
 837 
 838     // Pick up 0, 1 or 2 words from SP+offset.
 839 
 840     assert(!regs[i].second()->is_valid() || regs[i].first()->next() == regs[i].second(),
 841             "scrambled load targets?");
 842     // Load in argument order going down.
 843     int ld_off = (total_args_passed - i)*Interpreter::stackElementSize;
 844     // Point to interpreter value (vs. tag)
 845     int next_off = ld_off - Interpreter::stackElementSize;
 846     //
 847     //


3463 
3464   if (UseRTMLocking) {
3465     // Abort RTM transaction before calling runtime
3466     // because critical section will be large and will be
3467     // aborted anyway. Also nmethod could be deoptimized.
3468     __ xabort(0);
3469   }
3470 
3471   // Make room for return address (or push it again)
3472   if (!cause_return) {
3473     __ push(rbx);
3474   }
3475 
3476   // Save registers, fpu state, and flags
3477   map = RegisterSaver::save_live_registers(masm, 0, &frame_size_in_words, save_vectors);
3478 
3479   // The following is basically a call_VM.  However, we need the precise
3480   // address of the call in order to generate an oopmap. Hence, we do all the
3481   // work outselves.
3482 
3483   __ set_last_Java_frame(noreg, noreg, NULL);
3484 
3485   // The return address must always be correct so that frame constructor never
3486   // sees an invalid pc.
3487 
3488   if (!cause_return) {
3489     // Get the return pc saved by the signal handler and stash it in its appropriate place on the stack.
3490     // Additionally, rbx is a callee saved register and we can look at it later to determine
3491     // if someone changed the return address for us!
3492     __ movptr(rbx, Address(r15_thread, JavaThread::saved_exception_pc_offset()));
3493     __ movptr(Address(rbp, wordSize), rbx);
3494   }
3495 
3496   // Do the call
3497   __ mov(c_rarg0, r15_thread);
3498   __ call(RuntimeAddress(call_ptr));
3499 
3500   // Set an oopmap for the call site.  This oopmap will map all
3501   // oop-registers and debug-info registers as callee-saved.  This
3502   // will allow deoptimization at this safepoint to find all possible
3503   // debug-info recordings, as well as let GC find all oops.


3609 // but since this is generic code we don't know what they are and the caller
3610 // must do any gc of the args.
3611 //
3612 RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const char* name) {
3613   assert (StubRoutines::forward_exception_entry() != NULL, "must be generated before");
3614 
3615   // allocate space for the code
3616   ResourceMark rm;
3617 
3618   CodeBuffer buffer(name, 1000, 512);
3619   MacroAssembler* masm                = new MacroAssembler(&buffer);
3620 
3621   int frame_size_in_words;
3622 
3623   OopMapSet *oop_maps = new OopMapSet();
3624   OopMap* map = NULL;
3625 
3626   int start = __ offset();
3627 
3628   map = RegisterSaver::save_live_registers(masm, 0, &frame_size_in_words);


3629 
3630   int frame_complete = __ offset();
3631 
3632   __ set_last_Java_frame(noreg, noreg, NULL);
3633 
3634   __ mov(c_rarg0, r15_thread);
3635 
3636   __ call(RuntimeAddress(destination));
3637 
3638 
3639   // Set an oopmap for the call site.
3640   // We need this not only for callee-saved registers, but also for volatile
3641   // registers that the compiler might be keeping live across a safepoint.
3642 
3643   oop_maps->add_gc_map( __ offset() - start, map);
3644 
3645   // rax contains the address we are going to jump to assuming no exception got installed
3646 
3647   // clear last_Java_sp
3648   __ reset_last_Java_frame(false);




 808   // Put saved SP in another register
 809   const Register saved_sp = rax;
 810   __ movptr(saved_sp, r11);
 811 
 812   // Will jump to the compiled code just as if compiled code was doing it.
 813   // Pre-load the register-jump target early, to schedule it better.
 814   __ movptr(r11, Address(rbx, in_bytes(Method::from_compiled_offset())));
 815 
 816 #if INCLUDE_JVMCI
 817   if (EnableJVMCI || UseAOT) {
 818     // check if this call should be routed towards a specific entry point
 819     __ cmpptr(Address(r15_thread, in_bytes(JavaThread::jvmci_alternate_call_target_offset())), 0);
 820     Label no_alternative_target;
 821     __ jcc(Assembler::equal, no_alternative_target);
 822     __ movptr(r11, Address(r15_thread, in_bytes(JavaThread::jvmci_alternate_call_target_offset())));
 823     __ movptr(Address(r15_thread, in_bytes(JavaThread::jvmci_alternate_call_target_offset())), 0);
 824     __ bind(no_alternative_target);
 825   }
 826 #endif // INCLUDE_JVMCI
 827 
 828   __ set_cont_fastpath(r15_thread, 0);
 829 
 830   // Now generate the shuffle code.  Pick up all register args and move the
 831   // rest through the floating point stack top.
 832   for (int i = 0; i < total_args_passed; i++) {
 833     if (sig_bt[i] == T_VOID) {
 834       // Longs and doubles are passed in native word order, but misaligned
 835       // in the 32-bit build.
 836       assert(i > 0 && (sig_bt[i-1] == T_LONG || sig_bt[i-1] == T_DOUBLE), "missing half");
 837       continue;
 838     }
 839 
 840     // Pick up 0, 1 or 2 words from SP+offset.
 841 
 842     assert(!regs[i].second()->is_valid() || regs[i].first()->next() == regs[i].second(),
 843             "scrambled load targets?");
 844     // Load in argument order going down.
 845     int ld_off = (total_args_passed - i)*Interpreter::stackElementSize;
 846     // Point to interpreter value (vs. tag)
 847     int next_off = ld_off - Interpreter::stackElementSize;
 848     //
 849     //


3465 
3466   if (UseRTMLocking) {
3467     // Abort RTM transaction before calling runtime
3468     // because critical section will be large and will be
3469     // aborted anyway. Also nmethod could be deoptimized.
3470     __ xabort(0);
3471   }
3472 
3473   // Make room for return address (or push it again)
3474   if (!cause_return) {
3475     __ push(rbx);
3476   }
3477 
3478   // Save registers, fpu state, and flags
3479   map = RegisterSaver::save_live_registers(masm, 0, &frame_size_in_words, save_vectors);
3480 
3481   // The following is basically a call_VM.  However, we need the precise
3482   // address of the call in order to generate an oopmap. Hence, we do all the
3483   // work outselves.
3484 
3485   __ set_last_Java_frame(noreg, noreg, NULL);  // JavaFrameAnchor::capture_last_Java_pc() will get the pc from the return address, which we store next:
3486 
3487   // The return address must always be correct so that frame constructor never
3488   // sees an invalid pc.
3489 
3490   if (!cause_return) {
3491     // Get the return pc saved by the signal handler and stash it in its appropriate place on the stack.
3492     // Additionally, rbx is a callee saved register and we can look at it later to determine
3493     // if someone changed the return address for us!
3494     __ movptr(rbx, Address(r15_thread, JavaThread::saved_exception_pc_offset()));
3495     __ movptr(Address(rbp, wordSize), rbx);
3496   }
3497 
3498   // Do the call
3499   __ mov(c_rarg0, r15_thread);
3500   __ call(RuntimeAddress(call_ptr));
3501 
3502   // Set an oopmap for the call site.  This oopmap will map all
3503   // oop-registers and debug-info registers as callee-saved.  This
3504   // will allow deoptimization at this safepoint to find all possible
3505   // debug-info recordings, as well as let GC find all oops.


3611 // but since this is generic code we don't know what they are and the caller
3612 // must do any gc of the args.
3613 //
3614 RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const char* name) {
3615   assert (StubRoutines::forward_exception_entry() != NULL, "must be generated before");
3616 
3617   // allocate space for the code
3618   ResourceMark rm;
3619 
3620   CodeBuffer buffer(name, 1000, 512);
3621   MacroAssembler* masm                = new MacroAssembler(&buffer);
3622 
3623   int frame_size_in_words;
3624 
3625   OopMapSet *oop_maps = new OopMapSet();
3626   OopMap* map = NULL;
3627 
3628   int start = __ offset();
3629 
3630   map = RegisterSaver::save_live_registers(masm, 0, &frame_size_in_words);
3631 
3632   // __ stop_if_in_cont(r10, "CONT 3");
3633 
3634   int frame_complete = __ offset();
3635 
3636   __ set_last_Java_frame(noreg, noreg, NULL);
3637 
3638   __ mov(c_rarg0, r15_thread);
3639 
3640   __ call(RuntimeAddress(destination));
3641 
3642 
3643   // Set an oopmap for the call site.
3644   // We need this not only for callee-saved registers, but also for volatile
3645   // registers that the compiler might be keeping live across a safepoint.
3646 
3647   oop_maps->add_gc_map( __ offset() - start, map);
3648 
3649   // rax contains the address we are going to jump to assuming no exception got installed
3650 
3651   // clear last_Java_sp
3652   __ reset_last_Java_frame(false);


< prev index next >