Mercurial > hg > graal-compiler
annotate src/cpu/sparc/vm/interp_masm_sparc.hpp @ 20143:3424e06e4951
Merge.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 02 Apr 2015 16:56:27 +0200 |
parents | 52b4284cb496 |
children |
rev | line source |
---|---|
0 | 1 /* |
10105
aeaca88565e6
8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
7204
diff
changeset
|
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1506
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1506
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:
1506
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef CPU_SPARC_VM_INTERP_MASM_SPARC_HPP |
26 #define CPU_SPARC_VM_INTERP_MASM_SPARC_HPP | |
27 | |
7204
f0c2369fda5a
8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
6725
diff
changeset
|
28 #include "asm/macroAssembler.inline.hpp" |
1972 | 29 #include "interpreter/invocationCounter.hpp" |
30 | |
0 | 31 // This file specializes the assember with interpreter-specific macros |
32 | |
10458 | 33 typedef ByteSize (*OffsetFunction)(uint); |
34 | |
0 | 35 REGISTER_DECLARATION( Register, Otos_i , O0); // tos for ints, etc |
36 REGISTER_DECLARATION( Register, Otos_l , O0); // for longs | |
37 REGISTER_DECLARATION( Register, Otos_l1, O0); // for 1st part of longs | |
38 REGISTER_DECLARATION( Register, Otos_l2, O1); // for 2nd part of longs | |
39 REGISTER_DECLARATION(FloatRegister, Ftos_f , F0); // for floats | |
40 REGISTER_DECLARATION(FloatRegister, Ftos_d , F0); // for doubles | |
41 REGISTER_DECLARATION(FloatRegister, Ftos_d1, F0); // for 1st part of double | |
42 REGISTER_DECLARATION(FloatRegister, Ftos_d2, F1); // for 2nd part of double | |
43 | |
44 #ifndef DONT_USE_REGISTER_DEFINES | |
45 #define Otos_i O0 | |
46 #define Otos_l O0 | |
47 #define Otos_l1 O0 | |
48 #define Otos_l2 O1 | |
49 #define Ftos_f F0 | |
50 #define Ftos_d F0 | |
51 #define Ftos_d1 F0 | |
52 #define Ftos_d2 F1 | |
53 #endif // DONT_USE_REGISTER_DEFINES | |
54 | |
55 class InterpreterMacroAssembler: public MacroAssembler { | |
56 protected: | |
57 #ifndef CC_INTERP | |
58 // Interpreter specific version of call_VM_base | |
59 virtual void call_VM_leaf_base( | |
60 Register java_thread, | |
61 address entry_point, | |
62 int number_of_arguments | |
63 ); | |
64 | |
65 virtual void call_VM_base( | |
66 Register oop_result, | |
67 Register java_thread, | |
68 Register last_java_sp, | |
69 address entry_point, | |
70 int number_of_arguments, | |
71 bool check_exception=true | |
72 ); | |
73 | |
74 virtual void check_and_handle_popframe(Register java_thread); | |
75 virtual void check_and_handle_earlyret(Register java_thread); | |
76 | |
77 // base routine for all dispatches | |
78 void dispatch_base(TosState state, address* table); | |
79 #endif /* CC_INTERP */ | |
80 | |
81 public: | |
82 InterpreterMacroAssembler(CodeBuffer* c) | |
83 : MacroAssembler(c) {} | |
84 | |
85 #ifndef CC_INTERP | |
86 virtual void load_earlyret_value(TosState state); | |
87 | |
88 static const Address l_tmp ; | |
89 static const Address d_tmp ; | |
90 #endif /* CC_INTERP */ | |
91 | |
92 // helper routine for frame allocation/deallocation | |
93 // compute the delta by which the caller's SP has to | |
94 // be adjusted to accomodate for the non-argument | |
95 // locals | |
96 void compute_extra_locals_size_in_bytes(Register args_size, Register locals_size, Register delta); | |
97 | |
98 #ifndef CC_INTERP | |
99 | |
100 // dispatch routines | |
101 void dispatch_prolog(TosState state, int step = 0); | |
102 void dispatch_epilog(TosState state, int step = 0); | |
103 void dispatch_only(TosState state); | |
104 void dispatch_normal(TosState state); | |
105 void dispatch_next(TosState state, int step = 0); | |
106 void dispatch_next_noverify_oop(TosState state, int step = 0); | |
107 void dispatch_via (TosState state, address* table); | |
108 | |
109 | |
110 // Removes the current activation (incl. unlocking of monitors). | |
111 // Additionally this code is used for earlyReturn in which case we | |
112 // want to skip throwing an exception and installing an exception. | |
113 void remove_activation(TosState state, | |
114 bool throw_monitor_exception = true, | |
115 bool install_monitor_exception = true); | |
116 | |
117 protected: | |
118 void dispatch_Lbyte_code(TosState state, address* table, int bcp_incr = 0, bool verify = true); | |
119 #endif /* CC_INTERP */ | |
120 | |
121 public: | |
122 // Super call_VM calls - correspond to MacroAssembler::call_VM(_leaf) calls | |
123 void super_call_VM(Register thread_cache, | |
124 Register oop_result, | |
125 Register last_java_sp, | |
126 address entry_point, | |
127 Register arg_1, | |
128 Register arg_2, | |
129 bool check_exception = true); | |
130 | |
131 #ifndef CC_INTERP | |
1295 | 132 void super_call_VM_leaf(Register thread_cache, address entry_point, Register arg_1, Register arg_2); |
0 | 133 |
134 // Generate a subtype check: branch to ok_is_subtype if sub_klass is | |
135 // a subtype of super_klass. Blows registers tmp1, tmp2 and tmp3. | |
136 void gen_subtype_check( Register sub_klass, Register super_klass, Register tmp1, Register tmp2, Register tmp3, Label &ok_is_subtype ); | |
137 | |
138 // helpers for tossing exceptions | |
139 void throw_if_not_1_icc( Condition ok_condition, Label& ok ); | |
140 void throw_if_not_1_xcc( Condition ok_condition, Label& ok ); | |
141 void throw_if_not_1_x ( Condition ok_condition, Label& ok ); // chooses icc or xcc based on _LP64 | |
142 | |
143 void throw_if_not_2( address throw_entry_point, Register Rscratch, Label& ok); | |
144 | |
145 void throw_if_not_icc( Condition ok_condition, address throw_entry_point, Register Rscratch ); | |
146 void throw_if_not_xcc( Condition ok_condition, address throw_entry_point, Register Rscratch ); | |
147 void throw_if_not_x ( Condition ok_condition, address throw_entry_point, Register Rscratch ); | |
148 | |
149 // helpers for expression stack | |
150 | |
151 void pop_i( Register r = Otos_i); | |
152 void pop_ptr( Register r = Otos_i, Register scratch = O4); | |
153 void pop_l( Register r = Otos_l1); | |
154 // G4_scratch and Lscratch are used at call sites!! | |
155 void pop_f(FloatRegister f = Ftos_f, Register scratch = G1_scratch); | |
156 void pop_d(FloatRegister f = Ftos_d1, Register scratch = G1_scratch); | |
157 | |
158 void push_i( Register r = Otos_i); | |
159 void push_ptr( Register r = Otos_i); | |
160 void push_l( Register r = Otos_l1); | |
161 void push_f(FloatRegister f = Ftos_f); | |
162 void push_d(FloatRegister f = Ftos_d1); | |
163 | |
164 | |
165 void pop (TosState state); // transition vtos -> state | |
166 void push(TosState state); // transition state -> vtos | |
167 void empty_expression_stack(); // resets both Lesp and SP | |
168 | |
169 #ifdef ASSERT | |
170 void verify_sp(Register Rsp, Register Rtemp); | |
171 void verify_esp(Register Resp); // verify that Lesp points to a word in the temp stack | |
172 #endif // ASSERT | |
173 | |
174 public: | |
175 void if_cmp(Condition cc, bool ptr_compare); | |
176 | |
177 // Load values from bytecode stream: | |
178 | |
179 enum signedOrNot { Signed, Unsigned }; | |
180 enum setCCOrNot { set_CC, dont_set_CC }; | |
181 | |
182 void get_2_byte_integer_at_bcp( int bcp_offset, | |
183 Register Rtmp, | |
184 Register Rdst, | |
185 signedOrNot is_signed, | |
186 setCCOrNot should_set_CC = dont_set_CC ); | |
187 | |
188 void get_4_byte_integer_at_bcp( int bcp_offset, | |
189 Register Rtmp, | |
190 Register Rdst, | |
191 setCCOrNot should_set_CC = dont_set_CC ); | |
192 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6123
diff
changeset
|
193 // Note: "get_cache_and_index" really means "get the index, use it to get the cache entry, and throw away the index". |
1565 | 194 void get_cache_and_index_at_bcp(Register cache, Register tmp, int bcp_offset, size_t index_size = sizeof(u2)); |
3852
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
2118
diff
changeset
|
195 void get_cache_and_index_and_bytecode_at_bcp(Register cache, Register temp, Register bytecode, int byte_no, int bcp_offset, size_t index_size = sizeof(u2)); |
1565 | 196 void get_cache_entry_pointer_at_bcp(Register cache, Register tmp, int bcp_offset, size_t index_size = sizeof(u2)); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6123
diff
changeset
|
197 // Note: This one does not fetch the cache. The first argument is a temp which may be killed. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6123
diff
changeset
|
198 void get_cache_index_at_bcp(Register temp, Register index, int bcp_offset, size_t index_size = sizeof(u2)); |
0 | 199 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6123
diff
changeset
|
200 // load cpool->resolved_references(index); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6123
diff
changeset
|
201 void load_resolved_reference_at_index(Register result, Register index); |
0 | 202 |
203 // common code | |
204 | |
205 void field_offset_at(int n, Register tmp, Register dest, Register base); | |
206 int field_offset_at(Register object, address bcp, int offset); | |
207 void fast_iaaccess(int n, address bcp); | |
208 void fast_iagetfield(address bcp); | |
209 void fast_iaputfield(address bcp, bool do_store_check ); | |
210 | |
211 void index_check(Register array, Register index, int index_shift, Register tmp, Register res); | |
212 void index_check_without_pop(Register array, Register index, int index_shift, Register tmp, Register res); | |
213 | |
6123
2fe087c3e814
7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents:
3852
diff
changeset
|
214 void get_const(Register Rdst); |
0 | 215 void get_constant_pool(Register Rdst); |
216 void get_constant_pool_cache(Register Rdst); | |
217 void get_cpool_and_tags(Register Rcpool, Register Rtags); | |
218 void is_a(Label& L); | |
219 | |
220 // Load compiled (i2c) or interpreter entry and call from interpreted | |
221 void call_from_interpreter(Register target, Register scratch, Register Rret); | |
222 | |
223 // -------------------------------------------------- | |
224 | |
225 void unlock_if_synchronized_method(TosState state, bool throw_monitor_exception = true, bool install_monitor_exception = true); | |
226 | |
227 void add_monitor_to_stack( bool stack_is_empty, | |
228 Register Rtemp, | |
229 Register Rtemp2 ); | |
230 | |
231 // Load/store aligned in _LP64 but unaligned otherwise | |
232 // These only apply to the Interpreter expression stack and locals! | |
233 void load_unaligned_double(Register r1, int offset, FloatRegister d); | |
234 void store_unaligned_double(FloatRegister d, Register r1, int offset ); | |
235 | |
236 // Load/store aligned in _LP64 but unaligned otherwise | |
237 void load_unaligned_long(Register r1, int offset, Register d); | |
238 void store_unaligned_long(Register d, Register r1, int offset ); | |
239 | |
240 void access_local_int( Register index, Register dst ); | |
241 void access_local_ptr( Register index, Register dst ); | |
242 void access_local_returnAddress( Register index, Register dst ); | |
243 void access_local_long( Register index, Register dst ); | |
244 void access_local_float( Register index, FloatRegister dst ); | |
245 void access_local_double( Register index, FloatRegister dst ); | |
246 #ifdef ASSERT | |
247 void check_for_regarea_stomp( Register Rindex, int offset, Register Rlimit, Register Rscratch, Register Rscratch1); | |
248 #endif // ASSERT | |
249 void store_local_int( Register index, Register src ); | |
1506 | 250 void store_local_ptr( Register index, Register src ); |
251 void store_local_ptr( int n, Register src ); | |
0 | 252 void store_local_long( Register index, Register src ); |
253 void store_local_float( Register index, FloatRegister src ); | |
254 void store_local_double( Register index, FloatRegister src ); | |
255 | |
1506 | 256 // Helpers for swap and dup |
257 void load_ptr(int n, Register val); | |
258 void store_ptr(int n, Register val); | |
0 | 259 |
1506 | 260 // Helper for getting receiver in register. |
0 | 261 void load_receiver(Register param_count, Register recv); |
262 | |
263 static int top_most_monitor_byte_offset(); // offset in bytes to top of monitor block | |
264 Address top_most_monitor(); | |
265 void compute_stack_base( Register Rdest ); | |
266 | |
267 #endif /* CC_INTERP */ | |
10105
aeaca88565e6
8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
7204
diff
changeset
|
268 void get_method_counters(Register method, Register Rcounters, Label& skip); |
aeaca88565e6
8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
7204
diff
changeset
|
269 void increment_invocation_counter( Register Rcounters, Register Rtmp, Register Rtmp2 ); |
aeaca88565e6
8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
7204
diff
changeset
|
270 void increment_backedge_counter( Register Rcounters, Register Rtmp, Register Rtmp2 ); |
0 | 271 #ifndef CC_INTERP |
272 void test_backedge_count_for_osr( Register backedge_count, Register branch_bcp, Register Rtmp ); | |
273 | |
274 #endif /* CC_INTERP */ | |
275 // Object locking | |
276 void lock_object (Register lock_reg, Register obj_reg); | |
277 void unlock_object(Register lock_reg); | |
278 | |
279 #ifndef CC_INTERP | |
280 // Interpreter profiling operations | |
2118
dd031b2226de
4930919: race condition in MDO creation at back branch locations
iveresov
parents:
1972
diff
changeset
|
281 void set_method_data_pointer(); |
0 | 282 void set_method_data_pointer_for_bcp(); |
283 void test_method_data_pointer(Label& zero_continue); | |
284 void verify_method_data_pointer(); | |
2118
dd031b2226de
4930919: race condition in MDO creation at back branch locations
iveresov
parents:
1972
diff
changeset
|
285 void test_invocation_counter_for_mdp(Register invocation_count, Register Rtmp, Label &profile_continue); |
0 | 286 |
287 void set_mdp_data_at(int constant, Register value); | |
288 void increment_mdp_data_at(Address counter, Register bumped_count, | |
289 bool decrement = false); | |
290 void increment_mdp_data_at(int constant, Register bumped_count, | |
291 bool decrement = false); | |
292 void increment_mdp_data_at(Register reg, int constant, | |
293 Register bumped_count, Register scratch2, | |
294 bool decrement = false); | |
1783 | 295 void increment_mask_and_jump(Address counter_addr, |
296 int increment, int mask, | |
297 Register scratch1, Register scratch2, | |
298 Condition cond, Label *where); | |
0 | 299 void set_mdp_flag_at(int flag_constant, Register scratch); |
300 void test_mdp_data_at(int offset, Register value, Label& not_equal_continue, | |
301 Register scratch); | |
302 | |
1206
87684f1a88b5
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
0
diff
changeset
|
303 void record_klass_in_profile(Register receiver, Register scratch, bool is_virtual_call); |
0 | 304 void record_klass_in_profile_helper(Register receiver, Register scratch, |
10458 | 305 Label& done, bool is_virtual_call); |
306 void record_item_in_profile_helper(Register item, | |
307 Register scratch, int start_row, Label& done, int total_rows, | |
308 OffsetFunction item_offset_fn, OffsetFunction item_count_offset_fn, | |
309 int non_profiled_offset); | |
0 | 310 |
311 void update_mdp_by_offset(int offset_of_disp, Register scratch); | |
312 void update_mdp_by_offset(Register reg, int offset_of_disp, | |
313 Register scratch); | |
314 void update_mdp_by_constant(int constant); | |
315 void update_mdp_for_ret(TosState state, Register return_bci); | |
316 | |
317 void profile_taken_branch(Register scratch, Register bumped_count); | |
318 void profile_not_taken_branch(Register scratch); | |
319 void profile_call(Register scratch); | |
320 void profile_final_call(Register scratch); | |
1503 | 321 void profile_virtual_call(Register receiver, Register scratch, bool receiver_can_be_null = false); |
10458 | 322 void profile_called_method(Register method, Register scratch); |
0 | 323 void profile_ret(TosState state, Register return_bci, Register scratch); |
324 void profile_null_seen(Register scratch); | |
325 void profile_typecheck(Register klass, Register scratch); | |
326 void profile_typecheck_failed(Register scratch); | |
327 void profile_switch_default(Register scratch); | |
328 void profile_switch_case(Register index, | |
329 Register scratch1, | |
330 Register scratch2, | |
331 Register scratch3); | |
332 | |
18041
52b4284cb496
Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14909
diff
changeset
|
333 void profile_obj_type(Register obj, const Address& mdo_addr, Register tmp); |
52b4284cb496
Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14909
diff
changeset
|
334 void profile_arguments_type(Register callee, Register tmp1, Register tmp2, bool is_virtual); |
52b4284cb496
Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14909
diff
changeset
|
335 void profile_return_type(Register ret, Register tmp1, Register tmp2); |
52b4284cb496
Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14909
diff
changeset
|
336 void profile_parameters_type(Register tmp1, Register tmp2, Register tmp3, Register tmp4); |
52b4284cb496
Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14909
diff
changeset
|
337 |
0 | 338 // Debugging |
339 void interp_verify_oop(Register reg, TosState state, const char * file, int line); // only if +VerifyOops && state == atos | |
340 void verify_oop_or_return_address(Register reg, Register rtmp); // for astore | |
341 void verify_FPU(int stack_depth, TosState state = ftos); // only if +VerifyFPU && (state == ftos || state == dtos) | |
342 | |
343 #endif /* CC_INTERP */ | |
344 // support for JVMTI/Dtrace | |
345 typedef enum { NotifyJVMTI, SkipNotifyJVMTI } NotifyMethodExitMode; | |
346 void notify_method_entry(); | |
347 void notify_method_exit( | |
348 bool save_result, TosState state, NotifyMethodExitMode mode); | |
349 | |
350 void save_return_value(TosState state, bool is_native_call); | |
351 void restore_return_value(TosState state, bool is_native_call); | |
1783 | 352 |
0 | 353 }; |
1972 | 354 |
355 #endif // CPU_SPARC_VM_INTERP_MASM_SPARC_HPP |