Mercurial > hg > graal-compiler
annotate src/cpu/x86/vm/graalRuntime_x86.cpp @ 8517:79cc35a1c2e7
-Merge
author | Christos Kotselidis <christos.kotselidis@oracle.com> |
---|---|
date | Mon, 25 Mar 2013 22:57:00 +0100 |
parents | c3657d00e343 |
children | e41c32a4d573 |
rev | line source |
---|---|
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 * |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
23 */ |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
25 #include "precompiled.hpp" |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 #include "asm/assembler.hpp" |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 #include "graal/graalRuntime.hpp" |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
28 #include "interpreter/interpreter.hpp" |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
29 #include "nativeInst_x86.hpp" |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 #include "oops/compiledICHolder.hpp" |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 #include "oops/oop.inline.hpp" |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
32 #include "prims/jvmtiExport.hpp" |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 #include "register_x86.hpp" |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 #include "runtime/sharedRuntime.hpp" |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 #include "runtime/signature.hpp" |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 #include "runtime/vframeArray.hpp" |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 #include "vmreg_x86.inline.hpp" |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 static void restore_live_registers(GraalStubAssembler* sasm, bool restore_fpu_registers = true); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 // Implementation of GraalStubAssembler |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
43 int GraalStubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, int args_size) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 // setup registers |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
45 const Register thread = NOT_LP64(rdi) LP64_ONLY(r15_thread); // is callee-saved register (Visual C++ calling conventions) |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
46 assert(!(oop_result1->is_valid() || metadata_result->is_valid()) || oop_result1 != metadata_result, "registers must be different"); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 assert(oop_result1 != thread && metadata_result != thread, "registers must be different"); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
48 assert(args_size >= 0, "illegal args_size"); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 #ifdef _LP64 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 mov(c_rarg0, thread); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
52 set_num_rt_args(0); // Nothing on stack |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
53 #else |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 set_num_rt_args(1 + args_size); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
55 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
56 // push java thread (becomes first argument of C function) |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
57 get_thread(thread); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
58 push(thread); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
59 #endif // _LP64 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
60 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
61 int call_offset; |
8127
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7936
diff
changeset
|
62 set_last_Java_frame(thread, rsp, noreg, NULL); |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
63 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
64 // do the call |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
65 call(RuntimeAddress(entry)); |
8127
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7936
diff
changeset
|
66 call_offset = offset(); |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
67 // verify callee-saved register |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
68 #ifdef ASSERT |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
69 guarantee(thread != rax, "change this code"); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
70 push(rax); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
71 { Label L; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
72 get_thread(rax); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
73 cmpptr(thread, rax); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
74 jcc(Assembler::equal, L); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
75 int3(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
76 stop("GraalStubAssembler::call_RT: rdi not callee saved?"); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
77 bind(L); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
78 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
79 pop(rax); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
80 #endif |
8127
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7936
diff
changeset
|
81 reset_last_Java_frame(thread, true, false); |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
82 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
83 // discard thread and arguments |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
84 NOT_LP64(addptr(rsp, num_rt_args()*BytesPerWord)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
85 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
86 // check for pending exceptions |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
87 { Label L; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
88 cmpptr(Address(thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
89 jcc(Assembler::equal, L); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
90 // exception pending => remove activation and forward to exception handler |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
91 movptr(rax, Address(thread, Thread::pending_exception_offset())); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
92 // make sure that the vm_results are cleared |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
93 if (oop_result1->is_valid()) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
94 movptr(Address(thread, JavaThread::vm_result_offset()), NULL_WORD); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
95 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
96 if (metadata_result->is_valid()) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
97 movptr(Address(thread, JavaThread::vm_result_2_offset()), NULL_WORD); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
98 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
99 // (thomaswue) Deoptimize in case of an exception. |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
100 restore_live_registers(this, false); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
101 movptr(Address(thread, Thread::pending_exception_offset()), NULL_WORD); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
102 leave(); |
8363
25691fcb505a
Transmit deoptimization reason in thread local instead of scratch register.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8229
diff
changeset
|
103 movl(Address(thread, ThreadShadow::pending_deoptimization_offset()), Deoptimization::make_trap_request(Deoptimization::Reason_constraint, Deoptimization::Action_reinterpret)); |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
104 jump(RuntimeAddress(SharedRuntime::deopt_blob()->uncommon_trap())); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
105 bind(L); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
106 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
107 // get oop results if there are any and reset the values in the thread |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
108 if (oop_result1->is_valid()) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
109 get_vm_result(oop_result1, thread); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
110 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
111 if (metadata_result->is_valid()) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
112 get_vm_result_2(metadata_result, thread); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
113 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
114 return call_offset; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
115 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
116 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
117 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
118 int GraalStubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
119 #ifdef _LP64 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
120 mov(c_rarg1, arg1); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
121 #else |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
122 push(arg1); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
123 #endif // _LP64 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
124 return call_RT(oop_result1, metadata_result, entry, 1); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
125 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
126 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
127 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
128 int GraalStubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1, Register arg2) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
129 #ifdef _LP64 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
130 if (c_rarg1 == arg2) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
131 if (c_rarg2 == arg1) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
132 xchgq(arg1, arg2); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
133 } else { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
134 mov(c_rarg2, arg2); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
135 mov(c_rarg1, arg1); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
136 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
137 } else { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
138 mov(c_rarg1, arg1); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
139 mov(c_rarg2, arg2); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
140 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
141 #else |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
142 push(arg2); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
143 push(arg1); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
144 #endif // _LP64 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
145 return call_RT(oop_result1, metadata_result, entry, 2); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
146 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
147 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
148 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
149 int GraalStubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1, Register arg2, Register arg3) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
150 #ifdef _LP64 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
151 // if there is any conflict use the stack |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
152 if (arg1 == c_rarg2 || arg1 == c_rarg3 || |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
153 arg2 == c_rarg1 || arg1 == c_rarg3 || |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
154 arg3 == c_rarg1 || arg1 == c_rarg2) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
155 push(arg3); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
156 push(arg2); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
157 push(arg1); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
158 pop(c_rarg1); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
159 pop(c_rarg2); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
160 pop(c_rarg3); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
161 } else { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
162 mov(c_rarg1, arg1); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
163 mov(c_rarg2, arg2); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
164 mov(c_rarg3, arg3); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
165 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
166 #else |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
167 push(arg3); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
168 push(arg2); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
169 push(arg1); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
170 #endif // _LP64 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
171 return call_RT(oop_result1, metadata_result, entry, 3); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
172 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
173 |
7235
a6bd253a770f
expanded LOG_PRINTF stub to handle up to 3 arguments in addition to the format string
Doug Simon <doug.simon@oracle.com>
parents:
7226
diff
changeset
|
174 int GraalStubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1, Register arg2, Register arg3, Register arg4) { |
a6bd253a770f
expanded LOG_PRINTF stub to handle up to 3 arguments in addition to the format string
Doug Simon <doug.simon@oracle.com>
parents:
7226
diff
changeset
|
175 #ifdef _LP64 |
7386
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
176 #ifdef _WIN64 |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
177 // on windows we only have the registers c_rarg0 to c_rarg3 for transferring parameters -> remaining parameters are on the stack |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
178 if (arg1 == c_rarg2 || arg1 == c_rarg3 || |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
179 arg2 == c_rarg1 || arg2 == c_rarg3 || |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
180 arg3 == c_rarg1 || arg3 == c_rarg2 || |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
181 arg4 == c_rarg1 || arg4 == c_rarg2) { |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
182 push(arg4); |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
183 push(arg3); |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
184 push(arg2); |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
185 push(arg1); |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
186 pop(c_rarg1); |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
187 pop(c_rarg2); |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
188 pop(c_rarg3); |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
189 } else { |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
190 mov(c_rarg1, arg1); |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
191 mov(c_rarg2, arg2); |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
192 mov(c_rarg3, arg3); |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
193 push(arg4); |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
194 } |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
195 #else |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
196 // if there is any conflict use the stack |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
197 if (arg1 == c_rarg2 || arg1 == c_rarg3 || arg1 == c_rarg4 || |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
198 arg2 == c_rarg1 || arg2 == c_rarg3 || arg2 == c_rarg4 || |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
199 arg3 == c_rarg1 || arg3 == c_rarg2 || arg3 == c_rarg4 || |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
200 arg4 == c_rarg1 || arg4 == c_rarg2 || arg4 == c_rarg3) { |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
201 push(arg4); |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
202 push(arg3); |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
203 push(arg2); |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
204 push(arg1); |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
205 pop(c_rarg1); |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
206 pop(c_rarg2); |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
207 pop(c_rarg3); |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
208 pop(c_rarg4); |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
209 } else { |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
210 mov(c_rarg1, arg1); |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
211 mov(c_rarg2, arg2); |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
212 mov(c_rarg3, arg3); |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
213 mov(c_rarg4, arg4); |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
214 } |
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
215 #endif |
7235
a6bd253a770f
expanded LOG_PRINTF stub to handle up to 3 arguments in addition to the format string
Doug Simon <doug.simon@oracle.com>
parents:
7226
diff
changeset
|
216 #else |
a6bd253a770f
expanded LOG_PRINTF stub to handle up to 3 arguments in addition to the format string
Doug Simon <doug.simon@oracle.com>
parents:
7226
diff
changeset
|
217 push(arg4); |
a6bd253a770f
expanded LOG_PRINTF stub to handle up to 3 arguments in addition to the format string
Doug Simon <doug.simon@oracle.com>
parents:
7226
diff
changeset
|
218 push(arg3); |
a6bd253a770f
expanded LOG_PRINTF stub to handle up to 3 arguments in addition to the format string
Doug Simon <doug.simon@oracle.com>
parents:
7226
diff
changeset
|
219 push(arg2); |
a6bd253a770f
expanded LOG_PRINTF stub to handle up to 3 arguments in addition to the format string
Doug Simon <doug.simon@oracle.com>
parents:
7226
diff
changeset
|
220 push(arg1); |
a6bd253a770f
expanded LOG_PRINTF stub to handle up to 3 arguments in addition to the format string
Doug Simon <doug.simon@oracle.com>
parents:
7226
diff
changeset
|
221 #endif // _LP64 |
a6bd253a770f
expanded LOG_PRINTF stub to handle up to 3 arguments in addition to the format string
Doug Simon <doug.simon@oracle.com>
parents:
7226
diff
changeset
|
222 return call_RT(oop_result1, metadata_result, entry, 4); |
a6bd253a770f
expanded LOG_PRINTF stub to handle up to 3 arguments in addition to the format string
Doug Simon <doug.simon@oracle.com>
parents:
7226
diff
changeset
|
223 } |
a6bd253a770f
expanded LOG_PRINTF stub to handle up to 3 arguments in addition to the format string
Doug Simon <doug.simon@oracle.com>
parents:
7226
diff
changeset
|
224 |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
225 // Implementation of GraalStubFrame |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
226 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
227 class GraalStubFrame: public StackObj { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
228 private: |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
229 GraalStubAssembler* _sasm; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
230 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
231 public: |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
232 GraalStubFrame(GraalStubAssembler* sasm, const char* name, bool must_gc_arguments); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
233 ~GraalStubFrame(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
234 }; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
235 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
236 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
237 #define __ _sasm-> |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
238 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
239 GraalStubFrame::GraalStubFrame(GraalStubAssembler* sasm, const char* name, bool must_gc_arguments) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
240 _sasm = sasm; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
241 __ set_info(name, must_gc_arguments); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
242 __ enter(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
243 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
244 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
245 GraalStubFrame::~GraalStubFrame() { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
246 __ leave(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
247 __ ret(0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
248 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
249 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
250 #undef __ |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
251 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
252 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
253 // Implementation of GraalRuntime |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
254 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
255 const int float_regs_as_doubles_size_in_slots = FloatRegisterImpl::number_of_registers * 2; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
256 const int xmm_regs_as_doubles_size_in_slots = XMMRegisterImpl::number_of_registers * 2; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
257 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
258 // Stack layout for saving/restoring all the registers needed during a runtime |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
259 // call (this includes deoptimization) |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
260 // Note: note that users of this frame may well have arguments to some runtime |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
261 // while these values are on the stack. These positions neglect those arguments |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
262 // but the code in save_live_registers will take the argument count into |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
263 // account. |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
264 // |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
265 #ifdef _LP64 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
266 #define SLOT2(x) x, |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
267 #define SLOT_PER_WORD 2 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
268 #else |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
269 #define SLOT2(x) |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
270 #define SLOT_PER_WORD 1 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
271 #endif // _LP64 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
272 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
273 enum reg_save_layout { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
274 // 64bit needs to keep stack 16 byte aligned. So we add some alignment dummies to make that |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
275 // happen and will assert if the stack size we create is misaligned |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
276 #ifdef _LP64 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
277 align_dummy_0, align_dummy_1, |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
278 #endif // _LP64 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
279 #ifdef _WIN64 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
280 // Windows always allocates space for it's argument registers (see |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
281 // frame::arg_reg_save_area_bytes). |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
282 arg_reg_save_1, arg_reg_save_1H, // 0, 4 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
283 arg_reg_save_2, arg_reg_save_2H, // 8, 12 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
284 arg_reg_save_3, arg_reg_save_3H, // 16, 20 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
285 arg_reg_save_4, arg_reg_save_4H, // 24, 28 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
286 #endif // _WIN64 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
287 xmm_regs_as_doubles_off, // 32 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
288 float_regs_as_doubles_off = xmm_regs_as_doubles_off + xmm_regs_as_doubles_size_in_slots, // 160 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
289 fpu_state_off = float_regs_as_doubles_off + float_regs_as_doubles_size_in_slots, // 224 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
290 // fpu_state_end_off is exclusive |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
291 fpu_state_end_off = fpu_state_off + (FPUStateSizeInWords / SLOT_PER_WORD), // 352 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
292 marker = fpu_state_end_off, SLOT2(markerH) // 352, 356 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
293 extra_space_offset, // 360 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
294 #ifdef _LP64 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
295 r15_off = extra_space_offset, r15H_off, // 360, 364 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
296 r14_off, r14H_off, // 368, 372 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
297 r13_off, r13H_off, // 376, 380 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
298 r12_off, r12H_off, // 384, 388 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
299 r11_off, r11H_off, // 392, 396 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
300 r10_off, r10H_off, // 400, 404 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
301 r9_off, r9H_off, // 408, 412 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
302 r8_off, r8H_off, // 416, 420 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
303 rdi_off, rdiH_off, // 424, 428 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
304 #else |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
305 rdi_off = extra_space_offset, |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
306 #endif // _LP64 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
307 rsi_off, SLOT2(rsiH_off) // 432, 436 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
308 rbp_off, SLOT2(rbpH_off) // 440, 444 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
309 rsp_off, SLOT2(rspH_off) // 448, 452 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
310 rbx_off, SLOT2(rbxH_off) // 456, 460 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
311 rdx_off, SLOT2(rdxH_off) // 464, 468 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
312 rcx_off, SLOT2(rcxH_off) // 472, 476 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
313 rax_off, SLOT2(raxH_off) // 480, 484 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
314 saved_rbp_off, SLOT2(saved_rbpH_off) // 488, 492 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
315 return_off, SLOT2(returnH_off) // 496, 500 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
316 reg_save_frame_size // As noted: neglects any parameters to runtime // 504 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
317 }; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
318 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
319 // Save registers which might be killed by calls into the runtime. |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
320 // Tries to smart about FP registers. In particular we separate |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
321 // saving and describing the FPU registers for deoptimization since we |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
322 // have to save the FPU registers twice if we describe them and on P4 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
323 // saving FPU registers which don't contain anything appears |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
324 // expensive. The deopt blob is the only thing which needs to |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
325 // describe FPU registers. In all other cases it should be sufficient |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
326 // to simply save their current value. |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
327 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
328 static OopMap* generate_oop_map(GraalStubAssembler* sasm, int num_rt_args, |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
329 bool save_fpu_registers = true) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
330 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
331 // In 64bit all the args are in regs so there are no additional stack slots |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
332 LP64_ONLY(num_rt_args = 0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
333 LP64_ONLY(assert((reg_save_frame_size * VMRegImpl::stack_slot_size) % 16 == 0, "must be 16 byte aligned");) |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
334 int frame_size_in_slots = reg_save_frame_size + num_rt_args; // args + thread |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
335 sasm->set_frame_size(frame_size_in_slots / VMRegImpl::slots_per_word ); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
336 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
337 // record saved value locations in an OopMap |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
338 // locations are offsets from sp after runtime call; num_rt_args is number of arguments in call, including thread |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
339 OopMap* map = new OopMap(frame_size_in_slots, 0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
340 map->set_callee_saved(VMRegImpl::stack2reg(rax_off + num_rt_args), rax->as_VMReg()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
341 map->set_callee_saved(VMRegImpl::stack2reg(rcx_off + num_rt_args), rcx->as_VMReg()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
342 map->set_callee_saved(VMRegImpl::stack2reg(rdx_off + num_rt_args), rdx->as_VMReg()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
343 map->set_callee_saved(VMRegImpl::stack2reg(rbx_off + num_rt_args), rbx->as_VMReg()); |
8127
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7936
diff
changeset
|
344 map->set_callee_saved(VMRegImpl::stack2reg(rbp_off + num_rt_args), rbp->as_VMReg()); |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
345 map->set_callee_saved(VMRegImpl::stack2reg(rsi_off + num_rt_args), rsi->as_VMReg()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
346 map->set_callee_saved(VMRegImpl::stack2reg(rdi_off + num_rt_args), rdi->as_VMReg()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
347 #ifdef _LP64 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
348 map->set_callee_saved(VMRegImpl::stack2reg(r8_off + num_rt_args), r8->as_VMReg()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
349 map->set_callee_saved(VMRegImpl::stack2reg(r9_off + num_rt_args), r9->as_VMReg()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
350 map->set_callee_saved(VMRegImpl::stack2reg(r10_off + num_rt_args), r10->as_VMReg()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
351 map->set_callee_saved(VMRegImpl::stack2reg(r11_off + num_rt_args), r11->as_VMReg()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
352 map->set_callee_saved(VMRegImpl::stack2reg(r12_off + num_rt_args), r12->as_VMReg()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
353 map->set_callee_saved(VMRegImpl::stack2reg(r13_off + num_rt_args), r13->as_VMReg()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
354 map->set_callee_saved(VMRegImpl::stack2reg(r14_off + num_rt_args), r14->as_VMReg()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
355 map->set_callee_saved(VMRegImpl::stack2reg(r15_off + num_rt_args), r15->as_VMReg()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
356 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
357 // This is stupid but needed. |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
358 map->set_callee_saved(VMRegImpl::stack2reg(raxH_off + num_rt_args), rax->as_VMReg()->next()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
359 map->set_callee_saved(VMRegImpl::stack2reg(rcxH_off + num_rt_args), rcx->as_VMReg()->next()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
360 map->set_callee_saved(VMRegImpl::stack2reg(rdxH_off + num_rt_args), rdx->as_VMReg()->next()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
361 map->set_callee_saved(VMRegImpl::stack2reg(rbxH_off + num_rt_args), rbx->as_VMReg()->next()); |
8127
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7936
diff
changeset
|
362 map->set_callee_saved(VMRegImpl::stack2reg(rbpH_off + num_rt_args), rbp->as_VMReg()->next()); |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
363 map->set_callee_saved(VMRegImpl::stack2reg(rsiH_off + num_rt_args), rsi->as_VMReg()->next()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
364 map->set_callee_saved(VMRegImpl::stack2reg(rdiH_off + num_rt_args), rdi->as_VMReg()->next()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
365 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
366 map->set_callee_saved(VMRegImpl::stack2reg(r8H_off + num_rt_args), r8->as_VMReg()->next()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
367 map->set_callee_saved(VMRegImpl::stack2reg(r9H_off + num_rt_args), r9->as_VMReg()->next()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
368 map->set_callee_saved(VMRegImpl::stack2reg(r10H_off + num_rt_args), r10->as_VMReg()->next()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
369 map->set_callee_saved(VMRegImpl::stack2reg(r11H_off + num_rt_args), r11->as_VMReg()->next()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
370 map->set_callee_saved(VMRegImpl::stack2reg(r12H_off + num_rt_args), r12->as_VMReg()->next()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
371 map->set_callee_saved(VMRegImpl::stack2reg(r13H_off + num_rt_args), r13->as_VMReg()->next()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
372 map->set_callee_saved(VMRegImpl::stack2reg(r14H_off + num_rt_args), r14->as_VMReg()->next()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
373 map->set_callee_saved(VMRegImpl::stack2reg(r15H_off + num_rt_args), r15->as_VMReg()->next()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
374 #endif // _LP64 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
375 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
376 if (save_fpu_registers) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
377 if (UseSSE < 2) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
378 int fpu_off = float_regs_as_doubles_off; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
379 for (int n = 0; n < FloatRegisterImpl::number_of_registers; n++) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
380 VMReg fpu_name_0 = as_FloatRegister(n)->as_VMReg(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
381 map->set_callee_saved(VMRegImpl::stack2reg(fpu_off + num_rt_args), fpu_name_0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
382 // %%% This is really a waste but we'll keep things as they were for now |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
383 if (true) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
384 map->set_callee_saved(VMRegImpl::stack2reg(fpu_off + 1 + num_rt_args), fpu_name_0->next()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
385 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
386 fpu_off += 2; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
387 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
388 assert(fpu_off == fpu_state_off, "incorrect number of fpu stack slots"); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
389 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
390 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
391 if (UseSSE >= 2) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
392 int xmm_off = xmm_regs_as_doubles_off; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
393 for (int n = 0; n < XMMRegisterImpl::number_of_registers; n++) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
394 VMReg xmm_name_0 = as_XMMRegister(n)->as_VMReg(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
395 map->set_callee_saved(VMRegImpl::stack2reg(xmm_off + num_rt_args), xmm_name_0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
396 // %%% This is really a waste but we'll keep things as they were for now |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
397 if (true) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
398 map->set_callee_saved(VMRegImpl::stack2reg(xmm_off + 1 + num_rt_args), xmm_name_0->next()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
399 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
400 xmm_off += 2; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
401 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
402 assert(xmm_off == float_regs_as_doubles_off, "incorrect number of xmm registers"); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
403 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
404 } else if (UseSSE == 1) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
405 int xmm_off = xmm_regs_as_doubles_off; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
406 for (int n = 0; n < XMMRegisterImpl::number_of_registers; n++) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
407 VMReg xmm_name_0 = as_XMMRegister(n)->as_VMReg(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
408 map->set_callee_saved(VMRegImpl::stack2reg(xmm_off + num_rt_args), xmm_name_0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
409 xmm_off += 2; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
410 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
411 assert(xmm_off == float_regs_as_doubles_off, "incorrect number of xmm registers"); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
412 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
413 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
414 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
415 return map; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
416 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
417 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
418 #define __ sasm-> |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
419 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
420 static OopMap* save_live_registers(GraalStubAssembler* sasm, int num_rt_args, |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
421 bool save_fpu_registers = true) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
422 __ block_comment("save_live_registers"); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
423 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
424 __ pusha(); // integer registers |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
425 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
426 // assert(float_regs_as_doubles_off % 2 == 0, "misaligned offset"); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
427 // assert(xmm_regs_as_doubles_off % 2 == 0, "misaligned offset"); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
428 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
429 __ subptr(rsp, extra_space_offset * VMRegImpl::stack_slot_size); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
430 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
431 #ifdef ASSERT |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
432 __ movptr(Address(rsp, marker * VMRegImpl::stack_slot_size), (int32_t)0xfeedbeef); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
433 #endif |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
434 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
435 if (save_fpu_registers) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
436 if (UseSSE < 2) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
437 // save FPU stack |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
438 __ fnsave(Address(rsp, fpu_state_off * VMRegImpl::stack_slot_size)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
439 __ fwait(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
440 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
441 #ifdef ASSERT |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
442 Label ok; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
443 __ cmpw(Address(rsp, fpu_state_off * VMRegImpl::stack_slot_size), StubRoutines::fpu_cntrl_wrd_std()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
444 __ jccb(Assembler::equal, ok); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
445 __ stop("corrupted control word detected"); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
446 __ bind(ok); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
447 #endif |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
448 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
449 // Reset the control word to guard against exceptions being unmasked |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
450 // since fstp_d can cause FPU stack underflow exceptions. Write it |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
451 // into the on stack copy and then reload that to make sure that the |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
452 // current and future values are correct. |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
453 __ movw(Address(rsp, fpu_state_off * VMRegImpl::stack_slot_size), StubRoutines::fpu_cntrl_wrd_std()); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
454 __ frstor(Address(rsp, fpu_state_off * VMRegImpl::stack_slot_size)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
455 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
456 // Save the FPU registers in de-opt-able form |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
457 __ fstp_d(Address(rsp, float_regs_as_doubles_off * VMRegImpl::stack_slot_size + 0)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
458 __ fstp_d(Address(rsp, float_regs_as_doubles_off * VMRegImpl::stack_slot_size + 8)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
459 __ fstp_d(Address(rsp, float_regs_as_doubles_off * VMRegImpl::stack_slot_size + 16)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
460 __ fstp_d(Address(rsp, float_regs_as_doubles_off * VMRegImpl::stack_slot_size + 24)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
461 __ fstp_d(Address(rsp, float_regs_as_doubles_off * VMRegImpl::stack_slot_size + 32)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
462 __ fstp_d(Address(rsp, float_regs_as_doubles_off * VMRegImpl::stack_slot_size + 40)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
463 __ fstp_d(Address(rsp, float_regs_as_doubles_off * VMRegImpl::stack_slot_size + 48)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
464 __ fstp_d(Address(rsp, float_regs_as_doubles_off * VMRegImpl::stack_slot_size + 56)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
465 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
466 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
467 if (UseSSE >= 2) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
468 // save XMM registers |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
469 // XMM registers can contain float or double values, but this is not known here, |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
470 // so always save them as doubles. |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
471 // note that float values are _not_ converted automatically, so for float values |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
472 // the second word contains only garbage data. |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
473 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 0), xmm0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
474 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 8), xmm1); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
475 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 16), xmm2); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
476 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 24), xmm3); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
477 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 32), xmm4); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
478 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 40), xmm5); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
479 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 48), xmm6); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
480 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 56), xmm7); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
481 #ifdef _LP64 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
482 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 64), xmm8); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
483 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 72), xmm9); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
484 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 80), xmm10); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
485 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 88), xmm11); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
486 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 96), xmm12); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
487 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 104), xmm13); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
488 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 112), xmm14); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
489 __ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 120), xmm15); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
490 #endif // _LP64 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
491 } else if (UseSSE == 1) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
492 // save XMM registers as float because double not supported without SSE2 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
493 __ movflt(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 0), xmm0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
494 __ movflt(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 8), xmm1); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
495 __ movflt(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 16), xmm2); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
496 __ movflt(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 24), xmm3); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
497 __ movflt(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 32), xmm4); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
498 __ movflt(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 40), xmm5); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
499 __ movflt(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 48), xmm6); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
500 __ movflt(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 56), xmm7); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
501 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
502 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
503 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
504 // FPU stack must be empty now |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
505 __ verify_FPU(0, "save_live_registers"); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
506 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
507 return generate_oop_map(sasm, num_rt_args, save_fpu_registers); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
508 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
509 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
510 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
511 static void restore_fpu(GraalStubAssembler* sasm, bool restore_fpu_registers = true) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
512 if (restore_fpu_registers) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
513 if (UseSSE >= 2) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
514 // restore XMM registers |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
515 __ movdbl(xmm0, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 0)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
516 __ movdbl(xmm1, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 8)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
517 __ movdbl(xmm2, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 16)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
518 __ movdbl(xmm3, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 24)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
519 __ movdbl(xmm4, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 32)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
520 __ movdbl(xmm5, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 40)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
521 __ movdbl(xmm6, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 48)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
522 __ movdbl(xmm7, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 56)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
523 #ifdef _LP64 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
524 __ movdbl(xmm8, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 64)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
525 __ movdbl(xmm9, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 72)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
526 __ movdbl(xmm10, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 80)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
527 __ movdbl(xmm11, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 88)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
528 __ movdbl(xmm12, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 96)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
529 __ movdbl(xmm13, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 104)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
530 __ movdbl(xmm14, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 112)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
531 __ movdbl(xmm15, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 120)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
532 #endif // _LP64 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
533 } else if (UseSSE == 1) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
534 // restore XMM registers |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
535 __ movflt(xmm0, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 0)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
536 __ movflt(xmm1, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 8)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
537 __ movflt(xmm2, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 16)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
538 __ movflt(xmm3, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 24)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
539 __ movflt(xmm4, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 32)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
540 __ movflt(xmm5, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 40)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
541 __ movflt(xmm6, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 48)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
542 __ movflt(xmm7, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 56)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
543 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
544 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
545 if (UseSSE < 2) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
546 __ frstor(Address(rsp, fpu_state_off * VMRegImpl::stack_slot_size)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
547 } else { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
548 // check that FPU stack is really empty |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
549 __ verify_FPU(0, "restore_live_registers"); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
550 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
551 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
552 } else { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
553 // check that FPU stack is really empty |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
554 __ verify_FPU(0, "restore_live_registers"); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
555 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
556 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
557 #ifdef ASSERT |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
558 { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
559 Label ok; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
560 __ cmpptr(Address(rsp, marker * VMRegImpl::stack_slot_size), (int32_t)0xfeedbeef); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
561 __ jcc(Assembler::equal, ok); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
562 __ stop("bad offsets in frame"); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
563 __ bind(ok); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
564 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
565 #endif // ASSERT |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
566 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
567 __ addptr(rsp, extra_space_offset * VMRegImpl::stack_slot_size); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
568 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
569 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
570 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
571 static void restore_live_registers(GraalStubAssembler* sasm, bool restore_fpu_registers/* = true*/) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
572 __ block_comment("restore_live_registers"); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
573 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
574 restore_fpu(sasm, restore_fpu_registers); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
575 __ popa(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
576 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
577 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
578 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
579 static void restore_live_registers_except_rax(GraalStubAssembler* sasm, bool restore_fpu_registers = true) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
580 __ block_comment("restore_live_registers_except_rax"); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
581 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
582 restore_fpu(sasm, restore_fpu_registers); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
583 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
584 #ifdef _LP64 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
585 __ movptr(r15, Address(rsp, 0)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
586 __ movptr(r14, Address(rsp, wordSize)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
587 __ movptr(r13, Address(rsp, 2 * wordSize)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
588 __ movptr(r12, Address(rsp, 3 * wordSize)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
589 __ movptr(r11, Address(rsp, 4 * wordSize)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
590 __ movptr(r10, Address(rsp, 5 * wordSize)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
591 __ movptr(r9, Address(rsp, 6 * wordSize)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
592 __ movptr(r8, Address(rsp, 7 * wordSize)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
593 __ movptr(rdi, Address(rsp, 8 * wordSize)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
594 __ movptr(rsi, Address(rsp, 9 * wordSize)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
595 __ movptr(rbp, Address(rsp, 10 * wordSize)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
596 // skip rsp |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
597 __ movptr(rbx, Address(rsp, 12 * wordSize)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
598 __ movptr(rdx, Address(rsp, 13 * wordSize)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
599 __ movptr(rcx, Address(rsp, 14 * wordSize)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
600 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
601 __ addptr(rsp, 16 * wordSize); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
602 #else |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
603 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
604 __ pop(rdi); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
605 __ pop(rsi); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
606 __ pop(rbp); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
607 __ pop(rbx); // skip this value |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
608 __ pop(rbx); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
609 __ pop(rdx); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
610 __ pop(rcx); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
611 __ addptr(rsp, BytesPerWord); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
612 #endif // _LP64 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
613 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
614 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
615 OopMapSet* GraalRuntime::generate_handle_exception(StubID id, GraalStubAssembler *sasm) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
616 __ block_comment("generate_handle_exception"); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
617 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
618 // incoming parameters |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
619 const Register exception_oop = rax; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
620 const Register exception_pc = rdx; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
621 // other registers used in this stub |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
622 const Register thread = NOT_LP64(rdi) LP64_ONLY(r15_thread); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
623 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
624 // Save registers, if required. |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
625 OopMapSet* oop_maps = new OopMapSet(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
626 OopMap* oop_map = NULL; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
627 switch (id) { |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
628 case handle_exception_nofpu_id: |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
629 // At this point all registers MAY be live. |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
630 oop_map = save_live_registers(sasm, 1 /*thread*/, id == handle_exception_nofpu_id); |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
631 break; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
632 default: ShouldNotReachHere(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
633 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
634 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
635 #ifdef TIERED |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
636 // C2 can leave the fpu stack dirty |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
637 if (UseSSE < 2) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
638 __ empty_FPU_stack(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
639 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
640 #endif // TIERED |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
641 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
642 // verify that only rax, and rdx is valid at this time |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
643 #ifdef ASSERT |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
644 __ movptr(rbx, 0xDEAD); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
645 __ movptr(rcx, 0xDEAD); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
646 __ movptr(rsi, 0xDEAD); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
647 __ movptr(rdi, 0xDEAD); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
648 #endif |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
649 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
650 // verify that rax, contains a valid exception |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
651 __ verify_not_null_oop(exception_oop); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
652 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
653 // load address of JavaThread object for thread-local data |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
654 NOT_LP64(__ get_thread(thread);) |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
655 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
656 #ifdef ASSERT |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
657 // check that fields in JavaThread for exception oop and issuing pc are |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
658 // empty before writing to them |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
659 Label oop_empty; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
660 __ cmpptr(Address(thread, JavaThread::exception_oop_offset()), (int32_t) NULL_WORD); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
661 __ jcc(Assembler::equal, oop_empty); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
662 __ stop("exception oop already set"); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
663 __ bind(oop_empty); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
664 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
665 Label pc_empty; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
666 __ cmpptr(Address(thread, JavaThread::exception_pc_offset()), 0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
667 __ jcc(Assembler::equal, pc_empty); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
668 __ stop("exception pc already set"); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
669 __ bind(pc_empty); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
670 #endif |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
671 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
672 // save exception oop and issuing pc into JavaThread |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
673 // (exception handler will load it from here) |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
674 __ movptr(Address(thread, JavaThread::exception_oop_offset()), exception_oop); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
675 __ movptr(Address(thread, JavaThread::exception_pc_offset()), exception_pc); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
676 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
677 // patch throwing pc into return address (has bci & oop map) |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
678 __ movptr(Address(rbp, 1*BytesPerWord), exception_pc); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
679 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
680 // compute the exception handler. |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
681 // the exception oop and the throwing pc are read from the fields in JavaThread |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
682 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, exception_handler_for_pc)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
683 oop_maps->add_gc_map(call_offset, oop_map); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
684 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
685 // rax: handler address |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
686 // will be the deopt blob if nmethod was deoptimized while we looked up |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
687 // handler regardless of whether handler existed in the nmethod. |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
688 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
689 // only rax, is valid at this time, all other registers have been destroyed by the runtime call |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
690 #ifdef ASSERT |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
691 __ movptr(rbx, 0xDEAD); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
692 __ movptr(rcx, 0xDEAD); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
693 __ movptr(rdx, 0xDEAD); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
694 __ movptr(rsi, 0xDEAD); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
695 __ movptr(rdi, 0xDEAD); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
696 #endif |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
697 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
698 // patch the return address, this stub will directly return to the exception handler |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
699 __ movptr(Address(rbp, 1*BytesPerWord), rax); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
700 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
701 switch (id) { |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
702 case handle_exception_nofpu_id: |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
703 // Restore the registers that were saved at the beginning. |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
704 restore_live_registers(sasm, id == handle_exception_nofpu_id); |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
705 break; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
706 default: ShouldNotReachHere(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
707 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
708 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
709 return oop_maps; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
710 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
711 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
712 void GraalRuntime::generate_unwind_exception(GraalStubAssembler *sasm) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
713 // incoming parameters |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
714 const Register exception_oop = rax; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
715 // callee-saved copy of exception_oop during runtime call |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
716 const Register exception_oop_callee_saved = NOT_LP64(rsi) LP64_ONLY(r14); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
717 // other registers used in this stub |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
718 const Register exception_pc = rdx; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
719 const Register handler_addr = rbx; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
720 const Register thread = NOT_LP64(rdi) LP64_ONLY(r15_thread); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
721 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
722 // verify that only rax is valid at this time |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
723 #ifdef ASSERT |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
724 __ movptr(rbx, 0xDEAD); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
725 __ movptr(rcx, 0xDEAD); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
726 __ movptr(rdx, 0xDEAD); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
727 __ movptr(rsi, 0xDEAD); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
728 __ movptr(rdi, 0xDEAD); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
729 #endif |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
730 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
731 #ifdef ASSERT |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
732 // check that fields in JavaThread for exception oop and issuing pc are empty |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
733 NOT_LP64(__ get_thread(thread);) |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
734 Label oop_empty; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
735 __ cmpptr(Address(thread, JavaThread::exception_oop_offset()), 0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
736 __ jcc(Assembler::equal, oop_empty); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
737 __ stop("exception oop must be empty"); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
738 __ bind(oop_empty); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
739 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
740 Label pc_empty; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
741 __ cmpptr(Address(thread, JavaThread::exception_pc_offset()), 0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
742 __ jcc(Assembler::equal, pc_empty); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
743 __ stop("exception pc must be empty"); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
744 __ bind(pc_empty); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
745 #endif |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
746 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
747 // clear the FPU stack in case any FPU results are left behind |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
748 __ empty_FPU_stack(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
749 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
750 // save exception_oop in callee-saved register to preserve it during runtime calls |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
751 __ verify_not_null_oop(exception_oop); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
752 __ movptr(exception_oop_callee_saved, exception_oop); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
753 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
754 NOT_LP64(__ get_thread(thread);) |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
755 // Get return address (is on top of stack after leave). |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
756 __ movptr(exception_pc, Address(rsp, 0)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
757 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
758 // search the exception handler address of the caller (using the return address) |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
759 __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), thread, exception_pc); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
760 // rax: exception handler address of the caller |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
761 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
762 // Only RAX and RSI are valid at this time, all other registers have been destroyed by the call. |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
763 #ifdef ASSERT |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
764 __ movptr(rbx, 0xDEAD); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
765 __ movptr(rcx, 0xDEAD); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
766 __ movptr(rdx, 0xDEAD); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
767 __ movptr(rdi, 0xDEAD); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
768 #endif |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
769 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
770 // move result of call into correct register |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
771 __ movptr(handler_addr, rax); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
772 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
773 // Restore exception oop to RAX (required convention of exception handler). |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
774 __ movptr(exception_oop, exception_oop_callee_saved); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
775 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
776 // verify that there is really a valid exception in rax |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
777 __ verify_not_null_oop(exception_oop); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
778 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
779 // get throwing pc (= return address). |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
780 // rdx has been destroyed by the call, so it must be set again |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
781 // the pop is also necessary to simulate the effect of a ret(0) |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
782 __ pop(exception_pc); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
783 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
784 // Restore SP from BP if the exception PC is a method handle call site. |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
785 NOT_LP64(__ get_thread(thread);) |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
786 __ cmpl(Address(thread, JavaThread::is_method_handle_return_offset()), 0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
787 __ cmovptr(Assembler::notEqual, rsp, rbp_mh_SP_save); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
788 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
789 // continue at exception handler (return address removed) |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
790 // note: do *not* remove arguments when unwinding the |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
791 // activation since the caller assumes having |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
792 // all arguments on the stack when entering the |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
793 // runtime to determine the exception handler |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
794 // (GC happens at call site with arguments!) |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
795 // rax: exception oop |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
796 // rdx: throwing pc |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
797 // rbx: exception handler |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
798 __ jmp(handler_addr); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
799 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
800 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
801 OopMapSet* GraalRuntime::generate_code_for(StubID id, GraalStubAssembler* sasm) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
802 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
803 // for better readability |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
804 const bool must_gc_arguments = true; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
805 const bool dont_gc_arguments = false; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
806 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
807 // default value; overwritten for some optimized stubs that are called from methods that do not use the fpu |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
808 bool save_fpu_registers = true; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
809 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
810 // stub code & info for the different stubs |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
811 OopMapSet* oop_maps = NULL; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
812 switch (id) { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
813 |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
814 case new_instance_id: |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
815 { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
816 Register klass = rdx; // Incoming |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
817 Register obj = rax; // Result |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
818 __ set_info("new_instance", dont_gc_arguments); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
819 __ enter(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
820 OopMap* map = save_live_registers(sasm, 2); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
821 int call_offset = __ call_RT(obj, noreg, CAST_FROM_FN_PTR(address, new_instance), klass); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
822 oop_maps = new OopMapSet(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
823 oop_maps->add_gc_map(call_offset, map); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
824 restore_live_registers_except_rax(sasm); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
825 __ verify_oop(obj); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
826 __ leave(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
827 __ ret(0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
828 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
829 // rax,: new instance |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
830 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
831 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
832 break; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
833 |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
834 case new_array_id: |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
835 { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
836 Register length = rbx; // Incoming |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
837 Register klass = rdx; // Incoming |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
838 Register obj = rax; // Result |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
839 |
7145
6c46172c04bf
consolidated new_type_array and new_object_array stubs into one as there no difference between them
Doug Simon <doug.simon@oracle.com>
parents:
7125
diff
changeset
|
840 __ set_info("new_array", dont_gc_arguments); |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
841 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
842 __ enter(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
843 OopMap* map = save_live_registers(sasm, 3); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
844 int call_offset; |
7145
6c46172c04bf
consolidated new_type_array and new_object_array stubs into one as there no difference between them
Doug Simon <doug.simon@oracle.com>
parents:
7125
diff
changeset
|
845 call_offset = __ call_RT(obj, noreg, CAST_FROM_FN_PTR(address, new_array), klass, length); |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
846 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
847 oop_maps = new OopMapSet(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
848 oop_maps->add_gc_map(call_offset, map); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
849 restore_live_registers_except_rax(sasm); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
850 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
851 __ verify_oop(obj); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
852 __ leave(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
853 __ ret(0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
854 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
855 // rax,: new array |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
856 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
857 break; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
858 |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
859 case new_multi_array_id: |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
860 { GraalStubFrame f(sasm, "new_multi_array", dont_gc_arguments); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
861 // rax,: klass |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
862 // rbx,: rank |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
863 // rcx: address of 1st dimension |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
864 OopMap* map = save_live_registers(sasm, 4); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
865 int call_offset = __ call_RT(rax, noreg, CAST_FROM_FN_PTR(address, new_multi_array), rax, rbx, rcx); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
866 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
867 oop_maps = new OopMapSet(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
868 oop_maps->add_gc_map(call_offset, map); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
869 restore_live_registers_except_rax(sasm); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
870 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
871 // rax,: new multi array |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
872 __ verify_oop(rax); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
873 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
874 break; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
875 |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
876 case register_finalizer_id: |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
877 { |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
878 __ set_info("register_finalizer", dont_gc_arguments); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
879 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
880 // This is called via call_runtime so the arguments |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
881 // will be place in C abi locations |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
882 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
883 #ifdef _LP64 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
884 __ verify_oop(j_rarg0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
885 __ mov(rax, j_rarg0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
886 #else |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
887 // The object is passed on the stack and we haven't pushed a |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
888 // frame yet so it's one work away from top of stack. |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
889 __ movptr(rax, Address(rsp, 1 * BytesPerWord)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
890 __ verify_oop(rax); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
891 #endif // _LP64 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
892 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
893 // load the klass and check the has finalizer flag |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
894 Label register_finalizer; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
895 Register t = rsi; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
896 __ load_klass(t, rax); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
897 __ movl(t, Address(t, Klass::access_flags_offset())); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
898 __ testl(t, JVM_ACC_HAS_FINALIZER); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
899 __ jcc(Assembler::notZero, register_finalizer); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
900 __ ret(0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
901 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
902 __ bind(register_finalizer); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
903 __ enter(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
904 OopMap* oop_map = save_live_registers(sasm, 2 /*num_rt_args */); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
905 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, SharedRuntime::register_finalizer), rax); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
906 oop_maps = new OopMapSet(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
907 oop_maps->add_gc_map(call_offset, oop_map); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
908 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
909 // Now restore all the live registers |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
910 restore_live_registers(sasm); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
911 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
912 __ leave(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
913 __ ret(0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
914 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
915 break; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
916 |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
917 case handle_exception_nofpu_id: |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
918 { GraalStubFrame f(sasm, "handle_exception", dont_gc_arguments); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
919 oop_maps = generate_handle_exception(id, sasm); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
920 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
921 break; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
922 |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
923 case unwind_exception_call_id: { |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
924 // remove the frame from the stack |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
925 __ movptr(rsp, rbp); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
926 __ pop(rbp); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
927 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
928 __ set_info("unwind_exception", dont_gc_arguments); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
929 // note: no stubframe since we are about to leave the current |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
930 // activation and we are calling a leaf VM function only. |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
931 generate_unwind_exception(sasm); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
932 __ should_not_reach_here(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
933 break; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
934 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
935 |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
936 case OSR_migration_end_id: { |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
937 __ enter(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
938 save_live_registers(sasm, 0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
939 __ movptr(c_rarg0, j_rarg0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
940 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::OSR_migration_end))); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
941 restore_live_registers(sasm); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
942 __ leave(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
943 __ ret(0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
944 break; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
945 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
946 |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
947 case create_null_pointer_exception_id: { |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
948 __ enter(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
949 oop_maps = new OopMapSet(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
950 OopMap* oop_map = save_live_registers(sasm, 0); |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
951 int call_offset = __ call_RT(rax, noreg, (address)create_null_exception, 0); |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
952 oop_maps->add_gc_map(call_offset, oop_map); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
953 __ leave(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
954 __ ret(0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
955 break; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
956 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
957 |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
958 case create_out_of_bounds_exception_id: { |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
959 __ enter(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
960 oop_maps = new OopMapSet(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
961 OopMap* oop_map = save_live_registers(sasm, 0); |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
962 int call_offset = __ call_RT(rax, noreg, (address)create_out_of_bounds_exception, j_rarg0); |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
963 oop_maps->add_gc_map(call_offset, oop_map); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
964 __ leave(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
965 __ ret(0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
966 break; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
967 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
968 |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
969 case vm_error_id: { |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
970 __ enter(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
971 oop_maps = new OopMapSet(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
972 OopMap* oop_map = save_live_registers(sasm, 0); |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
973 int call_offset = __ call_RT(noreg, noreg, (address)vm_error, j_rarg0, j_rarg1, j_rarg2); |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
974 oop_maps->add_gc_map(call_offset, oop_map); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
975 restore_live_registers(sasm); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
976 __ leave(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
977 __ ret(0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
978 break; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
979 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
980 |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
981 case log_printf_id: { |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
982 __ enter(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
983 oop_maps = new OopMapSet(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
984 OopMap* oop_map = save_live_registers(sasm, 0); |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
985 int call_offset = __ call_RT(noreg, noreg, (address)log_printf, j_rarg0, j_rarg1, j_rarg2, j_rarg3); |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
986 oop_maps->add_gc_map(call_offset, oop_map); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
987 restore_live_registers(sasm); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
988 __ leave(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
989 __ ret(0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
990 break; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
991 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
992 |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
993 case log_primitive_id: { |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
994 __ enter(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
995 oop_maps = new OopMapSet(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
996 OopMap* oop_map = save_live_registers(sasm, 0); |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
997 int call_offset = __ call_RT(noreg, noreg, (address)log_primitive, j_rarg0, j_rarg1, j_rarg2); |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
998 oop_maps->add_gc_map(call_offset, oop_map); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
999 restore_live_registers(sasm); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1000 __ leave(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1001 __ ret(0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1002 break; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1003 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1004 |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
1005 case log_object_id: { |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1006 __ enter(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1007 oop_maps = new OopMapSet(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1008 OopMap* oop_map = save_live_registers(sasm, 0); |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
1009 int call_offset = __ call_RT(noreg, noreg, (address)log_object, j_rarg0, j_rarg1); |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1010 oop_maps->add_gc_map(call_offset, oop_map); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1011 restore_live_registers(sasm); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1012 __ leave(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1013 __ ret(0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1014 break; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1015 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1016 |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
1017 case verify_oop_id: { |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1018 // We use enter & leave so that a better stack trace is produced in the hs_err file |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1019 __ enter(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1020 __ verify_oop(r13, "Graal verify oop"); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1021 __ leave(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1022 __ ret(0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1023 break; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1024 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1025 |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
1026 case arithmetic_frem_id: { |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1027 __ subptr(rsp, 8); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1028 __ movflt(Address(rsp, 0), xmm1); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1029 __ fld_s(Address(rsp, 0)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1030 __ movflt(Address(rsp, 0), xmm0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1031 __ fld_s(Address(rsp, 0)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1032 Label L; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1033 __ bind(L); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1034 __ fprem(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1035 __ fwait(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1036 __ fnstsw_ax(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1037 __ testl(rax, 0x400); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1038 __ jcc(Assembler::notZero, L); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1039 __ fxch(1); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1040 __ fpop(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1041 __ fstp_s(Address(rsp, 0)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1042 __ movflt(xmm0, Address(rsp, 0)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1043 __ addptr(rsp, 8); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1044 __ ret(0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1045 break; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1046 } |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
1047 case arithmetic_drem_id: { |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1048 __ subptr(rsp, 8); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1049 __ movdbl(Address(rsp, 0), xmm1); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1050 __ fld_d(Address(rsp, 0)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1051 __ movdbl(Address(rsp, 0), xmm0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1052 __ fld_d(Address(rsp, 0)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1053 Label L; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1054 __ bind(L); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1055 __ fprem(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1056 __ fwait(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1057 __ fnstsw_ax(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1058 __ testl(rax, 0x400); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1059 __ jcc(Assembler::notZero, L); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1060 __ fxch(1); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1061 __ fpop(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1062 __ fstp_d(Address(rsp, 0)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1063 __ movdbl(xmm0, Address(rsp, 0)); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1064 __ addptr(rsp, 8); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1065 __ ret(0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1066 break; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1067 } |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
1068 case monitorenter_id: { |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1069 Register obj = j_rarg0; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1070 Register lock = j_rarg1; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1071 { |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
1072 GraalStubFrame f(sasm, "monitorenter", dont_gc_arguments); |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1073 OopMap* map = save_live_registers(sasm, 2, save_fpu_registers); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1074 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1075 // Called with store_parameter and not C abi |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
1076 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, monitorenter), obj, lock); |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1077 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1078 oop_maps = new OopMapSet(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1079 oop_maps->add_gc_map(call_offset, map); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1080 restore_live_registers(sasm, save_fpu_registers); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1081 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1082 __ ret(0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1083 break; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1084 } |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
1085 case monitorexit_id: { |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1086 Register obj = j_rarg0; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1087 Register lock = j_rarg1; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1088 { |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
1089 GraalStubFrame f(sasm, "monitorexit", dont_gc_arguments); |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1090 OopMap* map = save_live_registers(sasm, 2, save_fpu_registers); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1091 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1092 // note: really a leaf routine but must setup last java sp |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1093 // => use call_RT for now (speed can be improved by |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1094 // doing last java sp setup manually) |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
1095 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, monitorexit), obj, lock); |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1096 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1097 oop_maps = new OopMapSet(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1098 oop_maps->add_gc_map(call_offset, map); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1099 restore_live_registers(sasm, save_fpu_registers); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1100 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1101 __ ret(0); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1102 break; |
8490
1567c6cc6561
Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8489
diff
changeset
|
1103 } |
8506 | 1104 case wb_pre_call_id: { |
8490
1567c6cc6561
Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8489
diff
changeset
|
1105 Register obj = j_rarg0; |
1567c6cc6561
Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8489
diff
changeset
|
1106 { |
8499
96a337d307bd
-More progress in G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8497
diff
changeset
|
1107 GraalStubFrame f(sasm, "graal_wb_pre_call", dont_gc_arguments); |
96a337d307bd
-More progress in G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8497
diff
changeset
|
1108 OopMap* map = save_live_registers(sasm, 2, save_fpu_registers); |
8490
1567c6cc6561
Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8489
diff
changeset
|
1109 |
1567c6cc6561
Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8489
diff
changeset
|
1110 // note: really a leaf routine but must setup last java sp |
1567c6cc6561
Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8489
diff
changeset
|
1111 // => use call_RT for now (speed can be improved by |
1567c6cc6561
Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8489
diff
changeset
|
1112 // doing last java sp setup manually) |
8506 | 1113 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, wb_pre_call), obj); |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1114 |
8499
96a337d307bd
-More progress in G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8497
diff
changeset
|
1115 oop_maps = new OopMapSet(); |
96a337d307bd
-More progress in G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8497
diff
changeset
|
1116 oop_maps->add_gc_map(call_offset, map); |
8502
ff4fa8b0516e
-Create push patch
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8499
diff
changeset
|
1117 restore_live_registers(sasm); |
8490
1567c6cc6561
Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8489
diff
changeset
|
1118 } |
1567c6cc6561
Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8489
diff
changeset
|
1119 __ ret(0); |
1567c6cc6561
Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8489
diff
changeset
|
1120 break; |
1567c6cc6561
Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8489
diff
changeset
|
1121 } |
8506 | 1122 case wb_post_call_id: { |
8490
1567c6cc6561
Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8489
diff
changeset
|
1123 Register obj = j_rarg0; |
8502
ff4fa8b0516e
-Create push patch
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8499
diff
changeset
|
1124 Register caddr = j_rarg1; |
8490
1567c6cc6561
Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8489
diff
changeset
|
1125 { |
8499
96a337d307bd
-More progress in G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8497
diff
changeset
|
1126 GraalStubFrame f(sasm, "graal_wb_post_call", dont_gc_arguments); |
96a337d307bd
-More progress in G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8497
diff
changeset
|
1127 OopMap* map = save_live_registers(sasm, 2, save_fpu_registers); |
8489
92d21814cf7b
-Implement WB primitive stub call for G1's slow path later
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
7386
diff
changeset
|
1128 |
8490
1567c6cc6561
Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8489
diff
changeset
|
1129 // note: really a leaf routine but must setup last java sp |
1567c6cc6561
Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8489
diff
changeset
|
1130 // => use call_RT for now (speed can be improved by |
1567c6cc6561
Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8489
diff
changeset
|
1131 // doing last java sp setup manually) |
8506 | 1132 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, wb_post_call), obj, caddr); |
8490
1567c6cc6561
Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8489
diff
changeset
|
1133 |
8499
96a337d307bd
-More progress in G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8497
diff
changeset
|
1134 oop_maps = new OopMapSet(); |
96a337d307bd
-More progress in G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8497
diff
changeset
|
1135 oop_maps->add_gc_map(call_offset, map); |
8502
ff4fa8b0516e
-Create push patch
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8499
diff
changeset
|
1136 restore_live_registers(sasm); |
8490
1567c6cc6561
Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8489
diff
changeset
|
1137 } |
1567c6cc6561
Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8489
diff
changeset
|
1138 __ ret(0); |
1567c6cc6561
Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8489
diff
changeset
|
1139 break; |
1567c6cc6561
Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8489
diff
changeset
|
1140 } |
8499
96a337d307bd
-More progress in G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8497
diff
changeset
|
1141 |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1142 |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
1143 case identity_hash_code_id: { |
7220
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7125
diff
changeset
|
1144 Register obj = j_rarg0; // Incoming |
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7125
diff
changeset
|
1145 __ set_info("identity_hash_code", dont_gc_arguments); |
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7125
diff
changeset
|
1146 __ enter(); |
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7125
diff
changeset
|
1147 OopMap* map = save_live_registers(sasm, 1); |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
1148 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, identity_hash_code), obj); |
7220
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7125
diff
changeset
|
1149 oop_maps = new OopMapSet(); |
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7125
diff
changeset
|
1150 oop_maps->add_gc_map(call_offset, map); |
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7125
diff
changeset
|
1151 restore_live_registers_except_rax(sasm); |
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7125
diff
changeset
|
1152 __ leave(); |
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7125
diff
changeset
|
1153 __ ret(0); |
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7125
diff
changeset
|
1154 break; |
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7125
diff
changeset
|
1155 } |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
1156 case thread_is_interrupted_id: { |
7220
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7125
diff
changeset
|
1157 Register thread = j_rarg0; |
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7125
diff
changeset
|
1158 Register clear_interrupted = j_rarg1; |
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7125
diff
changeset
|
1159 |
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7125
diff
changeset
|
1160 __ set_info("identity_hash_code", dont_gc_arguments); |
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7125
diff
changeset
|
1161 __ enter(); |
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7125
diff
changeset
|
1162 OopMap* map = save_live_registers(sasm, 1); |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7386
diff
changeset
|
1163 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, thread_is_interrupted), thread, clear_interrupted); |
7220
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7125
diff
changeset
|
1164 oop_maps = new OopMapSet(); |
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7125
diff
changeset
|
1165 oop_maps->add_gc_map(call_offset, map); |
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7125
diff
changeset
|
1166 restore_live_registers_except_rax(sasm); |
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7125
diff
changeset
|
1167 __ leave(); |
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7125
diff
changeset
|
1168 __ ret(0); |
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7125
diff
changeset
|
1169 break; |
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7125
diff
changeset
|
1170 } |
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7125
diff
changeset
|
1171 |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1172 default: |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1173 { GraalStubFrame f(sasm, "unimplemented entry", dont_gc_arguments); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1174 __ movptr(rax, (int)id); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1175 __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), rax); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1176 __ should_not_reach_here(); |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1177 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1178 break; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1179 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1180 return oop_maps; |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1181 } |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1182 |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1183 #undef __ |