src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp
author naoto
Tue, 09 Jul 2019 08:05:38 -0700
changeset 55627 9c1885fb2a42
parent 54793 f4c8f88c665e
child 55521 f9a2f93a0c87
child 58678 9cf78a70fa4f
permissions -rw-r--r--
8227127: Era designator not displayed correctly using the COMPAT provider Reviewed-by: rriggs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52462
diff changeset
     2
 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
30225
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
     3
 * Copyright (c) 2014, 2015, Red Hat Inc. All rights reserved.
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
     5
 *
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
     8
 * published by the Free Software Foundation.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
     9
 *
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    14
 * accompanied this code).
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    15
 *
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    19
 *
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    22
 * questions.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    23
 *
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    24
 */
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    25
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52462
diff changeset
    26
#ifndef CPU_AARCH64_MACROASSEMBLER_AARCH64_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52462
diff changeset
    27
#define CPU_AARCH64_MACROASSEMBLER_AARCH64_HPP
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    28
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    29
#include "asm/assembler.hpp"
54793
f4c8f88c665e 8223645: AArch64 build broken by fix for 8223136
aph
parents: 54440
diff changeset
    30
#include "oops/compressedOops.hpp"
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    31
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    32
// MacroAssembler extends Assembler by frequently used macros.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    33
//
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    34
// Instructions for which a 'better' code sequence exists depending
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    35
// on arguments should also go in here.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    36
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    37
class MacroAssembler: public Assembler {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    38
  friend class LIR_Assembler;
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    39
31517
f1dc80fd7748 8129426: aarch64: add support for PopCount in C2
enevill
parents: 31414
diff changeset
    40
 public:
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    41
  using Assembler::mov;
30890
dbbc65d3cd40 8079565: aarch64: Add vectorization support for aarch64
enevill
parents: 30429
diff changeset
    42
  using Assembler::movi;
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    43
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    44
 protected:
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    45
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    46
  // Support for VM calls
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    47
  //
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    48
  // This is the base routine called by the different versions of call_VM_leaf. The interpreter
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    49
  // may customize this version by overriding it for its purposes (e.g., to save/restore
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    50
  // additional registers when doing a VM call).
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 34507
diff changeset
    51
  virtual void call_VM_leaf_base(
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    52
    address entry_point,               // the entry point
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    53
    int     number_of_arguments,        // the number of arguments to pop after the call
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    54
    Label *retaddr = NULL
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    55
  );
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    56
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 34507
diff changeset
    57
  virtual void call_VM_leaf_base(
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    58
    address entry_point,               // the entry point
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    59
    int     number_of_arguments,        // the number of arguments to pop after the call
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    60
    Label &retaddr) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    61
    call_VM_leaf_base(entry_point, number_of_arguments, &retaddr);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    62
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    63
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    64
  // This is the base routine called by the different versions of call_VM. The interpreter
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    65
  // may customize this version by overriding it for its purposes (e.g., to save/restore
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    66
  // additional registers when doing a VM call).
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    67
  //
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    68
  // If no java_thread register is specified (noreg) than rthread will be used instead. call_VM_base
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    69
  // returns the register which contains the thread upon return. If a thread register has been
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    70
  // specified, the return value will correspond to that register. If no last_java_sp is specified
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    71
  // (noreg) than rsp will be used instead.
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 34507
diff changeset
    72
  virtual void call_VM_base(           // returns the register containing the thread upon return
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    73
    Register oop_result,               // where an oop-result ends up if any; use noreg otherwise
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    74
    Register java_thread,              // the thread if computed before     ; use noreg otherwise
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    75
    Register last_java_sp,             // to set up last_Java_frame in stubs; use noreg otherwise
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    76
    address  entry_point,              // the entry point
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    77
    int      number_of_arguments,      // the number of arguments (w/o thread) to pop after the call
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    78
    bool     check_exceptions          // whether to check for pending exceptions after return
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    79
  );
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    80
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    81
  void call_VM_helper(Register oop_result, address entry_point, int number_of_arguments, bool check_exceptions = true);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    82
49481
8d02d496e785 8193266: AArch64: TestOptionsWithRanges.java SIGSEGV
smonteith
parents: 49161
diff changeset
    83
  // True if an XOR can be used to expand narrow klass references.
8d02d496e785 8193266: AArch64: TestOptionsWithRanges.java SIGSEGV
smonteith
parents: 49161
diff changeset
    84
  bool use_XOR_for_compressed_class_base;
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    85
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    86
 public:
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    87
  MacroAssembler(CodeBuffer* code) : Assembler(code) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    88
    use_XOR_for_compressed_class_base
54793
f4c8f88c665e 8223645: AArch64 build broken by fix for 8223136
aph
parents: 54440
diff changeset
    89
      = operand_valid_for_logical_immediate
f4c8f88c665e 8223645: AArch64 build broken by fix for 8223136
aph
parents: 54440
diff changeset
    90
           (/*is32*/false, (uint64_t)CompressedKlassPointers::base())
f4c8f88c665e 8223645: AArch64 build broken by fix for 8223136
aph
parents: 54440
diff changeset
    91
         && ((uint64_t)CompressedKlassPointers::base()
f4c8f88c665e 8223645: AArch64 build broken by fix for 8223136
aph
parents: 54440
diff changeset
    92
             > (1UL << log2_intptr(CompressedKlassPointers::range())));
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    93
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    94
46294
345a46524a19 8172020: Internal Error (cpu/arm/vm/frame_arm.cpp:571): assert(obj == __null || Universe::heap()->is_in(obj)) failed: sanity check #
cjplummer
parents: 43439
diff changeset
    95
 // These routines should emit JVMTI PopFrame and ForceEarlyReturn handling code.
345a46524a19 8172020: Internal Error (cpu/arm/vm/frame_arm.cpp:571): assert(obj == __null || Universe::heap()->is_in(obj)) failed: sanity check #
cjplummer
parents: 43439
diff changeset
    96
 // The implementation is only non-empty for the InterpreterMacroAssembler,
345a46524a19 8172020: Internal Error (cpu/arm/vm/frame_arm.cpp:571): assert(obj == __null || Universe::heap()->is_in(obj)) failed: sanity check #
cjplummer
parents: 43439
diff changeset
    97
 // as only the interpreter handles PopFrame and ForceEarlyReturn requests.
345a46524a19 8172020: Internal Error (cpu/arm/vm/frame_arm.cpp:571): assert(obj == __null || Universe::heap()->is_in(obj)) failed: sanity check #
cjplummer
parents: 43439
diff changeset
    98
 virtual void check_and_handle_popframe(Register java_thread);
345a46524a19 8172020: Internal Error (cpu/arm/vm/frame_arm.cpp:571): assert(obj == __null || Universe::heap()->is_in(obj)) failed: sanity check #
cjplummer
parents: 43439
diff changeset
    99
 virtual void check_and_handle_earlyret(Register java_thread);
345a46524a19 8172020: Internal Error (cpu/arm/vm/frame_arm.cpp:571): assert(obj == __null || Universe::heap()->is_in(obj)) failed: sanity check #
cjplummer
parents: 43439
diff changeset
   100
48127
efc459cf351e 8189596: AArch64: implementation for Thread-local handshakes
aph
parents: 47915
diff changeset
   101
  void safepoint_poll(Label& slow_path);
efc459cf351e 8189596: AArch64: implementation for Thread-local handshakes
aph
parents: 47915
diff changeset
   102
  void safepoint_poll_acquire(Label& slow_path);
efc459cf351e 8189596: AArch64: implementation for Thread-local handshakes
aph
parents: 47915
diff changeset
   103
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   104
  // Biased locking support
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   105
  // lock_reg and obj_reg must be loaded up with the appropriate values.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   106
  // swap_reg is killed.
32395
13b0caf18153 8133352: aarch64: generates constrained unpredictable instructions
enevill
parents: 32082
diff changeset
   107
  // tmp_reg must be supplied and must not be rscratch1 or rscratch2
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   108
  // Optional slow case is for implementations (interpreter and C1) which branch to
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   109
  // slow case directly. Leaves condition codes set for C2's Fast_Lock node.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   110
  // Returns offset of first potentially-faulting instruction for null
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   111
  // check info (currently consumed only by C1). If
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   112
  // swap_reg_contains_mark is true then returns -1 as it is assumed
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   113
  // the calling code has already passed any potential faults.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   114
  int biased_locking_enter(Register lock_reg, Register obj_reg,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   115
                           Register swap_reg, Register tmp_reg,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   116
                           bool swap_reg_contains_mark,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   117
                           Label& done, Label* slow_case = NULL,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   118
                           BiasedLockingCounters* counters = NULL);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   119
  void biased_locking_exit (Register obj_reg, Register temp_reg, Label& done);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   120
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   121
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   122
  // Helper functions for statistics gathering.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   123
  // Unconditional atomic increment.
32395
13b0caf18153 8133352: aarch64: generates constrained unpredictable instructions
enevill
parents: 32082
diff changeset
   124
  void atomic_incw(Register counter_addr, Register tmp, Register tmp2);
13b0caf18153 8133352: aarch64: generates constrained unpredictable instructions
enevill
parents: 32082
diff changeset
   125
  void atomic_incw(Address counter_addr, Register tmp1, Register tmp2, Register tmp3) {
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   126
    lea(tmp1, counter_addr);
32395
13b0caf18153 8133352: aarch64: generates constrained unpredictable instructions
enevill
parents: 32082
diff changeset
   127
    atomic_incw(tmp1, tmp2, tmp3);
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   128
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   129
  // Load Effective Address
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   130
  void lea(Register r, const Address &a) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   131
    InstructionMark im(this);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   132
    code_section()->relocate(inst_mark(), a.rspec());
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   133
    a.lea(this, r);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   134
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   135
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   136
  void addmw(Address a, Register incr, Register scratch) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   137
    ldrw(scratch, a);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   138
    addw(scratch, scratch, incr);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   139
    strw(scratch, a);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   140
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   141
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   142
  // Add constant to memory word
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   143
  void addmw(Address a, int imm, Register scratch) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   144
    ldrw(scratch, a);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   145
    if (imm > 0)
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   146
      addw(scratch, scratch, (unsigned)imm);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   147
    else
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   148
      subw(scratch, scratch, (unsigned)-imm);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   149
    strw(scratch, a);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   150
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   151
33193
c7ffe5c06513 8139041: Redundant DMB instructions
aph
parents: 33175
diff changeset
   152
  void bind(Label& L) {
c7ffe5c06513 8139041: Redundant DMB instructions
aph
parents: 33175
diff changeset
   153
    Assembler::bind(L);
49161
8f1bc5a0d16d 8196064: AArch64: Merging ld/st into ldp/stp in macro-assembler
zyao
parents: 49010
diff changeset
   154
    code()->clear_last_insn();
33193
c7ffe5c06513 8139041: Redundant DMB instructions
aph
parents: 33175
diff changeset
   155
  }
c7ffe5c06513 8139041: Redundant DMB instructions
aph
parents: 33175
diff changeset
   156
c7ffe5c06513 8139041: Redundant DMB instructions
aph
parents: 33175
diff changeset
   157
  void membar(Membar_mask_bits order_constraint);
c7ffe5c06513 8139041: Redundant DMB instructions
aph
parents: 33175
diff changeset
   158
49161
8f1bc5a0d16d 8196064: AArch64: Merging ld/st into ldp/stp in macro-assembler
zyao
parents: 49010
diff changeset
   159
  using Assembler::ldr;
8f1bc5a0d16d 8196064: AArch64: Merging ld/st into ldp/stp in macro-assembler
zyao
parents: 49010
diff changeset
   160
  using Assembler::str;
8f1bc5a0d16d 8196064: AArch64: Merging ld/st into ldp/stp in macro-assembler
zyao
parents: 49010
diff changeset
   161
8f1bc5a0d16d 8196064: AArch64: Merging ld/st into ldp/stp in macro-assembler
zyao
parents: 49010
diff changeset
   162
  void ldr(Register Rx, const Address &adr);
8f1bc5a0d16d 8196064: AArch64: Merging ld/st into ldp/stp in macro-assembler
zyao
parents: 49010
diff changeset
   163
  void ldrw(Register Rw, const Address &adr);
8f1bc5a0d16d 8196064: AArch64: Merging ld/st into ldp/stp in macro-assembler
zyao
parents: 49010
diff changeset
   164
  void str(Register Rx, const Address &adr);
8f1bc5a0d16d 8196064: AArch64: Merging ld/st into ldp/stp in macro-assembler
zyao
parents: 49010
diff changeset
   165
  void strw(Register Rx, const Address &adr);
8f1bc5a0d16d 8196064: AArch64: Merging ld/st into ldp/stp in macro-assembler
zyao
parents: 49010
diff changeset
   166
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   167
  // Frame creation and destruction shared between JITs.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   168
  void build_frame(int framesize);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   169
  void remove_frame(int framesize);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   170
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   171
  virtual void _call_Unimplemented(address call_site) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   172
    mov(rscratch2, call_site);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   173
    haltsim();
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   174
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   175
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   176
#define call_Unimplemented() _call_Unimplemented((address)__PRETTY_FUNCTION__)
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   177
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   178
  virtual void notify(int type);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   179
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   180
  // aliases defined in AARCH64 spec
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   181
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   182
  template<class T>
30225
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
   183
  inline void cmpw(Register Rd, T imm)  { subsw(zr, Rd, imm); }
51374
7be0084191ed 8206895: aarch64: rework error-prone cmp instuction
bulasevich
parents: 51350
diff changeset
   184
7be0084191ed 8206895: aarch64: rework error-prone cmp instuction
bulasevich
parents: 51350
diff changeset
   185
  inline void cmp(Register Rd, unsigned char imm8)  { subs(zr, Rd, imm8); }
7be0084191ed 8206895: aarch64: rework error-prone cmp instuction
bulasevich
parents: 51350
diff changeset
   186
  inline void cmp(Register Rd, unsigned imm) __attribute__ ((deprecated));
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   187
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   188
  inline void cmnw(Register Rd, unsigned imm) { addsw(zr, Rd, imm); }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   189
  inline void cmn(Register Rd, unsigned imm) { adds(zr, Rd, imm); }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   190
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   191
  void cset(Register Rd, Assembler::Condition cond) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   192
    csinc(Rd, zr, zr, ~cond);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   193
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   194
  void csetw(Register Rd, Assembler::Condition cond) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   195
    csincw(Rd, zr, zr, ~cond);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   196
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   197
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   198
  void cneg(Register Rd, Register Rn, Assembler::Condition cond) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   199
    csneg(Rd, Rn, Rn, ~cond);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   200
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   201
  void cnegw(Register Rd, Register Rn, Assembler::Condition cond) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   202
    csnegw(Rd, Rn, Rn, ~cond);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   203
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   204
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   205
  inline void movw(Register Rd, Register Rn) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   206
    if (Rd == sp || Rn == sp) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   207
      addw(Rd, Rn, 0U);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   208
    } else {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   209
      orrw(Rd, zr, Rn);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   210
    }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   211
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   212
  inline void mov(Register Rd, Register Rn) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   213
    assert(Rd != r31_sp && Rn != r31_sp, "should be");
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   214
    if (Rd == Rn) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   215
    } else if (Rd == sp || Rn == sp) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   216
      add(Rd, Rn, 0U);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   217
    } else {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   218
      orr(Rd, zr, Rn);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   219
    }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   220
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   221
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   222
  inline void moviw(Register Rd, unsigned imm) { orrw(Rd, zr, imm); }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   223
  inline void movi(Register Rd, unsigned imm) { orr(Rd, zr, imm); }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   224
34507
636a88905e3b 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 33193
diff changeset
   225
  inline void tstw(Register Rd, Register Rn) { andsw(zr, Rd, Rn); }
636a88905e3b 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 33193
diff changeset
   226
  inline void tst(Register Rd, Register Rn) { ands(zr, Rd, Rn); }
636a88905e3b 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 33193
diff changeset
   227
636a88905e3b 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 33193
diff changeset
   228
  inline void tstw(Register Rd, uint64_t imm) { andsw(zr, Rd, imm); }
636a88905e3b 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 33193
diff changeset
   229
  inline void tst(Register Rd, uint64_t imm) { ands(zr, Rd, imm); }
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   230
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   231
  inline void bfiw(Register Rd, Register Rn, unsigned lsb, unsigned width) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   232
    bfmw(Rd, Rn, ((32 - lsb) & 31), (width - 1));
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   233
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   234
  inline void bfi(Register Rd, Register Rn, unsigned lsb, unsigned width) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   235
    bfm(Rd, Rn, ((64 - lsb) & 63), (width - 1));
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   236
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   237
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   238
  inline void bfxilw(Register Rd, Register Rn, unsigned lsb, unsigned width) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   239
    bfmw(Rd, Rn, lsb, (lsb + width - 1));
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   240
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   241
  inline void bfxil(Register Rd, Register Rn, unsigned lsb, unsigned width) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   242
    bfm(Rd, Rn, lsb , (lsb + width - 1));
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   243
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   244
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   245
  inline void sbfizw(Register Rd, Register Rn, unsigned lsb, unsigned width) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   246
    sbfmw(Rd, Rn, ((32 - lsb) & 31), (width - 1));
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   247
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   248
  inline void sbfiz(Register Rd, Register Rn, unsigned lsb, unsigned width) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   249
    sbfm(Rd, Rn, ((64 - lsb) & 63), (width - 1));
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   250
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   251
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   252
  inline void sbfxw(Register Rd, Register Rn, unsigned lsb, unsigned width) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   253
    sbfmw(Rd, Rn, lsb, (lsb + width - 1));
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   254
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   255
  inline void sbfx(Register Rd, Register Rn, unsigned lsb, unsigned width) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   256
    sbfm(Rd, Rn, lsb , (lsb + width - 1));
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   257
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   258
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   259
  inline void ubfizw(Register Rd, Register Rn, unsigned lsb, unsigned width) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   260
    ubfmw(Rd, Rn, ((32 - lsb) & 31), (width - 1));
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   261
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   262
  inline void ubfiz(Register Rd, Register Rn, unsigned lsb, unsigned width) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   263
    ubfm(Rd, Rn, ((64 - lsb) & 63), (width - 1));
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   264
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   265
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   266
  inline void ubfxw(Register Rd, Register Rn, unsigned lsb, unsigned width) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   267
    ubfmw(Rd, Rn, lsb, (lsb + width - 1));
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   268
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   269
  inline void ubfx(Register Rd, Register Rn, unsigned lsb, unsigned width) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   270
    ubfm(Rd, Rn, lsb , (lsb + width - 1));
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   271
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   272
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   273
  inline void asrw(Register Rd, Register Rn, unsigned imm) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   274
    sbfmw(Rd, Rn, imm, 31);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   275
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   276
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   277
  inline void asr(Register Rd, Register Rn, unsigned imm) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   278
    sbfm(Rd, Rn, imm, 63);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   279
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   280
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   281
  inline void lslw(Register Rd, Register Rn, unsigned imm) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   282
    ubfmw(Rd, Rn, ((32 - imm) & 31), (31 - imm));
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   283
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   284
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   285
  inline void lsl(Register Rd, Register Rn, unsigned imm) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   286
    ubfm(Rd, Rn, ((64 - imm) & 63), (63 - imm));
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   287
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   288
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   289
  inline void lsrw(Register Rd, Register Rn, unsigned imm) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   290
    ubfmw(Rd, Rn, imm, 31);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   291
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   292
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   293
  inline void lsr(Register Rd, Register Rn, unsigned imm) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   294
    ubfm(Rd, Rn, imm, 63);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   295
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   296
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   297
  inline void rorw(Register Rd, Register Rn, unsigned imm) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   298
    extrw(Rd, Rn, Rn, imm);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   299
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   300
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   301
  inline void ror(Register Rd, Register Rn, unsigned imm) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   302
    extr(Rd, Rn, Rn, imm);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   303
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   304
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   305
  inline void sxtbw(Register Rd, Register Rn) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   306
    sbfmw(Rd, Rn, 0, 7);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   307
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   308
  inline void sxthw(Register Rd, Register Rn) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   309
    sbfmw(Rd, Rn, 0, 15);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   310
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   311
  inline void sxtb(Register Rd, Register Rn) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   312
    sbfm(Rd, Rn, 0, 7);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   313
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   314
  inline void sxth(Register Rd, Register Rn) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   315
    sbfm(Rd, Rn, 0, 15);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   316
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   317
  inline void sxtw(Register Rd, Register Rn) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   318
    sbfm(Rd, Rn, 0, 31);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   319
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   320
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   321
  inline void uxtbw(Register Rd, Register Rn) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   322
    ubfmw(Rd, Rn, 0, 7);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   323
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   324
  inline void uxthw(Register Rd, Register Rn) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   325
    ubfmw(Rd, Rn, 0, 15);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   326
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   327
  inline void uxtb(Register Rd, Register Rn) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   328
    ubfm(Rd, Rn, 0, 7);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   329
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   330
  inline void uxth(Register Rd, Register Rn) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   331
    ubfm(Rd, Rn, 0, 15);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   332
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   333
  inline void uxtw(Register Rd, Register Rn) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   334
    ubfm(Rd, Rn, 0, 31);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   335
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   336
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   337
  inline void cmnw(Register Rn, Register Rm) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   338
    addsw(zr, Rn, Rm);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   339
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   340
  inline void cmn(Register Rn, Register Rm) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   341
    adds(zr, Rn, Rm);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   342
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   343
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   344
  inline void cmpw(Register Rn, Register Rm) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   345
    subsw(zr, Rn, Rm);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   346
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   347
  inline void cmp(Register Rn, Register Rm) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   348
    subs(zr, Rn, Rm);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   349
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   350
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   351
  inline void negw(Register Rd, Register Rn) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   352
    subw(Rd, zr, Rn);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   353
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   354
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   355
  inline void neg(Register Rd, Register Rn) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   356
    sub(Rd, zr, Rn);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   357
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   358
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   359
  inline void negsw(Register Rd, Register Rn) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   360
    subsw(Rd, zr, Rn);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   361
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   362
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   363
  inline void negs(Register Rd, Register Rn) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   364
    subs(Rd, zr, Rn);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   365
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   366
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   367
  inline void cmnw(Register Rn, Register Rm, enum shift_kind kind, unsigned shift = 0) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   368
    addsw(zr, Rn, Rm, kind, shift);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   369
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   370
  inline void cmn(Register Rn, Register Rm, enum shift_kind kind, unsigned shift = 0) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   371
    adds(zr, Rn, Rm, kind, shift);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   372
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   373
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   374
  inline void cmpw(Register Rn, Register Rm, enum shift_kind kind, unsigned shift = 0) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   375
    subsw(zr, Rn, Rm, kind, shift);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   376
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   377
  inline void cmp(Register Rn, Register Rm, enum shift_kind kind, unsigned shift = 0) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   378
    subs(zr, Rn, Rm, kind, shift);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   379
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   380
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   381
  inline void negw(Register Rd, Register Rn, enum shift_kind kind, unsigned shift = 0) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   382
    subw(Rd, zr, Rn, kind, shift);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   383
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   384
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   385
  inline void neg(Register Rd, Register Rn, enum shift_kind kind, unsigned shift = 0) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   386
    sub(Rd, zr, Rn, kind, shift);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   387
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   388
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   389
  inline void negsw(Register Rd, Register Rn, enum shift_kind kind, unsigned shift = 0) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   390
    subsw(Rd, zr, Rn, kind, shift);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   391
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   392
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   393
  inline void negs(Register Rd, Register Rn, enum shift_kind kind, unsigned shift = 0) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   394
    subs(Rd, zr, Rn, kind, shift);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   395
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   396
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   397
  inline void mnegw(Register Rd, Register Rn, Register Rm) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   398
    msubw(Rd, Rn, Rm, zr);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   399
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   400
  inline void mneg(Register Rd, Register Rn, Register Rm) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   401
    msub(Rd, Rn, Rm, zr);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   402
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   403
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   404
  inline void mulw(Register Rd, Register Rn, Register Rm) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   405
    maddw(Rd, Rn, Rm, zr);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   406
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   407
  inline void mul(Register Rd, Register Rn, Register Rm) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   408
    madd(Rd, Rn, Rm, zr);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   409
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   410
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   411
  inline void smnegl(Register Rd, Register Rn, Register Rm) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   412
    smsubl(Rd, Rn, Rm, zr);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   413
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   414
  inline void smull(Register Rd, Register Rn, Register Rm) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   415
    smaddl(Rd, Rn, Rm, zr);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   416
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   417
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   418
  inline void umnegl(Register Rd, Register Rn, Register Rm) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   419
    umsubl(Rd, Rn, Rm, zr);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   420
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   421
  inline void umull(Register Rd, Register Rn, Register Rm) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   422
    umaddl(Rd, Rn, Rm, zr);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   423
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   424
30429
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 30225
diff changeset
   425
#define WRAP(INSN)                                                            \
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 30225
diff changeset
   426
  void INSN(Register Rd, Register Rn, Register Rm, Register Ra) {             \
35148
5cfafc99d791 8143072: [JVMCI] Port JVMCI to AArch64
twisti
parents: 35125
diff changeset
   427
    if ((VM_Version::features() & VM_Version::CPU_A53MAC) && Ra != zr)        \
30429
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 30225
diff changeset
   428
      nop();                                                                  \
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 30225
diff changeset
   429
    Assembler::INSN(Rd, Rn, Rm, Ra);                                          \
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 30225
diff changeset
   430
  }
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 30225
diff changeset
   431
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 30225
diff changeset
   432
  WRAP(madd) WRAP(msub) WRAP(maddw) WRAP(msubw)
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 30225
diff changeset
   433
  WRAP(smaddl) WRAP(smsubl) WRAP(umaddl) WRAP(umsubl)
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 30225
diff changeset
   434
#undef WRAP
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 30225
diff changeset
   435
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 30225
diff changeset
   436
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   437
  // macro assembly operations needed for aarch64
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   438
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   439
  // first two private routines for loading 32 bit or 64 bit constants
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   440
private:
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   441
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   442
  void mov_immediate64(Register dst, u_int64_t imm64);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   443
  void mov_immediate32(Register dst, u_int32_t imm32);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   444
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   445
  int push(unsigned int bitset, Register stack);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   446
  int pop(unsigned int bitset, Register stack);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   447
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   448
  void mov(Register dst, Address a);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   449
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   450
public:
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   451
  void push(RegSet regs, Register stack) { if (regs.bits()) push(regs.bits(), stack); }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   452
  void pop(RegSet regs, Register stack) { if (regs.bits()) pop(regs.bits(), stack); }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   453
35579
d21d5a0db03f 8146709: AArch64: Incorrect use of ADRP for byte_map_base
aph
parents: 35232
diff changeset
   454
  // Push and pop everything that might be clobbered by a native
d21d5a0db03f 8146709: AArch64: Incorrect use of ADRP for byte_map_base
aph
parents: 35232
diff changeset
   455
  // runtime call except rscratch1 and rscratch2.  (They are always
d21d5a0db03f 8146709: AArch64: Incorrect use of ADRP for byte_map_base
aph
parents: 35232
diff changeset
   456
  // scratch, so we don't have to protect them.)  Only save the lower
d21d5a0db03f 8146709: AArch64: Incorrect use of ADRP for byte_map_base
aph
parents: 35232
diff changeset
   457
  // 64 bits of each vector register.
d21d5a0db03f 8146709: AArch64: Incorrect use of ADRP for byte_map_base
aph
parents: 35232
diff changeset
   458
  void push_call_clobbered_registers();
d21d5a0db03f 8146709: AArch64: Incorrect use of ADRP for byte_map_base
aph
parents: 35232
diff changeset
   459
  void pop_call_clobbered_registers();
d21d5a0db03f 8146709: AArch64: Incorrect use of ADRP for byte_map_base
aph
parents: 35232
diff changeset
   460
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   461
  // now mov instructions for loading absolute addresses and 32 or
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   462
  // 64 bit integers
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   463
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   464
  inline void mov(Register dst, address addr)
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   465
  {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   466
    mov_immediate64(dst, (u_int64_t)addr);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   467
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   468
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   469
  inline void mov(Register dst, u_int64_t imm64)
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   470
  {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   471
    mov_immediate64(dst, imm64);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   472
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   473
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   474
  inline void movw(Register dst, u_int32_t imm32)
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   475
  {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   476
    mov_immediate32(dst, imm32);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   477
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   478
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   479
  inline void mov(Register dst, long l)
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   480
  {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   481
    mov(dst, (u_int64_t)l);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   482
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   483
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   484
  inline void mov(Register dst, int i)
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   485
  {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   486
    mov(dst, (long)i);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   487
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   488
31955
c6ac18ab3d6b 8131779: AARCH64: add Montgomery multiply intrinsic
aph
parents: 31591
diff changeset
   489
  void mov(Register dst, RegisterOrConstant src) {
c6ac18ab3d6b 8131779: AARCH64: add Montgomery multiply intrinsic
aph
parents: 31591
diff changeset
   490
    if (src.is_register())
c6ac18ab3d6b 8131779: AARCH64: add Montgomery multiply intrinsic
aph
parents: 31591
diff changeset
   491
      mov(dst, src.as_register());
c6ac18ab3d6b 8131779: AARCH64: add Montgomery multiply intrinsic
aph
parents: 31591
diff changeset
   492
    else
c6ac18ab3d6b 8131779: AARCH64: add Montgomery multiply intrinsic
aph
parents: 31591
diff changeset
   493
      mov(dst, src.as_constant());
c6ac18ab3d6b 8131779: AARCH64: add Montgomery multiply intrinsic
aph
parents: 31591
diff changeset
   494
  }
c6ac18ab3d6b 8131779: AARCH64: add Montgomery multiply intrinsic
aph
parents: 31591
diff changeset
   495
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   496
  void movptr(Register r, uintptr_t imm64);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   497
31227
964d24a82077 8129551: aarch64: some regressions introduced by addition of vectorisation code
enevill
parents: 30890
diff changeset
   498
  void mov(FloatRegister Vd, SIMD_Arrangement T, u_int32_t imm32);
30890
dbbc65d3cd40 8079565: aarch64: Add vectorization support for aarch64
enevill
parents: 30429
diff changeset
   499
31954
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
   500
  void mov(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn) {
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
   501
    orr(Vd, T, Vn, Vn);
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
   502
  }
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
   503
35125
6982b109eeee 8145438: Guarantee failures since 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 35086
diff changeset
   504
public:
6982b109eeee 8145438: Guarantee failures since 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 35086
diff changeset
   505
6982b109eeee 8145438: Guarantee failures since 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 35086
diff changeset
   506
  // Generalized Test Bit And Branch, including a "far" variety which
6982b109eeee 8145438: Guarantee failures since 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 35086
diff changeset
   507
  // spans more than 32KiB.
6982b109eeee 8145438: Guarantee failures since 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 35086
diff changeset
   508
  void tbr(Condition cond, Register Rt, int bitpos, Label &dest, bool far = false) {
6982b109eeee 8145438: Guarantee failures since 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 35086
diff changeset
   509
    assert(cond == EQ || cond == NE, "must be");
6982b109eeee 8145438: Guarantee failures since 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 35086
diff changeset
   510
6982b109eeee 8145438: Guarantee failures since 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 35086
diff changeset
   511
    if (far)
6982b109eeee 8145438: Guarantee failures since 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 35086
diff changeset
   512
      cond = ~cond;
6982b109eeee 8145438: Guarantee failures since 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 35086
diff changeset
   513
6982b109eeee 8145438: Guarantee failures since 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 35086
diff changeset
   514
    void (Assembler::* branch)(Register Rt, int bitpos, Label &L);
6982b109eeee 8145438: Guarantee failures since 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 35086
diff changeset
   515
    if (cond == Assembler::EQ)
6982b109eeee 8145438: Guarantee failures since 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 35086
diff changeset
   516
      branch = &Assembler::tbz;
6982b109eeee 8145438: Guarantee failures since 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 35086
diff changeset
   517
    else
6982b109eeee 8145438: Guarantee failures since 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 35086
diff changeset
   518
      branch = &Assembler::tbnz;
6982b109eeee 8145438: Guarantee failures since 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 35086
diff changeset
   519
6982b109eeee 8145438: Guarantee failures since 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 35086
diff changeset
   520
    if (far) {
6982b109eeee 8145438: Guarantee failures since 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 35086
diff changeset
   521
      Label L;
6982b109eeee 8145438: Guarantee failures since 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 35086
diff changeset
   522
      (this->*branch)(Rt, bitpos, L);
6982b109eeee 8145438: Guarantee failures since 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 35086
diff changeset
   523
      b(dest);
6982b109eeee 8145438: Guarantee failures since 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 35086
diff changeset
   524
      bind(L);
6982b109eeee 8145438: Guarantee failures since 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 35086
diff changeset
   525
    } else {
6982b109eeee 8145438: Guarantee failures since 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 35086
diff changeset
   526
      (this->*branch)(Rt, bitpos, dest);
6982b109eeee 8145438: Guarantee failures since 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 35086
diff changeset
   527
    }
6982b109eeee 8145438: Guarantee failures since 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 35086
diff changeset
   528
  }
6982b109eeee 8145438: Guarantee failures since 8144028: Use AArch64 bit-test instructions in C2
aph
parents: 35086
diff changeset
   529
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   530
  // macro instructions for accessing and updating floating point
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   531
  // status register
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   532
  //
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   533
  // FPSR : op1 == 011
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   534
  //        CRn == 0100
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   535
  //        CRm == 0100
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   536
  //        op2 == 001
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   537
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   538
  inline void get_fpsr(Register reg)
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   539
  {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   540
    mrs(0b11, 0b0100, 0b0100, 0b001, reg);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   541
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   542
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   543
  inline void set_fpsr(Register reg)
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   544
  {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   545
    msr(0b011, 0b0100, 0b0100, 0b001, reg);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   546
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   547
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   548
  inline void clear_fpsr()
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   549
  {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   550
    msr(0b011, 0b0100, 0b0100, 0b001, zr);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   551
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   552
38143
3b732f17ea7d 8155617: aarch64: ClearArray does not use DC ZVA
enevill
parents: 38037
diff changeset
   553
  // DCZID_EL0: op1 == 011
3b732f17ea7d 8155617: aarch64: ClearArray does not use DC ZVA
enevill
parents: 38037
diff changeset
   554
  //            CRn == 0000
3b732f17ea7d 8155617: aarch64: ClearArray does not use DC ZVA
enevill
parents: 38037
diff changeset
   555
  //            CRm == 0000
3b732f17ea7d 8155617: aarch64: ClearArray does not use DC ZVA
enevill
parents: 38037
diff changeset
   556
  //            op2 == 111
3b732f17ea7d 8155617: aarch64: ClearArray does not use DC ZVA
enevill
parents: 38037
diff changeset
   557
  inline void get_dczid_el0(Register reg)
3b732f17ea7d 8155617: aarch64: ClearArray does not use DC ZVA
enevill
parents: 38037
diff changeset
   558
  {
3b732f17ea7d 8155617: aarch64: ClearArray does not use DC ZVA
enevill
parents: 38037
diff changeset
   559
    mrs(0b011, 0b0000, 0b0000, 0b111, reg);
3b732f17ea7d 8155617: aarch64: ClearArray does not use DC ZVA
enevill
parents: 38037
diff changeset
   560
  }
3b732f17ea7d 8155617: aarch64: ClearArray does not use DC ZVA
enevill
parents: 38037
diff changeset
   561
38714
170464570e45 8157841: aarch64: prefetch ignores cache line size
enevill
parents: 38713
diff changeset
   562
  // CTR_EL0:   op1 == 011
170464570e45 8157841: aarch64: prefetch ignores cache line size
enevill
parents: 38713
diff changeset
   563
  //            CRn == 0000
170464570e45 8157841: aarch64: prefetch ignores cache line size
enevill
parents: 38713
diff changeset
   564
  //            CRm == 0000
170464570e45 8157841: aarch64: prefetch ignores cache line size
enevill
parents: 38713
diff changeset
   565
  //            op2 == 001
170464570e45 8157841: aarch64: prefetch ignores cache line size
enevill
parents: 38713
diff changeset
   566
  inline void get_ctr_el0(Register reg)
170464570e45 8157841: aarch64: prefetch ignores cache line size
enevill
parents: 38713
diff changeset
   567
  {
170464570e45 8157841: aarch64: prefetch ignores cache line size
enevill
parents: 38713
diff changeset
   568
    mrs(0b011, 0b0000, 0b0000, 0b001, reg);
170464570e45 8157841: aarch64: prefetch ignores cache line size
enevill
parents: 38713
diff changeset
   569
  }
170464570e45 8157841: aarch64: prefetch ignores cache line size
enevill
parents: 38713
diff changeset
   570
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   571
  // idiv variant which deals with MINLONG as dividend and -1 as divisor
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   572
  int corrected_idivl(Register result, Register ra, Register rb,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   573
                      bool want_remainder, Register tmp = rscratch1);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   574
  int corrected_idivq(Register result, Register ra, Register rb,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   575
                      bool want_remainder, Register tmp = rscratch1);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   576
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   577
  // Support for NULL-checks
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   578
  //
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   579
  // Generates code that causes a NULL OS exception if the content of reg is NULL.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   580
  // If the accessed location is M[reg + offset] and the offset is known, provide the
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   581
  // offset. No explicit code generation is needed if the offset is within a certain
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   582
  // range (0 <= offset <= page_size).
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   583
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   584
  virtual void null_check(Register reg, int offset = -1);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   585
  static bool needs_explicit_null_check(intptr_t offset);
52462
4ad404da0088 8213199: GC abstraction for Assembler::needs_explicit_null_check()
rkennke
parents: 52460
diff changeset
   586
  static bool uses_implicit_null_check(void* address);
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   587
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   588
  static address target_addr_for_insn(address insn_addr, unsigned insn);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   589
  static address target_addr_for_insn(address insn_addr) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   590
    unsigned insn = *(unsigned*)insn_addr;
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   591
    return target_addr_for_insn(insn_addr, insn);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   592
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   593
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   594
  // Required platform-specific helpers for Label::patch_instructions.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   595
  // They _shadow_ the declarations in AbstractAssembler, which are undefined.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   596
  static int pd_patch_instruction_size(address branch, address target);
51633
21154cb84d2a 8209594: guarantee(this->is8bit(imm8)) failed: Short forward jump exceeds 8-bit offset
kvn
parents: 51374
diff changeset
   597
  static void pd_patch_instruction(address branch, address target, const char* file = NULL, int line = 0) {
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   598
    pd_patch_instruction_size(branch, target);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   599
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   600
  static address pd_call_destination(address branch) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   601
    return target_addr_for_insn(branch);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   602
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   603
#ifndef PRODUCT
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   604
  static void pd_print_patched_instruction(address branch);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   605
#endif
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   606
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   607
  static int patch_oop(address insn_addr, address o);
42605
c127902170ee 8170106: AArch64: Multiple JVMCI issues
aph
parents: 41670
diff changeset
   608
  static int patch_narrow_klass(address insn_addr, narrowKlass n);
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   609
32082
2a3323e25de1 8130309: Need to bailout cleanly if creation of stubs fails when codecache is out of space
thartmann
parents: 31956
diff changeset
   610
  address emit_trampoline_stub(int insts_call_instruction_offset, address target);
54440
23a04fe2aca2 8219993: AArch64: Compiled CI stubs are unsafely modified
aph
parents: 53244
diff changeset
   611
  void emit_static_call_stub();
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   612
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   613
  // The following 4 methods return the offset of the appropriate move instruction
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   614
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   615
  // Support for fast byte/short loading with zero extension (depending on particular CPU)
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   616
  int load_unsigned_byte(Register dst, Address src);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   617
  int load_unsigned_short(Register dst, Address src);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   618
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   619
  // Support for fast byte/short loading with sign extension (depending on particular CPU)
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   620
  int load_signed_byte(Register dst, Address src);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   621
  int load_signed_short(Register dst, Address src);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   622
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   623
  int load_signed_byte32(Register dst, Address src);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   624
  int load_signed_short32(Register dst, Address src);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   625
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   626
  // Support for sign-extension (hi:lo = extend_sign(lo))
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   627
  void extend_sign(Register hi, Register lo);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   628
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   629
  // Load and store values by size and signed-ness
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   630
  void load_sized_value(Register dst, Address src, size_t size_in_bytes, bool is_signed, Register dst2 = noreg);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   631
  void store_sized_value(Address dst, Register src, size_t size_in_bytes, Register src2 = noreg);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   632
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   633
  // Support for inc/dec with optimal instruction selection depending on value
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   634
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   635
  // x86_64 aliases an unqualified register/address increment and
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   636
  // decrement to call incrementq and decrementq but also supports
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   637
  // explicitly sized calls to incrementq/decrementq or
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   638
  // incrementl/decrementl
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   639
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   640
  // for aarch64 the proper convention would be to use
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   641
  // increment/decrement for 64 bit operatons and
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   642
  // incrementw/decrementw for 32 bit operations. so when porting
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   643
  // x86_64 code we can leave calls to increment/decrement as is,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   644
  // replace incrementq/decrementq with increment/decrement and
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   645
  // replace incrementl/decrementl with incrementw/decrementw.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   646
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   647
  // n.b. increment/decrement calls with an Address destination will
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   648
  // need to use a scratch register to load the value to be
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   649
  // incremented. increment/decrement calls which add or subtract a
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   650
  // constant value greater than 2^12 will need to use a 2nd scratch
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   651
  // register to hold the constant. so, a register increment/decrement
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   652
  // may trash rscratch2 and an address increment/decrement trash
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   653
  // rscratch and rscratch2
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   654
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   655
  void decrementw(Address dst, int value = 1);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   656
  void decrementw(Register reg, int value = 1);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   657
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   658
  void decrement(Register reg, int value = 1);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   659
  void decrement(Address dst, int value = 1);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   660
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   661
  void incrementw(Address dst, int value = 1);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   662
  void incrementw(Register reg, int value = 1);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   663
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   664
  void increment(Register reg, int value = 1);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   665
  void increment(Address dst, int value = 1);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   666
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   667
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   668
  // Alignment
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   669
  void align(int modulus);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   670
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   671
  // Stack frame creation/removal
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   672
  void enter()
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   673
  {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   674
    stp(rfp, lr, Address(pre(sp, -2 * wordSize)));
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   675
    mov(rfp, sp);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   676
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   677
  void leave()
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   678
  {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   679
    mov(sp, rfp);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   680
    ldp(rfp, lr, Address(post(sp, 2 * wordSize)));
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   681
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   682
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   683
  // Support for getting the JavaThread pointer (i.e.; a reference to thread-local information)
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   684
  // The pointer will be loaded into the thread register.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   685
  void get_thread(Register thread);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   686
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   687
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   688
  // Support for VM calls
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   689
  //
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   690
  // It is imperative that all calls into the VM are handled via the call_VM macros.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   691
  // They make sure that the stack linkage is setup correctly. call_VM's correspond
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   692
  // to ENTRY/ENTRY_X entry points while call_VM_leaf's correspond to LEAF entry points.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   693
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   694
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   695
  void call_VM(Register oop_result,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   696
               address entry_point,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   697
               bool check_exceptions = true);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   698
  void call_VM(Register oop_result,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   699
               address entry_point,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   700
               Register arg_1,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   701
               bool check_exceptions = true);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   702
  void call_VM(Register oop_result,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   703
               address entry_point,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   704
               Register arg_1, Register arg_2,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   705
               bool check_exceptions = true);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   706
  void call_VM(Register oop_result,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   707
               address entry_point,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   708
               Register arg_1, Register arg_2, Register arg_3,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   709
               bool check_exceptions = true);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   710
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   711
  // Overloadings with last_Java_sp
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   712
  void call_VM(Register oop_result,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   713
               Register last_java_sp,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   714
               address entry_point,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   715
               int number_of_arguments = 0,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   716
               bool check_exceptions = true);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   717
  void call_VM(Register oop_result,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   718
               Register last_java_sp,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   719
               address entry_point,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   720
               Register arg_1, bool
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   721
               check_exceptions = true);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   722
  void call_VM(Register oop_result,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   723
               Register last_java_sp,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   724
               address entry_point,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   725
               Register arg_1, Register arg_2,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   726
               bool check_exceptions = true);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   727
  void call_VM(Register oop_result,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   728
               Register last_java_sp,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   729
               address entry_point,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   730
               Register arg_1, Register arg_2, Register arg_3,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   731
               bool check_exceptions = true);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   732
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   733
  void get_vm_result  (Register oop_result, Register thread);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   734
  void get_vm_result_2(Register metadata_result, Register thread);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   735
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   736
  // These always tightly bind to MacroAssembler::call_VM_base
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   737
  // bypassing the virtual implementation
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   738
  void super_call_VM(Register oop_result, Register last_java_sp, address entry_point, int number_of_arguments = 0, bool check_exceptions = true);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   739
  void super_call_VM(Register oop_result, Register last_java_sp, address entry_point, Register arg_1, bool check_exceptions = true);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   740
  void super_call_VM(Register oop_result, Register last_java_sp, address entry_point, Register arg_1, Register arg_2, bool check_exceptions = true);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   741
  void super_call_VM(Register oop_result, Register last_java_sp, address entry_point, Register arg_1, Register arg_2, Register arg_3, bool check_exceptions = true);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   742
  void super_call_VM(Register oop_result, Register last_java_sp, address entry_point, Register arg_1, Register arg_2, Register arg_3, Register arg_4, bool check_exceptions = true);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   743
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   744
  void call_VM_leaf(address entry_point,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   745
                    int number_of_arguments = 0);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   746
  void call_VM_leaf(address entry_point,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   747
                    Register arg_1);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   748
  void call_VM_leaf(address entry_point,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   749
                    Register arg_1, Register arg_2);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   750
  void call_VM_leaf(address entry_point,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   751
                    Register arg_1, Register arg_2, Register arg_3);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   752
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   753
  // These always tightly bind to MacroAssembler::call_VM_leaf_base
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   754
  // bypassing the virtual implementation
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   755
  void super_call_VM_leaf(address entry_point);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   756
  void super_call_VM_leaf(address entry_point, Register arg_1);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   757
  void super_call_VM_leaf(address entry_point, Register arg_1, Register arg_2);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   758
  void super_call_VM_leaf(address entry_point, Register arg_1, Register arg_2, Register arg_3);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   759
  void super_call_VM_leaf(address entry_point, Register arg_1, Register arg_2, Register arg_3, Register arg_4);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   760
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   761
  // last Java Frame (fills frame anchor)
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   762
  void set_last_Java_frame(Register last_java_sp,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   763
                           Register last_java_fp,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   764
                           address last_java_pc,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   765
                           Register scratch);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   766
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   767
  void set_last_Java_frame(Register last_java_sp,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   768
                           Register last_java_fp,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   769
                           Label &last_java_pc,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   770
                           Register scratch);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   771
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   772
  void set_last_Java_frame(Register last_java_sp,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   773
                           Register last_java_fp,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   774
                           Register last_java_pc,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   775
                           Register scratch);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   776
40643
49539fc14e5a 8164113: AArch64: follow-up the fix for 8161598
aph
parents: 40049
diff changeset
   777
  void reset_last_Java_frame(Register thread);
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   778
40643
49539fc14e5a 8164113: AArch64: follow-up the fix for 8161598
aph
parents: 40049
diff changeset
   779
  // thread in the default location (rthread)
49539fc14e5a 8164113: AArch64: follow-up the fix for 8161598
aph
parents: 40049
diff changeset
   780
  void reset_last_Java_frame(bool clear_fp);
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   781
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   782
  // Stores
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   783
  void store_check(Register obj);                // store check for obj - register is destroyed afterwards
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   784
  void store_check(Register obj, Address dst);   // same as above, dst is exact store location (reg. is destroyed)
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   785
49748
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49724
diff changeset
   786
  void resolve_jobject(Register value, Register thread, Register tmp);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49724
diff changeset
   787
51866
703813b05838 8211064: [AArch64] Interpreter and c1 don't correctly handle jboolean results in native calls
aph
parents: 51633
diff changeset
   788
  // C 'boolean' to Java boolean: x == 0 ? 0 : 1
703813b05838 8211064: [AArch64] Interpreter and c1 don't correctly handle jboolean results in native calls
aph
parents: 51633
diff changeset
   789
  void c2bool(Register x);
703813b05838 8211064: [AArch64] Interpreter and c1 don't correctly handle jboolean results in native calls
aph
parents: 51633
diff changeset
   790
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   791
  // oop manipulations
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   792
  void load_klass(Register dst, Register src);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   793
  void store_klass(Register dst, Register src);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   794
  void cmp_klass(Register oop, Register trial_klass, Register tmp);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   795
49816
a3e79f97e86b 8200555: OopHandle should use Access API
coleenp
parents: 49748
diff changeset
   796
  void resolve_oop_handle(Register result, Register tmp = r5);
a3e79f97e86b 8200555: OopHandle should use Access API
coleenp
parents: 49748
diff changeset
   797
  void load_mirror(Register dst, Register method, Register tmp = r5);
38074
8475fdc6dcc3 8154580: Save mirror in interpreter frame to enable cleanups of CLDClosure
coleenp
parents: 38057
diff changeset
   798
50110
3d98842c8677 8202714: Create a MacroAssembler::access_load/store_at wrapper for AArch64
rkennke
parents: 49982
diff changeset
   799
  void access_load_at(BasicType type, DecoratorSet decorators, Register dst, Address src,
3d98842c8677 8202714: Create a MacroAssembler::access_load/store_at wrapper for AArch64
rkennke
parents: 49982
diff changeset
   800
                      Register tmp1, Register tmp_thread);
3d98842c8677 8202714: Create a MacroAssembler::access_load/store_at wrapper for AArch64
rkennke
parents: 49982
diff changeset
   801
3d98842c8677 8202714: Create a MacroAssembler::access_load/store_at wrapper for AArch64
rkennke
parents: 49982
diff changeset
   802
  void access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register src,
3d98842c8677 8202714: Create a MacroAssembler::access_load/store_at wrapper for AArch64
rkennke
parents: 49982
diff changeset
   803
                       Register tmp1, Register tmp_thread);
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   804
51350
57565f7dcb2a 8205523: Explicit barriers for interpreter
rkennke
parents: 50757
diff changeset
   805
  // Resolves obj for access. Result is placed in the same register.
57565f7dcb2a 8205523: Explicit barriers for interpreter
rkennke
parents: 50757
diff changeset
   806
  // All other registers are preserved.
57565f7dcb2a 8205523: Explicit barriers for interpreter
rkennke
parents: 50757
diff changeset
   807
  void resolve(DecoratorSet decorators, Register obj);
57565f7dcb2a 8205523: Explicit barriers for interpreter
rkennke
parents: 50757
diff changeset
   808
50110
3d98842c8677 8202714: Create a MacroAssembler::access_load/store_at wrapper for AArch64
rkennke
parents: 49982
diff changeset
   809
  void load_heap_oop(Register dst, Address src, Register tmp1 = noreg,
3d98842c8677 8202714: Create a MacroAssembler::access_load/store_at wrapper for AArch64
rkennke
parents: 49982
diff changeset
   810
                     Register thread_tmp = noreg, DecoratorSet decorators = 0);
3d98842c8677 8202714: Create a MacroAssembler::access_load/store_at wrapper for AArch64
rkennke
parents: 49982
diff changeset
   811
3d98842c8677 8202714: Create a MacroAssembler::access_load/store_at wrapper for AArch64
rkennke
parents: 49982
diff changeset
   812
  void load_heap_oop_not_null(Register dst, Address src, Register tmp1 = noreg,
3d98842c8677 8202714: Create a MacroAssembler::access_load/store_at wrapper for AArch64
rkennke
parents: 49982
diff changeset
   813
                              Register thread_tmp = noreg, DecoratorSet decorators = 0);
3d98842c8677 8202714: Create a MacroAssembler::access_load/store_at wrapper for AArch64
rkennke
parents: 49982
diff changeset
   814
  void store_heap_oop(Address dst, Register src, Register tmp1 = noreg,
3d98842c8677 8202714: Create a MacroAssembler::access_load/store_at wrapper for AArch64
rkennke
parents: 49982
diff changeset
   815
                      Register tmp_thread = noreg, DecoratorSet decorators = 0);
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   816
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   817
  // currently unimplemented
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   818
  // Used for storing NULL. All other oop constants should be
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   819
  // stored using routines that take a jobject.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   820
  void store_heap_oop_null(Address dst);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   821
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   822
  void load_prototype_header(Register dst, Register src);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   823
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   824
  void store_klass_gap(Register dst, Register src);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   825
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   826
  // This dummy is to prevent a call to store_heap_oop from
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   827
  // converting a zero (like NULL) into a Register by giving
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   828
  // the compiler two choices it can't resolve
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   829
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   830
  void store_heap_oop(Address dst, void* dummy);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   831
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   832
  void encode_heap_oop(Register d, Register s);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   833
  void encode_heap_oop(Register r) { encode_heap_oop(r, r); }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   834
  void decode_heap_oop(Register d, Register s);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   835
  void decode_heap_oop(Register r) { decode_heap_oop(r, r); }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   836
  void encode_heap_oop_not_null(Register r);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   837
  void decode_heap_oop_not_null(Register r);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   838
  void encode_heap_oop_not_null(Register dst, Register src);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   839
  void decode_heap_oop_not_null(Register dst, Register src);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   840
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   841
  void set_narrow_oop(Register dst, jobject obj);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   842
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   843
  void encode_klass_not_null(Register r);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   844
  void decode_klass_not_null(Register r);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   845
  void encode_klass_not_null(Register dst, Register src);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   846
  void decode_klass_not_null(Register dst, Register src);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   847
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   848
  void set_narrow_klass(Register dst, Klass* k);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   849
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   850
  // if heap base register is used - reinit it with the correct value
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   851
  void reinit_heapbase();
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   852
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   853
  DEBUG_ONLY(void verify_heapbase(const char* msg);)
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   854
33061
69a83b5ce390 8136524: aarch64: test/compiler/runtime/7196199/Test7196199.java fails
enevill
parents: 32725
diff changeset
   855
  void push_CPU_state(bool save_vectors = false);
69a83b5ce390 8136524: aarch64: test/compiler/runtime/7196199/Test7196199.java fails
enevill
parents: 32725
diff changeset
   856
  void pop_CPU_state(bool restore_vectors = false) ;
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   857
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   858
  // Round up to a power of two
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   859
  void round_to(Register reg, int modulus);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   860
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   861
  // allocation
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   862
  void eden_allocate(
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   863
    Register obj,                      // result: pointer to object after successful allocation
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   864
    Register var_size_in_bytes,        // object size in bytes if unknown at compile time; invalid otherwise
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   865
    int      con_size_in_bytes,        // object size in bytes if   known at compile time
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   866
    Register t1,                       // temp register
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   867
    Label&   slow_case                 // continuation point if fast allocation fails
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   868
  );
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   869
  void tlab_allocate(
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   870
    Register obj,                      // result: pointer to object after successful allocation
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   871
    Register var_size_in_bytes,        // object size in bytes if unknown at compile time; invalid otherwise
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   872
    int      con_size_in_bytes,        // object size in bytes if   known at compile time
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   873
    Register t1,                       // temp register
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   874
    Register t2,                       // temp register
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   875
    Label&   slow_case                 // continuation point if fast allocation fails
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   876
  );
42871
c89e1f0a084e 8169177: AArch64: SIGSEGV when "-XX:+ZeroTLAB" is specified along with GC options
aph
parents: 42605
diff changeset
   877
  void zero_memory(Register addr, Register len, Register t1);
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   878
  void verify_tlab();
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   879
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   880
  // interface method calling
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   881
  void lookup_interface_method(Register recv_klass,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   882
                               Register intf_klass,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   883
                               RegisterOrConstant itable_index,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   884
                               Register method_result,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   885
                               Register scan_temp,
48652
7c03f19d38a7 8195685: AArch64: AArch64 cannot build with JDK-8174962
aph
parents: 48183
diff changeset
   886
                               Label& no_such_interface,
7c03f19d38a7 8195685: AArch64: AArch64 cannot build with JDK-8174962
aph
parents: 48183
diff changeset
   887
                   bool return_method = true);
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   888
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   889
  // virtual method calling
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   890
  // n.b. x86 allows RegisterOrConstant for vtable_index
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   891
  void lookup_virtual_method(Register recv_klass,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   892
                             RegisterOrConstant vtable_index,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   893
                             Register method_result);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   894
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   895
  // Test sub_klass against super_klass, with fast and slow paths.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   896
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   897
  // The fast path produces a tri-state answer: yes / no / maybe-slow.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   898
  // One of the three labels can be NULL, meaning take the fall-through.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   899
  // If super_check_offset is -1, the value is loaded up from super_klass.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   900
  // No registers are killed, except temp_reg.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   901
  void check_klass_subtype_fast_path(Register sub_klass,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   902
                                     Register super_klass,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   903
                                     Register temp_reg,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   904
                                     Label* L_success,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   905
                                     Label* L_failure,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   906
                                     Label* L_slow_path,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   907
                RegisterOrConstant super_check_offset = RegisterOrConstant(-1));
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   908
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   909
  // The rest of the type check; must be wired to a corresponding fast path.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   910
  // It does not repeat the fast path logic, so don't use it standalone.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   911
  // The temp_reg and temp2_reg can be noreg, if no temps are available.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   912
  // Updates the sub's secondary super cache as necessary.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   913
  // If set_cond_codes, condition codes will be Z on success, NZ on failure.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   914
  void check_klass_subtype_slow_path(Register sub_klass,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   915
                                     Register super_klass,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   916
                                     Register temp_reg,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   917
                                     Register temp2_reg,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   918
                                     Label* L_success,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   919
                                     Label* L_failure,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   920
                                     bool set_cond_codes = false);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   921
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   922
  // Simplified, combined version, good for typical uses.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   923
  // Falls through on failure.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   924
  void check_klass_subtype(Register sub_klass,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   925
                           Register super_klass,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   926
                           Register temp_reg,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   927
                           Label& L_success);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   928
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   929
  Address argument_address(RegisterOrConstant arg_slot, int extra_slot_offset = 0);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   930
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   931
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   932
  // Debugging
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   933
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   934
  // only if +VerifyOops
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   935
  void verify_oop(Register reg, const char* s = "broken oop");
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   936
  void verify_oop_addr(Address addr, const char * s = "broken oop addr");
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   937
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   938
// TODO: verify method and klass metadata (compare against vptr?)
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   939
  void _verify_method_ptr(Register reg, const char * msg, const char * file, int line) {}
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   940
  void _verify_klass_ptr(Register reg, const char * msg, const char * file, int line){}
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   941
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   942
#define verify_method_ptr(reg) _verify_method_ptr(reg, "broken method " #reg, __FILE__, __LINE__)
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   943
#define verify_klass_ptr(reg) _verify_klass_ptr(reg, "broken klass " #reg, __FILE__, __LINE__)
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   944
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   945
  // only if +VerifyFPU
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   946
  void verify_FPU(int stack_depth, const char* s = "illegal FPU state");
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   947
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   948
  // prints msg, dumps registers and stops execution
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   949
  void stop(const char* msg);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   950
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   951
  // prints msg and continues
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   952
  void warn(const char* msg);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   953
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   954
  static void debug64(char* msg, int64_t pc, int64_t regs[]);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   955
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   956
  void untested()                                { stop("untested"); }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   957
46560
388aa8d67c80 8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents: 46458
diff changeset
   958
  void unimplemented(const char* what = "");
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   959
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   960
  void should_not_reach_here()                   { stop("should not reach here"); }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   961
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   962
  // Stack overflow checking
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   963
  void bang_stack_with_offset(int offset) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   964
    // stack grows down, caller passes positive offset
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   965
    assert(offset > 0, "must bang with negative offset");
46627
8e1eae187d4d 8183547: AArch64: Better instruction sequence for stack bangs
aph
parents: 46560
diff changeset
   966
    sub(rscratch2, sp, offset);
8e1eae187d4d 8183547: AArch64: Better instruction sequence for stack bangs
aph
parents: 46560
diff changeset
   967
    str(zr, Address(rscratch2));
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   968
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   969
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   970
  // Writes to stack successive pages until offset reached to check for
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   971
  // stack overflow + shadow pages.  Also, clobbers tmp
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   972
  void bang_stack_size(Register size, Register tmp);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   973
43439
5e03c9ba74f3 8172144: AArch64: Implement "JEP 270: Reserved Stack Areas for Critical Sections"
aph
parents: 42871
diff changeset
   974
  // Check for reserved stack access in method being exited (for JIT)
5e03c9ba74f3 8172144: AArch64: Implement "JEP 270: Reserved Stack Areas for Critical Sections"
aph
parents: 42871
diff changeset
   975
  void reserved_stack_check();
5e03c9ba74f3 8172144: AArch64: Implement "JEP 270: Reserved Stack Areas for Critical Sections"
aph
parents: 42871
diff changeset
   976
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   977
  virtual RegisterOrConstant delayed_value_impl(intptr_t* delayed_value_addr,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   978
                                                Register tmp,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   979
                                                int offset);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   980
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   981
  // Arithmetics
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   982
33175
c8f3d95c66bc 8138575: Improve generated code for profile counters
aph
parents: 33061
diff changeset
   983
  void addptr(const Address &dst, int32_t src);
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   984
  void cmpptr(Register src1, Address src2);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   985
50536
8434981a4137 8203157: Object equals abstraction for BarrierSetAssembler
rkennke
parents: 50411
diff changeset
   986
  void cmpoop(Register obj1, Register obj2);
8434981a4137 8203157: Object equals abstraction for BarrierSetAssembler
rkennke
parents: 50411
diff changeset
   987
32725
33ccf5318a0b 8135157: DMB elimination in AArch64 C2 synchronization implementation
aph
parents: 32395
diff changeset
   988
  // Various forms of CAS
33ccf5318a0b 8135157: DMB elimination in AArch64 C2 synchronization implementation
aph
parents: 32395
diff changeset
   989
46449
7b2416f0f524 8167659: Access of mark word should use oopDesc::mark_offset_in_bytes() instead of '0'
rkennke
parents: 46294
diff changeset
   990
  void cmpxchg_obj_header(Register oldv, Register newv, Register obj, Register tmp,
7b2416f0f524 8167659: Access of mark word should use oopDesc::mark_offset_in_bytes() instead of '0'
rkennke
parents: 46294
diff changeset
   991
                          Label &suceed, Label *fail);
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   992
  void cmpxchgptr(Register oldv, Register newv, Register addr, Register tmp,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   993
                  Label &suceed, Label *fail);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   994
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   995
  void cmpxchgw(Register oldv, Register newv, Register addr, Register tmp,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   996
                  Label &suceed, Label *fail);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   997
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   998
  void atomic_add(Register prev, RegisterOrConstant incr, Register addr);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   999
  void atomic_addw(Register prev, RegisterOrConstant incr, Register addr);
37269
5c2c4e5bb067 8151775: aarch64: add support for 8.1 LSE atomic operations
enevill
parents: 36562
diff changeset
  1000
  void atomic_addal(Register prev, RegisterOrConstant incr, Register addr);
5c2c4e5bb067 8151775: aarch64: add support for 8.1 LSE atomic operations
enevill
parents: 36562
diff changeset
  1001
  void atomic_addalw(Register prev, RegisterOrConstant incr, Register addr);
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1002
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1003
  void atomic_xchg(Register prev, Register newv, Register addr);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1004
  void atomic_xchgw(Register prev, Register newv, Register addr);
37269
5c2c4e5bb067 8151775: aarch64: add support for 8.1 LSE atomic operations
enevill
parents: 36562
diff changeset
  1005
  void atomic_xchgal(Register prev, Register newv, Register addr);
5c2c4e5bb067 8151775: aarch64: add support for 8.1 LSE atomic operations
enevill
parents: 36562
diff changeset
  1006
  void atomic_xchgalw(Register prev, Register newv, Register addr);
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1007
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1008
  void orptr(Address adr, RegisterOrConstant src) {
48183
ee8e37f85775 8189439: Parameters type profiling is not performed from aarch64 interpreter
dpochepk
parents: 48127
diff changeset
  1009
    ldr(rscratch1, adr);
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1010
    if (src.is_register())
48183
ee8e37f85775 8189439: Parameters type profiling is not performed from aarch64 interpreter
dpochepk
parents: 48127
diff changeset
  1011
      orr(rscratch1, rscratch1, src.as_register());
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1012
    else
48183
ee8e37f85775 8189439: Parameters type profiling is not performed from aarch64 interpreter
dpochepk
parents: 48127
diff changeset
  1013
      orr(rscratch1, rscratch1, src.as_constant());
ee8e37f85775 8189439: Parameters type profiling is not performed from aarch64 interpreter
dpochepk
parents: 48127
diff changeset
  1014
    str(rscratch1, adr);
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1015
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1016
32725
33ccf5318a0b 8135157: DMB elimination in AArch64 C2 synchronization implementation
aph
parents: 32395
diff changeset
  1017
  // A generic CAS; success or failure is in the EQ flag.
40049
a23a3ed6c7a6 8141633: Implement VarHandles/Unsafe intrinsics on AArch64
aph
parents: 40041
diff changeset
  1018
  // Clobbers rscratch1
32725
33ccf5318a0b 8135157: DMB elimination in AArch64 C2 synchronization implementation
aph
parents: 32395
diff changeset
  1019
  void cmpxchg(Register addr, Register expected, Register new_val,
36562
4d1e93624d6a 8150394: aarch64: add support for 8.1 LSE CAS instructions
enevill
parents: 36338
diff changeset
  1020
               enum operand_size size,
40049
a23a3ed6c7a6 8141633: Implement VarHandles/Unsafe intrinsics on AArch64
aph
parents: 40041
diff changeset
  1021
               bool acquire, bool release, bool weak,
a23a3ed6c7a6 8141633: Implement VarHandles/Unsafe intrinsics on AArch64
aph
parents: 40041
diff changeset
  1022
               Register result);
52408
04cbcebf5adf 8211320: Aarch64: unsafe.compareAndSetByte() and unsafe.compareAndSetShort() c2 intrinsics broken with negative expected value
roland
parents: 51866
diff changeset
  1023
private:
04cbcebf5adf 8211320: Aarch64: unsafe.compareAndSetByte() and unsafe.compareAndSetShort() c2 intrinsics broken with negative expected value
roland
parents: 51866
diff changeset
  1024
  void compare_eq(Register rn, Register rm, enum operand_size size);
32725
33ccf5318a0b 8135157: DMB elimination in AArch64 C2 synchronization implementation
aph
parents: 32395
diff changeset
  1025
52408
04cbcebf5adf 8211320: Aarch64: unsafe.compareAndSetByte() and unsafe.compareAndSetShort() c2 intrinsics broken with negative expected value
roland
parents: 51866
diff changeset
  1026
public:
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1027
  // Calls
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1028
32082
2a3323e25de1 8130309: Need to bailout cleanly if creation of stubs fails when codecache is out of space
thartmann
parents: 31956
diff changeset
  1029
  address trampoline_call(Address entry, CodeBuffer *cbuf = NULL);
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1030
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1031
  static bool far_branches() {
50411
0191ac1da300 8204341: AArch64: AOT runtime does not need a workaround for far calls
aph
parents: 50110
diff changeset
  1032
    return ReservedCodeCacheSize > branch_range || UseAOT;
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1033
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1034
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1035
  // Jumps that can reach anywhere in the code cache.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1036
  // Trashes tmp.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1037
  void far_call(Address entry, CodeBuffer *cbuf = NULL, Register tmp = rscratch1);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1038
  void far_jump(Address entry, CodeBuffer *cbuf = NULL, Register tmp = rscratch1);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1039
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1040
  static int far_branch_size() {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1041
    if (far_branches()) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1042
      return 3 * 4;  // adrp, add, br
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1043
    } else {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1044
      return 4;
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1045
    }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1046
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1047
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1048
  // Emit the CompiledIC call idiom
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 34507
diff changeset
  1049
  address ic_call(address entry, jint method_index = 0);
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1050
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1051
public:
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1052
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1053
  // Data
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1054
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1055
  void mov_metadata(Register dst, Metadata* obj);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1056
  Address allocate_metadata_address(Metadata* obj);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1057
  Address constant_oop_address(jobject obj);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1058
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1059
  void movoop(Register dst, jobject obj, bool immediate = false);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1060
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1061
  // CRC32 code for java.util.zip.CRC32::updateBytes() instrinsic.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1062
  void kernel_crc32(Register crc, Register buf, Register len,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1063
        Register table0, Register table1, Register table2, Register table3,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1064
        Register tmp, Register tmp2, Register tmp3);
31591
82134a118aea 8130687: aarch64: add support for hardware crc32c
enevill
parents: 31517
diff changeset
  1065
  // CRC32 code for java.util.zip.CRC32C::updateBytes() instrinsic.
82134a118aea 8130687: aarch64: add support for hardware crc32c
enevill
parents: 31517
diff changeset
  1066
  void kernel_crc32c(Register crc, Register buf, Register len,
82134a118aea 8130687: aarch64: add support for hardware crc32c
enevill
parents: 31517
diff changeset
  1067
        Register table0, Register table1, Register table2, Register table3,
82134a118aea 8130687: aarch64: add support for hardware crc32c
enevill
parents: 31517
diff changeset
  1068
        Register tmp, Register tmp2, Register tmp3);
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1069
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1070
  // Stack push and pop individual 64 bit registers
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1071
  void push(Register src);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1072
  void pop(Register dst);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1073
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1074
  // push all registers onto the stack
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1075
  void pusha();
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1076
  void popa();
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1077
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1078
  void repne_scan(Register addr, Register value, Register count,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1079
                  Register scratch);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1080
  void repne_scanw(Register addr, Register value, Register count,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1081
                   Register scratch);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1082
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1083
  typedef void (MacroAssembler::* add_sub_imm_insn)(Register Rd, Register Rn, unsigned imm);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1084
  typedef void (MacroAssembler::* add_sub_reg_insn)(Register Rd, Register Rn, Register Rm, enum shift_kind kind, unsigned shift);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1085
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1086
  // If a constant does not fit in an immediate field, generate some
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1087
  // number of MOV instructions and then perform the operation
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1088
  void wrap_add_sub_imm_insn(Register Rd, Register Rn, unsigned imm,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1089
                             add_sub_imm_insn insn1,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1090
                             add_sub_reg_insn insn2);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1091
  // Seperate vsn which sets the flags
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1092
  void wrap_adds_subs_imm_insn(Register Rd, Register Rn, unsigned imm,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1093
                             add_sub_imm_insn insn1,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1094
                             add_sub_reg_insn insn2);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1095
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1096
#define WRAP(INSN)                                                      \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1097
  void INSN(Register Rd, Register Rn, unsigned imm) {                   \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1098
    wrap_add_sub_imm_insn(Rd, Rn, imm, &Assembler::INSN, &Assembler::INSN); \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1099
  }                                                                     \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1100
                                                                        \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1101
  void INSN(Register Rd, Register Rn, Register Rm,                      \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1102
             enum shift_kind kind, unsigned shift = 0) {                \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1103
    Assembler::INSN(Rd, Rn, Rm, kind, shift);                           \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1104
  }                                                                     \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1105
                                                                        \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1106
  void INSN(Register Rd, Register Rn, Register Rm) {                    \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1107
    Assembler::INSN(Rd, Rn, Rm);                                        \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1108
  }                                                                     \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1109
                                                                        \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1110
  void INSN(Register Rd, Register Rn, Register Rm,                      \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1111
           ext::operation option, int amount = 0) {                     \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1112
    Assembler::INSN(Rd, Rn, Rm, option, amount);                        \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1113
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1114
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1115
  WRAP(add) WRAP(addw) WRAP(sub) WRAP(subw)
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1116
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1117
#undef WRAP
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1118
#define WRAP(INSN)                                                      \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1119
  void INSN(Register Rd, Register Rn, unsigned imm) {                   \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1120
    wrap_adds_subs_imm_insn(Rd, Rn, imm, &Assembler::INSN, &Assembler::INSN); \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1121
  }                                                                     \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1122
                                                                        \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1123
  void INSN(Register Rd, Register Rn, Register Rm,                      \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1124
             enum shift_kind kind, unsigned shift = 0) {                \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1125
    Assembler::INSN(Rd, Rn, Rm, kind, shift);                           \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1126
  }                                                                     \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1127
                                                                        \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1128
  void INSN(Register Rd, Register Rn, Register Rm) {                    \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1129
    Assembler::INSN(Rd, Rn, Rm);                                        \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1130
  }                                                                     \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1131
                                                                        \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1132
  void INSN(Register Rd, Register Rn, Register Rm,                      \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1133
           ext::operation option, int amount = 0) {                     \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1134
    Assembler::INSN(Rd, Rn, Rm, option, amount);                        \
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1135
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1136
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1137
  WRAP(adds) WRAP(addsw) WRAP(subs) WRAP(subsw)
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1138
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1139
  void add(Register Rd, Register Rn, RegisterOrConstant increment);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1140
  void addw(Register Rd, Register Rn, RegisterOrConstant increment);
31955
c6ac18ab3d6b 8131779: AARCH64: add Montgomery multiply intrinsic
aph
parents: 31591
diff changeset
  1141
  void sub(Register Rd, Register Rn, RegisterOrConstant decrement);
32395
13b0caf18153 8133352: aarch64: generates constrained unpredictable instructions
enevill
parents: 32082
diff changeset
  1142
  void subw(Register Rd, Register Rn, RegisterOrConstant decrement);
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1143
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1144
  void adrp(Register reg1, const Address &dest, unsigned long &byte_offset);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1145
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1146
  void tableswitch(Register index, jint lowbound, jint highbound,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1147
                   Label &jumptable, Label &jumptable_end, int stride = 1) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1148
    adr(rscratch1, jumptable);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1149
    subsw(rscratch2, index, lowbound);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1150
    subsw(zr, rscratch2, highbound - lowbound);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1151
    br(Assembler::HS, jumptable_end);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1152
    add(rscratch1, rscratch1, rscratch2,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1153
        ext::sxtw, exact_log2(stride * Assembler::instruction_size));
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1154
    br(rscratch1);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1155
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1156
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1157
  // Form an address from base + offset in Rd.  Rd may or may not
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1158
  // actually be used: you must use the Address that is returned.  It
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1159
  // is up to you to ensure that the shift provided matches the size
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1160
  // of your data.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1161
  Address form_address(Register Rd, Register base, long byte_offset, int shift);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1162
35579
d21d5a0db03f 8146709: AArch64: Incorrect use of ADRP for byte_map_base
aph
parents: 35232
diff changeset
  1163
  // Return true iff an address is within the 48-bit AArch64 address
d21d5a0db03f 8146709: AArch64: Incorrect use of ADRP for byte_map_base
aph
parents: 35232
diff changeset
  1164
  // space.
d21d5a0db03f 8146709: AArch64: Incorrect use of ADRP for byte_map_base
aph
parents: 35232
diff changeset
  1165
  bool is_valid_AArch64_address(address a) {
d21d5a0db03f 8146709: AArch64: Incorrect use of ADRP for byte_map_base
aph
parents: 35232
diff changeset
  1166
    return ((uint64_t)a >> 48) == 0;
d21d5a0db03f 8146709: AArch64: Incorrect use of ADRP for byte_map_base
aph
parents: 35232
diff changeset
  1167
  }
d21d5a0db03f 8146709: AArch64: Incorrect use of ADRP for byte_map_base
aph
parents: 35232
diff changeset
  1168
d21d5a0db03f 8146709: AArch64: Incorrect use of ADRP for byte_map_base
aph
parents: 35232
diff changeset
  1169
  // Load the base of the cardtable byte map into reg.
d21d5a0db03f 8146709: AArch64: Incorrect use of ADRP for byte_map_base
aph
parents: 35232
diff changeset
  1170
  void load_byte_map_base(Register reg);
d21d5a0db03f 8146709: AArch64: Incorrect use of ADRP for byte_map_base
aph
parents: 35232
diff changeset
  1171
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1172
  // Prolog generator routines to support switch between x86 code and
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1173
  // generated ARM code
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1174
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1175
  // routine to generate an x86 prolog for a stub function which
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1176
  // bootstraps into the generated ARM code which directly follows the
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1177
  // stub
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1178
  //
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1179
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1180
  public:
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1181
  // enum used for aarch64--x86 linkage to define return type of x86 function
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1182
  enum ret_type { ret_type_void, ret_type_integral, ret_type_float, ret_type_double};
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1184
#ifdef BUILTIN_SIM
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1185
  void c_stub_prolog(int gp_arg_count, int fp_arg_count, int ret_type, address *prolog_ptr = NULL);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1186
#else
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1187
  void c_stub_prolog(int gp_arg_count, int fp_arg_count, int ret_type) { }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1188
#endif
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1189
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1190
  // special version of call_VM_leaf_base needed for aarch64 simulator
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1191
  // where we need to specify both the gp and fp arg counts and the
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1192
  // return type so that the linkage routine from aarch64 to x86 and
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1193
  // back knows which aarch64 registers to copy to x86 registers and
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1194
  // which x86 result register to copy back to an aarch64 register
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1195
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1196
  void call_VM_leaf_base1(
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1197
    address  entry_point,             // the entry point
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1198
    int      number_of_gp_arguments,  // the number of gp reg arguments to pass
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1199
    int      number_of_fp_arguments,  // the number of fp reg arguments to pass
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1200
    ret_type type,                    // the return type for the call
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1201
    Label*   retaddr = NULL
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1202
  );
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1203
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1204
  void ldr_constant(Register dest, const Address &const_addr) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1205
    if (NearCpool) {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1206
      ldr(dest, const_addr);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1207
    } else {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1208
      unsigned long offset;
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1209
      adrp(dest, InternalAddress(const_addr.target()), offset);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1210
      ldr(dest, Address(dest, offset));
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1211
    }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1212
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1213
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1214
  address read_polling_page(Register r, address page, relocInfo::relocType rtype);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1215
  address read_polling_page(Register r, relocInfo::relocType rtype);
48127
efc459cf351e 8189596: AArch64: implementation for Thread-local handshakes
aph
parents: 47915
diff changeset
  1216
  void get_polling_page(Register dest, address page, relocInfo::relocType rtype);
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1217
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1218
  // CRC32 code for java.util.zip.CRC32::updateBytes() instrinsic.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1219
  void update_byte_crc32(Register crc, Register val, Register table);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1220
  void update_word_crc32(Register crc, Register v, Register tmp,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1221
        Register table0, Register table1, Register table2, Register table3,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1222
        bool upper = false);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1223
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1224
  void string_compare(Register str1, Register str2,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1225
                      Register cnt1, Register cnt2, Register result,
50756
7ad092f40454 8202326: AARCH64: optimize string compare intrinsic
dpochepk
parents: 50754
diff changeset
  1226
                      Register tmp1, Register tmp2, FloatRegister vtmp1,
7ad092f40454 8202326: AARCH64: optimize string compare intrinsic
dpochepk
parents: 50754
diff changeset
  1227
                      FloatRegister vtmp2, FloatRegister vtmp3, int ae);
36338
de236db57636 8149733: AArch64: refactor array_equals/string_equals
hshi
parents: 35842
diff changeset
  1228
46814
2e45cd2fdcb6 8184943: AARCH64: Intrinsify hasNegatives
dpochepk
parents: 46720
diff changeset
  1229
  void has_negatives(Register ary1, Register len, Register result);
2e45cd2fdcb6 8184943: AARCH64: Intrinsify hasNegatives
dpochepk
parents: 46720
diff changeset
  1230
49724
bf7f42f2f025 8187472: AARCH64: array_equals intrinsic doesn't use prefetch for large arrays
dpochepk
parents: 49481
diff changeset
  1231
  void arrays_equals(Register a1, Register a2, Register result, Register cnt1,
bf7f42f2f025 8187472: AARCH64: array_equals intrinsic doesn't use prefetch for large arrays
dpochepk
parents: 49481
diff changeset
  1232
                     Register tmp1, Register tmp2, Register tmp3, int elem_size);
bf7f42f2f025 8187472: AARCH64: array_equals intrinsic doesn't use prefetch for large arrays
dpochepk
parents: 49481
diff changeset
  1233
bf7f42f2f025 8187472: AARCH64: array_equals intrinsic doesn't use prefetch for large arrays
dpochepk
parents: 49481
diff changeset
  1234
  void string_equals(Register a1, Register a2, Register result, Register cnt1,
bf7f42f2f025 8187472: AARCH64: array_equals intrinsic doesn't use prefetch for large arrays
dpochepk
parents: 49481
diff changeset
  1235
                     int elem_size);
36338
de236db57636 8149733: AArch64: refactor array_equals/string_equals
hshi
parents: 35842
diff changeset
  1236
38072
964dfd630089 8154957: AArch64: Better byte behavior
aph
parents: 38057
diff changeset
  1237
  void fill_words(Register base, Register cnt, Register value);
38143
3b732f17ea7d 8155617: aarch64: ClearArray does not use DC ZVA
enevill
parents: 38037
diff changeset
  1238
  void zero_words(Register base, u_int64_t cnt);
45054
c09733aaf97f 8179444: AArch64: Put zero_words on a diet
aph
parents: 43439
diff changeset
  1239
  void zero_words(Register ptr, Register cnt);
c09733aaf97f 8179444: AArch64: Put zero_words on a diet
aph
parents: 43439
diff changeset
  1240
  void zero_dcache_blocks(Register base, Register cnt);
c09733aaf97f 8179444: AArch64: Put zero_words on a diet
aph
parents: 43439
diff changeset
  1241
c09733aaf97f 8179444: AArch64: Put zero_words on a diet
aph
parents: 43439
diff changeset
  1242
  static const int zero_words_block_size;
38072
964dfd630089 8154957: AArch64: Better byte behavior
aph
parents: 38057
diff changeset
  1243
38003
f84c8ee82ac8 8153310: AArch64: JEP 254: Implement byte_array_inflate
aph
parents: 37269
diff changeset
  1244
  void byte_array_inflate(Register src, Register dst, Register len,
f84c8ee82ac8 8153310: AArch64: JEP 254: Implement byte_array_inflate
aph
parents: 37269
diff changeset
  1245
                          FloatRegister vtmp1, FloatRegister vtmp2,
f84c8ee82ac8 8153310: AArch64: JEP 254: Implement byte_array_inflate
aph
parents: 37269
diff changeset
  1246
                          FloatRegister vtmp3, Register tmp4);
f84c8ee82ac8 8153310: AArch64: JEP 254: Implement byte_array_inflate
aph
parents: 37269
diff changeset
  1247
f84c8ee82ac8 8153310: AArch64: JEP 254: Implement byte_array_inflate
aph
parents: 37269
diff changeset
  1248
  void char_array_compress(Register src, Register dst, Register len,
f84c8ee82ac8 8153310: AArch64: JEP 254: Implement byte_array_inflate
aph
parents: 37269
diff changeset
  1249
                           FloatRegister tmp1Reg, FloatRegister tmp2Reg,
f84c8ee82ac8 8153310: AArch64: JEP 254: Implement byte_array_inflate
aph
parents: 37269
diff changeset
  1250
                           FloatRegister tmp3Reg, FloatRegister tmp4Reg,
f84c8ee82ac8 8153310: AArch64: JEP 254: Implement byte_array_inflate
aph
parents: 37269
diff changeset
  1251
                           Register result);
38028
be8cc044b136 8153797: aarch64: Add Arrays.fill stub code
enevill
parents: 37269
diff changeset
  1252
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1253
  void encode_iso_array(Register src, Register dst,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1254
                        Register len, Register result,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1255
                        FloatRegister Vtmp1, FloatRegister Vtmp2,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1256
                        FloatRegister Vtmp3, FloatRegister Vtmp4);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1257
  void string_indexof(Register str1, Register str2,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1258
                      Register cnt1, Register cnt2,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1259
                      Register tmp1, Register tmp2,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1260
                      Register tmp3, Register tmp4,
50757
866c9aa29ee4 8189103: AARCH64: optimize String indexOf intrinsic
dpochepk
parents: 50756
diff changeset
  1261
                      Register tmp5, Register tmp6,
38713
4a16e9ea88a0 8157834: aarch64: Hello World crashes with fastdebug build
enevill
parents: 38144
diff changeset
  1262
                      int int_cnt1, Register result, int ae);
41670
ee918e29fc47 8157708: aarch64: StrIndexOfChar intrinsic is not implemented
enevill
parents: 40643
diff changeset
  1263
  void string_indexof_char(Register str1, Register cnt1,
ee918e29fc47 8157708: aarch64: StrIndexOfChar intrinsic is not implemented
enevill
parents: 40643
diff changeset
  1264
                           Register ch, Register result,
ee918e29fc47 8157708: aarch64: StrIndexOfChar intrinsic is not implemented
enevill
parents: 40643
diff changeset
  1265
                           Register tmp1, Register tmp2, Register tmp3);
50753
4449b45900f1 8196402: AARCH64: create intrinsic for Math.log
dpochepk
parents: 50693
diff changeset
  1266
  void fast_log(FloatRegister vtmp0, FloatRegister vtmp1, FloatRegister vtmp2,
4449b45900f1 8196402: AARCH64: create intrinsic for Math.log
dpochepk
parents: 50693
diff changeset
  1267
                FloatRegister vtmp3, FloatRegister vtmp4, FloatRegister vtmp5,
4449b45900f1 8196402: AARCH64: create intrinsic for Math.log
dpochepk
parents: 50693
diff changeset
  1268
                FloatRegister tmpC1, FloatRegister tmpC2, FloatRegister tmpC3,
4449b45900f1 8196402: AARCH64: create intrinsic for Math.log
dpochepk
parents: 50693
diff changeset
  1269
                FloatRegister tmpC4, Register tmp1, Register tmp2,
4449b45900f1 8196402: AARCH64: create intrinsic for Math.log
dpochepk
parents: 50693
diff changeset
  1270
                Register tmp3, Register tmp4, Register tmp5);
50754
ccb8aa083958 8189105: AARCH64: create intrinsic for sin and cos
dpochepk
parents: 50753
diff changeset
  1271
  void generate_dsin_dcos(bool isCos, address npio2_hw, address two_over_pi,
ccb8aa083958 8189105: AARCH64: create intrinsic for sin and cos
dpochepk
parents: 50753
diff changeset
  1272
      address pio2, address dsin_coef, address dcos_coef);
ccb8aa083958 8189105: AARCH64: create intrinsic for sin and cos
dpochepk
parents: 50753
diff changeset
  1273
 private:
ccb8aa083958 8189105: AARCH64: create intrinsic for sin and cos
dpochepk
parents: 50753
diff changeset
  1274
  // begin trigonometric functions support block
ccb8aa083958 8189105: AARCH64: create intrinsic for sin and cos
dpochepk
parents: 50753
diff changeset
  1275
  void generate__ieee754_rem_pio2(address npio2_hw, address two_over_pi, address pio2);
ccb8aa083958 8189105: AARCH64: create intrinsic for sin and cos
dpochepk
parents: 50753
diff changeset
  1276
  void generate__kernel_rem_pio2(address two_over_pi, address pio2);
ccb8aa083958 8189105: AARCH64: create intrinsic for sin and cos
dpochepk
parents: 50753
diff changeset
  1277
  void generate_kernel_sin(FloatRegister x, bool iyIsOne, address dsin_coef);
ccb8aa083958 8189105: AARCH64: create intrinsic for sin and cos
dpochepk
parents: 50753
diff changeset
  1278
  void generate_kernel_cos(FloatRegister x, address dcos_coef);
ccb8aa083958 8189105: AARCH64: create intrinsic for sin and cos
dpochepk
parents: 50753
diff changeset
  1279
  // end trigonometric functions support block
30225
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
  1280
  void add2_with_carry(Register final_dest_hi, Register dest_hi, Register dest_lo,
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
  1281
                       Register src1, Register src2);
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
  1282
  void add2_with_carry(Register dest_hi, Register dest_lo, Register src1, Register src2) {
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
  1283
    add2_with_carry(dest_hi, dest_hi, dest_lo, src1, src2);
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
  1284
  }
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
  1285
  void multiply_64_x_64_loop(Register x, Register xstart, Register x_xstart,
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
  1286
                             Register y, Register y_idx, Register z,
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
  1287
                             Register carry, Register product,
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
  1288
                             Register idx, Register kdx);
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
  1289
  void multiply_128_x_128_loop(Register y, Register z,
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
  1290
                               Register carry, Register carry2,
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
  1291
                               Register idx, Register jdx,
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
  1292
                               Register yz_idx1, Register yz_idx2,
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
  1293
                               Register tmp, Register tmp3, Register tmp4,
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
  1294
                               Register tmp7, Register product_hi);
47773
6e3ab27f9144 8189176: AARCH64: Improve _updateBytesCRC32 intrinsic
dchuyko
parents: 47571
diff changeset
  1295
  void kernel_crc32_using_crc32(Register crc, Register buf,
6e3ab27f9144 8189176: AARCH64: Improve _updateBytesCRC32 intrinsic
dchuyko
parents: 47571
diff changeset
  1296
        Register len, Register tmp0, Register tmp1, Register tmp2,
6e3ab27f9144 8189176: AARCH64: Improve _updateBytesCRC32 intrinsic
dchuyko
parents: 47571
diff changeset
  1297
        Register tmp3);
47915
d4af6b80aec3 8189177: AARCH64: Improve _updateBytesCRC32C intrinsic
dchuyko
parents: 47773
diff changeset
  1298
  void kernel_crc32c_using_crc32c(Register crc, Register buf,
d4af6b80aec3 8189177: AARCH64: Improve _updateBytesCRC32C intrinsic
dchuyko
parents: 47773
diff changeset
  1299
        Register len, Register tmp0, Register tmp1, Register tmp2,
d4af6b80aec3 8189177: AARCH64: Improve _updateBytesCRC32C intrinsic
dchuyko
parents: 47773
diff changeset
  1300
        Register tmp3);
30225
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
  1301
public:
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
  1302
  void multiply_to_len(Register x, Register xlen, Register y, Register ylen, Register z,
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
  1303
                       Register zlen, Register tmp1, Register tmp2, Register tmp3,
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
  1304
                       Register tmp4, Register tmp5, Register tmp6, Register tmp7);
47571
c19054f06c14 8186915: AARCH64: Intrinsify squareToLen and mulAdd
dpochepk
parents: 47216
diff changeset
  1305
  void mul_add(Register out, Register in, Register offs, Register len, Register k);
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1306
  // ISB may be needed because of a safepoint
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1307
  void maybe_isb() { isb(); }
30225
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
  1308
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
  1309
private:
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
  1310
  // Return the effective address r + (r1 << ext) + offset.
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
  1311
  // Uses rscratch2.
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
  1312
  Address offsetted_address(Register r, Register r1, Address::extend ext,
e9722ea461d4 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents: 29479
diff changeset
  1313
                            int offset, int size);
31954
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1314
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1315
private:
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1316
  // Returns an address on the stack which is reachable with a ldr/str of size
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1317
  // Uses rscratch2 if the address is not directly reachable
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1318
  Address spill_address(int size, int offset, Register tmp=rscratch2);
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1319
49161
8f1bc5a0d16d 8196064: AArch64: Merging ld/st into ldp/stp in macro-assembler
zyao
parents: 49010
diff changeset
  1320
  bool merge_alignment_check(Register base, size_t size, long cur_offset, long prev_offset) const;
8f1bc5a0d16d 8196064: AArch64: Merging ld/st into ldp/stp in macro-assembler
zyao
parents: 49010
diff changeset
  1321
8f1bc5a0d16d 8196064: AArch64: Merging ld/st into ldp/stp in macro-assembler
zyao
parents: 49010
diff changeset
  1322
  // Check whether two loads/stores can be merged into ldp/stp.
8f1bc5a0d16d 8196064: AArch64: Merging ld/st into ldp/stp in macro-assembler
zyao
parents: 49010
diff changeset
  1323
  bool ldst_can_merge(Register rx, const Address &adr, size_t cur_size_in_bytes, bool is_store) const;
8f1bc5a0d16d 8196064: AArch64: Merging ld/st into ldp/stp in macro-assembler
zyao
parents: 49010
diff changeset
  1324
8f1bc5a0d16d 8196064: AArch64: Merging ld/st into ldp/stp in macro-assembler
zyao
parents: 49010
diff changeset
  1325
  // Merge current load/store with previous load/store into ldp/stp.
8f1bc5a0d16d 8196064: AArch64: Merging ld/st into ldp/stp in macro-assembler
zyao
parents: 49010
diff changeset
  1326
  void merge_ldst(Register rx, const Address &adr, size_t cur_size_in_bytes, bool is_store);
8f1bc5a0d16d 8196064: AArch64: Merging ld/st into ldp/stp in macro-assembler
zyao
parents: 49010
diff changeset
  1327
8f1bc5a0d16d 8196064: AArch64: Merging ld/st into ldp/stp in macro-assembler
zyao
parents: 49010
diff changeset
  1328
  // Try to merge two loads/stores into ldp/stp. If success, returns true else false.
8f1bc5a0d16d 8196064: AArch64: Merging ld/st into ldp/stp in macro-assembler
zyao
parents: 49010
diff changeset
  1329
  bool try_merge_ldst(Register rt, const Address &adr, size_t cur_size_in_bytes, bool is_store);
8f1bc5a0d16d 8196064: AArch64: Merging ld/st into ldp/stp in macro-assembler
zyao
parents: 49010
diff changeset
  1330
31954
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1331
public:
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1332
  void spill(Register Rx, bool is64, int offset) {
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1333
    if (is64) {
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1334
      str(Rx, spill_address(8, offset));
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1335
    } else {
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1336
      strw(Rx, spill_address(4, offset));
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1337
    }
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1338
  }
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1339
  void spill(FloatRegister Vx, SIMD_RegVariant T, int offset) {
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1340
    str(Vx, T, spill_address(1 << (int)T, offset));
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1341
  }
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1342
  void unspill(Register Rx, bool is64, int offset) {
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1343
    if (is64) {
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1344
      ldr(Rx, spill_address(8, offset));
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1345
    } else {
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1346
      ldrw(Rx, spill_address(4, offset));
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1347
    }
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1348
  }
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1349
  void unspill(FloatRegister Vx, SIMD_RegVariant T, int offset) {
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1350
    ldr(Vx, T, spill_address(1 << (int)T, offset));
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1351
  }
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1352
  void spill_copy128(int src_offset, int dst_offset,
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1353
                     Register tmp1=rscratch1, Register tmp2=rscratch2) {
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1354
    if (src_offset < 512 && (src_offset & 7) == 0 &&
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1355
        dst_offset < 512 && (dst_offset & 7) == 0) {
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1356
      ldp(tmp1, tmp2, Address(sp, src_offset));
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1357
      stp(tmp1, tmp2, Address(sp, dst_offset));
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1358
    } else {
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1359
      unspill(tmp1, true, src_offset);
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1360
      spill(tmp1, true, dst_offset);
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1361
      unspill(tmp1, true, src_offset+8);
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1362
      spill(tmp1, true, dst_offset+8);
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1363
    }
eecbca64fad6 8131362: aarch64: C2 does not handle large stack offsets
enevill
parents: 31591
diff changeset
  1364
  }
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1365
};
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1366
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1367
#ifdef ASSERT
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1368
inline bool AbstractAssembler::pd_check_instruction_mark() { return false; }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1369
#endif
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1370
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1371
/**
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1372
 * class SkipIfEqual:
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1373
 *
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1374
 * Instantiating this class will result in assembly code being output that will
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1375
 * jump around any code emitted between the creation of the instance and it's
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1376
 * automatic destruction at the end of a scope block, depending on the value of
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1377
 * the flag passed to the constructor, which will be checked at run-time.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1378
 */
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1379
class SkipIfEqual {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1380
 private:
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1381
  MacroAssembler* _masm;
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1382
  Label _label;
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1383
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1384
 public:
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1385
   SkipIfEqual(MacroAssembler*, const bool* flag_addr, bool value);
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1386
   ~SkipIfEqual();
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1387
};
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1388
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1389
struct tableswitch {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1390
  Register _reg;
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1391
  int _insn_index; jint _first_key; jint _last_key;
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1392
  Label _after;
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1393
  Label _branches;
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1394
};
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
  1395
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52462
diff changeset
  1396
#endif // CPU_AARCH64_MACROASSEMBLER_AARCH64_HPP