annotate src/cpu/x86/vm/c1_Runtime1_x86.cpp @ 7212:291ffc492eb6

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