< prev index next >

src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp

Print this page




  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  *
  24  */
  25 
  26 #include "precompiled.hpp"
  27 #include "asm/macroAssembler.inline.hpp"
  28 #include "gc/shared/barrierSet.hpp"
  29 #include "gc/shared/barrierSetAssembler.hpp"
  30 #include "interp_masm_aarch64.hpp"
  31 #include "interpreter/interpreter.hpp"
  32 #include "interpreter/interpreterRuntime.hpp"
  33 #include "logging/log.hpp"
  34 #include "oops/arrayOop.hpp"
  35 #include "oops/markOop.hpp"
  36 #include "oops/method.hpp"
  37 #include "oops/methodData.hpp"

  38 #include "prims/jvmtiExport.hpp"
  39 #include "prims/jvmtiThreadState.hpp"
  40 #include "runtime/basicLock.hpp"
  41 #include "runtime/biasedLocking.hpp"
  42 #include "runtime/frame.inline.hpp"
  43 #include "runtime/safepointMechanism.hpp"
  44 #include "runtime/sharedRuntime.hpp"
  45 #include "runtime/thread.inline.hpp"
  46 
  47 
  48 void InterpreterMacroAssembler::narrow(Register result) {
  49 
  50   // Get method->_constMethod->_result_type
  51   ldr(rscratch1, Address(rfp, frame::interpreter_frame_method_offset * wordSize));
  52   ldr(rscratch1, Address(rscratch1, Method::const_offset()));
  53   ldrb(rscratch1, Address(rscratch1, ConstMethod::result_type_offset()));
  54 
  55   Label done, notBool, notByte, notChar;
  56 
  57   // common case first


 639 
 640     add(c_rarg1, c_rarg1, entry_size); // otherwise advance to next entry
 641     bind(entry);
 642     cmp(c_rarg1, r19); // check if bottom reached
 643     br(Assembler::NE, loop); // if not at bottom then check this entry
 644   }
 645 
 646   bind(no_unlock);
 647 
 648   // jvmti support
 649   if (notify_jvmdi) {
 650     notify_method_exit(state, NotifyJVMTI);    // preserve TOSCA
 651   } else {
 652     notify_method_exit(state, SkipNotifyJVMTI); // preserve TOSCA
 653   }
 654 
 655   // remove activation
 656   // get sender esp
 657   ldr(esp,
 658       Address(rfp, frame::interpreter_frame_sender_sp_offset * wordSize));

 659   if (StackReservedPages > 0) {
 660     // testing if reserved zone needs to be re-enabled
 661     Label no_reserved_zone_enabling;
 662 
 663     ldr(rscratch1, Address(rthread, JavaThread::reserved_stack_activation_offset()));
 664     cmp(esp, rscratch1);
 665     br(Assembler::LS, no_reserved_zone_enabling);
 666 
 667     call_VM_leaf(
 668       CAST_FROM_FN_PTR(address, SharedRuntime::enable_stack_reserved_zone), rthread);
 669     call_VM(noreg, CAST_FROM_FN_PTR(address,
 670                    InterpreterRuntime::throw_delayed_StackOverflowError));
 671     should_not_reach_here();
 672 
 673     bind(no_reserved_zone_enabling);
 674   }



























 675   // remove frame anchor
 676   leave();
 677   // If we're returning to interpreted code we will shortly be
 678   // adjusting SP to allow some space for ESP.  If we're returning to
 679   // compiled code the saved sender SP was saved in sender_sp, so this
 680   // restores it.
 681   andr(sp, esp, -16);
 682 }
 683 
 684 // Lock object
 685 //
 686 // Args:
 687 //      c_rarg1: BasicObjectLock to be used for locking
 688 //
 689 // Kills:
 690 //      r0
 691 //      c_rarg0, c_rarg1, c_rarg2, c_rarg3, .. (param regs)
 692 //      rscratch1, rscratch2 (scratch regs)
 693 void InterpreterMacroAssembler::lock_object(Register lock_reg)
 694 {


 707     const int obj_offset = BasicObjectLock::obj_offset_in_bytes();
 708     const int lock_offset = BasicObjectLock::lock_offset_in_bytes ();
 709     const int mark_offset = lock_offset +
 710                             BasicLock::displaced_header_offset_in_bytes();
 711 
 712     Label slow_case;
 713 
 714     // Load object pointer into obj_reg %c_rarg3
 715     ldr(obj_reg, Address(lock_reg, obj_offset));
 716 
 717     if (UseBiasedLocking) {
 718       biased_locking_enter(lock_reg, obj_reg, swap_reg, tmp, false, done, &slow_case);
 719     }
 720 
 721     // Load (object->mark() | 1) into swap_reg
 722     ldr(rscratch1, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
 723     orr(swap_reg, rscratch1, 1);
 724 
 725     // Save (object->mark() | 1) into BasicLock's displaced header
 726     str(swap_reg, Address(lock_reg, mark_offset));





 727 
 728     assert(lock_offset == 0,
 729            "displached header must be first word in BasicObjectLock");
 730 
 731     Label fail;
 732     if (PrintBiasedLockingStatistics) {
 733       Label fast;
 734       cmpxchg_obj_header(swap_reg, lock_reg, obj_reg, rscratch1, fast, &fail);
 735       bind(fast);
 736       atomic_incw(Address((address)BiasedLocking::fast_path_entry_count_addr()),
 737                   rscratch2, rscratch1, tmp);
 738       b(done);
 739       bind(fail);
 740     } else {
 741       cmpxchg_obj_header(swap_reg, lock_reg, obj_reg, rscratch1, done, /*fallthrough*/NULL);
 742     }
 743 
 744     // Test if the oopMark is an obvious stack pointer, i.e.,
 745     //  1) (mark & 7) == 0, and
 746     //  2) rsp <= mark < mark + os::pagesize()




  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  *
  24  */
  25 
  26 #include "precompiled.hpp"
  27 #include "asm/macroAssembler.inline.hpp"
  28 #include "gc/shared/barrierSet.hpp"
  29 #include "gc/shared/barrierSetAssembler.hpp"
  30 #include "interp_masm_aarch64.hpp"
  31 #include "interpreter/interpreter.hpp"
  32 #include "interpreter/interpreterRuntime.hpp"
  33 #include "logging/log.hpp"
  34 #include "oops/arrayOop.hpp"
  35 #include "oops/markOop.hpp"
  36 #include "oops/method.hpp"
  37 #include "oops/methodData.hpp"
  38 #include "oops/valueKlass.hpp"
  39 #include "prims/jvmtiExport.hpp"
  40 #include "prims/jvmtiThreadState.hpp"
  41 #include "runtime/basicLock.hpp"
  42 #include "runtime/biasedLocking.hpp"
  43 #include "runtime/frame.inline.hpp"
  44 #include "runtime/safepointMechanism.hpp"
  45 #include "runtime/sharedRuntime.hpp"
  46 #include "runtime/thread.inline.hpp"
  47 
  48 
  49 void InterpreterMacroAssembler::narrow(Register result) {
  50 
  51   // Get method->_constMethod->_result_type
  52   ldr(rscratch1, Address(rfp, frame::interpreter_frame_method_offset * wordSize));
  53   ldr(rscratch1, Address(rscratch1, Method::const_offset()));
  54   ldrb(rscratch1, Address(rscratch1, ConstMethod::result_type_offset()));
  55 
  56   Label done, notBool, notByte, notChar;
  57 
  58   // common case first


 640 
 641     add(c_rarg1, c_rarg1, entry_size); // otherwise advance to next entry
 642     bind(entry);
 643     cmp(c_rarg1, r19); // check if bottom reached
 644     br(Assembler::NE, loop); // if not at bottom then check this entry
 645   }
 646 
 647   bind(no_unlock);
 648 
 649   // jvmti support
 650   if (notify_jvmdi) {
 651     notify_method_exit(state, NotifyJVMTI);    // preserve TOSCA
 652   } else {
 653     notify_method_exit(state, SkipNotifyJVMTI); // preserve TOSCA
 654   }
 655 
 656   // remove activation
 657   // get sender esp
 658   ldr(esp,
 659       Address(rfp, frame::interpreter_frame_sender_sp_offset * wordSize));
 660 
 661   if (StackReservedPages > 0) {
 662     // testing if reserved zone needs to be re-enabled
 663     Label no_reserved_zone_enabling;
 664 
 665     ldr(rscratch1, Address(rthread, JavaThread::reserved_stack_activation_offset()));
 666     cmp(esp, rscratch1);
 667     br(Assembler::LS, no_reserved_zone_enabling);
 668 
 669     call_VM_leaf(
 670       CAST_FROM_FN_PTR(address, SharedRuntime::enable_stack_reserved_zone), rthread);
 671     call_VM(noreg, CAST_FROM_FN_PTR(address,
 672                    InterpreterRuntime::throw_delayed_StackOverflowError));
 673     should_not_reach_here();
 674 
 675     bind(no_reserved_zone_enabling);
 676   }
 677 
 678 
 679   if (state == atos && ValueTypeReturnedAsFields) {
 680     Label skip;
 681     // Test if the return type is a value type
 682     ldr(rscratch1, Address(rfp, frame::interpreter_frame_method_offset * wordSize));
 683     ldr(rscratch1, Address(rscratch1, Method::const_offset()));
 684     ldrb(rscratch1, Address(rscratch1, ConstMethod::result_type_offset()));
 685     cmpw(rscratch1, (u1) T_VALUETYPE);
 686     br(Assembler::NE, skip);
 687 
 688     // We are returning a value type, load its fields into registers
 689     // Load fields from a buffered value with a value class specific handler
 690 
 691     load_klass(rscratch1 /*dst*/, r0 /*src*/);
 692     ldr(rscratch1, Address(rscratch1, InstanceKlass::adr_valueklass_fixed_block_offset()));
 693     ldr(rscratch1, Address(rscratch1, ValueKlass::unpack_handler_offset()));
 694     cbz(rscratch1, skip); 
 695 
 696     blr(rscratch1);
 697 
 698     // call above kills the value in r1. Reload it.
 699     ldr(r1, Address(rfp, frame::interpreter_frame_sender_sp_offset * wordSize));
 700     bind(skip);
 701   }
 702 
 703 
 704   // remove frame anchor
 705   leave();
 706   // If we're returning to interpreted code we will shortly be
 707   // adjusting SP to allow some space for ESP.  If we're returning to
 708   // compiled code the saved sender SP was saved in sender_sp, so this
 709   // restores it.
 710   andr(sp, esp, -16);
 711 }
 712 
 713 // Lock object
 714 //
 715 // Args:
 716 //      c_rarg1: BasicObjectLock to be used for locking
 717 //
 718 // Kills:
 719 //      r0
 720 //      c_rarg0, c_rarg1, c_rarg2, c_rarg3, .. (param regs)
 721 //      rscratch1, rscratch2 (scratch regs)
 722 void InterpreterMacroAssembler::lock_object(Register lock_reg)
 723 {


 736     const int obj_offset = BasicObjectLock::obj_offset_in_bytes();
 737     const int lock_offset = BasicObjectLock::lock_offset_in_bytes ();
 738     const int mark_offset = lock_offset +
 739                             BasicLock::displaced_header_offset_in_bytes();
 740 
 741     Label slow_case;
 742 
 743     // Load object pointer into obj_reg %c_rarg3
 744     ldr(obj_reg, Address(lock_reg, obj_offset));
 745 
 746     if (UseBiasedLocking) {
 747       biased_locking_enter(lock_reg, obj_reg, swap_reg, tmp, false, done, &slow_case);
 748     }
 749 
 750     // Load (object->mark() | 1) into swap_reg
 751     ldr(rscratch1, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
 752     orr(swap_reg, rscratch1, 1);
 753 
 754     // Save (object->mark() | 1) into BasicLock's displaced header
 755     str(swap_reg, Address(lock_reg, mark_offset));
 756 
 757     if (EnableValhalla && !UseBiasedLocking) { 
 758       // For slow path is_always_locked, using biased, which is never natural for !UseBiasLocking
 759       andr(swap_reg, swap_reg, ~markOopDesc::biased_lock_bit_in_place);
 760     }
 761 
 762     assert(lock_offset == 0,
 763            "displached header must be first word in BasicObjectLock");
 764 
 765     Label fail;
 766     if (PrintBiasedLockingStatistics) {
 767       Label fast;
 768       cmpxchg_obj_header(swap_reg, lock_reg, obj_reg, rscratch1, fast, &fail);
 769       bind(fast);
 770       atomic_incw(Address((address)BiasedLocking::fast_path_entry_count_addr()),
 771                   rscratch2, rscratch1, tmp);
 772       b(done);
 773       bind(fail);
 774     } else {
 775       cmpxchg_obj_header(swap_reg, lock_reg, obj_reg, rscratch1, done, /*fallthrough*/NULL);
 776     }
 777 
 778     // Test if the oopMark is an obvious stack pointer, i.e.,
 779     //  1) (mark & 7) == 0, and
 780     //  2) rsp <= mark < mark + os::pagesize()


< prev index next >