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