author | kvn |
Tue, 14 Jan 2014 17:46:48 -0800 | |
changeset 22505 | 4523090c9674 |
parent 22234 | da823d78ad65 |
child 24442 | 4d4ae31dea26 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
22234
da823d78ad65
8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents:
21088
diff
changeset
|
2 |
* Copyright (c) 1999, 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:
5046
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5046
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:
5046
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "c1/c1_Defs.hpp" |
|
27 |
#include "c1/c1_MacroAssembler.hpp" |
|
28 |
#include "c1/c1_Runtime1.hpp" |
|
29 |
#include "interpreter/interpreter.hpp" |
|
30 |
#include "nativeInst_sparc.hpp" |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11439
diff
changeset
|
31 |
#include "oops/compiledICHolder.hpp" |
7397 | 32 |
#include "oops/oop.inline.hpp" |
33 |
#include "prims/jvmtiExport.hpp" |
|
34 |
#include "register_sparc.hpp" |
|
35 |
#include "runtime/sharedRuntime.hpp" |
|
36 |
#include "runtime/signature.hpp" |
|
37 |
#include "runtime/vframeArray.hpp" |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
38 |
#include "utilities/macros.hpp" |
7397 | 39 |
#include "vmreg_sparc.inline.hpp" |
20403
45a89fbcd8f7
8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents:
19710
diff
changeset
|
40 |
#if INCLUDE_ALL_GCS |
45a89fbcd8f7
8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents:
19710
diff
changeset
|
41 |
#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" |
45a89fbcd8f7
8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents:
19710
diff
changeset
|
42 |
#endif |
1 | 43 |
|
44 |
// Implementation of StubAssembler |
|
45 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11439
diff
changeset
|
46 |
int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry_point, int number_of_arguments) { |
1 | 47 |
// for sparc changing the number of arguments doesn't change |
48 |
// anything about the frame size so we'll always lie and claim that |
|
49 |
// we are only passing 1 argument. |
|
50 |
set_num_rt_args(1); |
|
51 |
||
52 |
assert_not_delayed(); |
|
53 |
// bang stack before going to runtime |
|
54 |
set(-os::vm_page_size() + STACK_BIAS, G3_scratch); |
|
55 |
st(G0, SP, G3_scratch); |
|
56 |
||
57 |
// debugging support |
|
58 |
assert(number_of_arguments >= 0 , "cannot have negative number of arguments"); |
|
59 |
||
60 |
set_last_Java_frame(SP, noreg); |
|
61 |
if (VerifyThread) mov(G2_thread, O0); // about to be smashed; pass early |
|
62 |
save_thread(L7_thread_cache); |
|
63 |
// do the call |
|
64 |
call(entry_point, relocInfo::runtime_call_type); |
|
65 |
if (!VerifyThread) { |
|
66 |
delayed()->mov(G2_thread, O0); // pass thread as first argument |
|
67 |
} else { |
|
68 |
delayed()->nop(); // (thread already passed) |
|
69 |
} |
|
70 |
int call_offset = offset(); // offset of return address |
|
71 |
restore_thread(L7_thread_cache); |
|
72 |
reset_last_Java_frame(); |
|
73 |
||
74 |
// check for pending exceptions |
|
75 |
{ Label L; |
|
2571 | 76 |
Address exception_addr(G2_thread, Thread::pending_exception_offset()); |
1 | 77 |
ld_ptr(exception_addr, Gtemp); |
10252 | 78 |
br_null_short(Gtemp, pt, L); |
2571 | 79 |
Address vm_result_addr(G2_thread, JavaThread::vm_result_offset()); |
1 | 80 |
st_ptr(G0, vm_result_addr); |
2571 | 81 |
Address vm_result_addr_2(G2_thread, JavaThread::vm_result_2_offset()); |
1 | 82 |
st_ptr(G0, vm_result_addr_2); |
83 |
||
84 |
if (frame_size() == no_frame_size) { |
|
85 |
// we use O7 linkage so that forward_exception_entry has the issuing PC |
|
86 |
call(StubRoutines::forward_exception_entry(), relocInfo::runtime_call_type); |
|
87 |
delayed()->restore(); |
|
88 |
} else if (_stub_id == Runtime1::forward_exception_id) { |
|
89 |
should_not_reach_here(); |
|
90 |
} else { |
|
2571 | 91 |
AddressLiteral exc(Runtime1::entry_for(Runtime1::forward_exception_id)); |
92 |
jump_to(exc, G4); |
|
1 | 93 |
delayed()->nop(); |
94 |
} |
|
95 |
bind(L); |
|
96 |
} |
|
97 |
||
98 |
// get oop result if there is one and reset the value in the thread |
|
99 |
if (oop_result1->is_valid()) { // get oop result if there is one and reset it in the thread |
|
100 |
get_vm_result (oop_result1); |
|
101 |
} else { |
|
102 |
// be a little paranoid and clear the result |
|
2571 | 103 |
Address vm_result_addr(G2_thread, JavaThread::vm_result_offset()); |
1 | 104 |
st_ptr(G0, vm_result_addr); |
105 |
} |
|
106 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11439
diff
changeset
|
107 |
// get second result if there is one and reset the value in the thread |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11439
diff
changeset
|
108 |
if (metadata_result->is_valid()) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11439
diff
changeset
|
109 |
get_vm_result_2 (metadata_result); |
1 | 110 |
} else { |
111 |
// be a little paranoid and clear the result |
|
2571 | 112 |
Address vm_result_addr_2(G2_thread, JavaThread::vm_result_2_offset()); |
1 | 113 |
st_ptr(G0, vm_result_addr_2); |
114 |
} |
|
115 |
||
116 |
return call_offset; |
|
117 |
} |
|
118 |
||
119 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11439
diff
changeset
|
120 |
int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1) { |
1 | 121 |
// O0 is reserved for the thread |
122 |
mov(arg1, O1); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11439
diff
changeset
|
123 |
return call_RT(oop_result1, metadata_result, entry, 1); |
1 | 124 |
} |
125 |
||
126 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11439
diff
changeset
|
127 |
int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1, Register arg2) { |
1 | 128 |
// O0 is reserved for the thread |
129 |
mov(arg1, O1); |
|
130 |
mov(arg2, O2); assert(arg2 != O1, "smashed argument"); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11439
diff
changeset
|
131 |
return call_RT(oop_result1, metadata_result, entry, 2); |
1 | 132 |
} |
133 |
||
134 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11439
diff
changeset
|
135 |
int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1, Register arg2, Register arg3) { |
1 | 136 |
// O0 is reserved for the thread |
137 |
mov(arg1, O1); |
|
138 |
mov(arg2, O2); assert(arg2 != O1, "smashed argument"); |
|
139 |
mov(arg3, O3); assert(arg3 != O1 && arg3 != O2, "smashed argument"); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11439
diff
changeset
|
140 |
return call_RT(oop_result1, metadata_result, entry, 3); |
1 | 141 |
} |
142 |
||
143 |
||
144 |
// Implementation of Runtime1 |
|
145 |
||
146 |
#define __ sasm-> |
|
147 |
||
148 |
static int cpu_reg_save_offsets[FrameMap::nof_cpu_regs]; |
|
149 |
static int fpu_reg_save_offsets[FrameMap::nof_fpu_regs]; |
|
150 |
static int reg_save_size_in_words; |
|
151 |
static int frame_size_in_bytes = -1; |
|
152 |
||
153 |
static OopMap* generate_oop_map(StubAssembler* sasm, bool save_fpu_registers) { |
|
154 |
assert(frame_size_in_bytes == __ total_frame_size_in_bytes(reg_save_size_in_words), |
|
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
155 |
"mismatch in calculation"); |
1 | 156 |
sasm->set_frame_size(frame_size_in_bytes / BytesPerWord); |
157 |
int frame_size_in_slots = frame_size_in_bytes / sizeof(jint); |
|
158 |
OopMap* oop_map = new OopMap(frame_size_in_slots, 0); |
|
159 |
||
160 |
int i; |
|
161 |
for (i = 0; i < FrameMap::nof_cpu_regs; i++) { |
|
162 |
Register r = as_Register(i); |
|
163 |
if (r == G1 || r == G3 || r == G4 || r == G5) { |
|
164 |
int sp_offset = cpu_reg_save_offsets[i]; |
|
165 |
oop_map->set_callee_saved(VMRegImpl::stack2reg(sp_offset), |
|
166 |
r->as_VMReg()); |
|
167 |
} |
|
168 |
} |
|
169 |
||
170 |
if (save_fpu_registers) { |
|
171 |
for (i = 0; i < FrameMap::nof_fpu_regs; i++) { |
|
172 |
FloatRegister r = as_FloatRegister(i); |
|
173 |
int sp_offset = fpu_reg_save_offsets[i]; |
|
174 |
oop_map->set_callee_saved(VMRegImpl::stack2reg(sp_offset), |
|
175 |
r->as_VMReg()); |
|
176 |
} |
|
177 |
} |
|
178 |
return oop_map; |
|
179 |
} |
|
180 |
||
181 |
static OopMap* save_live_registers(StubAssembler* sasm, bool save_fpu_registers = true) { |
|
182 |
assert(frame_size_in_bytes == __ total_frame_size_in_bytes(reg_save_size_in_words), |
|
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
183 |
"mismatch in calculation"); |
1 | 184 |
__ save_frame_c1(frame_size_in_bytes); |
185 |
||
186 |
// Record volatile registers as callee-save values in an OopMap so their save locations will be |
|
187 |
// propagated to the caller frame's RegisterMap during StackFrameStream construction (needed for |
|
188 |
// deoptimization; see compiledVFrame::create_stack_value). The caller's I, L and O registers |
|
189 |
// are saved in register windows - I's and L's in the caller's frame and O's in the stub frame |
|
190 |
// (as the stub's I's) when the runtime routine called by the stub creates its frame. |
|
191 |
// OopMap frame sizes are in c2 stack slot sizes (sizeof(jint)) |
|
192 |
||
193 |
int i; |
|
194 |
for (i = 0; i < FrameMap::nof_cpu_regs; i++) { |
|
195 |
Register r = as_Register(i); |
|
196 |
if (r == G1 || r == G3 || r == G4 || r == G5) { |
|
197 |
int sp_offset = cpu_reg_save_offsets[i]; |
|
198 |
__ st_ptr(r, SP, (sp_offset * BytesPerWord) + STACK_BIAS); |
|
199 |
} |
|
200 |
} |
|
201 |
||
202 |
if (save_fpu_registers) { |
|
203 |
for (i = 0; i < FrameMap::nof_fpu_regs; i++) { |
|
204 |
FloatRegister r = as_FloatRegister(i); |
|
205 |
int sp_offset = fpu_reg_save_offsets[i]; |
|
206 |
__ stf(FloatRegisterImpl::S, r, SP, (sp_offset * BytesPerWord) + STACK_BIAS); |
|
207 |
} |
|
208 |
} |
|
209 |
||
210 |
return generate_oop_map(sasm, save_fpu_registers); |
|
211 |
} |
|
212 |
||
213 |
static void restore_live_registers(StubAssembler* sasm, bool restore_fpu_registers = true) { |
|
214 |
for (int i = 0; i < FrameMap::nof_cpu_regs; i++) { |
|
215 |
Register r = as_Register(i); |
|
216 |
if (r == G1 || r == G3 || r == G4 || r == G5) { |
|
217 |
__ ld_ptr(SP, (cpu_reg_save_offsets[i] * BytesPerWord) + STACK_BIAS, r); |
|
218 |
} |
|
219 |
} |
|
220 |
||
221 |
if (restore_fpu_registers) { |
|
222 |
for (int i = 0; i < FrameMap::nof_fpu_regs; i++) { |
|
223 |
FloatRegister r = as_FloatRegister(i); |
|
224 |
__ ldf(FloatRegisterImpl::S, SP, (fpu_reg_save_offsets[i] * BytesPerWord) + STACK_BIAS, r); |
|
225 |
} |
|
226 |
} |
|
227 |
} |
|
228 |
||
229 |
||
230 |
void Runtime1::initialize_pd() { |
|
231 |
// compute word offsets from SP at which live (non-windowed) registers are captured by stub routines |
|
232 |
// |
|
233 |
// A stub routine will have a frame that is at least large enough to hold |
|
234 |
// a register window save area (obviously) and the volatile g registers |
|
235 |
// and floating registers. A user of save_live_registers can have a frame |
|
236 |
// that has more scratch area in it (although typically they will use L-regs). |
|
237 |
// in that case the frame will look like this (stack growing down) |
|
238 |
// |
|
239 |
// FP -> | | |
|
240 |
// | scratch mem | |
|
241 |
// | " " | |
|
242 |
// -------------- |
|
243 |
// | float regs | |
|
244 |
// | " " | |
|
245 |
// --------------- |
|
246 |
// | G regs | |
|
247 |
// | " " | |
|
248 |
// --------------- |
|
249 |
// | abi reg. | |
|
250 |
// | window save | |
|
251 |
// | area | |
|
252 |
// SP -> --------------- |
|
253 |
// |
|
254 |
int i; |
|
255 |
int sp_offset = round_to(frame::register_save_words, 2); // start doubleword aligned |
|
256 |
||
257 |
// only G int registers are saved explicitly; others are found in register windows |
|
258 |
for (i = 0; i < FrameMap::nof_cpu_regs; i++) { |
|
259 |
Register r = as_Register(i); |
|
260 |
if (r == G1 || r == G3 || r == G4 || r == G5) { |
|
261 |
cpu_reg_save_offsets[i] = sp_offset; |
|
262 |
sp_offset++; |
|
263 |
} |
|
264 |
} |
|
265 |
||
266 |
// all float registers are saved explicitly |
|
267 |
assert(FrameMap::nof_fpu_regs == 32, "double registers not handled here"); |
|
268 |
for (i = 0; i < FrameMap::nof_fpu_regs; i++) { |
|
269 |
fpu_reg_save_offsets[i] = sp_offset; |
|
270 |
sp_offset++; |
|
271 |
} |
|
272 |
reg_save_size_in_words = sp_offset - frame::memory_parameter_word_sp_offset; |
|
273 |
// this should match assembler::total_frame_size_in_bytes, which |
|
274 |
// isn't callable from this context. It's checked by an assert when |
|
275 |
// it's used though. |
|
276 |
frame_size_in_bytes = align_size_up(sp_offset * wordSize, 8); |
|
277 |
} |
|
278 |
||
279 |
||
280 |
OopMapSet* Runtime1::generate_exception_throw(StubAssembler* sasm, address target, bool has_argument) { |
|
281 |
// make a frame and preserve the caller's caller-save registers |
|
282 |
OopMap* oop_map = save_live_registers(sasm); |
|
283 |
int call_offset; |
|
284 |
if (!has_argument) { |
|
285 |
call_offset = __ call_RT(noreg, noreg, target); |
|
286 |
} else { |
|
287 |
call_offset = __ call_RT(noreg, noreg, target, G4); |
|
288 |
} |
|
289 |
OopMapSet* oop_maps = new OopMapSet(); |
|
290 |
oop_maps->add_gc_map(call_offset, oop_map); |
|
291 |
||
292 |
__ should_not_reach_here(); |
|
293 |
return oop_maps; |
|
294 |
} |
|
295 |
||
296 |
||
297 |
OopMapSet* Runtime1::generate_stub_call(StubAssembler* sasm, Register result, address target, |
|
298 |
Register arg1, Register arg2, Register arg3) { |
|
299 |
// make a frame and preserve the caller's caller-save registers |
|
300 |
OopMap* oop_map = save_live_registers(sasm); |
|
301 |
||
302 |
int call_offset; |
|
303 |
if (arg1 == noreg) { |
|
304 |
call_offset = __ call_RT(result, noreg, target); |
|
305 |
} else if (arg2 == noreg) { |
|
306 |
call_offset = __ call_RT(result, noreg, target, arg1); |
|
307 |
} else if (arg3 == noreg) { |
|
308 |
call_offset = __ call_RT(result, noreg, target, arg1, arg2); |
|
309 |
} else { |
|
310 |
call_offset = __ call_RT(result, noreg, target, arg1, arg2, arg3); |
|
311 |
} |
|
312 |
OopMapSet* oop_maps = NULL; |
|
313 |
||
314 |
oop_maps = new OopMapSet(); |
|
315 |
oop_maps->add_gc_map(call_offset, oop_map); |
|
316 |
restore_live_registers(sasm); |
|
317 |
||
318 |
__ ret(); |
|
319 |
__ delayed()->restore(); |
|
320 |
||
321 |
return oop_maps; |
|
322 |
} |
|
323 |
||
324 |
||
325 |
OopMapSet* Runtime1::generate_patching(StubAssembler* sasm, address target) { |
|
326 |
// make a frame and preserve the caller's caller-save registers |
|
327 |
OopMap* oop_map = save_live_registers(sasm); |
|
328 |
||
329 |
// call the runtime patching routine, returns non-zero if nmethod got deopted. |
|
330 |
int call_offset = __ call_RT(noreg, noreg, target); |
|
331 |
OopMapSet* oop_maps = new OopMapSet(); |
|
332 |
oop_maps->add_gc_map(call_offset, oop_map); |
|
333 |
||
334 |
// re-execute the patched instruction or, if the nmethod was deoptmized, return to the |
|
335 |
// deoptimization handler entry that will cause re-execution of the current bytecode |
|
336 |
DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob(); |
|
337 |
assert(deopt_blob != NULL, "deoptimization blob must have been created"); |
|
338 |
||
339 |
Label no_deopt; |
|
10252 | 340 |
__ br_null_short(O0, Assembler::pt, no_deopt); |
1 | 341 |
|
342 |
// return to the deoptimization handler entry for unpacking and rexecute |
|
343 |
// if we simply returned the we'd deopt as if any call we patched had just |
|
344 |
// returned. |
|
345 |
||
346 |
restore_live_registers(sasm); |
|
7927
553d29e6d40c
7013812: C1: deopt blob too far from patching stub
iveresov
parents:
7898
diff
changeset
|
347 |
|
553d29e6d40c
7013812: C1: deopt blob too far from patching stub
iveresov
parents:
7898
diff
changeset
|
348 |
AddressLiteral dest(deopt_blob->unpack_with_reexecution()); |
553d29e6d40c
7013812: C1: deopt blob too far from patching stub
iveresov
parents:
7898
diff
changeset
|
349 |
__ jump_to(dest, O0); |
553d29e6d40c
7013812: C1: deopt blob too far from patching stub
iveresov
parents:
7898
diff
changeset
|
350 |
__ delayed()->restore(); |
1 | 351 |
|
352 |
__ bind(no_deopt); |
|
353 |
restore_live_registers(sasm); |
|
354 |
__ ret(); |
|
355 |
__ delayed()->restore(); |
|
356 |
||
357 |
return oop_maps; |
|
358 |
} |
|
359 |
||
360 |
OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) { |
|
361 |
||
362 |
OopMapSet* oop_maps = NULL; |
|
363 |
// for better readability |
|
364 |
const bool must_gc_arguments = true; |
|
365 |
const bool dont_gc_arguments = false; |
|
366 |
||
367 |
// stub code & info for the different stubs |
|
368 |
switch (id) { |
|
369 |
case forward_exception_id: |
|
370 |
{ |
|
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
371 |
oop_maps = generate_handle_exception(id, sasm); |
1 | 372 |
} |
373 |
break; |
|
374 |
||
375 |
case new_instance_id: |
|
376 |
case fast_new_instance_id: |
|
377 |
case fast_new_instance_init_check_id: |
|
378 |
{ |
|
379 |
Register G5_klass = G5; // Incoming |
|
380 |
Register O0_obj = O0; // Outgoing |
|
381 |
||
382 |
if (id == new_instance_id) { |
|
383 |
__ set_info("new_instance", dont_gc_arguments); |
|
384 |
} else if (id == fast_new_instance_id) { |
|
385 |
__ set_info("fast new_instance", dont_gc_arguments); |
|
386 |
} else { |
|
387 |
assert(id == fast_new_instance_init_check_id, "bad StubID"); |
|
388 |
__ set_info("fast new_instance init check", dont_gc_arguments); |
|
389 |
} |
|
390 |
||
391 |
if ((id == fast_new_instance_id || id == fast_new_instance_init_check_id) && |
|
392 |
UseTLAB && FastTLABRefill) { |
|
393 |
Label slow_path; |
|
394 |
Register G1_obj_size = G1; |
|
395 |
Register G3_t1 = G3; |
|
396 |
Register G4_t2 = G4; |
|
397 |
assert_different_registers(G5_klass, G1_obj_size, G3_t1, G4_t2); |
|
398 |
||
399 |
// Push a frame since we may do dtrace notification for the |
|
400 |
// allocation which requires calling out and we don't want |
|
401 |
// to stomp the real return address. |
|
402 |
__ save_frame(0); |
|
403 |
||
404 |
if (id == fast_new_instance_init_check_id) { |
|
405 |
// make sure the klass is initialized |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11439
diff
changeset
|
406 |
__ ldub(G5_klass, in_bytes(InstanceKlass::init_state_offset()), G3_t1); |
21088 | 407 |
__ cmp(G3_t1, InstanceKlass::fully_initialized); |
408 |
__ br(Assembler::notEqual, false, Assembler::pn, slow_path); |
|
409 |
__ delayed()->nop(); |
|
1 | 410 |
} |
411 |
#ifdef ASSERT |
|
412 |
// assert object can be fast path allocated |
|
413 |
{ |
|
414 |
Label ok, not_ok; |
|
11430
718fc06da49a
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
10972
diff
changeset
|
415 |
__ ld(G5_klass, in_bytes(Klass::layout_helper_offset()), G1_obj_size); |
10252 | 416 |
// make sure it's an instance (LH > 0) |
417 |
__ cmp_and_br_short(G1_obj_size, 0, Assembler::lessEqual, Assembler::pn, not_ok); |
|
1 | 418 |
__ btst(Klass::_lh_instance_slow_path_bit, G1_obj_size); |
419 |
__ br(Assembler::zero, false, Assembler::pn, ok); |
|
420 |
__ delayed()->nop(); |
|
421 |
__ bind(not_ok); |
|
422 |
__ stop("assert(can be fast path allocated)"); |
|
423 |
__ should_not_reach_here(); |
|
424 |
__ bind(ok); |
|
425 |
} |
|
426 |
#endif // ASSERT |
|
427 |
// if we got here then the TLAB allocation failed, so try |
|
428 |
// refilling the TLAB or allocating directly from eden. |
|
429 |
Label retry_tlab, try_eden; |
|
430 |
__ tlab_refill(retry_tlab, try_eden, slow_path); // preserves G5_klass |
|
431 |
||
432 |
__ bind(retry_tlab); |
|
433 |
||
434 |
// get the instance size |
|
11430
718fc06da49a
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
10972
diff
changeset
|
435 |
__ ld(G5_klass, in_bytes(Klass::layout_helper_offset()), G1_obj_size); |
7724
a92d706dbdd5
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
7427
diff
changeset
|
436 |
|
1 | 437 |
__ tlab_allocate(O0_obj, G1_obj_size, 0, G3_t1, slow_path); |
7724
a92d706dbdd5
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
7427
diff
changeset
|
438 |
|
1 | 439 |
__ initialize_object(O0_obj, G5_klass, G1_obj_size, 0, G3_t1, G4_t2); |
440 |
__ verify_oop(O0_obj); |
|
441 |
__ mov(O0, I0); |
|
442 |
__ ret(); |
|
443 |
__ delayed()->restore(); |
|
444 |
||
445 |
__ bind(try_eden); |
|
446 |
// get the instance size |
|
11430
718fc06da49a
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
10972
diff
changeset
|
447 |
__ ld(G5_klass, in_bytes(Klass::layout_helper_offset()), G1_obj_size); |
1 | 448 |
__ eden_allocate(O0_obj, G1_obj_size, 0, G3_t1, G4_t2, slow_path); |
7898
729a02451b8a
7011463: Sparc MacroAssembler::incr_allocated_bytes() needs a RegisterOrConstant argument
phh
parents:
7724
diff
changeset
|
449 |
__ incr_allocated_bytes(G1_obj_size, G3_t1, G4_t2); |
7724
a92d706dbdd5
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
7427
diff
changeset
|
450 |
|
1 | 451 |
__ initialize_object(O0_obj, G5_klass, G1_obj_size, 0, G3_t1, G4_t2); |
452 |
__ verify_oop(O0_obj); |
|
453 |
__ mov(O0, I0); |
|
454 |
__ ret(); |
|
455 |
__ delayed()->restore(); |
|
456 |
||
457 |
__ bind(slow_path); |
|
458 |
||
459 |
// pop this frame so generate_stub_call can push it's own |
|
460 |
__ restore(); |
|
461 |
} |
|
462 |
||
463 |
oop_maps = generate_stub_call(sasm, I0, CAST_FROM_FN_PTR(address, new_instance), G5_klass); |
|
464 |
// I0->O0: new instance |
|
465 |
} |
|
466 |
||
467 |
break; |
|
468 |
||
469 |
case counter_overflow_id: |
|
6453 | 470 |
// G4 contains bci, G5 contains method |
471 |
oop_maps = generate_stub_call(sasm, noreg, CAST_FROM_FN_PTR(address, counter_overflow), G4, G5); |
|
1 | 472 |
break; |
473 |
||
474 |
case new_type_array_id: |
|
475 |
case new_object_array_id: |
|
476 |
{ |
|
477 |
Register G5_klass = G5; // Incoming |
|
478 |
Register G4_length = G4; // Incoming |
|
479 |
Register O0_obj = O0; // Outgoing |
|
480 |
||
11430
718fc06da49a
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
10972
diff
changeset
|
481 |
Address klass_lh(G5_klass, Klass::layout_helper_offset()); |
1 | 482 |
assert(Klass::_lh_header_size_shift % BitsPerByte == 0, "bytewise"); |
483 |
assert(Klass::_lh_header_size_mask == 0xFF, "bytewise"); |
|
484 |
// Use this offset to pick out an individual byte of the layout_helper: |
|
485 |
const int klass_lh_header_size_offset = ((BytesPerInt - 1) // 3 - 2 selects byte {0,1,0,0} |
|
486 |
- Klass::_lh_header_size_shift / BitsPerByte); |
|
487 |
||
488 |
if (id == new_type_array_id) { |
|
489 |
__ set_info("new_type_array", dont_gc_arguments); |
|
490 |
} else { |
|
491 |
__ set_info("new_object_array", dont_gc_arguments); |
|
492 |
} |
|
493 |
||
494 |
#ifdef ASSERT |
|
495 |
// assert object type is really an array of the proper kind |
|
496 |
{ |
|
497 |
Label ok; |
|
498 |
Register G3_t1 = G3; |
|
499 |
__ ld(klass_lh, G3_t1); |
|
500 |
__ sra(G3_t1, Klass::_lh_array_tag_shift, G3_t1); |
|
501 |
int tag = ((id == new_type_array_id) |
|
502 |
? Klass::_lh_array_tag_type_value |
|
503 |
: Klass::_lh_array_tag_obj_value); |
|
10252 | 504 |
__ cmp_and_brx_short(G3_t1, tag, Assembler::equal, Assembler::pt, ok); |
1 | 505 |
__ stop("assert(is an array klass)"); |
506 |
__ should_not_reach_here(); |
|
507 |
__ bind(ok); |
|
508 |
} |
|
509 |
#endif // ASSERT |
|
510 |
||
511 |
if (UseTLAB && FastTLABRefill) { |
|
512 |
Label slow_path; |
|
513 |
Register G1_arr_size = G1; |
|
514 |
Register G3_t1 = G3; |
|
515 |
Register O1_t2 = O1; |
|
516 |
assert_different_registers(G5_klass, G4_length, G1_arr_size, G3_t1, O1_t2); |
|
517 |
||
518 |
// check that array length is small enough for fast path |
|
519 |
__ set(C1_MacroAssembler::max_array_allocation_length, G3_t1); |
|
21088 | 520 |
__ cmp(G4_length, G3_t1); |
521 |
__ br(Assembler::greaterUnsigned, false, Assembler::pn, slow_path); |
|
522 |
__ delayed()->nop(); |
|
1 | 523 |
|
524 |
// if we got here then the TLAB allocation failed, so try |
|
525 |
// refilling the TLAB or allocating directly from eden. |
|
526 |
Label retry_tlab, try_eden; |
|
527 |
__ tlab_refill(retry_tlab, try_eden, slow_path); // preserves G4_length and G5_klass |
|
528 |
||
529 |
__ bind(retry_tlab); |
|
530 |
||
531 |
// get the allocation size: (length << (layout_helper & 0x1F)) + header_size |
|
532 |
__ ld(klass_lh, G3_t1); |
|
533 |
__ sll(G4_length, G3_t1, G1_arr_size); |
|
534 |
__ srl(G3_t1, Klass::_lh_header_size_shift, G3_t1); |
|
535 |
__ and3(G3_t1, Klass::_lh_header_size_mask, G3_t1); |
|
536 |
__ add(G1_arr_size, G3_t1, G1_arr_size); |
|
537 |
__ add(G1_arr_size, MinObjAlignmentInBytesMask, G1_arr_size); // align up |
|
538 |
__ and3(G1_arr_size, ~MinObjAlignmentInBytesMask, G1_arr_size); |
|
539 |
||
540 |
__ tlab_allocate(O0_obj, G1_arr_size, 0, G3_t1, slow_path); // preserves G1_arr_size |
|
541 |
||
542 |
__ initialize_header(O0_obj, G5_klass, G4_length, G3_t1, O1_t2); |
|
543 |
__ ldub(klass_lh, G3_t1, klass_lh_header_size_offset); |
|
544 |
__ sub(G1_arr_size, G3_t1, O1_t2); // body length |
|
545 |
__ add(O0_obj, G3_t1, G3_t1); // body start |
|
546 |
__ initialize_body(G3_t1, O1_t2); |
|
547 |
__ verify_oop(O0_obj); |
|
548 |
__ retl(); |
|
549 |
__ delayed()->nop(); |
|
550 |
||
551 |
__ bind(try_eden); |
|
552 |
// get the allocation size: (length << (layout_helper & 0x1F)) + header_size |
|
553 |
__ ld(klass_lh, G3_t1); |
|
554 |
__ sll(G4_length, G3_t1, G1_arr_size); |
|
555 |
__ srl(G3_t1, Klass::_lh_header_size_shift, G3_t1); |
|
556 |
__ and3(G3_t1, Klass::_lh_header_size_mask, G3_t1); |
|
557 |
__ add(G1_arr_size, G3_t1, G1_arr_size); |
|
558 |
__ add(G1_arr_size, MinObjAlignmentInBytesMask, G1_arr_size); |
|
559 |
__ and3(G1_arr_size, ~MinObjAlignmentInBytesMask, G1_arr_size); |
|
560 |
||
561 |
__ eden_allocate(O0_obj, G1_arr_size, 0, G3_t1, O1_t2, slow_path); // preserves G1_arr_size |
|
7898
729a02451b8a
7011463: Sparc MacroAssembler::incr_allocated_bytes() needs a RegisterOrConstant argument
phh
parents:
7724
diff
changeset
|
562 |
__ incr_allocated_bytes(G1_arr_size, G3_t1, O1_t2); |
1 | 563 |
|
564 |
__ initialize_header(O0_obj, G5_klass, G4_length, G3_t1, O1_t2); |
|
565 |
__ ldub(klass_lh, G3_t1, klass_lh_header_size_offset); |
|
566 |
__ sub(G1_arr_size, G3_t1, O1_t2); // body length |
|
567 |
__ add(O0_obj, G3_t1, G3_t1); // body start |
|
568 |
__ initialize_body(G3_t1, O1_t2); |
|
569 |
__ verify_oop(O0_obj); |
|
570 |
__ retl(); |
|
571 |
__ delayed()->nop(); |
|
572 |
||
573 |
__ bind(slow_path); |
|
574 |
} |
|
575 |
||
576 |
if (id == new_type_array_id) { |
|
577 |
oop_maps = generate_stub_call(sasm, I0, CAST_FROM_FN_PTR(address, new_type_array), G5_klass, G4_length); |
|
578 |
} else { |
|
579 |
oop_maps = generate_stub_call(sasm, I0, CAST_FROM_FN_PTR(address, new_object_array), G5_klass, G4_length); |
|
580 |
} |
|
581 |
// I0 -> O0: new array |
|
582 |
} |
|
583 |
break; |
|
584 |
||
585 |
case new_multi_array_id: |
|
586 |
{ // O0: klass |
|
587 |
// O1: rank |
|
588 |
// O2: address of 1st dimension |
|
589 |
__ set_info("new_multi_array", dont_gc_arguments); |
|
590 |
oop_maps = generate_stub_call(sasm, I0, CAST_FROM_FN_PTR(address, new_multi_array), I0, I1, I2); |
|
591 |
// I0 -> O0: new multi array |
|
592 |
} |
|
593 |
break; |
|
594 |
||
595 |
case register_finalizer_id: |
|
596 |
{ |
|
597 |
__ set_info("register_finalizer", dont_gc_arguments); |
|
598 |
||
599 |
// load the klass and check the has finalizer flag |
|
600 |
Label register_finalizer; |
|
601 |
Register t = O1; |
|
7427 | 602 |
__ load_klass(O0, t); |
11430
718fc06da49a
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
10972
diff
changeset
|
603 |
__ ld(t, in_bytes(Klass::access_flags_offset()), t); |
1 | 604 |
__ set(JVM_ACC_HAS_FINALIZER, G3); |
605 |
__ andcc(G3, t, G0); |
|
606 |
__ br(Assembler::notZero, false, Assembler::pt, register_finalizer); |
|
607 |
__ delayed()->nop(); |
|
608 |
||
609 |
// do a leaf return |
|
610 |
__ retl(); |
|
611 |
__ delayed()->nop(); |
|
612 |
||
613 |
__ bind(register_finalizer); |
|
614 |
OopMap* oop_map = save_live_registers(sasm); |
|
615 |
int call_offset = __ call_RT(noreg, noreg, |
|
616 |
CAST_FROM_FN_PTR(address, SharedRuntime::register_finalizer), I0); |
|
617 |
oop_maps = new OopMapSet(); |
|
618 |
oop_maps->add_gc_map(call_offset, oop_map); |
|
619 |
||
620 |
// Now restore all the live registers |
|
621 |
restore_live_registers(sasm); |
|
622 |
||
623 |
__ ret(); |
|
624 |
__ delayed()->restore(); |
|
625 |
} |
|
626 |
break; |
|
627 |
||
628 |
case throw_range_check_failed_id: |
|
629 |
{ __ set_info("range_check_failed", dont_gc_arguments); // arguments will be discarded |
|
630 |
// G4: index |
|
631 |
oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_range_check_exception), true); |
|
632 |
} |
|
633 |
break; |
|
634 |
||
635 |
case throw_index_exception_id: |
|
636 |
{ __ set_info("index_range_check_failed", dont_gc_arguments); // arguments will be discarded |
|
637 |
// G4: index |
|
638 |
oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_index_exception), true); |
|
639 |
} |
|
640 |
break; |
|
641 |
||
642 |
case throw_div0_exception_id: |
|
643 |
{ __ set_info("throw_div0_exception", dont_gc_arguments); |
|
644 |
oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_div0_exception), false); |
|
645 |
} |
|
646 |
break; |
|
647 |
||
648 |
case throw_null_pointer_exception_id: |
|
649 |
{ __ set_info("throw_null_pointer_exception", dont_gc_arguments); |
|
650 |
oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_null_pointer_exception), false); |
|
651 |
} |
|
652 |
break; |
|
653 |
||
654 |
case handle_exception_id: |
|
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
655 |
{ __ set_info("handle_exception", dont_gc_arguments); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
656 |
oop_maps = generate_handle_exception(id, sasm); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
657 |
} |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
658 |
break; |
1 | 659 |
|
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
660 |
case handle_exception_from_callee_id: |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
661 |
{ __ set_info("handle_exception_from_callee", dont_gc_arguments); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
662 |
oop_maps = generate_handle_exception(id, sasm); |
1 | 663 |
} |
664 |
break; |
|
665 |
||
666 |
case unwind_exception_id: |
|
667 |
{ |
|
668 |
// O0: exception |
|
669 |
// I7: address of call to this method |
|
670 |
||
671 |
__ set_info("unwind_exception", dont_gc_arguments); |
|
672 |
__ mov(Oexception, Oexception->after_save()); |
|
673 |
__ add(I7, frame::pc_return_offset, Oissuing_pc->after_save()); |
|
674 |
||
675 |
__ call_VM_leaf(L7_thread_cache, CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), |
|
5046 | 676 |
G2_thread, Oissuing_pc->after_save()); |
1 | 677 |
__ verify_not_null_oop(Oexception->after_save()); |
5687 | 678 |
|
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
679 |
// Restore SP from L7 if the exception PC is a method handle call site. |
5687 | 680 |
__ mov(O0, G5); // Save the target address. |
681 |
__ lduw(Address(G2_thread, JavaThread::is_method_handle_return_offset()), L0); |
|
682 |
__ tst(L0); // Condition codes are preserved over the restore. |
|
683 |
__ restore(); |
|
684 |
||
685 |
__ jmp(G5, 0); |
|
686 |
__ delayed()->movcc(Assembler::notZero, false, Assembler::icc, L7_mh_SP_save, SP); // Restore SP if required. |
|
1 | 687 |
} |
688 |
break; |
|
689 |
||
690 |
case throw_array_store_exception_id: |
|
691 |
{ |
|
692 |
__ set_info("throw_array_store_exception", dont_gc_arguments); |
|
8067
f5f4eac4c48f
7008809: should report the class in ArrayStoreExceptions from compiled code
never
parents:
7898
diff
changeset
|
693 |
oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_array_store_exception), true); |
1 | 694 |
} |
695 |
break; |
|
696 |
||
697 |
case throw_class_cast_exception_id: |
|
698 |
{ |
|
699 |
// G4: object |
|
700 |
__ set_info("throw_class_cast_exception", dont_gc_arguments); |
|
701 |
oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_class_cast_exception), true); |
|
702 |
} |
|
703 |
break; |
|
704 |
||
705 |
case throw_incompatible_class_change_error_id: |
|
706 |
{ |
|
707 |
__ set_info("throw_incompatible_class_cast_exception", dont_gc_arguments); |
|
708 |
oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_incompatible_class_change_error), false); |
|
709 |
} |
|
710 |
break; |
|
711 |
||
712 |
case slow_subtype_check_id: |
|
713 |
{ // Support for uint StubRoutine::partial_subtype_check( Klass sub, Klass super ); |
|
714 |
// Arguments : |
|
715 |
// |
|
716 |
// ret : G3 |
|
717 |
// sub : G3, argument, destroyed |
|
718 |
// super: G1, argument, not changed |
|
719 |
// raddr: O7, blown by call |
|
2256
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
1374
diff
changeset
|
720 |
Label miss; |
1 | 721 |
|
722 |
__ save_frame(0); // Blow no registers! |
|
723 |
||
2256
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
1374
diff
changeset
|
724 |
__ check_klass_subtype_slow_path(G3, G1, L0, L1, L2, L4, NULL, &miss); |
1 | 725 |
|
726 |
__ mov(1, G3); |
|
2256
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
1374
diff
changeset
|
727 |
__ ret(); // Result in G5 is 'true' |
1 | 728 |
__ delayed()->restore(); // free copy or add can go here |
729 |
||
730 |
__ bind(miss); |
|
731 |
__ mov(0, G3); |
|
2256
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
1374
diff
changeset
|
732 |
__ ret(); // Result in G5 is 'false' |
1 | 733 |
__ delayed()->restore(); // free copy or add can go here |
734 |
} |
|
735 |
||
736 |
case monitorenter_nofpu_id: |
|
737 |
case monitorenter_id: |
|
738 |
{ // G4: object |
|
739 |
// G5: lock address |
|
740 |
__ set_info("monitorenter", dont_gc_arguments); |
|
741 |
||
742 |
int save_fpu_registers = (id == monitorenter_id); |
|
743 |
// make a frame and preserve the caller's caller-save registers |
|
744 |
OopMap* oop_map = save_live_registers(sasm, save_fpu_registers); |
|
745 |
||
746 |
int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, monitorenter), G4, G5); |
|
747 |
||
748 |
oop_maps = new OopMapSet(); |
|
749 |
oop_maps->add_gc_map(call_offset, oop_map); |
|
750 |
restore_live_registers(sasm, save_fpu_registers); |
|
751 |
||
752 |
__ ret(); |
|
753 |
__ delayed()->restore(); |
|
754 |
} |
|
755 |
break; |
|
756 |
||
757 |
case monitorexit_nofpu_id: |
|
758 |
case monitorexit_id: |
|
759 |
{ // G4: lock address |
|
760 |
// note: really a leaf routine but must setup last java sp |
|
761 |
// => use call_RT for now (speed can be improved by |
|
762 |
// doing last java sp setup manually) |
|
763 |
__ set_info("monitorexit", dont_gc_arguments); |
|
764 |
||
765 |
int save_fpu_registers = (id == monitorexit_id); |
|
766 |
// make a frame and preserve the caller's caller-save registers |
|
767 |
OopMap* oop_map = save_live_registers(sasm, save_fpu_registers); |
|
768 |
||
769 |
int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, monitorexit), G4); |
|
770 |
||
771 |
oop_maps = new OopMapSet(); |
|
772 |
oop_maps->add_gc_map(call_offset, oop_map); |
|
773 |
restore_live_registers(sasm, save_fpu_registers); |
|
774 |
||
775 |
__ ret(); |
|
776 |
__ delayed()->restore(); |
|
10972
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10519
diff
changeset
|
777 |
} |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10519
diff
changeset
|
778 |
break; |
1 | 779 |
|
10972
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10519
diff
changeset
|
780 |
case deoptimize_id: |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10519
diff
changeset
|
781 |
{ |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10519
diff
changeset
|
782 |
__ set_info("deoptimize", dont_gc_arguments); |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10519
diff
changeset
|
783 |
OopMap* oop_map = save_live_registers(sasm); |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10519
diff
changeset
|
784 |
int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize)); |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10519
diff
changeset
|
785 |
oop_maps = new OopMapSet(); |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10519
diff
changeset
|
786 |
oop_maps->add_gc_map(call_offset, oop_map); |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10519
diff
changeset
|
787 |
restore_live_registers(sasm); |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10519
diff
changeset
|
788 |
DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob(); |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10519
diff
changeset
|
789 |
assert(deopt_blob != NULL, "deoptimization blob must have been created"); |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10519
diff
changeset
|
790 |
AddressLiteral dest(deopt_blob->unpack_with_reexecution()); |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10519
diff
changeset
|
791 |
__ jump_to(dest, O0); |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10519
diff
changeset
|
792 |
__ delayed()->restore(); |
1 | 793 |
} |
794 |
break; |
|
795 |
||
796 |
case access_field_patching_id: |
|
797 |
{ __ set_info("access_field_patching", dont_gc_arguments); |
|
798 |
oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, access_field_patching)); |
|
799 |
} |
|
800 |
break; |
|
801 |
||
802 |
case load_klass_patching_id: |
|
803 |
{ __ set_info("load_klass_patching", dont_gc_arguments); |
|
804 |
oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, move_klass_patching)); |
|
805 |
} |
|
806 |
break; |
|
807 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11439
diff
changeset
|
808 |
case load_mirror_patching_id: |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11439
diff
changeset
|
809 |
{ __ set_info("load_mirror_patching", dont_gc_arguments); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11439
diff
changeset
|
810 |
oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, move_mirror_patching)); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11439
diff
changeset
|
811 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11439
diff
changeset
|
812 |
break; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11439
diff
changeset
|
813 |
|
19710
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
17009
diff
changeset
|
814 |
case load_appendix_patching_id: |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
17009
diff
changeset
|
815 |
{ __ set_info("load_appendix_patching", dont_gc_arguments); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
17009
diff
changeset
|
816 |
oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, move_appendix_patching)); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
17009
diff
changeset
|
817 |
} |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
17009
diff
changeset
|
818 |
break; |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
17009
diff
changeset
|
819 |
|
1 | 820 |
case dtrace_object_alloc_id: |
821 |
{ // O0: object |
|
822 |
__ set_info("dtrace_object_alloc", dont_gc_arguments); |
|
823 |
// we can't gc here so skip the oopmap but make sure that all |
|
824 |
// the live registers get saved. |
|
825 |
save_live_registers(sasm); |
|
826 |
||
827 |
__ save_thread(L7_thread_cache); |
|
828 |
__ call(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_object_alloc), |
|
829 |
relocInfo::runtime_call_type); |
|
830 |
__ delayed()->mov(I0, O0); |
|
831 |
__ restore_thread(L7_thread_cache); |
|
832 |
||
833 |
restore_live_registers(sasm); |
|
834 |
__ ret(); |
|
835 |
__ delayed()->restore(); |
|
836 |
} |
|
837 |
break; |
|
838 |
||
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
839 |
#if INCLUDE_ALL_GCS |
1374 | 840 |
case g1_pre_barrier_slow_id: |
841 |
{ // G4: previous value of memory |
|
842 |
BarrierSet* bs = Universe::heap()->barrier_set(); |
|
843 |
if (bs->kind() != BarrierSet::G1SATBCTLogging) { |
|
844 |
__ save_frame(0); |
|
845 |
__ set((int)id, O1); |
|
846 |
__ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), I0); |
|
847 |
__ should_not_reach_here(); |
|
848 |
break; |
|
849 |
} |
|
850 |
||
851 |
__ set_info("g1_pre_barrier_slow_id", dont_gc_arguments); |
|
852 |
||
853 |
Register pre_val = G4; |
|
854 |
Register tmp = G1_scratch; |
|
855 |
Register tmp2 = G3_scratch; |
|
856 |
||
857 |
Label refill, restart; |
|
858 |
bool with_frame = false; // I don't know if we can do with-frame. |
|
859 |
int satb_q_index_byte_offset = |
|
860 |
in_bytes(JavaThread::satb_mark_queue_offset() + |
|
861 |
PtrQueue::byte_offset_of_index()); |
|
862 |
int satb_q_buf_byte_offset = |
|
863 |
in_bytes(JavaThread::satb_mark_queue_offset() + |
|
864 |
PtrQueue::byte_offset_of_buf()); |
|
10497
1bcff72a4b82
7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents:
10252
diff
changeset
|
865 |
|
1374 | 866 |
__ bind(restart); |
10497
1bcff72a4b82
7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents:
10252
diff
changeset
|
867 |
// Load the index into the SATB buffer. PtrQueue::_index is a |
1bcff72a4b82
7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents:
10252
diff
changeset
|
868 |
// size_t so ld_ptr is appropriate |
1374 | 869 |
__ ld_ptr(G2_thread, satb_q_index_byte_offset, tmp); |
870 |
||
10497
1bcff72a4b82
7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents:
10252
diff
changeset
|
871 |
// index == 0? |
1bcff72a4b82
7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents:
10252
diff
changeset
|
872 |
__ cmp_and_brx_short(tmp, G0, Assembler::equal, Assembler::pn, refill); |
1374 | 873 |
|
10497
1bcff72a4b82
7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents:
10252
diff
changeset
|
874 |
__ ld_ptr(G2_thread, satb_q_buf_byte_offset, tmp2); |
1374 | 875 |
__ sub(tmp, oopSize, tmp); |
876 |
||
877 |
__ st_ptr(pre_val, tmp2, tmp); // [_buf + index] := <address_of_card> |
|
878 |
// Use return-from-leaf |
|
879 |
__ retl(); |
|
880 |
__ delayed()->st_ptr(tmp, G2_thread, satb_q_index_byte_offset); |
|
881 |
||
882 |
__ bind(refill); |
|
883 |
__ save_frame(0); |
|
884 |
||
885 |
__ mov(pre_val, L0); |
|
886 |
__ mov(tmp, L1); |
|
887 |
__ mov(tmp2, L2); |
|
888 |
||
889 |
__ call_VM_leaf(L7_thread_cache, |
|
890 |
CAST_FROM_FN_PTR(address, |
|
891 |
SATBMarkQueueSet::handle_zero_index_for_thread), |
|
892 |
G2_thread); |
|
893 |
||
894 |
__ mov(L0, pre_val); |
|
895 |
__ mov(L1, tmp); |
|
896 |
__ mov(L2, tmp2); |
|
897 |
||
898 |
__ br(Assembler::always, /*annul*/false, Assembler::pt, restart); |
|
899 |
__ delayed()->restore(); |
|
900 |
} |
|
901 |
break; |
|
902 |
||
903 |
case g1_post_barrier_slow_id: |
|
904 |
{ |
|
905 |
BarrierSet* bs = Universe::heap()->barrier_set(); |
|
906 |
if (bs->kind() != BarrierSet::G1SATBCTLogging) { |
|
907 |
__ save_frame(0); |
|
908 |
__ set((int)id, O1); |
|
909 |
__ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), I0); |
|
910 |
__ should_not_reach_here(); |
|
911 |
break; |
|
912 |
} |
|
913 |
||
914 |
__ set_info("g1_post_barrier_slow_id", dont_gc_arguments); |
|
915 |
||
916 |
Register addr = G4; |
|
917 |
Register cardtable = G5; |
|
918 |
Register tmp = G1_scratch; |
|
919 |
Register tmp2 = G3_scratch; |
|
920 |
jbyte* byte_map_base = ((CardTableModRefBS*)bs)->byte_map_base; |
|
921 |
||
20403
45a89fbcd8f7
8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents:
19710
diff
changeset
|
922 |
Label not_already_dirty, restart, refill, young_card; |
1374 | 923 |
|
924 |
#ifdef _LP64 |
|
925 |
__ srlx(addr, CardTableModRefBS::card_shift, addr); |
|
926 |
#else |
|
927 |
__ srl(addr, CardTableModRefBS::card_shift, addr); |
|
928 |
#endif |
|
929 |
||
2571 | 930 |
AddressLiteral rs(byte_map_base); |
931 |
__ set(rs, cardtable); // cardtable := <card table base> |
|
1374 | 932 |
__ ldub(addr, cardtable, tmp); // tmp := [addr + cardtable] |
933 |
||
20403
45a89fbcd8f7
8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents:
19710
diff
changeset
|
934 |
__ cmp_and_br_short(tmp, G1SATBCardTableModRefBS::g1_young_card_val(), Assembler::equal, Assembler::pt, young_card); |
45a89fbcd8f7
8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents:
19710
diff
changeset
|
935 |
|
45a89fbcd8f7
8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents:
19710
diff
changeset
|
936 |
__ membar(Assembler::Membar_mask_bits(Assembler::StoreLoad)); |
45a89fbcd8f7
8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents:
19710
diff
changeset
|
937 |
__ ldub(addr, cardtable, tmp); // tmp := [addr + cardtable] |
45a89fbcd8f7
8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents:
19710
diff
changeset
|
938 |
|
10497
1bcff72a4b82
7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents:
10252
diff
changeset
|
939 |
assert(CardTableModRefBS::dirty_card_val() == 0, "otherwise check this code"); |
1bcff72a4b82
7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents:
10252
diff
changeset
|
940 |
__ cmp_and_br_short(tmp, G0, Assembler::notEqual, Assembler::pt, not_already_dirty); |
1374 | 941 |
|
20403
45a89fbcd8f7
8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents:
19710
diff
changeset
|
942 |
__ bind(young_card); |
1374 | 943 |
// We didn't take the branch, so we're already dirty: return. |
944 |
// Use return-from-leaf |
|
945 |
__ retl(); |
|
946 |
__ delayed()->nop(); |
|
947 |
||
948 |
// Not dirty. |
|
949 |
__ bind(not_already_dirty); |
|
10497
1bcff72a4b82
7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents:
10252
diff
changeset
|
950 |
|
1bcff72a4b82
7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents:
10252
diff
changeset
|
951 |
// Get cardtable + tmp into a reg by itself |
1bcff72a4b82
7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents:
10252
diff
changeset
|
952 |
__ add(addr, cardtable, tmp2); |
1bcff72a4b82
7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents:
10252
diff
changeset
|
953 |
|
1374 | 954 |
// First, dirty it. |
955 |
__ stb(G0, tmp2, 0); // [cardPtr] := 0 (i.e., dirty). |
|
956 |
||
957 |
Register tmp3 = cardtable; |
|
958 |
Register tmp4 = tmp; |
|
959 |
||
960 |
// these registers are now dead |
|
961 |
addr = cardtable = tmp = noreg; |
|
962 |
||
963 |
int dirty_card_q_index_byte_offset = |
|
964 |
in_bytes(JavaThread::dirty_card_queue_offset() + |
|
965 |
PtrQueue::byte_offset_of_index()); |
|
966 |
int dirty_card_q_buf_byte_offset = |
|
967 |
in_bytes(JavaThread::dirty_card_queue_offset() + |
|
968 |
PtrQueue::byte_offset_of_buf()); |
|
10497
1bcff72a4b82
7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents:
10252
diff
changeset
|
969 |
|
1374 | 970 |
__ bind(restart); |
10497
1bcff72a4b82
7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents:
10252
diff
changeset
|
971 |
|
1bcff72a4b82
7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents:
10252
diff
changeset
|
972 |
// Get the index into the update buffer. PtrQueue::_index is |
1bcff72a4b82
7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents:
10252
diff
changeset
|
973 |
// a size_t so ld_ptr is appropriate here. |
1374 | 974 |
__ ld_ptr(G2_thread, dirty_card_q_index_byte_offset, tmp3); |
975 |
||
10497
1bcff72a4b82
7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents:
10252
diff
changeset
|
976 |
// index == 0? |
1bcff72a4b82
7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents:
10252
diff
changeset
|
977 |
__ cmp_and_brx_short(tmp3, G0, Assembler::equal, Assembler::pn, refill); |
1bcff72a4b82
7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents:
10252
diff
changeset
|
978 |
|
1bcff72a4b82
7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents:
10252
diff
changeset
|
979 |
__ ld_ptr(G2_thread, dirty_card_q_buf_byte_offset, tmp4); |
1374 | 980 |
__ sub(tmp3, oopSize, tmp3); |
981 |
||
982 |
__ st_ptr(tmp2, tmp4, tmp3); // [_buf + index] := <address_of_card> |
|
983 |
// Use return-from-leaf |
|
984 |
__ retl(); |
|
985 |
__ delayed()->st_ptr(tmp3, G2_thread, dirty_card_q_index_byte_offset); |
|
986 |
||
987 |
__ bind(refill); |
|
988 |
__ save_frame(0); |
|
989 |
||
990 |
__ mov(tmp2, L0); |
|
991 |
__ mov(tmp3, L1); |
|
992 |
__ mov(tmp4, L2); |
|
993 |
||
994 |
__ call_VM_leaf(L7_thread_cache, |
|
995 |
CAST_FROM_FN_PTR(address, |
|
996 |
DirtyCardQueueSet::handle_zero_index_for_thread), |
|
997 |
G2_thread); |
|
998 |
||
999 |
__ mov(L0, tmp2); |
|
1000 |
__ mov(L1, tmp3); |
|
1001 |
__ mov(L2, tmp4); |
|
1002 |
||
1003 |
__ br(Assembler::always, /*annul*/false, Assembler::pt, restart); |
|
1004 |
__ delayed()->restore(); |
|
1005 |
} |
|
1006 |
break; |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
1007 |
#endif // INCLUDE_ALL_GCS |
1374 | 1008 |
|
16611 | 1009 |
case predicate_failed_trap_id: |
1010 |
{ |
|
1011 |
__ set_info("predicate_failed_trap", dont_gc_arguments); |
|
1012 |
OopMap* oop_map = save_live_registers(sasm); |
|
1013 |
||
1014 |
int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, predicate_failed_trap)); |
|
1015 |
||
1016 |
oop_maps = new OopMapSet(); |
|
1017 |
oop_maps->add_gc_map(call_offset, oop_map); |
|
1018 |
||
1019 |
DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob(); |
|
1020 |
assert(deopt_blob != NULL, "deoptimization blob must have been created"); |
|
1021 |
restore_live_registers(sasm); |
|
17009
f5fe7861d135
8011582: assert(nbits == 32 || (-(1 << nbits-1) <= x && x < ( 1 << nbits-1))) failed: value out of range
roland
parents:
16611
diff
changeset
|
1022 |
|
f5fe7861d135
8011582: assert(nbits == 32 || (-(1 << nbits-1) <= x && x < ( 1 << nbits-1))) failed: value out of range
roland
parents:
16611
diff
changeset
|
1023 |
AddressLiteral dest(deopt_blob->unpack_with_reexecution()); |
f5fe7861d135
8011582: assert(nbits == 32 || (-(1 << nbits-1) <= x && x < ( 1 << nbits-1))) failed: value out of range
roland
parents:
16611
diff
changeset
|
1024 |
__ jump_to(dest, O0); |
f5fe7861d135
8011582: assert(nbits == 32 || (-(1 << nbits-1) <= x && x < ( 1 << nbits-1))) failed: value out of range
roland
parents:
16611
diff
changeset
|
1025 |
__ delayed()->restore(); |
16611 | 1026 |
} |
1027 |
break; |
|
1028 |
||
1 | 1029 |
default: |
1030 |
{ __ set_info("unimplemented entry", dont_gc_arguments); |
|
1031 |
__ save_frame(0); |
|
1032 |
__ set((int)id, O1); |
|
1033 |
__ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), O1); |
|
1034 |
__ should_not_reach_here(); |
|
1035 |
} |
|
1036 |
break; |
|
1037 |
} |
|
1038 |
return oop_maps; |
|
1039 |
} |
|
1040 |
||
1041 |
||
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1042 |
OopMapSet* Runtime1::generate_handle_exception(StubID id, StubAssembler* sasm) { |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1043 |
__ block_comment("generate_handle_exception"); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1044 |
|
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1045 |
// Save registers, if required. |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1046 |
OopMapSet* oop_maps = new OopMapSet(); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1047 |
OopMap* oop_map = NULL; |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1048 |
switch (id) { |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1049 |
case forward_exception_id: |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1050 |
// We're handling an exception in the context of a compiled frame. |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1051 |
// The registers have been saved in the standard places. Perform |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1052 |
// an exception lookup in the caller and dispatch to the handler |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1053 |
// if found. Otherwise unwind and dispatch to the callers |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1054 |
// exception handler. |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1055 |
oop_map = generate_oop_map(sasm, true); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1056 |
|
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1057 |
// transfer the pending exception to the exception_oop |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1058 |
__ ld_ptr(G2_thread, in_bytes(JavaThread::pending_exception_offset()), Oexception); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1059 |
__ ld_ptr(Oexception, 0, G0); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1060 |
__ st_ptr(G0, G2_thread, in_bytes(JavaThread::pending_exception_offset())); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1061 |
__ add(I7, frame::pc_return_offset, Oissuing_pc); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1062 |
break; |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1063 |
case handle_exception_id: |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1064 |
// At this point all registers MAY be live. |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1065 |
oop_map = save_live_registers(sasm); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1066 |
__ mov(Oexception->after_save(), Oexception); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1067 |
__ mov(Oissuing_pc->after_save(), Oissuing_pc); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1068 |
break; |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1069 |
case handle_exception_from_callee_id: |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1070 |
// At this point all registers except exception oop (Oexception) |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1071 |
// and exception pc (Oissuing_pc) are dead. |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1072 |
oop_map = new OopMap(frame_size_in_bytes / sizeof(jint), 0); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1073 |
sasm->set_frame_size(frame_size_in_bytes / BytesPerWord); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1074 |
__ save_frame_c1(frame_size_in_bytes); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1075 |
__ mov(Oexception->after_save(), Oexception); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1076 |
__ mov(Oissuing_pc->after_save(), Oissuing_pc); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1077 |
break; |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1078 |
default: ShouldNotReachHere(); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1079 |
} |
1 | 1080 |
|
1081 |
__ verify_not_null_oop(Oexception); |
|
1082 |
||
20703
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
19710
diff
changeset
|
1083 |
#ifdef ASSERT |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
19710
diff
changeset
|
1084 |
// check that fields in JavaThread for exception oop and issuing pc are |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
19710
diff
changeset
|
1085 |
// empty before writing to them |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
19710
diff
changeset
|
1086 |
Label oop_empty; |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
19710
diff
changeset
|
1087 |
Register scratch = I7; // We can use I7 here because it's overwritten later anyway. |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
19710
diff
changeset
|
1088 |
__ ld_ptr(Address(G2_thread, JavaThread::exception_oop_offset()), scratch); |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
19710
diff
changeset
|
1089 |
__ br_null(scratch, false, Assembler::pt, oop_empty); |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
19710
diff
changeset
|
1090 |
__ delayed()->nop(); |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
19710
diff
changeset
|
1091 |
__ stop("exception oop already set"); |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
19710
diff
changeset
|
1092 |
__ bind(oop_empty); |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
19710
diff
changeset
|
1093 |
|
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
19710
diff
changeset
|
1094 |
Label pc_empty; |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
19710
diff
changeset
|
1095 |
__ ld_ptr(Address(G2_thread, JavaThread::exception_pc_offset()), scratch); |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
19710
diff
changeset
|
1096 |
__ br_null(scratch, false, Assembler::pt, pc_empty); |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
19710
diff
changeset
|
1097 |
__ delayed()->nop(); |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
19710
diff
changeset
|
1098 |
__ stop("exception pc already set"); |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
19710
diff
changeset
|
1099 |
__ bind(pc_empty); |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
19710
diff
changeset
|
1100 |
#endif |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
19710
diff
changeset
|
1101 |
|
1 | 1102 |
// save the exception and issuing pc in the thread |
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1103 |
__ st_ptr(Oexception, G2_thread, in_bytes(JavaThread::exception_oop_offset())); |
1 | 1104 |
__ st_ptr(Oissuing_pc, G2_thread, in_bytes(JavaThread::exception_pc_offset())); |
1105 |
||
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1106 |
// use the throwing pc as the return address to lookup (has bci & oop map) |
1 | 1107 |
__ mov(Oissuing_pc, I7); |
1108 |
__ sub(I7, frame::pc_return_offset, I7); |
|
1109 |
int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, exception_handler_for_pc)); |
|
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1110 |
oop_maps->add_gc_map(call_offset, oop_map); |
1 | 1111 |
|
1112 |
// Note: if nmethod has been deoptimized then regardless of |
|
1113 |
// whether it had a handler or not we will deoptimize |
|
1114 |
// by entering the deopt blob with a pending exception. |
|
1115 |
||
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1116 |
// Restore the registers that were saved at the beginning, remove |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1117 |
// the frame and jump to the exception handler. |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1118 |
switch (id) { |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1119 |
case forward_exception_id: |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1120 |
case handle_exception_id: |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1121 |
restore_live_registers(sasm); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1122 |
__ jmp(O0, 0); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1123 |
__ delayed()->restore(); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1124 |
break; |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1125 |
case handle_exception_from_callee_id: |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1126 |
// Restore SP from L7 if the exception PC is a method handle call site. |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1127 |
__ mov(O0, G5); // Save the target address. |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1128 |
__ lduw(Address(G2_thread, JavaThread::is_method_handle_return_offset()), L0); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1129 |
__ tst(L0); // Condition codes are preserved over the restore. |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1130 |
__ restore(); |
1 | 1131 |
|
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1132 |
__ jmp(G5, 0); // jump to the exception handler |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1133 |
__ delayed()->movcc(Assembler::notZero, false, Assembler::icc, L7_mh_SP_save, SP); // Restore SP if required. |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1134 |
break; |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1135 |
default: ShouldNotReachHere(); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1136 |
} |
1 | 1137 |
|
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8069
diff
changeset
|
1138 |
return oop_maps; |
1 | 1139 |
} |
1140 |
||
1141 |
||
1142 |
#undef __ |
|
1143 |
||
6176
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5702
diff
changeset
|
1144 |
const char *Runtime1::pd_name_for_address(address entry) { |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5702
diff
changeset
|
1145 |
return "<unknown function>"; |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5702
diff
changeset
|
1146 |
} |