src/hotspot/cpu/sparc/macroAssembler_sparc.inline.hpp
author erikj
Tue, 12 Sep 2017 19:03:39 +0200
changeset 47216 71c04702a3d5
parent 46596 hotspot/src/cpu/sparc/vm/macroAssembler_sparc.inline.hpp@a7c9706d25a9
child 47561 f59f0e51ef8a
permissions -rw-r--r--
8187443: Forest Consolidation: Move files to unified layout Reviewed-by: darcy, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
     1
/*
46381
020219e46c86 8150388: Remove SPARC 32-bit support
gtriantafill
parents: 35090
diff changeset
     2
 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
     4
 *
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
     7
 * published by the Free Software Foundation.
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
     8
 *
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    13
 * accompanied this code).
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    14
 *
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    18
 *
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    21
 * questions.
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    22
 *
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    23
 */
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    24
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    25
#ifndef CPU_SPARC_VM_MACROASSEMBLER_SPARC_INLINE_HPP
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    26
#define CPU_SPARC_VM_MACROASSEMBLER_SPARC_INLINE_HPP
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    27
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    28
#include "asm/assembler.inline.hpp"
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    29
#include "asm/macroAssembler.hpp"
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    30
#include "asm/codeBuffer.hpp"
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    31
#include "code/codeCache.hpp"
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    32
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    33
inline bool Address::is_simm13(int offset) { return Assembler::is_simm13(disp() + offset); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    34
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    35
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    36
inline int AddressLiteral::low10() const {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    37
  return Assembler::low10(value());
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    38
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    39
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    40
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    41
inline void MacroAssembler::pd_patch_instruction(address branch, address target) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    42
  jint& stub_inst = *(jint*) branch;
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    43
  stub_inst = patched_branch(target - branch, stub_inst, 0);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    44
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    45
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    46
// Use the right loads/stores for the platform
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    47
inline void MacroAssembler::ld_ptr( Register s1, Register s2, Register d ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    48
  Assembler::ldx(s1, s2, d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    49
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    50
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    51
inline void MacroAssembler::ld_ptr( Register s1, int simm13a, Register d ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    52
  Assembler::ldx(s1, simm13a, d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    53
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    54
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    55
#ifdef ASSERT
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    56
// ByteSize is only a class when ASSERT is defined, otherwise it's an int.
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    57
inline void MacroAssembler::ld_ptr( Register s1, ByteSize simm13a, Register d ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    58
  ld_ptr(s1, in_bytes(simm13a), d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    59
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    60
#endif
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    61
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    62
inline void MacroAssembler::ld_ptr( Register s1, RegisterOrConstant s2, Register d ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    63
  ldx(s1, s2, d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    64
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    65
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    66
inline void MacroAssembler::ld_ptr(const Address& a, Register d, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    67
  ldx(a, d, offset);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    68
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    69
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    70
inline void MacroAssembler::st_ptr( Register d, Register s1, Register s2 ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    71
  Assembler::stx(d, s1, s2);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    72
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    73
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    74
inline void MacroAssembler::st_ptr( Register d, Register s1, int simm13a ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    75
  Assembler::stx(d, s1, simm13a);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    76
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    77
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    78
#ifdef ASSERT
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    79
// ByteSize is only a class when ASSERT is defined, otherwise it's an int.
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    80
inline void MacroAssembler::st_ptr( Register d, Register s1, ByteSize simm13a ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    81
  st_ptr(d, s1, in_bytes(simm13a));
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    82
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    83
#endif
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    84
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    85
inline void MacroAssembler::st_ptr( Register d, Register s1, RegisterOrConstant s2 ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    86
  stx(d, s1, s2);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    87
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    88
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    89
inline void MacroAssembler::st_ptr(Register d, const Address& a, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    90
  stx(d, a, offset);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    91
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    92
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    93
// Use the right loads/stores for the platform
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    94
inline void MacroAssembler::ld_long( Register s1, Register s2, Register d ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    95
  Assembler::ldx(s1, s2, d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    96
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    97
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    98
inline void MacroAssembler::ld_long( Register s1, int simm13a, Register d ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
    99
  Assembler::ldx(s1, simm13a, d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   100
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   101
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   102
inline void MacroAssembler::ld_long( Register s1, RegisterOrConstant s2, Register d ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   103
  ldx(s1, s2, d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   104
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   105
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   106
inline void MacroAssembler::ld_long(const Address& a, Register d, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   107
  ldx(a, d, offset);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   108
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   109
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   110
inline void MacroAssembler::st_long( Register d, Register s1, Register s2 ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   111
  Assembler::stx(d, s1, s2);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   112
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   113
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   114
inline void MacroAssembler::st_long( Register d, Register s1, int simm13a ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   115
  Assembler::stx(d, s1, simm13a);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   116
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   117
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   118
inline void MacroAssembler::st_long( Register d, Register s1, RegisterOrConstant s2 ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   119
  stx(d, s1, s2);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   120
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   121
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   122
inline void MacroAssembler::st_long( Register d, const Address& a, int offset ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   123
  stx(d, a, offset);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   124
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   125
35090
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   126
inline void MacroAssembler::stbool(Register d, const Address& a) { stb(d, a); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   127
inline void MacroAssembler::ldbool(const Address& a, Register d) { ldub(a, d); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   128
inline void MacroAssembler::movbool( bool boolconst, Register d) { mov( (int) boolconst, d); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   129
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   130
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   131
inline void MacroAssembler::signx( Register s, Register d ) { sra( s, G0, d); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   132
inline void MacroAssembler::signx( Register d )             { sra( d, G0, d); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   133
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   134
inline void MacroAssembler::not1( Register s, Register d ) { xnor( s, G0, d ); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   135
inline void MacroAssembler::not1( Register d )             { xnor( d, G0, d ); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   136
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   137
inline void MacroAssembler::neg( Register s, Register d ) { sub( G0, s, d ); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   138
inline void MacroAssembler::neg( Register d )             { sub( G0, d, d ); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   139
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   140
inline void MacroAssembler::cas(  Register s1, Register s2, Register d) { casa( s1, s2, d, ASI_PRIMARY); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   141
inline void MacroAssembler::casx( Register s1, Register s2, Register d) { casxa(s1, s2, d, ASI_PRIMARY); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   142
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   143
// Functions for isolating 64 bit atomic swaps for LP64
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   144
// cas_ptr will perform cas for 32 bit VM's and casx for 64 bit VM's
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   145
inline void MacroAssembler::cas_ptr(  Register s1, Register s2, Register d) {
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   146
  casx( s1, s2, d );
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   147
}
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   148
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   149
// Functions for isolating 64 bit shifts for LP64
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   150
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   151
inline void MacroAssembler::sll_ptr( Register s1, Register s2, Register d ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   152
  Assembler::sllx(s1, s2, d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   153
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   154
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   155
inline void MacroAssembler::sll_ptr( Register s1, int imm6a,   Register d ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   156
  Assembler::sllx(s1, imm6a, d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   157
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   158
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   159
inline void MacroAssembler::srl_ptr( Register s1, Register s2, Register d ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   160
  Assembler::srlx(s1, s2, d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   161
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   162
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   163
inline void MacroAssembler::srl_ptr( Register s1, int imm6a,   Register d ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   164
  Assembler::srlx(s1, imm6a, d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   165
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   166
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   167
inline void MacroAssembler::sll_ptr( Register s1, RegisterOrConstant s2, Register d ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   168
  if (s2.is_register())  sll_ptr(s1, s2.as_register(), d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   169
  else                   sll_ptr(s1, s2.as_constant(), d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   170
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   171
35090
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   172
inline void MacroAssembler::casl(  Register s1, Register s2, Register d) { casa( s1, s2, d, ASI_PRIMARY_LITTLE); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   173
inline void MacroAssembler::casxl( Register s1, Register s2, Register d) { casxa(s1, s2, d, ASI_PRIMARY_LITTLE); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   174
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   175
inline void MacroAssembler::inc(   Register d,  int const13 ) { add(   d, const13, d); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   176
inline void MacroAssembler::inccc( Register d,  int const13 ) { addcc( d, const13, d); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   177
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   178
inline void MacroAssembler::dec(   Register d,  int const13 ) { sub(   d, const13, d); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   179
inline void MacroAssembler::deccc( Register d,  int const13 ) { subcc( d, const13, d); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   180
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   181
// Use the right branch for the platform
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   182
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   183
inline void MacroAssembler::br( Condition c, bool a, Predict p, address d, relocInfo::relocType rt ) {
18097
acd70736bd60 8008407: remove SPARC V8 support
morris
parents: 14827
diff changeset
   184
  Assembler::bp(c, a, icc, p, d, rt);
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   185
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   186
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   187
inline void MacroAssembler::br( Condition c, bool a, Predict p, Label& L ) {
46596
a7c9706d25a9 8144448: Avoid placing CTI immediately following or preceding RDPC instruction
neliasso
parents: 46381
diff changeset
   188
  // See note[+] on 'avoid_pipeline_stalls()', in "assembler_sparc.inline.hpp".
a7c9706d25a9 8144448: Avoid placing CTI immediately following or preceding RDPC instruction
neliasso
parents: 46381
diff changeset
   189
  avoid_pipeline_stall();
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   190
  br(c, a, p, target(L));
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   191
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   192
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   193
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   194
// Branch that tests either xcc or icc depending on the
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   195
// architecture compiled (LP64 or not)
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   196
inline void MacroAssembler::brx( Condition c, bool a, Predict p, address d, relocInfo::relocType rt ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   197
    Assembler::bp(c, a, xcc, p, d, rt);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   198
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   199
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   200
inline void MacroAssembler::brx( Condition c, bool a, Predict p, Label& L ) {
46596
a7c9706d25a9 8144448: Avoid placing CTI immediately following or preceding RDPC instruction
neliasso
parents: 46381
diff changeset
   201
  avoid_pipeline_stall();
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   202
  brx(c, a, p, target(L));
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   203
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   204
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   205
inline void MacroAssembler::ba( Label& L ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   206
  br(always, false, pt, L);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   207
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   208
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   209
// Warning: V9 only functions
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   210
inline void MacroAssembler::bp( Condition c, bool a, CC cc, Predict p, address d, relocInfo::relocType rt ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   211
  Assembler::bp(c, a, cc, p, d, rt);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   212
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   213
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   214
inline void MacroAssembler::bp( Condition c, bool a, CC cc, Predict p, Label& L ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   215
  Assembler::bp(c, a, cc, p, L);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   216
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   217
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   218
inline void MacroAssembler::fb( Condition c, bool a, Predict p, address d, relocInfo::relocType rt ) {
18097
acd70736bd60 8008407: remove SPARC V8 support
morris
parents: 14827
diff changeset
   219
  fbp(c, a, fcc0, p, d, rt);
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   220
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   221
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   222
inline void MacroAssembler::fb( Condition c, bool a, Predict p, Label& L ) {
46596
a7c9706d25a9 8144448: Avoid placing CTI immediately following or preceding RDPC instruction
neliasso
parents: 46381
diff changeset
   223
  avoid_pipeline_stall();
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   224
  fb(c, a, p, target(L));
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   225
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   226
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   227
inline void MacroAssembler::fbp( Condition c, bool a, CC cc, Predict p, address d, relocInfo::relocType rt ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   228
  Assembler::fbp(c, a, cc, p, d, rt);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   229
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   230
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   231
inline void MacroAssembler::fbp( Condition c, bool a, CC cc, Predict p, Label& L ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   232
  Assembler::fbp(c, a, cc, p, L);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   233
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   234
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   235
inline void MacroAssembler::jmp( Register s1, Register s2 ) { jmpl( s1, s2, G0 ); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   236
inline void MacroAssembler::jmp( Register s1, int simm13a, RelocationHolder const& rspec ) { jmpl( s1, simm13a, G0, rspec); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   237
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   238
inline bool MacroAssembler::is_far_target(address d) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   239
  if (ForceUnreachable) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   240
    // References outside the code cache should be treated as far
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   241
    return d < CodeCache::low_bound() || d > CodeCache::high_bound();
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   242
  }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   243
  return !is_in_wdisp30_range(d, CodeCache::low_bound()) || !is_in_wdisp30_range(d, CodeCache::high_bound());
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   244
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   245
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   246
// Call with a check to see if we need to deal with the added
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   247
// expense of relocation and if we overflow the displacement
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   248
// of the quick call instruction.
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   249
inline void MacroAssembler::call( address d, relocInfo::relocType rt ) {
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 28915
diff changeset
   250
  MacroAssembler::call(d, Relocation::spec_simple(rt));
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 28915
diff changeset
   251
}
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 28915
diff changeset
   252
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 28915
diff changeset
   253
inline void MacroAssembler::call( address d, RelocationHolder const& rspec ) {
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   254
  intptr_t disp;
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   255
  // NULL is ok because it will be relocated later.
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   256
  // Must change NULL to a reachable address in order to
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   257
  // pass asserts here and in wdisp.
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   258
  if ( d == NULL )
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   259
    d = pc();
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   260
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   261
  // Is this address within range of the call instruction?
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   262
  // If not, use the expensive instruction sequence
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   263
  if (is_far_target(d)) {
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 28915
diff changeset
   264
    relocate(rspec);
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   265
    AddressLiteral dest(d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   266
    jumpl_to(dest, O7, O7);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   267
  } else {
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 28915
diff changeset
   268
    Assembler::call(d, rspec);
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   269
  }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   270
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   271
46596
a7c9706d25a9 8144448: Avoid placing CTI immediately following or preceding RDPC instruction
neliasso
parents: 46381
diff changeset
   272
inline void MacroAssembler::call( Label& L, relocInfo::relocType rt ) {
a7c9706d25a9 8144448: Avoid placing CTI immediately following or preceding RDPC instruction
neliasso
parents: 46381
diff changeset
   273
  avoid_pipeline_stall();
a7c9706d25a9 8144448: Avoid placing CTI immediately following or preceding RDPC instruction
neliasso
parents: 46381
diff changeset
   274
  MacroAssembler::call(target(L), rt);
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   275
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   276
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   277
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   278
inline void MacroAssembler::callr( Register s1, Register s2 ) { jmpl( s1, s2, O7 ); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   279
inline void MacroAssembler::callr( Register s1, int simm13a, RelocationHolder const& rspec ) { jmpl( s1, simm13a, O7, rspec); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   280
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   281
// prefetch instruction
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   282
inline void MacroAssembler::iprefetch( address d, relocInfo::relocType rt ) {
18097
acd70736bd60 8008407: remove SPARC V8 support
morris
parents: 14827
diff changeset
   283
  Assembler::bp( never, true, xcc, pt, d, rt );
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   284
    Assembler::bp( never, true, xcc, pt, d, rt );
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   285
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   286
inline void MacroAssembler::iprefetch( Label& L) { iprefetch( target(L) ); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   287
35090
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   288
inline void MacroAssembler::tst( Register s ) { orcc( G0, s, G0 ); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   289
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   290
inline void MacroAssembler::ret( bool trace ) {
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   291
  if (trace) {
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   292
    mov(I7, O7); // traceable register
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   293
    JMP(O7, 2 * BytesPerInstWord);
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   294
  } else {
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   295
    jmpl( I7, 2 * BytesPerInstWord, G0 );
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   296
  }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   297
}
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   298
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   299
inline void MacroAssembler::retl( bool trace ) {
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   300
  if (trace) {
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   301
    JMP(O7, 2 * BytesPerInstWord);
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   302
  } else {
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   303
    jmpl( O7, 2 * BytesPerInstWord, G0 );
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   304
  }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   305
}
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   306
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   307
35090
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   308
inline void MacroAssembler::cmp(  Register s1, Register s2 ) { subcc( s1, s2, G0 ); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   309
inline void MacroAssembler::cmp(  Register s1, int simm13a ) { subcc( s1, simm13a, G0 ); }
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   310
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   311
// Note:  All MacroAssembler::set_foo functions are defined out-of-line.
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   312
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   313
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   314
// Loads the current PC of the following instruction as an immediate value in
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   315
// 2 instructions.  All PCs in the CodeCache are within 2 Gig of each other.
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   316
inline intptr_t MacroAssembler::load_pc_address( Register reg, int bytes_to_skip ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   317
  intptr_t thepc = (intptr_t)pc() + 2*BytesPerInstWord + bytes_to_skip;
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   318
  Unimplemented();
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   319
  return thepc;
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   320
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   321
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   322
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   323
inline void MacroAssembler::load_contents(const AddressLiteral& addrlit, Register d, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   324
  assert_not_delayed();
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   325
  if (ForceUnreachable) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   326
    patchable_sethi(addrlit, d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   327
  } else {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   328
    sethi(addrlit, d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   329
  }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   330
  ld(d, addrlit.low10() + offset, d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   331
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   332
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   333
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   334
inline void MacroAssembler::load_bool_contents(const AddressLiteral& addrlit, Register d, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   335
  assert_not_delayed();
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   336
  if (ForceUnreachable) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   337
    patchable_sethi(addrlit, d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   338
  } else {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   339
    sethi(addrlit, d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   340
  }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   341
  ldub(d, addrlit.low10() + offset, d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   342
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   343
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   344
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   345
inline void MacroAssembler::load_ptr_contents(const AddressLiteral& addrlit, Register d, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   346
  assert_not_delayed();
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   347
  if (ForceUnreachable) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   348
    patchable_sethi(addrlit, d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   349
  } else {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   350
    sethi(addrlit, d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   351
  }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   352
  ld_ptr(d, addrlit.low10() + offset, d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   353
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   354
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   355
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   356
inline void MacroAssembler::store_contents(Register s, const AddressLiteral& addrlit, Register temp, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   357
  assert_not_delayed();
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   358
  if (ForceUnreachable) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   359
    patchable_sethi(addrlit, temp);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   360
  } else {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   361
    sethi(addrlit, temp);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   362
  }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   363
  st(s, temp, addrlit.low10() + offset);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   364
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   365
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   366
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   367
inline void MacroAssembler::store_ptr_contents(Register s, const AddressLiteral& addrlit, Register temp, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   368
  assert_not_delayed();
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   369
  if (ForceUnreachable) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   370
    patchable_sethi(addrlit, temp);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   371
  } else {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   372
    sethi(addrlit, temp);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   373
  }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   374
  st_ptr(s, temp, addrlit.low10() + offset);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   375
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   376
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   377
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   378
// This code sequence is relocatable to any address, even on LP64.
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   379
inline void MacroAssembler::jumpl_to(const AddressLiteral& addrlit, Register temp, Register d, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   380
  assert_not_delayed();
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   381
  // Force fixed length sethi because NativeJump and NativeFarCall don't handle
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   382
  // variable length instruction streams.
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   383
  patchable_sethi(addrlit, temp);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   384
  jmpl(temp, addrlit.low10() + offset, d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   385
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   386
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   387
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   388
inline void MacroAssembler::jump_to(const AddressLiteral& addrlit, Register temp, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   389
  jumpl_to(addrlit, temp, G0, offset);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   390
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   391
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   392
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   393
inline void MacroAssembler::jump_indirect_to(Address& a, Register temp,
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   394
                                             int ld_offset, int jmp_offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   395
  assert_not_delayed();
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   396
  //sethi(al);                   // sethi is caller responsibility for this one
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   397
  ld_ptr(a, temp, ld_offset);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   398
  jmp(temp, jmp_offset);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   399
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   400
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   401
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   402
inline void MacroAssembler::set_metadata(Metadata* obj, Register d) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   403
  set_metadata(allocate_metadata_address(obj), d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   404
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   405
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   406
inline void MacroAssembler::set_metadata_constant(Metadata* obj, Register d) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   407
  set_metadata(constant_metadata_address(obj), d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   408
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   409
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   410
inline void MacroAssembler::set_metadata(const AddressLiteral& obj_addr, Register d) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   411
  assert(obj_addr.rspec().type() == relocInfo::metadata_type, "must be a metadata reloc");
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   412
  set(obj_addr, d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   413
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   414
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   415
inline void MacroAssembler::set_oop(jobject obj, Register d) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   416
  set_oop(allocate_oop_address(obj), d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   417
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   418
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   419
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   420
inline void MacroAssembler::set_oop_constant(jobject obj, Register d) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   421
  set_oop(constant_oop_address(obj), d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   422
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   423
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   424
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   425
inline void MacroAssembler::set_oop(const AddressLiteral& obj_addr, Register d) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   426
  assert(obj_addr.rspec().type() == relocInfo::oop_type, "must be an oop reloc");
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   427
  set(obj_addr, d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   428
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   429
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   430
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   431
inline void MacroAssembler::load_argument( Argument& a, Register  d ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   432
  if (a.is_register())
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   433
    mov(a.as_register(), d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   434
  else
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   435
    ld (a.as_address(),  d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   436
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   437
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   438
inline void MacroAssembler::store_argument( Register s, Argument& a ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   439
  if (a.is_register())
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   440
    mov(s, a.as_register());
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   441
  else
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   442
    st_ptr (s, a.as_address());         // ABI says everything is right justified.
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   443
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   444
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   445
inline void MacroAssembler::store_ptr_argument( Register s, Argument& a ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   446
  if (a.is_register())
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   447
    mov(s, a.as_register());
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   448
  else
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   449
    st_ptr (s, a.as_address());
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   450
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   451
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   452
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   453
inline void MacroAssembler::store_float_argument( FloatRegister s, Argument& a ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   454
  if (a.is_float_register())
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   455
// V9 ABI has F1, F3, F5 are used to pass instead of O0, O1, O2
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   456
    fmov(FloatRegisterImpl::S, s, a.as_float_register() );
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   457
  else
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   458
    // Floats are stored in the high half of the stack entry
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   459
    // The low half is undefined per the ABI.
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   460
    stf(FloatRegisterImpl::S, s, a.as_address(), sizeof(jfloat));
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   461
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   462
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   463
inline void MacroAssembler::store_double_argument( FloatRegister s, Argument& a ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   464
  if (a.is_float_register())
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   465
// V9 ABI has D0, D2, D4 are used to pass instead of O0, O1, O2
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   466
    fmov(FloatRegisterImpl::D, s, a.as_double_register() );
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   467
  else
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   468
    stf(FloatRegisterImpl::D, s, a.as_address());
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   469
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   470
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   471
inline void MacroAssembler::store_long_argument( Register s, Argument& a ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   472
  if (a.is_register())
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   473
    mov(s, a.as_register());
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   474
  else
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   475
    stx(s, a.as_address());
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   476
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   477
35090
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   478
inline void MacroAssembler::round_to( Register r, int modulus ) {
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   479
  assert_not_delayed();
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   480
  inc( r, modulus - 1 );
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   481
  and3( r, -modulus, r );
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   482
}
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   483
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   484
inline void MacroAssembler::add(Register s1, int simm13a, Register d, relocInfo::relocType rtype) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   485
  relocate(rtype);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   486
  add(s1, simm13a, d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   487
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   488
inline void MacroAssembler::add(Register s1, int simm13a, Register d, RelocationHolder const& rspec) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   489
  relocate(rspec);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   490
  add(s1, simm13a, d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   491
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   492
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   493
// form effective addresses this way:
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   494
inline void MacroAssembler::add(const Address& a, Register d, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   495
  if (a.has_index())   add(a.base(), a.index(),         d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   496
  else               { add(a.base(), a.disp() + offset, d, a.rspec(offset)); offset = 0; }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   497
  if (offset != 0)     add(d,        offset,            d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   498
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   499
inline void MacroAssembler::add(Register s1, RegisterOrConstant s2, Register d, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   500
  if (s2.is_register())  add(s1, s2.as_register(),          d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   501
  else                 { add(s1, s2.as_constant() + offset, d); offset = 0; }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   502
  if (offset != 0)       add(d,  offset,                    d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   503
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   504
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   505
inline void MacroAssembler::andn(Register s1, RegisterOrConstant s2, Register d) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   506
  if (s2.is_register())  andn(s1, s2.as_register(), d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   507
  else                   andn(s1, s2.as_constant(), d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   508
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   509
35090
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   510
inline void MacroAssembler::btst( Register s1,  Register s2 ) { andcc( s1, s2, G0 ); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   511
inline void MacroAssembler::btst( int simm13a,  Register s )  { andcc( s,  simm13a, G0 ); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   512
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   513
inline void MacroAssembler::bset( Register s1,  Register s2 ) { or3( s1, s2, s2 ); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   514
inline void MacroAssembler::bset( int simm13a,  Register s )  { or3( s,  simm13a, s ); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   515
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   516
inline void MacroAssembler::bclr( Register s1,  Register s2 ) { andn( s1, s2, s2 ); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   517
inline void MacroAssembler::bclr( int simm13a,  Register s )  { andn( s,  simm13a, s ); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   518
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   519
inline void MacroAssembler::btog( Register s1,  Register s2 ) { xor3( s1, s2, s2 ); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   520
inline void MacroAssembler::btog( int simm13a,  Register s )  { xor3( s,  simm13a, s ); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   521
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   522
inline void MacroAssembler::clr( Register d ) { or3( G0, G0, d ); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   523
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   524
inline void MacroAssembler::clrb( Register s1, Register s2) { stb( G0, s1, s2 ); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   525
inline void MacroAssembler::clrh( Register s1, Register s2) { sth( G0, s1, s2 ); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   526
inline void MacroAssembler::clr(  Register s1, Register s2) { stw( G0, s1, s2 ); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   527
inline void MacroAssembler::clrx( Register s1, Register s2) { stx( G0, s1, s2 ); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   528
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   529
inline void MacroAssembler::clrb( Register s1, int simm13a) { stb( G0, s1, simm13a); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   530
inline void MacroAssembler::clrh( Register s1, int simm13a) { sth( G0, s1, simm13a); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   531
inline void MacroAssembler::clr(  Register s1, int simm13a) { stw( G0, s1, simm13a); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   532
inline void MacroAssembler::clrx( Register s1, int simm13a) { stx( G0, s1, simm13a); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   533
35090
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   534
inline void MacroAssembler::clruw( Register s, Register d ) { srl( s, G0, d); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   535
inline void MacroAssembler::clruwu( Register d ) { srl( d, G0, d); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   536
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   537
// Make all 32 bit loads signed so 64 bit registers maintain proper sign
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   538
inline void MacroAssembler::ld(  Register s1, Register s2, Register d)      { ldsw( s1, s2, d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   539
inline void MacroAssembler::ld(  Register s1, int simm13a, Register d)      { ldsw( s1, simm13a, d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   540
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   541
#ifdef ASSERT
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   542
  // ByteSize is only a class when ASSERT is defined, otherwise it's an int.
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   543
inline void MacroAssembler::ld(Register s1, ByteSize simm13a, Register d) { ldsw( s1, in_bytes(simm13a), d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   544
#endif
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   545
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   546
inline void MacroAssembler::ld(  const Address& a, Register d, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   547
  if (a.has_index()) { assert(offset == 0, ""); ld(  a.base(), a.index(),         d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   548
  else               {                          ld(  a.base(), a.disp() + offset, d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   549
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   550
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   551
inline void MacroAssembler::ldsb(const Address& a, Register d, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   552
  if (a.has_index()) { assert(offset == 0, ""); ldsb(a.base(), a.index(),         d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   553
  else               {                          ldsb(a.base(), a.disp() + offset, d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   554
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   555
inline void MacroAssembler::ldsh(const Address& a, Register d, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   556
  if (a.has_index()) { assert(offset == 0, ""); ldsh(a.base(), a.index(),         d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   557
  else               {                          ldsh(a.base(), a.disp() + offset, d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   558
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   559
inline void MacroAssembler::ldsw(const Address& a, Register d, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   560
  if (a.has_index()) { assert(offset == 0, ""); ldsw(a.base(), a.index(),         d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   561
  else               {                          ldsw(a.base(), a.disp() + offset, d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   562
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   563
inline void MacroAssembler::ldub(const Address& a, Register d, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   564
  if (a.has_index()) { assert(offset == 0, ""); ldub(a.base(), a.index(),         d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   565
  else               {                          ldub(a.base(), a.disp() + offset, d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   566
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   567
inline void MacroAssembler::lduh(const Address& a, Register d, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   568
  if (a.has_index()) { assert(offset == 0, ""); lduh(a.base(), a.index(),         d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   569
  else               {                          lduh(a.base(), a.disp() + offset, d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   570
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   571
inline void MacroAssembler::lduw(const Address& a, Register d, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   572
  if (a.has_index()) { assert(offset == 0, ""); lduw(a.base(), a.index(),         d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   573
  else               {                          lduw(a.base(), a.disp() + offset, d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   574
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   575
inline void MacroAssembler::ldd( const Address& a, Register d, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   576
  if (a.has_index()) { assert(offset == 0, ""); ldd( a.base(), a.index(),         d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   577
  else               {                          ldd( a.base(), a.disp() + offset, d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   578
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   579
inline void MacroAssembler::ldx( const Address& a, Register d, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   580
  if (a.has_index()) { assert(offset == 0, ""); ldx( a.base(), a.index(),         d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   581
  else               {                          ldx( a.base(), a.disp() + offset, d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   582
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   583
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   584
inline void MacroAssembler::ldub(Register s1, RegisterOrConstant s2, Register d) { ldub(Address(s1, s2), d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   585
inline void MacroAssembler::ldsb(Register s1, RegisterOrConstant s2, Register d) { ldsb(Address(s1, s2), d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   586
inline void MacroAssembler::lduh(Register s1, RegisterOrConstant s2, Register d) { lduh(Address(s1, s2), d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   587
inline void MacroAssembler::ldsh(Register s1, RegisterOrConstant s2, Register d) { ldsh(Address(s1, s2), d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   588
inline void MacroAssembler::lduw(Register s1, RegisterOrConstant s2, Register d) { lduw(Address(s1, s2), d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   589
inline void MacroAssembler::ldsw(Register s1, RegisterOrConstant s2, Register d) { ldsw(Address(s1, s2), d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   590
inline void MacroAssembler::ldx( Register s1, RegisterOrConstant s2, Register d) { ldx( Address(s1, s2), d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   591
inline void MacroAssembler::ld(  Register s1, RegisterOrConstant s2, Register d) { ld(  Address(s1, s2), d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   592
inline void MacroAssembler::ldd( Register s1, RegisterOrConstant s2, Register d) { ldd( Address(s1, s2), d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   593
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   594
inline void MacroAssembler::ldf(FloatRegisterImpl::Width w, Register s1, RegisterOrConstant s2, FloatRegister d) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   595
  if (s2.is_register())  ldf(w, s1, s2.as_register(), d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   596
  else                   ldf(w, s1, s2.as_constant(), d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   597
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   598
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   599
inline void MacroAssembler::ldf(FloatRegisterImpl::Width w, const Address& a, FloatRegister d, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   600
  relocate(a.rspec(offset));
28915
66ed75a5c945 8071818: Incorrect addressing mode used for ldf in SPARC assembler
zmajo
parents: 24008
diff changeset
   601
  if (a.has_index()) {
66ed75a5c945 8071818: Incorrect addressing mode used for ldf in SPARC assembler
zmajo
parents: 24008
diff changeset
   602
    assert(offset == 0, "");
66ed75a5c945 8071818: Incorrect addressing mode used for ldf in SPARC assembler
zmajo
parents: 24008
diff changeset
   603
    ldf(w, a.base(), a.index(), d);
66ed75a5c945 8071818: Incorrect addressing mode used for ldf in SPARC assembler
zmajo
parents: 24008
diff changeset
   604
  } else {
66ed75a5c945 8071818: Incorrect addressing mode used for ldf in SPARC assembler
zmajo
parents: 24008
diff changeset
   605
    ldf(w, a.base(), a.disp() + offset, d);
66ed75a5c945 8071818: Incorrect addressing mode used for ldf in SPARC assembler
zmajo
parents: 24008
diff changeset
   606
  }
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   607
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   608
35090
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   609
inline void MacroAssembler::lduwl(Register s1, Register s2, Register d) { lduwa(s1, s2, ASI_PRIMARY_LITTLE, d); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   610
inline void MacroAssembler::ldswl(Register s1, Register s2, Register d) { ldswa(s1, s2, ASI_PRIMARY_LITTLE, d);}
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   611
inline void MacroAssembler::ldxl( Register s1, Register s2, Register d) { ldxa(s1, s2, ASI_PRIMARY_LITTLE, d); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   612
inline void MacroAssembler::ldfl(FloatRegisterImpl::Width w, Register s1, Register s2, FloatRegister d) { ldfa(w, s1, s2, ASI_PRIMARY_LITTLE, d); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   613
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   614
// returns if membar generates anything, obviously this code should mirror
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   615
// membar below.
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   616
inline bool MacroAssembler::membar_has_effect( Membar_mask_bits const7a ) {
18097
acd70736bd60 8008407: remove SPARC V8 support
morris
parents: 14827
diff changeset
   617
  if (!os::is_MP())
acd70736bd60 8008407: remove SPARC V8 support
morris
parents: 14827
diff changeset
   618
    return false;  // Not needed on single CPU
acd70736bd60 8008407: remove SPARC V8 support
morris
parents: 14827
diff changeset
   619
  const Membar_mask_bits effective_mask =
acd70736bd60 8008407: remove SPARC V8 support
morris
parents: 14827
diff changeset
   620
      Membar_mask_bits(const7a & ~(LoadLoad | LoadStore | StoreStore));
acd70736bd60 8008407: remove SPARC V8 support
morris
parents: 14827
diff changeset
   621
  return (effective_mask != 0);
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   622
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   623
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   624
inline void MacroAssembler::membar( Membar_mask_bits const7a ) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   625
  // Uniprocessors do not need memory barriers
18097
acd70736bd60 8008407: remove SPARC V8 support
morris
parents: 14827
diff changeset
   626
  if (!os::is_MP())
acd70736bd60 8008407: remove SPARC V8 support
morris
parents: 14827
diff changeset
   627
    return;
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   628
  // Weakened for current Sparcs and TSO.  See the v9 manual, sections 8.4.3,
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   629
  // 8.4.4.3, a.31 and a.50.
18097
acd70736bd60 8008407: remove SPARC V8 support
morris
parents: 14827
diff changeset
   630
  // Under TSO, setting bit 3, 2, or 0 is redundant, so the only value
acd70736bd60 8008407: remove SPARC V8 support
morris
parents: 14827
diff changeset
   631
  // of the mmask subfield of const7a that does anything that isn't done
acd70736bd60 8008407: remove SPARC V8 support
morris
parents: 14827
diff changeset
   632
  // implicitly is StoreLoad.
acd70736bd60 8008407: remove SPARC V8 support
morris
parents: 14827
diff changeset
   633
  const Membar_mask_bits effective_mask =
acd70736bd60 8008407: remove SPARC V8 support
morris
parents: 14827
diff changeset
   634
      Membar_mask_bits(const7a & ~(LoadLoad | LoadStore | StoreStore));
acd70736bd60 8008407: remove SPARC V8 support
morris
parents: 14827
diff changeset
   635
  if (effective_mask != 0) {
acd70736bd60 8008407: remove SPARC V8 support
morris
parents: 14827
diff changeset
   636
    Assembler::membar(effective_mask);
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   637
  }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   638
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   639
35090
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   640
inline void MacroAssembler::mov(Register s, Register d) {
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   641
  if (s != d) {
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   642
    or3(G0, s, d);
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   643
  } else {
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   644
    assert_not_delayed();  // Put something useful in the delay slot!
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   645
  }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   646
}
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   647
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   648
inline void MacroAssembler::mov_or_nop(Register s, Register d) {
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   649
  if (s != d) {
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   650
    or3(G0, s, d);
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   651
  } else {
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   652
    nop();
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   653
  }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   654
}
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   655
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   656
inline void MacroAssembler::mov( int simm13a, Register d) { or3( G0, simm13a, d); }
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   657
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   658
inline void MacroAssembler::prefetch(const Address& a, PrefetchFcn f, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   659
  relocate(a.rspec(offset));
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   660
  assert(!a.has_index(), "");
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   661
  prefetch(a.base(), a.disp() + offset, f);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   662
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   663
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   664
inline void MacroAssembler::st(Register d, Register s1, Register s2)      { stw(d, s1, s2); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   665
inline void MacroAssembler::st(Register d, Register s1, int simm13a)      { stw(d, s1, simm13a); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   666
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   667
#ifdef ASSERT
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   668
// ByteSize is only a class when ASSERT is defined, otherwise it's an int.
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   669
inline void MacroAssembler::st(Register d, Register s1, ByteSize simm13a) { stw(d, s1, in_bytes(simm13a)); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   670
#endif
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   671
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   672
inline void MacroAssembler::st(Register d, const Address& a, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   673
  if (a.has_index()) { assert(offset == 0, ""); st( d, a.base(), a.index()        ); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   674
  else               {                          st( d, a.base(), a.disp() + offset); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   675
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   676
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   677
inline void MacroAssembler::stb(Register d, const Address& a, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   678
  if (a.has_index()) { assert(offset == 0, ""); stb(d, a.base(), a.index()        ); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   679
  else               {                          stb(d, a.base(), a.disp() + offset); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   680
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   681
inline void MacroAssembler::sth(Register d, const Address& a, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   682
  if (a.has_index()) { assert(offset == 0, ""); sth(d, a.base(), a.index()        ); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   683
  else               {                          sth(d, a.base(), a.disp() + offset); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   684
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   685
inline void MacroAssembler::stw(Register d, const Address& a, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   686
  if (a.has_index()) { assert(offset == 0, ""); stw(d, a.base(), a.index()        ); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   687
  else               {                          stw(d, a.base(), a.disp() + offset); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   688
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   689
inline void MacroAssembler::std(Register d, const Address& a, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   690
  if (a.has_index()) { assert(offset == 0, ""); std(d, a.base(), a.index()        ); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   691
  else               {                          std(d, a.base(), a.disp() + offset); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   692
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   693
inline void MacroAssembler::stx(Register d, const Address& a, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   694
  if (a.has_index()) { assert(offset == 0, ""); stx(d, a.base(), a.index()        ); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   695
  else               {                          stx(d, a.base(), a.disp() + offset); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   696
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   697
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   698
inline void MacroAssembler::stb(Register d, Register s1, RegisterOrConstant s2) { stb(d, Address(s1, s2)); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   699
inline void MacroAssembler::sth(Register d, Register s1, RegisterOrConstant s2) { sth(d, Address(s1, s2)); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   700
inline void MacroAssembler::stw(Register d, Register s1, RegisterOrConstant s2) { stw(d, Address(s1, s2)); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   701
inline void MacroAssembler::stx(Register d, Register s1, RegisterOrConstant s2) { stx(d, Address(s1, s2)); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   702
inline void MacroAssembler::std(Register d, Register s1, RegisterOrConstant s2) { std(d, Address(s1, s2)); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   703
inline void MacroAssembler::st( Register d, Register s1, RegisterOrConstant s2) { st( d, Address(s1, s2)); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   704
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   705
inline void MacroAssembler::stf(FloatRegisterImpl::Width w, FloatRegister d, Register s1, RegisterOrConstant s2) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   706
  if (s2.is_register())  stf(w, d, s1, s2.as_register());
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   707
  else                   stf(w, d, s1, s2.as_constant());
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   708
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   709
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   710
inline void MacroAssembler::stf(FloatRegisterImpl::Width w, FloatRegister d, const Address& a, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   711
  relocate(a.rspec(offset));
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   712
  if (a.has_index()) { assert(offset == 0, ""); stf(w, d, a.base(), a.index()        ); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   713
  else               {                          stf(w, d, a.base(), a.disp() + offset); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   714
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   715
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   716
inline void MacroAssembler::sub(Register s1, RegisterOrConstant s2, Register d, int offset) {
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   717
  if (s2.is_register())  sub(s1, s2.as_register(),          d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   718
  else                 { sub(s1, s2.as_constant() + offset, d); offset = 0; }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   719
  if (offset != 0)       sub(d,  offset,                    d);
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   720
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   721
18104
590c10f73634 8002160: Compilation issue with adlc using latest SunStudio compilers
drchase
parents: 18097
diff changeset
   722
inline void MacroAssembler::swap(const Address& a, Register d, int offset) {
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   723
  relocate(a.rspec(offset));
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   724
  if (a.has_index()) { assert(offset == 0, ""); swap(a.base(), a.index(), d        ); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   725
  else               {                          swap(a.base(), a.disp() + offset, d); }
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   726
}
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   727
35090
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   728
inline void MacroAssembler::bang_stack_with_offset(int offset) {
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   729
  // stack grows down, caller passes positive offset
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   730
  assert(offset > 0, "must bang with negative offset");
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   731
  set((-offset)+STACK_BIAS, G3_scratch);
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   732
  st(G0, SP, G3_scratch);
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   733
}
1f5b6aa795d0 8144748: Move assembler/macroAssembler inline function definitions to corresponding inline.hpp files
mikael
parents: 35086
diff changeset
   734
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
diff changeset
   735
#endif // CPU_SPARC_VM_MACROASSEMBLER_SPARC_INLINE_HPP