comparison src/share/vm/opto/parseHelper.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 da91efe96a93
children d8ce2825b193
comparison
equal deleted inserted replaced
6803:06f52c4d0e18 6804:e626685e9f6c
41 address call_address = is_entry ? CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry) : 41 address call_address = is_entry ? CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry) :
42 CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit); 42 CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit);
43 const char *call_name = is_entry ? "dtrace_method_entry" : "dtrace_method_exit"; 43 const char *call_name = is_entry ? "dtrace_method_entry" : "dtrace_method_exit";
44 44
45 // Get base of thread-local storage area 45 // Get base of thread-local storage area
46 Node* thread = _gvn.transform( new (C, 1) ThreadLocalNode() ); 46 Node* thread = _gvn.transform( new (C) ThreadLocalNode() );
47 47
48 // Get method 48 // Get method
49 const TypePtr* method_type = TypeMetadataPtr::make(method); 49 const TypePtr* method_type = TypeMetadataPtr::make(method);
50 Node *method_node = _gvn.transform( ConNode::make(C, method_type) ); 50 Node *method_node = _gvn.transform( ConNode::make(C, method_type) );
51 51
173 // Is the array klass is exactly its defined type? 173 // Is the array klass is exactly its defined type?
174 if (always_see_exact_class && !tak->klass_is_exact()) { 174 if (always_see_exact_class && !tak->klass_is_exact()) {
175 // Make a constant out of the inexact array klass 175 // Make a constant out of the inexact array klass
176 const TypeKlassPtr *extak = tak->cast_to_exactness(true)->is_klassptr(); 176 const TypeKlassPtr *extak = tak->cast_to_exactness(true)->is_klassptr();
177 Node* con = makecon(extak); 177 Node* con = makecon(extak);
178 Node* cmp = _gvn.transform(new (C, 3) CmpPNode( array_klass, con )); 178 Node* cmp = _gvn.transform(new (C) CmpPNode( array_klass, con ));
179 Node* bol = _gvn.transform(new (C, 2) BoolNode( cmp, BoolTest::eq )); 179 Node* bol = _gvn.transform(new (C) BoolNode( cmp, BoolTest::eq ));
180 Node* ctrl= control(); 180 Node* ctrl= control();
181 { BuildCutout unless(this, bol, PROB_MAX); 181 { BuildCutout unless(this, bol, PROB_MAX);
182 uncommon_trap(Deoptimization::Reason_array_check, 182 uncommon_trap(Deoptimization::Reason_array_check,
183 Deoptimization::Action_maybe_recompile, 183 Deoptimization::Action_maybe_recompile,
184 tak->klass()); 184 tak->klass());
213 void Parse::emit_guard_for_new(ciInstanceKlass* klass) { 213 void Parse::emit_guard_for_new(ciInstanceKlass* klass) {
214 // Emit guarded new 214 // Emit guarded new
215 // if (klass->_init_thread != current_thread || 215 // if (klass->_init_thread != current_thread ||
216 // klass->_init_state != being_initialized) 216 // klass->_init_state != being_initialized)
217 // uncommon_trap 217 // uncommon_trap
218 Node* cur_thread = _gvn.transform( new (C, 1) ThreadLocalNode() ); 218 Node* cur_thread = _gvn.transform( new (C) ThreadLocalNode() );
219 Node* merge = new (C, 3) RegionNode(3); 219 Node* merge = new (C) RegionNode(3);
220 _gvn.set_type(merge, Type::CONTROL); 220 _gvn.set_type(merge, Type::CONTROL);
221 Node* kls = makecon(TypeKlassPtr::make(klass)); 221 Node* kls = makecon(TypeKlassPtr::make(klass));
222 222
223 Node* init_thread_offset = _gvn.MakeConX(in_bytes(InstanceKlass::init_thread_offset())); 223 Node* init_thread_offset = _gvn.MakeConX(in_bytes(InstanceKlass::init_thread_offset()));
224 Node* adr_node = basic_plus_adr(kls, kls, init_thread_offset); 224 Node* adr_node = basic_plus_adr(kls, kls, init_thread_offset);
320 // This code is largely copied from the range check code in 320 // This code is largely copied from the range check code in
321 // array_addressing() 321 // array_addressing()
322 322
323 // Test invocation count vs threshold 323 // Test invocation count vs threshold
324 Node *threshold = makecon(TypeInt::make(limit)); 324 Node *threshold = makecon(TypeInt::make(limit));
325 Node *chk = _gvn.transform( new (C, 3) CmpUNode( cnt, threshold) ); 325 Node *chk = _gvn.transform( new (C) CmpUNode( cnt, threshold) );
326 BoolTest::mask btest = BoolTest::lt; 326 BoolTest::mask btest = BoolTest::lt;
327 Node *tst = _gvn.transform( new (C, 2) BoolNode( chk, btest) ); 327 Node *tst = _gvn.transform( new (C) BoolNode( chk, btest) );
328 // Branch to failure if threshold exceeded 328 // Branch to failure if threshold exceeded
329 { BuildCutout unless(this, tst, PROB_ALWAYS); 329 { BuildCutout unless(this, tst, PROB_ALWAYS);
330 uncommon_trap(Deoptimization::Reason_age, 330 uncommon_trap(Deoptimization::Reason_age,
331 Deoptimization::Action_maybe_recompile); 331 Deoptimization::Action_maybe_recompile);
332 } 332 }
346 Node* cnt = make_load(NULL, adr_node, TypeInt::INT, T_INT, adr_type); 346 Node* cnt = make_load(NULL, adr_node, TypeInt::INT, T_INT, adr_type);
347 347
348 test_counter_against_threshold(cnt, limit); 348 test_counter_against_threshold(cnt, limit);
349 349
350 // Add one to the counter and store 350 // Add one to the counter and store
351 Node* incr = _gvn.transform(new (C, 3) AddINode(cnt, _gvn.intcon(1))); 351 Node* incr = _gvn.transform(new (C) AddINode(cnt, _gvn.intcon(1)));
352 store_to_memory( NULL, adr_node, incr, T_INT, adr_type ); 352 store_to_memory( NULL, adr_node, incr, T_INT, adr_type );
353 } 353 }
354 354
355 //----------------------------method_data_addressing--------------------------- 355 //----------------------------method_data_addressing---------------------------
356 Node* Parse::method_data_addressing(ciMethodData* md, ciProfileData* data, ByteSize counter_offset, Node* idx, uint stride) { 356 Node* Parse::method_data_addressing(ciMethodData* md, ciProfileData* data, ByteSize counter_offset, Node* idx, uint stride) {
367 Node* mdo = makecon(adr_type); 367 Node* mdo = makecon(adr_type);
368 Node* ptr = basic_plus_adr(mdo, mdo, offset); 368 Node* ptr = basic_plus_adr(mdo, mdo, offset);
369 369
370 if (stride != 0) { 370 if (stride != 0) {
371 Node* str = _gvn.MakeConX(stride); 371 Node* str = _gvn.MakeConX(stride);
372 Node* scale = _gvn.transform( new (C, 3) MulXNode( idx, str ) ); 372 Node* scale = _gvn.transform( new (C) MulXNode( idx, str ) );
373 ptr = _gvn.transform( new (C, 4) AddPNode( mdo, ptr, scale ) ); 373 ptr = _gvn.transform( new (C) AddPNode( mdo, ptr, scale ) );
374 } 374 }
375 375
376 return ptr; 376 return ptr;
377 } 377 }
378 378
380 void Parse::increment_md_counter_at(ciMethodData* md, ciProfileData* data, ByteSize counter_offset, Node* idx, uint stride) { 380 void Parse::increment_md_counter_at(ciMethodData* md, ciProfileData* data, ByteSize counter_offset, Node* idx, uint stride) {
381 Node* adr_node = method_data_addressing(md, data, counter_offset, idx, stride); 381 Node* adr_node = method_data_addressing(md, data, counter_offset, idx, stride);
382 382
383 const TypePtr* adr_type = _gvn.type(adr_node)->is_ptr(); 383 const TypePtr* adr_type = _gvn.type(adr_node)->is_ptr();
384 Node* cnt = make_load(NULL, adr_node, TypeInt::INT, T_INT, adr_type); 384 Node* cnt = make_load(NULL, adr_node, TypeInt::INT, T_INT, adr_type);
385 Node* incr = _gvn.transform(new (C, 3) AddINode(cnt, _gvn.intcon(DataLayout::counter_increment))); 385 Node* incr = _gvn.transform(new (C) AddINode(cnt, _gvn.intcon(DataLayout::counter_increment)));
386 store_to_memory(NULL, adr_node, incr, T_INT, adr_type ); 386 store_to_memory(NULL, adr_node, incr, T_INT, adr_type );
387 } 387 }
388 388
389 //--------------------------test_for_osr_md_counter_at------------------------- 389 //--------------------------test_for_osr_md_counter_at-------------------------
390 void Parse::test_for_osr_md_counter_at(ciMethodData* md, ciProfileData* data, ByteSize counter_offset, int limit) { 390 void Parse::test_for_osr_md_counter_at(ciMethodData* md, ciProfileData* data, ByteSize counter_offset, int limit) {
400 void Parse::set_md_flag_at(ciMethodData* md, ciProfileData* data, int flag_constant) { 400 void Parse::set_md_flag_at(ciMethodData* md, ciProfileData* data, int flag_constant) {
401 Node* adr_node = method_data_addressing(md, data, DataLayout::flags_offset()); 401 Node* adr_node = method_data_addressing(md, data, DataLayout::flags_offset());
402 402
403 const TypePtr* adr_type = _gvn.type(adr_node)->is_ptr(); 403 const TypePtr* adr_type = _gvn.type(adr_node)->is_ptr();
404 Node* flags = make_load(NULL, adr_node, TypeInt::BYTE, T_BYTE, adr_type); 404 Node* flags = make_load(NULL, adr_node, TypeInt::BYTE, T_BYTE, adr_type);
405 Node* incr = _gvn.transform(new (C, 3) OrINode(flags, _gvn.intcon(flag_constant))); 405 Node* incr = _gvn.transform(new (C) OrINode(flags, _gvn.intcon(flag_constant)));
406 store_to_memory(NULL, adr_node, incr, T_BYTE, adr_type); 406 store_to_memory(NULL, adr_node, incr, T_BYTE, adr_type);
407 } 407 }
408 408
409 //----------------------------profile_taken_branch----------------------------- 409 //----------------------------profile_taken_branch-----------------------------
410 void Parse::profile_taken_branch(int target_bci, bool force_update) { 410 void Parse::profile_taken_branch(int target_bci, bool force_update) {