33 #include "oops/method.hpp" |
33 #include "oops/method.hpp" |
34 #include "prims/jvmtiExport.hpp" |
34 #include "prims/jvmtiExport.hpp" |
35 #include "prims/jvmtiThreadState.hpp" |
35 #include "prims/jvmtiThreadState.hpp" |
36 #include "runtime/basicLock.hpp" |
36 #include "runtime/basicLock.hpp" |
37 #include "runtime/biasedLocking.hpp" |
37 #include "runtime/biasedLocking.hpp" |
|
38 #include "runtime/safepointMechanism.hpp" |
38 #include "runtime/sharedRuntime.hpp" |
39 #include "runtime/sharedRuntime.hpp" |
39 #include "runtime/thread.inline.hpp" |
40 #include "runtime/thread.inline.hpp" |
40 |
41 |
41 // Implementation of InterpreterMacroAssembler |
42 // Implementation of InterpreterMacroAssembler |
42 |
43 |
807 dispatch_next(state, step); |
808 dispatch_next(state, step); |
808 } |
809 } |
809 |
810 |
810 void InterpreterMacroAssembler::dispatch_base(TosState state, |
811 void InterpreterMacroAssembler::dispatch_base(TosState state, |
811 address* table, |
812 address* table, |
812 bool verifyoop) { |
813 bool verifyoop, |
|
814 bool generate_poll) { |
813 verify_FPU(1, state); |
815 verify_FPU(1, state); |
814 if (VerifyActivationFrameSize) { |
816 if (VerifyActivationFrameSize) { |
815 Label L; |
817 Label L; |
816 mov(rcx, rbp); |
818 mov(rcx, rbp); |
817 subptr(rcx, rsp); |
819 subptr(rcx, rsp); |
825 } |
827 } |
826 if (verifyoop) { |
828 if (verifyoop) { |
827 verify_oop(rax, state); |
829 verify_oop(rax, state); |
828 } |
830 } |
829 #ifdef _LP64 |
831 #ifdef _LP64 |
|
832 |
|
833 Label no_safepoint, dispatch; |
|
834 address* const safepoint_table = Interpreter::safept_table(state); |
|
835 if (SafepointMechanism::uses_thread_local_poll() && table != safepoint_table && generate_poll) { |
|
836 NOT_PRODUCT(block_comment("Thread-local Safepoint poll")); |
|
837 |
|
838 testb(Address(r15_thread, Thread::polling_page_offset()), SafepointMechanism::poll_bit()); |
|
839 |
|
840 jccb(Assembler::zero, no_safepoint); |
|
841 lea(rscratch1, ExternalAddress((address)safepoint_table)); |
|
842 jmpb(dispatch); |
|
843 } |
|
844 |
|
845 bind(no_safepoint); |
830 lea(rscratch1, ExternalAddress((address)table)); |
846 lea(rscratch1, ExternalAddress((address)table)); |
|
847 bind(dispatch); |
831 jmp(Address(rscratch1, rbx, Address::times_8)); |
848 jmp(Address(rscratch1, rbx, Address::times_8)); |
|
849 |
832 #else |
850 #else |
833 Address index(noreg, rbx, Address::times_ptr); |
851 Address index(noreg, rbx, Address::times_ptr); |
834 ExternalAddress tbl((address)table); |
852 ExternalAddress tbl((address)table); |
835 ArrayAddress dispatch(tbl, index); |
853 ArrayAddress dispatch(tbl, index); |
836 jump(dispatch); |
854 jump(dispatch); |
837 #endif // _LP64 |
855 #endif // _LP64 |
838 } |
856 } |
839 |
857 |
840 void InterpreterMacroAssembler::dispatch_only(TosState state) { |
858 void InterpreterMacroAssembler::dispatch_only(TosState state, bool generate_poll) { |
841 dispatch_base(state, Interpreter::dispatch_table(state)); |
859 dispatch_base(state, Interpreter::dispatch_table(state), true, generate_poll); |
842 } |
860 } |
843 |
861 |
844 void InterpreterMacroAssembler::dispatch_only_normal(TosState state) { |
862 void InterpreterMacroAssembler::dispatch_only_normal(TosState state) { |
845 dispatch_base(state, Interpreter::normal_table(state)); |
863 dispatch_base(state, Interpreter::normal_table(state)); |
846 } |
864 } |
848 void InterpreterMacroAssembler::dispatch_only_noverify(TosState state) { |
866 void InterpreterMacroAssembler::dispatch_only_noverify(TosState state) { |
849 dispatch_base(state, Interpreter::normal_table(state), false); |
867 dispatch_base(state, Interpreter::normal_table(state), false); |
850 } |
868 } |
851 |
869 |
852 |
870 |
853 void InterpreterMacroAssembler::dispatch_next(TosState state, int step) { |
871 void InterpreterMacroAssembler::dispatch_next(TosState state, int step, bool generate_poll) { |
854 // load next bytecode (load before advancing _bcp_register to prevent AGI) |
872 // load next bytecode (load before advancing _bcp_register to prevent AGI) |
855 load_unsigned_byte(rbx, Address(_bcp_register, step)); |
873 load_unsigned_byte(rbx, Address(_bcp_register, step)); |
856 // advance _bcp_register |
874 // advance _bcp_register |
857 increment(_bcp_register, step); |
875 increment(_bcp_register, step); |
858 dispatch_base(state, Interpreter::dispatch_table(state)); |
876 dispatch_base(state, Interpreter::dispatch_table(state), true, generate_poll); |
859 } |
877 } |
860 |
878 |
861 void InterpreterMacroAssembler::dispatch_via(TosState state, address* table) { |
879 void InterpreterMacroAssembler::dispatch_via(TosState state, address* table) { |
862 // load current bytecode |
880 // load current bytecode |
863 load_unsigned_byte(rbx, Address(_bcp_register, 0)); |
881 load_unsigned_byte(rbx, Address(_bcp_register, 0)); |