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