src/cpu/x86/vm/sharedRuntime_x86_32.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot Sdiff src/cpu/x86/vm

src/cpu/x86/vm/sharedRuntime_x86_32.cpp

Print this page




 717 
 718 
 719 static void move_i2c_double(MacroAssembler *masm, XMMRegister r, Register saved_sp, int ld_off) {
 720   int next_val_off = ld_off - Interpreter::stackElementSize;
 721   __ movdbl(r, Address(saved_sp, next_val_off));
 722 }
 723 
 724 static void range_check(MacroAssembler* masm, Register pc_reg, Register temp_reg,
 725                         address code_start, address code_end,
 726                         Label& L_ok) {
 727   Label L_fail;
 728   __ lea(temp_reg, ExternalAddress(code_start));
 729   __ cmpptr(pc_reg, temp_reg);
 730   __ jcc(Assembler::belowEqual, L_fail);
 731   __ lea(temp_reg, ExternalAddress(code_end));
 732   __ cmpptr(pc_reg, temp_reg);
 733   __ jcc(Assembler::below, L_ok);
 734   __ bind(L_fail);
 735 }
 736 
 737 static void gen_i2c_adapter(MacroAssembler *masm,
 738                             int total_args_passed,
 739                             int comp_args_on_stack,
 740                             const BasicType *sig_bt,
 741                             const VMRegPair *regs) {
 742 
 743   // Note: rsi contains the senderSP on entry. We must preserve it since
 744   // we may do a i2c -> c2i transition if we lose a race where compiled
 745   // code goes non-entrant while we get args ready.
 746 
 747   // Adapters can be frameless because they do not require the caller
 748   // to perform additional cleanup work, such as correcting the stack pointer.
 749   // An i2c adapter is frameless because the *caller* frame, which is interpreted,
 750   // routinely repairs its own stack pointer (from interpreter_frame_last_sp),
 751   // even if a callee has modified the stack pointer.
 752   // A c2i adapter is frameless because the *callee* frame, which is interpreted,
 753   // routinely repairs its caller's stack pointer (from sender_sp, which is set
 754   // up via the senderSP register).
 755   // In other words, if *either* the caller or callee is interpreted, we can
 756   // get the stack pointer repaired after a call.
 757   // This is why c2i and i2c adapters cannot be indefinitely composed.
 758   // In particular, if a c2i adapter were to somehow call an i2c adapter,
 759   // both caller and callee would be compiled methods, and neither would
 760   // clean up the stack pointer changes performed by the two adapters.
 761   // If this happens, control eventually transfers back to the compiled
 762   // caller, but with an uncorrected stack, causing delayed havoc.




 717 
 718 
 719 static void move_i2c_double(MacroAssembler *masm, XMMRegister r, Register saved_sp, int ld_off) {
 720   int next_val_off = ld_off - Interpreter::stackElementSize;
 721   __ movdbl(r, Address(saved_sp, next_val_off));
 722 }
 723 
 724 static void range_check(MacroAssembler* masm, Register pc_reg, Register temp_reg,
 725                         address code_start, address code_end,
 726                         Label& L_ok) {
 727   Label L_fail;
 728   __ lea(temp_reg, ExternalAddress(code_start));
 729   __ cmpptr(pc_reg, temp_reg);
 730   __ jcc(Assembler::belowEqual, L_fail);
 731   __ lea(temp_reg, ExternalAddress(code_end));
 732   __ cmpptr(pc_reg, temp_reg);
 733   __ jcc(Assembler::below, L_ok);
 734   __ bind(L_fail);
 735 }
 736 
 737 void SharedRuntime::gen_i2c_adapter(MacroAssembler *masm,
 738                                     int total_args_passed,
 739                                     int comp_args_on_stack,
 740                                     const BasicType *sig_bt,
 741                                     const VMRegPair *regs) {

 742   // Note: rsi contains the senderSP on entry. We must preserve it since
 743   // we may do a i2c -> c2i transition if we lose a race where compiled
 744   // code goes non-entrant while we get args ready.
 745 
 746   // Adapters can be frameless because they do not require the caller
 747   // to perform additional cleanup work, such as correcting the stack pointer.
 748   // An i2c adapter is frameless because the *caller* frame, which is interpreted,
 749   // routinely repairs its own stack pointer (from interpreter_frame_last_sp),
 750   // even if a callee has modified the stack pointer.
 751   // A c2i adapter is frameless because the *callee* frame, which is interpreted,
 752   // routinely repairs its caller's stack pointer (from sender_sp, which is set
 753   // up via the senderSP register).
 754   // In other words, if *either* the caller or callee is interpreted, we can
 755   // get the stack pointer repaired after a call.
 756   // This is why c2i and i2c adapters cannot be indefinitely composed.
 757   // In particular, if a c2i adapter were to somehow call an i2c adapter,
 758   // both caller and callee would be compiled methods, and neither would
 759   // clean up the stack pointer changes performed by the two adapters.
 760   // If this happens, control eventually transfers back to the compiled
 761   // caller, but with an uncorrected stack, causing delayed havoc.


src/cpu/x86/vm/sharedRuntime_x86_32.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File