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