< prev index next >

src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp

Print this page
rev 53735 : AArch64 support for ValueTypes


  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


 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


 656   // remove activation
 657   // get sender esp
 658   ldr(esp,
 659       Address(rfp, frame::interpreter_frame_sender_sp_offset * wordSize));
 660   if (StackReservedPages > 0) {
 661     // testing if reserved zone needs to be re-enabled
 662     Label no_reserved_zone_enabling;
 663 
 664     ldr(rscratch1, Address(rthread, JavaThread::reserved_stack_activation_offset()));
 665     cmp(esp, rscratch1);
 666     br(Assembler::LS, no_reserved_zone_enabling);
 667 
 668     call_VM_leaf(
 669       CAST_FROM_FN_PTR(address, SharedRuntime::enable_stack_reserved_zone), rthread);
 670     call_VM(noreg, CAST_FROM_FN_PTR(address,
 671                    InterpreterRuntime::throw_delayed_StackOverflowError));
 672     should_not_reach_here();
 673 
 674     bind(no_reserved_zone_enabling);
 675   }
 676 
 677   // DMS CHECK: ValueTypeReturnedAsFields support should be here
 678   // remove frame anchor
 679   leave();
 680   // If we're returning to interpreted code we will shortly be
 681   // adjusting SP to allow some space for ESP.  If we're returning to
 682   // compiled code the saved sender SP was saved in sender_sp, so this
 683   // restores it.
 684   andr(sp, esp, -16);
 685 }
 686 
 687 // Lock object
 688 //
 689 // Args:
 690 //      c_rarg1: BasicObjectLock to be used for locking
 691 //
 692 // Kills:
 693 //      r0
 694 //      c_rarg0, c_rarg1, c_rarg2, c_rarg3, .. (param regs)
 695 //      rscratch1, rscratch2 (scratch regs)
 696 void InterpreterMacroAssembler::lock_object(Register lock_reg)
 697 {


 710     const int obj_offset = BasicObjectLock::obj_offset_in_bytes();
 711     const int lock_offset = BasicObjectLock::lock_offset_in_bytes ();
 712     const int mark_offset = lock_offset +
 713                             BasicLock::displaced_header_offset_in_bytes();
 714 
 715     Label slow_case;
 716 
 717     // Load object pointer into obj_reg %c_rarg3
 718     ldr(obj_reg, Address(lock_reg, obj_offset));
 719 
 720     if (UseBiasedLocking) {
 721       biased_locking_enter(lock_reg, obj_reg, swap_reg, tmp, false, done, &slow_case);
 722     }
 723 
 724     // Load (object->mark() | 1) into swap_reg
 725     ldr(rscratch1, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
 726     orr(swap_reg, rscratch1, 1);
 727 
 728     // Save (object->mark() | 1) into BasicLock's displaced header
 729     str(swap_reg, Address(lock_reg, mark_offset));
 730 
 731     if (EnableValhalla && !UseBiasedLocking) { // DMS CHECK
 732       // For slow path is_always_locked, using biased, which is never natural for !UseBiasLocking
 733       andr(swap_reg, swap_reg, ~markOopDesc::biased_lock_bit_in_place);
 734     }
 735 
 736     assert(lock_offset == 0,
 737            "displached header must be first word in BasicObjectLock");
 738 
 739     Label fail;
 740     if (PrintBiasedLockingStatistics) {
 741       Label fast;
 742       cmpxchg_obj_header(swap_reg, lock_reg, obj_reg, rscratch1, fast, &fail);
 743       bind(fast);
 744       atomic_incw(Address((address)BiasedLocking::fast_path_entry_count_addr()),
 745                   rscratch2, rscratch1, tmp);
 746       b(done);
 747       bind(fail);
 748     } else {
 749       cmpxchg_obj_header(swap_reg, lock_reg, obj_reg, rscratch1, done, /*fallthrough*/NULL);
 750     }
 751 
 752     // Test if the oopMark is an obvious stack pointer, i.e.,
 753     //  1) (mark & 7) == 0, and
 754     //  2) rsp <= mark < mark + os::pagesize()


< prev index next >