hotspot/src/cpu/x86/vm/assembler_x86.hpp
author xlu
Wed, 24 Dec 2008 13:06:09 -0800
changeset 1888 bbf498fb4354
parent 1500 bea9a90f3e8f
child 2148 09c7f703773b
permissions -rw-r--r--
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t Summary: Avoid casting between int32_t and intptr_t specifically for MasmAssembler::movptr in 32 bit platforms. Reviewed-by: jrose, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
670
ddf3e9583f2f 6719955: Update copyright year
xdono
parents: 594
diff changeset
     2
 * Copyright 1997-2008 Sun Microsystems, Inc.  All Rights Reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
class BiasedLockingCounters;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
// Contains all the definitions needed for x86 assembly code generation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
// Calling convention
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
class Argument VALUE_OBJ_CLASS_SPEC {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
  enum {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
#ifdef _LP64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
#ifdef _WIN64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
    n_int_register_parameters_c   = 4, // rcx, rdx, r8, r9 (c_rarg0, c_rarg1, ...)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
    n_float_register_parameters_c = 4,  // xmm0 - xmm3 (c_farg0, c_farg1, ... )
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
    n_int_register_parameters_c   = 6, // rdi, rsi, rdx, rcx, r8, r9 (c_rarg0, c_rarg1, ...)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
    n_float_register_parameters_c = 8,  // xmm0 - xmm7 (c_farg0, c_farg1, ... )
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
#endif // _WIN64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
    n_int_register_parameters_j   = 6, // j_rarg0, j_rarg1, ...
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
    n_float_register_parameters_j = 8  // j_farg0, j_farg1, ...
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
    n_register_parameters = 0   // 0 registers used to pass arguments
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
#endif // _LP64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
#ifdef _LP64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
// Symbolically name the register arguments used by the c calling convention.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
// Windows is different from linux/solaris. So much for standards...
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
#ifdef _WIN64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
REGISTER_DECLARATION(Register, c_rarg0, rcx);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
REGISTER_DECLARATION(Register, c_rarg1, rdx);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
REGISTER_DECLARATION(Register, c_rarg2, r8);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
REGISTER_DECLARATION(Register, c_rarg3, r9);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
    61
REGISTER_DECLARATION(XMMRegister, c_farg0, xmm0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
    62
REGISTER_DECLARATION(XMMRegister, c_farg1, xmm1);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
    63
REGISTER_DECLARATION(XMMRegister, c_farg2, xmm2);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
    64
REGISTER_DECLARATION(XMMRegister, c_farg3, xmm3);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
REGISTER_DECLARATION(Register, c_rarg0, rdi);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
REGISTER_DECLARATION(Register, c_rarg1, rsi);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
REGISTER_DECLARATION(Register, c_rarg2, rdx);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
REGISTER_DECLARATION(Register, c_rarg3, rcx);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
REGISTER_DECLARATION(Register, c_rarg4, r8);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
REGISTER_DECLARATION(Register, c_rarg5, r9);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
    75
REGISTER_DECLARATION(XMMRegister, c_farg0, xmm0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
    76
REGISTER_DECLARATION(XMMRegister, c_farg1, xmm1);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
    77
REGISTER_DECLARATION(XMMRegister, c_farg2, xmm2);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
    78
REGISTER_DECLARATION(XMMRegister, c_farg3, xmm3);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
    79
REGISTER_DECLARATION(XMMRegister, c_farg4, xmm4);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
    80
REGISTER_DECLARATION(XMMRegister, c_farg5, xmm5);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
    81
REGISTER_DECLARATION(XMMRegister, c_farg6, xmm6);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
    82
REGISTER_DECLARATION(XMMRegister, c_farg7, xmm7);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
#endif // _WIN64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
// Symbolically name the register arguments used by the Java calling convention.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
// We have control over the convention for java so we can do what we please.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
// What pleases us is to offset the java calling convention so that when
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
// we call a suitable jni method the arguments are lined up and we don't
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
// have to do little shuffling. A suitable jni method is non-static and a
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
// small number of arguments (two fewer args on windows)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
//        |-------------------------------------------------------|
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
//        | c_rarg0   c_rarg1  c_rarg2 c_rarg3 c_rarg4 c_rarg5    |
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
//        |-------------------------------------------------------|
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
//        | rcx       rdx      r8      r9      rdi*    rsi*       | windows (* not a c_rarg)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
//        | rdi       rsi      rdx     rcx     r8      r9         | solaris/linux
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
//        |-------------------------------------------------------|
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
//        | j_rarg5   j_rarg0  j_rarg1 j_rarg2 j_rarg3 j_rarg4    |
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
//        |-------------------------------------------------------|
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
REGISTER_DECLARATION(Register, j_rarg0, c_rarg1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
REGISTER_DECLARATION(Register, j_rarg1, c_rarg2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
REGISTER_DECLARATION(Register, j_rarg2, c_rarg3);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
// Windows runs out of register args here
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
#ifdef _WIN64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
REGISTER_DECLARATION(Register, j_rarg3, rdi);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
REGISTER_DECLARATION(Register, j_rarg4, rsi);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
REGISTER_DECLARATION(Register, j_rarg3, c_rarg4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
REGISTER_DECLARATION(Register, j_rarg4, c_rarg5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
#endif /* _WIN64 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
REGISTER_DECLARATION(Register, j_rarg5, c_rarg0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   115
REGISTER_DECLARATION(XMMRegister, j_farg0, xmm0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   116
REGISTER_DECLARATION(XMMRegister, j_farg1, xmm1);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   117
REGISTER_DECLARATION(XMMRegister, j_farg2, xmm2);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   118
REGISTER_DECLARATION(XMMRegister, j_farg3, xmm3);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   119
REGISTER_DECLARATION(XMMRegister, j_farg4, xmm4);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   120
REGISTER_DECLARATION(XMMRegister, j_farg5, xmm5);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   121
REGISTER_DECLARATION(XMMRegister, j_farg6, xmm6);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   122
REGISTER_DECLARATION(XMMRegister, j_farg7, xmm7);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
REGISTER_DECLARATION(Register, rscratch1, r10);  // volatile
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
REGISTER_DECLARATION(Register, rscratch2, r11);  // volatile
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   127
REGISTER_DECLARATION(Register, r12_heapbase, r12); // callee-saved
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
REGISTER_DECLARATION(Register, r15_thread, r15); // callee-saved
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   130
#else
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   131
// rscratch1 will apear in 32bit code that is dead but of course must compile
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   132
// Using noreg ensures if the dead code is incorrectly live and executed it
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   133
// will cause an assertion failure
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   134
#define rscratch1 noreg
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   135
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
#endif // _LP64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
// Address is an abstraction used to represent a memory location
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
// using any of the amd64 addressing modes with one object.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
// Note: A register location is represented via a Register, not
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
//       via an address for efficiency & simplicity reasons.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
class ArrayAddress;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
class Address VALUE_OBJ_CLASS_SPEC {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  enum ScaleFactor {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
    no_scale = -1,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
    times_1  =  0,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
    times_2  =  1,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
    times_4  =  2,
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   153
    times_8  =  3,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   154
    times_ptr = LP64_ONLY(times_8) NOT_LP64(times_4)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  Register         _base;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  Register         _index;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  ScaleFactor      _scale;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  int              _disp;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  RelocationHolder _rspec;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   164
  // Easily misused constructors make them private
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   165
  // %%% can we make these go away?
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   166
  NOT_LP64(Address(address loc, RelocationHolder spec);)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   167
  Address(int disp, address loc, relocInfo::relocType rtype);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   168
  Address(int disp, address loc, RelocationHolder spec);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
 public:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   171
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   172
 int disp() { return _disp; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  // creation
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  Address()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
    : _base(noreg),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
      _index(noreg),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
      _scale(no_scale),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
      _disp(0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  // No default displacement otherwise Register can be implicitly
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  // converted to 0(Register) which is quite a different animal.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  Address(Register base, int disp)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
    : _base(base),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
      _index(noreg),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
      _scale(no_scale),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
      _disp(disp) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
  Address(Register base, Register index, ScaleFactor scale, int disp = 0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
    : _base (base),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
      _index(index),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
      _scale(scale),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
      _disp (disp) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
    assert(!index->is_valid() == (scale == Address::no_scale),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
           "inconsistent address");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  // The following two overloads are used in connection with the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  // ByteSize type (see sizes.hpp).  They simplify the use of
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  // ByteSize'd arguments in assembly code. Note that their equivalent
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  // for the optimized build are the member functions with int disp
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  // argument since ByteSize is mapped to an int type in that case.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  // Note: DO NOT introduce similar overloaded functions for WordSize
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  // arguments as in the optimized mode, both ByteSize and WordSize
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  // are mapped to the same type and thus the compiler cannot make a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  // distinction anymore (=> compiler errors).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
  Address(Register base, ByteSize disp)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
    : _base(base),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
      _index(noreg),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
      _scale(no_scale),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
      _disp(in_bytes(disp)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  Address(Register base, Register index, ScaleFactor scale, ByteSize disp)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
    : _base(base),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
      _index(index),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
      _scale(scale),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
      _disp(in_bytes(disp)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
    assert(!index->is_valid() == (scale == Address::no_scale),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
           "inconsistent address");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
#endif // ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
  // accessors
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 244
diff changeset
   230
  bool        uses(Register reg) const { return _base == reg || _index == reg; }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 244
diff changeset
   231
  Register    base()             const { return _base;  }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 244
diff changeset
   232
  Register    index()            const { return _index; }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 244
diff changeset
   233
  ScaleFactor scale()            const { return _scale; }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 244
diff changeset
   234
  int         disp()             const { return _disp;  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
  // Convert the raw encoding form into the form expected by the constructor for
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
  // Address.  An index of 4 (rsp) corresponds to having no index, so convert
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
  // that to noreg for the Address constructor.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
  static Address make_raw(int base, int index, int scale, int disp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  static Address make_array(ArrayAddress);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
  bool base_needs_rex() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
    return _base != noreg && _base->encoding() >= 8;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
  bool index_needs_rex() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
    return _index != noreg &&_index->encoding() >= 8;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
  relocInfo::relocType reloc() const { return _rspec.type(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
  friend class Assembler;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  friend class MacroAssembler;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
  friend class LIR_Assembler; // base/index/scale/disp
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
// AddressLiteral has been split out from Address because operands of this type
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
// need to be treated specially on 32bit vs. 64bit platforms. By splitting it out
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
// the few instructions that need to deal with address literals are unique and the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
// MacroAssembler does not have to implement every instruction in the Assembler
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
// in order to search for address literals that may need special handling depending
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
// on the instruction and the platform. As small step on the way to merging i486/amd64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
// directories.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
class AddressLiteral VALUE_OBJ_CLASS_SPEC {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  friend class ArrayAddress;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
  RelocationHolder _rspec;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
  // Typically we use AddressLiterals we want to use their rval
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
  // However in some situations we want the lval (effect address) of the item.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
  // We provide a special factory for making those lvals.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
  bool _is_lval;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
  // If the target is far we'll need to load the ea of this to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
  // a register to reach it. Otherwise if near we can do rip
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
  // relative addressing.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
  address          _target;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
 protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
  // creation
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
  AddressLiteral()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
    : _is_lval(false),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
      _target(NULL)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
  {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
  public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
  AddressLiteral(address target, relocInfo::relocType rtype);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
  AddressLiteral(address target, RelocationHolder const& rspec)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
    : _rspec(rspec),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
      _is_lval(false),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
      _target(target)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
  {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
  AddressLiteral addr() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
    AddressLiteral ret = *this;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
    ret._is_lval = true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
    return ret;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
  address target() { return _target; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
  bool is_lval() { return _is_lval; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
  relocInfo::relocType reloc() const { return _rspec.type(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
  const RelocationHolder& rspec() const { return _rspec; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
  friend class Assembler;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
  friend class MacroAssembler;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
  friend class Address;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
  friend class LIR_Assembler;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
// Convience classes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
class RuntimeAddress: public AddressLiteral {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
  public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
  RuntimeAddress(address target) : AddressLiteral(target, relocInfo::runtime_call_type) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
class OopAddress: public AddressLiteral {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
  public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
  OopAddress(address target) : AddressLiteral(target, relocInfo::oop_type){}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
class ExternalAddress: public AddressLiteral {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
  public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
  ExternalAddress(address target) : AddressLiteral(target, relocInfo::external_word_type){}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
class InternalAddress: public AddressLiteral {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
  public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
  InternalAddress(address target) : AddressLiteral(target, relocInfo::internal_word_type) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
// x86 can do array addressing as a single operation since disp can be an absolute
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
// address amd64 can't. We create a class that expresses the concept but does extra
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
// magic on amd64 to get the final result
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
class ArrayAddress VALUE_OBJ_CLASS_SPEC {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
  private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
  AddressLiteral _base;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
  Address        _index;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
  public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
  ArrayAddress() {};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
  ArrayAddress(AddressLiteral base, Address index): _base(base), _index(index) {};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
  AddressLiteral base() { return _base; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
  Address index() { return _index; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   374
const int FPUStateSizeInWords = NOT_LP64(27) LP64_ONLY( 512 / wordSize);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
// The Intel x86/Amd64 Assembler: Pure assembler doing NO optimizations on the instruction
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
// level (e.g. mov rax, 0 is not translated into xor rax, rax!); i.e., what you write
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
// is what you get. The Assembler is generating code into a CodeBuffer.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
class Assembler : public AbstractAssembler  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
  friend class AbstractAssembler; // for the non-virtual hack
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
  friend class LIR_Assembler; // as_Address()
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   383
  friend class StubGenerator;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
  enum Condition {                     // The x86 condition codes used for conditional jumps/moves.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
    zero          = 0x4,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
    notZero       = 0x5,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
    equal         = 0x4,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
    notEqual      = 0x5,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
    less          = 0xc,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
    lessEqual     = 0xe,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
    greater       = 0xf,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
    greaterEqual  = 0xd,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
    below         = 0x2,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
    belowEqual    = 0x6,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
    above         = 0x7,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
    aboveEqual    = 0x3,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
    overflow      = 0x0,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
    noOverflow    = 0x1,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
    carrySet      = 0x2,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
    carryClear    = 0x3,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
    negative      = 0x8,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
    positive      = 0x9,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
    parity        = 0xa,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
    noParity      = 0xb
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
  enum Prefix {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
    // segment overrides
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
    CS_segment = 0x2e,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
    SS_segment = 0x36,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
    DS_segment = 0x3e,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
    ES_segment = 0x26,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
    FS_segment = 0x64,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
    GS_segment = 0x65,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
    REX        = 0x40,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
    REX_B      = 0x41,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
    REX_X      = 0x42,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
    REX_XB     = 0x43,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
    REX_R      = 0x44,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
    REX_RB     = 0x45,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
    REX_RX     = 0x46,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
    REX_RXB    = 0x47,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
    REX_W      = 0x48,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
    REX_WB     = 0x49,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
    REX_WX     = 0x4A,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
    REX_WXB    = 0x4B,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
    REX_WR     = 0x4C,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
    REX_WRB    = 0x4D,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
    REX_WRX    = 0x4E,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
    REX_WRXB   = 0x4F
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
  enum WhichOperand {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
    // input to locate_operand, and format code for relocations
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   441
    imm_operand  = 0,            // embedded 32-bit|64-bit immediate operand
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
    disp32_operand = 1,          // embedded 32-bit displacement or address
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
    call32_operand = 2,          // embedded 32-bit self-relative displacement
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   444
#ifndef _LP64
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
    _WhichOperand_limit = 3
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   446
#else
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   447
     narrow_oop_operand = 3,     // embedded 32-bit immediate narrow oop
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   448
    _WhichOperand_limit = 4
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   449
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   450
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   452
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   453
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   454
  // NOTE: The general philopsophy of the declarations here is that 64bit versions
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   455
  // of instructions are freely declared without the need for wrapping them an ifdef.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   456
  // (Some dangerous instructions are ifdef's out of inappropriate jvm's.)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   457
  // In the .cpp file the implementations are wrapped so that they are dropped out
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   458
  // of the resulting jvm. This is done mostly to keep the footprint of KERNEL
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   459
  // to the size it was prior to merging up the 32bit and 64bit assemblers.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   460
  //
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   461
  // This does mean you'll get a linker/runtime error if you use a 64bit only instruction
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   462
  // in a 32bit vm. This is somewhat unfortunate but keeps the ifdef noise down.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   463
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   464
private:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   465
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   466
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   467
  // 64bit prefixes
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   468
  int prefix_and_encode(int reg_enc, bool byteinst = false);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   469
  int prefixq_and_encode(int reg_enc);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   470
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   471
  int prefix_and_encode(int dst_enc, int src_enc, bool byteinst = false);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   472
  int prefixq_and_encode(int dst_enc, int src_enc);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   473
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   474
  void prefix(Register reg);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   475
  void prefix(Address adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   476
  void prefixq(Address adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   477
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   478
  void prefix(Address adr, Register reg,  bool byteinst = false);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   479
  void prefixq(Address adr, Register reg);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   480
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   481
  void prefix(Address adr, XMMRegister reg);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   482
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   483
  void prefetch_prefix(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   484
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   485
  // Helper functions for groups of instructions
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   486
  void emit_arith_b(int op1, int op2, Register dst, int imm8);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   487
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   488
  void emit_arith(int op1, int op2, Register dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   489
  // only 32bit??
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   490
  void emit_arith(int op1, int op2, Register dst, jobject obj);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   491
  void emit_arith(int op1, int op2, Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   492
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   493
  void emit_operand(Register reg,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   494
                    Register base, Register index, Address::ScaleFactor scale,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   495
                    int disp,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   496
                    RelocationHolder const& rspec,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   497
                    int rip_relative_correction = 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   498
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   499
  void emit_operand(Register reg, Address adr, int rip_relative_correction = 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   500
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   501
  // operands that only take the original 32bit registers
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   502
  void emit_operand32(Register reg, Address adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   503
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   504
  void emit_operand(XMMRegister reg,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   505
                    Register base, Register index, Address::ScaleFactor scale,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   506
                    int disp,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   507
                    RelocationHolder const& rspec);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   508
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   509
  void emit_operand(XMMRegister reg, Address adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   510
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   511
  void emit_operand(MMXRegister reg, Address adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   512
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   513
  // workaround gcc (3.2.1-7) bug
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   514
  void emit_operand(Address adr, MMXRegister reg);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   515
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   516
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   517
  // Immediate-to-memory forms
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   518
  void emit_arith_operand(int op1, Register rm, Address adr, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   519
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   520
  void emit_farith(int b1, int b2, int i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   521
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   522
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   523
 protected:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   524
  #ifdef ASSERT
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   525
  void check_relocation(RelocationHolder const& rspec, int format);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   526
  #endif
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   527
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   528
  inline void emit_long64(jlong x);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   529
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   530
  void emit_data(jint data, relocInfo::relocType    rtype, int format);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   531
  void emit_data(jint data, RelocationHolder const& rspec, int format);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   532
  void emit_data64(jlong data, relocInfo::relocType rtype, int format = 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   533
  void emit_data64(jlong data, RelocationHolder const& rspec, int format = 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   534
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   535
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   536
  bool reachable(AddressLiteral adr) NOT_LP64({ return true;});
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   537
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   538
  // These are all easily abused and hence protected
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   539
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   540
  void mov_literal32(Register dst, int32_t imm32, RelocationHolder const& rspec, int format = 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   541
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   542
  // 32BIT ONLY SECTION
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   543
#ifndef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   544
  // Make these disappear in 64bit mode since they would never be correct
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   545
  void cmp_literal32(Register src1, int32_t imm32, RelocationHolder const& rspec);   // 32BIT ONLY
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   546
  void cmp_literal32(Address src1, int32_t imm32, RelocationHolder const& rspec);    // 32BIT ONLY
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   547
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   548
  void mov_literal32(Address dst, int32_t imm32, RelocationHolder const& rspec);     // 32BIT ONLY
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   549
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   550
  void push_literal32(int32_t imm32, RelocationHolder const& rspec);                 // 32BIT ONLY
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   551
#else
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   552
  // 64BIT ONLY SECTION
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   553
  void mov_literal64(Register dst, intptr_t imm64, RelocationHolder const& rspec);   // 64BIT ONLY
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   554
#endif // _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   555
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   556
  // These are unique in that we are ensured by the caller that the 32bit
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   557
  // relative in these instructions will always be able to reach the potentially
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   558
  // 64bit address described by entry. Since they can take a 64bit address they
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   559
  // don't have the 32 suffix like the other instructions in this class.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   560
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   561
  void call_literal(address entry, RelocationHolder const& rspec);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   562
  void jmp_literal(address entry, RelocationHolder const& rspec);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   563
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   564
  // Avoid using directly section
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   565
  // Instructions in this section are actually usable by anyone without danger
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   566
  // of failure but have performance issues that are addressed my enhanced
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   567
  // instructions which will do the proper thing base on the particular cpu.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   568
  // We protect them because we don't trust you...
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   569
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   570
  // Don't use next inc() and dec() methods directly. INC & DEC instructions
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   571
  // could cause a partial flag stall since they don't set CF flag.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   572
  // Use MacroAssembler::decrement() & MacroAssembler::increment() methods
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   573
  // which call inc() & dec() or add() & sub() in accordance with
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   574
  // the product flag UseIncDec value.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   575
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   576
  void decl(Register dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   577
  void decl(Address dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   578
  void decq(Register dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   579
  void decq(Address dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   580
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   581
  void incl(Register dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   582
  void incl(Address dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   583
  void incq(Register dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   584
  void incq(Address dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   585
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   586
  // New cpus require use of movsd and movss to avoid partial register stall
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   587
  // when loading from memory. But for old Opteron use movlpd instead of movsd.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   588
  // The selection is done in MacroAssembler::movdbl() and movflt().
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   589
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   590
  // Move Scalar Single-Precision Floating-Point Values
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   591
  void movss(XMMRegister dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   592
  void movss(XMMRegister dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   593
  void movss(Address dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   594
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   595
  // Move Scalar Double-Precision Floating-Point Values
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   596
  void movsd(XMMRegister dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   597
  void movsd(XMMRegister dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   598
  void movsd(Address dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   599
  void movlpd(XMMRegister dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   600
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   601
  // New cpus require use of movaps and movapd to avoid partial register stall
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   602
  // when moving between registers.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   603
  void movaps(XMMRegister dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   604
  void movapd(XMMRegister dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   605
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   606
  // End avoid using directly
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   607
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   608
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   609
  // Instruction prefixes
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   610
  void prefix(Prefix p);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   611
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   612
  public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   613
489c9b5090e2 Initial load
duke
parents:
diff changeset
   614
  // Creation
489c9b5090e2 Initial load
duke
parents:
diff changeset
   615
  Assembler(CodeBuffer* code) : AbstractAssembler(code) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   616
489c9b5090e2 Initial load
duke
parents:
diff changeset
   617
  // Decoding
489c9b5090e2 Initial load
duke
parents:
diff changeset
   618
  static address locate_operand(address inst, WhichOperand which);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   619
  static address locate_next_instruction(address inst);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   620
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   621
  // Utilities
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   622
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   623
#ifdef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   624
 static bool is_simm(int64_t x, int nbits) { return -( CONST64(1) << (nbits-1) )  <= x   &&   x  <  ( CONST64(1) << (nbits-1) ); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   625
 static bool is_simm32(int64_t x) { return x == (int64_t)(int32_t)x; }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   626
#else
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   627
 static bool is_simm(int32_t x, int nbits) { return -( 1 << (nbits-1) )  <= x   &&   x  <  ( 1 << (nbits-1) ); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   628
 static bool is_simm32(int32_t x) { return true; }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   629
#endif // LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   630
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   631
  // Generic instructions
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   632
  // Does 32bit or 64bit as needed for the platform. In some sense these
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   633
  // belong in macro assembler but there is no need for both varieties to exist
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   634
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   635
  void lea(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   636
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   637
  void mov(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   638
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   639
  void pusha();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   640
  void popa();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   641
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   642
  void pushf();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   643
  void popf();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   644
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   645
  void push(int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   646
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   647
  void push(Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   648
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   649
  void pop(Register dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   650
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   651
  // These are dummies to prevent surprise implicit conversions to Register
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   652
  void push(void* v);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   653
  void pop(void* v);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   654
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   655
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   656
  // These do register sized moves/scans
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   657
  void rep_mov();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   658
  void rep_set();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   659
  void repne_scan();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   660
#ifdef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   661
  void repne_scanl();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   662
#endif
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   663
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   664
  // Vanilla instructions in lexical order
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   665
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   666
  void adcl(Register dst, int32_t imm32);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   667
  void adcl(Register dst, Address src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   668
  void adcl(Register dst, Register src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   669
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   670
  void adcq(Register dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   671
  void adcq(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   672
  void adcq(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   673
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   674
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   675
  void addl(Address dst, int32_t imm32);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   676
  void addl(Address dst, Register src);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   677
  void addl(Register dst, int32_t imm32);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   678
  void addl(Register dst, Address src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   679
  void addl(Register dst, Register src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   680
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   681
  void addq(Address dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   682
  void addq(Address dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   683
  void addq(Register dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   684
  void addq(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   685
  void addq(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   686
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   687
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   688
  void addr_nop_4();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   689
  void addr_nop_5();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   690
  void addr_nop_7();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   691
  void addr_nop_8();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   692
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   693
  // Add Scalar Double-Precision Floating-Point Values
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   694
  void addsd(XMMRegister dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   695
  void addsd(XMMRegister dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   696
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   697
  // Add Scalar Single-Precision Floating-Point Values
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   698
  void addss(XMMRegister dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   699
  void addss(XMMRegister dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   700
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   701
  void andl(Register dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   702
  void andl(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   703
  void andl(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   704
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   705
  void andq(Register dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   706
  void andq(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   707
  void andq(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   708
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   709
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   710
  // Bitwise Logical AND of Packed Double-Precision Floating-Point Values
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   711
  void andpd(XMMRegister dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   712
  void andpd(XMMRegister dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   713
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   714
  void bswapl(Register reg);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   715
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   716
  void bswapq(Register reg);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   717
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   718
  void call(Label& L, relocInfo::relocType rtype);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   719
  void call(Register reg);  // push pc; pc <- reg
489c9b5090e2 Initial load
duke
parents:
diff changeset
   720
  void call(Address adr);   // push pc; pc <- adr
489c9b5090e2 Initial load
duke
parents:
diff changeset
   721
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   722
  void cdql();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   723
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   724
  void cdqq();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   725
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   726
  void cld() { emit_byte(0xfc); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   727
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   728
  void clflush(Address adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   729
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   730
  void cmovl(Condition cc, Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   731
  void cmovl(Condition cc, Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   732
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   733
  void cmovq(Condition cc, Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   734
  void cmovq(Condition cc, Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   735
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   736
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   737
  void cmpb(Address dst, int imm8);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   738
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   739
  void cmpl(Address dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   740
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   741
  void cmpl(Register dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   742
  void cmpl(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   743
  void cmpl(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   744
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   745
  void cmpq(Address dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   746
  void cmpq(Address dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   747
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   748
  void cmpq(Register dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   749
  void cmpq(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   750
  void cmpq(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   751
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   752
  // these are dummies used to catch attempting to convert NULL to Register
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   753
  void cmpl(Register dst, void* junk); // dummy
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   754
  void cmpq(Register dst, void* junk); // dummy
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   755
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   756
  void cmpw(Address dst, int imm16);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   757
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   758
  void cmpxchg8 (Address adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   759
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   760
  void cmpxchgl(Register reg, Address adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   761
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   762
  void cmpxchgq(Register reg, Address adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   763
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   764
  // Ordered Compare Scalar Double-Precision Floating-Point Values and set EFLAGS
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   765
  void comisd(XMMRegister dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   766
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   767
  // Ordered Compare Scalar Single-Precision Floating-Point Values and set EFLAGS
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   768
  void comiss(XMMRegister dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   769
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   770
  // Identify processor type and features
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   771
  void cpuid() {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   772
    emit_byte(0x0F);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   773
    emit_byte(0xA2);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   774
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   775
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   776
  // Convert Scalar Double-Precision Floating-Point Value to Scalar Single-Precision Floating-Point Value
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   777
  void cvtsd2ss(XMMRegister dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   778
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   779
  // Convert Doubleword Integer to Scalar Double-Precision Floating-Point Value
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   780
  void cvtsi2sdl(XMMRegister dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   781
  void cvtsi2sdq(XMMRegister dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   782
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   783
  // Convert Doubleword Integer to Scalar Single-Precision Floating-Point Value
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   784
  void cvtsi2ssl(XMMRegister dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   785
  void cvtsi2ssq(XMMRegister dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   786
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   787
  // Convert Packed Signed Doubleword Integers to Packed Double-Precision Floating-Point Value
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   788
  void cvtdq2pd(XMMRegister dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   789
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   790
  // Convert Packed Signed Doubleword Integers to Packed Single-Precision Floating-Point Value
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   791
  void cvtdq2ps(XMMRegister dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   792
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   793
  // Convert Scalar Single-Precision Floating-Point Value to Scalar Double-Precision Floating-Point Value
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   794
  void cvtss2sd(XMMRegister dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   795
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   796
  // Convert with Truncation Scalar Double-Precision Floating-Point Value to Doubleword Integer
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   797
  void cvttsd2sil(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   798
  void cvttsd2sil(Register dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   799
  void cvttsd2siq(Register dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   800
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   801
  // Convert with Truncation Scalar Single-Precision Floating-Point Value to Doubleword Integer
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   802
  void cvttss2sil(Register dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   803
  void cvttss2siq(Register dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   804
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   805
  // Divide Scalar Double-Precision Floating-Point Values
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   806
  void divsd(XMMRegister dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   807
  void divsd(XMMRegister dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   808
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   809
  // Divide Scalar Single-Precision Floating-Point Values
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   810
  void divss(XMMRegister dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   811
  void divss(XMMRegister dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   812
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   813
  void emms();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   814
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   815
  void fabs();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   816
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   817
  void fadd(int i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   818
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   819
  void fadd_d(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   820
  void fadd_s(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   821
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   822
  // "Alternate" versions of x87 instructions place result down in FPU
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   823
  // stack instead of on TOS
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   824
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   825
  void fadda(int i); // "alternate" fadd
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   826
  void faddp(int i = 1);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   827
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   828
  void fchs();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   829
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   830
  void fcom(int i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   831
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   832
  void fcomp(int i = 1);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   833
  void fcomp_d(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   834
  void fcomp_s(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   835
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   836
  void fcompp();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   837
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   838
  void fcos();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   839
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   840
  void fdecstp();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   841
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   842
  void fdiv(int i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   843
  void fdiv_d(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   844
  void fdivr_s(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   845
  void fdiva(int i);  // "alternate" fdiv
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   846
  void fdivp(int i = 1);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   847
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   848
  void fdivr(int i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   849
  void fdivr_d(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   850
  void fdiv_s(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   851
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   852
  void fdivra(int i); // "alternate" reversed fdiv
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   853
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   854
  void fdivrp(int i = 1);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   855
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   856
  void ffree(int i = 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   857
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   858
  void fild_d(Address adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   859
  void fild_s(Address adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   860
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   861
  void fincstp();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   862
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   863
  void finit();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   864
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   865
  void fist_s (Address adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   866
  void fistp_d(Address adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   867
  void fistp_s(Address adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   868
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   869
  void fld1();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   870
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   871
  void fld_d(Address adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   872
  void fld_s(Address adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   873
  void fld_s(int index);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   874
  void fld_x(Address adr);  // extended-precision (80-bit) format
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   875
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   876
  void fldcw(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   877
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   878
  void fldenv(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   879
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   880
  void fldlg2();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   881
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   882
  void fldln2();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   883
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   884
  void fldz();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   885
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   886
  void flog();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   887
  void flog10();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   888
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   889
  void fmul(int i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   890
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   891
  void fmul_d(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   892
  void fmul_s(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   893
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   894
  void fmula(int i);  // "alternate" fmul
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   895
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   896
  void fmulp(int i = 1);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   897
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   898
  void fnsave(Address dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   899
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   900
  void fnstcw(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   901
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   902
  void fnstsw_ax();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   903
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   904
  void fprem();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   905
  void fprem1();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   906
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   907
  void frstor(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   908
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   909
  void fsin();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   910
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   911
  void fsqrt();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   912
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   913
  void fst_d(Address adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   914
  void fst_s(Address adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   915
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   916
  void fstp_d(Address adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   917
  void fstp_d(int index);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   918
  void fstp_s(Address adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   919
  void fstp_x(Address adr); // extended-precision (80-bit) format
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   920
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   921
  void fsub(int i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   922
  void fsub_d(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   923
  void fsub_s(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   924
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   925
  void fsuba(int i);  // "alternate" fsub
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   926
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   927
  void fsubp(int i = 1);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   928
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   929
  void fsubr(int i);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   930
  void fsubr_d(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   931
  void fsubr_s(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   932
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   933
  void fsubra(int i); // "alternate" reversed fsub
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   934
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   935
  void fsubrp(int i = 1);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   936
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   937
  void ftan();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   938
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   939
  void ftst();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   940
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   941
  void fucomi(int i = 1);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   942
  void fucomip(int i = 1);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   943
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   944
  void fwait();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   945
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   946
  void fxch(int i = 1);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   947
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   948
  void fxrstor(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   949
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   950
  void fxsave(Address dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   951
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   952
  void fyl2x();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   953
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   954
  void hlt();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   955
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   956
  void idivl(Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   957
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   958
  void idivq(Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   959
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   960
  void imull(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   961
  void imull(Register dst, Register src, int value);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   962
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   963
  void imulq(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   964
  void imulq(Register dst, Register src, int value);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   965
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   966
489c9b5090e2 Initial load
duke
parents:
diff changeset
   967
  // jcc is the generic conditional branch generator to run-
489c9b5090e2 Initial load
duke
parents:
diff changeset
   968
  // time routines, jcc is used for branches to labels. jcc
489c9b5090e2 Initial load
duke
parents:
diff changeset
   969
  // takes a branch opcode (cc) and a label (L) and generates
489c9b5090e2 Initial load
duke
parents:
diff changeset
   970
  // either a backward branch or a forward branch and links it
489c9b5090e2 Initial load
duke
parents:
diff changeset
   971
  // to the label fixup chain. Usage:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   972
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   973
  // Label L;      // unbound label
489c9b5090e2 Initial load
duke
parents:
diff changeset
   974
  // jcc(cc, L);   // forward branch to unbound label
489c9b5090e2 Initial load
duke
parents:
diff changeset
   975
  // bind(L);      // bind label to the current pc
489c9b5090e2 Initial load
duke
parents:
diff changeset
   976
  // jcc(cc, L);   // backward branch to bound label
489c9b5090e2 Initial load
duke
parents:
diff changeset
   977
  // bind(L);      // illegal: a label may be bound only once
489c9b5090e2 Initial load
duke
parents:
diff changeset
   978
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   979
  // Note: The same Label can be used for forward and backward branches
489c9b5090e2 Initial load
duke
parents:
diff changeset
   980
  // but it may be bound only once.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   981
489c9b5090e2 Initial load
duke
parents:
diff changeset
   982
  void jcc(Condition cc, Label& L,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   983
           relocInfo::relocType rtype = relocInfo::none);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   984
489c9b5090e2 Initial load
duke
parents:
diff changeset
   985
  // Conditional jump to a 8-bit offset to L.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   986
  // WARNING: be very careful using this for forward jumps.  If the label is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   987
  // not bound within an 8-bit offset of this instruction, a run-time error
489c9b5090e2 Initial load
duke
parents:
diff changeset
   988
  // will occur.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   989
  void jccb(Condition cc, Label& L);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   990
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   991
  void jmp(Address entry);    // pc <- entry
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   992
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   993
  // Label operations & relative jumps (PPUM Appendix D)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   994
  void jmp(Label& L, relocInfo::relocType rtype = relocInfo::none);   // unconditional jump to L
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   995
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   996
  void jmp(Register entry); // pc <- entry
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   997
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   998
  // Unconditional 8-bit offset jump to L.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   999
  // WARNING: be very careful using this for forward jumps.  If the label is
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1000
  // not bound within an 8-bit offset of this instruction, a run-time error
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1001
  // will occur.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1002
  void jmpb(Label& L);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1003
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1004
  void ldmxcsr( Address src );
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1005
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1006
  void leal(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1007
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1008
  void leaq(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1009
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1010
  void lfence() {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1011
    emit_byte(0x0F);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1012
    emit_byte(0xAE);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1013
    emit_byte(0xE8);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1014
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1015
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1016
  void lock();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1017
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1018
  enum Membar_mask_bits {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1019
    StoreStore = 1 << 3,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1020
    LoadStore  = 1 << 2,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1021
    StoreLoad  = 1 << 1,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1022
    LoadLoad   = 1 << 0
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1023
  };
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1024
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1025
  // Serializes memory.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1026
  void membar(Membar_mask_bits order_constraint) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1027
    // We only have to handle StoreLoad and LoadLoad
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1028
    if (order_constraint & StoreLoad) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1029
      // MFENCE subsumes LFENCE
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1030
      mfence();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1031
    } /* [jk] not needed currently: else if (order_constraint & LoadLoad) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1032
         lfence();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1033
    } */
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1034
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1035
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1036
  void mfence();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1037
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1038
  // Moves
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1039
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1040
  void mov64(Register dst, int64_t imm64);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1041
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1042
  void movb(Address dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1043
  void movb(Address dst, int imm8);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1044
  void movb(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1045
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1046
  void movdl(XMMRegister dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1047
  void movdl(Register dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1048
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1049
  // Move Double Quadword
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1050
  void movdq(XMMRegister dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1051
  void movdq(Register dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1052
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1053
  // Move Aligned Double Quadword
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1054
  void movdqa(Address     dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1055
  void movdqa(XMMRegister dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1056
  void movdqa(XMMRegister dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1057
1437
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  1058
  // Move Unaligned Double Quadword
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  1059
  void movdqu(Address     dst, XMMRegister src);
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  1060
  void movdqu(XMMRegister dst, Address src);
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  1061
  void movdqu(XMMRegister dst, XMMRegister src);
d1846c1c04c4 6532536: Optimize arraycopy stubs for Intel cpus
kvn
parents: 1394
diff changeset
  1062
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1063
  void movl(Register dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1064
  void movl(Address dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1065
  void movl(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1066
  void movl(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1067
  void movl(Address dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1068
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1069
  // These dummies prevent using movl from converting a zero (like NULL) into Register
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1070
  // by giving the compiler two choices it can't resolve
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1071
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1072
  void movl(Address  dst, void* junk);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1073
  void movl(Register dst, void* junk);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1074
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1075
#ifdef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1076
  void movq(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1077
  void movq(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1078
  void movq(Address dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1079
#endif
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1080
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1081
  void movq(Address     dst, MMXRegister src );
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1082
  void movq(MMXRegister dst, Address src );
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1083
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1084
#ifdef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1085
  // These dummies prevent using movq from converting a zero (like NULL) into Register
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1086
  // by giving the compiler two choices it can't resolve
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1087
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1088
  void movq(Address  dst, void* dummy);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1089
  void movq(Register dst, void* dummy);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1090
#endif
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1091
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1092
  // Move Quadword
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1093
  void movq(Address     dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1094
  void movq(XMMRegister dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1095
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1096
  void movsbl(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1097
  void movsbl(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1098
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1099
#ifdef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1100
  // Move signed 32bit immediate to 64bit extending sign
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1101
  void movslq(Address dst, int32_t imm64);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1102
  void movslq(Register dst, int32_t imm64);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1103
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1104
  void movslq(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1105
  void movslq(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1106
  void movslq(Register dst, void* src); // Dummy declaration to cause NULL to be ambiguous
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1107
#endif
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1108
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1109
  void movswl(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1110
  void movswl(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1111
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1112
  void movw(Address dst, int imm16);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1113
  void movw(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1114
  void movw(Address dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1115
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1116
  void movzbl(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1117
  void movzbl(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1118
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1119
  void movzwl(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1120
  void movzwl(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1121
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1122
  void mull(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1123
  void mull(Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1124
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1125
  // Multiply Scalar Double-Precision Floating-Point Values
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1126
  void mulsd(XMMRegister dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1127
  void mulsd(XMMRegister dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1128
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1129
  // Multiply Scalar Single-Precision Floating-Point Values
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1130
  void mulss(XMMRegister dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1131
  void mulss(XMMRegister dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1132
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1133
  void negl(Register dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1134
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1135
#ifdef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1136
  void negq(Register dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1137
#endif
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1138
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1139
  void nop(int i = 1);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1140
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1141
  void notl(Register dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1142
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1143
#ifdef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1144
  void notq(Register dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1145
#endif
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1146
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1147
  void orl(Address dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1148
  void orl(Register dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1149
  void orl(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1150
  void orl(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1151
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1152
  void orq(Address dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1153
  void orq(Register dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1154
  void orq(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1155
  void orq(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1156
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1157
  void popl(Address dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1158
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1159
#ifdef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1160
  void popq(Address dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1161
#endif
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1162
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1163
  // Prefetches (SSE, SSE2, 3DNOW only)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1164
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1165
  void prefetchnta(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1166
  void prefetchr(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1167
  void prefetcht0(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1168
  void prefetcht1(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1169
  void prefetcht2(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1170
  void prefetchw(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1171
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1172
  // Shuffle Packed Doublewords
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1173
  void pshufd(XMMRegister dst, XMMRegister src, int mode);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1174
  void pshufd(XMMRegister dst, Address src,     int mode);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1175
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1176
  // Shuffle Packed Low Words
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1177
  void pshuflw(XMMRegister dst, XMMRegister src, int mode);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1178
  void pshuflw(XMMRegister dst, Address src,     int mode);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1179
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1180
  // Shift Right Logical Quadword Immediate
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1181
  void psrlq(XMMRegister dst, int shift);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1182
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1183
  // Interleave Low Bytes
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1184
  void punpcklbw(XMMRegister dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1185
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1186
  void pushl(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1187
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1188
  void pushq(Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1189
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1190
  // Xor Packed Byte Integer Values
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1191
  void pxor(XMMRegister dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1192
  void pxor(XMMRegister dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1193
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1194
  void rcll(Register dst, int imm8);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1195
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1196
  void rclq(Register dst, int imm8);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1197
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1198
  void ret(int imm16);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1199
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1200
  void sahf();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1201
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1202
  void sarl(Register dst, int imm8);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1203
  void sarl(Register dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1204
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1205
  void sarq(Register dst, int imm8);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1206
  void sarq(Register dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1207
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1208
  void sbbl(Address dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1209
  void sbbl(Register dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1210
  void sbbl(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1211
  void sbbl(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1212
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1213
  void sbbq(Address dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1214
  void sbbq(Register dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1215
  void sbbq(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1216
  void sbbq(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1217
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1218
  void setb(Condition cc, Register dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1219
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1220
  void shldl(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1221
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1222
  void shll(Register dst, int imm8);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1223
  void shll(Register dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1224
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1225
  void shlq(Register dst, int imm8);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1226
  void shlq(Register dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1227
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1228
  void shrdl(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1229
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1230
  void shrl(Register dst, int imm8);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1231
  void shrl(Register dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1232
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1233
  void shrq(Register dst, int imm8);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1234
  void shrq(Register dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1235
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1236
  void smovl(); // QQQ generic?
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1237
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1238
  // Compute Square Root of Scalar Double-Precision Floating-Point Value
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1239
  void sqrtsd(XMMRegister dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1240
  void sqrtsd(XMMRegister dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1241
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1242
  void std() { emit_byte(0xfd); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1243
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1244
  void stmxcsr( Address dst );
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1245
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1246
  void subl(Address dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1247
  void subl(Address dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1248
  void subl(Register dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1249
  void subl(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1250
  void subl(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1251
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1252
  void subq(Address dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1253
  void subq(Address dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1254
  void subq(Register dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1255
  void subq(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1256
  void subq(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1257
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1258
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1259
  // Subtract Scalar Double-Precision Floating-Point Values
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1260
  void subsd(XMMRegister dst, Address src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1261
  void subsd(XMMRegister dst, XMMRegister src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1262
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1263
  // Subtract Scalar Single-Precision Floating-Point Values
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1264
  void subss(XMMRegister dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1265
  void subss(XMMRegister dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1266
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1267
  void testb(Register dst, int imm8);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1268
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1269
  void testl(Register dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1270
  void testl(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1271
  void testl(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1272
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1273
  void testq(Register dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1274
  void testq(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1275
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1276
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1277
  // Unordered Compare Scalar Double-Precision Floating-Point Values and set EFLAGS
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1278
  void ucomisd(XMMRegister dst, Address src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1279
  void ucomisd(XMMRegister dst, XMMRegister src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1280
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1281
  // Unordered Compare Scalar Single-Precision Floating-Point Values and set EFLAGS
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1282
  void ucomiss(XMMRegister dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1283
  void ucomiss(XMMRegister dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1284
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1285
  void xaddl(Address dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1286
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1287
  void xaddq(Address dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1288
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1289
  void xchgl(Register reg, Address adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1290
  void xchgl(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1291
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1292
  void xchgq(Register reg, Address adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1293
  void xchgq(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1294
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1295
  void xorl(Register dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1296
  void xorl(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1297
  void xorl(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1298
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1299
  void xorq(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1300
  void xorq(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1301
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1302
  // Bitwise Logical XOR of Packed Double-Precision Floating-Point Values
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1303
  void xorpd(XMMRegister dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1304
  void xorpd(XMMRegister dst, XMMRegister src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1305
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1306
  // Bitwise Logical XOR of Packed Single-Precision Floating-Point Values
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1307
  void xorps(XMMRegister dst, Address src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1308
  void xorps(XMMRegister dst, XMMRegister src);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1309
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1310
  void set_byte_if_not_zero(Register dst); // sets reg to 1 if not zero, otherwise 0
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1311
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1312
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1313
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1314
// MacroAssembler extends Assembler by frequently used macros.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1315
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1316
// Instructions for which a 'better' code sequence exists depending
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1317
// on arguments should also go in here.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1318
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1319
class MacroAssembler: public Assembler {
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 244
diff changeset
  1320
  friend class LIR_Assembler;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 244
diff changeset
  1321
  friend class Runtime1;      // as_Address()
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1322
 protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1323
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1324
  Address as_Address(AddressLiteral adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1325
  Address as_Address(ArrayAddress adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1326
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1327
  // Support for VM calls
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1328
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1329
  // This is the base routine called by the different versions of call_VM_leaf. The interpreter
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1330
  // may customize this version by overriding it for its purposes (e.g., to save/restore
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1331
  // additional registers when doing a VM call).
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1332
#ifdef CC_INTERP
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1333
  // c++ interpreter never wants to use interp_masm version of call_VM
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1334
  #define VIRTUAL
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1335
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1336
  #define VIRTUAL virtual
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1337
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1338
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1339
  VIRTUAL void call_VM_leaf_base(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1340
    address entry_point,               // the entry point
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1341
    int     number_of_arguments        // the number of arguments to pop after the call
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1342
  );
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1343
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1344
  // This is the base routine called by the different versions of call_VM. The interpreter
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1345
  // may customize this version by overriding it for its purposes (e.g., to save/restore
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1346
  // additional registers when doing a VM call).
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1347
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1348
  // If no java_thread register is specified (noreg) than rdi will be used instead. call_VM_base
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1349
  // returns the register which contains the thread upon return. If a thread register has been
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1350
  // specified, the return value will correspond to that register. If no last_java_sp is specified
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1351
  // (noreg) than rsp will be used instead.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1352
  VIRTUAL void call_VM_base(           // returns the register containing the thread upon return
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1353
    Register oop_result,               // where an oop-result ends up if any; use noreg otherwise
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1354
    Register java_thread,              // the thread if computed before     ; use noreg otherwise
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1355
    Register last_java_sp,             // to set up last_Java_frame in stubs; use noreg otherwise
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1356
    address  entry_point,              // the entry point
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1357
    int      number_of_arguments,      // the number of arguments (w/o thread) to pop after the call
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1358
    bool     check_exceptions          // whether to check for pending exceptions after return
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1359
  );
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1360
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1361
  // These routines should emit JVMTI PopFrame and ForceEarlyReturn handling code.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1362
  // The implementation is only non-empty for the InterpreterMacroAssembler,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1363
  // as only the interpreter handles PopFrame and ForceEarlyReturn requests.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1364
  virtual void check_and_handle_popframe(Register java_thread);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1365
  virtual void check_and_handle_earlyret(Register java_thread);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1366
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1367
  void call_VM_helper(Register oop_result, address entry_point, int number_of_arguments, bool check_exceptions = true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1368
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1369
  // helpers for FPU flag access
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1370
  // tmp is a temporary register, if none is available use noreg
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1371
  void save_rax   (Register tmp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1372
  void restore_rax(Register tmp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1373
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1374
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1375
  MacroAssembler(CodeBuffer* code) : Assembler(code) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1376
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1377
  // Support for NULL-checks
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1378
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1379
  // Generates code that causes a NULL OS exception if the content of reg is NULL.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1380
  // If the accessed location is M[reg + offset] and the offset is known, provide the
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1381
  // offset. No explicit code generation is needed if the offset is within a certain
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1382
  // range (0 <= offset <= page_size).
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1383
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1384
  void null_check(Register reg, int offset = -1);
594
9f4474e5dbaf 6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents: 244
diff changeset
  1385
  static bool needs_explicit_null_check(intptr_t offset);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1386
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1387
  // Required platform-specific helpers for Label::patch_instructions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1388
  // They _shadow_ the declarations in AbstractAssembler, which are undefined.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1389
  void pd_patch_instruction(address branch, address target);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1390
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1391
  static void pd_print_patched_instruction(address branch);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1392
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1393
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1394
  // The following 4 methods return the offset of the appropriate move instruction
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1395
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1396
  // Support for fast byte/word loading with zero extension (depending on particular CPU)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1397
  int load_unsigned_byte(Register dst, Address src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1398
  int load_unsigned_word(Register dst, Address src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1399
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1400
  // Support for fast byte/word loading with sign extension (depending on particular CPU)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1401
  int load_signed_byte(Register dst, Address src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1402
  int load_signed_word(Register dst, Address src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1403
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1404
  // Support for sign-extension (hi:lo = extend_sign(lo))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1405
  void extend_sign(Register hi, Register lo);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1406
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1407
  // Support for inc/dec with optimal instruction selection depending on value
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1408
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1409
  void increment(Register reg, int value = 1) { LP64_ONLY(incrementq(reg, value)) NOT_LP64(incrementl(reg, value)) ; }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1410
  void decrement(Register reg, int value = 1) { LP64_ONLY(decrementq(reg, value)) NOT_LP64(decrementl(reg, value)) ; }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1411
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1412
  void decrementl(Address dst, int value = 1);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1413
  void decrementl(Register reg, int value = 1);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1414
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1415
  void decrementq(Register reg, int value = 1);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1416
  void decrementq(Address dst, int value = 1);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1417
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1418
  void incrementl(Address dst, int value = 1);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1419
  void incrementl(Register reg, int value = 1);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1420
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1421
  void incrementq(Register reg, int value = 1);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1422
  void incrementq(Address dst, int value = 1);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1423
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1424
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1425
  // Support optimal SSE move instructions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1426
  void movflt(XMMRegister dst, XMMRegister src) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1427
    if (UseXmmRegToRegMoveAll) { movaps(dst, src); return; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1428
    else                       { movss (dst, src); return; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1429
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1430
  void movflt(XMMRegister dst, Address src) { movss(dst, src); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1431
  void movflt(XMMRegister dst, AddressLiteral src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1432
  void movflt(Address dst, XMMRegister src) { movss(dst, src); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1433
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1434
  void movdbl(XMMRegister dst, XMMRegister src) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1435
    if (UseXmmRegToRegMoveAll) { movapd(dst, src); return; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1436
    else                       { movsd (dst, src); return; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1437
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1438
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1439
  void movdbl(XMMRegister dst, AddressLiteral src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1440
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1441
  void movdbl(XMMRegister dst, Address src) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1442
    if (UseXmmLoadAndClearUpper) { movsd (dst, src); return; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1443
    else                         { movlpd(dst, src); return; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1444
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1445
  void movdbl(Address dst, XMMRegister src) { movsd(dst, src); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1446
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1447
  void incrementl(AddressLiteral dst);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1448
  void incrementl(ArrayAddress dst);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1449
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1450
  // Alignment
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1451
  void align(int modulus);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1452
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1453
  // Misc
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1454
  void fat_nop(); // 5 byte nop
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1455
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1456
  // Stack frame creation/removal
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1457
  void enter();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1458
  void leave();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1459
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1460
  // Support for getting the JavaThread pointer (i.e.; a reference to thread-local information)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1461
  // The pointer will be loaded into the thread register.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1462
  void get_thread(Register thread);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1463
1394
apetrusenko
parents: 1388 1066
diff changeset
  1464
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1465
  // Support for VM calls
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1466
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1467
  // It is imperative that all calls into the VM are handled via the call_VM macros.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1468
  // They make sure that the stack linkage is setup correctly. call_VM's correspond
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1469
  // to ENTRY/ENTRY_X entry points while call_VM_leaf's correspond to LEAF entry points.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1470
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1471
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1472
  void call_VM(Register oop_result,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1473
               address entry_point,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1474
               bool check_exceptions = true);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1475
  void call_VM(Register oop_result,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1476
               address entry_point,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1477
               Register arg_1,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1478
               bool check_exceptions = true);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1479
  void call_VM(Register oop_result,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1480
               address entry_point,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1481
               Register arg_1, Register arg_2,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1482
               bool check_exceptions = true);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1483
  void call_VM(Register oop_result,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1484
               address entry_point,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1485
               Register arg_1, Register arg_2, Register arg_3,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1486
               bool check_exceptions = true);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1487
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1488
  // Overloadings with last_Java_sp
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1489
  void call_VM(Register oop_result,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1490
               Register last_java_sp,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1491
               address entry_point,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1492
               int number_of_arguments = 0,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1493
               bool check_exceptions = true);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1494
  void call_VM(Register oop_result,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1495
               Register last_java_sp,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1496
               address entry_point,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1497
               Register arg_1, bool
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1498
               check_exceptions = true);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1499
  void call_VM(Register oop_result,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1500
               Register last_java_sp,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1501
               address entry_point,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1502
               Register arg_1, Register arg_2,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1503
               bool check_exceptions = true);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1504
  void call_VM(Register oop_result,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1505
               Register last_java_sp,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1506
               address entry_point,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1507
               Register arg_1, Register arg_2, Register arg_3,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1508
               bool check_exceptions = true);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1509
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1510
  void call_VM_leaf(address entry_point,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1511
                    int number_of_arguments = 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1512
  void call_VM_leaf(address entry_point,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1513
                    Register arg_1);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1514
  void call_VM_leaf(address entry_point,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1515
                    Register arg_1, Register arg_2);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1516
  void call_VM_leaf(address entry_point,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1517
                    Register arg_1, Register arg_2, Register arg_3);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1518
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1519
  // last Java Frame (fills frame anchor)
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1520
  void set_last_Java_frame(Register thread,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1521
                           Register last_java_sp,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1522
                           Register last_java_fp,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1523
                           address last_java_pc);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1524
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1525
  // thread in the default location (r15_thread on 64bit)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1526
  void set_last_Java_frame(Register last_java_sp,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1527
                           Register last_java_fp,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1528
                           address last_java_pc);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1529
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1530
  void reset_last_Java_frame(Register thread, bool clear_fp, bool clear_pc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1531
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1532
  // thread in the default location (r15_thread on 64bit)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1533
  void reset_last_Java_frame(bool clear_fp, bool clear_pc);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1534
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1535
  // Stores
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1536
  void store_check(Register obj);                // store check for obj - register is destroyed afterwards
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1537
  void store_check(Register obj, Address dst);   // same as above, dst is exact store location (reg. is destroyed)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1538
1394
apetrusenko
parents: 1388 1066
diff changeset
  1539
  void g1_write_barrier_pre(Register obj,
apetrusenko
parents: 1388 1066
diff changeset
  1540
#ifndef _LP64
apetrusenko
parents: 1388 1066
diff changeset
  1541
                            Register thread,
apetrusenko
parents: 1388 1066
diff changeset
  1542
#endif
apetrusenko
parents: 1388 1066
diff changeset
  1543
                            Register tmp,
apetrusenko
parents: 1388 1066
diff changeset
  1544
                            Register tmp2,
apetrusenko
parents: 1388 1066
diff changeset
  1545
                            bool     tosca_live);
apetrusenko
parents: 1388 1066
diff changeset
  1546
  void g1_write_barrier_post(Register store_addr,
apetrusenko
parents: 1388 1066
diff changeset
  1547
                             Register new_val,
apetrusenko
parents: 1388 1066
diff changeset
  1548
#ifndef _LP64
apetrusenko
parents: 1388 1066
diff changeset
  1549
                             Register thread,
apetrusenko
parents: 1388 1066
diff changeset
  1550
#endif
apetrusenko
parents: 1388 1066
diff changeset
  1551
                             Register tmp,
apetrusenko
parents: 1388 1066
diff changeset
  1552
                             Register tmp2);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 244
diff changeset
  1553
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 244
diff changeset
  1554
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1555
  // split store_check(Register obj) to enhance instruction interleaving
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1556
  void store_check_part_1(Register obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1557
  void store_check_part_2(Register obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1558
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1559
  // C 'boolean' to Java boolean: x == 0 ? 0 : 1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1560
  void c2bool(Register x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1561
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1562
  // C++ bool manipulation
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1563
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1564
  void movbool(Register dst, Address src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1565
  void movbool(Address dst, bool boolconst);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1566
  void movbool(Address dst, Register src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1567
  void testbool(Register dst);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1568
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1569
  // oop manipulations
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1570
  void load_klass(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1571
  void store_klass(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1572
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1573
  void load_prototype_header(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1574
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1575
#ifdef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1576
  void store_klass_gap(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1577
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1578
  void load_heap_oop(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1579
  void store_heap_oop(Address dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1580
  void encode_heap_oop(Register r);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1581
  void decode_heap_oop(Register r);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1582
  void encode_heap_oop_not_null(Register r);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1583
  void decode_heap_oop_not_null(Register r);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1584
  void encode_heap_oop_not_null(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1585
  void decode_heap_oop_not_null(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1586
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1587
  void set_narrow_oop(Register dst, jobject obj);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1588
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1589
  // if heap base register is used - reinit it with the correct value
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1590
  void reinit_heapbase();
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1591
#endif // _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1592
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1593
  // Int division/remainder for Java
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1594
  // (as idivl, but checks for special case as described in JVM spec.)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1595
  // returns idivl instruction offset for implicit exception handling
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1596
  int corrected_idivl(Register reg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1597
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1598
  // Long division/remainder for Java
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1599
  // (as idivq, but checks for special case as described in JVM spec.)
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1600
  // returns idivq instruction offset for implicit exception handling
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1601
  int corrected_idivq(Register reg);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1602
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1603
  void int3();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1604
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1605
  // Long operation macros for a 32bit cpu
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1606
  // Long negation for Java
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1607
  void lneg(Register hi, Register lo);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1608
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1609
  // Long multiplication for Java
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1610
  // (destroys contents of eax, ebx, ecx and edx)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1611
  void lmul(int x_rsp_offset, int y_rsp_offset); // rdx:rax = x * y
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1612
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1613
  // Long shifts for Java
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1614
  // (semantics as described in JVM spec.)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1615
  void lshl(Register hi, Register lo);                               // hi:lo << (rcx & 0x3f)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1616
  void lshr(Register hi, Register lo, bool sign_extension = false);  // hi:lo >> (rcx & 0x3f)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1617
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1618
  // Long compare for Java
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1619
  // (semantics as described in JVM spec.)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1620
  void lcmp2int(Register x_hi, Register x_lo, Register y_hi, Register y_lo); // x_hi = lcmp(x, y)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1621
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1622
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1623
  // misc
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1624
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1625
  // Sign extension
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1626
  void sign_extend_short(Register reg);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1627
  void sign_extend_byte(Register reg);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1628
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1629
  // Division by power of 2, rounding towards 0
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1630
  void division_with_shift(Register reg, int shift_value);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1631
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1632
  // Compares the top-most stack entries on the FPU stack and sets the eflags as follows:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1633
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1634
  // CF (corresponds to C0) if x < y
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1635
  // PF (corresponds to C2) if unordered
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1636
  // ZF (corresponds to C3) if x = y
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1637
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1638
  // The arguments are in reversed order on the stack (i.e., top of stack is first argument).
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1639
  // tmp is a temporary register, if none is available use noreg (only matters for non-P6 code)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1640
  void fcmp(Register tmp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1641
  // Variant of the above which allows y to be further down the stack
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1642
  // and which only pops x and y if specified. If pop_right is
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1643
  // specified then pop_left must also be specified.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1644
  void fcmp(Register tmp, int index, bool pop_left, bool pop_right);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1645
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1646
  // Floating-point comparison for Java
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1647
  // Compares the top-most stack entries on the FPU stack and stores the result in dst.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1648
  // The arguments are in reversed order on the stack (i.e., top of stack is first argument).
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1649
  // (semantics as described in JVM spec.)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1650
  void fcmp2int(Register dst, bool unordered_is_less);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1651
  // Variant of the above which allows y to be further down the stack
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1652
  // and which only pops x and y if specified. If pop_right is
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1653
  // specified then pop_left must also be specified.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1654
  void fcmp2int(Register dst, bool unordered_is_less, int index, bool pop_left, bool pop_right);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1655
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1656
  // Floating-point remainder for Java (ST0 = ST0 fremr ST1, ST1 is empty afterwards)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1657
  // tmp is a temporary register, if none is available use noreg
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1658
  void fremr(Register tmp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1659
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1660
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1661
  // same as fcmp2int, but using SSE2
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1662
  void cmpss2int(XMMRegister opr1, XMMRegister opr2, Register dst, bool unordered_is_less);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1663
  void cmpsd2int(XMMRegister opr1, XMMRegister opr2, Register dst, bool unordered_is_less);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1664
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1665
  // Inlined sin/cos generator for Java; must not use CPU instruction
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1666
  // directly on Intel as it does not have high enough precision
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1667
  // outside of the range [-pi/4, pi/4]. Extra argument indicate the
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1668
  // number of FPU stack slots in use; all but the topmost will
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1669
  // require saving if a slow case is necessary. Assumes argument is
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1670
  // on FP TOS; result is on FP TOS.  No cpu registers are changed by
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1671
  // this code.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1672
  void trigfunc(char trig, int num_fpu_regs_in_use = 1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1673
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1674
  // branch to L if FPU flag C2 is set/not set
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1675
  // tmp is a temporary register, if none is available use noreg
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1676
  void jC2 (Register tmp, Label& L);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1677
  void jnC2(Register tmp, Label& L);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1678
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1679
  // Pop ST (ffree & fincstp combined)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1680
  void fpop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1681
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1682
  // pushes double TOS element of FPU stack on CPU stack; pops from FPU stack
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1683
  void push_fTOS();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1684
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1685
  // pops double TOS element from CPU stack and pushes on FPU stack
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1686
  void pop_fTOS();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1687
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1688
  void empty_FPU_stack();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1689
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1690
  void push_IU_state();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1691
  void pop_IU_state();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1692
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1693
  void push_FPU_state();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1694
  void pop_FPU_state();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1695
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1696
  void push_CPU_state();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1697
  void pop_CPU_state();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1698
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1699
  // Round up to a power of two
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1700
  void round_to(Register reg, int modulus);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1701
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1702
  // Callee saved registers handling
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1703
  void push_callee_saved_registers();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1704
  void pop_callee_saved_registers();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1705
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1706
  // allocation
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1707
  void eden_allocate(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1708
    Register obj,                      // result: pointer to object after successful allocation
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1709
    Register var_size_in_bytes,        // object size in bytes if unknown at compile time; invalid otherwise
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1710
    int      con_size_in_bytes,        // object size in bytes if   known at compile time
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1711
    Register t1,                       // temp register
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1712
    Label&   slow_case                 // continuation point if fast allocation fails
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1713
  );
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1714
  void tlab_allocate(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1715
    Register obj,                      // result: pointer to object after successful allocation
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1716
    Register var_size_in_bytes,        // object size in bytes if unknown at compile time; invalid otherwise
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1717
    int      con_size_in_bytes,        // object size in bytes if   known at compile time
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1718
    Register t1,                       // temp register
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1719
    Register t2,                       // temp register
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1720
    Label&   slow_case                 // continuation point if fast allocation fails
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1721
  );
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1722
  void tlab_refill(Label& retry_tlab, Label& try_eden, Label& slow_case);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1723
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1724
  //----
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1725
  void set_word_if_not_zero(Register reg); // sets reg to 1 if not zero, otherwise 0
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1726
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1727
  // Debugging
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1728
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1729
  // only if +VerifyOops
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1730
  void verify_oop(Register reg, const char* s = "broken oop");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1731
  void verify_oop_addr(Address addr, const char * s = "broken oop addr");
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1732
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1733
  // only if +VerifyFPU
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1734
  void verify_FPU(int stack_depth, const char* s = "illegal FPU state");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1735
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1736
  // prints msg, dumps registers and stops execution
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1737
  void stop(const char* msg);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1738
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1739
  // prints msg and continues
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1740
  void warn(const char* msg);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1741
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1742
  static void debug32(int rdi, int rsi, int rbp, int rsp, int rbx, int rdx, int rcx, int rax, int eip, char* msg);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1743
  static void debug64(char* msg, int64_t pc, int64_t regs[]);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1744
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1745
  void os_breakpoint();
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1746
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1747
  void untested()                                { stop("untested"); }
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1748
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1749
  void unimplemented(const char* what = "")      { char* b = new char[1024];  jio_snprintf(b, sizeof(b), "unimplemented: %s", what);  stop(b); }
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1750
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1751
  void should_not_reach_here()                   { stop("should not reach here"); }
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1752
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1753
  void print_CPU_state();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1754
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1755
  // Stack overflow checking
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1756
  void bang_stack_with_offset(int offset) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1757
    // stack grows down, caller passes positive offset
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1758
    assert(offset > 0, "must bang with negative offset");
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1759
    movl(Address(rsp, (-offset)), rax);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1760
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1761
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1762
  // Writes to stack successive pages until offset reached to check for
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1763
  // stack overflow + shadow pages.  Also, clobbers tmp
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1764
  void bang_stack_size(Register size, Register tmp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1765
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1766
  // Support for serializing memory accesses between threads
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1767
  void serialize_memory(Register thread, Register tmp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1768
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1769
  void verify_tlab();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1770
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1771
  // Biased locking support
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1772
  // lock_reg and obj_reg must be loaded up with the appropriate values.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1773
  // swap_reg must be rax, and is killed.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1774
  // tmp_reg is optional. If it is supplied (i.e., != noreg) it will
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1775
  // be killed; if not supplied, push/pop will be used internally to
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1776
  // allocate a temporary (inefficient, avoid if possible).
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1777
  // Optional slow case is for implementations (interpreter and C1) which branch to
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1778
  // slow case directly. Leaves condition codes set for C2's Fast_Lock node.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1779
  // Returns offset of first potentially-faulting instruction for null
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1780
  // check info (currently consumed only by C1). If
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1781
  // swap_reg_contains_mark is true then returns -1 as it is assumed
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1782
  // the calling code has already passed any potential faults.
1500
bea9a90f3e8f 6462850: generate biased locking code in C2 ideal graph
kvn
parents: 1437
diff changeset
  1783
  int biased_locking_enter(Register lock_reg, Register obj_reg,
bea9a90f3e8f 6462850: generate biased locking code in C2 ideal graph
kvn
parents: 1437
diff changeset
  1784
                           Register swap_reg, Register tmp_reg,
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1785
                           bool swap_reg_contains_mark,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1786
                           Label& done, Label* slow_case = NULL,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1787
                           BiasedLockingCounters* counters = NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1788
  void biased_locking_exit (Register obj_reg, Register temp_reg, Label& done);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1789
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1790
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1791
  Condition negate_condition(Condition cond);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1792
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1793
  // Instructions that use AddressLiteral operands. These instruction can handle 32bit/64bit
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1794
  // operands. In general the names are modified to avoid hiding the instruction in Assembler
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1795
  // so that we don't need to implement all the varieties in the Assembler with trivial wrappers
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1796
  // here in MacroAssembler. The major exception to this rule is call
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1797
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1798
  // Arithmetics
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1799
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1800
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1801
  void addptr(Address dst, int32_t src) { LP64_ONLY(addq(dst, src)) NOT_LP64(addl(dst, src)) ; }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1802
  void addptr(Address dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1803
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1804
  void addptr(Register dst, Address src) { LP64_ONLY(addq(dst, src)) NOT_LP64(addl(dst, src)); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1805
  void addptr(Register dst, int32_t src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1806
  void addptr(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1807
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1808
  void andptr(Register dst, int32_t src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1809
  void andptr(Register src1, Register src2) { LP64_ONLY(andq(src1, src2)) NOT_LP64(andl(src1, src2)) ; }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1810
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1811
  void cmp8(AddressLiteral src1, int imm);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1812
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1813
  // renamed to drag out the casting of address to int32_t/intptr_t
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1814
  void cmp32(Register src1, int32_t imm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1815
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1816
  void cmp32(AddressLiteral src1, int32_t imm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1817
  // compare reg - mem, or reg - &mem
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1818
  void cmp32(Register src1, AddressLiteral src2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1819
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1820
  void cmp32(Register src1, Address src2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1821
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1822
#ifndef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1823
  void cmpoop(Address dst, jobject obj);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1824
  void cmpoop(Register dst, jobject obj);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1825
#endif // _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1826
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1827
  // NOTE src2 must be the lval. This is NOT an mem-mem compare
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1828
  void cmpptr(Address src1, AddressLiteral src2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1829
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1830
  void cmpptr(Register src1, AddressLiteral src2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1831
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1832
  void cmpptr(Register src1, Register src2) { LP64_ONLY(cmpq(src1, src2)) NOT_LP64(cmpl(src1, src2)) ; }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1833
  void cmpptr(Register src1, Address src2) { LP64_ONLY(cmpq(src1, src2)) NOT_LP64(cmpl(src1, src2)) ; }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1834
  // void cmpptr(Address src1, Register src2) { LP64_ONLY(cmpq(src1, src2)) NOT_LP64(cmpl(src1, src2)) ; }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1835
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1836
  void cmpptr(Register src1, int32_t src2) { LP64_ONLY(cmpq(src1, src2)) NOT_LP64(cmpl(src1, src2)) ; }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1837
  void cmpptr(Address src1, int32_t src2) { LP64_ONLY(cmpq(src1, src2)) NOT_LP64(cmpl(src1, src2)) ; }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1838
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1839
  // cmp64 to avoild hiding cmpq
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1840
  void cmp64(Register src1, AddressLiteral src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1841
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1842
  void cmpxchgptr(Register reg, Address adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1843
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1844
  void locked_cmpxchgptr(Register reg, AddressLiteral adr);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1845
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1846
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1847
  void imulptr(Register dst, Register src) { LP64_ONLY(imulq(dst, src)) NOT_LP64(imull(dst, src)); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1848
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1849
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1850
  void negptr(Register dst) { LP64_ONLY(negq(dst)) NOT_LP64(negl(dst)); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1851
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1852
  void notptr(Register dst) { LP64_ONLY(notq(dst)) NOT_LP64(notl(dst)); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1853
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1854
  void shlptr(Register dst, int32_t shift);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1855
  void shlptr(Register dst) { LP64_ONLY(shlq(dst)) NOT_LP64(shll(dst)); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1856
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1857
  void shrptr(Register dst, int32_t shift);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1858
  void shrptr(Register dst) { LP64_ONLY(shrq(dst)) NOT_LP64(shrl(dst)); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1859
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1860
  void sarptr(Register dst) { LP64_ONLY(sarq(dst)) NOT_LP64(sarl(dst)); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1861
  void sarptr(Register dst, int32_t src) { LP64_ONLY(sarq(dst, src)) NOT_LP64(sarl(dst, src)); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1862
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1863
  void subptr(Address dst, int32_t src) { LP64_ONLY(subq(dst, src)) NOT_LP64(subl(dst, src)); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1864
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1865
  void subptr(Register dst, Address src) { LP64_ONLY(subq(dst, src)) NOT_LP64(subl(dst, src)); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1866
  void subptr(Register dst, int32_t src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1867
  void subptr(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1868
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1869
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1870
  void sbbptr(Address dst, int32_t src) { LP64_ONLY(sbbq(dst, src)) NOT_LP64(sbbl(dst, src)); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1871
  void sbbptr(Register dst, int32_t src) { LP64_ONLY(sbbq(dst, src)) NOT_LP64(sbbl(dst, src)); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1872
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1873
  void xchgptr(Register src1, Register src2) { LP64_ONLY(xchgq(src1, src2)) NOT_LP64(xchgl(src1, src2)) ; }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1874
  void xchgptr(Register src1, Address src2) { LP64_ONLY(xchgq(src1, src2)) NOT_LP64(xchgl(src1, src2)) ; }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1875
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1876
  void xaddptr(Address src1, Register src2) { LP64_ONLY(xaddq(src1, src2)) NOT_LP64(xaddl(src1, src2)) ; }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1877
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1878
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1879
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1880
  // Helper functions for statistics gathering.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1881
  // Conditionally (atomically, on MPs) increments passed counter address, preserving condition codes.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1882
  void cond_inc32(Condition cond, AddressLiteral counter_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1883
  // Unconditional atomic increment.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1884
  void atomic_incl(AddressLiteral counter_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1885
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1886
  void lea(Register dst, AddressLiteral adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1887
  void lea(Address dst, AddressLiteral adr);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1888
  void lea(Register dst, Address adr) { Assembler::lea(dst, adr); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1889
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1890
  void leal32(Register dst, Address src) { leal(dst, src); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1891
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1892
  void test32(Register src1, AddressLiteral src2);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1893
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1894
  void orptr(Register dst, Address src) { LP64_ONLY(orq(dst, src)) NOT_LP64(orl(dst, src)); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1895
  void orptr(Register dst, Register src) { LP64_ONLY(orq(dst, src)) NOT_LP64(orl(dst, src)); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1896
  void orptr(Register dst, int32_t src) { LP64_ONLY(orq(dst, src)) NOT_LP64(orl(dst, src)); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1897
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1898
  void testptr(Register src, int32_t imm32) {  LP64_ONLY(testq(src, imm32)) NOT_LP64(testl(src, imm32)); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1899
  void testptr(Register src1, Register src2);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1900
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1901
  void xorptr(Register dst, Register src) { LP64_ONLY(xorq(dst, src)) NOT_LP64(xorl(dst, src)); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1902
  void xorptr(Register dst, Address src) { LP64_ONLY(xorq(dst, src)) NOT_LP64(xorl(dst, src)); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1903
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1904
  // Calls
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1905
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1906
  void call(Label& L, relocInfo::relocType rtype);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1907
  void call(Register entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1908
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1909
  // NOTE: this call tranfers to the effective address of entry NOT
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1910
  // the address contained by entry. This is because this is more natural
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1911
  // for jumps/calls.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1912
  void call(AddressLiteral entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1913
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1914
  // Jumps
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1915
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1916
  // NOTE: these jumps tranfer to the effective address of dst NOT
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1917
  // the address contained by dst. This is because this is more natural
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1918
  // for jumps/calls.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1919
  void jump(AddressLiteral dst);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1920
  void jump_cc(Condition cc, AddressLiteral dst);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1921
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1922
  // 32bit can do a case table jump in one instruction but we no longer allow the base
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1923
  // to be installed in the Address class. This jump will tranfers to the address
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1924
  // contained in the location described by entry (not the address of entry)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1925
  void jump(ArrayAddress entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1926
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1927
  // Floating
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1928
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1929
  void andpd(XMMRegister dst, Address src) { Assembler::andpd(dst, src); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1930
  void andpd(XMMRegister dst, AddressLiteral src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1931
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1932
  void comiss(XMMRegister dst, Address src) { Assembler::comiss(dst, src); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1933
  void comiss(XMMRegister dst, AddressLiteral src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1934
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1935
  void comisd(XMMRegister dst, Address src) { Assembler::comisd(dst, src); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1936
  void comisd(XMMRegister dst, AddressLiteral src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1937
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1938
  void fldcw(Address src) { Assembler::fldcw(src); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1939
  void fldcw(AddressLiteral src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1940
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1941
  void fld_s(int index)   { Assembler::fld_s(index); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1942
  void fld_s(Address src) { Assembler::fld_s(src); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1943
  void fld_s(AddressLiteral src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1944
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1945
  void fld_d(Address src) { Assembler::fld_d(src); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1946
  void fld_d(AddressLiteral src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1947
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1948
  void fld_x(Address src) { Assembler::fld_x(src); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1949
  void fld_x(AddressLiteral src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1950
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1951
  void ldmxcsr(Address src) { Assembler::ldmxcsr(src); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1952
  void ldmxcsr(AddressLiteral src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1953
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1954
private:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1955
  // these are private because users should be doing movflt/movdbl
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1956
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1957
  void movss(Address dst, XMMRegister src)     { Assembler::movss(dst, src); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1958
  void movss(XMMRegister dst, XMMRegister src) { Assembler::movss(dst, src); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1959
  void movss(XMMRegister dst, Address src)     { Assembler::movss(dst, src); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1960
  void movss(XMMRegister dst, AddressLiteral src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1961
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1962
  void movlpd(XMMRegister dst, Address src)      {Assembler::movlpd(dst, src); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1963
  void movlpd(XMMRegister dst, AddressLiteral src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1964
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1965
public:
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1966
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1967
  void movsd(XMMRegister dst, XMMRegister src) { Assembler::movsd(dst, src); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1968
  void movsd(Address dst, XMMRegister src)     { Assembler::movsd(dst, src); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1969
  void movsd(XMMRegister dst, Address src)     { Assembler::movsd(dst, src); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1970
  void movsd(XMMRegister dst, AddressLiteral src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1971
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1972
  void ucomiss(XMMRegister dst, XMMRegister src) { Assembler::ucomiss(dst, src); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1973
  void ucomiss(XMMRegister dst, Address src) { Assembler::ucomiss(dst, src); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1974
  void ucomiss(XMMRegister dst, AddressLiteral src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1975
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1976
  void ucomisd(XMMRegister dst, XMMRegister src) { Assembler::ucomisd(dst, src); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1977
  void ucomisd(XMMRegister dst, Address src) { Assembler::ucomisd(dst, src); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1978
  void ucomisd(XMMRegister dst, AddressLiteral src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1979
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1980
  // Bitwise Logical XOR of Packed Double-Precision Floating-Point Values
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1981
  void xorpd(XMMRegister dst, XMMRegister src) { Assembler::xorpd(dst, src); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1982
  void xorpd(XMMRegister dst, Address src)     { Assembler::xorpd(dst, src); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1983
  void xorpd(XMMRegister dst, AddressLiteral src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1984
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1985
  // Bitwise Logical XOR of Packed Single-Precision Floating-Point Values
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1986
  void xorps(XMMRegister dst, XMMRegister src) { Assembler::xorps(dst, src); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1987
  void xorps(XMMRegister dst, Address src)     { Assembler::xorps(dst, src); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1988
  void xorps(XMMRegister dst, AddressLiteral src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1989
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1990
  // Data
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1991
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1992
  void cmov(Condition cc, Register dst, Register src) { LP64_ONLY(cmovq(cc, dst, src)) NOT_LP64(cmovl(cc, dst, src)); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1993
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1994
  void cmovptr(Condition cc, Register dst, Address src) { LP64_ONLY(cmovq(cc, dst, src)) NOT_LP64(cmovl(cc, dst, src)); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1995
  void cmovptr(Condition cc, Register dst, Register src) { LP64_ONLY(cmovq(cc, dst, src)) NOT_LP64(cmovl(cc, dst, src)); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  1996
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1997
  void movoop(Register dst, jobject obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1998
  void movoop(Address dst, jobject obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1999
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2000
  void movptr(ArrayAddress dst, Register src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2001
  // can this do an lea?
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2002
  void movptr(Register dst, ArrayAddress src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2003
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2004
  void movptr(Register dst, Address src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2005
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2006
  void movptr(Register dst, AddressLiteral src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2007
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2008
  void movptr(Register dst, intptr_t src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2009
  void movptr(Register dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2010
  void movptr(Address dst, intptr_t src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2011
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2012
  void movptr(Address dst, Register src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2013
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2014
#ifdef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2015
  // Generally the next two are only used for moving NULL
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2016
  // Although there are situations in initializing the mark word where
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2017
  // they could be used. They are dangerous.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2018
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2019
  // They only exist on LP64 so that int32_t and intptr_t are not the same
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2020
  // and we have ambiguous declarations.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2021
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2022
  void movptr(Address dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2023
  void movptr(Register dst, int32_t imm32);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2024
#endif // _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2025
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2026
  // to avoid hiding movl
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2027
  void mov32(AddressLiteral dst, Register src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2028
  void mov32(Register dst, AddressLiteral src);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2029
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2030
  // to avoid hiding movb
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2031
  void movbyte(ArrayAddress dst, int src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2032
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2033
  // Can push value or effective address
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2034
  void pushptr(AddressLiteral src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2035
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2036
  void pushptr(Address src) { LP64_ONLY(pushq(src)) NOT_LP64(pushl(src)); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2037
  void popptr(Address src) { LP64_ONLY(popq(src)) NOT_LP64(popl(src)); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2038
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2039
  void pushoop(jobject obj);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2040
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2041
  // sign extend as need a l to ptr sized element
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2042
  void movl2ptr(Register dst, Address src) { LP64_ONLY(movslq(dst, src)) NOT_LP64(movl(dst, src)); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2043
  void movl2ptr(Register dst, Register src) { LP64_ONLY(movslq(dst, src)) NOT_LP64(if (dst != src) movl(dst, src)); }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2044
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
  2045
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2046
#undef VIRTUAL
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2047
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2048
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2049
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2050
/**
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2051
 * class SkipIfEqual:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2052
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2053
 * Instantiating this class will result in assembly code being output that will
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2054
 * jump around any code emitted between the creation of the instance and it's
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2055
 * automatic destruction at the end of a scope block, depending on the value of
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2056
 * the flag passed to the constructor, which will be checked at run-time.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2057
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2058
class SkipIfEqual {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2059
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2060
  MacroAssembler* _masm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2061
  Label _label;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2062
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2063
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2064
   SkipIfEqual(MacroAssembler*, const bool* flag_addr, bool value);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2065
   ~SkipIfEqual();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2066
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2067
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2068
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2069
inline bool AbstractAssembler::pd_check_instruction_mark() { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2070
#endif