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