comparison src/share/vm/opto/generateOptoStub.cpp @ 6804:e626685e9f6c

7193318: C2: remove number of inputs requirement from Node's new operator Summary: Deleted placement new operator of Node - node(size_t, Compile *, int). Reviewed-by: kvn, twisti Contributed-by: bharadwaj.yadavalli@oracle.com
author kvn
date Thu, 27 Sep 2012 09:38:42 -0700
parents f95d63e2154a
children b9a9ed0f8eeb
comparison
equal deleted inserted replaced
6803:06f52c4d0e18 6804:e626685e9f6c
48 48
49 const TypeTuple *jdomain = C->tf()->domain(); 49 const TypeTuple *jdomain = C->tf()->domain();
50 const TypeTuple *jrange = C->tf()->range(); 50 const TypeTuple *jrange = C->tf()->range();
51 51
52 // The procedure start 52 // The procedure start
53 StartNode* start = new (C, 2) StartNode(root(), jdomain); 53 StartNode* start = new (C) StartNode(root(), jdomain);
54 _gvn.set_type_bottom(start); 54 _gvn.set_type_bottom(start);
55 55
56 // Make a map, with JVM state 56 // Make a map, with JVM state
57 uint parm_cnt = jdomain->cnt(); 57 uint parm_cnt = jdomain->cnt();
58 uint max_map = MAX2(2*parm_cnt+1, jrange->cnt()); 58 uint max_map = MAX2(2*parm_cnt+1, jrange->cnt());
61 JVMState* jvms = new (C) JVMState(0); 61 JVMState* jvms = new (C) JVMState(0);
62 jvms->set_bci(InvocationEntryBci); 62 jvms->set_bci(InvocationEntryBci);
63 jvms->set_monoff(max_map); 63 jvms->set_monoff(max_map);
64 jvms->set_endoff(max_map); 64 jvms->set_endoff(max_map);
65 { 65 {
66 SafePointNode *map = new (C, max_map) SafePointNode( max_map, jvms ); 66 SafePointNode *map = new (C) SafePointNode( max_map, jvms );
67 jvms->set_map(map); 67 jvms->set_map(map);
68 set_jvms(jvms); 68 set_jvms(jvms);
69 assert(map == this->map(), "kit.map is set"); 69 assert(map == this->map(), "kit.map is set");
70 } 70 }
71 71
72 // Make up the parameters 72 // Make up the parameters
73 uint i; 73 uint i;
74 for( i = 0; i < parm_cnt; i++ ) 74 for( i = 0; i < parm_cnt; i++ )
75 map()->init_req(i, _gvn.transform(new (C, 1) ParmNode(start, i))); 75 map()->init_req(i, _gvn.transform(new (C) ParmNode(start, i)));
76 for( ; i<map()->req(); i++ ) 76 for( ; i<map()->req(); i++ )
77 map()->init_req(i, top()); // For nicer debugging 77 map()->init_req(i, top()); // For nicer debugging
78 78
79 // GraphKit requires memory to be a MergeMemNode: 79 // GraphKit requires memory to be a MergeMemNode:
80 set_all_memory(map()->memory()); 80 set_all_memory(map()->memory());
81 81
82 // Get base of thread-local storage area 82 // Get base of thread-local storage area
83 Node* thread = _gvn.transform( new (C, 1) ThreadLocalNode() ); 83 Node* thread = _gvn.transform( new (C) ThreadLocalNode() );
84 84
85 const int NoAlias = Compile::AliasIdxBot; 85 const int NoAlias = Compile::AliasIdxBot;
86 86
87 Node* adr_last_Java_pc = basic_plus_adr(top(), 87 Node* adr_last_Java_pc = basic_plus_adr(top(),
88 thread, 88 thread,
158 // Final C signature 158 // Final C signature
159 const TypeFunc *c_sig = TypeFunc::make(domain,range); 159 const TypeFunc *c_sig = TypeFunc::make(domain,range);
160 160
161 //----------------------------- 161 //-----------------------------
162 // Make the call node 162 // Make the call node
163 CallRuntimeNode *call = new (C, c_sig->domain()->cnt()) 163 CallRuntimeNode *call = new (C)
164 CallRuntimeNode(c_sig, C_function, name, TypePtr::BOTTOM); 164 CallRuntimeNode(c_sig, C_function, name, TypePtr::BOTTOM);
165 //----------------------------- 165 //-----------------------------
166 166
167 // Fix-up the debug info for the call 167 // Fix-up the debug info for the call
168 call->set_jvms( new (C) JVMState(0) ); 168 call->set_jvms( new (C) JVMState(0) );
184 _gvn.transform_no_reclaim(call); 184 _gvn.transform_no_reclaim(call);
185 185
186 186
187 //----------------------------- 187 //-----------------------------
188 // Now set up the return results 188 // Now set up the return results
189 set_control( _gvn.transform( new (C, 1) ProjNode(call,TypeFunc::Control)) ); 189 set_control( _gvn.transform( new (C) ProjNode(call,TypeFunc::Control)) );
190 set_i_o( _gvn.transform( new (C, 1) ProjNode(call,TypeFunc::I_O )) ); 190 set_i_o( _gvn.transform( new (C) ProjNode(call,TypeFunc::I_O )) );
191 set_all_memory_call(call); 191 set_all_memory_call(call);
192 if (range->cnt() > TypeFunc::Parms) { 192 if (range->cnt() > TypeFunc::Parms) {
193 Node* retnode = _gvn.transform( new (C, 1) ProjNode(call,TypeFunc::Parms) ); 193 Node* retnode = _gvn.transform( new (C) ProjNode(call,TypeFunc::Parms) );
194 // C-land is allowed to return sub-word values. Convert to integer type. 194 // C-land is allowed to return sub-word values. Convert to integer type.
195 assert( retval != Type::TOP, "" ); 195 assert( retval != Type::TOP, "" );
196 if (retval == TypeInt::BOOL) { 196 if (retval == TypeInt::BOOL) {
197 retnode = _gvn.transform( new (C, 3) AndINode(retnode, intcon(0xFF)) ); 197 retnode = _gvn.transform( new (C) AndINode(retnode, intcon(0xFF)) );
198 } else if (retval == TypeInt::CHAR) { 198 } else if (retval == TypeInt::CHAR) {
199 retnode = _gvn.transform( new (C, 3) AndINode(retnode, intcon(0xFFFF)) ); 199 retnode = _gvn.transform( new (C) AndINode(retnode, intcon(0xFFFF)) );
200 } else if (retval == TypeInt::BYTE) { 200 } else if (retval == TypeInt::BYTE) {
201 retnode = _gvn.transform( new (C, 3) LShiftINode(retnode, intcon(24)) ); 201 retnode = _gvn.transform( new (C) LShiftINode(retnode, intcon(24)) );
202 retnode = _gvn.transform( new (C, 3) RShiftINode(retnode, intcon(24)) ); 202 retnode = _gvn.transform( new (C) RShiftINode(retnode, intcon(24)) );
203 } else if (retval == TypeInt::SHORT) { 203 } else if (retval == TypeInt::SHORT) {
204 retnode = _gvn.transform( new (C, 3) LShiftINode(retnode, intcon(16)) ); 204 retnode = _gvn.transform( new (C) LShiftINode(retnode, intcon(16)) );
205 retnode = _gvn.transform( new (C, 3) RShiftINode(retnode, intcon(16)) ); 205 retnode = _gvn.transform( new (C) RShiftINode(retnode, intcon(16)) );
206 } 206 }
207 map()->set_req( TypeFunc::Parms, retnode ); 207 map()->set_req( TypeFunc::Parms, retnode );
208 } 208 }
209 209
210 //----------------------------- 210 //-----------------------------
245 Node* adr = basic_plus_adr(top(), thread, in_bytes(Thread::pending_exception_offset())); 245 Node* adr = basic_plus_adr(top(), thread, in_bytes(Thread::pending_exception_offset()));
246 Node* pending = make_load(NULL, adr, TypeOopPtr::BOTTOM, T_OBJECT, NoAlias, false); 246 Node* pending = make_load(NULL, adr, TypeOopPtr::BOTTOM, T_OBJECT, NoAlias, false);
247 247
248 Node* exit_memory = reset_memory(); 248 Node* exit_memory = reset_memory();
249 249
250 Node* cmp = _gvn.transform( new (C, 3) CmpPNode(pending, null()) ); 250 Node* cmp = _gvn.transform( new (C) CmpPNode(pending, null()) );
251 Node* bo = _gvn.transform( new (C, 2) BoolNode(cmp, BoolTest::ne) ); 251 Node* bo = _gvn.transform( new (C) BoolNode(cmp, BoolTest::ne) );
252 IfNode *iff = create_and_map_if(control(), bo, PROB_MIN, COUNT_UNKNOWN); 252 IfNode *iff = create_and_map_if(control(), bo, PROB_MIN, COUNT_UNKNOWN);
253 253
254 Node* if_null = _gvn.transform( new (C, 1) IfFalseNode(iff) ); 254 Node* if_null = _gvn.transform( new (C) IfFalseNode(iff) );
255 Node* if_not_null = _gvn.transform( new (C, 1) IfTrueNode(iff) ); 255 Node* if_not_null = _gvn.transform( new (C) IfTrueNode(iff) );
256 256
257 assert (StubRoutines::forward_exception_entry() != NULL, "must be generated before"); 257 assert (StubRoutines::forward_exception_entry() != NULL, "must be generated before");
258 Node *exc_target = makecon(TypeRawPtr::make( StubRoutines::forward_exception_entry() )); 258 Node *exc_target = makecon(TypeRawPtr::make( StubRoutines::forward_exception_entry() ));
259 Node *to_exc = new (C, TypeFunc::Parms+2) TailCallNode(if_not_null, 259 Node *to_exc = new (C) TailCallNode(if_not_null,
260 i_o(), 260 i_o(),
261 exit_memory, 261 exit_memory,
262 frameptr(), 262 frameptr(),
263 returnadr(), 263 returnadr(),
264 exc_target, null()); 264 exc_target, null());
265 root()->add_req(_gvn.transform(to_exc)); // bind to root to keep live 265 root()->add_req(_gvn.transform(to_exc)); // bind to root to keep live
266 C->init_start(start); 266 C->init_start(start);
267 267
268 //----------------------------- 268 //-----------------------------
269 // If this is a normal subroutine return, issue the return and be done. 269 // If this is a normal subroutine return, issue the return and be done.
270 Node *ret; 270 Node *ret;
271 switch( is_fancy_jump ) { 271 switch( is_fancy_jump ) {
272 case 0: // Make a return instruction 272 case 0: // Make a return instruction
273 // Return to caller, free any space for return address 273 // Return to caller, free any space for return address
274 ret = new (C, TypeFunc::Parms) ReturnNode(TypeFunc::Parms, if_null, 274 ret = new (C) ReturnNode(TypeFunc::Parms, if_null,
275 i_o(), 275 i_o(),
276 exit_memory, 276 exit_memory,
277 frameptr(), 277 frameptr(),
278 returnadr()); 278 returnadr());
279 if (C->tf()->range()->cnt() > TypeFunc::Parms) 279 if (C->tf()->range()->cnt() > TypeFunc::Parms)
280 ret->add_req( map()->in(TypeFunc::Parms) ); 280 ret->add_req( map()->in(TypeFunc::Parms) );
281 break; 281 break;
282 case 1: // This is a fancy tail-call jump. Jump to computed address. 282 case 1: // This is a fancy tail-call jump. Jump to computed address.
283 // Jump to new callee; leave old return address alone. 283 // Jump to new callee; leave old return address alone.
284 ret = new (C, TypeFunc::Parms+2) TailCallNode(if_null, 284 ret = new (C) TailCallNode(if_null,
285 i_o(), 285 i_o(),
286 exit_memory, 286 exit_memory,
287 frameptr(), 287 frameptr(),
288 returnadr(), 288 returnadr(),
289 target, map()->in(TypeFunc::Parms)); 289 target, map()->in(TypeFunc::Parms));
290 break; 290 break;
291 case 2: // Pop return address & jump 291 case 2: // Pop return address & jump
292 // Throw away old return address; jump to new computed address 292 // Throw away old return address; jump to new computed address
293 //assert(C_function == CAST_FROM_FN_PTR(address, OptoRuntime::rethrow_C), "fancy_jump==2 only for rethrow"); 293 //assert(C_function == CAST_FROM_FN_PTR(address, OptoRuntime::rethrow_C), "fancy_jump==2 only for rethrow");
294 ret = new (C, TypeFunc::Parms+2) TailJumpNode(if_null, 294 ret = new (C) TailJumpNode(if_null,
295 i_o(), 295 i_o(),
296 exit_memory, 296 exit_memory,
297 frameptr(), 297 frameptr(),
298 target, map()->in(TypeFunc::Parms)); 298 target, map()->in(TypeFunc::Parms));
299 break; 299 break;
300 default: 300 default:
301 ShouldNotReachHere(); 301 ShouldNotReachHere();
302 } 302 }
303 root()->add_req(_gvn.transform(ret)); 303 root()->add_req(_gvn.transform(ret));