< prev index next >

src/cpu/aarch64/vm/macroAssembler_aarch64.cpp

Print this page




  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 "interpreter/interpreter.hpp"
  32 
  33 #include "compiler/disassembler.hpp"
  34 #include "memory/resourceArea.hpp"
  35 #include "nativeInst_aarch64.hpp"
  36 #include "oops/klass.inline.hpp"
  37 #include "oops/oop.inline.hpp"
  38 #include "opto/compile.hpp"
  39 #include "opto/node.hpp"
  40 #include "runtime/biasedLocking.hpp"
  41 #include "runtime/icache.hpp"
  42 #include "runtime/interfaceSupport.hpp"
  43 #include "runtime/sharedRuntime.hpp"

  44 
  45 #if INCLUDE_ALL_GCS
  46 #include "gc/g1/g1CollectedHeap.inline.hpp"
  47 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
  48 #include "gc/g1/heapRegion.hpp"
  49 #endif
  50 
  51 #ifdef PRODUCT
  52 #define BLOCK_COMMENT(str) /* nothing */
  53 #define STOP(error) stop(error)
  54 #else
  55 #define BLOCK_COMMENT(str) block_comment(str)
  56 #define STOP(error) block_comment(error); stop(error)
  57 #endif
  58 
  59 #define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
  60 
  61 // Patch any kind of instruction; there may be several instructions.
  62 // Return the total length (in bytes) of the instructions.
  63 int MacroAssembler::pd_patch_instruction_size(address branch, address target) {


4631       subs(len, len, 8);
4632       add(src, src, 16);
4633       br(GE, NEXT_8);
4634 
4635     BIND(LOOP_1);
4636       adds(len, len, 8);
4637       br(LE, DONE);
4638 #else
4639       cbz(len, DONE);
4640 #endif
4641     BIND(NEXT_1);
4642       ldrh(tmp1, Address(post(src, 2)));
4643       tst(tmp1, 0xff00);
4644       br(NE, DONE);
4645       strb(tmp1, Address(post(dst, 1)));
4646       subs(len, len, 1);
4647       br(GT, NEXT_1);
4648 
4649     BIND(DONE);
4650       sub(result, result, len); // Return index where we stopped




















4651 }


  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 "interpreter/interpreter.hpp"
  32 
  33 #include "compiler/disassembler.hpp"
  34 #include "memory/resourceArea.hpp"
  35 #include "nativeInst_aarch64.hpp"
  36 #include "oops/klass.inline.hpp"
  37 #include "oops/oop.inline.hpp"
  38 #include "opto/compile.hpp"
  39 #include "opto/node.hpp"
  40 #include "runtime/biasedLocking.hpp"
  41 #include "runtime/icache.hpp"
  42 #include "runtime/interfaceSupport.hpp"
  43 #include "runtime/sharedRuntime.hpp"
  44 #include "runtime/thread.hpp"
  45 
  46 #if INCLUDE_ALL_GCS
  47 #include "gc/g1/g1CollectedHeap.inline.hpp"
  48 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
  49 #include "gc/g1/heapRegion.hpp"
  50 #endif
  51 
  52 #ifdef PRODUCT
  53 #define BLOCK_COMMENT(str) /* nothing */
  54 #define STOP(error) stop(error)
  55 #else
  56 #define BLOCK_COMMENT(str) block_comment(str)
  57 #define STOP(error) block_comment(error); stop(error)
  58 #endif
  59 
  60 #define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
  61 
  62 // Patch any kind of instruction; there may be several instructions.
  63 // Return the total length (in bytes) of the instructions.
  64 int MacroAssembler::pd_patch_instruction_size(address branch, address target) {


4632       subs(len, len, 8);
4633       add(src, src, 16);
4634       br(GE, NEXT_8);
4635 
4636     BIND(LOOP_1);
4637       adds(len, len, 8);
4638       br(LE, DONE);
4639 #else
4640       cbz(len, DONE);
4641 #endif
4642     BIND(NEXT_1);
4643       ldrh(tmp1, Address(post(src, 2)));
4644       tst(tmp1, 0xff00);
4645       br(NE, DONE);
4646       strb(tmp1, Address(post(dst, 1)));
4647       subs(len, len, 1);
4648       br(GT, NEXT_1);
4649 
4650     BIND(DONE);
4651       sub(result, result, len); // Return index where we stopped
4652 }
4653 
4654 // get_thread() can be called anywhere inside generated code so we
4655 // need to save whatever non-callee save context might get clobbered
4656 // by the call to JavaThread::aarch64_get_thread_helper() or, indeed,
4657 // the call setup code.
4658 //
4659 // aarch64_get_thread_helper() clobbers only r0, r1, and flags.
4660 //
4661 void MacroAssembler::get_thread(Register dst) {
4662   RegSet saved_regs = RegSet::range(r0, r1) + lr - dst;
4663   push(saved_regs, sp);
4664 
4665   mov(lr, CAST_FROM_FN_PTR(address, JavaThread::aarch64_get_thread_helper));
4666   blrt(lr, 1, 0, 1);
4667   if (dst != c_rarg0) {
4668     mov(dst, c_rarg0);
4669   }
4670 
4671   pop(saved_regs, sp);
4672 }
< prev index next >