< prev index next >

src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp

Print this page

  23  *
  24  */
  25 
  26 #include <sys/types.h>
  27 
  28 #include "precompiled.hpp"
  29 #include "asm/assembler.hpp"
  30 #include "asm/assembler.inline.hpp"
  31 #include "ci/ciEnv.hpp"
  32 #include "compiler/compileTask.hpp"
  33 #include "compiler/disassembler.hpp"
  34 #include "compiler/oopMap.hpp"
  35 #include "gc/shared/barrierSet.hpp"
  36 #include "gc/shared/barrierSetAssembler.hpp"
  37 #include "gc/shared/cardTableBarrierSet.hpp"
  38 #include "gc/shared/cardTable.hpp"
  39 #include "gc/shared/collectedHeap.hpp"
  40 #include "gc/shared/tlab_globals.hpp"
  41 #include "interpreter/bytecodeHistogram.hpp"
  42 #include "interpreter/interpreter.hpp"

  43 #include "jvm.h"
  44 #include "memory/resourceArea.hpp"
  45 #include "memory/universe.hpp"
  46 #include "nativeInst_aarch64.hpp"
  47 #include "oops/accessDecorators.hpp"
  48 #include "oops/compressedKlass.inline.hpp"
  49 #include "oops/compressedOops.inline.hpp"
  50 #include "oops/klass.inline.hpp"
  51 #include "runtime/continuation.hpp"
  52 #include "runtime/icache.hpp"
  53 #include "runtime/interfaceSupport.inline.hpp"
  54 #include "runtime/javaThread.hpp"
  55 #include "runtime/jniHandles.inline.hpp"
  56 #include "runtime/sharedRuntime.hpp"
  57 #include "runtime/stubRoutines.hpp"
  58 #include "utilities/powerOfTwo.hpp"
  59 #ifdef COMPILER1
  60 #include "c1/c1_LIRAssembler.hpp"
  61 #endif
  62 #ifdef COMPILER2

1650   // cf. TemplateTable::prepare_invoke(), if (load_receiver).
1651   int stackElementSize = Interpreter::stackElementSize;
1652   int offset = Interpreter::expr_offset_in_bytes(extra_slot_offset+0);
1653 #ifdef ASSERT
1654   int offset1 = Interpreter::expr_offset_in_bytes(extra_slot_offset+1);
1655   assert(offset1 - offset == stackElementSize, "correct arithmetic");
1656 #endif
1657   if (arg_slot.is_constant()) {
1658     return Address(esp, arg_slot.as_constant() * stackElementSize
1659                    + offset);
1660   } else {
1661     add(rscratch1, esp, arg_slot.as_register(),
1662         ext::uxtx, exact_log2(stackElementSize));
1663     return Address(rscratch1, offset);
1664   }
1665 }
1666 
1667 void MacroAssembler::call_VM_leaf_base(address entry_point,
1668                                        int number_of_arguments,
1669                                        Label *retaddr) {
1670   Label E, L;
1671 
1672   stp(rscratch1, rmethod, Address(pre(sp, -2 * wordSize)));

1673 
1674   mov(rscratch1, entry_point);
1675   blr(rscratch1);
1676   if (retaddr)
1677     bind(*retaddr);
1678 














1679   ldp(rscratch1, rmethod, Address(post(sp, 2 * wordSize)));
1680 }
1681 
1682 void MacroAssembler::call_VM_leaf(address entry_point, int number_of_arguments) {
1683   call_VM_leaf_base(entry_point, number_of_arguments);
1684 }
1685 
1686 void MacroAssembler::call_VM_leaf(address entry_point, Register arg_0) {
1687   pass_arg0(this, arg_0);
1688   call_VM_leaf_base(entry_point, 1);
1689 }
1690 
1691 void MacroAssembler::call_VM_leaf(address entry_point, Register arg_0, Register arg_1) {
1692   assert_different_registers(arg_1, c_rarg0);
1693   pass_arg0(this, arg_0);
1694   pass_arg1(this, arg_1);
1695   call_VM_leaf_base(entry_point, 2);
1696 }
1697 
1698 void MacroAssembler::call_VM_leaf(address entry_point, Register arg_0,

4904     ThreadInVMfromUnknown tiv;
4905     assert(oop_recorder() != nullptr, "this assembler needs an OopRecorder");
4906     assert(Universe::heap()->is_in(JNIHandles::resolve(obj)), "not an oop");
4907   }
4908 #endif
4909   int oop_index = oop_recorder()->find_index(obj);
4910   return Address((address)obj, oop_Relocation::spec(oop_index));
4911 }
4912 
4913 // Defines obj, preserves var_size_in_bytes, okay for t2 == var_size_in_bytes.
4914 void MacroAssembler::tlab_allocate(Register obj,
4915                                    Register var_size_in_bytes,
4916                                    int con_size_in_bytes,
4917                                    Register t1,
4918                                    Register t2,
4919                                    Label& slow_case) {
4920   BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler();
4921   bs->tlab_allocate(this, obj, var_size_in_bytes, con_size_in_bytes, t1, t2, slow_case);
4922 }
4923 
































4924 void MacroAssembler::verify_tlab() {
4925 #ifdef ASSERT
4926   if (UseTLAB && VerifyOops) {
4927     Label next, ok;
4928 
4929     stp(rscratch2, rscratch1, Address(pre(sp, -16)));
4930 
4931     ldr(rscratch2, Address(rthread, in_bytes(JavaThread::tlab_top_offset())));
4932     ldr(rscratch1, Address(rthread, in_bytes(JavaThread::tlab_start_offset())));
4933     cmp(rscratch2, rscratch1);
4934     br(Assembler::HS, next);
4935     STOP("assert(top >= start)");
4936     should_not_reach_here();
4937 
4938     bind(next);
4939     ldr(rscratch2, Address(rthread, in_bytes(JavaThread::tlab_end_offset())));
4940     ldr(rscratch1, Address(rthread, in_bytes(JavaThread::tlab_top_offset())));
4941     cmp(rscratch2, rscratch1);
4942     br(Assembler::HS, ok);
4943     STOP("assert(top <= end)");

  23  *
  24  */
  25 
  26 #include <sys/types.h>
  27 
  28 #include "precompiled.hpp"
  29 #include "asm/assembler.hpp"
  30 #include "asm/assembler.inline.hpp"
  31 #include "ci/ciEnv.hpp"
  32 #include "compiler/compileTask.hpp"
  33 #include "compiler/disassembler.hpp"
  34 #include "compiler/oopMap.hpp"
  35 #include "gc/shared/barrierSet.hpp"
  36 #include "gc/shared/barrierSetAssembler.hpp"
  37 #include "gc/shared/cardTableBarrierSet.hpp"
  38 #include "gc/shared/cardTable.hpp"
  39 #include "gc/shared/collectedHeap.hpp"
  40 #include "gc/shared/tlab_globals.hpp"
  41 #include "interpreter/bytecodeHistogram.hpp"
  42 #include "interpreter/interpreter.hpp"
  43 #include "interpreter/interpreterRuntime.hpp"
  44 #include "jvm.h"
  45 #include "memory/resourceArea.hpp"
  46 #include "memory/universe.hpp"
  47 #include "nativeInst_aarch64.hpp"
  48 #include "oops/accessDecorators.hpp"
  49 #include "oops/compressedKlass.inline.hpp"
  50 #include "oops/compressedOops.inline.hpp"
  51 #include "oops/klass.inline.hpp"
  52 #include "runtime/continuation.hpp"
  53 #include "runtime/icache.hpp"
  54 #include "runtime/interfaceSupport.inline.hpp"
  55 #include "runtime/javaThread.hpp"
  56 #include "runtime/jniHandles.inline.hpp"
  57 #include "runtime/sharedRuntime.hpp"
  58 #include "runtime/stubRoutines.hpp"
  59 #include "utilities/powerOfTwo.hpp"
  60 #ifdef COMPILER1
  61 #include "c1/c1_LIRAssembler.hpp"
  62 #endif
  63 #ifdef COMPILER2

1651   // cf. TemplateTable::prepare_invoke(), if (load_receiver).
1652   int stackElementSize = Interpreter::stackElementSize;
1653   int offset = Interpreter::expr_offset_in_bytes(extra_slot_offset+0);
1654 #ifdef ASSERT
1655   int offset1 = Interpreter::expr_offset_in_bytes(extra_slot_offset+1);
1656   assert(offset1 - offset == stackElementSize, "correct arithmetic");
1657 #endif
1658   if (arg_slot.is_constant()) {
1659     return Address(esp, arg_slot.as_constant() * stackElementSize
1660                    + offset);
1661   } else {
1662     add(rscratch1, esp, arg_slot.as_register(),
1663         ext::uxtx, exact_log2(stackElementSize));
1664     return Address(rscratch1, offset);
1665   }
1666 }
1667 
1668 void MacroAssembler::call_VM_leaf_base(address entry_point,
1669                                        int number_of_arguments,
1670                                        Label *retaddr) {
1671   Label not_preempted;
1672 
1673   stp(rscratch1, rmethod, Address(pre(sp, -2 * wordSize)));
1674   str(zr, Address(rthread, JavaThread::preempt_alternate_return_offset()));
1675 
1676   mov(rscratch1, entry_point);
1677   blr(rscratch1);
1678   if (retaddr)
1679     bind(*retaddr);
1680 
1681   if (entry_point == CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter) || 
1682       entry_point == CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter_obj)) {
1683     ldr(rscratch1, Address(rthread, JavaThread::preempt_alternate_return_offset()));
1684     ldr(rscratch2, Address(rthread, in_bytes(JavaThread::preempt_alternate_return_offset()) + wordSize));
1685     cbz(rscratch1, not_preempted);
1686     mov(r4, sp); // r4 is clobbered by VM calls, so free here
1687     cmp(rscratch2, r4);
1688     br(LT, not_preempted);
1689     str(zr, Address(rthread, JavaThread::preempt_alternate_return_offset()));
1690     str(zr, Address(rthread, in_bytes(JavaThread::preempt_alternate_return_offset()) + wordSize));
1691     br(rscratch1);
1692   }
1693 
1694   bind(not_preempted);
1695   ldp(rscratch1, rmethod, Address(post(sp, 2 * wordSize)));
1696 }
1697 
1698 void MacroAssembler::call_VM_leaf(address entry_point, int number_of_arguments) {
1699   call_VM_leaf_base(entry_point, number_of_arguments);
1700 }
1701 
1702 void MacroAssembler::call_VM_leaf(address entry_point, Register arg_0) {
1703   pass_arg0(this, arg_0);
1704   call_VM_leaf_base(entry_point, 1);
1705 }
1706 
1707 void MacroAssembler::call_VM_leaf(address entry_point, Register arg_0, Register arg_1) {
1708   assert_different_registers(arg_1, c_rarg0);
1709   pass_arg0(this, arg_0);
1710   pass_arg1(this, arg_1);
1711   call_VM_leaf_base(entry_point, 2);
1712 }
1713 
1714 void MacroAssembler::call_VM_leaf(address entry_point, Register arg_0,

4920     ThreadInVMfromUnknown tiv;
4921     assert(oop_recorder() != nullptr, "this assembler needs an OopRecorder");
4922     assert(Universe::heap()->is_in(JNIHandles::resolve(obj)), "not an oop");
4923   }
4924 #endif
4925   int oop_index = oop_recorder()->find_index(obj);
4926   return Address((address)obj, oop_Relocation::spec(oop_index));
4927 }
4928 
4929 // Defines obj, preserves var_size_in_bytes, okay for t2 == var_size_in_bytes.
4930 void MacroAssembler::tlab_allocate(Register obj,
4931                                    Register var_size_in_bytes,
4932                                    int con_size_in_bytes,
4933                                    Register t1,
4934                                    Register t2,
4935                                    Label& slow_case) {
4936   BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler();
4937   bs->tlab_allocate(this, obj, var_size_in_bytes, con_size_in_bytes, t1, t2, slow_case);
4938 }
4939 
4940 void MacroAssembler::inc_held_monitor_count() {
4941   Address dst = Address(rthread, JavaThread::held_monitor_count_offset());
4942 #ifdef ASSERT
4943   ldr(rscratch2, dst);
4944   increment(rscratch2);
4945   str(rscratch2, dst);
4946   Label ok;
4947   tbz(rscratch2, 63, ok);
4948   STOP("assert(held monitor count underflow)");
4949   should_not_reach_here();
4950   bind(ok);
4951 #else
4952   increment(dst);
4953 #endif
4954 }
4955 
4956 void MacroAssembler::dec_held_monitor_count() {
4957   Address dst = Address(rthread, JavaThread::held_monitor_count_offset());
4958 #ifdef ASSERT
4959   ldr(rscratch2, dst);
4960   decrement(rscratch2);
4961   str(rscratch2, dst);
4962   Label ok;
4963   tbz(rscratch2, 63, ok);
4964   STOP("assert(held monitor count underflow)");
4965   should_not_reach_here();
4966   bind(ok);
4967 #else
4968   decrement(dst);
4969 #endif
4970 }
4971 
4972 void MacroAssembler::verify_tlab() {
4973 #ifdef ASSERT
4974   if (UseTLAB && VerifyOops) {
4975     Label next, ok;
4976 
4977     stp(rscratch2, rscratch1, Address(pre(sp, -16)));
4978 
4979     ldr(rscratch2, Address(rthread, in_bytes(JavaThread::tlab_top_offset())));
4980     ldr(rscratch1, Address(rthread, in_bytes(JavaThread::tlab_start_offset())));
4981     cmp(rscratch2, rscratch1);
4982     br(Assembler::HS, next);
4983     STOP("assert(top >= start)");
4984     should_not_reach_here();
4985 
4986     bind(next);
4987     ldr(rscratch2, Address(rthread, in_bytes(JavaThread::tlab_end_offset())));
4988     ldr(rscratch1, Address(rthread, in_bytes(JavaThread::tlab_top_offset())));
4989     cmp(rscratch2, rscratch1);
4990     br(Assembler::HS, ok);
4991     STOP("assert(top <= end)");
< prev index next >