Print this page
Split |
Close |
Expand all |
Collapse all |
--- old/src/cpu/sparc/vm/interp_masm_sparc.hpp
+++ new/src/cpu/sparc/vm/interp_masm_sparc.hpp
1 1 /*
2 - * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
2 + * Copyright 1997-2010 Sun Microsystems, Inc. All Rights Reserved.
3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 4 *
5 5 * This code is free software; you can redistribute it and/or modify it
6 6 * under the terms of the GNU General Public License version 2 only, as
7 7 * published by the Free Software Foundation.
8 8 *
9 9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 12 * version 2 for more details (a copy is included in the LICENSE file that
13 13 * accompanied this code).
14 14 *
15 15 * You should have received a copy of the GNU General Public License version
16 16 * 2 along with this work; if not, write to the Free Software Foundation,
17 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 18 *
19 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 21 * have any questions.
22 22 *
23 23 */
24 24
25 25 // This file specializes the assember with interpreter-specific macros
26 26
27 27 REGISTER_DECLARATION( Register, Otos_i , O0); // tos for ints, etc
28 28 REGISTER_DECLARATION( Register, Otos_l , O0); // for longs
29 29 REGISTER_DECLARATION( Register, Otos_l1, O0); // for 1st part of longs
30 30 REGISTER_DECLARATION( Register, Otos_l2, O1); // for 2nd part of longs
31 31 REGISTER_DECLARATION(FloatRegister, Ftos_f , F0); // for floats
32 32 REGISTER_DECLARATION(FloatRegister, Ftos_d , F0); // for doubles
33 33 REGISTER_DECLARATION(FloatRegister, Ftos_d1, F0); // for 1st part of double
34 34 REGISTER_DECLARATION(FloatRegister, Ftos_d2, F1); // for 2nd part of double
35 35
36 36 #ifndef DONT_USE_REGISTER_DEFINES
37 37 #define Otos_i O0
38 38 #define Otos_l O0
39 39 #define Otos_l1 O0
40 40 #define Otos_l2 O1
41 41 #define Ftos_f F0
42 42 #define Ftos_d F0
43 43 #define Ftos_d1 F0
44 44 #define Ftos_d2 F1
45 45 #endif // DONT_USE_REGISTER_DEFINES
46 46
47 47 class InterpreterMacroAssembler: public MacroAssembler {
48 48 protected:
49 49 #ifndef CC_INTERP
50 50 // Interpreter specific version of call_VM_base
51 51 virtual void call_VM_leaf_base(
52 52 Register java_thread,
53 53 address entry_point,
54 54 int number_of_arguments
55 55 );
56 56
57 57 virtual void call_VM_base(
58 58 Register oop_result,
59 59 Register java_thread,
60 60 Register last_java_sp,
61 61 address entry_point,
62 62 int number_of_arguments,
63 63 bool check_exception=true
64 64 );
65 65
66 66 virtual void check_and_handle_popframe(Register java_thread);
67 67 virtual void check_and_handle_earlyret(Register java_thread);
68 68
69 69 // base routine for all dispatches
70 70 void dispatch_base(TosState state, address* table);
71 71 #endif /* CC_INTERP */
72 72
73 73 public:
74 74 InterpreterMacroAssembler(CodeBuffer* c)
75 75 : MacroAssembler(c) {}
76 76
77 77 #ifndef CC_INTERP
78 78 virtual void load_earlyret_value(TosState state);
79 79
80 80 static const Address l_tmp ;
81 81 static const Address d_tmp ;
82 82 #endif /* CC_INTERP */
83 83
84 84 // helper routine for frame allocation/deallocation
85 85 // compute the delta by which the caller's SP has to
86 86 // be adjusted to accomodate for the non-argument
87 87 // locals
88 88 void compute_extra_locals_size_in_bytes(Register args_size, Register locals_size, Register delta);
89 89
90 90 #ifndef CC_INTERP
91 91
92 92 // dispatch routines
93 93 void dispatch_prolog(TosState state, int step = 0);
94 94 void dispatch_epilog(TosState state, int step = 0);
95 95 void dispatch_only(TosState state);
96 96 void dispatch_normal(TosState state);
97 97 void dispatch_next(TosState state, int step = 0);
98 98 void dispatch_next_noverify_oop(TosState state, int step = 0);
99 99 void dispatch_via (TosState state, address* table);
100 100
101 101
102 102 // Removes the current activation (incl. unlocking of monitors).
103 103 // Additionally this code is used for earlyReturn in which case we
104 104 // want to skip throwing an exception and installing an exception.
105 105 void remove_activation(TosState state,
106 106 bool throw_monitor_exception = true,
107 107 bool install_monitor_exception = true);
108 108
109 109 protected:
110 110 void dispatch_Lbyte_code(TosState state, address* table, int bcp_incr = 0, bool verify = true);
111 111 #endif /* CC_INTERP */
112 112
113 113 public:
↓ open down ↓ |
101 lines elided |
↑ open up ↑ |
114 114 // Super call_VM calls - correspond to MacroAssembler::call_VM(_leaf) calls
115 115 void super_call_VM(Register thread_cache,
116 116 Register oop_result,
117 117 Register last_java_sp,
118 118 address entry_point,
119 119 Register arg_1,
120 120 Register arg_2,
121 121 bool check_exception = true);
122 122
123 123 #ifndef CC_INTERP
124 - void super_call_VM_leaf(Register thread_cache, address entry_point, Register arg_1);
124 + void super_call_VM_leaf(Register thread_cache, address entry_point, Register arg_1, Register arg_2);
125 125
126 126 // Generate a subtype check: branch to ok_is_subtype if sub_klass is
127 127 // a subtype of super_klass. Blows registers tmp1, tmp2 and tmp3.
128 128 void gen_subtype_check( Register sub_klass, Register super_klass, Register tmp1, Register tmp2, Register tmp3, Label &ok_is_subtype );
129 129
130 130 // helpers for tossing exceptions
131 131 void throw_if_not_1_icc( Condition ok_condition, Label& ok );
132 132 void throw_if_not_1_xcc( Condition ok_condition, Label& ok );
133 133 void throw_if_not_1_x ( Condition ok_condition, Label& ok ); // chooses icc or xcc based on _LP64
134 134
135 135 void throw_if_not_2( address throw_entry_point, Register Rscratch, Label& ok);
136 136
137 137 void throw_if_not_icc( Condition ok_condition, address throw_entry_point, Register Rscratch );
138 138 void throw_if_not_xcc( Condition ok_condition, address throw_entry_point, Register Rscratch );
139 139 void throw_if_not_x ( Condition ok_condition, address throw_entry_point, Register Rscratch );
140 140
141 141 // helpers for expression stack
142 142
143 143 void pop_i( Register r = Otos_i);
144 144 void pop_ptr( Register r = Otos_i, Register scratch = O4);
145 145 void pop_l( Register r = Otos_l1);
146 146 // G4_scratch and Lscratch are used at call sites!!
147 147 void pop_f(FloatRegister f = Ftos_f, Register scratch = G1_scratch);
148 148 void pop_d(FloatRegister f = Ftos_d1, Register scratch = G1_scratch);
149 149
150 150 void push_i( Register r = Otos_i);
151 151 void push_ptr( Register r = Otos_i);
152 152 void push_ptr( Register r, Register tag);
153 153 void push_l( Register r = Otos_l1);
154 154 void push_f(FloatRegister f = Ftos_f);
155 155 void push_d(FloatRegister f = Ftos_d1);
156 156
157 157
158 158 void pop (TosState state); // transition vtos -> state
159 159 void push(TosState state); // transition state -> vtos
160 160 void empty_expression_stack(); // resets both Lesp and SP
161 161
162 162 // Support for Tagged Stacks
163 163 void tag_stack(frame::Tag t, Register r);
164 164 void tag_stack(Register tag);
165 165 void tag_local(frame::Tag t, Register src, Register base, int n = 0);
166 166
167 167 #ifdef ASSERT
168 168 void verify_sp(Register Rsp, Register Rtemp);
169 169 void verify_esp(Register Resp); // verify that Lesp points to a word in the temp stack
170 170
171 171 void verify_stack_tag(frame::Tag t, Register r, Register scratch = G0);
172 172 void verify_local_tag(frame::Tag t, Register base, Register scr, int n = 0);
173 173 #endif // ASSERT
174 174
175 175 public:
176 176 void if_cmp(Condition cc, bool ptr_compare);
177 177
178 178 // Load values from bytecode stream:
179 179
180 180 enum signedOrNot { Signed, Unsigned };
181 181 enum setCCOrNot { set_CC, dont_set_CC };
182 182
183 183 void get_2_byte_integer_at_bcp( int bcp_offset,
184 184 Register Rtmp,
185 185 Register Rdst,
186 186 signedOrNot is_signed,
187 187 setCCOrNot should_set_CC = dont_set_CC );
188 188
189 189 void get_4_byte_integer_at_bcp( int bcp_offset,
190 190 Register Rtmp,
191 191 Register Rdst,
192 192 setCCOrNot should_set_CC = dont_set_CC );
193 193
194 194 void get_cache_and_index_at_bcp(Register cache, Register tmp, int bcp_offset);
195 195 void get_cache_entry_pointer_at_bcp(Register cache, Register tmp, int bcp_offset);
196 196
197 197
198 198 // common code
199 199
200 200 void field_offset_at(int n, Register tmp, Register dest, Register base);
201 201 int field_offset_at(Register object, address bcp, int offset);
202 202 void fast_iaaccess(int n, address bcp);
203 203 void fast_iagetfield(address bcp);
204 204 void fast_iaputfield(address bcp, bool do_store_check );
205 205
206 206 void index_check(Register array, Register index, int index_shift, Register tmp, Register res);
207 207 void index_check_without_pop(Register array, Register index, int index_shift, Register tmp, Register res);
208 208
209 209 void get_constant_pool(Register Rdst);
210 210 void get_constant_pool_cache(Register Rdst);
211 211 void get_cpool_and_tags(Register Rcpool, Register Rtags);
212 212 void is_a(Label& L);
213 213
214 214 // Load compiled (i2c) or interpreter entry and call from interpreted
215 215 void call_from_interpreter(Register target, Register scratch, Register Rret);
216 216
217 217 // --------------------------------------------------
218 218
219 219 void unlock_if_synchronized_method(TosState state, bool throw_monitor_exception = true, bool install_monitor_exception = true);
220 220
221 221 void add_monitor_to_stack( bool stack_is_empty,
222 222 Register Rtemp,
223 223 Register Rtemp2 );
224 224
225 225 // Load/store aligned in _LP64 but unaligned otherwise
226 226 // These only apply to the Interpreter expression stack and locals!
227 227 void load_unaligned_double(Register r1, int offset, FloatRegister d);
228 228 void store_unaligned_double(FloatRegister d, Register r1, int offset );
229 229
230 230 // Load/store aligned in _LP64 but unaligned otherwise
231 231 void load_unaligned_long(Register r1, int offset, Register d);
232 232 void store_unaligned_long(Register d, Register r1, int offset );
233 233
234 234 void access_local_int( Register index, Register dst );
235 235 void access_local_ptr( Register index, Register dst );
236 236 void access_local_returnAddress( Register index, Register dst );
237 237 void access_local_long( Register index, Register dst );
238 238 void access_local_float( Register index, FloatRegister dst );
239 239 void access_local_double( Register index, FloatRegister dst );
240 240 #ifdef ASSERT
241 241 void check_for_regarea_stomp( Register Rindex, int offset, Register Rlimit, Register Rscratch, Register Rscratch1);
242 242 #endif // ASSERT
243 243 void store_local_int( Register index, Register src );
244 244 void store_local_ptr( Register index, Register src, Register tag = Otos_l2 );
245 245 void store_local_ptr( int n, Register src, Register tag = Otos_l2 );
246 246 void store_local_long( Register index, Register src );
247 247 void store_local_float( Register index, FloatRegister src );
248 248 void store_local_double( Register index, FloatRegister src );
249 249
250 250 // Tagged stack helpers for swap and dup
251 251 void load_ptr_and_tag(int n, Register val, Register tag);
252 252 void store_ptr_and_tag(int n, Register val, Register tag);
253 253
254 254 // Tagged stack helper for getting receiver in register.
255 255 void load_receiver(Register param_count, Register recv);
256 256
257 257 static int top_most_monitor_byte_offset(); // offset in bytes to top of monitor block
258 258 Address top_most_monitor();
259 259 void compute_stack_base( Register Rdest );
260 260
261 261 #endif /* CC_INTERP */
262 262 void increment_invocation_counter( Register Rtmp, Register Rtmp2 );
263 263 void increment_backedge_counter( Register Rtmp, Register Rtmp2 );
264 264 #ifndef CC_INTERP
265 265 void test_backedge_count_for_osr( Register backedge_count, Register branch_bcp, Register Rtmp );
266 266
267 267 #endif /* CC_INTERP */
268 268 // Object locking
269 269 void lock_object (Register lock_reg, Register obj_reg);
270 270 void unlock_object(Register lock_reg);
271 271
272 272 #ifndef CC_INTERP
273 273 // Interpreter profiling operations
274 274 void set_method_data_pointer() { set_method_data_pointer_offset(noreg); }
275 275 void set_method_data_pointer_for_bcp();
276 276 void set_method_data_pointer_offset(Register mdi_reg);
277 277 void test_method_data_pointer(Label& zero_continue);
278 278 void verify_method_data_pointer();
279 279 void test_invocation_counter_for_mdp(Register invocation_count, Register cur_bcp, Register Rtmp, Label &profile_continue);
280 280
281 281 void set_mdp_data_at(int constant, Register value);
282 282 void increment_mdp_data_at(Address counter, Register bumped_count,
283 283 bool decrement = false);
284 284 void increment_mdp_data_at(int constant, Register bumped_count,
285 285 bool decrement = false);
286 286 void increment_mdp_data_at(Register reg, int constant,
287 287 Register bumped_count, Register scratch2,
288 288 bool decrement = false);
289 289 void set_mdp_flag_at(int flag_constant, Register scratch);
290 290 void test_mdp_data_at(int offset, Register value, Label& not_equal_continue,
291 291 Register scratch);
292 292
293 293 void record_klass_in_profile(Register receiver, Register scratch, bool is_virtual_call);
294 294 void record_klass_in_profile_helper(Register receiver, Register scratch,
295 295 int start_row, Label& done, bool is_virtual_call);
296 296
297 297 void update_mdp_by_offset(int offset_of_disp, Register scratch);
298 298 void update_mdp_by_offset(Register reg, int offset_of_disp,
299 299 Register scratch);
300 300 void update_mdp_by_constant(int constant);
301 301 void update_mdp_for_ret(TosState state, Register return_bci);
302 302
303 303 void profile_taken_branch(Register scratch, Register bumped_count);
304 304 void profile_not_taken_branch(Register scratch);
305 305 void profile_call(Register scratch);
306 306 void profile_final_call(Register scratch);
307 307 void profile_virtual_call(Register receiver, Register scratch);
308 308 void profile_ret(TosState state, Register return_bci, Register scratch);
309 309 void profile_null_seen(Register scratch);
310 310 void profile_typecheck(Register klass, Register scratch);
311 311 void profile_typecheck_failed(Register scratch);
312 312 void profile_switch_default(Register scratch);
313 313 void profile_switch_case(Register index,
314 314 Register scratch1,
315 315 Register scratch2,
316 316 Register scratch3);
317 317
318 318 // Debugging
319 319 void interp_verify_oop(Register reg, TosState state, const char * file, int line); // only if +VerifyOops && state == atos
320 320 void verify_oop_or_return_address(Register reg, Register rtmp); // for astore
321 321 void verify_FPU(int stack_depth, TosState state = ftos); // only if +VerifyFPU && (state == ftos || state == dtos)
322 322
323 323 #endif /* CC_INTERP */
324 324 // support for JVMTI/Dtrace
325 325 typedef enum { NotifyJVMTI, SkipNotifyJVMTI } NotifyMethodExitMode;
326 326 void notify_method_entry();
327 327 void notify_method_exit(
328 328 bool save_result, TosState state, NotifyMethodExitMode mode);
329 329
330 330 void save_return_value(TosState state, bool is_native_call);
331 331 void restore_return_value(TosState state, bool is_native_call);
332 332 };
↓ open down ↓ |
198 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX