comparison src/share/vm/opto/generateOptoStub.cpp @ 14909:4ca6dc0799b6

Backout jdk9 merge
author Gilles Duboscq <duboscq@ssw.jku.at>
date Tue, 01 Apr 2014 13:57:07 +0200
parents abec000618bf
children 89152779163c
comparison
equal deleted inserted replaced
14908:8db6e76cb658 14909:4ca6dc0799b6
1 /* 1 /*
2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
102 // as soon as last_Java_sp != NULL the has_last_Java_frame is true and 102 // as soon as last_Java_sp != NULL the has_last_Java_frame is true and
103 // users will look at the other fields. 103 // users will look at the other fields.
104 // 104 //
105 Node *adr_sp = basic_plus_adr(top(), thread, in_bytes(JavaThread::last_Java_sp_offset())); 105 Node *adr_sp = basic_plus_adr(top(), thread, in_bytes(JavaThread::last_Java_sp_offset()));
106 Node *last_sp = basic_plus_adr(top(), frameptr(), (intptr_t) STACK_BIAS); 106 Node *last_sp = basic_plus_adr(top(), frameptr(), (intptr_t) STACK_BIAS);
107 store_to_memory(NULL, adr_sp, last_sp, T_ADDRESS, NoAlias, MemNode::unordered); 107 store_to_memory(NULL, adr_sp, last_sp, T_ADDRESS, NoAlias);
108 108
109 // Set _thread_in_native 109 // Set _thread_in_native
110 // The order of stores into TLS is critical! Setting _thread_in_native MUST 110 // The order of stores into TLS is critical! Setting _thread_in_native MUST
111 // be last, because a GC is allowed at any time after setting it and the GC 111 // be last, because a GC is allowed at any time after setting it and the GC
112 // will require last_Java_pc and last_Java_sp. 112 // will require last_Java_pc and last_Java_sp.
113 Node* adr_state = basic_plus_adr(top(), thread, in_bytes(JavaThread::thread_state_offset()));
113 114
114 //----------------------------- 115 //-----------------------------
115 // Compute signature for C call. Varies from the Java signature! 116 // Compute signature for C call. Varies from the Java signature!
116 const Type **fields = TypeTuple::fields(2*parm_cnt+2); 117 const Type **fields = TypeTuple::fields(2*parm_cnt+2);
117 uint cnt = TypeFunc::Parms; 118 uint cnt = TypeFunc::Parms;
118 // The C routines gets the base of thread-local storage passed in as an 119 // The C routines gets the base of thread-local storage passed in as an
119 // extra argument. Not all calls need it, but its cheap to add here. 120 // extra argument. Not all calls need it, but its cheap to add here.
120 for (uint pcnt = cnt; pcnt < parm_cnt; pcnt++, cnt++) { 121 for( ; cnt<parm_cnt; cnt++ )
121 // Convert ints to longs if required. 122 fields[cnt] = jdomain->field_at(cnt);
122 if (CCallingConventionRequiresIntsAsLongs && jdomain->field_at(pcnt)->isa_int()) {
123 fields[cnt++] = TypeLong::LONG;
124 fields[cnt] = Type::HALF; // must add an additional half for a long
125 } else {
126 fields[cnt] = jdomain->field_at(pcnt);
127 }
128 }
129
130 fields[cnt++] = TypeRawPtr::BOTTOM; // Thread-local storage 123 fields[cnt++] = TypeRawPtr::BOTTOM; // Thread-local storage
131 // Also pass in the caller's PC, if asked for. 124 // Also pass in the caller's PC, if asked for.
132 if( return_pc ) 125 if( return_pc )
133 fields[cnt++] = TypeRawPtr::BOTTOM; // Return PC 126 fields[cnt++] = TypeRawPtr::BOTTOM; // Return PC
134 127
175 call->jvms()->set_bci(0); 168 call->jvms()->set_bci(0);
176 call->jvms()->set_offsets(cnt); 169 call->jvms()->set_offsets(cnt);
177 170
178 // Set fixed predefined input arguments 171 // Set fixed predefined input arguments
179 cnt = 0; 172 cnt = 0;
180 for (i = 0; i < TypeFunc::Parms; i++) 173 for( i=0; i<TypeFunc::Parms; i++ )
181 call->init_req(cnt++, map()->in(i)); 174 call->init_req( cnt++, map()->in(i) );
182 // A little too aggressive on the parm copy; return address is not an input 175 // A little too aggressive on the parm copy; return address is not an input
183 call->set_req(TypeFunc::ReturnAdr, top()); 176 call->set_req(TypeFunc::ReturnAdr, top());
184 for (; i < parm_cnt; i++) { // Regular input arguments 177 for( ; i<parm_cnt; i++ ) // Regular input arguments
185 // Convert ints to longs if required. 178 call->init_req( cnt++, map()->in(i) );
186 if (CCallingConventionRequiresIntsAsLongs && jdomain->field_at(i)->isa_int()) {
187 Node* int_as_long = _gvn.transform(new (C) ConvI2LNode(map()->in(i)));
188 call->init_req(cnt++, int_as_long); // long
189 call->init_req(cnt++, top()); // half
190 } else {
191 call->init_req(cnt++, map()->in(i));
192 }
193 }
194 179
195 call->init_req( cnt++, thread ); 180 call->init_req( cnt++, thread );
196 if( return_pc ) // Return PC, if asked for 181 if( return_pc ) // Return PC, if asked for
197 call->init_req( cnt++, returnadr() ); 182 call->init_req( cnt++, returnadr() );
198 _gvn.transform_no_reclaim(call); 183 _gvn.transform_no_reclaim(call);
222 } 207 }
223 208
224 //----------------------------- 209 //-----------------------------
225 210
226 // Clear last_Java_sp 211 // Clear last_Java_sp
227 store_to_memory(NULL, adr_sp, null(), T_ADDRESS, NoAlias, MemNode::unordered); 212 store_to_memory(NULL, adr_sp, null(), T_ADDRESS, NoAlias);
228 // Clear last_Java_pc and (optionally)_flags 213 // Clear last_Java_pc and (optionally)_flags
229 store_to_memory(NULL, adr_last_Java_pc, null(), T_ADDRESS, NoAlias, MemNode::unordered); 214 store_to_memory(NULL, adr_last_Java_pc, null(), T_ADDRESS, NoAlias);
230 #if defined(SPARC) 215 #if defined(SPARC)
231 store_to_memory(NULL, adr_flags, intcon(0), T_INT, NoAlias, MemNode::unordered); 216 store_to_memory(NULL, adr_flags, intcon(0), T_INT, NoAlias);
232 #endif /* defined(SPARC) */ 217 #endif /* defined(SPARC) */
233 #if (defined(IA64) && !defined(AIX)) 218 #ifdef IA64
234 Node* adr_last_Java_fp = basic_plus_adr(top(), thread, in_bytes(JavaThread::last_Java_fp_offset())); 219 Node* adr_last_Java_fp = basic_plus_adr(top(), thread, in_bytes(JavaThread::last_Java_fp_offset()));
235 store_to_memory(NULL, adr_last_Java_fp, null(), T_ADDRESS, NoAlias, MemNode::unordered); 220 if( os::is_MP() ) insert_mem_bar(Op_MemBarRelease);
221 store_to_memory(NULL, adr_last_Java_fp, null(), T_ADDRESS, NoAlias);
236 #endif 222 #endif
237 223
238 // For is-fancy-jump, the C-return value is also the branch target 224 // For is-fancy-jump, the C-return value is also the branch target
239 Node* target = map()->in(TypeFunc::Parms); 225 Node* target = map()->in(TypeFunc::Parms);
240 // Runtime call returning oop in TLS? Fetch it out 226 // Runtime call returning oop in TLS? Fetch it out
241 if( pass_tls ) { 227 if( pass_tls ) {
242 Node* adr = basic_plus_adr(top(), thread, in_bytes(JavaThread::vm_result_offset())); 228 Node* adr = basic_plus_adr(top(), thread, in_bytes(JavaThread::vm_result_offset()));
243 Node* vm_result = make_load(NULL, adr, TypeOopPtr::BOTTOM, T_OBJECT, NoAlias, MemNode::unordered); 229 Node* vm_result = make_load(NULL, adr, TypeOopPtr::BOTTOM, T_OBJECT, NoAlias, false);
244 map()->set_req(TypeFunc::Parms, vm_result); // vm_result passed as result 230 map()->set_req(TypeFunc::Parms, vm_result); // vm_result passed as result
245 // clear thread-local-storage(tls) 231 // clear thread-local-storage(tls)
246 store_to_memory(NULL, adr, null(), T_ADDRESS, NoAlias, MemNode::unordered); 232 store_to_memory(NULL, adr, null(), T_ADDRESS, NoAlias);
247 } 233 }
248 234
249 //----------------------------- 235 //-----------------------------
250 // check exception 236 // check exception
251 Node* adr = basic_plus_adr(top(), thread, in_bytes(Thread::pending_exception_offset())); 237 Node* adr = basic_plus_adr(top(), thread, in_bytes(Thread::pending_exception_offset()));
252 Node* pending = make_load(NULL, adr, TypeOopPtr::BOTTOM, T_OBJECT, NoAlias, MemNode::unordered); 238 Node* pending = make_load(NULL, adr, TypeOopPtr::BOTTOM, T_OBJECT, NoAlias, false);
253 239
254 Node* exit_memory = reset_memory(); 240 Node* exit_memory = reset_memory();
255 241
256 Node* cmp = _gvn.transform( new (C) CmpPNode(pending, null()) ); 242 Node* cmp = _gvn.transform( new (C) CmpPNode(pending, null()) );
257 Node* bo = _gvn.transform( new (C) BoolNode(cmp, BoolTest::ne) ); 243 Node* bo = _gvn.transform( new (C) BoolNode(cmp, BoolTest::ne) );