22 *
23 */
24
25 #include "compiler/compiler_globals.hpp"
26 #include "interp_masm_x86.hpp"
27 #include "interpreter/interpreter.hpp"
28 #include "interpreter/interpreterRuntime.hpp"
29 #include "logging/log.hpp"
30 #include "oops/arrayOop.hpp"
31 #include "oops/markWord.hpp"
32 #include "oops/methodData.hpp"
33 #include "oops/method.hpp"
34 #include "oops/resolvedFieldEntry.hpp"
35 #include "oops/resolvedIndyEntry.hpp"
36 #include "oops/resolvedMethodEntry.hpp"
37 #include "prims/jvmtiExport.hpp"
38 #include "prims/jvmtiThreadState.hpp"
39 #include "runtime/basicLock.hpp"
40 #include "runtime/frame.inline.hpp"
41 #include "runtime/javaThread.hpp"
42 #include "runtime/safepointMechanism.hpp"
43 #include "runtime/sharedRuntime.hpp"
44 #include "utilities/powerOfTwo.hpp"
45
46 // Implementation of InterpreterMacroAssembler
47
48 void InterpreterMacroAssembler::jump_to_entry(address entry) {
49 assert(entry, "Entry must have been generated by now");
50 jump(RuntimeAddress(entry));
51 }
52
53 void InterpreterMacroAssembler::profile_obj_type(Register obj, const Address& mdo_addr) {
54 Label update, next, none;
55
56 assert_different_registers(obj, rscratch1, mdo_addr.base(), mdo_addr.index());
57
58 interp_verify_oop(obj, atos);
59
60 testptr(obj, obj);
61 jccb(Assembler::notZero, update);
1691 MacroAssembler::_verify_oop_checked(reg, "broken oop", file, line);
1692 }
1693 }
1694
1695
1696 // Jump if ((*counter_addr += increment) & mask) == 0
1697 void InterpreterMacroAssembler::increment_mask_and_jump(Address counter_addr, Address mask,
1698 Register scratch, Label* where) {
1699 // This update is actually not atomic and can lose a number of updates
1700 // under heavy contention, but the alternative of using the (contended)
1701 // atomic update here penalizes profiling paths too much.
1702 movl(scratch, counter_addr);
1703 incrementl(scratch, InvocationCounter::count_increment);
1704 movl(counter_addr, scratch);
1705 andl(scratch, mask);
1706 if (where != nullptr) {
1707 jcc(Assembler::zero, *where);
1708 }
1709 }
1710
1711 void InterpreterMacroAssembler::notify_method_entry() {
1712 // Whenever JVMTI is interp_only_mode, method entry/exit events are sent to
1713 // track stack depth. If it is possible to enter interp_only_mode we add
1714 // the code to check if the event should be sent.
1715 Register rthread = r15_thread;
1716 Register rarg = c_rarg1;
1717 if (JvmtiExport::can_post_interpreter_events()) {
1718 Label L;
1719 movl(rdx, Address(rthread, JavaThread::interp_only_mode_offset()));
1720 testl(rdx, rdx);
1721 jcc(Assembler::zero, L);
1722 call_VM(noreg, CAST_FROM_FN_PTR(address,
1723 InterpreterRuntime::post_method_entry));
1724 bind(L);
1725 }
1726
1727 if (DTraceMethodProbes) {
1728 get_method(rarg);
1729 call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry),
1730 rthread, rarg);
|
22 *
23 */
24
25 #include "compiler/compiler_globals.hpp"
26 #include "interp_masm_x86.hpp"
27 #include "interpreter/interpreter.hpp"
28 #include "interpreter/interpreterRuntime.hpp"
29 #include "logging/log.hpp"
30 #include "oops/arrayOop.hpp"
31 #include "oops/markWord.hpp"
32 #include "oops/methodData.hpp"
33 #include "oops/method.hpp"
34 #include "oops/resolvedFieldEntry.hpp"
35 #include "oops/resolvedIndyEntry.hpp"
36 #include "oops/resolvedMethodEntry.hpp"
37 #include "prims/jvmtiExport.hpp"
38 #include "prims/jvmtiThreadState.hpp"
39 #include "runtime/basicLock.hpp"
40 #include "runtime/frame.inline.hpp"
41 #include "runtime/javaThread.hpp"
42 #include "runtime/runtimeUpcalls.hpp"
43 #include "runtime/safepointMechanism.hpp"
44 #include "runtime/sharedRuntime.hpp"
45 #include "utilities/powerOfTwo.hpp"
46
47 // Implementation of InterpreterMacroAssembler
48
49 void InterpreterMacroAssembler::jump_to_entry(address entry) {
50 assert(entry, "Entry must have been generated by now");
51 jump(RuntimeAddress(entry));
52 }
53
54 void InterpreterMacroAssembler::profile_obj_type(Register obj, const Address& mdo_addr) {
55 Label update, next, none;
56
57 assert_different_registers(obj, rscratch1, mdo_addr.base(), mdo_addr.index());
58
59 interp_verify_oop(obj, atos);
60
61 testptr(obj, obj);
62 jccb(Assembler::notZero, update);
1692 MacroAssembler::_verify_oop_checked(reg, "broken oop", file, line);
1693 }
1694 }
1695
1696
1697 // Jump if ((*counter_addr += increment) & mask) == 0
1698 void InterpreterMacroAssembler::increment_mask_and_jump(Address counter_addr, Address mask,
1699 Register scratch, Label* where) {
1700 // This update is actually not atomic and can lose a number of updates
1701 // under heavy contention, but the alternative of using the (contended)
1702 // atomic update here penalizes profiling paths too much.
1703 movl(scratch, counter_addr);
1704 incrementl(scratch, InvocationCounter::count_increment);
1705 movl(counter_addr, scratch);
1706 andl(scratch, mask);
1707 if (where != nullptr) {
1708 jcc(Assembler::zero, *where);
1709 }
1710 }
1711
1712 void InterpreterMacroAssembler::generate_runtime_upcalls_on_method_entry()
1713 {
1714 address upcall = RuntimeUpcalls::on_method_entry_upcall_address();
1715 if (RuntimeUpcalls::does_upcall_need_method_parameter(upcall)) {
1716 get_method(c_rarg1);
1717 call_VM(noreg,upcall, c_rarg1);
1718 } else {
1719 call_VM(noreg,upcall);
1720 }
1721 }
1722
1723 void InterpreterMacroAssembler::notify_method_entry() {
1724 // Whenever JVMTI is interp_only_mode, method entry/exit events are sent to
1725 // track stack depth. If it is possible to enter interp_only_mode we add
1726 // the code to check if the event should be sent.
1727 Register rthread = r15_thread;
1728 Register rarg = c_rarg1;
1729 if (JvmtiExport::can_post_interpreter_events()) {
1730 Label L;
1731 movl(rdx, Address(rthread, JavaThread::interp_only_mode_offset()));
1732 testl(rdx, rdx);
1733 jcc(Assembler::zero, L);
1734 call_VM(noreg, CAST_FROM_FN_PTR(address,
1735 InterpreterRuntime::post_method_entry));
1736 bind(L);
1737 }
1738
1739 if (DTraceMethodProbes) {
1740 get_method(rarg);
1741 call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry),
1742 rthread, rarg);
|