annotate src/cpu/sparc/vm/nativeInst_sparc.hpp @ 17524:89152779163c

Merge with jdk8-b132
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 15 Oct 2014 11:59:32 +0200
parents 4ca6dc0799b6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
17524
89152779163c Merge with jdk8-b132
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 605
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 605
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 605
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #ifndef CPU_SPARC_VM_NATIVEINST_SPARC_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define CPU_SPARC_VM_NATIVEINST_SPARC_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
7204
f0c2369fda5a 8003250: SPARC: move MacroAssembler into separate file
twisti
parents: 6725
diff changeset
28 #include "asm/macroAssembler.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "memory/allocation.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30 #include "runtime/icache.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31 #include "runtime/os.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
32 #include "utilities/top.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
33
0
a61af66fc99e Initial load
duke
parents:
diff changeset
34 // We have interface for the following instructions:
a61af66fc99e Initial load
duke
parents:
diff changeset
35 // - NativeInstruction
a61af66fc99e Initial load
duke
parents:
diff changeset
36 // - - NativeCall
a61af66fc99e Initial load
duke
parents:
diff changeset
37 // - - NativeFarCall
a61af66fc99e Initial load
duke
parents:
diff changeset
38 // - - NativeMovConstReg
a61af66fc99e Initial load
duke
parents:
diff changeset
39 // - - NativeMovConstRegPatching
a61af66fc99e Initial load
duke
parents:
diff changeset
40 // - - NativeMovRegMem
a61af66fc99e Initial load
duke
parents:
diff changeset
41 // - - NativeMovRegMemPatching
a61af66fc99e Initial load
duke
parents:
diff changeset
42 // - - NativeJump
a61af66fc99e Initial load
duke
parents:
diff changeset
43 // - - NativeGeneralJump
a61af66fc99e Initial load
duke
parents:
diff changeset
44 // - - NativeIllegalInstruction
a61af66fc99e Initial load
duke
parents:
diff changeset
45 // The base class for different kinds of native instruction abstractions.
a61af66fc99e Initial load
duke
parents:
diff changeset
46 // Provides the primitive operations to manipulate code relative to this.
a61af66fc99e Initial load
duke
parents:
diff changeset
47 class NativeInstruction VALUE_OBJ_CLASS_SPEC {
a61af66fc99e Initial load
duke
parents:
diff changeset
48 friend class Relocation;
a61af66fc99e Initial load
duke
parents:
diff changeset
49
a61af66fc99e Initial load
duke
parents:
diff changeset
50 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
51 enum Sparc_specific_constants {
a61af66fc99e Initial load
duke
parents:
diff changeset
52 nop_instruction_size = 4
a61af66fc99e Initial load
duke
parents:
diff changeset
53 };
a61af66fc99e Initial load
duke
parents:
diff changeset
54
116
018d5b58dd4f 6537506: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents: 0
diff changeset
55 bool is_dtrace_trap();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
56 bool is_nop() { return long_at(0) == nop_instruction(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
57 bool is_call() { return is_op(long_at(0), Assembler::call_op); }
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10997
diff changeset
58 bool is_call_reg() { return is_op(long_at(0), Assembler::arith_op); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
59 bool is_sethi() { return (is_op2(long_at(0), Assembler::sethi_op2)
a61af66fc99e Initial load
duke
parents:
diff changeset
60 && inv_rd(long_at(0)) != G0); }
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62 bool sets_cc() {
a61af66fc99e Initial load
duke
parents:
diff changeset
63 // conservative (returns true for some instructions that do not set the
a61af66fc99e Initial load
duke
parents:
diff changeset
64 // the condition code, such as, "save".
a61af66fc99e Initial load
duke
parents:
diff changeset
65 // Does not return true for the deprecated tagged instructions, such as, TADDcc
a61af66fc99e Initial load
duke
parents:
diff changeset
66 int x = long_at(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
67 return (is_op(x, Assembler::arith_op) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
68 (inv_op3(x) & Assembler::cc_bit_op3) == Assembler::cc_bit_op3);
a61af66fc99e Initial load
duke
parents:
diff changeset
69 }
a61af66fc99e Initial load
duke
parents:
diff changeset
70 bool is_illegal();
a61af66fc99e Initial load
duke
parents:
diff changeset
71 bool is_zombie() {
a61af66fc99e Initial load
duke
parents:
diff changeset
72 int x = long_at(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
73 return is_op3(x,
10997
46c544b8fbfc 8008407: remove SPARC V8 support
morris
parents: 7204
diff changeset
74 Assembler::ldsw_op3,
0
a61af66fc99e Initial load
duke
parents:
diff changeset
75 Assembler::ldst_op)
a61af66fc99e Initial load
duke
parents:
diff changeset
76 && Assembler::inv_rs1(x) == G0
a61af66fc99e Initial load
duke
parents:
diff changeset
77 && Assembler::inv_rd(x) == O7;
a61af66fc99e Initial load
duke
parents:
diff changeset
78 }
a61af66fc99e Initial load
duke
parents:
diff changeset
79 bool is_ic_miss_trap(); // Inline-cache uses a trap to detect a miss
a61af66fc99e Initial load
duke
parents:
diff changeset
80 bool is_return() {
a61af66fc99e Initial load
duke
parents:
diff changeset
81 // is it the output of MacroAssembler::ret or MacroAssembler::retl?
a61af66fc99e Initial load
duke
parents:
diff changeset
82 int x = long_at(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
83 const int pc_return_offset = 8; // see frame_sparc.hpp
a61af66fc99e Initial load
duke
parents:
diff changeset
84 return is_op3(x, Assembler::jmpl_op3, Assembler::arith_op)
a61af66fc99e Initial load
duke
parents:
diff changeset
85 && (inv_rs1(x) == I7 || inv_rs1(x) == O7)
a61af66fc99e Initial load
duke
parents:
diff changeset
86 && inv_immed(x) && inv_simm(x, 13) == pc_return_offset
a61af66fc99e Initial load
duke
parents:
diff changeset
87 && inv_rd(x) == G0;
a61af66fc99e Initial load
duke
parents:
diff changeset
88 }
a61af66fc99e Initial load
duke
parents:
diff changeset
89 bool is_int_jump() {
a61af66fc99e Initial load
duke
parents:
diff changeset
90 // is it the output of MacroAssembler::b?
a61af66fc99e Initial load
duke
parents:
diff changeset
91 int x = long_at(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
92 return is_op2(x, Assembler::bp_op2) || is_op2(x, Assembler::br_op2);
a61af66fc99e Initial load
duke
parents:
diff changeset
93 }
a61af66fc99e Initial load
duke
parents:
diff changeset
94 bool is_float_jump() {
a61af66fc99e Initial load
duke
parents:
diff changeset
95 // is it the output of MacroAssembler::fb?
a61af66fc99e Initial load
duke
parents:
diff changeset
96 int x = long_at(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
97 return is_op2(x, Assembler::fbp_op2) || is_op2(x, Assembler::fb_op2);
a61af66fc99e Initial load
duke
parents:
diff changeset
98 }
a61af66fc99e Initial load
duke
parents:
diff changeset
99 bool is_jump() {
a61af66fc99e Initial load
duke
parents:
diff changeset
100 return is_int_jump() || is_float_jump();
a61af66fc99e Initial load
duke
parents:
diff changeset
101 }
a61af66fc99e Initial load
duke
parents:
diff changeset
102 bool is_cond_jump() {
a61af66fc99e Initial load
duke
parents:
diff changeset
103 int x = long_at(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
104 return (is_int_jump() && Assembler::inv_cond(x) != Assembler::always) ||
a61af66fc99e Initial load
duke
parents:
diff changeset
105 (is_float_jump() && Assembler::inv_cond(x) != Assembler::f_always);
a61af66fc99e Initial load
duke
parents:
diff changeset
106 }
a61af66fc99e Initial load
duke
parents:
diff changeset
107
a61af66fc99e Initial load
duke
parents:
diff changeset
108 bool is_stack_bang() {
a61af66fc99e Initial load
duke
parents:
diff changeset
109 int x = long_at(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
110 return is_op3(x, Assembler::stw_op3, Assembler::ldst_op) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
111 (inv_rd(x) == G0) && (inv_rs1(x) == SP) && (inv_rs2(x) == G3_scratch);
a61af66fc99e Initial load
duke
parents:
diff changeset
112 }
a61af66fc99e Initial load
duke
parents:
diff changeset
113
a61af66fc99e Initial load
duke
parents:
diff changeset
114 bool is_prefetch() {
a61af66fc99e Initial load
duke
parents:
diff changeset
115 int x = long_at(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
116 return is_op3(x, Assembler::prefetch_op3, Assembler::ldst_op);
a61af66fc99e Initial load
duke
parents:
diff changeset
117 }
a61af66fc99e Initial load
duke
parents:
diff changeset
118
a61af66fc99e Initial load
duke
parents:
diff changeset
119 bool is_membar() {
a61af66fc99e Initial load
duke
parents:
diff changeset
120 int x = long_at(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
121 return is_op3(x, Assembler::membar_op3, Assembler::arith_op) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
122 (inv_rd(x) == G0) && (inv_rs1(x) == O7);
a61af66fc99e Initial load
duke
parents:
diff changeset
123 }
a61af66fc99e Initial load
duke
parents:
diff changeset
124
a61af66fc99e Initial load
duke
parents:
diff changeset
125 bool is_safepoint_poll() {
a61af66fc99e Initial load
duke
parents:
diff changeset
126 int x = long_at(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
127 #ifdef _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
128 return is_op3(x, Assembler::ldx_op3, Assembler::ldst_op) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
129 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
130 return is_op3(x, Assembler::lduw_op3, Assembler::ldst_op) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
131 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
132 (inv_rd(x) == G0) && (inv_immed(x) ? Assembler::inv_simm13(x) == 0 : inv_rs2(x) == G0);
a61af66fc99e Initial load
duke
parents:
diff changeset
133 }
a61af66fc99e Initial load
duke
parents:
diff changeset
134
a61af66fc99e Initial load
duke
parents:
diff changeset
135 bool is_zero_test(Register &reg);
a61af66fc99e Initial load
duke
parents:
diff changeset
136 bool is_load_store_with_small_offset(Register reg);
a61af66fc99e Initial load
duke
parents:
diff changeset
137
a61af66fc99e Initial load
duke
parents:
diff changeset
138 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
139 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
140 static int rdpc_instruction() { return Assembler::op(Assembler::arith_op ) | Assembler::op3(Assembler::rdreg_op3) | Assembler::u_field(5, 18, 14) | Assembler::rd(O7); }
a61af66fc99e Initial load
duke
parents:
diff changeset
141 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
142 // Temporary fix: in optimized mode, u_field is a macro for efficiency reasons (see Assembler::u_field) - needs to be fixed
a61af66fc99e Initial load
duke
parents:
diff changeset
143 static int rdpc_instruction() { return Assembler::op(Assembler::arith_op ) | Assembler::op3(Assembler::rdreg_op3) | u_field(5, 18, 14) | Assembler::rd(O7); }
a61af66fc99e Initial load
duke
parents:
diff changeset
144 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
145 static int nop_instruction() { return Assembler::op(Assembler::branch_op) | Assembler::op2(Assembler::sethi_op2); }
a61af66fc99e Initial load
duke
parents:
diff changeset
146 static int illegal_instruction(); // the output of __ breakpoint_trap()
a61af66fc99e Initial load
duke
parents:
diff changeset
147 static int call_instruction(address destination, address pc) { return Assembler::op(Assembler::call_op) | Assembler::wdisp((intptr_t)destination, (intptr_t)pc, 30); }
a61af66fc99e Initial load
duke
parents:
diff changeset
148
a61af66fc99e Initial load
duke
parents:
diff changeset
149 static int branch_instruction(Assembler::op2s op2val, Assembler::Condition c, bool a) {
a61af66fc99e Initial load
duke
parents:
diff changeset
150 return Assembler::op(Assembler::branch_op) | Assembler::op2(op2val) | Assembler::annul(a) | Assembler::cond(c);
a61af66fc99e Initial load
duke
parents:
diff changeset
151 }
a61af66fc99e Initial load
duke
parents:
diff changeset
152
a61af66fc99e Initial load
duke
parents:
diff changeset
153 static int op3_instruction(Assembler::ops opval, Register rd, Assembler::op3s op3val, Register rs1, int simm13a) {
a61af66fc99e Initial load
duke
parents:
diff changeset
154 return Assembler::op(opval) | Assembler::rd(rd) | Assembler::op3(op3val) | Assembler::rs1(rs1) | Assembler::immed(true) | Assembler::simm(simm13a, 13);
a61af66fc99e Initial load
duke
parents:
diff changeset
155 }
a61af66fc99e Initial load
duke
parents:
diff changeset
156
a61af66fc99e Initial load
duke
parents:
diff changeset
157 static int sethi_instruction(Register rd, int imm22a) {
a61af66fc99e Initial load
duke
parents:
diff changeset
158 return Assembler::op(Assembler::branch_op) | Assembler::rd(rd) | Assembler::op2(Assembler::sethi_op2) | Assembler::hi22(imm22a);
a61af66fc99e Initial load
duke
parents:
diff changeset
159 }
a61af66fc99e Initial load
duke
parents:
diff changeset
160
a61af66fc99e Initial load
duke
parents:
diff changeset
161 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
162 address addr_at(int offset) const { return address(this) + offset; }
a61af66fc99e Initial load
duke
parents:
diff changeset
163 int long_at(int offset) const { return *(int*)addr_at(offset); }
a61af66fc99e Initial load
duke
parents:
diff changeset
164 void set_long_at(int offset, int i); /* deals with I-cache */
a61af66fc99e Initial load
duke
parents:
diff changeset
165 void set_jlong_at(int offset, jlong i); /* deals with I-cache */
a61af66fc99e Initial load
duke
parents:
diff changeset
166 void set_addr_at(int offset, address x); /* deals with I-cache */
a61af66fc99e Initial load
duke
parents:
diff changeset
167
a61af66fc99e Initial load
duke
parents:
diff changeset
168 address instruction_address() const { return addr_at(0); }
a61af66fc99e Initial load
duke
parents:
diff changeset
169 address next_instruction_address() const { return addr_at(BytesPerInstWord); }
a61af66fc99e Initial load
duke
parents:
diff changeset
170
a61af66fc99e Initial load
duke
parents:
diff changeset
171 static bool is_op( int x, Assembler::ops opval) {
a61af66fc99e Initial load
duke
parents:
diff changeset
172 return Assembler::inv_op(x) == opval;
a61af66fc99e Initial load
duke
parents:
diff changeset
173 }
a61af66fc99e Initial load
duke
parents:
diff changeset
174 static bool is_op2(int x, Assembler::op2s op2val) {
a61af66fc99e Initial load
duke
parents:
diff changeset
175 return Assembler::inv_op(x) == Assembler::branch_op && Assembler::inv_op2(x) == op2val;
a61af66fc99e Initial load
duke
parents:
diff changeset
176 }
a61af66fc99e Initial load
duke
parents:
diff changeset
177 static bool is_op3(int x, Assembler::op3s op3val, Assembler::ops opval) {
a61af66fc99e Initial load
duke
parents:
diff changeset
178 return Assembler::inv_op(x) == opval && Assembler::inv_op3(x) == op3val;
a61af66fc99e Initial load
duke
parents:
diff changeset
179 }
a61af66fc99e Initial load
duke
parents:
diff changeset
180
a61af66fc99e Initial load
duke
parents:
diff changeset
181 // utilities to help subclasses decode:
a61af66fc99e Initial load
duke
parents:
diff changeset
182 static Register inv_rd( int x ) { return Assembler::inv_rd( x); }
a61af66fc99e Initial load
duke
parents:
diff changeset
183 static Register inv_rs1( int x ) { return Assembler::inv_rs1(x); }
a61af66fc99e Initial load
duke
parents:
diff changeset
184 static Register inv_rs2( int x ) { return Assembler::inv_rs2(x); }
a61af66fc99e Initial load
duke
parents:
diff changeset
185
a61af66fc99e Initial load
duke
parents:
diff changeset
186 static bool inv_immed( int x ) { return Assembler::inv_immed(x); }
a61af66fc99e Initial load
duke
parents:
diff changeset
187 static bool inv_annul( int x ) { return (Assembler::annul(true) & x) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
188 static int inv_cond( int x ) { return Assembler::inv_cond(x); }
a61af66fc99e Initial load
duke
parents:
diff changeset
189
a61af66fc99e Initial load
duke
parents:
diff changeset
190 static int inv_op( int x ) { return Assembler::inv_op( x); }
a61af66fc99e Initial load
duke
parents:
diff changeset
191 static int inv_op2( int x ) { return Assembler::inv_op2(x); }
a61af66fc99e Initial load
duke
parents:
diff changeset
192 static int inv_op3( int x ) { return Assembler::inv_op3(x); }
a61af66fc99e Initial load
duke
parents:
diff changeset
193
a61af66fc99e Initial load
duke
parents:
diff changeset
194 static int inv_simm( int x, int nbits ) { return Assembler::inv_simm(x, nbits); }
a61af66fc99e Initial load
duke
parents:
diff changeset
195 static intptr_t inv_wdisp( int x, int nbits ) { return Assembler::inv_wdisp( x, 0, nbits); }
a61af66fc99e Initial load
duke
parents:
diff changeset
196 static intptr_t inv_wdisp16( int x ) { return Assembler::inv_wdisp16(x, 0); }
7204
f0c2369fda5a 8003250: SPARC: move MacroAssembler into separate file
twisti
parents: 6725
diff changeset
197 static int branch_destination_offset(int x) { return MacroAssembler::branch_destination(x, 0); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
198 static int patch_branch_destination_offset(int dest_offset, int x) {
7204
f0c2369fda5a 8003250: SPARC: move MacroAssembler into separate file
twisti
parents: 6725
diff changeset
199 return MacroAssembler::patched_branch(dest_offset, x, 0);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
200 }
a61af66fc99e Initial load
duke
parents:
diff changeset
201
a61af66fc99e Initial load
duke
parents:
diff changeset
202 // utility for checking if x is either of 2 small constants
a61af66fc99e Initial load
duke
parents:
diff changeset
203 static bool is_either(int x, int k1, int k2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
204 // return x == k1 || x == k2;
a61af66fc99e Initial load
duke
parents:
diff changeset
205 return (1 << x) & (1 << k1 | 1 << k2);
a61af66fc99e Initial load
duke
parents:
diff changeset
206 }
a61af66fc99e Initial load
duke
parents:
diff changeset
207
a61af66fc99e Initial load
duke
parents:
diff changeset
208 // utility for checking overflow of signed instruction fields
a61af66fc99e Initial load
duke
parents:
diff changeset
209 static bool fits_in_simm(int x, int nbits) {
a61af66fc99e Initial load
duke
parents:
diff changeset
210 // cf. Assembler::assert_signed_range()
a61af66fc99e Initial load
duke
parents:
diff changeset
211 // return -(1 << nbits-1) <= x && x < ( 1 << nbits-1),
a61af66fc99e Initial load
duke
parents:
diff changeset
212 return (unsigned)(x + (1 << nbits-1)) < (unsigned)(1 << nbits);
a61af66fc99e Initial load
duke
parents:
diff changeset
213 }
a61af66fc99e Initial load
duke
parents:
diff changeset
214
a61af66fc99e Initial load
duke
parents:
diff changeset
215 // set a signed immediate field
a61af66fc99e Initial load
duke
parents:
diff changeset
216 static int set_simm(int insn, int imm, int nbits) {
a61af66fc99e Initial load
duke
parents:
diff changeset
217 return (insn &~ Assembler::simm(-1, nbits)) | Assembler::simm(imm, nbits);
a61af66fc99e Initial load
duke
parents:
diff changeset
218 }
a61af66fc99e Initial load
duke
parents:
diff changeset
219
a61af66fc99e Initial load
duke
parents:
diff changeset
220 // set a wdisp field (disp should be the difference of two addresses)
a61af66fc99e Initial load
duke
parents:
diff changeset
221 static int set_wdisp(int insn, intptr_t disp, int nbits) {
a61af66fc99e Initial load
duke
parents:
diff changeset
222 return (insn &~ Assembler::wdisp((intptr_t)-4, (intptr_t)0, nbits)) | Assembler::wdisp(disp, 0, nbits);
a61af66fc99e Initial load
duke
parents:
diff changeset
223 }
a61af66fc99e Initial load
duke
parents:
diff changeset
224
a61af66fc99e Initial load
duke
parents:
diff changeset
225 static int set_wdisp16(int insn, intptr_t disp) {
a61af66fc99e Initial load
duke
parents:
diff changeset
226 return (insn &~ Assembler::wdisp16((intptr_t)-4, 0)) | Assembler::wdisp16(disp, 0);
a61af66fc99e Initial load
duke
parents:
diff changeset
227 }
a61af66fc99e Initial load
duke
parents:
diff changeset
228
a61af66fc99e Initial load
duke
parents:
diff changeset
229 // get a simm13 field from an arithmetic or memory instruction
a61af66fc99e Initial load
duke
parents:
diff changeset
230 static int get_simm13(int insn) {
a61af66fc99e Initial load
duke
parents:
diff changeset
231 assert(is_either(Assembler::inv_op(insn),
a61af66fc99e Initial load
duke
parents:
diff changeset
232 Assembler::arith_op, Assembler::ldst_op) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
233 (insn & Assembler::immed(true)), "must have a simm13 field");
a61af66fc99e Initial load
duke
parents:
diff changeset
234 return Assembler::inv_simm(insn, 13);
a61af66fc99e Initial load
duke
parents:
diff changeset
235 }
a61af66fc99e Initial load
duke
parents:
diff changeset
236
a61af66fc99e Initial load
duke
parents:
diff changeset
237 // set the simm13 field of an arithmetic or memory instruction
a61af66fc99e Initial load
duke
parents:
diff changeset
238 static bool set_simm13(int insn, int imm) {
a61af66fc99e Initial load
duke
parents:
diff changeset
239 get_simm13(insn); // tickle the assertion check
a61af66fc99e Initial load
duke
parents:
diff changeset
240 return set_simm(insn, imm, 13);
a61af66fc99e Initial load
duke
parents:
diff changeset
241 }
a61af66fc99e Initial load
duke
parents:
diff changeset
242
a61af66fc99e Initial load
duke
parents:
diff changeset
243 // combine the fields of a sethi stream (7 instructions ) and an add, jmp or ld/st
a61af66fc99e Initial load
duke
parents:
diff changeset
244 static intptr_t data64( address pc, int arith_insn ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
245 assert(is_op2(*(unsigned int *)pc, Assembler::sethi_op2), "must be sethi");
a61af66fc99e Initial load
duke
parents:
diff changeset
246 intptr_t hi = (intptr_t)gethi( (unsigned int *)pc );
a61af66fc99e Initial load
duke
parents:
diff changeset
247 intptr_t lo = (intptr_t)get_simm13(arith_insn);
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
248 assert((unsigned)lo < (1 << 10), "offset field of set_metadata must be 10 bits");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
249 return hi | lo;
a61af66fc99e Initial load
duke
parents:
diff changeset
250 }
a61af66fc99e Initial load
duke
parents:
diff changeset
251
a61af66fc99e Initial load
duke
parents:
diff changeset
252 // Regenerate the instruction sequence that performs the 64 bit
a61af66fc99e Initial load
duke
parents:
diff changeset
253 // sethi. This only does the sethi. The disp field (bottom 10 bits)
605
98cb887364d3 6810672: Comment typos
twisti
parents: 196
diff changeset
254 // must be handled separately.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
255 static void set_data64_sethi(address instaddr, intptr_t x);
2375
d673ef06fe96 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 1972
diff changeset
256 static void verify_data64_sethi(address instaddr, intptr_t x);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
257
a61af66fc99e Initial load
duke
parents:
diff changeset
258 // combine the fields of a sethi/simm13 pair (simm13 = or, add, jmpl, ld/st)
a61af66fc99e Initial load
duke
parents:
diff changeset
259 static int data32(int sethi_insn, int arith_insn) {
a61af66fc99e Initial load
duke
parents:
diff changeset
260 assert(is_op2(sethi_insn, Assembler::sethi_op2), "must be sethi");
a61af66fc99e Initial load
duke
parents:
diff changeset
261 int hi = Assembler::inv_hi22(sethi_insn);
a61af66fc99e Initial load
duke
parents:
diff changeset
262 int lo = get_simm13(arith_insn);
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
263 assert((unsigned)lo < (1 << 10), "offset field of set_metadata must be 10 bits");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
264 return hi | lo;
a61af66fc99e Initial load
duke
parents:
diff changeset
265 }
a61af66fc99e Initial load
duke
parents:
diff changeset
266
a61af66fc99e Initial load
duke
parents:
diff changeset
267 static int set_data32_sethi(int sethi_insn, int imm) {
a61af66fc99e Initial load
duke
parents:
diff changeset
268 // note that Assembler::hi22 clips the low 10 bits for us
a61af66fc99e Initial load
duke
parents:
diff changeset
269 assert(is_op2(sethi_insn, Assembler::sethi_op2), "must be sethi");
a61af66fc99e Initial load
duke
parents:
diff changeset
270 return (sethi_insn &~ Assembler::hi22(-1)) | Assembler::hi22(imm);
a61af66fc99e Initial load
duke
parents:
diff changeset
271 }
a61af66fc99e Initial load
duke
parents:
diff changeset
272
a61af66fc99e Initial load
duke
parents:
diff changeset
273 static int set_data32_simm13(int arith_insn, int imm) {
a61af66fc99e Initial load
duke
parents:
diff changeset
274 get_simm13(arith_insn); // tickle the assertion check
a61af66fc99e Initial load
duke
parents:
diff changeset
275 int imm10 = Assembler::low10(imm);
a61af66fc99e Initial load
duke
parents:
diff changeset
276 return (arith_insn &~ Assembler::simm(-1, 13)) | Assembler::simm(imm10, 13);
a61af66fc99e Initial load
duke
parents:
diff changeset
277 }
a61af66fc99e Initial load
duke
parents:
diff changeset
278
a61af66fc99e Initial load
duke
parents:
diff changeset
279 static int low10(int imm) {
a61af66fc99e Initial load
duke
parents:
diff changeset
280 return Assembler::low10(imm);
a61af66fc99e Initial load
duke
parents:
diff changeset
281 }
a61af66fc99e Initial load
duke
parents:
diff changeset
282
a61af66fc99e Initial load
duke
parents:
diff changeset
283 // Perform the inverse of the LP64 Macroassembler::sethi
a61af66fc99e Initial load
duke
parents:
diff changeset
284 // routine. Extracts the 54 bits of address from the instruction
a61af66fc99e Initial load
duke
parents:
diff changeset
285 // stream. This routine must agree with the sethi routine in
a61af66fc99e Initial load
duke
parents:
diff changeset
286 // assembler_inline_sparc.hpp
a61af66fc99e Initial load
duke
parents:
diff changeset
287 static address gethi( unsigned int *pc ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
288 int i = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
289 uintptr_t adr;
a61af66fc99e Initial load
duke
parents:
diff changeset
290 // We first start out with the real sethi instruction
a61af66fc99e Initial load
duke
parents:
diff changeset
291 assert(is_op2(*pc, Assembler::sethi_op2), "in gethi - must be sethi");
a61af66fc99e Initial load
duke
parents:
diff changeset
292 adr = (unsigned int)Assembler::inv_hi22( *(pc++) );
a61af66fc99e Initial load
duke
parents:
diff changeset
293 i++;
a61af66fc99e Initial load
duke
parents:
diff changeset
294 while ( i < 7 ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
295 // We're done if we hit a nop
a61af66fc99e Initial load
duke
parents:
diff changeset
296 if ( (int)*pc == nop_instruction() ) break;
a61af66fc99e Initial load
duke
parents:
diff changeset
297 assert ( Assembler::inv_op(*pc) == Assembler::arith_op, "in gethi - must be arith_op" );
a61af66fc99e Initial load
duke
parents:
diff changeset
298 switch ( Assembler::inv_op3(*pc) ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
299 case Assembler::xor_op3:
a61af66fc99e Initial load
duke
parents:
diff changeset
300 adr ^= (intptr_t)get_simm13( *pc );
a61af66fc99e Initial load
duke
parents:
diff changeset
301 return ( (address)adr );
a61af66fc99e Initial load
duke
parents:
diff changeset
302 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
303 case Assembler::sll_op3:
a61af66fc99e Initial load
duke
parents:
diff changeset
304 adr <<= ( *pc & 0x3f );
a61af66fc99e Initial load
duke
parents:
diff changeset
305 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
306 case Assembler::or_op3:
a61af66fc99e Initial load
duke
parents:
diff changeset
307 adr |= (intptr_t)get_simm13( *pc );
a61af66fc99e Initial load
duke
parents:
diff changeset
308 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
309 default:
a61af66fc99e Initial load
duke
parents:
diff changeset
310 assert ( 0, "in gethi - Should not reach here" );
a61af66fc99e Initial load
duke
parents:
diff changeset
311 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
312 }
a61af66fc99e Initial load
duke
parents:
diff changeset
313 pc++;
a61af66fc99e Initial load
duke
parents:
diff changeset
314 i++;
a61af66fc99e Initial load
duke
parents:
diff changeset
315 }
a61af66fc99e Initial load
duke
parents:
diff changeset
316 return ( (address)adr );
a61af66fc99e Initial load
duke
parents:
diff changeset
317 }
a61af66fc99e Initial load
duke
parents:
diff changeset
318
a61af66fc99e Initial load
duke
parents:
diff changeset
319 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
320 void verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
321 void print();
a61af66fc99e Initial load
duke
parents:
diff changeset
322
a61af66fc99e Initial load
duke
parents:
diff changeset
323 // unit test stuff
a61af66fc99e Initial load
duke
parents:
diff changeset
324 static void test() {} // override for testing
a61af66fc99e Initial load
duke
parents:
diff changeset
325
a61af66fc99e Initial load
duke
parents:
diff changeset
326 inline friend NativeInstruction* nativeInstruction_at(address address);
a61af66fc99e Initial load
duke
parents:
diff changeset
327 };
a61af66fc99e Initial load
duke
parents:
diff changeset
328
a61af66fc99e Initial load
duke
parents:
diff changeset
329 inline NativeInstruction* nativeInstruction_at(address address) {
a61af66fc99e Initial load
duke
parents:
diff changeset
330 NativeInstruction* inst = (NativeInstruction*)address;
a61af66fc99e Initial load
duke
parents:
diff changeset
331 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
332 inst->verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
333 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
334 return inst;
a61af66fc99e Initial load
duke
parents:
diff changeset
335 }
a61af66fc99e Initial load
duke
parents:
diff changeset
336
a61af66fc99e Initial load
duke
parents:
diff changeset
337
a61af66fc99e Initial load
duke
parents:
diff changeset
338
a61af66fc99e Initial load
duke
parents:
diff changeset
339 //-----------------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
340
a61af66fc99e Initial load
duke
parents:
diff changeset
341 // The NativeCall is an abstraction for accessing/manipulating native call imm32 instructions.
a61af66fc99e Initial load
duke
parents:
diff changeset
342 // (used to manipulate inline caches, primitive & dll calls, etc.)
a61af66fc99e Initial load
duke
parents:
diff changeset
343 inline NativeCall* nativeCall_at(address instr);
a61af66fc99e Initial load
duke
parents:
diff changeset
344 inline NativeCall* nativeCall_overwriting_at(address instr,
a61af66fc99e Initial load
duke
parents:
diff changeset
345 address destination);
a61af66fc99e Initial load
duke
parents:
diff changeset
346 inline NativeCall* nativeCall_before(address return_address);
a61af66fc99e Initial load
duke
parents:
diff changeset
347 class NativeCall: public NativeInstruction {
a61af66fc99e Initial load
duke
parents:
diff changeset
348 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
349 enum Sparc_specific_constants {
a61af66fc99e Initial load
duke
parents:
diff changeset
350 instruction_size = 8,
a61af66fc99e Initial load
duke
parents:
diff changeset
351 return_address_offset = 8,
a61af66fc99e Initial load
duke
parents:
diff changeset
352 call_displacement_width = 30,
a61af66fc99e Initial load
duke
parents:
diff changeset
353 displacement_offset = 0,
a61af66fc99e Initial load
duke
parents:
diff changeset
354 instruction_offset = 0
a61af66fc99e Initial load
duke
parents:
diff changeset
355 };
a61af66fc99e Initial load
duke
parents:
diff changeset
356 address instruction_address() const { return addr_at(0); }
a61af66fc99e Initial load
duke
parents:
diff changeset
357 address next_instruction_address() const { return addr_at(instruction_size); }
a61af66fc99e Initial load
duke
parents:
diff changeset
358 address return_address() const { return addr_at(return_address_offset); }
a61af66fc99e Initial load
duke
parents:
diff changeset
359
a61af66fc99e Initial load
duke
parents:
diff changeset
360 address destination() const { return inv_wdisp(long_at(0), call_displacement_width) + instruction_address(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
361 address displacement_address() const { return addr_at(displacement_offset); }
a61af66fc99e Initial load
duke
parents:
diff changeset
362 void set_destination(address dest) { set_long_at(0, set_wdisp(long_at(0), dest - instruction_address(), call_displacement_width)); }
a61af66fc99e Initial load
duke
parents:
diff changeset
363 void set_destination_mt_safe(address dest);
a61af66fc99e Initial load
duke
parents:
diff changeset
364
a61af66fc99e Initial load
duke
parents:
diff changeset
365 void verify_alignment() {} // do nothing on sparc
a61af66fc99e Initial load
duke
parents:
diff changeset
366 void verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
367 void print();
a61af66fc99e Initial load
duke
parents:
diff changeset
368
a61af66fc99e Initial load
duke
parents:
diff changeset
369 // unit test stuff
a61af66fc99e Initial load
duke
parents:
diff changeset
370 static void test();
a61af66fc99e Initial load
duke
parents:
diff changeset
371
a61af66fc99e Initial load
duke
parents:
diff changeset
372 // Creation
a61af66fc99e Initial load
duke
parents:
diff changeset
373 friend inline NativeCall* nativeCall_at(address instr);
a61af66fc99e Initial load
duke
parents:
diff changeset
374 friend NativeCall* nativeCall_overwriting_at(address instr, address destination = NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
375 // insert a "blank" call:
a61af66fc99e Initial load
duke
parents:
diff changeset
376 NativeCall* call = (NativeCall*)instr;
a61af66fc99e Initial load
duke
parents:
diff changeset
377 call->set_long_at(0 * BytesPerInstWord, call_instruction(destination, instr));
a61af66fc99e Initial load
duke
parents:
diff changeset
378 call->set_long_at(1 * BytesPerInstWord, nop_instruction());
a61af66fc99e Initial load
duke
parents:
diff changeset
379 assert(call->addr_at(2 * BytesPerInstWord) - instr == instruction_size, "instruction size");
a61af66fc99e Initial load
duke
parents:
diff changeset
380 // check its structure now:
a61af66fc99e Initial load
duke
parents:
diff changeset
381 assert(nativeCall_at(instr)->destination() == destination, "correct call destination");
a61af66fc99e Initial load
duke
parents:
diff changeset
382 return call;
a61af66fc99e Initial load
duke
parents:
diff changeset
383 }
a61af66fc99e Initial load
duke
parents:
diff changeset
384
a61af66fc99e Initial load
duke
parents:
diff changeset
385 friend inline NativeCall* nativeCall_before(address return_address) {
a61af66fc99e Initial load
duke
parents:
diff changeset
386 NativeCall* call = (NativeCall*)(return_address - return_address_offset);
a61af66fc99e Initial load
duke
parents:
diff changeset
387 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
388 call->verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
389 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
390 return call;
a61af66fc99e Initial load
duke
parents:
diff changeset
391 }
a61af66fc99e Initial load
duke
parents:
diff changeset
392
a61af66fc99e Initial load
duke
parents:
diff changeset
393 static bool is_call_at(address instr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
394 return nativeInstruction_at(instr)->is_call();
a61af66fc99e Initial load
duke
parents:
diff changeset
395 }
a61af66fc99e Initial load
duke
parents:
diff changeset
396
a61af66fc99e Initial load
duke
parents:
diff changeset
397 static bool is_call_before(address instr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
398 return nativeInstruction_at(instr - return_address_offset)->is_call();
a61af66fc99e Initial load
duke
parents:
diff changeset
399 }
a61af66fc99e Initial load
duke
parents:
diff changeset
400
a61af66fc99e Initial load
duke
parents:
diff changeset
401 static bool is_call_to(address instr, address target) {
a61af66fc99e Initial load
duke
parents:
diff changeset
402 return nativeInstruction_at(instr)->is_call() &&
a61af66fc99e Initial load
duke
parents:
diff changeset
403 nativeCall_at(instr)->destination() == target;
a61af66fc99e Initial load
duke
parents:
diff changeset
404 }
a61af66fc99e Initial load
duke
parents:
diff changeset
405
a61af66fc99e Initial load
duke
parents:
diff changeset
406 // MT-safe patching of a call instruction.
a61af66fc99e Initial load
duke
parents:
diff changeset
407 static void insert(address code_pos, address entry) {
a61af66fc99e Initial load
duke
parents:
diff changeset
408 (void)nativeCall_overwriting_at(code_pos, entry);
a61af66fc99e Initial load
duke
parents:
diff changeset
409 }
a61af66fc99e Initial load
duke
parents:
diff changeset
410
a61af66fc99e Initial load
duke
parents:
diff changeset
411 static void replace_mt_safe(address instr_addr, address code_buffer);
a61af66fc99e Initial load
duke
parents:
diff changeset
412 };
a61af66fc99e Initial load
duke
parents:
diff changeset
413 inline NativeCall* nativeCall_at(address instr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
414 NativeCall* call = (NativeCall*)instr;
a61af66fc99e Initial load
duke
parents:
diff changeset
415 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
416 call->verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
417 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
418 return call;
a61af66fc99e Initial load
duke
parents:
diff changeset
419 }
a61af66fc99e Initial load
duke
parents:
diff changeset
420
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10997
diff changeset
421 class NativeCallReg: public NativeInstruction {
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10997
diff changeset
422 public:
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10997
diff changeset
423 enum Sparc_specific_constants {
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10997
diff changeset
424 instruction_size = 8,
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10997
diff changeset
425 return_address_offset = 8,
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10997
diff changeset
426 instruction_offset = 0
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10997
diff changeset
427 };
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10997
diff changeset
428
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10997
diff changeset
429 address next_instruction_address() const {
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10997
diff changeset
430 return addr_at(instruction_size);
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10997
diff changeset
431 }
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10997
diff changeset
432 };
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10997
diff changeset
433
0
a61af66fc99e Initial load
duke
parents:
diff changeset
434 // The NativeFarCall is an abstraction for accessing/manipulating native call-anywhere
a61af66fc99e Initial load
duke
parents:
diff changeset
435 // instructions in the sparcv9 vm. Used to call native methods which may be loaded
a61af66fc99e Initial load
duke
parents:
diff changeset
436 // anywhere in the address space, possibly out of reach of a call instruction.
a61af66fc99e Initial load
duke
parents:
diff changeset
437
a61af66fc99e Initial load
duke
parents:
diff changeset
438 #ifndef _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
439
a61af66fc99e Initial load
duke
parents:
diff changeset
440 // On 32-bit systems, a far call is the same as a near one.
a61af66fc99e Initial load
duke
parents:
diff changeset
441 class NativeFarCall;
a61af66fc99e Initial load
duke
parents:
diff changeset
442 inline NativeFarCall* nativeFarCall_at(address instr);
a61af66fc99e Initial load
duke
parents:
diff changeset
443 class NativeFarCall : public NativeCall {
a61af66fc99e Initial load
duke
parents:
diff changeset
444 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
445 friend inline NativeFarCall* nativeFarCall_at(address instr) { return (NativeFarCall*)nativeCall_at(instr); }
a61af66fc99e Initial load
duke
parents:
diff changeset
446 friend NativeFarCall* nativeFarCall_overwriting_at(address instr, address destination = NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
447 { return (NativeFarCall*)nativeCall_overwriting_at(instr, destination); }
a61af66fc99e Initial load
duke
parents:
diff changeset
448 friend NativeFarCall* nativeFarCall_before(address return_address)
a61af66fc99e Initial load
duke
parents:
diff changeset
449 { return (NativeFarCall*)nativeCall_before(return_address); }
a61af66fc99e Initial load
duke
parents:
diff changeset
450 };
a61af66fc99e Initial load
duke
parents:
diff changeset
451
a61af66fc99e Initial load
duke
parents:
diff changeset
452 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
453
a61af66fc99e Initial load
duke
parents:
diff changeset
454 // The format of this extended-range call is:
a61af66fc99e Initial load
duke
parents:
diff changeset
455 // jumpl_to addr, lreg
a61af66fc99e Initial load
duke
parents:
diff changeset
456 // == sethi %hi54(addr), O7 ; jumpl O7, %lo10(addr), O7 ; <delay>
a61af66fc99e Initial load
duke
parents:
diff changeset
457 // That is, it is essentially the same as a NativeJump.
a61af66fc99e Initial load
duke
parents:
diff changeset
458 class NativeFarCall;
a61af66fc99e Initial load
duke
parents:
diff changeset
459 inline NativeFarCall* nativeFarCall_overwriting_at(address instr, address destination);
a61af66fc99e Initial load
duke
parents:
diff changeset
460 inline NativeFarCall* nativeFarCall_at(address instr);
a61af66fc99e Initial load
duke
parents:
diff changeset
461 class NativeFarCall: public NativeInstruction {
a61af66fc99e Initial load
duke
parents:
diff changeset
462 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
463 enum Sparc_specific_constants {
a61af66fc99e Initial load
duke
parents:
diff changeset
464 // instruction_size includes the delay slot instruction.
a61af66fc99e Initial load
duke
parents:
diff changeset
465 instruction_size = 9 * BytesPerInstWord,
a61af66fc99e Initial load
duke
parents:
diff changeset
466 return_address_offset = 9 * BytesPerInstWord,
a61af66fc99e Initial load
duke
parents:
diff changeset
467 jmpl_offset = 7 * BytesPerInstWord,
a61af66fc99e Initial load
duke
parents:
diff changeset
468 displacement_offset = 0,
a61af66fc99e Initial load
duke
parents:
diff changeset
469 instruction_offset = 0
a61af66fc99e Initial load
duke
parents:
diff changeset
470 };
a61af66fc99e Initial load
duke
parents:
diff changeset
471 address instruction_address() const { return addr_at(0); }
a61af66fc99e Initial load
duke
parents:
diff changeset
472 address next_instruction_address() const { return addr_at(instruction_size); }
a61af66fc99e Initial load
duke
parents:
diff changeset
473 address return_address() const { return addr_at(return_address_offset); }
a61af66fc99e Initial load
duke
parents:
diff changeset
474
a61af66fc99e Initial load
duke
parents:
diff changeset
475 address destination() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
476 return (address) data64(addr_at(0), long_at(jmpl_offset));
a61af66fc99e Initial load
duke
parents:
diff changeset
477 }
a61af66fc99e Initial load
duke
parents:
diff changeset
478 address displacement_address() const { return addr_at(displacement_offset); }
a61af66fc99e Initial load
duke
parents:
diff changeset
479 void set_destination(address dest);
a61af66fc99e Initial load
duke
parents:
diff changeset
480
a61af66fc99e Initial load
duke
parents:
diff changeset
481 bool destination_is_compiled_verified_entry_point();
a61af66fc99e Initial load
duke
parents:
diff changeset
482
a61af66fc99e Initial load
duke
parents:
diff changeset
483 void verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
484 void print();
a61af66fc99e Initial load
duke
parents:
diff changeset
485
a61af66fc99e Initial load
duke
parents:
diff changeset
486 // unit test stuff
a61af66fc99e Initial load
duke
parents:
diff changeset
487 static void test();
a61af66fc99e Initial load
duke
parents:
diff changeset
488
a61af66fc99e Initial load
duke
parents:
diff changeset
489 // Creation
a61af66fc99e Initial load
duke
parents:
diff changeset
490 friend inline NativeFarCall* nativeFarCall_at(address instr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
491 NativeFarCall* call = (NativeFarCall*)instr;
a61af66fc99e Initial load
duke
parents:
diff changeset
492 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
493 call->verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
494 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
495 return call;
a61af66fc99e Initial load
duke
parents:
diff changeset
496 }
a61af66fc99e Initial load
duke
parents:
diff changeset
497
a61af66fc99e Initial load
duke
parents:
diff changeset
498 friend inline NativeFarCall* nativeFarCall_overwriting_at(address instr, address destination = NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
499 Unimplemented();
a61af66fc99e Initial load
duke
parents:
diff changeset
500 NativeFarCall* call = (NativeFarCall*)instr;
a61af66fc99e Initial load
duke
parents:
diff changeset
501 return call;
a61af66fc99e Initial load
duke
parents:
diff changeset
502 }
a61af66fc99e Initial load
duke
parents:
diff changeset
503
a61af66fc99e Initial load
duke
parents:
diff changeset
504 friend NativeFarCall* nativeFarCall_before(address return_address) {
a61af66fc99e Initial load
duke
parents:
diff changeset
505 NativeFarCall* call = (NativeFarCall*)(return_address - return_address_offset);
a61af66fc99e Initial load
duke
parents:
diff changeset
506 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
507 call->verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
508 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
509 return call;
a61af66fc99e Initial load
duke
parents:
diff changeset
510 }
a61af66fc99e Initial load
duke
parents:
diff changeset
511
a61af66fc99e Initial load
duke
parents:
diff changeset
512 static bool is_call_at(address instr);
a61af66fc99e Initial load
duke
parents:
diff changeset
513
a61af66fc99e Initial load
duke
parents:
diff changeset
514 // MT-safe patching of a call instruction.
a61af66fc99e Initial load
duke
parents:
diff changeset
515 static void insert(address code_pos, address entry) {
a61af66fc99e Initial load
duke
parents:
diff changeset
516 (void)nativeFarCall_overwriting_at(code_pos, entry);
a61af66fc99e Initial load
duke
parents:
diff changeset
517 }
a61af66fc99e Initial load
duke
parents:
diff changeset
518 static void replace_mt_safe(address instr_addr, address code_buffer);
a61af66fc99e Initial load
duke
parents:
diff changeset
519 };
a61af66fc99e Initial load
duke
parents:
diff changeset
520
a61af66fc99e Initial load
duke
parents:
diff changeset
521 #endif // _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
522
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
523 // An interface for accessing/manipulating native set_metadata imm, reg instructions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
524 // (used to manipulate inlined data references, etc.)
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
525 // set_metadata imm, reg
0
a61af66fc99e Initial load
duke
parents:
diff changeset
526 // == sethi %hi22(imm), reg ; add reg, %lo10(imm), reg
a61af66fc99e Initial load
duke
parents:
diff changeset
527 class NativeMovConstReg;
a61af66fc99e Initial load
duke
parents:
diff changeset
528 inline NativeMovConstReg* nativeMovConstReg_at(address address);
a61af66fc99e Initial load
duke
parents:
diff changeset
529 class NativeMovConstReg: public NativeInstruction {
a61af66fc99e Initial load
duke
parents:
diff changeset
530 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
531 enum Sparc_specific_constants {
a61af66fc99e Initial load
duke
parents:
diff changeset
532 sethi_offset = 0,
a61af66fc99e Initial load
duke
parents:
diff changeset
533 #ifdef _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
534 add_offset = 7 * BytesPerInstWord,
a61af66fc99e Initial load
duke
parents:
diff changeset
535 instruction_size = 8 * BytesPerInstWord
a61af66fc99e Initial load
duke
parents:
diff changeset
536 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
537 add_offset = 4,
a61af66fc99e Initial load
duke
parents:
diff changeset
538 instruction_size = 8
a61af66fc99e Initial load
duke
parents:
diff changeset
539 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
540 };
a61af66fc99e Initial load
duke
parents:
diff changeset
541
a61af66fc99e Initial load
duke
parents:
diff changeset
542 address instruction_address() const { return addr_at(0); }
a61af66fc99e Initial load
duke
parents:
diff changeset
543 address next_instruction_address() const { return addr_at(instruction_size); }
a61af66fc99e Initial load
duke
parents:
diff changeset
544
a61af66fc99e Initial load
duke
parents:
diff changeset
545 // (The [set_]data accessor respects oop_type relocs also.)
a61af66fc99e Initial load
duke
parents:
diff changeset
546 intptr_t data() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
547 void set_data(intptr_t x);
a61af66fc99e Initial load
duke
parents:
diff changeset
548
a61af66fc99e Initial load
duke
parents:
diff changeset
549 // report the destination register
a61af66fc99e Initial load
duke
parents:
diff changeset
550 Register destination() { return inv_rd(long_at(sethi_offset)); }
a61af66fc99e Initial load
duke
parents:
diff changeset
551
a61af66fc99e Initial load
duke
parents:
diff changeset
552 void verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
553 void print();
a61af66fc99e Initial load
duke
parents:
diff changeset
554
a61af66fc99e Initial load
duke
parents:
diff changeset
555 // unit test stuff
a61af66fc99e Initial load
duke
parents:
diff changeset
556 static void test();
a61af66fc99e Initial load
duke
parents:
diff changeset
557
a61af66fc99e Initial load
duke
parents:
diff changeset
558 // Creation
a61af66fc99e Initial load
duke
parents:
diff changeset
559 friend inline NativeMovConstReg* nativeMovConstReg_at(address address) {
a61af66fc99e Initial load
duke
parents:
diff changeset
560 NativeMovConstReg* test = (NativeMovConstReg*)address;
a61af66fc99e Initial load
duke
parents:
diff changeset
561 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
562 test->verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
563 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
564 return test;
a61af66fc99e Initial load
duke
parents:
diff changeset
565 }
a61af66fc99e Initial load
duke
parents:
diff changeset
566
a61af66fc99e Initial load
duke
parents:
diff changeset
567
a61af66fc99e Initial load
duke
parents:
diff changeset
568 friend NativeMovConstReg* nativeMovConstReg_before(address address) {
a61af66fc99e Initial load
duke
parents:
diff changeset
569 NativeMovConstReg* test = (NativeMovConstReg*)(address - instruction_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
570 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
571 test->verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
572 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
573 return test;
a61af66fc99e Initial load
duke
parents:
diff changeset
574 }
a61af66fc99e Initial load
duke
parents:
diff changeset
575
a61af66fc99e Initial load
duke
parents:
diff changeset
576 };
a61af66fc99e Initial load
duke
parents:
diff changeset
577
a61af66fc99e Initial load
duke
parents:
diff changeset
578
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
579 // An interface for accessing/manipulating native set_metadata imm, reg instructions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
580 // (used to manipulate inlined data references, etc.)
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
581 // set_metadata imm, reg
0
a61af66fc99e Initial load
duke
parents:
diff changeset
582 // == sethi %hi22(imm), reg; nop; add reg, %lo10(imm), reg
a61af66fc99e Initial load
duke
parents:
diff changeset
583 //
a61af66fc99e Initial load
duke
parents:
diff changeset
584 // Note that it is identical to NativeMovConstReg with the exception of a nop between the
a61af66fc99e Initial load
duke
parents:
diff changeset
585 // sethi and the add. The nop is required to be in the delay slot of the call instruction
a61af66fc99e Initial load
duke
parents:
diff changeset
586 // which overwrites the sethi during patching.
a61af66fc99e Initial load
duke
parents:
diff changeset
587 class NativeMovConstRegPatching;
a61af66fc99e Initial load
duke
parents:
diff changeset
588 inline NativeMovConstRegPatching* nativeMovConstRegPatching_at(address address);class NativeMovConstRegPatching: public NativeInstruction {
a61af66fc99e Initial load
duke
parents:
diff changeset
589 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
590 enum Sparc_specific_constants {
a61af66fc99e Initial load
duke
parents:
diff changeset
591 sethi_offset = 0,
a61af66fc99e Initial load
duke
parents:
diff changeset
592 #ifdef _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
593 nop_offset = 7 * BytesPerInstWord,
a61af66fc99e Initial load
duke
parents:
diff changeset
594 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
595 nop_offset = sethi_offset + BytesPerInstWord,
a61af66fc99e Initial load
duke
parents:
diff changeset
596 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
597 add_offset = nop_offset + BytesPerInstWord,
a61af66fc99e Initial load
duke
parents:
diff changeset
598 instruction_size = add_offset + BytesPerInstWord
a61af66fc99e Initial load
duke
parents:
diff changeset
599 };
a61af66fc99e Initial load
duke
parents:
diff changeset
600
a61af66fc99e Initial load
duke
parents:
diff changeset
601 address instruction_address() const { return addr_at(0); }
a61af66fc99e Initial load
duke
parents:
diff changeset
602 address next_instruction_address() const { return addr_at(instruction_size); }
a61af66fc99e Initial load
duke
parents:
diff changeset
603
a61af66fc99e Initial load
duke
parents:
diff changeset
604 // (The [set_]data accessor respects oop_type relocs also.)
a61af66fc99e Initial load
duke
parents:
diff changeset
605 int data() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
606 void set_data(int x);
a61af66fc99e Initial load
duke
parents:
diff changeset
607
a61af66fc99e Initial load
duke
parents:
diff changeset
608 // report the destination register
a61af66fc99e Initial load
duke
parents:
diff changeset
609 Register destination() { return inv_rd(long_at(sethi_offset)); }
a61af66fc99e Initial load
duke
parents:
diff changeset
610
a61af66fc99e Initial load
duke
parents:
diff changeset
611 void verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
612 void print();
a61af66fc99e Initial load
duke
parents:
diff changeset
613
a61af66fc99e Initial load
duke
parents:
diff changeset
614 // unit test stuff
a61af66fc99e Initial load
duke
parents:
diff changeset
615 static void test();
a61af66fc99e Initial load
duke
parents:
diff changeset
616
a61af66fc99e Initial load
duke
parents:
diff changeset
617 // Creation
a61af66fc99e Initial load
duke
parents:
diff changeset
618 friend inline NativeMovConstRegPatching* nativeMovConstRegPatching_at(address address) {
a61af66fc99e Initial load
duke
parents:
diff changeset
619 NativeMovConstRegPatching* test = (NativeMovConstRegPatching*)address;
a61af66fc99e Initial load
duke
parents:
diff changeset
620 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
621 test->verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
622 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
623 return test;
a61af66fc99e Initial load
duke
parents:
diff changeset
624 }
a61af66fc99e Initial load
duke
parents:
diff changeset
625
a61af66fc99e Initial load
duke
parents:
diff changeset
626
a61af66fc99e Initial load
duke
parents:
diff changeset
627 friend NativeMovConstRegPatching* nativeMovConstRegPatching_before(address address) {
a61af66fc99e Initial load
duke
parents:
diff changeset
628 NativeMovConstRegPatching* test = (NativeMovConstRegPatching*)(address - instruction_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
629 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
630 test->verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
631 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
632 return test;
a61af66fc99e Initial load
duke
parents:
diff changeset
633 }
a61af66fc99e Initial load
duke
parents:
diff changeset
634
a61af66fc99e Initial load
duke
parents:
diff changeset
635 };
a61af66fc99e Initial load
duke
parents:
diff changeset
636
a61af66fc99e Initial load
duke
parents:
diff changeset
637
a61af66fc99e Initial load
duke
parents:
diff changeset
638 // An interface for accessing/manipulating native memory ops
a61af66fc99e Initial load
duke
parents:
diff changeset
639 // ld* [reg + offset], reg
a61af66fc99e Initial load
duke
parents:
diff changeset
640 // st* reg, [reg + offset]
a61af66fc99e Initial load
duke
parents:
diff changeset
641 // sethi %hi(imm), reg; add reg, %lo(imm), reg; ld* [reg1 + reg], reg2
a61af66fc99e Initial load
duke
parents:
diff changeset
642 // sethi %hi(imm), reg; add reg, %lo(imm), reg; st* reg2, [reg1 + reg]
a61af66fc99e Initial load
duke
parents:
diff changeset
643 // Ops covered: {lds,ldu,st}{w,b,h}, {ld,st}{d,x}
a61af66fc99e Initial load
duke
parents:
diff changeset
644 //
a61af66fc99e Initial load
duke
parents:
diff changeset
645 class NativeMovRegMem;
a61af66fc99e Initial load
duke
parents:
diff changeset
646 inline NativeMovRegMem* nativeMovRegMem_at (address address);
a61af66fc99e Initial load
duke
parents:
diff changeset
647 class NativeMovRegMem: public NativeInstruction {
a61af66fc99e Initial load
duke
parents:
diff changeset
648 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
649 enum Sparc_specific_constants {
a61af66fc99e Initial load
duke
parents:
diff changeset
650 op3_mask_ld = 1 << Assembler::lduw_op3 |
a61af66fc99e Initial load
duke
parents:
diff changeset
651 1 << Assembler::ldub_op3 |
a61af66fc99e Initial load
duke
parents:
diff changeset
652 1 << Assembler::lduh_op3 |
a61af66fc99e Initial load
duke
parents:
diff changeset
653 1 << Assembler::ldd_op3 |
a61af66fc99e Initial load
duke
parents:
diff changeset
654 1 << Assembler::ldsw_op3 |
a61af66fc99e Initial load
duke
parents:
diff changeset
655 1 << Assembler::ldsb_op3 |
a61af66fc99e Initial load
duke
parents:
diff changeset
656 1 << Assembler::ldsh_op3 |
a61af66fc99e Initial load
duke
parents:
diff changeset
657 1 << Assembler::ldx_op3,
a61af66fc99e Initial load
duke
parents:
diff changeset
658 op3_mask_st = 1 << Assembler::stw_op3 |
a61af66fc99e Initial load
duke
parents:
diff changeset
659 1 << Assembler::stb_op3 |
a61af66fc99e Initial load
duke
parents:
diff changeset
660 1 << Assembler::sth_op3 |
a61af66fc99e Initial load
duke
parents:
diff changeset
661 1 << Assembler::std_op3 |
a61af66fc99e Initial load
duke
parents:
diff changeset
662 1 << Assembler::stx_op3,
a61af66fc99e Initial load
duke
parents:
diff changeset
663 op3_ldst_int_limit = Assembler::ldf_op3,
a61af66fc99e Initial load
duke
parents:
diff changeset
664 op3_mask_ldf = 1 << (Assembler::ldf_op3 - op3_ldst_int_limit) |
a61af66fc99e Initial load
duke
parents:
diff changeset
665 1 << (Assembler::lddf_op3 - op3_ldst_int_limit),
a61af66fc99e Initial load
duke
parents:
diff changeset
666 op3_mask_stf = 1 << (Assembler::stf_op3 - op3_ldst_int_limit) |
a61af66fc99e Initial load
duke
parents:
diff changeset
667 1 << (Assembler::stdf_op3 - op3_ldst_int_limit),
a61af66fc99e Initial load
duke
parents:
diff changeset
668
a61af66fc99e Initial load
duke
parents:
diff changeset
669 offset_width = 13,
a61af66fc99e Initial load
duke
parents:
diff changeset
670 sethi_offset = 0,
a61af66fc99e Initial load
duke
parents:
diff changeset
671 #ifdef _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
672 add_offset = 7 * BytesPerInstWord,
a61af66fc99e Initial load
duke
parents:
diff changeset
673 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
674 add_offset = 4,
a61af66fc99e Initial load
duke
parents:
diff changeset
675 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
676 ldst_offset = add_offset + BytesPerInstWord
a61af66fc99e Initial load
duke
parents:
diff changeset
677 };
a61af66fc99e Initial load
duke
parents:
diff changeset
678 bool is_immediate() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
679 // check if instruction is ld* [reg + offset], reg or st* reg, [reg + offset]
a61af66fc99e Initial load
duke
parents:
diff changeset
680 int i0 = long_at(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
681 return (is_op(i0, Assembler::ldst_op));
a61af66fc99e Initial load
duke
parents:
diff changeset
682 }
a61af66fc99e Initial load
duke
parents:
diff changeset
683
a61af66fc99e Initial load
duke
parents:
diff changeset
684 address instruction_address() const { return addr_at(0); }
a61af66fc99e Initial load
duke
parents:
diff changeset
685 address next_instruction_address() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
686 #ifdef _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
687 return addr_at(is_immediate() ? 4 : (7 * BytesPerInstWord));
a61af66fc99e Initial load
duke
parents:
diff changeset
688 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
689 return addr_at(is_immediate() ? 4 : 12);
a61af66fc99e Initial load
duke
parents:
diff changeset
690 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
691 }
a61af66fc99e Initial load
duke
parents:
diff changeset
692 intptr_t offset() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
693 return is_immediate()? inv_simm(long_at(0), offset_width) :
a61af66fc99e Initial load
duke
parents:
diff changeset
694 nativeMovConstReg_at(addr_at(0))->data();
a61af66fc99e Initial load
duke
parents:
diff changeset
695 }
a61af66fc99e Initial load
duke
parents:
diff changeset
696 void set_offset(intptr_t x) {
a61af66fc99e Initial load
duke
parents:
diff changeset
697 if (is_immediate()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
698 guarantee(fits_in_simm(x, offset_width), "data block offset overflow");
a61af66fc99e Initial load
duke
parents:
diff changeset
699 set_long_at(0, set_simm(long_at(0), x, offset_width));
a61af66fc99e Initial load
duke
parents:
diff changeset
700 } else
a61af66fc99e Initial load
duke
parents:
diff changeset
701 nativeMovConstReg_at(addr_at(0))->set_data(x);
a61af66fc99e Initial load
duke
parents:
diff changeset
702 }
a61af66fc99e Initial load
duke
parents:
diff changeset
703
a61af66fc99e Initial load
duke
parents:
diff changeset
704 void add_offset_in_bytes(intptr_t radd_offset) {
a61af66fc99e Initial load
duke
parents:
diff changeset
705 set_offset (offset() + radd_offset);
a61af66fc99e Initial load
duke
parents:
diff changeset
706 }
a61af66fc99e Initial load
duke
parents:
diff changeset
707
a61af66fc99e Initial load
duke
parents:
diff changeset
708 void copy_instruction_to(address new_instruction_address);
a61af66fc99e Initial load
duke
parents:
diff changeset
709
a61af66fc99e Initial load
duke
parents:
diff changeset
710 void verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
711 void print ();
a61af66fc99e Initial load
duke
parents:
diff changeset
712
a61af66fc99e Initial load
duke
parents:
diff changeset
713 // unit test stuff
a61af66fc99e Initial load
duke
parents:
diff changeset
714 static void test();
a61af66fc99e Initial load
duke
parents:
diff changeset
715
a61af66fc99e Initial load
duke
parents:
diff changeset
716 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
717 friend inline NativeMovRegMem* nativeMovRegMem_at (address address) {
a61af66fc99e Initial load
duke
parents:
diff changeset
718 NativeMovRegMem* test = (NativeMovRegMem*)address;
a61af66fc99e Initial load
duke
parents:
diff changeset
719 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
720 test->verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
721 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
722 return test;
a61af66fc99e Initial load
duke
parents:
diff changeset
723 }
a61af66fc99e Initial load
duke
parents:
diff changeset
724 };
a61af66fc99e Initial load
duke
parents:
diff changeset
725
a61af66fc99e Initial load
duke
parents:
diff changeset
726
a61af66fc99e Initial load
duke
parents:
diff changeset
727 // An interface for accessing/manipulating native memory ops
a61af66fc99e Initial load
duke
parents:
diff changeset
728 // ld* [reg + offset], reg
a61af66fc99e Initial load
duke
parents:
diff changeset
729 // st* reg, [reg + offset]
a61af66fc99e Initial load
duke
parents:
diff changeset
730 // sethi %hi(imm), reg; nop; add reg, %lo(imm), reg; ld* [reg1 + reg], reg2
a61af66fc99e Initial load
duke
parents:
diff changeset
731 // sethi %hi(imm), reg; nop; add reg, %lo(imm), reg; st* reg2, [reg1 + reg]
a61af66fc99e Initial load
duke
parents:
diff changeset
732 // Ops covered: {lds,ldu,st}{w,b,h}, {ld,st}{d,x}
a61af66fc99e Initial load
duke
parents:
diff changeset
733 //
a61af66fc99e Initial load
duke
parents:
diff changeset
734 // Note that it is identical to NativeMovRegMem with the exception of a nop between the
a61af66fc99e Initial load
duke
parents:
diff changeset
735 // sethi and the add. The nop is required to be in the delay slot of the call instruction
a61af66fc99e Initial load
duke
parents:
diff changeset
736 // which overwrites the sethi during patching.
a61af66fc99e Initial load
duke
parents:
diff changeset
737 class NativeMovRegMemPatching;
a61af66fc99e Initial load
duke
parents:
diff changeset
738 inline NativeMovRegMemPatching* nativeMovRegMemPatching_at (address address);
a61af66fc99e Initial load
duke
parents:
diff changeset
739 class NativeMovRegMemPatching: public NativeInstruction {
a61af66fc99e Initial load
duke
parents:
diff changeset
740 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
741 enum Sparc_specific_constants {
a61af66fc99e Initial load
duke
parents:
diff changeset
742 op3_mask_ld = 1 << Assembler::lduw_op3 |
a61af66fc99e Initial load
duke
parents:
diff changeset
743 1 << Assembler::ldub_op3 |
a61af66fc99e Initial load
duke
parents:
diff changeset
744 1 << Assembler::lduh_op3 |
a61af66fc99e Initial load
duke
parents:
diff changeset
745 1 << Assembler::ldd_op3 |
a61af66fc99e Initial load
duke
parents:
diff changeset
746 1 << Assembler::ldsw_op3 |
a61af66fc99e Initial load
duke
parents:
diff changeset
747 1 << Assembler::ldsb_op3 |
a61af66fc99e Initial load
duke
parents:
diff changeset
748 1 << Assembler::ldsh_op3 |
a61af66fc99e Initial load
duke
parents:
diff changeset
749 1 << Assembler::ldx_op3,
a61af66fc99e Initial load
duke
parents:
diff changeset
750 op3_mask_st = 1 << Assembler::stw_op3 |
a61af66fc99e Initial load
duke
parents:
diff changeset
751 1 << Assembler::stb_op3 |
a61af66fc99e Initial load
duke
parents:
diff changeset
752 1 << Assembler::sth_op3 |
a61af66fc99e Initial load
duke
parents:
diff changeset
753 1 << Assembler::std_op3 |
a61af66fc99e Initial load
duke
parents:
diff changeset
754 1 << Assembler::stx_op3,
a61af66fc99e Initial load
duke
parents:
diff changeset
755 op3_ldst_int_limit = Assembler::ldf_op3,
a61af66fc99e Initial load
duke
parents:
diff changeset
756 op3_mask_ldf = 1 << (Assembler::ldf_op3 - op3_ldst_int_limit) |
a61af66fc99e Initial load
duke
parents:
diff changeset
757 1 << (Assembler::lddf_op3 - op3_ldst_int_limit),
a61af66fc99e Initial load
duke
parents:
diff changeset
758 op3_mask_stf = 1 << (Assembler::stf_op3 - op3_ldst_int_limit) |
a61af66fc99e Initial load
duke
parents:
diff changeset
759 1 << (Assembler::stdf_op3 - op3_ldst_int_limit),
a61af66fc99e Initial load
duke
parents:
diff changeset
760
a61af66fc99e Initial load
duke
parents:
diff changeset
761 offset_width = 13,
a61af66fc99e Initial load
duke
parents:
diff changeset
762 sethi_offset = 0,
a61af66fc99e Initial load
duke
parents:
diff changeset
763 #ifdef _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
764 nop_offset = 7 * BytesPerInstWord,
a61af66fc99e Initial load
duke
parents:
diff changeset
765 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
766 nop_offset = 4,
a61af66fc99e Initial load
duke
parents:
diff changeset
767 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
768 add_offset = nop_offset + BytesPerInstWord,
a61af66fc99e Initial load
duke
parents:
diff changeset
769 ldst_offset = add_offset + BytesPerInstWord
a61af66fc99e Initial load
duke
parents:
diff changeset
770 };
a61af66fc99e Initial load
duke
parents:
diff changeset
771 bool is_immediate() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
772 // check if instruction is ld* [reg + offset], reg or st* reg, [reg + offset]
a61af66fc99e Initial load
duke
parents:
diff changeset
773 int i0 = long_at(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
774 return (is_op(i0, Assembler::ldst_op));
a61af66fc99e Initial load
duke
parents:
diff changeset
775 }
a61af66fc99e Initial load
duke
parents:
diff changeset
776
a61af66fc99e Initial load
duke
parents:
diff changeset
777 address instruction_address() const { return addr_at(0); }
a61af66fc99e Initial load
duke
parents:
diff changeset
778 address next_instruction_address() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
779 return addr_at(is_immediate()? 4 : 16);
a61af66fc99e Initial load
duke
parents:
diff changeset
780 }
a61af66fc99e Initial load
duke
parents:
diff changeset
781 int offset() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
782 return is_immediate()? inv_simm(long_at(0), offset_width) :
a61af66fc99e Initial load
duke
parents:
diff changeset
783 nativeMovConstRegPatching_at(addr_at(0))->data();
a61af66fc99e Initial load
duke
parents:
diff changeset
784 }
a61af66fc99e Initial load
duke
parents:
diff changeset
785 void set_offset(int x) {
a61af66fc99e Initial load
duke
parents:
diff changeset
786 if (is_immediate()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
787 guarantee(fits_in_simm(x, offset_width), "data block offset overflow");
a61af66fc99e Initial load
duke
parents:
diff changeset
788 set_long_at(0, set_simm(long_at(0), x, offset_width));
a61af66fc99e Initial load
duke
parents:
diff changeset
789 }
a61af66fc99e Initial load
duke
parents:
diff changeset
790 else
a61af66fc99e Initial load
duke
parents:
diff changeset
791 nativeMovConstRegPatching_at(addr_at(0))->set_data(x);
a61af66fc99e Initial load
duke
parents:
diff changeset
792 }
a61af66fc99e Initial load
duke
parents:
diff changeset
793
a61af66fc99e Initial load
duke
parents:
diff changeset
794 void add_offset_in_bytes(intptr_t radd_offset) {
a61af66fc99e Initial load
duke
parents:
diff changeset
795 set_offset (offset() + radd_offset);
a61af66fc99e Initial load
duke
parents:
diff changeset
796 }
a61af66fc99e Initial load
duke
parents:
diff changeset
797
a61af66fc99e Initial load
duke
parents:
diff changeset
798 void copy_instruction_to(address new_instruction_address);
a61af66fc99e Initial load
duke
parents:
diff changeset
799
a61af66fc99e Initial load
duke
parents:
diff changeset
800 void verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
801 void print ();
a61af66fc99e Initial load
duke
parents:
diff changeset
802
a61af66fc99e Initial load
duke
parents:
diff changeset
803 // unit test stuff
a61af66fc99e Initial load
duke
parents:
diff changeset
804 static void test();
a61af66fc99e Initial load
duke
parents:
diff changeset
805
a61af66fc99e Initial load
duke
parents:
diff changeset
806 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
807 friend inline NativeMovRegMemPatching* nativeMovRegMemPatching_at (address address) {
a61af66fc99e Initial load
duke
parents:
diff changeset
808 NativeMovRegMemPatching* test = (NativeMovRegMemPatching*)address;
a61af66fc99e Initial load
duke
parents:
diff changeset
809 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
810 test->verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
811 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
812 return test;
a61af66fc99e Initial load
duke
parents:
diff changeset
813 }
a61af66fc99e Initial load
duke
parents:
diff changeset
814 };
a61af66fc99e Initial load
duke
parents:
diff changeset
815
a61af66fc99e Initial load
duke
parents:
diff changeset
816
a61af66fc99e Initial load
duke
parents:
diff changeset
817 // An interface for accessing/manipulating native jumps
a61af66fc99e Initial load
duke
parents:
diff changeset
818 // jump_to addr
a61af66fc99e Initial load
duke
parents:
diff changeset
819 // == sethi %hi22(addr), temp ; jumpl reg, %lo10(addr), G0 ; <delay>
a61af66fc99e Initial load
duke
parents:
diff changeset
820 // jumpl_to addr, lreg
a61af66fc99e Initial load
duke
parents:
diff changeset
821 // == sethi %hi22(addr), temp ; jumpl reg, %lo10(addr), lreg ; <delay>
a61af66fc99e Initial load
duke
parents:
diff changeset
822 class NativeJump;
a61af66fc99e Initial load
duke
parents:
diff changeset
823 inline NativeJump* nativeJump_at(address address);
a61af66fc99e Initial load
duke
parents:
diff changeset
824 class NativeJump: public NativeInstruction {
a61af66fc99e Initial load
duke
parents:
diff changeset
825 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
826 void guarantee_displacement(int disp, int width) {
a61af66fc99e Initial load
duke
parents:
diff changeset
827 guarantee(fits_in_simm(disp, width + 2), "branch displacement overflow");
a61af66fc99e Initial load
duke
parents:
diff changeset
828 }
a61af66fc99e Initial load
duke
parents:
diff changeset
829
a61af66fc99e Initial load
duke
parents:
diff changeset
830 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
831 enum Sparc_specific_constants {
a61af66fc99e Initial load
duke
parents:
diff changeset
832 sethi_offset = 0,
a61af66fc99e Initial load
duke
parents:
diff changeset
833 #ifdef _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
834 jmpl_offset = 7 * BytesPerInstWord,
a61af66fc99e Initial load
duke
parents:
diff changeset
835 instruction_size = 9 * BytesPerInstWord // includes delay slot
a61af66fc99e Initial load
duke
parents:
diff changeset
836 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
837 jmpl_offset = 1 * BytesPerInstWord,
a61af66fc99e Initial load
duke
parents:
diff changeset
838 instruction_size = 3 * BytesPerInstWord // includes delay slot
a61af66fc99e Initial load
duke
parents:
diff changeset
839 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
840 };
a61af66fc99e Initial load
duke
parents:
diff changeset
841
a61af66fc99e Initial load
duke
parents:
diff changeset
842 address instruction_address() const { return addr_at(0); }
a61af66fc99e Initial load
duke
parents:
diff changeset
843 address next_instruction_address() const { return addr_at(instruction_size); }
a61af66fc99e Initial load
duke
parents:
diff changeset
844
a61af66fc99e Initial load
duke
parents:
diff changeset
845 #ifdef _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
846 address jump_destination() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
847 return (address) data64(instruction_address(), long_at(jmpl_offset));
a61af66fc99e Initial load
duke
parents:
diff changeset
848 }
a61af66fc99e Initial load
duke
parents:
diff changeset
849 void set_jump_destination(address dest) {
a61af66fc99e Initial load
duke
parents:
diff changeset
850 set_data64_sethi( instruction_address(), (intptr_t)dest);
a61af66fc99e Initial load
duke
parents:
diff changeset
851 set_long_at(jmpl_offset, set_data32_simm13( long_at(jmpl_offset), (intptr_t)dest));
a61af66fc99e Initial load
duke
parents:
diff changeset
852 }
a61af66fc99e Initial load
duke
parents:
diff changeset
853 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
854 address jump_destination() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
855 return (address) data32(long_at(sethi_offset), long_at(jmpl_offset));
a61af66fc99e Initial load
duke
parents:
diff changeset
856 }
a61af66fc99e Initial load
duke
parents:
diff changeset
857 void set_jump_destination(address dest) {
a61af66fc99e Initial load
duke
parents:
diff changeset
858 set_long_at(sethi_offset, set_data32_sethi( long_at(sethi_offset), (intptr_t)dest));
a61af66fc99e Initial load
duke
parents:
diff changeset
859 set_long_at(jmpl_offset, set_data32_simm13( long_at(jmpl_offset), (intptr_t)dest));
a61af66fc99e Initial load
duke
parents:
diff changeset
860 }
a61af66fc99e Initial load
duke
parents:
diff changeset
861 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
862
a61af66fc99e Initial load
duke
parents:
diff changeset
863 // Creation
a61af66fc99e Initial load
duke
parents:
diff changeset
864 friend inline NativeJump* nativeJump_at(address address) {
a61af66fc99e Initial load
duke
parents:
diff changeset
865 NativeJump* jump = (NativeJump*)address;
a61af66fc99e Initial load
duke
parents:
diff changeset
866 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
867 jump->verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
868 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
869 return jump;
a61af66fc99e Initial load
duke
parents:
diff changeset
870 }
a61af66fc99e Initial load
duke
parents:
diff changeset
871
a61af66fc99e Initial load
duke
parents:
diff changeset
872 void verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
873 void print();
a61af66fc99e Initial load
duke
parents:
diff changeset
874
a61af66fc99e Initial load
duke
parents:
diff changeset
875 // Unit testing stuff
a61af66fc99e Initial load
duke
parents:
diff changeset
876 static void test();
a61af66fc99e Initial load
duke
parents:
diff changeset
877
a61af66fc99e Initial load
duke
parents:
diff changeset
878 // Insertion of native jump instruction
a61af66fc99e Initial load
duke
parents:
diff changeset
879 static void insert(address code_pos, address entry);
a61af66fc99e Initial load
duke
parents:
diff changeset
880 // MT-safe insertion of native jump at verified method entry
a61af66fc99e Initial load
duke
parents:
diff changeset
881 static void check_verified_entry_alignment(address entry, address verified_entry) {
a61af66fc99e Initial load
duke
parents:
diff changeset
882 // nothing to do for sparc.
a61af66fc99e Initial load
duke
parents:
diff changeset
883 }
a61af66fc99e Initial load
duke
parents:
diff changeset
884 static void patch_verified_entry(address entry, address verified_entry, address dest);
a61af66fc99e Initial load
duke
parents:
diff changeset
885 };
a61af66fc99e Initial load
duke
parents:
diff changeset
886
a61af66fc99e Initial load
duke
parents:
diff changeset
887
a61af66fc99e Initial load
duke
parents:
diff changeset
888
a61af66fc99e Initial load
duke
parents:
diff changeset
889 // Despite the name, handles only simple branches.
a61af66fc99e Initial load
duke
parents:
diff changeset
890 class NativeGeneralJump;
a61af66fc99e Initial load
duke
parents:
diff changeset
891 inline NativeGeneralJump* nativeGeneralJump_at(address address);
a61af66fc99e Initial load
duke
parents:
diff changeset
892 class NativeGeneralJump: public NativeInstruction {
a61af66fc99e Initial load
duke
parents:
diff changeset
893 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
894 enum Sparc_specific_constants {
a61af66fc99e Initial load
duke
parents:
diff changeset
895 instruction_size = 8
a61af66fc99e Initial load
duke
parents:
diff changeset
896 };
a61af66fc99e Initial load
duke
parents:
diff changeset
897
a61af66fc99e Initial load
duke
parents:
diff changeset
898 address instruction_address() const { return addr_at(0); }
a61af66fc99e Initial load
duke
parents:
diff changeset
899 address jump_destination() const { return addr_at(0) + branch_destination_offset(long_at(0)); }
a61af66fc99e Initial load
duke
parents:
diff changeset
900 void set_jump_destination(address dest) {
a61af66fc99e Initial load
duke
parents:
diff changeset
901 int patched_instr = patch_branch_destination_offset(dest - addr_at(0), long_at(0));
a61af66fc99e Initial load
duke
parents:
diff changeset
902 set_long_at(0, patched_instr);
a61af66fc99e Initial load
duke
parents:
diff changeset
903 }
a61af66fc99e Initial load
duke
parents:
diff changeset
904 NativeInstruction *delay_slot_instr() { return nativeInstruction_at(addr_at(4));}
a61af66fc99e Initial load
duke
parents:
diff changeset
905 void fill_delay_slot(int instr) { set_long_at(4, instr);}
a61af66fc99e Initial load
duke
parents:
diff changeset
906 Assembler::Condition condition() {
a61af66fc99e Initial load
duke
parents:
diff changeset
907 int x = long_at(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
908 return (Assembler::Condition) Assembler::inv_cond(x);
a61af66fc99e Initial load
duke
parents:
diff changeset
909 }
a61af66fc99e Initial load
duke
parents:
diff changeset
910
a61af66fc99e Initial load
duke
parents:
diff changeset
911 // Creation
a61af66fc99e Initial load
duke
parents:
diff changeset
912 friend inline NativeGeneralJump* nativeGeneralJump_at(address address) {
a61af66fc99e Initial load
duke
parents:
diff changeset
913 NativeGeneralJump* jump = (NativeGeneralJump*)(address);
a61af66fc99e Initial load
duke
parents:
diff changeset
914 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
915 jump->verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
916 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
917 return jump;
a61af66fc99e Initial load
duke
parents:
diff changeset
918 }
a61af66fc99e Initial load
duke
parents:
diff changeset
919
a61af66fc99e Initial load
duke
parents:
diff changeset
920 // Insertion of native general jump instruction
a61af66fc99e Initial load
duke
parents:
diff changeset
921 static void insert_unconditional(address code_pos, address entry);
a61af66fc99e Initial load
duke
parents:
diff changeset
922 static void replace_mt_safe(address instr_addr, address code_buffer);
a61af66fc99e Initial load
duke
parents:
diff changeset
923
a61af66fc99e Initial load
duke
parents:
diff changeset
924 void verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
925 };
a61af66fc99e Initial load
duke
parents:
diff changeset
926
a61af66fc99e Initial load
duke
parents:
diff changeset
927
a61af66fc99e Initial load
duke
parents:
diff changeset
928 class NativeIllegalInstruction: public NativeInstruction {
a61af66fc99e Initial load
duke
parents:
diff changeset
929 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
930 enum Sparc_specific_constants {
a61af66fc99e Initial load
duke
parents:
diff changeset
931 instruction_size = 4
a61af66fc99e Initial load
duke
parents:
diff changeset
932 };
a61af66fc99e Initial load
duke
parents:
diff changeset
933
a61af66fc99e Initial load
duke
parents:
diff changeset
934 // Insert illegal opcode as specific address
a61af66fc99e Initial load
duke
parents:
diff changeset
935 static void insert(address code_pos);
a61af66fc99e Initial load
duke
parents:
diff changeset
936 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
937
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
938 #endif // CPU_SPARC_VM_NATIVEINST_SPARC_HPP