Mercurial > hg > truffle
annotate src/cpu/x86/vm/c1_Runtime1_x86.cpp @ 4695:e29339f342de
Removed HandleException runtime call and associated C++ code (unused).
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sat, 25 Feb 2012 00:52:58 +0100 |
parents | 723df37192d6 |
children | 33df1aeaebbf |
rev | line source |
---|---|
0 | 1 /* |
2100
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
2002
diff
changeset
|
2 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1368
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1368
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1368
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
2415
09f96c3ff1ad
7032388: guarantee(VM_Version::supports_cmov()) failed: illegal instruction on i586 after 6919934
twisti
parents:
2321
diff
changeset
|
26 #include "asm/assembler.hpp" |
1972 | 27 #include "c1/c1_Defs.hpp" |
28 #include "c1/c1_MacroAssembler.hpp" | |
29 #include "c1/c1_Runtime1.hpp" | |
30 #include "interpreter/interpreter.hpp" | |
31 #include "nativeInst_x86.hpp" | |
32 #include "oops/compiledICHolderOop.hpp" | |
33 #include "oops/oop.inline.hpp" | |
34 #include "prims/jvmtiExport.hpp" | |
35 #include "register_x86.hpp" | |
36 #include "runtime/sharedRuntime.hpp" | |
37 #include "runtime/signature.hpp" | |
38 #include "runtime/vframeArray.hpp" | |
39 #include "vmreg_x86.inline.hpp" | |
0 | 40 |
2662
440ceca8e3d7
Add exception handlers only to Invoke and Throw instructions. Deoptimize if there is an exception in a HotSpot runtime call.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2608
diff
changeset
|
41 static void restore_live_registers(StubAssembler* sasm, bool restore_fpu_registers = true); |
0 | 42 |
43 // Implementation of StubAssembler | |
44 | |
45 int StubAssembler::call_RT(Register oop_result1, Register oop_result2, address entry, int args_size) { | |
46 // setup registers | |
304 | 47 const Register thread = NOT_LP64(rdi) LP64_ONLY(r15_thread); // is callee-saved register (Visual C++ calling conventions) |
0 | 48 assert(!(oop_result1->is_valid() || oop_result2->is_valid()) || oop_result1 != oop_result2, "registers must be different"); |
49 assert(oop_result1 != thread && oop_result2 != thread, "registers must be different"); | |
50 assert(args_size >= 0, "illegal args_size"); | |
51 | |
304 | 52 #ifdef _LP64 |
53 mov(c_rarg0, thread); | |
54 set_num_rt_args(0); // Nothing on stack | |
55 #else | |
0 | 56 set_num_rt_args(1 + args_size); |
57 | |
58 // push java thread (becomes first argument of C function) | |
59 get_thread(thread); | |
304 | 60 push(thread); |
61 #endif // _LP64 | |
0 | 62 |
63 set_last_Java_frame(thread, noreg, rbp, NULL); | |
304 | 64 |
0 | 65 // do the call |
66 call(RuntimeAddress(entry)); | |
67 int call_offset = offset(); | |
68 // verify callee-saved register | |
69 #ifdef ASSERT | |
70 guarantee(thread != rax, "change this code"); | |
304 | 71 push(rax); |
0 | 72 { Label L; |
73 get_thread(rax); | |
304 | 74 cmpptr(thread, rax); |
0 | 75 jcc(Assembler::equal, L); |
76 int3(); | |
77 stop("StubAssembler::call_RT: rdi not callee saved?"); | |
78 bind(L); | |
79 } | |
304 | 80 pop(rax); |
0 | 81 #endif |
82 reset_last_Java_frame(thread, true, false); | |
83 | |
84 // discard thread and arguments | |
304 | 85 NOT_LP64(addptr(rsp, num_rt_args()*BytesPerWord)); |
0 | 86 |
87 // check for pending exceptions | |
88 { Label L; | |
304 | 89 cmpptr(Address(thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD); |
0 | 90 jcc(Assembler::equal, L); |
91 // exception pending => remove activation and forward to exception handler | |
304 | 92 movptr(rax, Address(thread, Thread::pending_exception_offset())); |
0 | 93 // make sure that the vm_results are cleared |
94 if (oop_result1->is_valid()) { | |
512
db4caa99ef11
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents:
380
diff
changeset
|
95 movptr(Address(thread, JavaThread::vm_result_offset()), NULL_WORD); |
0 | 96 } |
97 if (oop_result2->is_valid()) { | |
512
db4caa99ef11
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents:
380
diff
changeset
|
98 movptr(Address(thread, JavaThread::vm_result_2_offset()), NULL_WORD); |
0 | 99 } |
2662
440ceca8e3d7
Add exception handlers only to Invoke and Throw instructions. Deoptimize if there is an exception in a HotSpot runtime call.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2608
diff
changeset
|
100 // (tw) Deoptimize in case of an exception. |
440ceca8e3d7
Add exception handlers only to Invoke and Throw instructions. Deoptimize if there is an exception in a HotSpot runtime call.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2608
diff
changeset
|
101 restore_live_registers(this, false); |
440ceca8e3d7
Add exception handlers only to Invoke and Throw instructions. Deoptimize if there is an exception in a HotSpot runtime call.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2608
diff
changeset
|
102 movptr(Address(thread, Thread::pending_exception_offset()), NULL_WORD); |
440ceca8e3d7
Add exception handlers only to Invoke and Throw instructions. Deoptimize if there is an exception in a HotSpot runtime call.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2608
diff
changeset
|
103 leave(); |
3509
28ba2439034f
recompile upon deoptimizations that are caused by runtime exceptions
Lukas Stadler <lukas.stadler@jku.at>
parents:
2891
diff
changeset
|
104 movl(rscratch1, 2); // InvalidateRecompile |
2662
440ceca8e3d7
Add exception handlers only to Invoke and Throw instructions. Deoptimize if there is an exception in a HotSpot runtime call.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2608
diff
changeset
|
105 jump(RuntimeAddress(SharedRuntime::deopt_blob()->uncommon_trap())); |
0 | 106 bind(L); |
107 } | |
108 // get oop results if there are any and reset the values in the thread | |
109 if (oop_result1->is_valid()) { | |
304 | 110 movptr(oop_result1, Address(thread, JavaThread::vm_result_offset())); |
512
db4caa99ef11
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents:
380
diff
changeset
|
111 movptr(Address(thread, JavaThread::vm_result_offset()), NULL_WORD); |
0 | 112 verify_oop(oop_result1); |
113 } | |
114 if (oop_result2->is_valid()) { | |
304 | 115 movptr(oop_result2, Address(thread, JavaThread::vm_result_2_offset())); |
512
db4caa99ef11
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents:
380
diff
changeset
|
116 movptr(Address(thread, JavaThread::vm_result_2_offset()), NULL_WORD); |
0 | 117 verify_oop(oop_result2); |
118 } | |
119 return call_offset; | |
120 } | |
121 | |
122 | |
123 int StubAssembler::call_RT(Register oop_result1, Register oop_result2, address entry, Register arg1) { | |
304 | 124 #ifdef _LP64 |
125 mov(c_rarg1, arg1); | |
126 #else | |
127 push(arg1); | |
128 #endif // _LP64 | |
0 | 129 return call_RT(oop_result1, oop_result2, entry, 1); |
130 } | |
131 | |
132 | |
133 int StubAssembler::call_RT(Register oop_result1, Register oop_result2, address entry, Register arg1, Register arg2) { | |
304 | 134 #ifdef _LP64 |
135 if (c_rarg1 == arg2) { | |
136 if (c_rarg2 == arg1) { | |
137 xchgq(arg1, arg2); | |
138 } else { | |
139 mov(c_rarg2, arg2); | |
140 mov(c_rarg1, arg1); | |
141 } | |
142 } else { | |
143 mov(c_rarg1, arg1); | |
144 mov(c_rarg2, arg2); | |
145 } | |
146 #else | |
147 push(arg2); | |
148 push(arg1); | |
149 #endif // _LP64 | |
0 | 150 return call_RT(oop_result1, oop_result2, entry, 2); |
151 } | |
152 | |
153 | |
154 int StubAssembler::call_RT(Register oop_result1, Register oop_result2, address entry, Register arg1, Register arg2, Register arg3) { | |
304 | 155 #ifdef _LP64 |
156 // if there is any conflict use the stack | |
157 if (arg1 == c_rarg2 || arg1 == c_rarg3 || | |
158 arg2 == c_rarg1 || arg1 == c_rarg3 || | |
159 arg3 == c_rarg1 || arg1 == c_rarg2) { | |
160 push(arg3); | |
161 push(arg2); | |
162 push(arg1); | |
163 pop(c_rarg1); | |
164 pop(c_rarg2); | |
165 pop(c_rarg3); | |
166 } else { | |
167 mov(c_rarg1, arg1); | |
168 mov(c_rarg2, arg2); | |
169 mov(c_rarg3, arg3); | |
170 } | |
171 #else | |
172 push(arg3); | |
173 push(arg2); | |
174 push(arg1); | |
175 #endif // _LP64 | |
0 | 176 return call_RT(oop_result1, oop_result2, entry, 3); |
177 } | |
178 | |
179 | |
180 // Implementation of StubFrame | |
181 | |
182 class StubFrame: public StackObj { | |
183 private: | |
184 StubAssembler* _sasm; | |
185 | |
186 public: | |
187 StubFrame(StubAssembler* sasm, const char* name, bool must_gc_arguments); | |
188 void load_argument(int offset_in_words, Register reg); | |
189 | |
190 ~StubFrame(); | |
191 }; | |
192 | |
193 | |
194 #define __ _sasm-> | |
195 | |
196 StubFrame::StubFrame(StubAssembler* sasm, const char* name, bool must_gc_arguments) { | |
197 _sasm = sasm; | |
198 __ set_info(name, must_gc_arguments); | |
199 __ enter(); | |
200 } | |
201 | |
202 // load parameters that were stored with LIR_Assembler::store_parameter | |
203 // Note: offsets for store_parameter and load_argument must match | |
204 void StubFrame::load_argument(int offset_in_words, Register reg) { | |
205 // rbp, + 0: link | |
206 // + 1: return address | |
207 // + 2: argument with offset 0 | |
208 // + 3: argument with offset 1 | |
209 // + 4: ... | |
210 | |
304 | 211 __ movptr(reg, Address(rbp, (offset_in_words + 2) * BytesPerWord)); |
0 | 212 } |
213 | |
214 | |
215 StubFrame::~StubFrame() { | |
216 __ leave(); | |
217 __ ret(0); | |
218 } | |
219 | |
220 #undef __ | |
221 | |
222 | |
223 // Implementation of Runtime1 | |
224 | |
225 #define __ sasm-> | |
226 | |
304 | 227 const int float_regs_as_doubles_size_in_slots = pd_nof_fpu_regs_frame_map * 2; |
228 const int xmm_regs_as_doubles_size_in_slots = FrameMap::nof_xmm_regs * 2; | |
0 | 229 |
230 // Stack layout for saving/restoring all the registers needed during a runtime | |
231 // call (this includes deoptimization) | |
232 // Note: note that users of this frame may well have arguments to some runtime | |
233 // while these values are on the stack. These positions neglect those arguments | |
234 // but the code in save_live_registers will take the argument count into | |
235 // account. | |
236 // | |
304 | 237 #ifdef _LP64 |
238 #define SLOT2(x) x, | |
239 #define SLOT_PER_WORD 2 | |
240 #else | |
241 #define SLOT2(x) | |
242 #define SLOT_PER_WORD 1 | |
243 #endif // _LP64 | |
244 | |
0 | 245 enum reg_save_layout { |
304 | 246 // 64bit needs to keep stack 16 byte aligned. So we add some alignment dummies to make that |
247 // happen and will assert if the stack size we create is misaligned | |
248 #ifdef _LP64 | |
249 align_dummy_0, align_dummy_1, | |
250 #endif // _LP64 | |
2321
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
251 #ifdef _WIN64 |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
252 // Windows always allocates space for it's argument registers (see |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
253 // frame::arg_reg_save_area_bytes). |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
254 arg_reg_save_1, arg_reg_save_1H, // 0, 4 |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
255 arg_reg_save_2, arg_reg_save_2H, // 8, 12 |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
256 arg_reg_save_3, arg_reg_save_3H, // 16, 20 |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
257 arg_reg_save_4, arg_reg_save_4H, // 24, 28 |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
258 #endif // _WIN64 |
304 | 259 xmm_regs_as_doubles_off, // 32 |
260 float_regs_as_doubles_off = xmm_regs_as_doubles_off + xmm_regs_as_doubles_size_in_slots, // 160 | |
261 fpu_state_off = float_regs_as_doubles_off + float_regs_as_doubles_size_in_slots, // 224 | |
262 // fpu_state_end_off is exclusive | |
263 fpu_state_end_off = fpu_state_off + (FPUStateSizeInWords / SLOT_PER_WORD), // 352 | |
264 marker = fpu_state_end_off, SLOT2(markerH) // 352, 356 | |
265 extra_space_offset, // 360 | |
266 #ifdef _LP64 | |
267 r15_off = extra_space_offset, r15H_off, // 360, 364 | |
268 r14_off, r14H_off, // 368, 372 | |
269 r13_off, r13H_off, // 376, 380 | |
270 r12_off, r12H_off, // 384, 388 | |
271 r11_off, r11H_off, // 392, 396 | |
272 r10_off, r10H_off, // 400, 404 | |
273 r9_off, r9H_off, // 408, 412 | |
274 r8_off, r8H_off, // 416, 420 | |
275 rdi_off, rdiH_off, // 424, 428 | |
276 #else | |
0 | 277 rdi_off = extra_space_offset, |
304 | 278 #endif // _LP64 |
279 rsi_off, SLOT2(rsiH_off) // 432, 436 | |
280 rbp_off, SLOT2(rbpH_off) // 440, 444 | |
281 rsp_off, SLOT2(rspH_off) // 448, 452 | |
282 rbx_off, SLOT2(rbxH_off) // 456, 460 | |
283 rdx_off, SLOT2(rdxH_off) // 464, 468 | |
284 rcx_off, SLOT2(rcxH_off) // 472, 476 | |
285 rax_off, SLOT2(raxH_off) // 480, 484 | |
286 saved_rbp_off, SLOT2(saved_rbpH_off) // 488, 492 | |
287 return_off, SLOT2(returnH_off) // 496, 500 | |
2321
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
288 reg_save_frame_size // As noted: neglects any parameters to runtime // 504 |
0 | 289 }; |
290 | |
291 | |
292 | |
293 // Save off registers which might be killed by calls into the runtime. | |
294 // Tries to smart of about FP registers. In particular we separate | |
295 // saving and describing the FPU registers for deoptimization since we | |
296 // have to save the FPU registers twice if we describe them and on P4 | |
297 // saving FPU registers which don't contain anything appears | |
298 // expensive. The deopt blob is the only thing which needs to | |
299 // describe FPU registers. In all other cases it should be sufficient | |
300 // to simply save their current value. | |
301 | |
302 static OopMap* generate_oop_map(StubAssembler* sasm, int num_rt_args, | |
303 bool save_fpu_registers = true) { | |
304 | 304 |
305 // In 64bit all the args are in regs so there are no additional stack slots | |
306 LP64_ONLY(num_rt_args = 0); | |
307 LP64_ONLY(assert((reg_save_frame_size * VMRegImpl::stack_slot_size) % 16 == 0, "must be 16 byte aligned");) | |
308 int frame_size_in_slots = reg_save_frame_size + num_rt_args; // args + thread | |
309 sasm->set_frame_size(frame_size_in_slots / VMRegImpl::slots_per_word ); | |
0 | 310 |
311 // record saved value locations in an OopMap | |
312 // locations are offsets from sp after runtime call; num_rt_args is number of arguments in call, including thread | |
304 | 313 OopMap* map = new OopMap(frame_size_in_slots, 0); |
0 | 314 map->set_callee_saved(VMRegImpl::stack2reg(rax_off + num_rt_args), rax->as_VMReg()); |
315 map->set_callee_saved(VMRegImpl::stack2reg(rcx_off + num_rt_args), rcx->as_VMReg()); | |
316 map->set_callee_saved(VMRegImpl::stack2reg(rdx_off + num_rt_args), rdx->as_VMReg()); | |
317 map->set_callee_saved(VMRegImpl::stack2reg(rbx_off + num_rt_args), rbx->as_VMReg()); | |
318 map->set_callee_saved(VMRegImpl::stack2reg(rsi_off + num_rt_args), rsi->as_VMReg()); | |
319 map->set_callee_saved(VMRegImpl::stack2reg(rdi_off + num_rt_args), rdi->as_VMReg()); | |
304 | 320 #ifdef _LP64 |
321 map->set_callee_saved(VMRegImpl::stack2reg(r8_off + num_rt_args), r8->as_VMReg()); | |
322 map->set_callee_saved(VMRegImpl::stack2reg(r9_off + num_rt_args), r9->as_VMReg()); | |
323 map->set_callee_saved(VMRegImpl::stack2reg(r10_off + num_rt_args), r10->as_VMReg()); | |
324 map->set_callee_saved(VMRegImpl::stack2reg(r11_off + num_rt_args), r11->as_VMReg()); | |
325 map->set_callee_saved(VMRegImpl::stack2reg(r12_off + num_rt_args), r12->as_VMReg()); | |
326 map->set_callee_saved(VMRegImpl::stack2reg(r13_off + num_rt_args), r13->as_VMReg()); | |
327 map->set_callee_saved(VMRegImpl::stack2reg(r14_off + num_rt_args), r14->as_VMReg()); | |
328 map->set_callee_saved(VMRegImpl::stack2reg(r15_off + num_rt_args), r15->as_VMReg()); | |
329 | |
330 // This is stupid but needed. | |
331 map->set_callee_saved(VMRegImpl::stack2reg(raxH_off + num_rt_args), rax->as_VMReg()->next()); | |
332 map->set_callee_saved(VMRegImpl::stack2reg(rcxH_off + num_rt_args), rcx->as_VMReg()->next()); | |
333 map->set_callee_saved(VMRegImpl::stack2reg(rdxH_off + num_rt_args), rdx->as_VMReg()->next()); | |
334 map->set_callee_saved(VMRegImpl::stack2reg(rbxH_off + num_rt_args), rbx->as_VMReg()->next()); | |
335 map->set_callee_saved(VMRegImpl::stack2reg(rsiH_off + num_rt_args), rsi->as_VMReg()->next()); | |
336 map->set_callee_saved(VMRegImpl::stack2reg(rdiH_off + num_rt_args), rdi->as_VMReg()->next()); | |
337 | |
338 map->set_callee_saved(VMRegImpl::stack2reg(r8H_off + num_rt_args), r8->as_VMReg()->next()); | |
339 map->set_callee_saved(VMRegImpl::stack2reg(r9H_off + num_rt_args), r9->as_VMReg()->next()); | |
340 map->set_callee_saved(VMRegImpl::stack2reg(r10H_off + num_rt_args), r10->as_VMReg()->next()); | |
341 map->set_callee_saved(VMRegImpl::stack2reg(r11H_off + num_rt_args), r11->as_VMReg()->next()); | |
342 map->set_callee_saved(VMRegImpl::stack2reg(r12H_off + num_rt_args), r12->as_VMReg()->next()); | |
343 map->set_callee_saved(VMRegImpl::stack2reg(r13H_off + num_rt_args), r13->as_VMReg()->next()); | |
344 map->set_callee_saved(VMRegImpl::stack2reg(r14H_off + num_rt_args), r14->as_VMReg()->next()); | |
345 map->set_callee_saved(VMRegImpl::stack2reg(r15H_off + num_rt_args), r15->as_VMReg()->next()); | |
346 #endif // _LP64 | |
0 | 347 |
348 if (save_fpu_registers) { | |
349 if (UseSSE < 2) { | |
350 int fpu_off = float_regs_as_doubles_off; | |
351 for (int n = 0; n < FrameMap::nof_fpu_regs; n++) { | |
352 VMReg fpu_name_0 = FrameMap::fpu_regname(n); | |
353 map->set_callee_saved(VMRegImpl::stack2reg(fpu_off + num_rt_args), fpu_name_0); | |
354 // %%% This is really a waste but we'll keep things as they were for now | |
355 if (true) { | |
356 map->set_callee_saved(VMRegImpl::stack2reg(fpu_off + 1 + num_rt_args), fpu_name_0->next()); | |
357 } | |
358 fpu_off += 2; | |
359 } | |
360 assert(fpu_off == fpu_state_off, "incorrect number of fpu stack slots"); | |
361 } | |
362 | |
363 if (UseSSE >= 2) { | |
364 int xmm_off = xmm_regs_as_doubles_off; | |
365 for (int n = 0; n < FrameMap::nof_xmm_regs; n++) { | |
366 VMReg xmm_name_0 = as_XMMRegister(n)->as_VMReg(); | |
367 map->set_callee_saved(VMRegImpl::stack2reg(xmm_off + num_rt_args), xmm_name_0); | |
368 // %%% This is really a waste but we'll keep things as they were for now | |
369 if (true) { | |
370 map->set_callee_saved(VMRegImpl::stack2reg(xmm_off + 1 + num_rt_args), xmm_name_0->next()); | |
371 } | |
372 xmm_off += 2; | |
373 } | |
374 assert(xmm_off == float_regs_as_doubles_off, "incorrect number of xmm registers"); | |
375 | |
376 } else if (UseSSE == 1) { | |
377 int xmm_off = xmm_regs_as_doubles_off; | |
378 for (int n = 0; n < FrameMap::nof_xmm_regs; n++) { | |
379 VMReg xmm_name_0 = as_XMMRegister(n)->as_VMReg(); | |
380 map->set_callee_saved(VMRegImpl::stack2reg(xmm_off + num_rt_args), xmm_name_0); | |
381 xmm_off += 2; | |
382 } | |
383 assert(xmm_off == float_regs_as_doubles_off, "incorrect number of xmm registers"); | |
384 } | |
385 } | |
386 | |
387 return map; | |
388 } | |
389 | |
390 static OopMap* save_live_registers(StubAssembler* sasm, int num_rt_args, | |
391 bool save_fpu_registers = true) { | |
392 __ block_comment("save_live_registers"); | |
393 | |
304 | 394 __ pusha(); // integer registers |
0 | 395 |
396 // assert(float_regs_as_doubles_off % 2 == 0, "misaligned offset"); | |
397 // assert(xmm_regs_as_doubles_off % 2 == 0, "misaligned offset"); | |
398 | |
304 | 399 __ subptr(rsp, extra_space_offset * VMRegImpl::stack_slot_size); |
0 | 400 |
401 #ifdef ASSERT | |
304 | 402 __ movptr(Address(rsp, marker * VMRegImpl::stack_slot_size), (int32_t)0xfeedbeef); |
0 | 403 #endif |
404 | |
405 if (save_fpu_registers) { | |
406 if (UseSSE < 2) { | |
407 // save FPU stack | |
304 | 408 __ fnsave(Address(rsp, fpu_state_off * VMRegImpl::stack_slot_size)); |
0 | 409 __ fwait(); |
410 | |
411 #ifdef ASSERT | |
412 Label ok; | |
304 | 413 __ cmpw(Address(rsp, fpu_state_off * VMRegImpl::stack_slot_size), StubRoutines::fpu_cntrl_wrd_std()); |
0 | 414 __ jccb(Assembler::equal, ok); |
415 __ stop("corrupted control word detected"); | |
416 __ bind(ok); | |
417 #endif | |
418 | |
419 // Reset the control word to guard against exceptions being unmasked | |
420 // since fstp_d can cause FPU stack underflow exceptions. Write it | |
421 // into the on stack copy and then reload that to make sure that the | |
422 // current and future values are correct. | |
304 | 423 __ movw(Address(rsp, fpu_state_off * VMRegImpl::stack_slot_size), StubRoutines::fpu_cntrl_wrd_std()); |
424 __ frstor(Address(rsp, fpu_state_off * VMRegImpl::stack_slot_size)); | |
0 | 425 |
426 // Save the FPU registers in de-opt-able form | |
304 | 427 __ fstp_d(Address(rsp, float_regs_as_doubles_off * VMRegImpl::stack_slot_size + 0)); |
428 __ fstp_d(Address(rsp, float_regs_as_doubles_off * VMRegImpl::stack_slot_size + 8)); | |
429 __ fstp_d(Address(rsp, float_regs_as_doubles_off * VMRegImpl::stack_slot_size + 16)); | |
430 __ fstp_d(Address(rsp, float_regs_as_doubles_off * VMRegImpl::stack_slot_size + 24)); | |
431 __ fstp_d(Address(rsp, float_regs_as_doubles_off * VMRegImpl::stack_slot_size + 32)); | |
432 __ fstp_d(Address(rsp, float_regs_as_doubles_off * VMRegImpl::stack_slot_size + 40)); | |
433 __ fstp_d(Address(rsp, float_regs_as_doubles_off * VMRegImpl::stack_slot_size + 48)); | |
434 __ fstp_d(Address(rsp, float_regs_as_doubles_off * VMRegImpl::stack_slot_size + 56)); | |
0 | 435 } |
436 | |
437 if (UseSSE >= 2) { | |
438 // save XMM registers | |
439 // XMM registers can contain float or double values, but this is not known here, | |
440 // so always save them as doubles. | |
441 // note that float values are _not_ converted automatically, so for float values | |
442 // the second word contains only garbage data. | |
304 | 443 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 0), xmm0); |
444 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 8), xmm1); | |
445 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 16), xmm2); | |
446 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 24), xmm3); | |
447 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 32), xmm4); | |
448 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 40), xmm5); | |
449 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 48), xmm6); | |
450 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 56), xmm7); | |
451 #ifdef _LP64 | |
452 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 64), xmm8); | |
453 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 72), xmm9); | |
454 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 80), xmm10); | |
455 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 88), xmm11); | |
456 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 96), xmm12); | |
457 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 104), xmm13); | |
458 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 112), xmm14); | |
459 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 120), xmm15); | |
460 #endif // _LP64 | |
0 | 461 } else if (UseSSE == 1) { |
462 // save XMM registers as float because double not supported without SSE2 | |
304 | 463 __ movflt(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 0), xmm0); |
464 __ movflt(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 8), xmm1); | |
465 __ movflt(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 16), xmm2); | |
466 __ movflt(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 24), xmm3); | |
467 __ movflt(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 32), xmm4); | |
468 __ movflt(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 40), xmm5); | |
469 __ movflt(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 48), xmm6); | |
470 __ movflt(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 56), xmm7); | |
0 | 471 } |
472 } | |
473 | |
474 // FPU stack must be empty now | |
475 __ verify_FPU(0, "save_live_registers"); | |
476 | |
477 return generate_oop_map(sasm, num_rt_args, save_fpu_registers); | |
478 } | |
479 | |
480 | |
481 static void restore_fpu(StubAssembler* sasm, bool restore_fpu_registers = true) { | |
482 if (restore_fpu_registers) { | |
483 if (UseSSE >= 2) { | |
484 // restore XMM registers | |
304 | 485 __ movdbl(xmm0, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 0)); |
486 __ movdbl(xmm1, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 8)); | |
487 __ movdbl(xmm2, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 16)); | |
488 __ movdbl(xmm3, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 24)); | |
489 __ movdbl(xmm4, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 32)); | |
490 __ movdbl(xmm5, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 40)); | |
491 __ movdbl(xmm6, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 48)); | |
492 __ movdbl(xmm7, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 56)); | |
493 #ifdef _LP64 | |
494 __ movdbl(xmm8, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 64)); | |
495 __ movdbl(xmm9, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 72)); | |
496 __ movdbl(xmm10, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 80)); | |
497 __ movdbl(xmm11, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 88)); | |
498 __ movdbl(xmm12, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 96)); | |
499 __ movdbl(xmm13, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 104)); | |
500 __ movdbl(xmm14, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 112)); | |
501 __ movdbl(xmm15, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 120)); | |
502 #endif // _LP64 | |
0 | 503 } else if (UseSSE == 1) { |
504 // restore XMM registers | |
304 | 505 __ movflt(xmm0, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 0)); |
506 __ movflt(xmm1, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 8)); | |
507 __ movflt(xmm2, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 16)); | |
508 __ movflt(xmm3, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 24)); | |
509 __ movflt(xmm4, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 32)); | |
510 __ movflt(xmm5, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 40)); | |
511 __ movflt(xmm6, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 48)); | |
512 __ movflt(xmm7, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 56)); | |
0 | 513 } |
514 | |
515 if (UseSSE < 2) { | |
304 | 516 __ frstor(Address(rsp, fpu_state_off * VMRegImpl::stack_slot_size)); |
0 | 517 } else { |
518 // check that FPU stack is really empty | |
519 __ verify_FPU(0, "restore_live_registers"); | |
520 } | |
521 | |
522 } else { | |
523 // check that FPU stack is really empty | |
524 __ verify_FPU(0, "restore_live_registers"); | |
525 } | |
526 | |
527 #ifdef ASSERT | |
528 { | |
529 Label ok; | |
304 | 530 __ cmpptr(Address(rsp, marker * VMRegImpl::stack_slot_size), (int32_t)0xfeedbeef); |
0 | 531 __ jcc(Assembler::equal, ok); |
532 __ stop("bad offsets in frame"); | |
533 __ bind(ok); | |
534 } | |
304 | 535 #endif // ASSERT |
0 | 536 |
304 | 537 __ addptr(rsp, extra_space_offset * VMRegImpl::stack_slot_size); |
0 | 538 } |
539 | |
540 | |
2662
440ceca8e3d7
Add exception handlers only to Invoke and Throw instructions. Deoptimize if there is an exception in a HotSpot runtime call.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2608
diff
changeset
|
541 static void restore_live_registers(StubAssembler* sasm, bool restore_fpu_registers/* = true*/) { |
0 | 542 __ block_comment("restore_live_registers"); |
543 | |
544 restore_fpu(sasm, restore_fpu_registers); | |
304 | 545 __ popa(); |
0 | 546 } |
547 | |
548 | |
549 static void restore_live_registers_except_rax(StubAssembler* sasm, bool restore_fpu_registers = true) { | |
550 __ block_comment("restore_live_registers_except_rax"); | |
551 | |
552 restore_fpu(sasm, restore_fpu_registers); | |
553 | |
304 | 554 #ifdef _LP64 |
555 __ movptr(r15, Address(rsp, 0)); | |
556 __ movptr(r14, Address(rsp, wordSize)); | |
557 __ movptr(r13, Address(rsp, 2 * wordSize)); | |
558 __ movptr(r12, Address(rsp, 3 * wordSize)); | |
559 __ movptr(r11, Address(rsp, 4 * wordSize)); | |
560 __ movptr(r10, Address(rsp, 5 * wordSize)); | |
561 __ movptr(r9, Address(rsp, 6 * wordSize)); | |
562 __ movptr(r8, Address(rsp, 7 * wordSize)); | |
563 __ movptr(rdi, Address(rsp, 8 * wordSize)); | |
564 __ movptr(rsi, Address(rsp, 9 * wordSize)); | |
565 __ movptr(rbp, Address(rsp, 10 * wordSize)); | |
566 // skip rsp | |
567 __ movptr(rbx, Address(rsp, 12 * wordSize)); | |
568 __ movptr(rdx, Address(rsp, 13 * wordSize)); | |
569 __ movptr(rcx, Address(rsp, 14 * wordSize)); | |
570 | |
571 __ addptr(rsp, 16 * wordSize); | |
572 #else | |
573 | |
574 __ pop(rdi); | |
575 __ pop(rsi); | |
576 __ pop(rbp); | |
577 __ pop(rbx); // skip this value | |
578 __ pop(rbx); | |
579 __ pop(rdx); | |
580 __ pop(rcx); | |
581 __ addptr(rsp, BytesPerWord); | |
582 #endif // _LP64 | |
0 | 583 } |
584 | |
585 | |
586 void Runtime1::initialize_pd() { | |
587 // nothing to do | |
588 } | |
589 | |
590 | |
591 // target: the entry point of the method that creates and posts the exception oop | |
592 // has_argument: true if the exception needs an argument (passed on stack because registers must be preserved) | |
593 | |
594 OopMapSet* Runtime1::generate_exception_throw(StubAssembler* sasm, address target, bool has_argument) { | |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
595 OopMapSet* oop_maps = new OopMapSet(); |
4559
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4223
diff
changeset
|
596 #ifdef GRAAL |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2662
diff
changeset
|
597 // graal passes the argument in r10 |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
598 OopMap* oop_map = save_live_registers(sasm, 1); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
599 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
600 // now all registers are saved and can be used freely |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
601 // verify that no old value is used accidentally |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
602 __ invalidate_registers(true, true, true, true, true, true); |
0 | 603 |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
604 // registers used by this stub |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
605 const Register temp_reg = rbx; |
0 | 606 |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
607 // load argument for exception that is passed as an argument into the stub |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
608 if (has_argument) { |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
609 __ movptr(c_rarg1, r10); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
610 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
611 int call_offset = __ call_RT(noreg, noreg, target, has_argument ? 1 : 0); |
0 | 612 |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
613 oop_maps->add_gc_map(call_offset, oop_map); |
4559
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4223
diff
changeset
|
614 #else |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
615 // preserve all registers |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
616 int num_rt_args = has_argument ? 2 : 1; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
617 OopMap* oop_map = save_live_registers(sasm, num_rt_args); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
618 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
619 // now all registers are saved and can be used freely |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
620 // verify that no old value is used accidentally |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
621 __ invalidate_registers(true, true, true, true, true, true); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
622 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
623 // registers used by this stub |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
624 const Register temp_reg = rbx; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
625 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
626 // load argument for exception that is passed as an argument into the stub |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
627 if (has_argument) { |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
628 #ifdef _LP64 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
629 __ movptr(c_rarg1, Address(rbp, 2*BytesPerWord)); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
630 #else |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
631 __ movptr(temp_reg, Address(rbp, 2*BytesPerWord)); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
632 __ push(temp_reg); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
633 #endif // _LP64 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
634 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
635 int call_offset = __ call_RT(noreg, noreg, target, num_rt_args - 1); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
636 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
637 oop_maps->add_gc_map(call_offset, oop_map); |
4559
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4223
diff
changeset
|
638 #endif |
0 | 639 |
640 __ stop("should not reach here"); | |
641 | |
642 return oop_maps; | |
643 } | |
644 | |
645 | |
2321
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
646 OopMapSet* Runtime1::generate_handle_exception(StubID id, StubAssembler *sasm) { |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
647 __ block_comment("generate_handle_exception"); |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
648 |
0 | 649 // incoming parameters |
650 const Register exception_oop = rax; | |
2321
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
651 const Register exception_pc = rdx; |
0 | 652 // other registers used in this stub |
304 | 653 const Register thread = NOT_LP64(rdi) LP64_ONLY(r15_thread); |
0 | 654 |
2321
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
655 // Save registers, if required. |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
656 OopMapSet* oop_maps = new OopMapSet(); |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
657 OopMap* oop_map = NULL; |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
658 switch (id) { |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
659 case forward_exception_id: |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
660 // We're handling an exception in the context of a compiled frame. |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
661 // The registers have been saved in the standard places. Perform |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
662 // an exception lookup in the caller and dispatch to the handler |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
663 // if found. Otherwise unwind and dispatch to the callers |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
664 // exception handler. |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
665 oop_map = generate_oop_map(sasm, 1 /*thread*/); |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
666 |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
667 // load and clear pending exception oop into RAX |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
668 __ movptr(exception_oop, Address(thread, Thread::pending_exception_offset())); |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
669 __ movptr(Address(thread, Thread::pending_exception_offset()), NULL_WORD); |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
670 |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
671 // load issuing PC (the return address for this stub) into rdx |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
672 __ movptr(exception_pc, Address(rbp, 1*BytesPerWord)); |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
673 |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
674 // make sure that the vm_results are cleared (may be unnecessary) |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
675 __ movptr(Address(thread, JavaThread::vm_result_offset()), NULL_WORD); |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
676 __ movptr(Address(thread, JavaThread::vm_result_2_offset()), NULL_WORD); |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
677 break; |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
678 case handle_exception_nofpu_id: |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
679 case handle_exception_id: |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
680 // At this point all registers MAY be live. |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
681 oop_map = save_live_registers(sasm, 1 /*thread*/, id == handle_exception_nofpu_id); |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
682 break; |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
683 case handle_exception_from_callee_id: { |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
684 // At this point all registers except exception oop (RAX) and |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
685 // exception pc (RDX) are dead. |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
686 const int frame_size = 2 /*BP, return address*/ NOT_LP64(+ 1 /*thread*/) WIN64_ONLY(+ frame::arg_reg_save_area_bytes / BytesPerWord); |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
687 oop_map = new OopMap(frame_size * VMRegImpl::slots_per_word, 0); |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
688 sasm->set_frame_size(frame_size); |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
689 WIN64_ONLY(__ subq(rsp, frame::arg_reg_save_area_bytes)); |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
690 break; |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
691 } |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
692 default: ShouldNotReachHere(); |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
693 } |
0 | 694 |
695 #ifdef TIERED | |
696 // C2 can leave the fpu stack dirty | |
2321
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
697 if (UseSSE < 2) { |
0 | 698 __ empty_FPU_stack(); |
699 } | |
700 #endif // TIERED | |
701 | |
702 // verify that only rax, and rdx is valid at this time | |
703 __ invalidate_registers(false, true, true, false, true, true); | |
704 // verify that rax, contains a valid exception | |
705 __ verify_not_null_oop(exception_oop); | |
706 | |
707 // load address of JavaThread object for thread-local data | |
304 | 708 NOT_LP64(__ get_thread(thread);) |
0 | 709 |
710 #ifdef ASSERT | |
711 // check that fields in JavaThread for exception oop and issuing pc are | |
712 // empty before writing to them | |
713 Label oop_empty; | |
304 | 714 __ cmpptr(Address(thread, JavaThread::exception_oop_offset()), (int32_t) NULL_WORD); |
0 | 715 __ jcc(Assembler::equal, oop_empty); |
716 __ stop("exception oop already set"); | |
717 __ bind(oop_empty); | |
718 | |
719 Label pc_empty; | |
304 | 720 __ cmpptr(Address(thread, JavaThread::exception_pc_offset()), 0); |
0 | 721 __ jcc(Assembler::equal, pc_empty); |
722 __ stop("exception pc already set"); | |
723 __ bind(pc_empty); | |
724 #endif | |
725 | |
726 // save exception oop and issuing pc into JavaThread | |
727 // (exception handler will load it from here) | |
304 | 728 __ movptr(Address(thread, JavaThread::exception_oop_offset()), exception_oop); |
2321
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
729 __ movptr(Address(thread, JavaThread::exception_pc_offset()), exception_pc); |
0 | 730 |
731 // patch throwing pc into return address (has bci & oop map) | |
304 | 732 __ movptr(Address(rbp, 1*BytesPerWord), exception_pc); |
0 | 733 |
734 // compute the exception handler. | |
735 // the exception oop and the throwing pc are read from the fields in JavaThread | |
736 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, exception_handler_for_pc)); | |
737 oop_maps->add_gc_map(call_offset, oop_map); | |
738 | |
2321
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
739 // rax: handler address |
0 | 740 // will be the deopt blob if nmethod was deoptimized while we looked up |
741 // handler regardless of whether handler existed in the nmethod. | |
742 | |
743 // only rax, is valid at this time, all other registers have been destroyed by the runtime call | |
744 __ invalidate_registers(false, true, true, true, true, true); | |
745 | |
2321
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
746 // patch the return address, this stub will directly return to the exception handler |
304 | 747 __ movptr(Address(rbp, 1*BytesPerWord), rax); |
0 | 748 |
2321
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
749 switch (id) { |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
750 case forward_exception_id: |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
751 case handle_exception_nofpu_id: |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
752 case handle_exception_id: |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
753 // Restore the registers that were saved at the beginning. |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
754 restore_live_registers(sasm, id == handle_exception_nofpu_id); |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
755 break; |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
756 case handle_exception_from_callee_id: |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
757 // WIN64_ONLY: No need to add frame::arg_reg_save_area_bytes to SP |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
758 // since we do a leave anyway. |
0 | 759 |
2321
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
760 // Pop the return address since we are possibly changing SP (restoring from BP). |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
761 __ leave(); |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
762 __ pop(rcx); |
0 | 763 |
2321
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
764 // Restore SP from BP if the exception PC is a method handle call site. |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
765 NOT_LP64(__ get_thread(thread);) |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
766 __ cmpl(Address(thread, JavaThread::is_method_handle_return_offset()), 0); |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
767 __ cmovptr(Assembler::notEqual, rsp, rbp_mh_SP_save); |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
768 __ jmp(rcx); // jump to exception handler |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
769 break; |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
770 default: ShouldNotReachHere(); |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
771 } |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
772 |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
773 return oop_maps; |
0 | 774 } |
775 | |
776 | |
777 void Runtime1::generate_unwind_exception(StubAssembler *sasm) { | |
778 // incoming parameters | |
779 const Register exception_oop = rax; | |
1295 | 780 // callee-saved copy of exception_oop during runtime call |
781 const Register exception_oop_callee_saved = NOT_LP64(rsi) LP64_ONLY(r14); | |
0 | 782 // other registers used in this stub |
783 const Register exception_pc = rdx; | |
784 const Register handler_addr = rbx; | |
304 | 785 const Register thread = NOT_LP64(rdi) LP64_ONLY(r15_thread); |
0 | 786 |
787 // verify that only rax, is valid at this time | |
788 __ invalidate_registers(false, true, true, true, true, true); | |
789 | |
790 #ifdef ASSERT | |
791 // check that fields in JavaThread for exception oop and issuing pc are empty | |
304 | 792 NOT_LP64(__ get_thread(thread);) |
0 | 793 Label oop_empty; |
304 | 794 __ cmpptr(Address(thread, JavaThread::exception_oop_offset()), 0); |
0 | 795 __ jcc(Assembler::equal, oop_empty); |
796 __ stop("exception oop must be empty"); | |
797 __ bind(oop_empty); | |
798 | |
799 Label pc_empty; | |
304 | 800 __ cmpptr(Address(thread, JavaThread::exception_pc_offset()), 0); |
0 | 801 __ jcc(Assembler::equal, pc_empty); |
802 __ stop("exception pc must be empty"); | |
803 __ bind(pc_empty); | |
804 #endif | |
805 | |
806 // clear the FPU stack in case any FPU results are left behind | |
807 __ empty_FPU_stack(); | |
808 | |
1295 | 809 // save exception_oop in callee-saved register to preserve it during runtime calls |
810 __ verify_not_null_oop(exception_oop); | |
811 __ movptr(exception_oop_callee_saved, exception_oop); | |
812 | |
813 NOT_LP64(__ get_thread(thread);) | |
814 // Get return address (is on top of stack after leave). | |
304 | 815 __ movptr(exception_pc, Address(rsp, 0)); |
0 | 816 |
1295 | 817 // search the exception handler address of the caller (using the return address) |
818 __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), thread, exception_pc); | |
819 // rax: exception handler address of the caller | |
0 | 820 |
1295 | 821 // Only RAX and RSI are valid at this time, all other registers have been destroyed by the call. |
822 __ invalidate_registers(false, true, true, true, false, true); | |
0 | 823 |
824 // move result of call into correct register | |
304 | 825 __ movptr(handler_addr, rax); |
0 | 826 |
1295 | 827 // Restore exception oop to RAX (required convention of exception handler). |
828 __ movptr(exception_oop, exception_oop_callee_saved); | |
0 | 829 |
1295 | 830 // verify that there is really a valid exception in rax |
831 __ verify_not_null_oop(exception_oop); | |
0 | 832 |
833 // get throwing pc (= return address). | |
834 // rdx has been destroyed by the call, so it must be set again | |
835 // the pop is also necessary to simulate the effect of a ret(0) | |
304 | 836 __ pop(exception_pc); |
0 | 837 |
2321
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
838 // Restore SP from BP if the exception PC is a method handle call site. |
1295 | 839 NOT_LP64(__ get_thread(thread);) |
1368
93767e6a2dfd
6941529: SharedRuntime::raw_exception_handler_for_return_address must reset thread MethodHandle flag
twisti
parents:
1295
diff
changeset
|
840 __ cmpl(Address(thread, JavaThread::is_method_handle_return_offset()), 0); |
1564 | 841 __ cmovptr(Assembler::notEqual, rsp, rbp_mh_SP_save); |
0 | 842 |
843 // continue at exception handler (return address removed) | |
844 // note: do *not* remove arguments when unwinding the | |
845 // activation since the caller assumes having | |
846 // all arguments on the stack when entering the | |
847 // runtime to determine the exception handler | |
848 // (GC happens at call site with arguments!) | |
1295 | 849 // rax: exception oop |
0 | 850 // rdx: throwing pc |
1295 | 851 // rbx: exception handler |
0 | 852 __ jmp(handler_addr); |
853 } | |
854 | |
855 | |
856 OopMapSet* Runtime1::generate_patching(StubAssembler* sasm, address target) { | |
857 // use the maximum number of runtime-arguments here because it is difficult to | |
858 // distinguish each RT-Call. | |
859 // Note: This number affects also the RT-Call in generate_handle_exception because | |
860 // the oop-map is shared for all calls. | |
861 const int num_rt_args = 2; // thread + dummy | |
862 | |
863 DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob(); | |
864 assert(deopt_blob != NULL, "deoptimization blob must have been created"); | |
865 | |
866 OopMap* oop_map = save_live_registers(sasm, num_rt_args); | |
867 | |
304 | 868 #ifdef _LP64 |
869 const Register thread = r15_thread; | |
870 // No need to worry about dummy | |
871 __ mov(c_rarg0, thread); | |
872 #else | |
873 __ push(rax); // push dummy | |
0 | 874 |
875 const Register thread = rdi; // is callee-saved register (Visual C++ calling conventions) | |
876 // push java thread (becomes first argument of C function) | |
877 __ get_thread(thread); | |
304 | 878 __ push(thread); |
879 #endif // _LP64 | |
0 | 880 __ set_last_Java_frame(thread, noreg, rbp, NULL); |
881 // do the call | |
882 __ call(RuntimeAddress(target)); | |
883 OopMapSet* oop_maps = new OopMapSet(); | |
884 oop_maps->add_gc_map(__ offset(), oop_map); | |
885 // verify callee-saved register | |
886 #ifdef ASSERT | |
887 guarantee(thread != rax, "change this code"); | |
304 | 888 __ push(rax); |
0 | 889 { Label L; |
890 __ get_thread(rax); | |
304 | 891 __ cmpptr(thread, rax); |
0 | 892 __ jcc(Assembler::equal, L); |
304 | 893 __ stop("StubAssembler::call_RT: rdi/r15 not callee saved?"); |
0 | 894 __ bind(L); |
895 } | |
304 | 896 __ pop(rax); |
0 | 897 #endif |
898 __ reset_last_Java_frame(thread, true, false); | |
304 | 899 #ifndef _LP64 |
900 __ pop(rcx); // discard thread arg | |
901 __ pop(rcx); // discard dummy | |
902 #endif // _LP64 | |
0 | 903 |
904 // check for pending exceptions | |
905 { Label L; | |
304 | 906 __ cmpptr(Address(thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD); |
0 | 907 __ jcc(Assembler::equal, L); |
908 // exception pending => remove activation and forward to exception handler | |
909 | |
304 | 910 __ testptr(rax, rax); // have we deoptimized? |
0 | 911 __ jump_cc(Assembler::equal, |
912 RuntimeAddress(Runtime1::entry_for(Runtime1::forward_exception_id))); | |
913 | |
914 // the deopt blob expects exceptions in the special fields of | |
915 // JavaThread, so copy and clear pending exception. | |
916 | |
917 // load and clear pending exception | |
304 | 918 __ movptr(rax, Address(thread, Thread::pending_exception_offset())); |
512
db4caa99ef11
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents:
380
diff
changeset
|
919 __ movptr(Address(thread, Thread::pending_exception_offset()), NULL_WORD); |
0 | 920 |
921 // check that there is really a valid exception | |
922 __ verify_not_null_oop(rax); | |
923 | |
924 // load throwing pc: this is the return address of the stub | |
304 | 925 __ movptr(rdx, Address(rsp, return_off * VMRegImpl::stack_slot_size)); |
0 | 926 |
927 #ifdef ASSERT | |
928 // check that fields in JavaThread for exception oop and issuing pc are empty | |
929 Label oop_empty; | |
304 | 930 __ cmpptr(Address(thread, JavaThread::exception_oop_offset()), (int32_t)NULL_WORD); |
0 | 931 __ jcc(Assembler::equal, oop_empty); |
932 __ stop("exception oop must be empty"); | |
933 __ bind(oop_empty); | |
934 | |
935 Label pc_empty; | |
304 | 936 __ cmpptr(Address(thread, JavaThread::exception_pc_offset()), (int32_t)NULL_WORD); |
0 | 937 __ jcc(Assembler::equal, pc_empty); |
938 __ stop("exception pc must be empty"); | |
939 __ bind(pc_empty); | |
940 #endif | |
941 | |
942 // store exception oop and throwing pc to JavaThread | |
304 | 943 __ movptr(Address(thread, JavaThread::exception_oop_offset()), rax); |
944 __ movptr(Address(thread, JavaThread::exception_pc_offset()), rdx); | |
0 | 945 |
946 restore_live_registers(sasm); | |
947 | |
948 __ leave(); | |
304 | 949 __ addptr(rsp, BytesPerWord); // remove return address from stack |
0 | 950 |
951 // Forward the exception directly to deopt blob. We can blow no | |
952 // registers and must leave throwing pc on the stack. A patch may | |
953 // have values live in registers so the entry point with the | |
954 // exception in tls. | |
955 __ jump(RuntimeAddress(deopt_blob->unpack_with_exception_in_tls())); | |
956 | |
957 __ bind(L); | |
958 } | |
959 | |
960 | |
961 // Runtime will return true if the nmethod has been deoptimized during | |
962 // the patching process. In that case we must do a deopt reexecute instead. | |
963 | |
964 Label reexecuteEntry, cont; | |
965 | |
304 | 966 __ testptr(rax, rax); // have we deoptimized? |
0 | 967 __ jcc(Assembler::equal, cont); // no |
968 | |
969 // Will reexecute. Proper return address is already on the stack we just restore | |
970 // registers, pop all of our frame but the return address and jump to the deopt blob | |
971 restore_live_registers(sasm); | |
972 __ leave(); | |
973 __ jump(RuntimeAddress(deopt_blob->unpack_with_reexecution())); | |
974 | |
975 __ bind(cont); | |
976 restore_live_registers(sasm); | |
977 __ leave(); | |
978 __ ret(0); | |
979 | |
980 return oop_maps; | |
981 } | |
982 | |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2662
diff
changeset
|
983 JRT_ENTRY(void, graal_create_null_exception(JavaThread* thread)) |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
984 thread->set_vm_result(Exceptions::new_exception(thread, vmSymbols::java_lang_NullPointerException(), NULL)()); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
985 JRT_END |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
986 |
3538
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
987 JRT_ENTRY(void, graal_create_out_of_bounds_exception(JavaThread* thread, jint index)) |
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
988 char message[jintAsStringSize]; |
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
989 sprintf(message, "%d", index); |
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
990 thread->set_vm_result(Exceptions::new_exception(thread, vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), message)()); |
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
991 JRT_END |
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
992 |
3682
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
993 JRT_ENTRY(void, graal_generic_callback(JavaThread* thread, oop _callback, oop _argument)) |
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
994 HandleMark hm; |
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
995 Handle callback(_callback); |
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
996 Handle argument(_argument); |
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
997 |
4223
e0a4668c57a2
Renaming of VMExits and VMEntries part 4.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4137
diff
changeset
|
998 KlassHandle klass = SystemDictionary::resolve_or_null(vmSymbols::com_oracle_max_cri_ci_CiGenericCallback(), SystemDictionary::java_system_loader(), NULL, thread); |
3682
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
999 if (klass.is_null()) { |
4223
e0a4668c57a2
Renaming of VMExits and VMEntries part 4.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4137
diff
changeset
|
1000 tty->print_cr("couldn't resolve com_oracle_max_cri_ci_CiGenericCallback"); |
3682
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
1001 } |
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
1002 |
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
1003 JavaValue result(T_OBJECT); |
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
1004 JavaCallArguments args; |
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
1005 args.push_oop(Handle(callback)); |
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
1006 args.push_oop(Handle(argument)); |
3705
6917cd12e8f8
CiGenericCallback handling: removed (buggy) native exception handling code, changed to callbackInternal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3682
diff
changeset
|
1007 JavaCalls::call_virtual(&result, klass, vmSymbols::callbackInternal_name(), vmSymbols::callback_signature(), &args, thread); |
3682
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
1008 |
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
1009 thread->set_vm_result((oop) result.get_jobject()); |
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
1010 JRT_END |
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
1011 |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
1012 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
1013 |
0 | 1014 |
1015 OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) { | |
1016 | |
1017 // for better readability | |
1018 const bool must_gc_arguments = true; | |
1019 const bool dont_gc_arguments = false; | |
1020 | |
1021 // default value; overwritten for some optimized stubs that are called from methods that do not use the fpu | |
1022 bool save_fpu_registers = true; | |
1023 | |
1024 // stub code & info for the different stubs | |
1025 OopMapSet* oop_maps = NULL; | |
1026 switch (id) { | |
1027 case forward_exception_id: | |
1028 { | |
2321
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
1029 oop_maps = generate_handle_exception(id, sasm); |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
1030 __ leave(); |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
1031 __ ret(0); |
0 | 1032 } |
1033 break; | |
1034 | |
1035 case new_instance_id: | |
1036 case fast_new_instance_id: | |
1037 case fast_new_instance_init_check_id: | |
1038 { | |
1039 Register klass = rdx; // Incoming | |
1040 Register obj = rax; // Result | |
1041 | |
1042 if (id == new_instance_id) { | |
1043 __ set_info("new_instance", dont_gc_arguments); | |
1044 } else if (id == fast_new_instance_id) { | |
1045 __ set_info("fast new_instance", dont_gc_arguments); | |
1046 } else { | |
1047 assert(id == fast_new_instance_init_check_id, "bad StubID"); | |
1048 __ set_info("fast new_instance init check", dont_gc_arguments); | |
1049 } | |
1050 | |
1051 if ((id == fast_new_instance_id || id == fast_new_instance_init_check_id) && | |
1052 UseTLAB && FastTLABRefill) { | |
1053 Label slow_path; | |
1054 Register obj_size = rcx; | |
1055 Register t1 = rbx; | |
1056 Register t2 = rsi; | |
1057 assert_different_registers(klass, obj, obj_size, t1, t2); | |
1058 | |
304 | 1059 __ push(rdi); |
1060 __ push(rbx); | |
0 | 1061 |
1062 if (id == fast_new_instance_init_check_id) { | |
1063 // make sure the klass is initialized | |
1064 __ cmpl(Address(klass, instanceKlass::init_state_offset_in_bytes() + sizeof(oopDesc)), instanceKlass::fully_initialized); | |
1065 __ jcc(Assembler::notEqual, slow_path); | |
1066 } | |
1067 | |
1068 #ifdef ASSERT | |
1069 // assert object can be fast path allocated | |
1070 { | |
1071 Label ok, not_ok; | |
1072 __ movl(obj_size, Address(klass, Klass::layout_helper_offset_in_bytes() + sizeof(oopDesc))); | |
1073 __ cmpl(obj_size, 0); // make sure it's an instance (LH > 0) | |
1074 __ jcc(Assembler::lessEqual, not_ok); | |
1075 __ testl(obj_size, Klass::_lh_instance_slow_path_bit); | |
1076 __ jcc(Assembler::zero, ok); | |
1077 __ bind(not_ok); | |
1078 __ stop("assert(can be fast path allocated)"); | |
1079 __ should_not_reach_here(); | |
1080 __ bind(ok); | |
1081 } | |
1082 #endif // ASSERT | |
1083 | |
1084 // if we got here then the TLAB allocation failed, so try | |
1085 // refilling the TLAB or allocating directly from eden. | |
1086 Label retry_tlab, try_eden; | |
2100
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
2002
diff
changeset
|
1087 const Register thread = |
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
2002
diff
changeset
|
1088 __ tlab_refill(retry_tlab, try_eden, slow_path); // does not destroy rdx (klass), returns rdi |
0 | 1089 |
1090 __ bind(retry_tlab); | |
1091 | |
304 | 1092 // get the instance size (size is postive so movl is fine for 64bit) |
0 | 1093 __ movl(obj_size, Address(klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes())); |
2100
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
2002
diff
changeset
|
1094 |
0 | 1095 __ tlab_allocate(obj, obj_size, 0, t1, t2, slow_path); |
2100
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
2002
diff
changeset
|
1096 |
0 | 1097 __ initialize_object(obj, klass, obj_size, 0, t1, t2); |
1098 __ verify_oop(obj); | |
304 | 1099 __ pop(rbx); |
1100 __ pop(rdi); | |
0 | 1101 __ ret(0); |
1102 | |
1103 __ bind(try_eden); | |
304 | 1104 // get the instance size (size is postive so movl is fine for 64bit) |
0 | 1105 __ movl(obj_size, Address(klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes())); |
2100
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
2002
diff
changeset
|
1106 |
0 | 1107 __ eden_allocate(obj, obj_size, 0, t1, slow_path); |
2100
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
2002
diff
changeset
|
1108 __ incr_allocated_bytes(thread, obj_size, 0); |
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
2002
diff
changeset
|
1109 |
0 | 1110 __ initialize_object(obj, klass, obj_size, 0, t1, t2); |
1111 __ verify_oop(obj); | |
304 | 1112 __ pop(rbx); |
1113 __ pop(rdi); | |
0 | 1114 __ ret(0); |
1115 | |
1116 __ bind(slow_path); | |
304 | 1117 __ pop(rbx); |
1118 __ pop(rdi); | |
0 | 1119 } |
1120 | |
1121 __ enter(); | |
1122 OopMap* map = save_live_registers(sasm, 2); | |
1123 int call_offset = __ call_RT(obj, noreg, CAST_FROM_FN_PTR(address, new_instance), klass); | |
1124 oop_maps = new OopMapSet(); | |
1125 oop_maps->add_gc_map(call_offset, map); | |
1126 restore_live_registers_except_rax(sasm); | |
1127 __ verify_oop(obj); | |
1128 __ leave(); | |
1129 __ ret(0); | |
1130 | |
1131 // rax,: new instance | |
1132 } | |
1133 | |
1134 break; | |
1135 | |
1136 case counter_overflow_id: | |
1137 { | |
1783 | 1138 Register bci = rax, method = rbx; |
0 | 1139 __ enter(); |
1783 | 1140 OopMap* map = save_live_registers(sasm, 3); |
0 | 1141 // Retrieve bci |
1142 __ movl(bci, Address(rbp, 2*BytesPerWord)); | |
1783 | 1143 // And a pointer to the methodOop |
1144 __ movptr(method, Address(rbp, 3*BytesPerWord)); | |
1145 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, counter_overflow), bci, method); | |
0 | 1146 oop_maps = new OopMapSet(); |
1147 oop_maps->add_gc_map(call_offset, map); | |
1148 restore_live_registers(sasm); | |
1149 __ leave(); | |
1150 __ ret(0); | |
1151 } | |
1152 break; | |
1153 | |
1154 case new_type_array_id: | |
1155 case new_object_array_id: | |
1156 { | |
1157 Register length = rbx; // Incoming | |
1158 Register klass = rdx; // Incoming | |
1159 Register obj = rax; // Result | |
1160 | |
1161 if (id == new_type_array_id) { | |
1162 __ set_info("new_type_array", dont_gc_arguments); | |
1163 } else { | |
1164 __ set_info("new_object_array", dont_gc_arguments); | |
1165 } | |
1166 | |
1167 #ifdef ASSERT | |
1168 // assert object type is really an array of the proper kind | |
1169 { | |
1170 Label ok; | |
1171 Register t0 = obj; | |
1172 __ movl(t0, Address(klass, Klass::layout_helper_offset_in_bytes() + sizeof(oopDesc))); | |
1173 __ sarl(t0, Klass::_lh_array_tag_shift); | |
1174 int tag = ((id == new_type_array_id) | |
1175 ? Klass::_lh_array_tag_type_value | |
1176 : Klass::_lh_array_tag_obj_value); | |
1177 __ cmpl(t0, tag); | |
1178 __ jcc(Assembler::equal, ok); | |
1179 __ stop("assert(is an array klass)"); | |
1180 __ should_not_reach_here(); | |
1181 __ bind(ok); | |
1182 } | |
1183 #endif // ASSERT | |
1184 | |
1185 if (UseTLAB && FastTLABRefill) { | |
1186 Register arr_size = rsi; | |
1187 Register t1 = rcx; // must be rcx for use as shift count | |
1188 Register t2 = rdi; | |
1189 Label slow_path; | |
1190 assert_different_registers(length, klass, obj, arr_size, t1, t2); | |
1191 | |
1192 // check that array length is small enough for fast path. | |
1193 __ cmpl(length, C1_MacroAssembler::max_array_allocation_length); | |
1194 __ jcc(Assembler::above, slow_path); | |
1195 | |
1196 // if we got here then the TLAB allocation failed, so try | |
1197 // refilling the TLAB or allocating directly from eden. | |
1198 Label retry_tlab, try_eden; | |
2100
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
2002
diff
changeset
|
1199 const Register thread = |
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
2002
diff
changeset
|
1200 __ tlab_refill(retry_tlab, try_eden, slow_path); // preserves rbx & rdx, returns rdi |
0 | 1201 |
1202 __ bind(retry_tlab); | |
1203 | |
1204 // get the allocation size: round_up(hdr + length << (layout_helper & 0x1F)) | |
2100
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
2002
diff
changeset
|
1205 // since size is positive movl does right thing on 64bit |
0 | 1206 __ movl(t1, Address(klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes())); |
304 | 1207 // since size is postive movl does right thing on 64bit |
0 | 1208 __ movl(arr_size, length); |
1209 assert(t1 == rcx, "fixed register usage"); | |
304 | 1210 __ shlptr(arr_size /* by t1=rcx, mod 32 */); |
1211 __ shrptr(t1, Klass::_lh_header_size_shift); | |
1212 __ andptr(t1, Klass::_lh_header_size_mask); | |
1213 __ addptr(arr_size, t1); | |
1214 __ addptr(arr_size, MinObjAlignmentInBytesMask); // align up | |
1215 __ andptr(arr_size, ~MinObjAlignmentInBytesMask); | |
0 | 1216 |
1217 __ tlab_allocate(obj, arr_size, 0, t1, t2, slow_path); // preserves arr_size | |
1218 | |
1219 __ initialize_header(obj, klass, length, t1, t2); | |
1220 __ movb(t1, Address(klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes() + (Klass::_lh_header_size_shift / BitsPerByte))); | |
1221 assert(Klass::_lh_header_size_shift % BitsPerByte == 0, "bytewise"); | |
1222 assert(Klass::_lh_header_size_mask <= 0xFF, "bytewise"); | |
304 | 1223 __ andptr(t1, Klass::_lh_header_size_mask); |
1224 __ subptr(arr_size, t1); // body length | |
1225 __ addptr(t1, obj); // body start | |
0 | 1226 __ initialize_body(t1, arr_size, 0, t2); |
1227 __ verify_oop(obj); | |
1228 __ ret(0); | |
1229 | |
1230 __ bind(try_eden); | |
1231 // get the allocation size: round_up(hdr + length << (layout_helper & 0x1F)) | |
2100
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
2002
diff
changeset
|
1232 // since size is positive movl does right thing on 64bit |
0 | 1233 __ movl(t1, Address(klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes())); |
304 | 1234 // since size is postive movl does right thing on 64bit |
0 | 1235 __ movl(arr_size, length); |
1236 assert(t1 == rcx, "fixed register usage"); | |
304 | 1237 __ shlptr(arr_size /* by t1=rcx, mod 32 */); |
1238 __ shrptr(t1, Klass::_lh_header_size_shift); | |
1239 __ andptr(t1, Klass::_lh_header_size_mask); | |
1240 __ addptr(arr_size, t1); | |
1241 __ addptr(arr_size, MinObjAlignmentInBytesMask); // align up | |
1242 __ andptr(arr_size, ~MinObjAlignmentInBytesMask); | |
0 | 1243 |
1244 __ eden_allocate(obj, arr_size, 0, t1, slow_path); // preserves arr_size | |
2100
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
2002
diff
changeset
|
1245 __ incr_allocated_bytes(thread, arr_size, 0); |
0 | 1246 |
1247 __ initialize_header(obj, klass, length, t1, t2); | |
1248 __ movb(t1, Address(klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes() + (Klass::_lh_header_size_shift / BitsPerByte))); | |
1249 assert(Klass::_lh_header_size_shift % BitsPerByte == 0, "bytewise"); | |
1250 assert(Klass::_lh_header_size_mask <= 0xFF, "bytewise"); | |
304 | 1251 __ andptr(t1, Klass::_lh_header_size_mask); |
1252 __ subptr(arr_size, t1); // body length | |
1253 __ addptr(t1, obj); // body start | |
0 | 1254 __ initialize_body(t1, arr_size, 0, t2); |
1255 __ verify_oop(obj); | |
1256 __ ret(0); | |
1257 | |
1258 __ bind(slow_path); | |
1259 } | |
1260 | |
1261 __ enter(); | |
1262 OopMap* map = save_live_registers(sasm, 3); | |
1263 int call_offset; | |
1264 if (id == new_type_array_id) { | |
1265 call_offset = __ call_RT(obj, noreg, CAST_FROM_FN_PTR(address, new_type_array), klass, length); | |
1266 } else { | |
1267 call_offset = __ call_RT(obj, noreg, CAST_FROM_FN_PTR(address, new_object_array), klass, length); | |
1268 } | |
1269 | |
1270 oop_maps = new OopMapSet(); | |
1271 oop_maps->add_gc_map(call_offset, map); | |
1272 restore_live_registers_except_rax(sasm); | |
1273 | |
1274 __ verify_oop(obj); | |
1275 __ leave(); | |
1276 __ ret(0); | |
1277 | |
1278 // rax,: new array | |
1279 } | |
1280 break; | |
1281 | |
1282 case new_multi_array_id: | |
1283 { StubFrame f(sasm, "new_multi_array", dont_gc_arguments); | |
1284 // rax,: klass | |
1285 // rbx,: rank | |
1286 // rcx: address of 1st dimension | |
1287 OopMap* map = save_live_registers(sasm, 4); | |
1288 int call_offset = __ call_RT(rax, noreg, CAST_FROM_FN_PTR(address, new_multi_array), rax, rbx, rcx); | |
1289 | |
1290 oop_maps = new OopMapSet(); | |
1291 oop_maps->add_gc_map(call_offset, map); | |
1292 restore_live_registers_except_rax(sasm); | |
1293 | |
1294 // rax,: new multi array | |
1295 __ verify_oop(rax); | |
1296 } | |
1297 break; | |
1298 | |
1299 case register_finalizer_id: | |
1300 { | |
1301 __ set_info("register_finalizer", dont_gc_arguments); | |
1302 | |
304 | 1303 // This is called via call_runtime so the arguments |
1304 // will be place in C abi locations | |
1305 | |
1306 #ifdef _LP64 | |
4559
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4223
diff
changeset
|
1307 #ifdef GRAAL |
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4223
diff
changeset
|
1308 __ verify_oop(j_rarg0); |
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4223
diff
changeset
|
1309 __ mov(rax, j_rarg0); |
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4223
diff
changeset
|
1310 #else |
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4223
diff
changeset
|
1311 __ verify_oop(c_rarg0); |
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4223
diff
changeset
|
1312 __ mov(rax, c_rarg0); |
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4223
diff
changeset
|
1313 #endif |
304 | 1314 #else |
0 | 1315 // The object is passed on the stack and we haven't pushed a |
1316 // frame yet so it's one work away from top of stack. | |
304 | 1317 __ movptr(rax, Address(rsp, 1 * BytesPerWord)); |
0 | 1318 __ verify_oop(rax); |
304 | 1319 #endif // _LP64 |
0 | 1320 |
1321 // load the klass and check the has finalizer flag | |
1322 Label register_finalizer; | |
1323 Register t = rsi; | |
2002 | 1324 __ load_klass(t, rax); |
0 | 1325 __ movl(t, Address(t, Klass::access_flags_offset_in_bytes() + sizeof(oopDesc))); |
1326 __ testl(t, JVM_ACC_HAS_FINALIZER); | |
1327 __ jcc(Assembler::notZero, register_finalizer); | |
1328 __ ret(0); | |
1329 | |
1330 __ bind(register_finalizer); | |
1331 __ enter(); | |
1332 OopMap* oop_map = save_live_registers(sasm, 2 /*num_rt_args */); | |
1333 int call_offset = __ call_RT(noreg, noreg, | |
1334 CAST_FROM_FN_PTR(address, SharedRuntime::register_finalizer), rax); | |
1335 oop_maps = new OopMapSet(); | |
1336 oop_maps->add_gc_map(call_offset, oop_map); | |
1337 | |
1338 // Now restore all the live registers | |
1339 restore_live_registers(sasm); | |
1340 | |
1341 __ leave(); | |
1342 __ ret(0); | |
1343 } | |
1344 break; | |
1345 | |
1346 case throw_range_check_failed_id: | |
1347 { StubFrame f(sasm, "range_check_failed", dont_gc_arguments); | |
1348 oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_range_check_exception), true); | |
1349 } | |
1350 break; | |
1351 | |
1352 case throw_index_exception_id: | |
1353 { StubFrame f(sasm, "index_range_check_failed", dont_gc_arguments); | |
1354 oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_index_exception), true); | |
1355 } | |
1356 break; | |
1357 | |
1358 case throw_div0_exception_id: | |
1359 { StubFrame f(sasm, "throw_div0_exception", dont_gc_arguments); | |
1360 oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_div0_exception), false); | |
1361 } | |
1362 break; | |
1363 | |
1364 case throw_null_pointer_exception_id: | |
1365 { StubFrame f(sasm, "throw_null_pointer_exception", dont_gc_arguments); | |
1366 oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_null_pointer_exception), false); | |
1367 } | |
1368 break; | |
1369 | |
1370 case handle_exception_nofpu_id: | |
1371 case handle_exception_id: | |
1372 { StubFrame f(sasm, "handle_exception", dont_gc_arguments); | |
2321
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
1373 oop_maps = generate_handle_exception(id, sasm); |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
1374 } |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
1375 break; |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
1376 |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
1377 case handle_exception_from_callee_id: |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
1378 { StubFrame f(sasm, "handle_exception_from_callee", dont_gc_arguments); |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2168
diff
changeset
|
1379 oop_maps = generate_handle_exception(id, sasm); |
0 | 1380 } |
1381 break; | |
1382 | |
1383 case unwind_exception_id: | |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
1384 { |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
1385 __ set_info("unwind_exception", dont_gc_arguments); |
0 | 1386 // note: no stubframe since we are about to leave the current |
1387 // activation and we are calling a leaf VM function only. | |
1388 generate_unwind_exception(sasm); | |
1389 } | |
1390 break; | |
1391 | |
1392 case throw_array_store_exception_id: | |
1393 { StubFrame f(sasm, "throw_array_store_exception", dont_gc_arguments); | |
1394 // tos + 0: link | |
1395 // + 1: return address | |
2168
e4fee0bdaa85
7008809: should report the class in ArrayStoreExceptions from compiled code
never
parents:
2100
diff
changeset
|
1396 oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_array_store_exception), true); |
0 | 1397 } |
1398 break; | |
1399 | |
1400 case throw_class_cast_exception_id: | |
1401 { StubFrame f(sasm, "throw_class_cast_exception", dont_gc_arguments); | |
1402 oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_class_cast_exception), true); | |
1403 } | |
1404 break; | |
1405 | |
1406 case throw_incompatible_class_change_error_id: | |
1407 { StubFrame f(sasm, "throw_incompatible_class_cast_exception", dont_gc_arguments); | |
1408 oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_incompatible_class_change_error), false); | |
1409 } | |
1410 break; | |
1411 | |
1412 case slow_subtype_check_id: | |
1413 { | |
644
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1414 // Typical calling sequence: |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1415 // __ push(klass_RInfo); // object klass or other subclass |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1416 // __ push(sup_k_RInfo); // array element klass or other superclass |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1417 // __ call(slow_subtype_check); |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1418 // Note that the subclass is pushed first, and is therefore deepest. |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1419 // Previous versions of this code reversed the names 'sub' and 'super'. |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1420 // This was operationally harmless but made the code unreadable. |
0 | 1421 enum layout { |
304 | 1422 rax_off, SLOT2(raxH_off) |
1423 rcx_off, SLOT2(rcxH_off) | |
1424 rsi_off, SLOT2(rsiH_off) | |
1425 rdi_off, SLOT2(rdiH_off) | |
1426 // saved_rbp_off, SLOT2(saved_rbpH_off) | |
1427 return_off, SLOT2(returnH_off) | |
644
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1428 sup_k_off, SLOT2(sup_kH_off) |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1429 klass_off, SLOT2(superH_off) |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1430 framesize, |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1431 result_off = klass_off // deepest argument is also the return value |
0 | 1432 }; |
1433 | |
1434 __ set_info("slow_subtype_check", dont_gc_arguments); | |
304 | 1435 __ push(rdi); |
1436 __ push(rsi); | |
1437 __ push(rcx); | |
1438 __ push(rax); | |
0 | 1439 |
304 | 1440 // This is called by pushing args and not with C abi |
644
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1441 __ movptr(rsi, Address(rsp, (klass_off) * VMRegImpl::stack_slot_size)); // subclass |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1442 __ movptr(rax, Address(rsp, (sup_k_off) * VMRegImpl::stack_slot_size)); // superclass |
0 | 1443 |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1414
diff
changeset
|
1444 Label success; |
0 | 1445 Label miss; |
4559
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4223
diff
changeset
|
1446 #ifdef GRAAL |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1414
diff
changeset
|
1447 // TODO this should really be within the XirSnippets |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1414
diff
changeset
|
1448 __ check_klass_subtype_fast_path(rsi, rax, rcx, &success, &miss, NULL); |
4559
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4223
diff
changeset
|
1449 #endif |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1414
diff
changeset
|
1450 |
644
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1451 __ check_klass_subtype_slow_path(rsi, rax, rcx, rdi, NULL, &miss); |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1452 |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1453 // fallthrough on success: |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1414
diff
changeset
|
1454 __ bind(success); |
644
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1455 __ movptr(Address(rsp, (result_off) * VMRegImpl::stack_slot_size), 1); // result |
304 | 1456 __ pop(rax); |
1457 __ pop(rcx); | |
1458 __ pop(rsi); | |
1459 __ pop(rdi); | |
0 | 1460 __ ret(0); |
1461 | |
1462 __ bind(miss); | |
644
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1463 __ movptr(Address(rsp, (result_off) * VMRegImpl::stack_slot_size), NULL_WORD); // result |
304 | 1464 __ pop(rax); |
1465 __ pop(rcx); | |
1466 __ pop(rsi); | |
1467 __ pop(rdi); | |
0 | 1468 __ ret(0); |
1469 } | |
1470 break; | |
1471 | |
1472 case monitorenter_nofpu_id: | |
1473 save_fpu_registers = false; | |
1474 // fall through | |
1475 case monitorenter_id: | |
1476 { | |
1477 StubFrame f(sasm, "monitorenter", dont_gc_arguments); | |
1478 OopMap* map = save_live_registers(sasm, 3, save_fpu_registers); | |
1479 | |
304 | 1480 // Called with store_parameter and not C abi |
1481 | |
0 | 1482 f.load_argument(1, rax); // rax,: object |
1483 f.load_argument(0, rbx); // rbx,: lock address | |
1484 | |
1485 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, monitorenter), rax, rbx); | |
1486 | |
1487 oop_maps = new OopMapSet(); | |
1488 oop_maps->add_gc_map(call_offset, map); | |
1489 restore_live_registers(sasm, save_fpu_registers); | |
1490 } | |
1491 break; | |
1492 | |
1493 case monitorexit_nofpu_id: | |
1494 save_fpu_registers = false; | |
1495 // fall through | |
1496 case monitorexit_id: | |
1497 { | |
1498 StubFrame f(sasm, "monitorexit", dont_gc_arguments); | |
1499 OopMap* map = save_live_registers(sasm, 2, save_fpu_registers); | |
1500 | |
304 | 1501 // Called with store_parameter and not C abi |
1502 | |
0 | 1503 f.load_argument(0, rax); // rax,: lock address |
1504 | |
1505 // note: really a leaf routine but must setup last java sp | |
1506 // => use call_RT for now (speed can be improved by | |
1507 // doing last java sp setup manually) | |
1508 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, monitorexit), rax); | |
1509 | |
1510 oop_maps = new OopMapSet(); | |
1511 oop_maps->add_gc_map(call_offset, map); | |
1512 restore_live_registers(sasm, save_fpu_registers); | |
4048
cec1757a0134
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
3899
diff
changeset
|
1513 } |
cec1757a0134
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
3899
diff
changeset
|
1514 break; |
0 | 1515 |
4048
cec1757a0134
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
3899
diff
changeset
|
1516 case deoptimize_id: |
cec1757a0134
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
3899
diff
changeset
|
1517 { |
cec1757a0134
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
3899
diff
changeset
|
1518 StubFrame f(sasm, "deoptimize", dont_gc_arguments); |
cec1757a0134
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
3899
diff
changeset
|
1519 const int num_rt_args = 1; // thread |
cec1757a0134
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
3899
diff
changeset
|
1520 OopMap* oop_map = save_live_registers(sasm, num_rt_args); |
cec1757a0134
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
3899
diff
changeset
|
1521 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize)); |
cec1757a0134
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
3899
diff
changeset
|
1522 oop_maps = new OopMapSet(); |
cec1757a0134
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
3899
diff
changeset
|
1523 oop_maps->add_gc_map(call_offset, oop_map); |
cec1757a0134
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
3899
diff
changeset
|
1524 restore_live_registers(sasm); |
cec1757a0134
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
3899
diff
changeset
|
1525 DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob(); |
cec1757a0134
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
3899
diff
changeset
|
1526 assert(deopt_blob != NULL, "deoptimization blob must have been created"); |
cec1757a0134
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
3899
diff
changeset
|
1527 __ leave(); |
cec1757a0134
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
3899
diff
changeset
|
1528 __ jump(RuntimeAddress(deopt_blob->unpack_with_reexecution())); |
0 | 1529 } |
1530 break; | |
1531 | |
1532 case access_field_patching_id: | |
1533 { StubFrame f(sasm, "access_field_patching", dont_gc_arguments); | |
1534 // we should set up register map | |
1535 oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, access_field_patching)); | |
1536 } | |
1537 break; | |
1538 | |
1539 case load_klass_patching_id: | |
1540 { StubFrame f(sasm, "load_klass_patching", dont_gc_arguments); | |
1541 // we should set up register map | |
1542 oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, move_klass_patching)); | |
1543 } | |
1544 break; | |
1545 | |
1546 case dtrace_object_alloc_id: | |
1547 { // rax,: object | |
1548 StubFrame f(sasm, "dtrace_object_alloc", dont_gc_arguments); | |
1549 // we can't gc here so skip the oopmap but make sure that all | |
1550 // the live registers get saved. | |
1551 save_live_registers(sasm, 1); | |
1552 | |
304 | 1553 __ NOT_LP64(push(rax)) LP64_ONLY(mov(c_rarg0, rax)); |
0 | 1554 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_object_alloc))); |
304 | 1555 NOT_LP64(__ pop(rax)); |
0 | 1556 |
1557 restore_live_registers(sasm); | |
1558 } | |
1559 break; | |
1560 | |
1561 case fpu2long_stub_id: | |
1562 { | |
1563 // rax, and rdx are destroyed, but should be free since the result is returned there | |
1564 // preserve rsi,ecx | |
304 | 1565 __ push(rsi); |
1566 __ push(rcx); | |
1567 LP64_ONLY(__ push(rdx);) | |
0 | 1568 |
1569 // check for NaN | |
1570 Label return0, do_return, return_min_jlong, do_convert; | |
1571 | |
304 | 1572 Address value_high_word(rsp, wordSize + 4); |
1573 Address value_low_word(rsp, wordSize); | |
1574 Address result_high_word(rsp, 3*wordSize + 4); | |
1575 Address result_low_word(rsp, 3*wordSize); | |
0 | 1576 |
304 | 1577 __ subptr(rsp, 32); // more than enough on 32bit |
0 | 1578 __ fst_d(value_low_word); |
1579 __ movl(rax, value_high_word); | |
1580 __ andl(rax, 0x7ff00000); | |
1581 __ cmpl(rax, 0x7ff00000); | |
1582 __ jcc(Assembler::notEqual, do_convert); | |
1583 __ movl(rax, value_high_word); | |
1584 __ andl(rax, 0xfffff); | |
1585 __ orl(rax, value_low_word); | |
1586 __ jcc(Assembler::notZero, return0); | |
1587 | |
1588 __ bind(do_convert); | |
1589 __ fnstcw(Address(rsp, 0)); | |
304 | 1590 __ movzwl(rax, Address(rsp, 0)); |
0 | 1591 __ orl(rax, 0xc00); |
1592 __ movw(Address(rsp, 2), rax); | |
1593 __ fldcw(Address(rsp, 2)); | |
1594 __ fwait(); | |
1595 __ fistp_d(result_low_word); | |
1596 __ fldcw(Address(rsp, 0)); | |
1597 __ fwait(); | |
304 | 1598 // This gets the entire long in rax on 64bit |
1599 __ movptr(rax, result_low_word); | |
1600 // testing of high bits | |
0 | 1601 __ movl(rdx, result_high_word); |
304 | 1602 __ mov(rcx, rax); |
0 | 1603 // What the heck is the point of the next instruction??? |
1604 __ xorl(rcx, 0x0); | |
1605 __ movl(rsi, 0x80000000); | |
1606 __ xorl(rsi, rdx); | |
1607 __ orl(rcx, rsi); | |
1608 __ jcc(Assembler::notEqual, do_return); | |
1609 __ fldz(); | |
1610 __ fcomp_d(value_low_word); | |
1611 __ fnstsw_ax(); | |
304 | 1612 #ifdef _LP64 |
1613 __ testl(rax, 0x4100); // ZF & CF == 0 | |
1614 __ jcc(Assembler::equal, return_min_jlong); | |
1615 #else | |
0 | 1616 __ sahf(); |
1617 __ jcc(Assembler::above, return_min_jlong); | |
304 | 1618 #endif // _LP64 |
0 | 1619 // return max_jlong |
304 | 1620 #ifndef _LP64 |
0 | 1621 __ movl(rdx, 0x7fffffff); |
1622 __ movl(rax, 0xffffffff); | |
304 | 1623 #else |
1624 __ mov64(rax, CONST64(0x7fffffffffffffff)); | |
1625 #endif // _LP64 | |
0 | 1626 __ jmp(do_return); |
1627 | |
1628 __ bind(return_min_jlong); | |
304 | 1629 #ifndef _LP64 |
0 | 1630 __ movl(rdx, 0x80000000); |
1631 __ xorl(rax, rax); | |
304 | 1632 #else |
1633 __ mov64(rax, CONST64(0x8000000000000000)); | |
1634 #endif // _LP64 | |
0 | 1635 __ jmp(do_return); |
1636 | |
1637 __ bind(return0); | |
1638 __ fpop(); | |
304 | 1639 #ifndef _LP64 |
1640 __ xorptr(rdx,rdx); | |
1641 __ xorptr(rax,rax); | |
1642 #else | |
1643 __ xorptr(rax, rax); | |
1644 #endif // _LP64 | |
0 | 1645 |
1646 __ bind(do_return); | |
304 | 1647 __ addptr(rsp, 32); |
1648 LP64_ONLY(__ pop(rdx);) | |
1649 __ pop(rcx); | |
1650 __ pop(rsi); | |
0 | 1651 __ ret(0); |
1652 } | |
1653 break; | |
1654 | |
342 | 1655 #ifndef SERIALGC |
1656 case g1_pre_barrier_slow_id: | |
1657 { | |
1658 StubFrame f(sasm, "g1_pre_barrier", dont_gc_arguments); | |
1659 // arg0 : previous value of memory | |
1660 | |
1661 BarrierSet* bs = Universe::heap()->barrier_set(); | |
1662 if (bs->kind() != BarrierSet::G1SATBCTLogging) { | |
362 | 1663 __ movptr(rax, (int)id); |
342 | 1664 __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), rax); |
1665 __ should_not_reach_here(); | |
1666 break; | |
1667 } | |
362 | 1668 __ push(rax); |
1669 __ push(rdx); | |
342 | 1670 |
1671 const Register pre_val = rax; | |
362 | 1672 const Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread); |
342 | 1673 const Register tmp = rdx; |
1674 | |
362 | 1675 NOT_LP64(__ get_thread(thread);) |
342 | 1676 |
1677 Address in_progress(thread, in_bytes(JavaThread::satb_mark_queue_offset() + | |
1678 PtrQueue::byte_offset_of_active())); | |
1679 | |
1680 Address queue_index(thread, in_bytes(JavaThread::satb_mark_queue_offset() + | |
1681 PtrQueue::byte_offset_of_index())); | |
1682 Address buffer(thread, in_bytes(JavaThread::satb_mark_queue_offset() + | |
1683 PtrQueue::byte_offset_of_buf())); | |
1684 | |
1685 | |
1686 Label done; | |
1687 Label runtime; | |
1688 | |
1689 // Can we store original value in the thread's buffer? | |
1690 | |
362 | 1691 #ifdef _LP64 |
1572 | 1692 __ movslq(tmp, queue_index); |
362 | 1693 __ cmpq(tmp, 0); |
1694 #else | |
342 | 1695 __ cmpl(queue_index, 0); |
362 | 1696 #endif |
342 | 1697 __ jcc(Assembler::equal, runtime); |
362 | 1698 #ifdef _LP64 |
1699 __ subq(tmp, wordSize); | |
1700 __ movl(queue_index, tmp); | |
1701 __ addq(tmp, buffer); | |
1702 #else | |
342 | 1703 __ subl(queue_index, wordSize); |
1704 __ movl(tmp, buffer); | |
1705 __ addl(tmp, queue_index); | |
362 | 1706 #endif |
1707 | |
342 | 1708 // prev_val (rax) |
1709 f.load_argument(0, pre_val); | |
362 | 1710 __ movptr(Address(tmp, 0), pre_val); |
342 | 1711 __ jmp(done); |
1712 | |
1713 __ bind(runtime); | |
1572 | 1714 __ push(rcx); |
1715 #ifdef _LP64 | |
1716 __ push(r8); | |
1717 __ push(r9); | |
1718 __ push(r10); | |
1719 __ push(r11); | |
1720 # ifndef _WIN64 | |
1721 __ push(rdi); | |
1722 __ push(rsi); | |
1723 # endif | |
1724 #endif | |
342 | 1725 // load the pre-value |
1726 f.load_argument(0, rcx); | |
1727 __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), rcx, thread); | |
1572 | 1728 #ifdef _LP64 |
1729 # ifndef _WIN64 | |
1730 __ pop(rsi); | |
1731 __ pop(rdi); | |
1732 # endif | |
1733 __ pop(r11); | |
1734 __ pop(r10); | |
1735 __ pop(r9); | |
1736 __ pop(r8); | |
1737 #endif | |
362 | 1738 __ pop(rcx); |
1572 | 1739 __ bind(done); |
342 | 1740 |
362 | 1741 __ pop(rdx); |
1742 __ pop(rax); | |
342 | 1743 } |
1744 break; | |
1745 | |
1746 case g1_post_barrier_slow_id: | |
1747 { | |
1748 StubFrame f(sasm, "g1_post_barrier", dont_gc_arguments); | |
1749 | |
1750 | |
1751 // arg0: store_address | |
1752 Address store_addr(rbp, 2*BytesPerWord); | |
1753 | |
1754 BarrierSet* bs = Universe::heap()->barrier_set(); | |
1755 CardTableModRefBS* ct = (CardTableModRefBS*)bs; | |
1756 Label done; | |
1757 Label runtime; | |
1758 | |
1759 // At this point we know new_value is non-NULL and the new_value crosses regsion. | |
1760 // Must check to see if card is already dirty | |
1761 | |
362 | 1762 const Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread); |
342 | 1763 |
1764 Address queue_index(thread, in_bytes(JavaThread::dirty_card_queue_offset() + | |
1765 PtrQueue::byte_offset_of_index())); | |
1766 Address buffer(thread, in_bytes(JavaThread::dirty_card_queue_offset() + | |
1767 PtrQueue::byte_offset_of_buf())); | |
1768 | |
362 | 1769 __ push(rax); |
1572 | 1770 __ push(rcx); |
342 | 1771 |
362 | 1772 NOT_LP64(__ get_thread(thread);) |
1773 ExternalAddress cardtable((address)ct->byte_map_base); | |
342 | 1774 assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code"); |
1775 | |
1572 | 1776 const Register card_addr = rcx; |
362 | 1777 #ifdef _LP64 |
1778 const Register tmp = rscratch1; | |
1779 f.load_argument(0, card_addr); | |
1780 __ shrq(card_addr, CardTableModRefBS::card_shift); | |
1781 __ lea(tmp, cardtable); | |
1782 // get the address of the card | |
1783 __ addq(card_addr, tmp); | |
1784 #else | |
1572 | 1785 const Register card_index = rcx; |
362 | 1786 f.load_argument(0, card_index); |
1787 __ shrl(card_index, CardTableModRefBS::card_shift); | |
1788 | |
342 | 1789 Address index(noreg, card_index, Address::times_1); |
1790 __ leal(card_addr, __ as_Address(ArrayAddress(cardtable, index))); | |
362 | 1791 #endif |
1792 | |
342 | 1793 __ cmpb(Address(card_addr, 0), 0); |
1794 __ jcc(Assembler::equal, done); | |
1795 | |
1796 // storing region crossing non-NULL, card is clean. | |
1797 // dirty card and log. | |
1798 | |
1799 __ movb(Address(card_addr, 0), 0); | |
1800 | |
1801 __ cmpl(queue_index, 0); | |
1802 __ jcc(Assembler::equal, runtime); | |
1803 __ subl(queue_index, wordSize); | |
1804 | |
1805 const Register buffer_addr = rbx; | |
362 | 1806 __ push(rbx); |
1807 | |
1808 __ movptr(buffer_addr, buffer); | |
342 | 1809 |
362 | 1810 #ifdef _LP64 |
1811 __ movslq(rscratch1, queue_index); | |
1812 __ addptr(buffer_addr, rscratch1); | |
1813 #else | |
1814 __ addptr(buffer_addr, queue_index); | |
1815 #endif | |
1816 __ movptr(Address(buffer_addr, 0), card_addr); | |
1817 | |
1818 __ pop(rbx); | |
342 | 1819 __ jmp(done); |
1820 | |
1821 __ bind(runtime); | |
1572 | 1822 __ push(rdx); |
1823 #ifdef _LP64 | |
1824 __ push(r8); | |
1825 __ push(r9); | |
1826 __ push(r10); | |
1827 __ push(r11); | |
1828 # ifndef _WIN64 | |
1829 __ push(rdi); | |
1830 __ push(rsi); | |
1831 # endif | |
1832 #endif | |
342 | 1833 __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, thread); |
1572 | 1834 #ifdef _LP64 |
1835 # ifndef _WIN64 | |
1836 __ pop(rsi); | |
1837 __ pop(rdi); | |
1838 # endif | |
1839 __ pop(r11); | |
1840 __ pop(r10); | |
1841 __ pop(r9); | |
1842 __ pop(r8); | |
1843 #endif | |
1844 __ pop(rdx); | |
1845 __ bind(done); | |
342 | 1846 |
1572 | 1847 __ pop(rcx); |
362 | 1848 __ pop(rax); |
342 | 1849 |
1850 } | |
1851 break; | |
1852 #endif // !SERIALGC | |
1853 | |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2662
diff
changeset
|
1854 case graal_unwind_exception_call_id: { |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1855 // remove the frame from the stack |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1856 __ movptr(rsp, rbp); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1857 __ pop(rbp); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1858 // exception_oop is passed using ordinary java calling conventions |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1859 __ movptr(rax, j_rarg0); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1860 |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1861 Label nonNullExceptionOop; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1862 __ testptr(rax, rax); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1863 __ jcc(Assembler::notZero, nonNullExceptionOop); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
1864 { |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1865 __ enter(); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1866 oop_maps = new OopMapSet(); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1867 OopMap* oop_map = save_live_registers(sasm, 0); |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2662
diff
changeset
|
1868 int call_offset = __ call_RT(rax, noreg, (address)graal_create_null_exception, 0); |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1869 oop_maps->add_gc_map(call_offset, oop_map); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1870 __ leave(); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1871 } |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1872 __ bind(nonNullExceptionOop); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
1873 |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1874 __ set_info("unwind_exception", dont_gc_arguments); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1875 // note: no stubframe since we are about to leave the current |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1876 // activation and we are calling a leaf VM function only. |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1877 generate_unwind_exception(sasm); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1878 __ should_not_reach_here(); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1879 break; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1880 } |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
1881 |
3558
bc95d122df79
added runtime call to supply info upon deoptimization
Lukas Stadler <lukas.stadler@jku.at>
parents:
3538
diff
changeset
|
1882 case graal_set_deopt_info_id: { |
bc95d122df79
added runtime call to supply info upon deoptimization
Lukas Stadler <lukas.stadler@jku.at>
parents:
3538
diff
changeset
|
1883 __ movptr(Address(r15_thread, JavaThread::graal_deopt_info_offset()), rscratch1); |
bc95d122df79
added runtime call to supply info upon deoptimization
Lukas Stadler <lukas.stadler@jku.at>
parents:
3538
diff
changeset
|
1884 __ ret(0); |
bc95d122df79
added runtime call to supply info upon deoptimization
Lukas Stadler <lukas.stadler@jku.at>
parents:
3538
diff
changeset
|
1885 break; |
bc95d122df79
added runtime call to supply info upon deoptimization
Lukas Stadler <lukas.stadler@jku.at>
parents:
3538
diff
changeset
|
1886 } |
bc95d122df79
added runtime call to supply info upon deoptimization
Lukas Stadler <lukas.stadler@jku.at>
parents:
3538
diff
changeset
|
1887 |
3538
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
1888 case graal_create_null_pointer_exception_id: { |
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
1889 __ enter(); |
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
1890 oop_maps = new OopMapSet(); |
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
1891 OopMap* oop_map = save_live_registers(sasm, 0); |
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
1892 int call_offset = __ call_RT(rax, noreg, (address)graal_create_null_exception, 0); |
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
1893 oop_maps->add_gc_map(call_offset, oop_map); |
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
1894 __ leave(); |
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
1895 __ ret(0); |
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
1896 break; |
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
1897 } |
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
1898 |
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
1899 case graal_create_out_of_bounds_exception_id: { |
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
1900 __ enter(); |
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
1901 oop_maps = new OopMapSet(); |
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
1902 OopMap* oop_map = save_live_registers(sasm, 0); |
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
1903 int call_offset = __ call_RT(rax, noreg, (address)graal_create_out_of_bounds_exception, c_rarg0); |
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
1904 oop_maps->add_gc_map(call_offset, oop_map); |
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
1905 __ leave(); |
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
1906 __ ret(0); |
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
1907 break; |
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
1908 } |
e4616e3d207b
support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents:
3509
diff
changeset
|
1909 |
3682
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
1910 case graal_generic_callback_id: { |
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
1911 __ enter(); |
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
1912 oop_maps = new OopMapSet(); |
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
1913 OopMap* oop_map = save_live_registers(sasm, 0); |
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
1914 int call_offset = __ call_RT(rax, noreg, (address)graal_generic_callback, j_rarg0, j_rarg1); |
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
1915 oop_maps->add_gc_map(call_offset, oop_map); |
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
1916 __ leave(); |
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
1917 __ ret(0); |
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
1918 break; |
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
1919 } |
6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
Lukas Stadler <lukas.stadler@jku.at>
parents:
3558
diff
changeset
|
1920 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2662
diff
changeset
|
1921 case graal_slow_subtype_check_id: { |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1922 Label success; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1923 Label miss; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1924 |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1925 // TODO this should really be within the XirSnippets |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1926 __ check_klass_subtype_fast_path(j_rarg0, j_rarg1, j_rarg2, &success, &miss, NULL); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1927 __ check_klass_subtype_slow_path(j_rarg0, j_rarg1, j_rarg2, j_rarg3, NULL, &miss); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1928 |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1929 // fallthrough on success: |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1930 __ bind(success); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1931 __ movptr(rax, 1); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1932 __ ret(0); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1933 |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1934 __ bind(miss); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1935 __ movptr(rax, NULL_WORD); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1936 __ ret(0); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1937 break; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1938 } |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
1939 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2662
diff
changeset
|
1940 case graal_verify_pointer_id: { |
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2662
diff
changeset
|
1941 __ verify_oop(r13, "graal verify pointer"); |
1449
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
1942 __ ret(0); |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
1943 break; |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
1944 } |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
1945 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2662
diff
changeset
|
1946 case graal_arithmetic_frem_id: { |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1947 __ subptr(rsp, 8); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1948 __ movflt(Address(rsp, 0), xmm1); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1949 __ fld_s(Address(rsp, 0)); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1950 __ movflt(Address(rsp, 0), xmm0); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1951 __ fld_s(Address(rsp, 0)); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1952 Label L; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1953 __ bind(L); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1954 __ fprem(); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1955 __ fwait(); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1956 __ fnstsw_ax(); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1957 __ testl(rax, 0x400); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1958 __ jcc(Assembler::notZero, L); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1959 __ fxch(1); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1960 __ fpop(); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1961 __ fstp_s(Address(rsp, 0)); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1962 __ movflt(xmm0, Address(rsp, 0)); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1963 __ addptr(rsp, 8); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1964 __ ret(0); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1965 break; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1966 } |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2662
diff
changeset
|
1967 case graal_arithmetic_drem_id: { |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1968 __ subptr(rsp, 8); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1969 __ movdbl(Address(rsp, 0), xmm1); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1970 __ fld_d(Address(rsp, 0)); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1971 __ movdbl(Address(rsp, 0), xmm0); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1972 __ fld_d(Address(rsp, 0)); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1973 Label L; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1974 __ bind(L); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1975 __ fprem(); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1976 __ fwait(); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1977 __ fnstsw_ax(); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1978 __ testl(rax, 0x400); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1979 __ jcc(Assembler::notZero, L); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1980 __ fxch(1); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1981 __ fpop(); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1982 __ fstp_d(Address(rsp, 0)); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1983 __ movdbl(xmm0, Address(rsp, 0)); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1984 __ addptr(rsp, 8); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1985 __ ret(0); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1986 break; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1987 } |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2662
diff
changeset
|
1988 case graal_monitorenter_id: { |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1989 Label slow_case; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1990 |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1991 Register obj = j_rarg0; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1992 Register lock = j_rarg1; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1993 |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1994 Register scratch1 = rax; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1995 Register scratch2 = rbx; |
1942
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1930
diff
changeset
|
1996 assert_different_registers(obj, lock, scratch1, scratch2); |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1997 |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1998 // copied from LIR_Assembler::emit_lock |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1999 if (UseFastLocking) { |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2000 assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header"); |
3714
b648304ba4ff
Change Graal monitor enter and exit from BasicObjectLock to BasicLock
Christian Wimmer <christian.wimmer@oracle.com>
parents:
3705
diff
changeset
|
2001 __ lock_object(scratch1, obj, lock, scratch2, slow_case, false); |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2002 __ ret(0); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
2003 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
2004 |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2005 __ bind(slow_case); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
2006 { |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2662
diff
changeset
|
2007 StubFrame f(sasm, "graal_monitorenter", dont_gc_arguments); |
3714
b648304ba4ff
Change Graal monitor enter and exit from BasicObjectLock to BasicLock
Christian Wimmer <christian.wimmer@oracle.com>
parents:
3705
diff
changeset
|
2008 OopMap* map = save_live_registers(sasm, 2, save_fpu_registers); |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2009 |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2010 // Called with store_parameter and not C abi |
3714
b648304ba4ff
Change Graal monitor enter and exit from BasicObjectLock to BasicLock
Christian Wimmer <christian.wimmer@oracle.com>
parents:
3705
diff
changeset
|
2011 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, graal_monitorenter), obj, lock); |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2012 |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2013 oop_maps = new OopMapSet(); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2014 oop_maps->add_gc_map(call_offset, map); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2015 restore_live_registers(sasm, save_fpu_registers); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2016 } |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2017 __ ret(0); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2018 break; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2019 } |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2662
diff
changeset
|
2020 case graal_monitorexit_id: { |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2021 Label slow_case; |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
2022 |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2023 Register obj = j_rarg0; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2024 Register lock = j_rarg1; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2025 |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2026 // needed in rax later on... |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2027 Register lock2 = rax; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2028 __ mov(lock2, lock); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2029 Register scratch1 = rbx; |
1942
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1930
diff
changeset
|
2030 assert_different_registers(obj, lock, scratch1, lock2); |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2031 |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2032 // copied from LIR_Assembler::emit_lock |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2033 if (UseFastLocking) { |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2034 assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header"); |
3714
b648304ba4ff
Change Graal monitor enter and exit from BasicObjectLock to BasicLock
Christian Wimmer <christian.wimmer@oracle.com>
parents:
3705
diff
changeset
|
2035 __ unlock_object(scratch1, obj, lock2, slow_case, false); |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2036 __ ret(0); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
2037 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
2038 |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2039 __ bind(slow_case); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
2040 { |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2662
diff
changeset
|
2041 StubFrame f(sasm, "graal_monitorexit", dont_gc_arguments); |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2042 OopMap* map = save_live_registers(sasm, 2, save_fpu_registers); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
2043 |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2044 // note: really a leaf routine but must setup last java sp |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2045 // => use call_RT for now (speed can be improved by |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2046 // doing last java sp setup manually) |
3714
b648304ba4ff
Change Graal monitor enter and exit from BasicObjectLock to BasicLock
Christian Wimmer <christian.wimmer@oracle.com>
parents:
3705
diff
changeset
|
2047 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, graal_monitorexit), obj, lock); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
2048 |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2049 oop_maps = new OopMapSet(); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2050 oop_maps->add_gc_map(call_offset, map); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2051 restore_live_registers(sasm, save_fpu_registers); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2052 } |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2053 __ ret(0); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2054 break; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2055 } |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
2056 |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2057 |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2058 |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
2059 |
0 | 2060 default: |
2061 { StubFrame f(sasm, "unimplemented entry", dont_gc_arguments); | |
304 | 2062 __ movptr(rax, (int)id); |
0 | 2063 __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), rax); |
2064 __ should_not_reach_here(); | |
2065 } | |
2066 break; | |
2067 } | |
2068 return oop_maps; | |
2069 } | |
2070 | |
2071 #undef __ | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1579
diff
changeset
|
2072 |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1579
diff
changeset
|
2073 const char *Runtime1::pd_name_for_address(address entry) { |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1579
diff
changeset
|
2074 return "<unknown function>"; |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1579
diff
changeset
|
2075 } |