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);
1740 MacroAssembler::_verify_oop_checked(reg, "broken oop", file, line);
1741 }
1742 }
1743
1744
1745 // Jump if ((*counter_addr += increment) & mask) == 0
1746 void InterpreterMacroAssembler::increment_mask_and_jump(Address counter_addr, Address mask,
1747 Register scratch, Label* where) {
1748 // This update is actually not atomic and can lose a number of updates
1749 // under heavy contention, but the alternative of using the (contended)
1750 // atomic update here penalizes profiling paths too much.
1751 movl(scratch, counter_addr);
1752 incrementl(scratch, InvocationCounter::count_increment);
1753 movl(counter_addr, scratch);
1754 andl(scratch, mask);
1755 if (where != nullptr) {
1756 jcc(Assembler::zero, *where);
1757 }
1758 }
1759
1760 void InterpreterMacroAssembler::notify_method_entry() {
1761 // Whenever JVMTI is interp_only_mode, method entry/exit events are sent to
1762 // track stack depth. If it is possible to enter interp_only_mode we add
1763 // the code to check if the event should be sent.
1764 Register rthread = r15_thread;
1765 Register rarg = c_rarg1;
1766 if (JvmtiExport::can_post_interpreter_events()) {
1767 Label L;
1768 movl(rdx, Address(rthread, JavaThread::interp_only_mode_offset()));
1769 testl(rdx, rdx);
1770 jcc(Assembler::zero, L);
1771 call_VM(noreg, CAST_FROM_FN_PTR(address,
1772 InterpreterRuntime::post_method_entry));
1773 bind(L);
1774 }
1775
1776 if (DTraceMethodProbes) {
1777 get_method(rarg);
1778 call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry),
1779 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);
1741 MacroAssembler::_verify_oop_checked(reg, "broken oop", file, line);
1742 }
1743 }
1744
1745
1746 // Jump if ((*counter_addr += increment) & mask) == 0
1747 void InterpreterMacroAssembler::increment_mask_and_jump(Address counter_addr, Address mask,
1748 Register scratch, Label* where) {
1749 // This update is actually not atomic and can lose a number of updates
1750 // under heavy contention, but the alternative of using the (contended)
1751 // atomic update here penalizes profiling paths too much.
1752 movl(scratch, counter_addr);
1753 incrementl(scratch, InvocationCounter::count_increment);
1754 movl(counter_addr, scratch);
1755 andl(scratch, mask);
1756 if (where != nullptr) {
1757 jcc(Assembler::zero, *where);
1758 }
1759 }
1760
1761 void InterpreterMacroAssembler::generate_runtime_upcalls_on_method_entry()
1762 {
1763 address upcall = RuntimeUpcalls::on_method_entry_upcall_address();
1764 if (RuntimeUpcalls::does_upcall_need_method_parameter(upcall)) {
1765 get_method(c_rarg1);
1766 call_VM(noreg,upcall, c_rarg1);
1767 } else {
1768 call_VM(noreg,upcall);
1769 }
1770 }
1771
1772 void InterpreterMacroAssembler::notify_method_entry() {
1773 // Whenever JVMTI is interp_only_mode, method entry/exit events are sent to
1774 // track stack depth. If it is possible to enter interp_only_mode we add
1775 // the code to check if the event should be sent.
1776 Register rthread = r15_thread;
1777 Register rarg = c_rarg1;
1778 if (JvmtiExport::can_post_interpreter_events()) {
1779 Label L;
1780 movl(rdx, Address(rthread, JavaThread::interp_only_mode_offset()));
1781 testl(rdx, rdx);
1782 jcc(Assembler::zero, L);
1783 call_VM(noreg, CAST_FROM_FN_PTR(address,
1784 InterpreterRuntime::post_method_entry));
1785 bind(L);
1786 }
1787
1788 if (DTraceMethodProbes) {
1789 get_method(rarg);
1790 call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry),
1791 rthread, rarg);
|