author | redestad |
Thu, 14 Nov 2019 15:24:35 +0100 | |
changeset 59081 | 95a99e617f28 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
37248 | 2 |
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
37248 | 26 |
#include "memory/resourceArea.hpp" |
7397 | 27 |
#include "opto/addnode.hpp" |
28 |
#include "opto/callnode.hpp" |
|
29 |
#include "opto/cfgnode.hpp" |
|
30 |
#include "opto/compile.hpp" |
|
23528 | 31 |
#include "opto/convertnode.hpp" |
7397 | 32 |
#include "opto/locknode.hpp" |
33 |
#include "opto/memnode.hpp" |
|
34 |
#include "opto/mulnode.hpp" |
|
35 |
#include "opto/node.hpp" |
|
36 |
#include "opto/parse.hpp" |
|
37 |
#include "opto/phaseX.hpp" |
|
38 |
#include "opto/rootnode.hpp" |
|
39 |
#include "opto/runtime.hpp" |
|
40 |
#include "opto/type.hpp" |
|
1 | 41 |
|
42 |
//--------------------gen_stub------------------------------- |
|
43 |
void GraphKit::gen_stub(address C_function, |
|
44 |
const char *name, |
|
45 |
int is_fancy_jump, |
|
46 |
bool pass_tls, |
|
47 |
bool return_pc) { |
|
48 |
ResourceMark rm; |
|
49 |
||
50 |
const TypeTuple *jdomain = C->tf()->domain(); |
|
51 |
const TypeTuple *jrange = C->tf()->range(); |
|
52 |
||
53 |
// The procedure start |
|
24923
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
54 |
StartNode* start = new StartNode(root(), jdomain); |
1 | 55 |
_gvn.set_type_bottom(start); |
56 |
||
57 |
// Make a map, with JVM state |
|
58 |
uint parm_cnt = jdomain->cnt(); |
|
59 |
uint max_map = MAX2(2*parm_cnt+1, jrange->cnt()); |
|
60 |
// %%% SynchronizationEntryBCI is redundant; use InvocationEntryBci in interfaces |
|
61 |
assert(SynchronizationEntryBCI == InvocationEntryBci, ""); |
|
62 |
JVMState* jvms = new (C) JVMState(0); |
|
63 |
jvms->set_bci(InvocationEntryBci); |
|
64 |
jvms->set_monoff(max_map); |
|
19708
64e8c91f5f3e
8012972: Incremental Inlining should support scalar replaced object in debug info
kvn
parents:
15475
diff
changeset
|
65 |
jvms->set_scloff(max_map); |
1 | 66 |
jvms->set_endoff(max_map); |
67 |
{ |
|
24923
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
68 |
SafePointNode *map = new SafePointNode( max_map, jvms ); |
1 | 69 |
jvms->set_map(map); |
70 |
set_jvms(jvms); |
|
71 |
assert(map == this->map(), "kit.map is set"); |
|
72 |
} |
|
73 |
||
74 |
// Make up the parameters |
|
75 |
uint i; |
|
35112
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
76 |
for (i = 0; i < parm_cnt; i++) { |
24923
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
77 |
map()->init_req(i, _gvn.transform(new ParmNode(start, i))); |
35112
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
78 |
} |
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
79 |
for ( ; i<map()->req(); i++) { |
1 | 80 |
map()->init_req(i, top()); // For nicer debugging |
35112
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
81 |
} |
1 | 82 |
|
83 |
// GraphKit requires memory to be a MergeMemNode: |
|
84 |
set_all_memory(map()->memory()); |
|
85 |
||
86 |
// Get base of thread-local storage area |
|
35112
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
87 |
Node* thread = _gvn.transform(new ThreadLocalNode()); |
1 | 88 |
|
89 |
const int NoAlias = Compile::AliasIdxBot; |
|
90 |
||
91 |
Node* adr_last_Java_pc = basic_plus_adr(top(), |
|
92 |
thread, |
|
93 |
in_bytes(JavaThread::frame_anchor_offset()) + |
|
94 |
in_bytes(JavaFrameAnchor::last_Java_pc_offset())); |
|
15475 | 95 |
#if defined(SPARC) |
1 | 96 |
Node* adr_flags = basic_plus_adr(top(), |
97 |
thread, |
|
98 |
in_bytes(JavaThread::frame_anchor_offset()) + |
|
99 |
in_bytes(JavaFrameAnchor::flags_offset())); |
|
15475 | 100 |
#endif /* defined(SPARC) */ |
1 | 101 |
|
102 |
||
103 |
// Drop in the last_Java_sp. last_Java_fp is not touched. |
|
104 |
// Always do this after the other "last_Java_frame" fields are set since |
|
105 |
// as soon as last_Java_sp != NULL the has_last_Java_frame is true and |
|
106 |
// users will look at the other fields. |
|
107 |
// |
|
108 |
Node *adr_sp = basic_plus_adr(top(), thread, in_bytes(JavaThread::last_Java_sp_offset())); |
|
109 |
Node *last_sp = basic_plus_adr(top(), frameptr(), (intptr_t) STACK_BIAS); |
|
22845
d8812d0ff387
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
22838
diff
changeset
|
110 |
store_to_memory(NULL, adr_sp, last_sp, T_ADDRESS, NoAlias, MemNode::unordered); |
1 | 111 |
|
112 |
// Set _thread_in_native |
|
113 |
// The order of stores into TLS is critical! Setting _thread_in_native MUST |
|
114 |
// be last, because a GC is allowed at any time after setting it and the GC |
|
115 |
// will require last_Java_pc and last_Java_sp. |
|
116 |
||
117 |
//----------------------------- |
|
118 |
// Compute signature for C call. Varies from the Java signature! |
|
35112
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
119 |
|
1 | 120 |
const Type **fields = TypeTuple::fields(2*parm_cnt+2); |
121 |
uint cnt = TypeFunc::Parms; |
|
122 |
// The C routines gets the base of thread-local storage passed in as an |
|
35112
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
123 |
// extra argument. Not all calls need it, but it is cheap to add here. |
22834
3e2df6a4a28c
8024342: PPC64 (part 111): Support for C calling conventions that require 64-bit ints.
goetz
parents:
22819
diff
changeset
|
124 |
for (uint pcnt = cnt; pcnt < parm_cnt; pcnt++, cnt++) { |
35112
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
125 |
const Type *f = jdomain->field_at(pcnt); |
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
126 |
if (CCallingConventionRequiresIntsAsLongs && f->isa_int()) { |
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
127 |
fields[cnt++] = TypeLong::LONG; |
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
128 |
fields[cnt] = Type::HALF; // Must add an additional half for a long. |
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
129 |
} else { |
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
130 |
fields[cnt] = f; |
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
131 |
} |
22834
3e2df6a4a28c
8024342: PPC64 (part 111): Support for C calling conventions that require 64-bit ints.
goetz
parents:
22819
diff
changeset
|
132 |
} |
1 | 133 |
fields[cnt++] = TypeRawPtr::BOTTOM; // Thread-local storage |
134 |
// Also pass in the caller's PC, if asked for. |
|
31590
427d073af867
8086069: Adapt runtime calls to recent intrinsics to pass ints as long
goetz
parents:
24923
diff
changeset
|
135 |
if (return_pc) { |
1 | 136 |
fields[cnt++] = TypeRawPtr::BOTTOM; // Return PC |
31590
427d073af867
8086069: Adapt runtime calls to recent intrinsics to pass ints as long
goetz
parents:
24923
diff
changeset
|
137 |
} |
35112
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
138 |
const TypeTuple* domain = TypeTuple::make(cnt, fields); |
1 | 139 |
|
140 |
// The C routine we are about to call cannot return an oop; it can block on |
|
141 |
// exit and a GC will trash the oop while it sits in C-land. Instead, we |
|
142 |
// return the oop through TLS for runtime calls. |
|
143 |
// Also, C routines returning integer subword values leave the high |
|
144 |
// order bits dirty; these must be cleaned up by explicit sign extension. |
|
145 |
const Type* retval = (jrange->cnt() == TypeFunc::Parms) ? Type::TOP : jrange->field_at(TypeFunc::Parms); |
|
146 |
// Make a private copy of jrange->fields(); |
|
147 |
const Type **rfields = TypeTuple::fields(jrange->cnt() - TypeFunc::Parms); |
|
148 |
// Fixup oop returns |
|
149 |
int retval_ptr = retval->isa_oop_ptr(); |
|
31590
427d073af867
8086069: Adapt runtime calls to recent intrinsics to pass ints as long
goetz
parents:
24923
diff
changeset
|
150 |
if (retval_ptr) { |
1 | 151 |
assert( pass_tls, "Oop must be returned thru TLS" ); |
152 |
// Fancy-jumps return address; others return void |
|
153 |
rfields[TypeFunc::Parms] = is_fancy_jump ? TypeRawPtr::BOTTOM : Type::TOP; |
|
154 |
||
31590
427d073af867
8086069: Adapt runtime calls to recent intrinsics to pass ints as long
goetz
parents:
24923
diff
changeset
|
155 |
} else if (retval->isa_int()) { // Returning any integer subtype? |
1 | 156 |
// "Fatten" byte, char & short return types to 'int' to show that |
157 |
// the native C code can return values with junk high order bits. |
|
158 |
// We'll sign-extend it below later. |
|
159 |
rfields[TypeFunc::Parms] = TypeInt::INT; // It's "dirty" and needs sign-ext |
|
160 |
||
31590
427d073af867
8086069: Adapt runtime calls to recent intrinsics to pass ints as long
goetz
parents:
24923
diff
changeset
|
161 |
} else if (jrange->cnt() >= TypeFunc::Parms+1) { // Else copy other types |
1 | 162 |
rfields[TypeFunc::Parms] = jrange->field_at(TypeFunc::Parms); |
31590
427d073af867
8086069: Adapt runtime calls to recent intrinsics to pass ints as long
goetz
parents:
24923
diff
changeset
|
163 |
if (jrange->cnt() == TypeFunc::Parms+2) { |
1 | 164 |
rfields[TypeFunc::Parms+1] = jrange->field_at(TypeFunc::Parms+1); |
31590
427d073af867
8086069: Adapt runtime calls to recent intrinsics to pass ints as long
goetz
parents:
24923
diff
changeset
|
165 |
} |
1 | 166 |
} |
35112
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
167 |
const TypeTuple* range = TypeTuple::make(jrange->cnt(), rfields); |
1 | 168 |
|
169 |
// Final C signature |
|
35112
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
170 |
const TypeFunc *c_sig = TypeFunc::make(domain, range); |
1 | 171 |
|
172 |
//----------------------------- |
|
35112
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
173 |
// Make the call node. |
24923
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
174 |
CallRuntimeNode *call = new CallRuntimeNode(c_sig, C_function, name, TypePtr::BOTTOM); |
1 | 175 |
//----------------------------- |
176 |
||
35112
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
177 |
// Fix-up the debug info for the call. |
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
178 |
call->set_jvms(new (C) JVMState(0)); |
1 | 179 |
call->jvms()->set_bci(0); |
180 |
call->jvms()->set_offsets(cnt); |
|
181 |
||
35112
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
182 |
// Set fixed predefined input arguments. |
1 | 183 |
cnt = 0; |
35112
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
184 |
for (i = 0; i < TypeFunc::Parms; i++) { |
31590
427d073af867
8086069: Adapt runtime calls to recent intrinsics to pass ints as long
goetz
parents:
24923
diff
changeset
|
185 |
call->init_req(cnt++, map()->in(i)); |
22834
3e2df6a4a28c
8024342: PPC64 (part 111): Support for C calling conventions that require 64-bit ints.
goetz
parents:
22819
diff
changeset
|
186 |
} |
35112
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
187 |
// A little too aggressive on the parm copy; return address is not an input. |
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
188 |
call->set_req(TypeFunc::ReturnAdr, top()); |
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
189 |
for (; i < parm_cnt; i++) { // Regular input arguments. |
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
190 |
const Type *f = jdomain->field_at(i); |
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
191 |
if (CCallingConventionRequiresIntsAsLongs && f->isa_int()) { |
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
192 |
call->init_req(cnt++, _gvn.transform(new ConvI2LNode(map()->in(i)))); |
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
193 |
call->init_req(cnt++, top()); |
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
194 |
} else { |
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
195 |
call->init_req(cnt++, map()->in(i)); |
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
196 |
} |
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
197 |
} |
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
198 |
call->init_req(cnt++, thread); |
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
199 |
if (return_pc) { // Return PC, if asked for. |
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
200 |
call->init_req(cnt++, returnadr()); |
b3c4347bb751
8144466: ppc64: fix argument passing through opto stubs.
goetz
parents:
33589
diff
changeset
|
201 |
} |
1 | 202 |
|
203 |
_gvn.transform_no_reclaim(call); |
|
204 |
||
205 |
//----------------------------- |
|
206 |
// Now set up the return results |
|
24923
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
207 |
set_control( _gvn.transform( new ProjNode(call,TypeFunc::Control)) ); |
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
208 |
set_i_o( _gvn.transform( new ProjNode(call,TypeFunc::I_O )) ); |
1 | 209 |
set_all_memory_call(call); |
210 |
if (range->cnt() > TypeFunc::Parms) { |
|
24923
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
211 |
Node* retnode = _gvn.transform( new ProjNode(call,TypeFunc::Parms) ); |
1 | 212 |
// C-land is allowed to return sub-word values. Convert to integer type. |
213 |
assert( retval != Type::TOP, "" ); |
|
214 |
if (retval == TypeInt::BOOL) { |
|
24923
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
215 |
retnode = _gvn.transform( new AndINode(retnode, intcon(0xFF)) ); |
1 | 216 |
} else if (retval == TypeInt::CHAR) { |
24923
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
217 |
retnode = _gvn.transform( new AndINode(retnode, intcon(0xFFFF)) ); |
1 | 218 |
} else if (retval == TypeInt::BYTE) { |
24923
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
219 |
retnode = _gvn.transform( new LShiftINode(retnode, intcon(24)) ); |
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
220 |
retnode = _gvn.transform( new RShiftINode(retnode, intcon(24)) ); |
1 | 221 |
} else if (retval == TypeInt::SHORT) { |
24923
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
222 |
retnode = _gvn.transform( new LShiftINode(retnode, intcon(16)) ); |
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
223 |
retnode = _gvn.transform( new RShiftINode(retnode, intcon(16)) ); |
1 | 224 |
} |
225 |
map()->set_req( TypeFunc::Parms, retnode ); |
|
226 |
} |
|
227 |
||
228 |
//----------------------------- |
|
229 |
||
230 |
// Clear last_Java_sp |
|
22845
d8812d0ff387
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
22838
diff
changeset
|
231 |
store_to_memory(NULL, adr_sp, null(), T_ADDRESS, NoAlias, MemNode::unordered); |
1 | 232 |
// Clear last_Java_pc and (optionally)_flags |
22845
d8812d0ff387
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
22838
diff
changeset
|
233 |
store_to_memory(NULL, adr_last_Java_pc, null(), T_ADDRESS, NoAlias, MemNode::unordered); |
15475 | 234 |
#if defined(SPARC) |
22845
d8812d0ff387
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
22838
diff
changeset
|
235 |
store_to_memory(NULL, adr_flags, intcon(0), T_INT, NoAlias, MemNode::unordered); |
15475 | 236 |
#endif /* defined(SPARC) */ |
22819
f88b9c394e42
8019973: PPC64 (part 11): Fix IA64 preprocessor conditionals on AIX.
goetz
parents:
15475
diff
changeset
|
237 |
#if (defined(IA64) && !defined(AIX)) |
1 | 238 |
Node* adr_last_Java_fp = basic_plus_adr(top(), thread, in_bytes(JavaThread::last_Java_fp_offset())); |
22845
d8812d0ff387
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
22838
diff
changeset
|
239 |
store_to_memory(NULL, adr_last_Java_fp, null(), T_ADDRESS, NoAlias, MemNode::unordered); |
1 | 240 |
#endif |
241 |
||
242 |
// For is-fancy-jump, the C-return value is also the branch target |
|
243 |
Node* target = map()->in(TypeFunc::Parms); |
|
244 |
// Runtime call returning oop in TLS? Fetch it out |
|
245 |
if( pass_tls ) { |
|
246 |
Node* adr = basic_plus_adr(top(), thread, in_bytes(JavaThread::vm_result_offset())); |
|
22845
d8812d0ff387
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
22838
diff
changeset
|
247 |
Node* vm_result = make_load(NULL, adr, TypeOopPtr::BOTTOM, T_OBJECT, NoAlias, MemNode::unordered); |
1 | 248 |
map()->set_req(TypeFunc::Parms, vm_result); // vm_result passed as result |
249 |
// clear thread-local-storage(tls) |
|
22845
d8812d0ff387
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
22838
diff
changeset
|
250 |
store_to_memory(NULL, adr, null(), T_ADDRESS, NoAlias, MemNode::unordered); |
1 | 251 |
} |
252 |
||
253 |
//----------------------------- |
|
254 |
// check exception |
|
255 |
Node* adr = basic_plus_adr(top(), thread, in_bytes(Thread::pending_exception_offset())); |
|
22845
d8812d0ff387
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
22838
diff
changeset
|
256 |
Node* pending = make_load(NULL, adr, TypeOopPtr::BOTTOM, T_OBJECT, NoAlias, MemNode::unordered); |
1 | 257 |
|
258 |
Node* exit_memory = reset_memory(); |
|
259 |
||
24923
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
260 |
Node* cmp = _gvn.transform( new CmpPNode(pending, null()) ); |
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
261 |
Node* bo = _gvn.transform( new BoolNode(cmp, BoolTest::ne) ); |
1 | 262 |
IfNode *iff = create_and_map_if(control(), bo, PROB_MIN, COUNT_UNKNOWN); |
263 |
||
24923
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
264 |
Node* if_null = _gvn.transform( new IfFalseNode(iff) ); |
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
265 |
Node* if_not_null = _gvn.transform( new IfTrueNode(iff) ); |
1 | 266 |
|
267 |
assert (StubRoutines::forward_exception_entry() != NULL, "must be generated before"); |
|
268 |
Node *exc_target = makecon(TypeRawPtr::make( StubRoutines::forward_exception_entry() )); |
|
24923
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
269 |
Node *to_exc = new TailCallNode(if_not_null, |
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
270 |
i_o(), |
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
271 |
exit_memory, |
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
272 |
frameptr(), |
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
273 |
returnadr(), |
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
274 |
exc_target, null()); |
1 | 275 |
root()->add_req(_gvn.transform(to_exc)); // bind to root to keep live |
276 |
C->init_start(start); |
|
277 |
||
278 |
//----------------------------- |
|
279 |
// If this is a normal subroutine return, issue the return and be done. |
|
33589
7cbd1b2c139b
8139040: Fix initializations before ShouldNotReachHere() etc. and enable -Wuninitialized on linux.
goetz
parents:
31590
diff
changeset
|
280 |
Node *ret = NULL; |
1 | 281 |
switch( is_fancy_jump ) { |
282 |
case 0: // Make a return instruction |
|
283 |
// Return to caller, free any space for return address |
|
24923
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
284 |
ret = new ReturnNode(TypeFunc::Parms, if_null, |
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
285 |
i_o(), |
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
286 |
exit_memory, |
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
287 |
frameptr(), |
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
288 |
returnadr()); |
1 | 289 |
if (C->tf()->range()->cnt() > TypeFunc::Parms) |
290 |
ret->add_req( map()->in(TypeFunc::Parms) ); |
|
291 |
break; |
|
292 |
case 1: // This is a fancy tail-call jump. Jump to computed address. |
|
293 |
// Jump to new callee; leave old return address alone. |
|
24923
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
294 |
ret = new TailCallNode(if_null, |
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
295 |
i_o(), |
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
296 |
exit_memory, |
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
297 |
frameptr(), |
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
298 |
returnadr(), |
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
299 |
target, map()->in(TypeFunc::Parms)); |
1 | 300 |
break; |
301 |
case 2: // Pop return address & jump |
|
302 |
// Throw away old return address; jump to new computed address |
|
303 |
//assert(C_function == CAST_FROM_FN_PTR(address, OptoRuntime::rethrow_C), "fancy_jump==2 only for rethrow"); |
|
24923
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23528
diff
changeset
|
304 |
ret = new TailJumpNode(if_null, |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
7397
diff
changeset
|
305 |
i_o(), |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
7397
diff
changeset
|
306 |
exit_memory, |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
7397
diff
changeset
|
307 |
frameptr(), |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
7397
diff
changeset
|
308 |
target, map()->in(TypeFunc::Parms)); |
1 | 309 |
break; |
310 |
default: |
|
311 |
ShouldNotReachHere(); |
|
312 |
} |
|
313 |
root()->add_req(_gvn.transform(ret)); |
|
314 |
} |