< prev index next >

src/hotspot/cpu/x86/interp_masm_x86.cpp

Print this page

  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);

1734     MacroAssembler::_verify_oop_checked(reg, "broken oop", file, line);
1735   }
1736 }
1737 
1738 
1739 // Jump if ((*counter_addr += increment) & mask) == 0
1740 void InterpreterMacroAssembler::increment_mask_and_jump(Address counter_addr, Address mask,
1741                                                         Register scratch, Label* where) {
1742   // This update is actually not atomic and can lose a number of updates
1743   // under heavy contention, but the alternative of using the (contended)
1744   // atomic update here penalizes profiling paths too much.
1745   movl(scratch, counter_addr);
1746   incrementl(scratch, InvocationCounter::count_increment);
1747   movl(counter_addr, scratch);
1748   andl(scratch, mask);
1749   if (where != nullptr) {
1750     jcc(Assembler::zero, *where);
1751   }
1752 }
1753 











1754 void InterpreterMacroAssembler::notify_method_entry() {
1755   // Whenever JVMTI is interp_only_mode, method entry/exit events are sent to
1756   // track stack depth.  If it is possible to enter interp_only_mode we add
1757   // the code to check if the event should be sent.
1758   Register rthread = r15_thread;
1759   Register rarg = c_rarg1;
1760   if (JvmtiExport::can_post_interpreter_events()) {
1761     Label L;
1762     movl(rdx, Address(rthread, JavaThread::interp_only_mode_offset()));
1763     testl(rdx, rdx);
1764     jcc(Assembler::zero, L);
1765     call_VM(noreg, CAST_FROM_FN_PTR(address,
1766                                     InterpreterRuntime::post_method_entry));
1767     bind(L);
1768   }
1769 
1770   if (DTraceMethodProbes) {
1771     get_method(rarg);
1772     call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry),
1773                  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);

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