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

1560     MacroAssembler::_verify_oop_checked(reg, "broken oop", file, line);
1561   }
1562 }
1563 
1564 
1565 // Jump if ((*counter_addr += increment) & mask) == 0
1566 void InterpreterMacroAssembler::increment_mask_and_jump(Address counter_addr, Address mask,
1567                                                         Register scratch, Label* where) {
1568   // This update is actually not atomic and can lose a number of updates
1569   // under heavy contention, but the alternative of using the (contended)
1570   // atomic update here penalizes profiling paths too much.
1571   movl(scratch, counter_addr);
1572   incrementl(scratch, InvocationCounter::count_increment);
1573   movl(counter_addr, scratch);
1574   andl(scratch, mask);
1575   if (where != nullptr) {
1576     jcc(Assembler::zero, *where);
1577   }
1578 }
1579 











1580 void InterpreterMacroAssembler::notify_method_entry() {
1581   // Whenever JVMTI is interp_only_mode, method entry/exit events are sent to
1582   // track stack depth.  If it is possible to enter interp_only_mode we add
1583   // the code to check if the event should be sent.
1584   Register rthread = r15_thread;
1585   Register rarg = c_rarg1;
1586   if (JvmtiExport::can_post_interpreter_events()) {
1587     Label L;
1588     movl(rdx, Address(rthread, JavaThread::interp_only_mode_offset()));
1589     testl(rdx, rdx);
1590     jcc(Assembler::zero, L);
1591     call_VM(noreg, CAST_FROM_FN_PTR(address,
1592                                     InterpreterRuntime::post_method_entry));
1593     bind(L);
1594   }
1595 
1596   if (DTraceMethodProbes) {
1597     get_method(rarg);
1598     call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry),
1599                  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);

1561     MacroAssembler::_verify_oop_checked(reg, "broken oop", file, line);
1562   }
1563 }
1564 
1565 
1566 // Jump if ((*counter_addr += increment) & mask) == 0
1567 void InterpreterMacroAssembler::increment_mask_and_jump(Address counter_addr, Address mask,
1568                                                         Register scratch, Label* where) {
1569   // This update is actually not atomic and can lose a number of updates
1570   // under heavy contention, but the alternative of using the (contended)
1571   // atomic update here penalizes profiling paths too much.
1572   movl(scratch, counter_addr);
1573   incrementl(scratch, InvocationCounter::count_increment);
1574   movl(counter_addr, scratch);
1575   andl(scratch, mask);
1576   if (where != nullptr) {
1577     jcc(Assembler::zero, *where);
1578   }
1579 }
1580 
1581 void InterpreterMacroAssembler::generate_runtime_upcalls_on_method_entry()
1582 {
1583   address upcall = RuntimeUpcalls::on_method_entry_upcall_address();
1584   if (RuntimeUpcalls::does_upcall_need_method_parameter(upcall)) {
1585     get_method(c_rarg1);
1586     call_VM(noreg,upcall, c_rarg1);
1587   } else {
1588     call_VM(noreg,upcall);
1589   }
1590 }
1591 
1592 void InterpreterMacroAssembler::notify_method_entry() {
1593   // Whenever JVMTI is interp_only_mode, method entry/exit events are sent to
1594   // track stack depth.  If it is possible to enter interp_only_mode we add
1595   // the code to check if the event should be sent.
1596   Register rthread = r15_thread;
1597   Register rarg = c_rarg1;
1598   if (JvmtiExport::can_post_interpreter_events()) {
1599     Label L;
1600     movl(rdx, Address(rthread, JavaThread::interp_only_mode_offset()));
1601     testl(rdx, rdx);
1602     jcc(Assembler::zero, L);
1603     call_VM(noreg, CAST_FROM_FN_PTR(address,
1604                                     InterpreterRuntime::post_method_entry));
1605     bind(L);
1606   }
1607 
1608   if (DTraceMethodProbes) {
1609     get_method(rarg);
1610     call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry),
1611                  rthread, rarg);
< prev index next >