author | rkennke |
Tue, 19 Jun 2018 13:03:12 -0400 | |
changeset 50693 | db0a17475826 |
parent 50094 | 2f79462aab9b |
child 51224 | dd1aa4229fd4 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49018
diff
changeset
|
2 |
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5252
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5252
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5252
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
8882
f852635a6383
7032388: guarantee(VM_Version::supports_cmov()) failed: illegal instruction on i586 after 6919934
twisti
parents:
8495
diff
changeset
|
26 |
#include "asm/assembler.hpp" |
7397 | 27 |
#include "c1/c1_Defs.hpp" |
28 |
#include "c1/c1_MacroAssembler.hpp" |
|
29 |
#include "c1/c1_Runtime1.hpp" |
|
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49018
diff
changeset
|
30 |
#include "ci/ciUtilities.hpp" |
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49018
diff
changeset
|
31 |
#include "gc/shared/cardTable.hpp" |
49455
848864ed9b17
8199604: Rename CardTableModRefBS to CardTableBarrierSet
eosterlund
parents:
49388
diff
changeset
|
32 |
#include "gc/shared/cardTableBarrierSet.hpp" |
7397 | 33 |
#include "interpreter/interpreter.hpp" |
34 |
#include "nativeInst_x86.hpp" |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11962
diff
changeset
|
35 |
#include "oops/compiledICHolder.hpp" |
7397 | 36 |
#include "oops/oop.inline.hpp" |
37 |
#include "prims/jvmtiExport.hpp" |
|
38 |
#include "register_x86.hpp" |
|
39 |
#include "runtime/sharedRuntime.hpp" |
|
40 |
#include "runtime/signature.hpp" |
|
41 |
#include "runtime/vframeArray.hpp" |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
42 |
#include "utilities/macros.hpp" |
7397 | 43 |
#include "vmreg_x86.inline.hpp" |
1 | 44 |
|
45 |
// Implementation of StubAssembler |
|
46 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11962
diff
changeset
|
47 |
int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, int args_size) { |
1 | 48 |
// setup registers |
1066 | 49 |
const Register thread = NOT_LP64(rdi) LP64_ONLY(r15_thread); // is callee-saved register (Visual C++ calling conventions) |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11962
diff
changeset
|
50 |
assert(!(oop_result1->is_valid() || metadata_result->is_valid()) || oop_result1 != metadata_result, "registers must be different"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11962
diff
changeset
|
51 |
assert(oop_result1 != thread && metadata_result != thread, "registers must be different"); |
1 | 52 |
assert(args_size >= 0, "illegal args_size"); |
11962
42ae1f21ed2b
7148486: At a method handle call returning with an exception may call the runtime with misaligned stack (x64)
roland
parents:
11439
diff
changeset
|
53 |
bool align_stack = false; |
42ae1f21ed2b
7148486: At a method handle call returning with an exception may call the runtime with misaligned stack (x64)
roland
parents:
11439
diff
changeset
|
54 |
#ifdef _LP64 |
42ae1f21ed2b
7148486: At a method handle call returning with an exception may call the runtime with misaligned stack (x64)
roland
parents:
11439
diff
changeset
|
55 |
// At a method handle call, the stack may not be properly aligned |
42ae1f21ed2b
7148486: At a method handle call returning with an exception may call the runtime with misaligned stack (x64)
roland
parents:
11439
diff
changeset
|
56 |
// when returning with an exception. |
42ae1f21ed2b
7148486: At a method handle call returning with an exception may call the runtime with misaligned stack (x64)
roland
parents:
11439
diff
changeset
|
57 |
align_stack = (stub_id() == Runtime1::handle_exception_from_callee_id); |
42ae1f21ed2b
7148486: At a method handle call returning with an exception may call the runtime with misaligned stack (x64)
roland
parents:
11439
diff
changeset
|
58 |
#endif |
1 | 59 |
|
1066 | 60 |
#ifdef _LP64 |
61 |
mov(c_rarg0, thread); |
|
62 |
set_num_rt_args(0); // Nothing on stack |
|
63 |
#else |
|
1 | 64 |
set_num_rt_args(1 + args_size); |
65 |
||
66 |
// push java thread (becomes first argument of C function) |
|
67 |
get_thread(thread); |
|
1066 | 68 |
push(thread); |
69 |
#endif // _LP64 |
|
1 | 70 |
|
11962
42ae1f21ed2b
7148486: At a method handle call returning with an exception may call the runtime with misaligned stack (x64)
roland
parents:
11439
diff
changeset
|
71 |
int call_offset; |
42ae1f21ed2b
7148486: At a method handle call returning with an exception may call the runtime with misaligned stack (x64)
roland
parents:
11439
diff
changeset
|
72 |
if (!align_stack) { |
42ae1f21ed2b
7148486: At a method handle call returning with an exception may call the runtime with misaligned stack (x64)
roland
parents:
11439
diff
changeset
|
73 |
set_last_Java_frame(thread, noreg, rbp, NULL); |
42ae1f21ed2b
7148486: At a method handle call returning with an exception may call the runtime with misaligned stack (x64)
roland
parents:
11439
diff
changeset
|
74 |
} else { |
42ae1f21ed2b
7148486: At a method handle call returning with an exception may call the runtime with misaligned stack (x64)
roland
parents:
11439
diff
changeset
|
75 |
address the_pc = pc(); |
42ae1f21ed2b
7148486: At a method handle call returning with an exception may call the runtime with misaligned stack (x64)
roland
parents:
11439
diff
changeset
|
76 |
call_offset = offset(); |
42ae1f21ed2b
7148486: At a method handle call returning with an exception may call the runtime with misaligned stack (x64)
roland
parents:
11439
diff
changeset
|
77 |
set_last_Java_frame(thread, noreg, rbp, the_pc); |
42ae1f21ed2b
7148486: At a method handle call returning with an exception may call the runtime with misaligned stack (x64)
roland
parents:
11439
diff
changeset
|
78 |
andptr(rsp, -(StackAlignmentInBytes)); // Align stack |
42ae1f21ed2b
7148486: At a method handle call returning with an exception may call the runtime with misaligned stack (x64)
roland
parents:
11439
diff
changeset
|
79 |
} |
1066 | 80 |
|
1 | 81 |
// do the call |
82 |
call(RuntimeAddress(entry)); |
|
11962
42ae1f21ed2b
7148486: At a method handle call returning with an exception may call the runtime with misaligned stack (x64)
roland
parents:
11439
diff
changeset
|
83 |
if (!align_stack) { |
42ae1f21ed2b
7148486: At a method handle call returning with an exception may call the runtime with misaligned stack (x64)
roland
parents:
11439
diff
changeset
|
84 |
call_offset = offset(); |
42ae1f21ed2b
7148486: At a method handle call returning with an exception may call the runtime with misaligned stack (x64)
roland
parents:
11439
diff
changeset
|
85 |
} |
1 | 86 |
// verify callee-saved register |
87 |
#ifdef ASSERT |
|
88 |
guarantee(thread != rax, "change this code"); |
|
1066 | 89 |
push(rax); |
1 | 90 |
{ Label L; |
91 |
get_thread(rax); |
|
1066 | 92 |
cmpptr(thread, rax); |
1 | 93 |
jcc(Assembler::equal, L); |
94 |
int3(); |
|
95 |
stop("StubAssembler::call_RT: rdi not callee saved?"); |
|
96 |
bind(L); |
|
97 |
} |
|
1066 | 98 |
pop(rax); |
1 | 99 |
#endif |
40644
39e631ed7145
8161598: Kitchensink fails: assert(nm->insts_contains(original_pc)) failed: original PC must be in nmethod/CompiledMethod
dlong
parents:
36832
diff
changeset
|
100 |
reset_last_Java_frame(thread, true); |
1 | 101 |
|
102 |
// discard thread and arguments |
|
1066 | 103 |
NOT_LP64(addptr(rsp, num_rt_args()*BytesPerWord)); |
1 | 104 |
|
105 |
// check for pending exceptions |
|
106 |
{ Label L; |
|
1066 | 107 |
cmpptr(Address(thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD); |
1 | 108 |
jcc(Assembler::equal, L); |
109 |
// exception pending => remove activation and forward to exception handler |
|
1066 | 110 |
movptr(rax, Address(thread, Thread::pending_exception_offset())); |
1 | 111 |
// make sure that the vm_results are cleared |
112 |
if (oop_result1->is_valid()) { |
|
1888
bbf498fb4354
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents:
1412
diff
changeset
|
113 |
movptr(Address(thread, JavaThread::vm_result_offset()), NULL_WORD); |
1 | 114 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11962
diff
changeset
|
115 |
if (metadata_result->is_valid()) { |
1888
bbf498fb4354
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents:
1412
diff
changeset
|
116 |
movptr(Address(thread, JavaThread::vm_result_2_offset()), NULL_WORD); |
1 | 117 |
} |
118 |
if (frame_size() == no_frame_size) { |
|
119 |
leave(); |
|
120 |
jump(RuntimeAddress(StubRoutines::forward_exception_entry())); |
|
121 |
} else if (_stub_id == Runtime1::forward_exception_id) { |
|
122 |
should_not_reach_here(); |
|
123 |
} else { |
|
124 |
jump(RuntimeAddress(Runtime1::entry_for(Runtime1::forward_exception_id))); |
|
125 |
} |
|
126 |
bind(L); |
|
127 |
} |
|
128 |
// get oop results if there are any and reset the values in the thread |
|
129 |
if (oop_result1->is_valid()) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11962
diff
changeset
|
130 |
get_vm_result(oop_result1, thread); |
1 | 131 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11962
diff
changeset
|
132 |
if (metadata_result->is_valid()) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11962
diff
changeset
|
133 |
get_vm_result_2(metadata_result, thread); |
1 | 134 |
} |
135 |
return call_offset; |
|
136 |
} |
|
137 |
||
138 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11962
diff
changeset
|
139 |
int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1) { |
1066 | 140 |
#ifdef _LP64 |
141 |
mov(c_rarg1, arg1); |
|
142 |
#else |
|
143 |
push(arg1); |
|
144 |
#endif // _LP64 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11962
diff
changeset
|
145 |
return call_RT(oop_result1, metadata_result, entry, 1); |
1 | 146 |
} |
147 |
||
148 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11962
diff
changeset
|
149 |
int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1, Register arg2) { |
1066 | 150 |
#ifdef _LP64 |
151 |
if (c_rarg1 == arg2) { |
|
152 |
if (c_rarg2 == arg1) { |
|
153 |
xchgq(arg1, arg2); |
|
154 |
} else { |
|
155 |
mov(c_rarg2, arg2); |
|
156 |
mov(c_rarg1, arg1); |
|
157 |
} |
|
158 |
} else { |
|
159 |
mov(c_rarg1, arg1); |
|
160 |
mov(c_rarg2, arg2); |
|
161 |
} |
|
162 |
#else |
|
163 |
push(arg2); |
|
164 |
push(arg1); |
|
165 |
#endif // _LP64 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11962
diff
changeset
|
166 |
return call_RT(oop_result1, metadata_result, entry, 2); |
1 | 167 |
} |
168 |
||
169 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11962
diff
changeset
|
170 |
int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1, Register arg2, Register arg3) { |
1066 | 171 |
#ifdef _LP64 |
172 |
// if there is any conflict use the stack |
|
173 |
if (arg1 == c_rarg2 || arg1 == c_rarg3 || |
|
174 |
arg2 == c_rarg1 || arg1 == c_rarg3 || |
|
175 |
arg3 == c_rarg1 || arg1 == c_rarg2) { |
|
176 |
push(arg3); |
|
177 |
push(arg2); |
|
178 |
push(arg1); |
|
179 |
pop(c_rarg1); |
|
180 |
pop(c_rarg2); |
|
181 |
pop(c_rarg3); |
|
182 |
} else { |
|
183 |
mov(c_rarg1, arg1); |
|
184 |
mov(c_rarg2, arg2); |
|
185 |
mov(c_rarg3, arg3); |
|
186 |
} |
|
187 |
#else |
|
188 |
push(arg3); |
|
189 |
push(arg2); |
|
190 |
push(arg1); |
|
191 |
#endif // _LP64 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11962
diff
changeset
|
192 |
return call_RT(oop_result1, metadata_result, entry, 3); |
1 | 193 |
} |
194 |
||
195 |
||
196 |
// Implementation of StubFrame |
|
197 |
||
198 |
class StubFrame: public StackObj { |
|
199 |
private: |
|
200 |
StubAssembler* _sasm; |
|
201 |
||
202 |
public: |
|
203 |
StubFrame(StubAssembler* sasm, const char* name, bool must_gc_arguments); |
|
204 |
void load_argument(int offset_in_words, Register reg); |
|
205 |
||
206 |
~StubFrame(); |
|
207 |
}; |
|
208 |
||
49906 | 209 |
void StubAssembler::prologue(const char* name, bool must_gc_arguments) { |
210 |
set_info(name, must_gc_arguments); |
|
211 |
enter(); |
|
212 |
} |
|
213 |
||
214 |
void StubAssembler::epilogue() { |
|
215 |
leave(); |
|
216 |
ret(0); |
|
217 |
} |
|
1 | 218 |
|
219 |
#define __ _sasm-> |
|
220 |
||
221 |
StubFrame::StubFrame(StubAssembler* sasm, const char* name, bool must_gc_arguments) { |
|
222 |
_sasm = sasm; |
|
49906 | 223 |
__ prologue(name, must_gc_arguments); |
1 | 224 |
} |
225 |
||
226 |
// load parameters that were stored with LIR_Assembler::store_parameter |
|
227 |
// Note: offsets for store_parameter and load_argument must match |
|
228 |
void StubFrame::load_argument(int offset_in_words, Register reg) { |
|
49906 | 229 |
__ load_parameter(offset_in_words, reg); |
1 | 230 |
} |
231 |
||
232 |
||
233 |
StubFrame::~StubFrame() { |
|
49906 | 234 |
__ epilogue(); |
1 | 235 |
} |
236 |
||
237 |
#undef __ |
|
238 |
||
239 |
||
240 |
// Implementation of Runtime1 |
|
241 |
||
1066 | 242 |
const int float_regs_as_doubles_size_in_slots = pd_nof_fpu_regs_frame_map * 2; |
243 |
const int xmm_regs_as_doubles_size_in_slots = FrameMap::nof_xmm_regs * 2; |
|
1 | 244 |
|
245 |
// Stack layout for saving/restoring all the registers needed during a runtime |
|
246 |
// call (this includes deoptimization) |
|
247 |
// Note: note that users of this frame may well have arguments to some runtime |
|
248 |
// while these values are on the stack. These positions neglect those arguments |
|
249 |
// but the code in save_live_registers will take the argument count into |
|
250 |
// account. |
|
251 |
// |
|
1066 | 252 |
#ifdef _LP64 |
253 |
#define SLOT2(x) x, |
|
254 |
#define SLOT_PER_WORD 2 |
|
255 |
#else |
|
256 |
#define SLOT2(x) |
|
257 |
#define SLOT_PER_WORD 1 |
|
258 |
#endif // _LP64 |
|
259 |
||
1 | 260 |
enum reg_save_layout { |
1066 | 261 |
// 64bit needs to keep stack 16 byte aligned. So we add some alignment dummies to make that |
262 |
// happen and will assert if the stack size we create is misaligned |
|
263 |
#ifdef _LP64 |
|
264 |
align_dummy_0, align_dummy_1, |
|
265 |
#endif // _LP64 |
|
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
266 |
#ifdef _WIN64 |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
267 |
// Windows always allocates space for it's argument registers (see |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
268 |
// frame::arg_reg_save_area_bytes). |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
269 |
arg_reg_save_1, arg_reg_save_1H, // 0, 4 |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
270 |
arg_reg_save_2, arg_reg_save_2H, // 8, 12 |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
271 |
arg_reg_save_3, arg_reg_save_3H, // 16, 20 |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
272 |
arg_reg_save_4, arg_reg_save_4H, // 24, 28 |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
273 |
#endif // _WIN64 |
1066 | 274 |
xmm_regs_as_doubles_off, // 32 |
275 |
float_regs_as_doubles_off = xmm_regs_as_doubles_off + xmm_regs_as_doubles_size_in_slots, // 160 |
|
276 |
fpu_state_off = float_regs_as_doubles_off + float_regs_as_doubles_size_in_slots, // 224 |
|
277 |
// fpu_state_end_off is exclusive |
|
278 |
fpu_state_end_off = fpu_state_off + (FPUStateSizeInWords / SLOT_PER_WORD), // 352 |
|
279 |
marker = fpu_state_end_off, SLOT2(markerH) // 352, 356 |
|
280 |
extra_space_offset, // 360 |
|
281 |
#ifdef _LP64 |
|
282 |
r15_off = extra_space_offset, r15H_off, // 360, 364 |
|
283 |
r14_off, r14H_off, // 368, 372 |
|
284 |
r13_off, r13H_off, // 376, 380 |
|
285 |
r12_off, r12H_off, // 384, 388 |
|
286 |
r11_off, r11H_off, // 392, 396 |
|
287 |
r10_off, r10H_off, // 400, 404 |
|
288 |
r9_off, r9H_off, // 408, 412 |
|
289 |
r8_off, r8H_off, // 416, 420 |
|
290 |
rdi_off, rdiH_off, // 424, 428 |
|
291 |
#else |
|
1 | 292 |
rdi_off = extra_space_offset, |
1066 | 293 |
#endif // _LP64 |
294 |
rsi_off, SLOT2(rsiH_off) // 432, 436 |
|
295 |
rbp_off, SLOT2(rbpH_off) // 440, 444 |
|
296 |
rsp_off, SLOT2(rspH_off) // 448, 452 |
|
297 |
rbx_off, SLOT2(rbxH_off) // 456, 460 |
|
298 |
rdx_off, SLOT2(rdxH_off) // 464, 468 |
|
299 |
rcx_off, SLOT2(rcxH_off) // 472, 476 |
|
300 |
rax_off, SLOT2(raxH_off) // 480, 484 |
|
301 |
saved_rbp_off, SLOT2(saved_rbpH_off) // 488, 492 |
|
302 |
return_off, SLOT2(returnH_off) // 496, 500 |
|
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
303 |
reg_save_frame_size // As noted: neglects any parameters to runtime // 504 |
1 | 304 |
}; |
305 |
||
306 |
// Save off registers which might be killed by calls into the runtime. |
|
307 |
// Tries to smart of about FP registers. In particular we separate |
|
308 |
// saving and describing the FPU registers for deoptimization since we |
|
309 |
// have to save the FPU registers twice if we describe them and on P4 |
|
310 |
// saving FPU registers which don't contain anything appears |
|
311 |
// expensive. The deopt blob is the only thing which needs to |
|
312 |
// describe FPU registers. In all other cases it should be sufficient |
|
313 |
// to simply save their current value. |
|
314 |
||
315 |
static OopMap* generate_oop_map(StubAssembler* sasm, int num_rt_args, |
|
316 |
bool save_fpu_registers = true) { |
|
1066 | 317 |
|
318 |
// In 64bit all the args are in regs so there are no additional stack slots |
|
319 |
LP64_ONLY(num_rt_args = 0); |
|
320 |
LP64_ONLY(assert((reg_save_frame_size * VMRegImpl::stack_slot_size) % 16 == 0, "must be 16 byte aligned");) |
|
321 |
int frame_size_in_slots = reg_save_frame_size + num_rt_args; // args + thread |
|
30624 | 322 |
sasm->set_frame_size(frame_size_in_slots / VMRegImpl::slots_per_word); |
1 | 323 |
|
324 |
// record saved value locations in an OopMap |
|
325 |
// locations are offsets from sp after runtime call; num_rt_args is number of arguments in call, including thread |
|
1066 | 326 |
OopMap* map = new OopMap(frame_size_in_slots, 0); |
1 | 327 |
map->set_callee_saved(VMRegImpl::stack2reg(rax_off + num_rt_args), rax->as_VMReg()); |
328 |
map->set_callee_saved(VMRegImpl::stack2reg(rcx_off + num_rt_args), rcx->as_VMReg()); |
|
329 |
map->set_callee_saved(VMRegImpl::stack2reg(rdx_off + num_rt_args), rdx->as_VMReg()); |
|
330 |
map->set_callee_saved(VMRegImpl::stack2reg(rbx_off + num_rt_args), rbx->as_VMReg()); |
|
331 |
map->set_callee_saved(VMRegImpl::stack2reg(rsi_off + num_rt_args), rsi->as_VMReg()); |
|
332 |
map->set_callee_saved(VMRegImpl::stack2reg(rdi_off + num_rt_args), rdi->as_VMReg()); |
|
1066 | 333 |
#ifdef _LP64 |
334 |
map->set_callee_saved(VMRegImpl::stack2reg(r8_off + num_rt_args), r8->as_VMReg()); |
|
335 |
map->set_callee_saved(VMRegImpl::stack2reg(r9_off + num_rt_args), r9->as_VMReg()); |
|
336 |
map->set_callee_saved(VMRegImpl::stack2reg(r10_off + num_rt_args), r10->as_VMReg()); |
|
337 |
map->set_callee_saved(VMRegImpl::stack2reg(r11_off + num_rt_args), r11->as_VMReg()); |
|
338 |
map->set_callee_saved(VMRegImpl::stack2reg(r12_off + num_rt_args), r12->as_VMReg()); |
|
339 |
map->set_callee_saved(VMRegImpl::stack2reg(r13_off + num_rt_args), r13->as_VMReg()); |
|
340 |
map->set_callee_saved(VMRegImpl::stack2reg(r14_off + num_rt_args), r14->as_VMReg()); |
|
341 |
map->set_callee_saved(VMRegImpl::stack2reg(r15_off + num_rt_args), r15->as_VMReg()); |
|
342 |
||
343 |
// This is stupid but needed. |
|
344 |
map->set_callee_saved(VMRegImpl::stack2reg(raxH_off + num_rt_args), rax->as_VMReg()->next()); |
|
345 |
map->set_callee_saved(VMRegImpl::stack2reg(rcxH_off + num_rt_args), rcx->as_VMReg()->next()); |
|
346 |
map->set_callee_saved(VMRegImpl::stack2reg(rdxH_off + num_rt_args), rdx->as_VMReg()->next()); |
|
347 |
map->set_callee_saved(VMRegImpl::stack2reg(rbxH_off + num_rt_args), rbx->as_VMReg()->next()); |
|
348 |
map->set_callee_saved(VMRegImpl::stack2reg(rsiH_off + num_rt_args), rsi->as_VMReg()->next()); |
|
349 |
map->set_callee_saved(VMRegImpl::stack2reg(rdiH_off + num_rt_args), rdi->as_VMReg()->next()); |
|
350 |
||
351 |
map->set_callee_saved(VMRegImpl::stack2reg(r8H_off + num_rt_args), r8->as_VMReg()->next()); |
|
352 |
map->set_callee_saved(VMRegImpl::stack2reg(r9H_off + num_rt_args), r9->as_VMReg()->next()); |
|
353 |
map->set_callee_saved(VMRegImpl::stack2reg(r10H_off + num_rt_args), r10->as_VMReg()->next()); |
|
354 |
map->set_callee_saved(VMRegImpl::stack2reg(r11H_off + num_rt_args), r11->as_VMReg()->next()); |
|
355 |
map->set_callee_saved(VMRegImpl::stack2reg(r12H_off + num_rt_args), r12->as_VMReg()->next()); |
|
356 |
map->set_callee_saved(VMRegImpl::stack2reg(r13H_off + num_rt_args), r13->as_VMReg()->next()); |
|
357 |
map->set_callee_saved(VMRegImpl::stack2reg(r14H_off + num_rt_args), r14->as_VMReg()->next()); |
|
358 |
map->set_callee_saved(VMRegImpl::stack2reg(r15H_off + num_rt_args), r15->as_VMReg()->next()); |
|
359 |
#endif // _LP64 |
|
1 | 360 |
|
30624 | 361 |
int xmm_bypass_limit = FrameMap::nof_xmm_regs; |
362 |
#ifdef _LP64 |
|
363 |
if (UseAVX < 3) { |
|
364 |
xmm_bypass_limit = xmm_bypass_limit / 2; |
|
365 |
} |
|
366 |
#endif |
|
367 |
||
1 | 368 |
if (save_fpu_registers) { |
369 |
if (UseSSE < 2) { |
|
370 |
int fpu_off = float_regs_as_doubles_off; |
|
371 |
for (int n = 0; n < FrameMap::nof_fpu_regs; n++) { |
|
372 |
VMReg fpu_name_0 = FrameMap::fpu_regname(n); |
|
373 |
map->set_callee_saved(VMRegImpl::stack2reg(fpu_off + num_rt_args), fpu_name_0); |
|
374 |
// %%% This is really a waste but we'll keep things as they were for now |
|
375 |
if (true) { |
|
376 |
map->set_callee_saved(VMRegImpl::stack2reg(fpu_off + 1 + num_rt_args), fpu_name_0->next()); |
|
377 |
} |
|
378 |
fpu_off += 2; |
|
379 |
} |
|
380 |
assert(fpu_off == fpu_state_off, "incorrect number of fpu stack slots"); |
|
381 |
} |
|
382 |
||
383 |
if (UseSSE >= 2) { |
|
384 |
int xmm_off = xmm_regs_as_doubles_off; |
|
385 |
for (int n = 0; n < FrameMap::nof_xmm_regs; n++) { |
|
30624 | 386 |
if (n < xmm_bypass_limit) { |
387 |
VMReg xmm_name_0 = as_XMMRegister(n)->as_VMReg(); |
|
388 |
map->set_callee_saved(VMRegImpl::stack2reg(xmm_off + num_rt_args), xmm_name_0); |
|
389 |
// %%% This is really a waste but we'll keep things as they were for now |
|
390 |
if (true) { |
|
391 |
map->set_callee_saved(VMRegImpl::stack2reg(xmm_off + 1 + num_rt_args), xmm_name_0->next()); |
|
392 |
} |
|
1 | 393 |
} |
394 |
xmm_off += 2; |
|
395 |
} |
|
396 |
assert(xmm_off == float_regs_as_doubles_off, "incorrect number of xmm registers"); |
|
397 |
||
398 |
} else if (UseSSE == 1) { |
|
399 |
int xmm_off = xmm_regs_as_doubles_off; |
|
32727
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
400 |
for (int n = 0; n < FrameMap::nof_fpu_regs; n++) { |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
401 |
VMReg xmm_name_0 = as_XMMRegister(n)->as_VMReg(); |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
402 |
map->set_callee_saved(VMRegImpl::stack2reg(xmm_off + num_rt_args), xmm_name_0); |
1 | 403 |
xmm_off += 2; |
404 |
} |
|
405 |
assert(xmm_off == float_regs_as_doubles_off, "incorrect number of xmm registers"); |
|
406 |
} |
|
407 |
} |
|
408 |
||
409 |
return map; |
|
410 |
} |
|
411 |
||
49906 | 412 |
#define __ this-> |
413 |
||
50023 | 414 |
void C1_MacroAssembler::save_live_registers_no_oop_map(bool save_fpu_registers) { |
1 | 415 |
__ block_comment("save_live_registers"); |
416 |
||
1066 | 417 |
__ pusha(); // integer registers |
1 | 418 |
|
419 |
// assert(float_regs_as_doubles_off % 2 == 0, "misaligned offset"); |
|
420 |
// assert(xmm_regs_as_doubles_off % 2 == 0, "misaligned offset"); |
|
421 |
||
1066 | 422 |
__ subptr(rsp, extra_space_offset * VMRegImpl::stack_slot_size); |
1 | 423 |
|
424 |
#ifdef ASSERT |
|
1066 | 425 |
__ movptr(Address(rsp, marker * VMRegImpl::stack_slot_size), (int32_t)0xfeedbeef); |
1 | 426 |
#endif |
427 |
||
428 |
if (save_fpu_registers) { |
|
429 |
if (UseSSE < 2) { |
|
430 |
// save FPU stack |
|
1066 | 431 |
__ fnsave(Address(rsp, fpu_state_off * VMRegImpl::stack_slot_size)); |
1 | 432 |
__ fwait(); |
433 |
||
434 |
#ifdef ASSERT |
|
435 |
Label ok; |
|
1066 | 436 |
__ cmpw(Address(rsp, fpu_state_off * VMRegImpl::stack_slot_size), StubRoutines::fpu_cntrl_wrd_std()); |
1 | 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. |
|
1066 | 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)); |
|
1 | 448 |
|
449 |
// Save the FPU registers in de-opt-able form |
|
32727
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
450 |
int offset = 0; |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
451 |
for (int n = 0; n < FrameMap::nof_fpu_regs; n++) { |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
452 |
__ fstp_d(Address(rsp, float_regs_as_doubles_off * VMRegImpl::stack_slot_size + offset)); |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
453 |
offset += 8; |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
454 |
} |
1 | 455 |
} |
456 |
||
457 |
if (UseSSE >= 2) { |
|
458 |
// save XMM registers |
|
459 |
// XMM registers can contain float or double values, but this is not known here, |
|
460 |
// so always save them as doubles. |
|
461 |
// note that float values are _not_ converted automatically, so for float values |
|
462 |
// the second word contains only garbage data. |
|
32727
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
463 |
int xmm_bypass_limit = FrameMap::nof_xmm_regs; |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
464 |
int offset = 0; |
1066 | 465 |
#ifdef _LP64 |
32727
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
466 |
if (UseAVX < 3) { |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
467 |
xmm_bypass_limit = xmm_bypass_limit / 2; |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
468 |
} |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
469 |
#endif |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
470 |
for (int n = 0; n < xmm_bypass_limit; n++) { |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
471 |
XMMRegister xmm_name = as_XMMRegister(n); |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
472 |
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + offset), xmm_name); |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
473 |
offset += 8; |
30624 | 474 |
} |
1 | 475 |
} else if (UseSSE == 1) { |
32727
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
476 |
// save XMM registers as float because double not supported without SSE2(num MMX == num fpu) |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
477 |
int offset = 0; |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
478 |
for (int n = 0; n < FrameMap::nof_fpu_regs; n++) { |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
479 |
XMMRegister xmm_name = as_XMMRegister(n); |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
480 |
__ movflt(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + offset), xmm_name); |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
481 |
offset += 8; |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
482 |
} |
1 | 483 |
} |
484 |
} |
|
485 |
||
486 |
// FPU stack must be empty now |
|
487 |
__ verify_FPU(0, "save_live_registers"); |
|
488 |
} |
|
489 |
||
49906 | 490 |
#undef __ |
491 |
#define __ sasm-> |
|
1 | 492 |
|
49906 | 493 |
static void restore_fpu(C1_MacroAssembler* sasm, bool restore_fpu_registers) { |
1 | 494 |
if (restore_fpu_registers) { |
495 |
if (UseSSE >= 2) { |
|
496 |
// restore XMM registers |
|
32727
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
497 |
int xmm_bypass_limit = FrameMap::nof_xmm_regs; |
1066 | 498 |
#ifdef _LP64 |
32727
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
499 |
if (UseAVX < 3) { |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
500 |
xmm_bypass_limit = xmm_bypass_limit / 2; |
30624 | 501 |
} |
32727
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
502 |
#endif |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
503 |
int offset = 0; |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
504 |
for (int n = 0; n < xmm_bypass_limit; n++) { |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
505 |
XMMRegister xmm_name = as_XMMRegister(n); |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
506 |
__ movdbl(xmm_name, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + offset)); |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
507 |
offset += 8; |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
508 |
} |
1 | 509 |
} else if (UseSSE == 1) { |
32727
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
510 |
// restore XMM registers(num MMX == num fpu) |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
511 |
int offset = 0; |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
512 |
for (int n = 0; n < FrameMap::nof_fpu_regs; n++) { |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
513 |
XMMRegister xmm_name = as_XMMRegister(n); |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
514 |
__ movflt(xmm_name, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + offset)); |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
515 |
offset += 8; |
320855c2baef
8132160: support for AVX 512 call frames and stack management
mcberg
parents:
30768
diff
changeset
|
516 |
} |
1 | 517 |
} |
518 |
||
519 |
if (UseSSE < 2) { |
|
1066 | 520 |
__ frstor(Address(rsp, fpu_state_off * VMRegImpl::stack_slot_size)); |
1 | 521 |
} else { |
522 |
// check that FPU stack is really empty |
|
523 |
__ verify_FPU(0, "restore_live_registers"); |
|
524 |
} |
|
525 |
||
526 |
} else { |
|
527 |
// check that FPU stack is really empty |
|
528 |
__ verify_FPU(0, "restore_live_registers"); |
|
529 |
} |
|
530 |
||
531 |
#ifdef ASSERT |
|
532 |
{ |
|
533 |
Label ok; |
|
1066 | 534 |
__ cmpptr(Address(rsp, marker * VMRegImpl::stack_slot_size), (int32_t)0xfeedbeef); |
1 | 535 |
__ jcc(Assembler::equal, ok); |
536 |
__ stop("bad offsets in frame"); |
|
537 |
__ bind(ok); |
|
538 |
} |
|
1066 | 539 |
#endif // ASSERT |
1 | 540 |
|
1066 | 541 |
__ addptr(rsp, extra_space_offset * VMRegImpl::stack_slot_size); |
1 | 542 |
} |
543 |
||
49906 | 544 |
#undef __ |
545 |
#define __ this-> |
|
1 | 546 |
|
49906 | 547 |
void C1_MacroAssembler::restore_live_registers(bool restore_fpu_registers) { |
1 | 548 |
__ block_comment("restore_live_registers"); |
549 |
||
49906 | 550 |
restore_fpu(this, restore_fpu_registers); |
1066 | 551 |
__ popa(); |
1 | 552 |
} |
553 |
||
49906 | 554 |
|
50023 | 555 |
void C1_MacroAssembler::restore_live_registers_except_rax(bool restore_fpu_registers) { |
1 | 556 |
__ block_comment("restore_live_registers_except_rax"); |
557 |
||
50023 | 558 |
restore_fpu(this, restore_fpu_registers); |
1 | 559 |
|
1066 | 560 |
#ifdef _LP64 |
561 |
__ movptr(r15, Address(rsp, 0)); |
|
562 |
__ movptr(r14, Address(rsp, wordSize)); |
|
563 |
__ movptr(r13, Address(rsp, 2 * wordSize)); |
|
564 |
__ movptr(r12, Address(rsp, 3 * wordSize)); |
|
565 |
__ movptr(r11, Address(rsp, 4 * wordSize)); |
|
566 |
__ movptr(r10, Address(rsp, 5 * wordSize)); |
|
567 |
__ movptr(r9, Address(rsp, 6 * wordSize)); |
|
568 |
__ movptr(r8, Address(rsp, 7 * wordSize)); |
|
569 |
__ movptr(rdi, Address(rsp, 8 * wordSize)); |
|
570 |
__ movptr(rsi, Address(rsp, 9 * wordSize)); |
|
571 |
__ movptr(rbp, Address(rsp, 10 * wordSize)); |
|
572 |
// skip rsp |
|
573 |
__ movptr(rbx, Address(rsp, 12 * wordSize)); |
|
574 |
__ movptr(rdx, Address(rsp, 13 * wordSize)); |
|
575 |
__ movptr(rcx, Address(rsp, 14 * wordSize)); |
|
576 |
||
577 |
__ addptr(rsp, 16 * wordSize); |
|
578 |
#else |
|
579 |
||
580 |
__ pop(rdi); |
|
581 |
__ pop(rsi); |
|
582 |
__ pop(rbp); |
|
583 |
__ pop(rbx); // skip this value |
|
584 |
__ pop(rbx); |
|
585 |
__ pop(rdx); |
|
586 |
__ pop(rcx); |
|
587 |
__ addptr(rsp, BytesPerWord); |
|
588 |
#endif // _LP64 |
|
1 | 589 |
} |
590 |
||
50023 | 591 |
#undef __ |
592 |
#define __ sasm-> |
|
593 |
||
594 |
static OopMap* save_live_registers(StubAssembler* sasm, int num_rt_args, |
|
595 |
bool save_fpu_registers = true) { |
|
596 |
__ save_live_registers_no_oop_map(save_fpu_registers); |
|
597 |
return generate_oop_map(sasm, num_rt_args, save_fpu_registers); |
|
598 |
} |
|
599 |
||
600 |
static void restore_live_registers(StubAssembler* sasm, bool restore_fpu_registers = true) { |
|
601 |
__ restore_live_registers(restore_fpu_registers); |
|
602 |
} |
|
603 |
||
604 |
static void restore_live_registers_except_rax(StubAssembler* sasm, bool restore_fpu_registers = true) { |
|
605 |
sasm->restore_live_registers_except_rax(restore_fpu_registers); |
|
606 |
} |
|
607 |
||
1 | 608 |
|
609 |
void Runtime1::initialize_pd() { |
|
610 |
// nothing to do |
|
611 |
} |
|
612 |
||
613 |
||
50094
2f79462aab9b
8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents:
50023
diff
changeset
|
614 |
// Target: the entry point of the method that creates and posts the exception oop. |
2f79462aab9b
8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents:
50023
diff
changeset
|
615 |
// has_argument: true if the exception needs arguments (passed on the stack because |
2f79462aab9b
8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents:
50023
diff
changeset
|
616 |
// registers must be preserved). |
1 | 617 |
OopMapSet* Runtime1::generate_exception_throw(StubAssembler* sasm, address target, bool has_argument) { |
50094
2f79462aab9b
8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents:
50023
diff
changeset
|
618 |
// Preserve all registers. |
2f79462aab9b
8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents:
50023
diff
changeset
|
619 |
int num_rt_args = has_argument ? (2 + 1) : 1; |
1 | 620 |
OopMap* oop_map = save_live_registers(sasm, num_rt_args); |
621 |
||
50094
2f79462aab9b
8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents:
50023
diff
changeset
|
622 |
// Now all registers are saved and can be used freely. |
2f79462aab9b
8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents:
50023
diff
changeset
|
623 |
// Verify that no old value is used accidentally. |
1 | 624 |
__ invalidate_registers(true, true, true, true, true, true); |
625 |
||
50094
2f79462aab9b
8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents:
50023
diff
changeset
|
626 |
// Registers used by this stub. |
1 | 627 |
const Register temp_reg = rbx; |
628 |
||
50094
2f79462aab9b
8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents:
50023
diff
changeset
|
629 |
// Load arguments for exception that are passed as arguments into the stub. |
1 | 630 |
if (has_argument) { |
1066 | 631 |
#ifdef _LP64 |
632 |
__ movptr(c_rarg1, Address(rbp, 2*BytesPerWord)); |
|
50094
2f79462aab9b
8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents:
50023
diff
changeset
|
633 |
__ movptr(c_rarg2, Address(rbp, 3*BytesPerWord)); |
1066 | 634 |
#else |
50094
2f79462aab9b
8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents:
50023
diff
changeset
|
635 |
__ movptr(temp_reg, Address(rbp, 3*BytesPerWord)); |
2f79462aab9b
8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents:
50023
diff
changeset
|
636 |
__ push(temp_reg); |
1066 | 637 |
__ movptr(temp_reg, Address(rbp, 2*BytesPerWord)); |
638 |
__ push(temp_reg); |
|
639 |
#endif // _LP64 |
|
1 | 640 |
} |
641 |
int call_offset = __ call_RT(noreg, noreg, target, num_rt_args - 1); |
|
642 |
||
643 |
OopMapSet* oop_maps = new OopMapSet(); |
|
644 |
oop_maps->add_gc_map(call_offset, oop_map); |
|
645 |
||
646 |
__ stop("should not reach here"); |
|
647 |
||
648 |
return oop_maps; |
|
649 |
} |
|
650 |
||
651 |
||
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
652 |
OopMapSet* Runtime1::generate_handle_exception(StubID id, StubAssembler *sasm) { |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
653 |
__ block_comment("generate_handle_exception"); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
654 |
|
1 | 655 |
// incoming parameters |
656 |
const Register exception_oop = rax; |
|
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
657 |
const Register exception_pc = rdx; |
1 | 658 |
// other registers used in this stub |
1066 | 659 |
const Register thread = NOT_LP64(rdi) LP64_ONLY(r15_thread); |
1 | 660 |
|
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
661 |
// Save registers, if required. |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
662 |
OopMapSet* oop_maps = new OopMapSet(); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
663 |
OopMap* oop_map = NULL; |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
664 |
switch (id) { |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
665 |
case forward_exception_id: |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
666 |
// We're handling an exception in the context of a compiled frame. |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
667 |
// The registers have been saved in the standard places. Perform |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
668 |
// an exception lookup in the caller and dispatch to the handler |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
669 |
// if found. Otherwise unwind and dispatch to the callers |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
670 |
// exception handler. |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
671 |
oop_map = generate_oop_map(sasm, 1 /*thread*/); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
672 |
|
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
673 |
// load and clear pending exception oop into RAX |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
674 |
__ movptr(exception_oop, Address(thread, Thread::pending_exception_offset())); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
675 |
__ movptr(Address(thread, Thread::pending_exception_offset()), NULL_WORD); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
676 |
|
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
677 |
// load issuing PC (the return address for this stub) into rdx |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
678 |
__ movptr(exception_pc, Address(rbp, 1*BytesPerWord)); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
679 |
|
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
680 |
// make sure that the vm_results are cleared (may be unnecessary) |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
681 |
__ movptr(Address(thread, JavaThread::vm_result_offset()), NULL_WORD); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
682 |
__ movptr(Address(thread, JavaThread::vm_result_2_offset()), NULL_WORD); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
683 |
break; |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
684 |
case handle_exception_nofpu_id: |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
685 |
case handle_exception_id: |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
686 |
// At this point all registers MAY be live. |
28045
dc52d4bb1316
8066900: Array Out Of Bounds Exception causes variable corruption
iveresov
parents:
27471
diff
changeset
|
687 |
oop_map = save_live_registers(sasm, 1 /*thread*/, id != handle_exception_nofpu_id); |
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
688 |
break; |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
689 |
case handle_exception_from_callee_id: { |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
690 |
// At this point all registers except exception oop (RAX) and |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
691 |
// exception pc (RDX) are dead. |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
692 |
const int frame_size = 2 /*BP, return address*/ NOT_LP64(+ 1 /*thread*/) WIN64_ONLY(+ frame::arg_reg_save_area_bytes / BytesPerWord); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
693 |
oop_map = new OopMap(frame_size * VMRegImpl::slots_per_word, 0); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
694 |
sasm->set_frame_size(frame_size); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
695 |
WIN64_ONLY(__ subq(rsp, frame::arg_reg_save_area_bytes)); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
696 |
break; |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
697 |
} |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
698 |
default: ShouldNotReachHere(); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
699 |
} |
1 | 700 |
|
701 |
#ifdef TIERED |
|
702 |
// C2 can leave the fpu stack dirty |
|
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
703 |
if (UseSSE < 2) { |
1 | 704 |
__ empty_FPU_stack(); |
705 |
} |
|
706 |
#endif // TIERED |
|
707 |
||
708 |
// verify that only rax, and rdx is valid at this time |
|
709 |
__ invalidate_registers(false, true, true, false, true, true); |
|
710 |
// verify that rax, contains a valid exception |
|
711 |
__ verify_not_null_oop(exception_oop); |
|
712 |
||
713 |
// load address of JavaThread object for thread-local data |
|
1066 | 714 |
NOT_LP64(__ get_thread(thread);) |
1 | 715 |
|
716 |
#ifdef ASSERT |
|
717 |
// check that fields in JavaThread for exception oop and issuing pc are |
|
718 |
// empty before writing to them |
|
719 |
Label oop_empty; |
|
1066 | 720 |
__ cmpptr(Address(thread, JavaThread::exception_oop_offset()), (int32_t) NULL_WORD); |
1 | 721 |
__ jcc(Assembler::equal, oop_empty); |
722 |
__ stop("exception oop already set"); |
|
723 |
__ bind(oop_empty); |
|
724 |
||
725 |
Label pc_empty; |
|
1066 | 726 |
__ cmpptr(Address(thread, JavaThread::exception_pc_offset()), 0); |
1 | 727 |
__ jcc(Assembler::equal, pc_empty); |
728 |
__ stop("exception pc already set"); |
|
729 |
__ bind(pc_empty); |
|
730 |
#endif |
|
731 |
||
732 |
// save exception oop and issuing pc into JavaThread |
|
733 |
// (exception handler will load it from here) |
|
1066 | 734 |
__ movptr(Address(thread, JavaThread::exception_oop_offset()), exception_oop); |
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
735 |
__ movptr(Address(thread, JavaThread::exception_pc_offset()), exception_pc); |
1 | 736 |
|
737 |
// patch throwing pc into return address (has bci & oop map) |
|
1066 | 738 |
__ movptr(Address(rbp, 1*BytesPerWord), exception_pc); |
1 | 739 |
|
740 |
// compute the exception handler. |
|
741 |
// the exception oop and the throwing pc are read from the fields in JavaThread |
|
742 |
int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, exception_handler_for_pc)); |
|
743 |
oop_maps->add_gc_map(call_offset, oop_map); |
|
744 |
||
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
745 |
// rax: handler address |
1 | 746 |
// will be the deopt blob if nmethod was deoptimized while we looked up |
747 |
// handler regardless of whether handler existed in the nmethod. |
|
748 |
||
749 |
// only rax, is valid at this time, all other registers have been destroyed by the runtime call |
|
750 |
__ invalidate_registers(false, true, true, true, true, true); |
|
751 |
||
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
752 |
// patch the return address, this stub will directly return to the exception handler |
1066 | 753 |
__ movptr(Address(rbp, 1*BytesPerWord), rax); |
1 | 754 |
|
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
755 |
switch (id) { |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
756 |
case forward_exception_id: |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
757 |
case handle_exception_nofpu_id: |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
758 |
case handle_exception_id: |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
759 |
// Restore the registers that were saved at the beginning. |
28045
dc52d4bb1316
8066900: Array Out Of Bounds Exception causes variable corruption
iveresov
parents:
27471
diff
changeset
|
760 |
restore_live_registers(sasm, id != handle_exception_nofpu_id); |
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
761 |
break; |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
762 |
case handle_exception_from_callee_id: |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
763 |
// WIN64_ONLY: No need to add frame::arg_reg_save_area_bytes to SP |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
764 |
// since we do a leave anyway. |
1 | 765 |
|
30305
b92a97e1e9cb
8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
zmajo
parents:
29325
diff
changeset
|
766 |
// Pop the return address. |
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
767 |
__ leave(); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
768 |
__ pop(rcx); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
769 |
__ jmp(rcx); // jump to exception handler |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
770 |
break; |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
771 |
default: ShouldNotReachHere(); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
772 |
} |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
773 |
|
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
774 |
return oop_maps; |
1 | 775 |
} |
776 |
||
777 |
||
778 |
void Runtime1::generate_unwind_exception(StubAssembler *sasm) { |
|
779 |
// incoming parameters |
|
780 |
const Register exception_oop = rax; |
|
5046 | 781 |
// callee-saved copy of exception_oop during runtime call |
782 |
const Register exception_oop_callee_saved = NOT_LP64(rsi) LP64_ONLY(r14); |
|
1 | 783 |
// other registers used in this stub |
784 |
const Register exception_pc = rdx; |
|
785 |
const Register handler_addr = rbx; |
|
1066 | 786 |
const Register thread = NOT_LP64(rdi) LP64_ONLY(r15_thread); |
1 | 787 |
|
788 |
// verify that only rax, is valid at this time |
|
789 |
__ invalidate_registers(false, true, true, true, true, true); |
|
790 |
||
791 |
#ifdef ASSERT |
|
792 |
// check that fields in JavaThread for exception oop and issuing pc are empty |
|
1066 | 793 |
NOT_LP64(__ get_thread(thread);) |
1 | 794 |
Label oop_empty; |
1066 | 795 |
__ cmpptr(Address(thread, JavaThread::exception_oop_offset()), 0); |
1 | 796 |
__ jcc(Assembler::equal, oop_empty); |
797 |
__ stop("exception oop must be empty"); |
|
798 |
__ bind(oop_empty); |
|
799 |
||
800 |
Label pc_empty; |
|
1066 | 801 |
__ cmpptr(Address(thread, JavaThread::exception_pc_offset()), 0); |
1 | 802 |
__ jcc(Assembler::equal, pc_empty); |
803 |
__ stop("exception pc must be empty"); |
|
804 |
__ bind(pc_empty); |
|
805 |
#endif |
|
806 |
||
807 |
// clear the FPU stack in case any FPU results are left behind |
|
808 |
__ empty_FPU_stack(); |
|
809 |
||
5046 | 810 |
// save exception_oop in callee-saved register to preserve it during runtime calls |
811 |
__ verify_not_null_oop(exception_oop); |
|
812 |
__ movptr(exception_oop_callee_saved, exception_oop); |
|
813 |
||
814 |
NOT_LP64(__ get_thread(thread);) |
|
815 |
// Get return address (is on top of stack after leave). |
|
1066 | 816 |
__ movptr(exception_pc, Address(rsp, 0)); |
1 | 817 |
|
5046 | 818 |
// search the exception handler address of the caller (using the return address) |
819 |
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), thread, exception_pc); |
|
820 |
// rax: exception handler address of the caller |
|
1 | 821 |
|
5046 | 822 |
// Only RAX and RSI are valid at this time, all other registers have been destroyed by the call. |
823 |
__ invalidate_registers(false, true, true, true, false, true); |
|
1 | 824 |
|
825 |
// move result of call into correct register |
|
1066 | 826 |
__ movptr(handler_addr, rax); |
1 | 827 |
|
5046 | 828 |
// Restore exception oop to RAX (required convention of exception handler). |
829 |
__ movptr(exception_oop, exception_oop_callee_saved); |
|
1 | 830 |
|
5046 | 831 |
// verify that there is really a valid exception in rax |
832 |
__ verify_not_null_oop(exception_oop); |
|
1 | 833 |
|
834 |
// get throwing pc (= return address). |
|
835 |
// rdx has been destroyed by the call, so it must be set again |
|
836 |
// the pop is also necessary to simulate the effect of a ret(0) |
|
1066 | 837 |
__ pop(exception_pc); |
1 | 838 |
|
839 |
// continue at exception handler (return address removed) |
|
840 |
// note: do *not* remove arguments when unwinding the |
|
841 |
// activation since the caller assumes having |
|
842 |
// all arguments on the stack when entering the |
|
843 |
// runtime to determine the exception handler |
|
844 |
// (GC happens at call site with arguments!) |
|
5046 | 845 |
// rax: exception oop |
1 | 846 |
// rdx: throwing pc |
5046 | 847 |
// rbx: exception handler |
1 | 848 |
__ jmp(handler_addr); |
849 |
} |
|
850 |
||
851 |
||
852 |
OopMapSet* Runtime1::generate_patching(StubAssembler* sasm, address target) { |
|
853 |
// use the maximum number of runtime-arguments here because it is difficult to |
|
854 |
// distinguish each RT-Call. |
|
855 |
// Note: This number affects also the RT-Call in generate_handle_exception because |
|
856 |
// the oop-map is shared for all calls. |
|
857 |
const int num_rt_args = 2; // thread + dummy |
|
858 |
||
859 |
DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob(); |
|
860 |
assert(deopt_blob != NULL, "deoptimization blob must have been created"); |
|
861 |
||
862 |
OopMap* oop_map = save_live_registers(sasm, num_rt_args); |
|
863 |
||
1066 | 864 |
#ifdef _LP64 |
865 |
const Register thread = r15_thread; |
|
866 |
// No need to worry about dummy |
|
867 |
__ mov(c_rarg0, thread); |
|
868 |
#else |
|
869 |
__ push(rax); // push dummy |
|
1 | 870 |
|
871 |
const Register thread = rdi; // is callee-saved register (Visual C++ calling conventions) |
|
872 |
// push java thread (becomes first argument of C function) |
|
873 |
__ get_thread(thread); |
|
1066 | 874 |
__ push(thread); |
875 |
#endif // _LP64 |
|
1 | 876 |
__ set_last_Java_frame(thread, noreg, rbp, NULL); |
877 |
// do the call |
|
878 |
__ call(RuntimeAddress(target)); |
|
879 |
OopMapSet* oop_maps = new OopMapSet(); |
|
880 |
oop_maps->add_gc_map(__ offset(), oop_map); |
|
881 |
// verify callee-saved register |
|
882 |
#ifdef ASSERT |
|
883 |
guarantee(thread != rax, "change this code"); |
|
1066 | 884 |
__ push(rax); |
1 | 885 |
{ Label L; |
886 |
__ get_thread(rax); |
|
1066 | 887 |
__ cmpptr(thread, rax); |
1 | 888 |
__ jcc(Assembler::equal, L); |
1066 | 889 |
__ stop("StubAssembler::call_RT: rdi/r15 not callee saved?"); |
1 | 890 |
__ bind(L); |
891 |
} |
|
1066 | 892 |
__ pop(rax); |
1 | 893 |
#endif |
40644
39e631ed7145
8161598: Kitchensink fails: assert(nm->insts_contains(original_pc)) failed: original PC must be in nmethod/CompiledMethod
dlong
parents:
36832
diff
changeset
|
894 |
__ reset_last_Java_frame(thread, true); |
1066 | 895 |
#ifndef _LP64 |
896 |
__ pop(rcx); // discard thread arg |
|
897 |
__ pop(rcx); // discard dummy |
|
898 |
#endif // _LP64 |
|
1 | 899 |
|
900 |
// check for pending exceptions |
|
901 |
{ Label L; |
|
1066 | 902 |
__ cmpptr(Address(thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD); |
1 | 903 |
__ jcc(Assembler::equal, L); |
904 |
// exception pending => remove activation and forward to exception handler |
|
905 |
||
1066 | 906 |
__ testptr(rax, rax); // have we deoptimized? |
1 | 907 |
__ jump_cc(Assembler::equal, |
908 |
RuntimeAddress(Runtime1::entry_for(Runtime1::forward_exception_id))); |
|
909 |
||
910 |
// the deopt blob expects exceptions in the special fields of |
|
911 |
// JavaThread, so copy and clear pending exception. |
|
912 |
||
913 |
// load and clear pending exception |
|
1066 | 914 |
__ movptr(rax, Address(thread, Thread::pending_exception_offset())); |
1888
bbf498fb4354
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents:
1412
diff
changeset
|
915 |
__ movptr(Address(thread, Thread::pending_exception_offset()), NULL_WORD); |
1 | 916 |
|
917 |
// check that there is really a valid exception |
|
918 |
__ verify_not_null_oop(rax); |
|
919 |
||
920 |
// load throwing pc: this is the return address of the stub |
|
1066 | 921 |
__ movptr(rdx, Address(rsp, return_off * VMRegImpl::stack_slot_size)); |
1 | 922 |
|
923 |
#ifdef ASSERT |
|
924 |
// check that fields in JavaThread for exception oop and issuing pc are empty |
|
925 |
Label oop_empty; |
|
1066 | 926 |
__ cmpptr(Address(thread, JavaThread::exception_oop_offset()), (int32_t)NULL_WORD); |
1 | 927 |
__ jcc(Assembler::equal, oop_empty); |
928 |
__ stop("exception oop must be empty"); |
|
929 |
__ bind(oop_empty); |
|
930 |
||
931 |
Label pc_empty; |
|
1066 | 932 |
__ cmpptr(Address(thread, JavaThread::exception_pc_offset()), (int32_t)NULL_WORD); |
1 | 933 |
__ jcc(Assembler::equal, pc_empty); |
934 |
__ stop("exception pc must be empty"); |
|
935 |
__ bind(pc_empty); |
|
936 |
#endif |
|
937 |
||
938 |
// store exception oop and throwing pc to JavaThread |
|
1066 | 939 |
__ movptr(Address(thread, JavaThread::exception_oop_offset()), rax); |
940 |
__ movptr(Address(thread, JavaThread::exception_pc_offset()), rdx); |
|
1 | 941 |
|
942 |
restore_live_registers(sasm); |
|
943 |
||
944 |
__ leave(); |
|
1066 | 945 |
__ addptr(rsp, BytesPerWord); // remove return address from stack |
1 | 946 |
|
947 |
// Forward the exception directly to deopt blob. We can blow no |
|
948 |
// registers and must leave throwing pc on the stack. A patch may |
|
949 |
// have values live in registers so the entry point with the |
|
950 |
// exception in tls. |
|
951 |
__ jump(RuntimeAddress(deopt_blob->unpack_with_exception_in_tls())); |
|
952 |
||
953 |
__ bind(L); |
|
954 |
} |
|
955 |
||
956 |
||
957 |
// Runtime will return true if the nmethod has been deoptimized during |
|
958 |
// the patching process. In that case we must do a deopt reexecute instead. |
|
959 |
||
960 |
Label reexecuteEntry, cont; |
|
961 |
||
1066 | 962 |
__ testptr(rax, rax); // have we deoptimized? |
1 | 963 |
__ jcc(Assembler::equal, cont); // no |
964 |
||
965 |
// Will reexecute. Proper return address is already on the stack we just restore |
|
966 |
// registers, pop all of our frame but the return address and jump to the deopt blob |
|
967 |
restore_live_registers(sasm); |
|
968 |
__ leave(); |
|
969 |
__ jump(RuntimeAddress(deopt_blob->unpack_with_reexecution())); |
|
970 |
||
971 |
__ bind(cont); |
|
972 |
restore_live_registers(sasm); |
|
973 |
__ leave(); |
|
974 |
__ ret(0); |
|
975 |
||
976 |
return oop_maps; |
|
977 |
} |
|
978 |
||
979 |
||
980 |
OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) { |
|
981 |
||
982 |
// for better readability |
|
983 |
const bool must_gc_arguments = true; |
|
984 |
const bool dont_gc_arguments = false; |
|
985 |
||
986 |
// default value; overwritten for some optimized stubs that are called from methods that do not use the fpu |
|
987 |
bool save_fpu_registers = true; |
|
988 |
||
989 |
// stub code & info for the different stubs |
|
990 |
OopMapSet* oop_maps = NULL; |
|
991 |
switch (id) { |
|
992 |
case forward_exception_id: |
|
993 |
{ |
|
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
994 |
oop_maps = generate_handle_exception(id, sasm); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
995 |
__ leave(); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
996 |
__ ret(0); |
1 | 997 |
} |
998 |
break; |
|
999 |
||
1000 |
case new_instance_id: |
|
1001 |
case fast_new_instance_id: |
|
1002 |
case fast_new_instance_init_check_id: |
|
1003 |
{ |
|
1004 |
Register klass = rdx; // Incoming |
|
1005 |
Register obj = rax; // Result |
|
1006 |
||
1007 |
if (id == new_instance_id) { |
|
1008 |
__ set_info("new_instance", dont_gc_arguments); |
|
1009 |
} else if (id == fast_new_instance_id) { |
|
1010 |
__ set_info("fast new_instance", dont_gc_arguments); |
|
1011 |
} else { |
|
1012 |
assert(id == fast_new_instance_init_check_id, "bad StubID"); |
|
1013 |
__ set_info("fast new_instance init check", dont_gc_arguments); |
|
1014 |
} |
|
1015 |
||
49010
9010e596f391
8194084: Obsolete FastTLABRefill and remove the related code
jcbeyler
parents:
47216
diff
changeset
|
1016 |
if ((id == fast_new_instance_id || id == fast_new_instance_init_check_id) && UseTLAB |
9010e596f391
8194084: Obsolete FastTLABRefill and remove the related code
jcbeyler
parents:
47216
diff
changeset
|
1017 |
&& Universe::heap()->supports_inline_contig_alloc()) { |
1 | 1018 |
Label slow_path; |
1019 |
Register obj_size = rcx; |
|
1020 |
Register t1 = rbx; |
|
1021 |
Register t2 = rsi; |
|
1022 |
assert_different_registers(klass, obj, obj_size, t1, t2); |
|
1023 |
||
1066 | 1024 |
__ push(rdi); |
1025 |
__ push(rbx); |
|
1 | 1026 |
|
1027 |
if (id == fast_new_instance_init_check_id) { |
|
1028 |
// make sure the klass is initialized |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11962
diff
changeset
|
1029 |
__ cmpb(Address(klass, InstanceKlass::init_state_offset()), InstanceKlass::fully_initialized); |
1 | 1030 |
__ jcc(Assembler::notEqual, slow_path); |
1031 |
} |
|
1032 |
||
1033 |
#ifdef ASSERT |
|
1034 |
// assert object can be fast path allocated |
|
1035 |
{ |
|
1036 |
Label ok, not_ok; |
|
11430
718fc06da49a
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
10972
diff
changeset
|
1037 |
__ movl(obj_size, Address(klass, Klass::layout_helper_offset())); |
1 | 1038 |
__ cmpl(obj_size, 0); // make sure it's an instance (LH > 0) |
1039 |
__ jcc(Assembler::lessEqual, not_ok); |
|
1040 |
__ testl(obj_size, Klass::_lh_instance_slow_path_bit); |
|
1041 |
__ jcc(Assembler::zero, ok); |
|
1042 |
__ bind(not_ok); |
|
1043 |
__ stop("assert(can be fast path allocated)"); |
|
1044 |
__ should_not_reach_here(); |
|
1045 |
__ bind(ok); |
|
1046 |
} |
|
1047 |
#endif // ASSERT |
|
1048 |
||
1049 |
// if we got here then the TLAB allocation failed, so try |
|
1050 |
// refilling the TLAB or allocating directly from eden. |
|
1051 |
Label retry_tlab, try_eden; |
|
49010
9010e596f391
8194084: Obsolete FastTLABRefill and remove the related code
jcbeyler
parents:
47216
diff
changeset
|
1052 |
const Register thread = NOT_LP64(rdi) LP64_ONLY(r15_thread); |
49018
f7caa2aecc86
8198341: Build failures after 8194084 (Obsolete FastTLABRefill and remove the related code)
shade
parents:
49010
diff
changeset
|
1053 |
NOT_LP64(__ get_thread(thread)); |
1 | 1054 |
|
1055 |
__ bind(try_eden); |
|
1066 | 1056 |
// get the instance size (size is postive so movl is fine for 64bit) |
11430
718fc06da49a
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
10972
diff
changeset
|
1057 |
__ movl(obj_size, Address(klass, Klass::layout_helper_offset())); |
7724
a92d706dbdd5
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
7427
diff
changeset
|
1058 |
|
50693 | 1059 |
__ eden_allocate(thread, obj, obj_size, 0, t1, slow_path); |
7724
a92d706dbdd5
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
7427
diff
changeset
|
1060 |
|
35548
8d3afe96ffea
8086053: Address inconsistencies regarding ZeroTLAB
zmajo
parents:
34148
diff
changeset
|
1061 |
__ initialize_object(obj, klass, obj_size, 0, t1, t2, /* is_tlab_allocated */ false); |
1 | 1062 |
__ verify_oop(obj); |
1066 | 1063 |
__ pop(rbx); |
1064 |
__ pop(rdi); |
|
1 | 1065 |
__ ret(0); |
1066 |
||
1067 |
__ bind(slow_path); |
|
1066 | 1068 |
__ pop(rbx); |
1069 |
__ pop(rdi); |
|
1 | 1070 |
} |
1071 |
||
1072 |
__ enter(); |
|
1073 |
OopMap* map = save_live_registers(sasm, 2); |
|
1074 |
int call_offset = __ call_RT(obj, noreg, CAST_FROM_FN_PTR(address, new_instance), klass); |
|
1075 |
oop_maps = new OopMapSet(); |
|
1076 |
oop_maps->add_gc_map(call_offset, map); |
|
1077 |
restore_live_registers_except_rax(sasm); |
|
1078 |
__ verify_oop(obj); |
|
1079 |
__ leave(); |
|
1080 |
__ ret(0); |
|
1081 |
||
1082 |
// rax,: new instance |
|
1083 |
} |
|
1084 |
||
1085 |
break; |
|
1086 |
||
1087 |
case counter_overflow_id: |
|
1088 |
{ |
|
6453 | 1089 |
Register bci = rax, method = rbx; |
1 | 1090 |
__ enter(); |
6453 | 1091 |
OopMap* map = save_live_registers(sasm, 3); |
1 | 1092 |
// Retrieve bci |
1093 |
__ movl(bci, Address(rbp, 2*BytesPerWord)); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11962
diff
changeset
|
1094 |
// And a pointer to the Method* |
6453 | 1095 |
__ movptr(method, Address(rbp, 3*BytesPerWord)); |
1096 |
int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, counter_overflow), bci, method); |
|
1 | 1097 |
oop_maps = new OopMapSet(); |
1098 |
oop_maps->add_gc_map(call_offset, map); |
|
1099 |
restore_live_registers(sasm); |
|
1100 |
__ leave(); |
|
1101 |
__ ret(0); |
|
1102 |
} |
|
1103 |
break; |
|
1104 |
||
1105 |
case new_type_array_id: |
|
1106 |
case new_object_array_id: |
|
1107 |
{ |
|
1108 |
Register length = rbx; // Incoming |
|
1109 |
Register klass = rdx; // Incoming |
|
1110 |
Register obj = rax; // Result |
|
1111 |
||
1112 |
if (id == new_type_array_id) { |
|
1113 |
__ set_info("new_type_array", dont_gc_arguments); |
|
1114 |
} else { |
|
1115 |
__ set_info("new_object_array", dont_gc_arguments); |
|
1116 |
} |
|
1117 |
||
1118 |
#ifdef ASSERT |
|
1119 |
// assert object type is really an array of the proper kind |
|
1120 |
{ |
|
1121 |
Label ok; |
|
1122 |
Register t0 = obj; |
|
11430
718fc06da49a
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
10972
diff
changeset
|
1123 |
__ movl(t0, Address(klass, Klass::layout_helper_offset())); |
1 | 1124 |
__ sarl(t0, Klass::_lh_array_tag_shift); |
1125 |
int tag = ((id == new_type_array_id) |
|
1126 |
? Klass::_lh_array_tag_type_value |
|
1127 |
: Klass::_lh_array_tag_obj_value); |
|
1128 |
__ cmpl(t0, tag); |
|
1129 |
__ jcc(Assembler::equal, ok); |
|
1130 |
__ stop("assert(is an array klass)"); |
|
1131 |
__ should_not_reach_here(); |
|
1132 |
__ bind(ok); |
|
1133 |
} |
|
1134 |
#endif // ASSERT |
|
1135 |
||
49010
9010e596f391
8194084: Obsolete FastTLABRefill and remove the related code
jcbeyler
parents:
47216
diff
changeset
|
1136 |
// If we got here, the TLAB allocation failed, so try allocating from |
9010e596f391
8194084: Obsolete FastTLABRefill and remove the related code
jcbeyler
parents:
47216
diff
changeset
|
1137 |
// eden if inline contiguous allocations are supported. |
9010e596f391
8194084: Obsolete FastTLABRefill and remove the related code
jcbeyler
parents:
47216
diff
changeset
|
1138 |
if (UseTLAB && Universe::heap()->supports_inline_contig_alloc()) { |
1 | 1139 |
Register arr_size = rsi; |
1140 |
Register t1 = rcx; // must be rcx for use as shift count |
|
1141 |
Register t2 = rdi; |
|
1142 |
Label slow_path; |
|
1143 |
||
1144 |
// get the allocation size: round_up(hdr + length << (layout_helper & 0x1F)) |
|
7724
a92d706dbdd5
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
7427
diff
changeset
|
1145 |
// since size is positive movl does right thing on 64bit |
11430
718fc06da49a
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
10972
diff
changeset
|
1146 |
__ movl(t1, Address(klass, Klass::layout_helper_offset())); |
1066 | 1147 |
// since size is postive movl does right thing on 64bit |
1 | 1148 |
__ movl(arr_size, length); |
1149 |
assert(t1 == rcx, "fixed register usage"); |
|
1066 | 1150 |
__ shlptr(arr_size /* by t1=rcx, mod 32 */); |
1151 |
__ shrptr(t1, Klass::_lh_header_size_shift); |
|
1152 |
__ andptr(t1, Klass::_lh_header_size_mask); |
|
1153 |
__ addptr(arr_size, t1); |
|
1154 |
__ addptr(arr_size, MinObjAlignmentInBytesMask); // align up |
|
1155 |
__ andptr(arr_size, ~MinObjAlignmentInBytesMask); |
|
1 | 1156 |
|
49010
9010e596f391
8194084: Obsolete FastTLABRefill and remove the related code
jcbeyler
parents:
47216
diff
changeset
|
1157 |
// Using t2 for non 64-bit. |
9010e596f391
8194084: Obsolete FastTLABRefill and remove the related code
jcbeyler
parents:
47216
diff
changeset
|
1158 |
const Register thread = NOT_LP64(t2) LP64_ONLY(r15_thread); |
49018
f7caa2aecc86
8198341: Build failures after 8194084 (Obsolete FastTLABRefill and remove the related code)
shade
parents:
49010
diff
changeset
|
1159 |
NOT_LP64(__ get_thread(thread)); |
50693 | 1160 |
__ eden_allocate(thread, obj, arr_size, 0, t1, slow_path); // preserves arr_size |
1 | 1161 |
|
1162 |
__ initialize_header(obj, klass, length, t1, t2); |
|
11430
718fc06da49a
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
10972
diff
changeset
|
1163 |
__ movb(t1, Address(klass, in_bytes(Klass::layout_helper_offset()) + (Klass::_lh_header_size_shift / BitsPerByte))); |
1 | 1164 |
assert(Klass::_lh_header_size_shift % BitsPerByte == 0, "bytewise"); |
1165 |
assert(Klass::_lh_header_size_mask <= 0xFF, "bytewise"); |
|
1066 | 1166 |
__ andptr(t1, Klass::_lh_header_size_mask); |
1167 |
__ subptr(arr_size, t1); // body length |
|
1168 |
__ addptr(t1, obj); // body start |
|
1 | 1169 |
__ initialize_body(t1, arr_size, 0, t2); |
1170 |
__ verify_oop(obj); |
|
1171 |
__ ret(0); |
|
1172 |
||
1173 |
__ bind(slow_path); |
|
1174 |
} |
|
1175 |
||
1176 |
__ enter(); |
|
1177 |
OopMap* map = save_live_registers(sasm, 3); |
|
1178 |
int call_offset; |
|
1179 |
if (id == new_type_array_id) { |
|
1180 |
call_offset = __ call_RT(obj, noreg, CAST_FROM_FN_PTR(address, new_type_array), klass, length); |
|
1181 |
} else { |
|
1182 |
call_offset = __ call_RT(obj, noreg, CAST_FROM_FN_PTR(address, new_object_array), klass, length); |
|
1183 |
} |
|
1184 |
||
1185 |
oop_maps = new OopMapSet(); |
|
1186 |
oop_maps->add_gc_map(call_offset, map); |
|
1187 |
restore_live_registers_except_rax(sasm); |
|
1188 |
||
1189 |
__ verify_oop(obj); |
|
1190 |
__ leave(); |
|
1191 |
__ ret(0); |
|
1192 |
||
1193 |
// rax,: new array |
|
1194 |
} |
|
1195 |
break; |
|
1196 |
||
1197 |
case new_multi_array_id: |
|
1198 |
{ StubFrame f(sasm, "new_multi_array", dont_gc_arguments); |
|
1199 |
// rax,: klass |
|
1200 |
// rbx,: rank |
|
1201 |
// rcx: address of 1st dimension |
|
1202 |
OopMap* map = save_live_registers(sasm, 4); |
|
1203 |
int call_offset = __ call_RT(rax, noreg, CAST_FROM_FN_PTR(address, new_multi_array), rax, rbx, rcx); |
|
1204 |
||
1205 |
oop_maps = new OopMapSet(); |
|
1206 |
oop_maps->add_gc_map(call_offset, map); |
|
1207 |
restore_live_registers_except_rax(sasm); |
|
1208 |
||
1209 |
// rax,: new multi array |
|
1210 |
__ verify_oop(rax); |
|
1211 |
} |
|
1212 |
break; |
|
1213 |
||
1214 |
case register_finalizer_id: |
|
1215 |
{ |
|
1216 |
__ set_info("register_finalizer", dont_gc_arguments); |
|
1217 |
||
1066 | 1218 |
// This is called via call_runtime so the arguments |
1219 |
// will be place in C abi locations |
|
1220 |
||
1221 |
#ifdef _LP64 |
|
1222 |
__ verify_oop(c_rarg0); |
|
1223 |
__ mov(rax, c_rarg0); |
|
1224 |
#else |
|
1 | 1225 |
// The object is passed on the stack and we haven't pushed a |
1226 |
// frame yet so it's one work away from top of stack. |
|
1066 | 1227 |
__ movptr(rax, Address(rsp, 1 * BytesPerWord)); |
1 | 1228 |
__ verify_oop(rax); |
1066 | 1229 |
#endif // _LP64 |
1 | 1230 |
|
1231 |
// load the klass and check the has finalizer flag |
|
1232 |
Label register_finalizer; |
|
1233 |
Register t = rsi; |
|
7427 | 1234 |
__ load_klass(t, rax); |
11430
718fc06da49a
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
10972
diff
changeset
|
1235 |
__ movl(t, Address(t, Klass::access_flags_offset())); |
1 | 1236 |
__ testl(t, JVM_ACC_HAS_FINALIZER); |
1237 |
__ jcc(Assembler::notZero, register_finalizer); |
|
1238 |
__ ret(0); |
|
1239 |
||
1240 |
__ bind(register_finalizer); |
|
1241 |
__ enter(); |
|
1242 |
OopMap* oop_map = save_live_registers(sasm, 2 /*num_rt_args */); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11962
diff
changeset
|
1243 |
int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, SharedRuntime::register_finalizer), rax); |
1 | 1244 |
oop_maps = new OopMapSet(); |
1245 |
oop_maps->add_gc_map(call_offset, oop_map); |
|
1246 |
||
1247 |
// Now restore all the live registers |
|
1248 |
restore_live_registers(sasm); |
|
1249 |
||
1250 |
__ leave(); |
|
1251 |
__ ret(0); |
|
1252 |
} |
|
1253 |
break; |
|
1254 |
||
1255 |
case throw_range_check_failed_id: |
|
1256 |
{ StubFrame f(sasm, "range_check_failed", dont_gc_arguments); |
|
1257 |
oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_range_check_exception), true); |
|
1258 |
} |
|
1259 |
break; |
|
1260 |
||
1261 |
case throw_index_exception_id: |
|
1262 |
{ StubFrame f(sasm, "index_range_check_failed", dont_gc_arguments); |
|
1263 |
oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_index_exception), true); |
|
1264 |
} |
|
1265 |
break; |
|
1266 |
||
1267 |
case throw_div0_exception_id: |
|
1268 |
{ StubFrame f(sasm, "throw_div0_exception", dont_gc_arguments); |
|
1269 |
oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_div0_exception), false); |
|
1270 |
} |
|
1271 |
break; |
|
1272 |
||
1273 |
case throw_null_pointer_exception_id: |
|
1274 |
{ StubFrame f(sasm, "throw_null_pointer_exception", dont_gc_arguments); |
|
1275 |
oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_null_pointer_exception), false); |
|
1276 |
} |
|
1277 |
break; |
|
1278 |
||
1279 |
case handle_exception_nofpu_id: |
|
1280 |
case handle_exception_id: |
|
1281 |
{ StubFrame f(sasm, "handle_exception", dont_gc_arguments); |
|
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
1282 |
oop_maps = generate_handle_exception(id, sasm); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
1283 |
} |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
1284 |
break; |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
1285 |
|
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
1286 |
case handle_exception_from_callee_id: |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
1287 |
{ StubFrame f(sasm, "handle_exception_from_callee", dont_gc_arguments); |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
1288 |
oop_maps = generate_handle_exception(id, sasm); |
1 | 1289 |
} |
1290 |
break; |
|
1291 |
||
1292 |
case unwind_exception_id: |
|
1293 |
{ __ set_info("unwind_exception", dont_gc_arguments); |
|
1294 |
// note: no stubframe since we are about to leave the current |
|
1295 |
// activation and we are calling a leaf VM function only. |
|
1296 |
generate_unwind_exception(sasm); |
|
1297 |
} |
|
1298 |
break; |
|
1299 |
||
1300 |
case throw_array_store_exception_id: |
|
1301 |
{ StubFrame f(sasm, "throw_array_store_exception", dont_gc_arguments); |
|
1302 |
// tos + 0: link |
|
1303 |
// + 1: return address |
|
8067
f5f4eac4c48f
7008809: should report the class in ArrayStoreExceptions from compiled code
never
parents:
7724
diff
changeset
|
1304 |
oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_array_store_exception), true); |
1 | 1305 |
} |
1306 |
break; |
|
1307 |
||
1308 |
case throw_class_cast_exception_id: |
|
1309 |
{ StubFrame f(sasm, "throw_class_cast_exception", dont_gc_arguments); |
|
1310 |
oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_class_cast_exception), true); |
|
1311 |
} |
|
1312 |
break; |
|
1313 |
||
1314 |
case throw_incompatible_class_change_error_id: |
|
1315 |
{ StubFrame f(sasm, "throw_incompatible_class_cast_exception", dont_gc_arguments); |
|
1316 |
oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_incompatible_class_change_error), false); |
|
1317 |
} |
|
1318 |
break; |
|
1319 |
||
1320 |
case slow_subtype_check_id: |
|
1321 |
{ |
|
2256
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
1909
diff
changeset
|
1322 |
// Typical calling sequence: |
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
1909
diff
changeset
|
1323 |
// __ push(klass_RInfo); // object klass or other subclass |
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
1909
diff
changeset
|
1324 |
// __ push(sup_k_RInfo); // array element klass or other superclass |
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
1909
diff
changeset
|
1325 |
// __ call(slow_subtype_check); |
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
1909
diff
changeset
|
1326 |
// Note that the subclass is pushed first, and is therefore deepest. |
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
1909
diff
changeset
|
1327 |
// Previous versions of this code reversed the names 'sub' and 'super'. |
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
1909
diff
changeset
|
1328 |
// This was operationally harmless but made the code unreadable. |
1 | 1329 |
enum layout { |
1066 | 1330 |
rax_off, SLOT2(raxH_off) |
1331 |
rcx_off, SLOT2(rcxH_off) |
|
1332 |
rsi_off, SLOT2(rsiH_off) |
|
1333 |
rdi_off, SLOT2(rdiH_off) |
|
1334 |
// saved_rbp_off, SLOT2(saved_rbpH_off) |
|
1335 |
return_off, SLOT2(returnH_off) |
|
2256
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
1909
diff
changeset
|
1336 |
sup_k_off, SLOT2(sup_kH_off) |
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
1909
diff
changeset
|
1337 |
klass_off, SLOT2(superH_off) |
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
1909
diff
changeset
|
1338 |
framesize, |
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
1909
diff
changeset
|
1339 |
result_off = klass_off // deepest argument is also the return value |
1 | 1340 |
}; |
1341 |
||
1342 |
__ set_info("slow_subtype_check", dont_gc_arguments); |
|
1066 | 1343 |
__ push(rdi); |
1344 |
__ push(rsi); |
|
1345 |
__ push(rcx); |
|
1346 |
__ push(rax); |
|
1 | 1347 |
|
1066 | 1348 |
// This is called by pushing args and not with C abi |
2256
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
1909
diff
changeset
|
1349 |
__ movptr(rsi, Address(rsp, (klass_off) * VMRegImpl::stack_slot_size)); // subclass |
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
1909
diff
changeset
|
1350 |
__ movptr(rax, Address(rsp, (sup_k_off) * VMRegImpl::stack_slot_size)); // superclass |
1 | 1351 |
|
1352 |
Label miss; |
|
2256
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
1909
diff
changeset
|
1353 |
__ check_klass_subtype_slow_path(rsi, rax, rcx, rdi, NULL, &miss); |
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
1909
diff
changeset
|
1354 |
|
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
1909
diff
changeset
|
1355 |
// fallthrough on success: |
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
1909
diff
changeset
|
1356 |
__ movptr(Address(rsp, (result_off) * VMRegImpl::stack_slot_size), 1); // result |
1066 | 1357 |
__ pop(rax); |
1358 |
__ pop(rcx); |
|
1359 |
__ pop(rsi); |
|
1360 |
__ pop(rdi); |
|
1 | 1361 |
__ ret(0); |
1362 |
||
1363 |
__ bind(miss); |
|
2256
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
1909
diff
changeset
|
1364 |
__ movptr(Address(rsp, (result_off) * VMRegImpl::stack_slot_size), NULL_WORD); // result |
1066 | 1365 |
__ pop(rax); |
1366 |
__ pop(rcx); |
|
1367 |
__ pop(rsi); |
|
1368 |
__ pop(rdi); |
|
1 | 1369 |
__ ret(0); |
1370 |
} |
|
1371 |
break; |
|
1372 |
||
1373 |
case monitorenter_nofpu_id: |
|
1374 |
save_fpu_registers = false; |
|
1375 |
// fall through |
|
1376 |
case monitorenter_id: |
|
1377 |
{ |
|
1378 |
StubFrame f(sasm, "monitorenter", dont_gc_arguments); |
|
1379 |
OopMap* map = save_live_registers(sasm, 3, save_fpu_registers); |
|
1380 |
||
1066 | 1381 |
// Called with store_parameter and not C abi |
1382 |
||
1 | 1383 |
f.load_argument(1, rax); // rax,: object |
1384 |
f.load_argument(0, rbx); // rbx,: lock address |
|
1385 |
||
1386 |
int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, monitorenter), rax, rbx); |
|
1387 |
||
1388 |
oop_maps = new OopMapSet(); |
|
1389 |
oop_maps->add_gc_map(call_offset, map); |
|
1390 |
restore_live_registers(sasm, save_fpu_registers); |
|
1391 |
} |
|
1392 |
break; |
|
1393 |
||
1394 |
case monitorexit_nofpu_id: |
|
1395 |
save_fpu_registers = false; |
|
1396 |
// fall through |
|
1397 |
case monitorexit_id: |
|
1398 |
{ |
|
1399 |
StubFrame f(sasm, "monitorexit", dont_gc_arguments); |
|
1400 |
OopMap* map = save_live_registers(sasm, 2, save_fpu_registers); |
|
1401 |
||
1066 | 1402 |
// Called with store_parameter and not C abi |
1403 |
||
1 | 1404 |
f.load_argument(0, rax); // rax,: lock address |
1405 |
||
1406 |
// note: really a leaf routine but must setup last java sp |
|
1407 |
// => use call_RT for now (speed can be improved by |
|
1408 |
// doing last java sp setup manually) |
|
1409 |
int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, monitorexit), rax); |
|
1410 |
||
1411 |
oop_maps = new OopMapSet(); |
|
1412 |
oop_maps->add_gc_map(call_offset, map); |
|
1413 |
restore_live_registers(sasm, save_fpu_registers); |
|
10972
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10508
diff
changeset
|
1414 |
} |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10508
diff
changeset
|
1415 |
break; |
1 | 1416 |
|
10972
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10508
diff
changeset
|
1417 |
case deoptimize_id: |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10508
diff
changeset
|
1418 |
{ |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10508
diff
changeset
|
1419 |
StubFrame f(sasm, "deoptimize", dont_gc_arguments); |
24442
4d4ae31dea26
8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents:
22234
diff
changeset
|
1420 |
const int num_rt_args = 2; // thread, trap_request |
10972
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10508
diff
changeset
|
1421 |
OopMap* oop_map = save_live_registers(sasm, num_rt_args); |
24442
4d4ae31dea26
8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents:
22234
diff
changeset
|
1422 |
f.load_argument(0, rax); |
4d4ae31dea26
8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents:
22234
diff
changeset
|
1423 |
int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize), rax); |
10972
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10508
diff
changeset
|
1424 |
oop_maps = new OopMapSet(); |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10508
diff
changeset
|
1425 |
oop_maps->add_gc_map(call_offset, oop_map); |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10508
diff
changeset
|
1426 |
restore_live_registers(sasm); |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10508
diff
changeset
|
1427 |
DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob(); |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10508
diff
changeset
|
1428 |
assert(deopt_blob != NULL, "deoptimization blob must have been created"); |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10508
diff
changeset
|
1429 |
__ leave(); |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10508
diff
changeset
|
1430 |
__ jump(RuntimeAddress(deopt_blob->unpack_with_reexecution())); |
1 | 1431 |
} |
1432 |
break; |
|
1433 |
||
1434 |
case access_field_patching_id: |
|
1435 |
{ StubFrame f(sasm, "access_field_patching", dont_gc_arguments); |
|
1436 |
// we should set up register map |
|
1437 |
oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, access_field_patching)); |
|
1438 |
} |
|
1439 |
break; |
|
1440 |
||
1441 |
case load_klass_patching_id: |
|
1442 |
{ StubFrame f(sasm, "load_klass_patching", dont_gc_arguments); |
|
1443 |
// we should set up register map |
|
1444 |
oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, move_klass_patching)); |
|
1445 |
} |
|
1446 |
break; |
|
1447 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11962
diff
changeset
|
1448 |
case load_mirror_patching_id: |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11962
diff
changeset
|
1449 |
{ StubFrame f(sasm, "load_mirror_patching", dont_gc_arguments); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11962
diff
changeset
|
1450 |
// we should set up register map |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11962
diff
changeset
|
1451 |
oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, move_mirror_patching)); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11962
diff
changeset
|
1452 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11962
diff
changeset
|
1453 |
break; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11962
diff
changeset
|
1454 |
|
19710
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
16611
diff
changeset
|
1455 |
case load_appendix_patching_id: |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
16611
diff
changeset
|
1456 |
{ StubFrame f(sasm, "load_appendix_patching", dont_gc_arguments); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
16611
diff
changeset
|
1457 |
// we should set up register map |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
16611
diff
changeset
|
1458 |
oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, move_appendix_patching)); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
16611
diff
changeset
|
1459 |
} |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
16611
diff
changeset
|
1460 |
break; |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
16611
diff
changeset
|
1461 |
|
1 | 1462 |
case dtrace_object_alloc_id: |
1463 |
{ // rax,: object |
|
1464 |
StubFrame f(sasm, "dtrace_object_alloc", dont_gc_arguments); |
|
1465 |
// we can't gc here so skip the oopmap but make sure that all |
|
1466 |
// the live registers get saved. |
|
1467 |
save_live_registers(sasm, 1); |
|
1468 |
||
1066 | 1469 |
__ NOT_LP64(push(rax)) LP64_ONLY(mov(c_rarg0, rax)); |
1 | 1470 |
__ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_object_alloc))); |
1066 | 1471 |
NOT_LP64(__ pop(rax)); |
1 | 1472 |
|
1473 |
restore_live_registers(sasm); |
|
1474 |
} |
|
1475 |
break; |
|
1476 |
||
1477 |
case fpu2long_stub_id: |
|
1478 |
{ |
|
1479 |
// rax, and rdx are destroyed, but should be free since the result is returned there |
|
1480 |
// preserve rsi,ecx |
|
1066 | 1481 |
__ push(rsi); |
1482 |
__ push(rcx); |
|
1483 |
LP64_ONLY(__ push(rdx);) |
|
1 | 1484 |
|
1485 |
// check for NaN |
|
1486 |
Label return0, do_return, return_min_jlong, do_convert; |
|
1487 |
||
1066 | 1488 |
Address value_high_word(rsp, wordSize + 4); |
1489 |
Address value_low_word(rsp, wordSize); |
|
1490 |
Address result_high_word(rsp, 3*wordSize + 4); |
|
1491 |
Address result_low_word(rsp, 3*wordSize); |
|
1 | 1492 |
|
1066 | 1493 |
__ subptr(rsp, 32); // more than enough on 32bit |
1 | 1494 |
__ fst_d(value_low_word); |
1495 |
__ movl(rax, value_high_word); |
|
1496 |
__ andl(rax, 0x7ff00000); |
|
1497 |
__ cmpl(rax, 0x7ff00000); |
|
1498 |
__ jcc(Assembler::notEqual, do_convert); |
|
1499 |
__ movl(rax, value_high_word); |
|
1500 |
__ andl(rax, 0xfffff); |
|
1501 |
__ orl(rax, value_low_word); |
|
1502 |
__ jcc(Assembler::notZero, return0); |
|
1503 |
||
1504 |
__ bind(do_convert); |
|
1505 |
__ fnstcw(Address(rsp, 0)); |
|
1066 | 1506 |
__ movzwl(rax, Address(rsp, 0)); |
1 | 1507 |
__ orl(rax, 0xc00); |
1508 |
__ movw(Address(rsp, 2), rax); |
|
1509 |
__ fldcw(Address(rsp, 2)); |
|
1510 |
__ fwait(); |
|
1511 |
__ fistp_d(result_low_word); |
|
1512 |
__ fldcw(Address(rsp, 0)); |
|
1513 |
__ fwait(); |
|
1066 | 1514 |
// This gets the entire long in rax on 64bit |
1515 |
__ movptr(rax, result_low_word); |
|
1516 |
// testing of high bits |
|
1 | 1517 |
__ movl(rdx, result_high_word); |
1066 | 1518 |
__ mov(rcx, rax); |
1 | 1519 |
// What the heck is the point of the next instruction??? |
1520 |
__ xorl(rcx, 0x0); |
|
1521 |
__ movl(rsi, 0x80000000); |
|
1522 |
__ xorl(rsi, rdx); |
|
1523 |
__ orl(rcx, rsi); |
|
1524 |
__ jcc(Assembler::notEqual, do_return); |
|
1525 |
__ fldz(); |
|
1526 |
__ fcomp_d(value_low_word); |
|
1527 |
__ fnstsw_ax(); |
|
1066 | 1528 |
#ifdef _LP64 |
1529 |
__ testl(rax, 0x4100); // ZF & CF == 0 |
|
1530 |
__ jcc(Assembler::equal, return_min_jlong); |
|
1531 |
#else |
|
1 | 1532 |
__ sahf(); |
1533 |
__ jcc(Assembler::above, return_min_jlong); |
|
1066 | 1534 |
#endif // _LP64 |
1 | 1535 |
// return max_jlong |
1066 | 1536 |
#ifndef _LP64 |
1 | 1537 |
__ movl(rdx, 0x7fffffff); |
1538 |
__ movl(rax, 0xffffffff); |
|
1066 | 1539 |
#else |
1540 |
__ mov64(rax, CONST64(0x7fffffffffffffff)); |
|
1541 |
#endif // _LP64 |
|
1 | 1542 |
__ jmp(do_return); |
1543 |
||
1544 |
__ bind(return_min_jlong); |
|
1066 | 1545 |
#ifndef _LP64 |
1 | 1546 |
__ movl(rdx, 0x80000000); |
1547 |
__ xorl(rax, rax); |
|
1066 | 1548 |
#else |
27471 | 1549 |
__ mov64(rax, UCONST64(0x8000000000000000)); |
1066 | 1550 |
#endif // _LP64 |
1 | 1551 |
__ jmp(do_return); |
1552 |
||
1553 |
__ bind(return0); |
|
1554 |
__ fpop(); |
|
1066 | 1555 |
#ifndef _LP64 |
1556 |
__ xorptr(rdx,rdx); |
|
1557 |
__ xorptr(rax,rax); |
|
1558 |
#else |
|
1559 |
__ xorptr(rax, rax); |
|
1560 |
#endif // _LP64 |
|
1 | 1561 |
|
1562 |
__ bind(do_return); |
|
1066 | 1563 |
__ addptr(rsp, 32); |
1564 |
LP64_ONLY(__ pop(rdx);) |
|
1565 |
__ pop(rcx); |
|
1566 |
__ pop(rsi); |
|
1 | 1567 |
__ ret(0); |
1568 |
} |
|
1569 |
break; |
|
1570 |
||
16611 | 1571 |
case predicate_failed_trap_id: |
1572 |
{ |
|
1573 |
StubFrame f(sasm, "predicate_failed_trap", dont_gc_arguments); |
|
1574 |
||
1575 |
OopMap* map = save_live_registers(sasm, 1); |
|
1576 |
||
1577 |
int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, predicate_failed_trap)); |
|
1578 |
oop_maps = new OopMapSet(); |
|
1579 |
oop_maps->add_gc_map(call_offset, map); |
|
1580 |
restore_live_registers(sasm); |
|
1581 |
__ leave(); |
|
1582 |
DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob(); |
|
1583 |
assert(deopt_blob != NULL, "deoptimization blob must have been created"); |
|
1584 |
||
1585 |
__ jump(RuntimeAddress(deopt_blob->unpack_with_reexecution())); |
|
1586 |
} |
|
1587 |
break; |
|
1588 |
||
1 | 1589 |
default: |
1590 |
{ StubFrame f(sasm, "unimplemented entry", dont_gc_arguments); |
|
1066 | 1591 |
__ movptr(rax, (int)id); |
1 | 1592 |
__ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), rax); |
1593 |
__ should_not_reach_here(); |
|
1594 |
} |
|
1595 |
break; |
|
1596 |
} |
|
1597 |
return oop_maps; |
|
1598 |
} |
|
1599 |
||
1600 |
#undef __ |
|
6176
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5702
diff
changeset
|
1601 |
|
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5702
diff
changeset
|
1602 |
const char *Runtime1::pd_name_for_address(address entry) { |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5702
diff
changeset
|
1603 |
return "<unknown function>"; |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5702
diff
changeset
|
1604 |
} |