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);
1617 MacroAssembler::_verify_oop_checked(reg, "broken oop", file, line);
1618 }
1619 }
1620
1621
1622 // Jump if ((*counter_addr += increment) & mask) == 0
1623 void InterpreterMacroAssembler::increment_mask_and_jump(Address counter_addr, Address mask,
1624 Register scratch, Label* where) {
1625 // This update is actually not atomic and can lose a number of updates
1626 // under heavy contention, but the alternative of using the (contended)
1627 // atomic update here penalizes profiling paths too much.
1628 movl(scratch, counter_addr);
1629 incrementl(scratch, InvocationCounter::count_increment);
1630 movl(counter_addr, scratch);
1631 andl(scratch, mask);
1632 if (where != nullptr) {
1633 jcc(Assembler::zero, *where);
1634 }
1635 }
1636
1637 void InterpreterMacroAssembler::notify_method_entry() {
1638 // Whenever JVMTI is interp_only_mode, method entry/exit events are sent to
1639 // track stack depth. If it is possible to enter interp_only_mode we add
1640 // the code to check if the event should be sent.
1641 Register rthread = r15_thread;
1642 Register rarg = c_rarg1;
1643 if (JvmtiExport::can_post_interpreter_events()) {
1644 Label L;
1645 movl(rdx, Address(rthread, JavaThread::interp_only_mode_offset()));
1646 testl(rdx, rdx);
1647 jcc(Assembler::zero, L);
1648 call_VM(noreg, CAST_FROM_FN_PTR(address,
1649 InterpreterRuntime::post_method_entry));
1650 bind(L);
1651 }
1652
1653 if (DTraceMethodProbes) {
1654 get_method(rarg);
1655 call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry),
1656 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);
1618 MacroAssembler::_verify_oop_checked(reg, "broken oop", file, line);
1619 }
1620 }
1621
1622
1623 // Jump if ((*counter_addr += increment) & mask) == 0
1624 void InterpreterMacroAssembler::increment_mask_and_jump(Address counter_addr, Address mask,
1625 Register scratch, Label* where) {
1626 // This update is actually not atomic and can lose a number of updates
1627 // under heavy contention, but the alternative of using the (contended)
1628 // atomic update here penalizes profiling paths too much.
1629 movl(scratch, counter_addr);
1630 incrementl(scratch, InvocationCounter::count_increment);
1631 movl(counter_addr, scratch);
1632 andl(scratch, mask);
1633 if (where != nullptr) {
1634 jcc(Assembler::zero, *where);
1635 }
1636 }
1637
1638 void InterpreterMacroAssembler::generate_runtime_upcalls_on_method_entry()
1639 {
1640 address upcall = RuntimeUpcalls::on_method_entry_upcall_address();
1641 if (RuntimeUpcalls::does_upcall_need_method_parameter(upcall)) {
1642 get_method(c_rarg1);
1643 call_VM(noreg,upcall, c_rarg1);
1644 } else {
1645 call_VM(noreg,upcall);
1646 }
1647 }
1648
1649 void InterpreterMacroAssembler::notify_method_entry() {
1650 // Whenever JVMTI is interp_only_mode, method entry/exit events are sent to
1651 // track stack depth. If it is possible to enter interp_only_mode we add
1652 // the code to check if the event should be sent.
1653 Register rthread = r15_thread;
1654 Register rarg = c_rarg1;
1655 if (JvmtiExport::can_post_interpreter_events()) {
1656 Label L;
1657 movl(rdx, Address(rthread, JavaThread::interp_only_mode_offset()));
1658 testl(rdx, rdx);
1659 jcc(Assembler::zero, L);
1660 call_VM(noreg, CAST_FROM_FN_PTR(address,
1661 InterpreterRuntime::post_method_entry));
1662 bind(L);
1663 }
1664
1665 if (DTraceMethodProbes) {
1666 get_method(rarg);
1667 call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry),
1668 rthread, rarg);
|