comparison src/share/vm/opto/graphKit.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 377508648226
comparison
equal deleted inserted replaced
6803:06f52c4d0e18 6804:e626685e9f6c
278 } else { 278 } else {
279 // ...or created from scratch 279 // ...or created from scratch
280 JVMState* jvms = new (C) JVMState(_method, NULL); 280 JVMState* jvms = new (C) JVMState(_method, NULL);
281 jvms->set_bci(_bci); 281 jvms->set_bci(_bci);
282 jvms->set_sp(_sp); 282 jvms->set_sp(_sp);
283 jvms->set_map(new (C, TypeFunc::Parms) SafePointNode(TypeFunc::Parms, jvms)); 283 jvms->set_map(new (C) SafePointNode(TypeFunc::Parms, jvms));
284 set_jvms(jvms); 284 set_jvms(jvms);
285 for (uint i = 0; i < map()->req(); i++) map()->init_req(i, top()); 285 for (uint i = 0; i < map()->req(); i++) map()->init_req(i, top());
286 set_all_memory(top()); 286 set_all_memory(top());
287 while (map()->req() < jvms->endoff()) map()->add_req(top()); 287 while (map()->req() < jvms->endoff()) map()->add_req(top());
288 } 288 }
330 MergeMemNode* phi_mem = phi_map->merged_memory(); 330 MergeMemNode* phi_mem = phi_map->merged_memory();
331 MergeMemNode* ex_mem = ex_map->merged_memory(); 331 MergeMemNode* ex_mem = ex_map->merged_memory();
332 if (region->in(0) != hidden_merge_mark) { 332 if (region->in(0) != hidden_merge_mark) {
333 // The control input is not (yet) a specially-marked region in phi_map. 333 // The control input is not (yet) a specially-marked region in phi_map.
334 // Make it so, and build some phis. 334 // Make it so, and build some phis.
335 region = new (C, 2) RegionNode(2); 335 region = new (C) RegionNode(2);
336 _gvn.set_type(region, Type::CONTROL); 336 _gvn.set_type(region, Type::CONTROL);
337 region->set_req(0, hidden_merge_mark); // marks an internal ex-state 337 region->set_req(0, hidden_merge_mark); // marks an internal ex-state
338 region->init_req(1, phi_map->control()); 338 region->init_req(1, phi_map->control());
339 phi_map->set_control(region); 339 phi_map->set_control(region);
340 Node* io_phi = PhiNode::make(region, phi_map->i_o(), Type::ABIO); 340 Node* io_phi = PhiNode::make(region, phi_map->i_o(), Type::ABIO);
479 // take the normal fast path provided by add_exception_events. If 479 // take the normal fast path provided by add_exception_events. If
480 // exception event reporting is enabled for this thread, we will 480 // exception event reporting is enabled for this thread, we will
481 // take the uncommon_trap in the BuildCutout below. 481 // take the uncommon_trap in the BuildCutout below.
482 482
483 // first must access the should_post_on_exceptions_flag in this thread's JavaThread 483 // first must access the should_post_on_exceptions_flag in this thread's JavaThread
484 Node* jthread = _gvn.transform(new (C, 1) ThreadLocalNode()); 484 Node* jthread = _gvn.transform(new (C) ThreadLocalNode());
485 Node* adr = basic_plus_adr(top(), jthread, in_bytes(JavaThread::should_post_on_exceptions_flag_offset())); 485 Node* adr = basic_plus_adr(top(), jthread, in_bytes(JavaThread::should_post_on_exceptions_flag_offset()));
486 Node* should_post_flag = make_load(control(), adr, TypeInt::INT, T_INT, Compile::AliasIdxRaw, false); 486 Node* should_post_flag = make_load(control(), adr, TypeInt::INT, T_INT, Compile::AliasIdxRaw, false);
487 487
488 // Test the should_post_on_exceptions_flag vs. 0 488 // Test the should_post_on_exceptions_flag vs. 0
489 Node* chk = _gvn.transform( new (C, 3) CmpINode(should_post_flag, intcon(0)) ); 489 Node* chk = _gvn.transform( new (C) CmpINode(should_post_flag, intcon(0)) );
490 Node* tst = _gvn.transform( new (C, 2) BoolNode(chk, BoolTest::eq) ); 490 Node* tst = _gvn.transform( new (C) BoolNode(chk, BoolTest::eq) );
491 491
492 // Branch to slow_path if should_post_on_exceptions_flag was true 492 // Branch to slow_path if should_post_on_exceptions_flag was true
493 { BuildCutout unless(this, tst, PROB_MAX); 493 { BuildCutout unless(this, tst, PROB_MAX);
494 // Do not try anything fancy if we're notifying the VM on every throw. 494 // Do not try anything fancy if we're notifying the VM on every throw.
495 // Cf. case Bytecodes::_athrow in parse2.cpp. 495 // Cf. case Bytecodes::_athrow in parse2.cpp.
654 { 654 {
655 assert(p->is_Con() || p->is_Bool(), "test must be a bool"); 655 assert(p->is_Con() || p->is_Bool(), "test must be a bool");
656 SafePointNode* outer_map = _map; // preserved map is caller's 656 SafePointNode* outer_map = _map; // preserved map is caller's
657 SafePointNode* inner_map = kit->map(); 657 SafePointNode* inner_map = kit->map();
658 IfNode* iff = kit->create_and_map_if(outer_map->control(), p, prob, cnt); 658 IfNode* iff = kit->create_and_map_if(outer_map->control(), p, prob, cnt);
659 outer_map->set_control(kit->gvn().transform( new (kit->C, 1) IfTrueNode(iff) )); 659 outer_map->set_control(kit->gvn().transform( new (kit->C) IfTrueNode(iff) ));
660 inner_map->set_control(kit->gvn().transform( new (kit->C, 1) IfFalseNode(iff) )); 660 inner_map->set_control(kit->gvn().transform( new (kit->C) IfFalseNode(iff) ));
661 } 661 }
662 BuildCutout::~BuildCutout() { 662 BuildCutout::~BuildCutout() {
663 GraphKit* kit = _kit; 663 GraphKit* kit = _kit;
664 assert(kit->stopped(), "cutout code must stop, throw, return, etc."); 664 assert(kit->stopped(), "cutout code must stop, throw, return, etc.");
665 } 665 }
1106 1106
1107 //------------------------------basic_plus_adr--------------------------------- 1107 //------------------------------basic_plus_adr---------------------------------
1108 Node* GraphKit::basic_plus_adr(Node* base, Node* ptr, Node* offset) { 1108 Node* GraphKit::basic_plus_adr(Node* base, Node* ptr, Node* offset) {
1109 // short-circuit a common case 1109 // short-circuit a common case
1110 if (offset == intcon(0)) return ptr; 1110 if (offset == intcon(0)) return ptr;
1111 return _gvn.transform( new (C, 4) AddPNode(base, ptr, offset) ); 1111 return _gvn.transform( new (C) AddPNode(base, ptr, offset) );
1112 } 1112 }
1113 1113
1114 Node* GraphKit::ConvI2L(Node* offset) { 1114 Node* GraphKit::ConvI2L(Node* offset) {
1115 // short-circuit a common case 1115 // short-circuit a common case
1116 jint offset_con = find_int_con(offset, Type::OffsetBot); 1116 jint offset_con = find_int_con(offset, Type::OffsetBot);
1117 if (offset_con != Type::OffsetBot) { 1117 if (offset_con != Type::OffsetBot) {
1118 return longcon((long) offset_con); 1118 return longcon((long) offset_con);
1119 } 1119 }
1120 return _gvn.transform( new (C, 2) ConvI2LNode(offset)); 1120 return _gvn.transform( new (C) ConvI2LNode(offset));
1121 } 1121 }
1122 Node* GraphKit::ConvL2I(Node* offset) { 1122 Node* GraphKit::ConvL2I(Node* offset) {
1123 // short-circuit a common case 1123 // short-circuit a common case
1124 jlong offset_con = find_long_con(offset, (jlong)Type::OffsetBot); 1124 jlong offset_con = find_long_con(offset, (jlong)Type::OffsetBot);
1125 if (offset_con != (jlong)Type::OffsetBot) { 1125 if (offset_con != (jlong)Type::OffsetBot) {
1126 return intcon((int) offset_con); 1126 return intcon((int) offset_con);
1127 } 1127 }
1128 return _gvn.transform( new (C, 2) ConvL2INode(offset)); 1128 return _gvn.transform( new (C) ConvL2INode(offset));
1129 } 1129 }
1130 1130
1131 //-------------------------load_object_klass----------------------------------- 1131 //-------------------------load_object_klass-----------------------------------
1132 Node* GraphKit::load_object_klass(Node* obj) { 1132 Node* GraphKit::load_object_klass(Node* obj) {
1133 // Special-case a fresh allocation to avoid building nodes: 1133 // Special-case a fresh allocation to avoid building nodes:
1142 // Special-case a fresh allocation to avoid building nodes: 1142 // Special-case a fresh allocation to avoid building nodes:
1143 AllocateArrayNode* alloc = AllocateArrayNode::Ideal_array_allocation(array, &_gvn); 1143 AllocateArrayNode* alloc = AllocateArrayNode::Ideal_array_allocation(array, &_gvn);
1144 Node *alen; 1144 Node *alen;
1145 if (alloc == NULL) { 1145 if (alloc == NULL) {
1146 Node *r_adr = basic_plus_adr(array, arrayOopDesc::length_offset_in_bytes()); 1146 Node *r_adr = basic_plus_adr(array, arrayOopDesc::length_offset_in_bytes());
1147 alen = _gvn.transform( new (C, 3) LoadRangeNode(0, immutable_memory(), r_adr, TypeInt::POS)); 1147 alen = _gvn.transform( new (C) LoadRangeNode(0, immutable_memory(), r_adr, TypeInt::POS));
1148 } else { 1148 } else {
1149 alen = alloc->Ideal_length(); 1149 alen = alloc->Ideal_length();
1150 Node* ccast = alloc->make_ideal_length(_gvn.type(array)->is_oopptr(), &_gvn); 1150 Node* ccast = alloc->make_ideal_length(_gvn.type(array)->is_oopptr(), &_gvn);
1151 if (ccast != alen) { 1151 if (ccast != alen) {
1152 alen = _gvn.transform(ccast); 1152 alen = _gvn.transform(ccast);
1175 explicit_null_checks_inserted++; 1175 explicit_null_checks_inserted++;
1176 1176
1177 // Construct NULL check 1177 // Construct NULL check
1178 Node *chk = NULL; 1178 Node *chk = NULL;
1179 switch(type) { 1179 switch(type) {
1180 case T_LONG : chk = new (C, 3) CmpLNode(value, _gvn.zerocon(T_LONG)); break; 1180 case T_LONG : chk = new (C) CmpLNode(value, _gvn.zerocon(T_LONG)); break;
1181 case T_INT : chk = new (C, 3) CmpINode( value, _gvn.intcon(0)); break; 1181 case T_INT : chk = new (C) CmpINode( value, _gvn.intcon(0)); break;
1182 case T_ARRAY : // fall through 1182 case T_ARRAY : // fall through
1183 type = T_OBJECT; // simplify further tests 1183 type = T_OBJECT; // simplify further tests
1184 case T_OBJECT : { 1184 case T_OBJECT : {
1185 const Type *t = _gvn.type( value ); 1185 const Type *t = _gvn.type( value );
1186 1186
1223 // same as: if (!TypePtr::NULL_PTR->higher_equal(t)) ... 1223 // same as: if (!TypePtr::NULL_PTR->higher_equal(t)) ...
1224 explicit_null_checks_elided++; 1224 explicit_null_checks_elided++;
1225 return value; // Elided null check quickly! 1225 return value; // Elided null check quickly!
1226 } 1226 }
1227 } 1227 }
1228 chk = new (C, 3) CmpPNode( value, null() ); 1228 chk = new (C) CmpPNode( value, null() );
1229 break; 1229 break;
1230 } 1230 }
1231 1231
1232 default : ShouldNotReachHere(); 1232 default : ShouldNotReachHere();
1233 } 1233 }
1234 assert(chk != NULL, "sanity check"); 1234 assert(chk != NULL, "sanity check");
1235 chk = _gvn.transform(chk); 1235 chk = _gvn.transform(chk);
1236 1236
1237 BoolTest::mask btest = assert_null ? BoolTest::eq : BoolTest::ne; 1237 BoolTest::mask btest = assert_null ? BoolTest::eq : BoolTest::ne;
1238 BoolNode *btst = new (C, 2) BoolNode( chk, btest); 1238 BoolNode *btst = new (C) BoolNode( chk, btest);
1239 Node *tst = _gvn.transform( btst ); 1239 Node *tst = _gvn.transform( btst );
1240 1240
1241 //----------- 1241 //-----------
1242 // if peephole optimizations occurred, a prior test existed. 1242 // if peephole optimizations occurred, a prior test existed.
1243 // If a prior test existed, maybe it dominates as we can avoid this test. 1243 // If a prior test existed, maybe it dominates as we can avoid this test.
1300 ok_prob = PROB_LIKELY_MAG(3); 1300 ok_prob = PROB_LIKELY_MAG(3);
1301 } 1301 }
1302 1302
1303 if (null_control != NULL) { 1303 if (null_control != NULL) {
1304 IfNode* iff = create_and_map_if(control(), tst, ok_prob, COUNT_UNKNOWN); 1304 IfNode* iff = create_and_map_if(control(), tst, ok_prob, COUNT_UNKNOWN);
1305 Node* null_true = _gvn.transform( new (C, 1) IfFalseNode(iff)); 1305 Node* null_true = _gvn.transform( new (C) IfFalseNode(iff));
1306 set_control( _gvn.transform( new (C, 1) IfTrueNode(iff))); 1306 set_control( _gvn.transform( new (C) IfTrueNode(iff)));
1307 if (null_true == top()) 1307 if (null_true == top())
1308 explicit_null_checks_elided++; 1308 explicit_null_checks_elided++;
1309 (*null_control) = null_true; 1309 (*null_control) = null_true;
1310 } else { 1310 } else {
1311 BuildCutout unless(this, tst, ok_prob); 1311 BuildCutout unless(this, tst, ok_prob);
1353 const Type *t = _gvn.type(obj); 1353 const Type *t = _gvn.type(obj);
1354 const Type *t_not_null = t->join(TypePtr::NOTNULL); 1354 const Type *t_not_null = t->join(TypePtr::NOTNULL);
1355 // Object is already not-null? 1355 // Object is already not-null?
1356 if( t == t_not_null ) return obj; 1356 if( t == t_not_null ) return obj;
1357 1357
1358 Node *cast = new (C, 2) CastPPNode(obj,t_not_null); 1358 Node *cast = new (C) CastPPNode(obj,t_not_null);
1359 cast->init_req(0, control()); 1359 cast->init_req(0, control());
1360 cast = _gvn.transform( cast ); 1360 cast = _gvn.transform( cast );
1361 1361
1362 // Scan for instances of 'obj' in the current JVM mapping. 1362 // Scan for instances of 'obj' in the current JVM mapping.
1363 // These instances are known to be not-null after the test. 1363 // These instances are known to be not-null after the test.
1408 map()->set_memory(mergemem); 1408 map()->set_memory(mergemem);
1409 } 1409 }
1410 1410
1411 //------------------------------set_all_memory_call---------------------------- 1411 //------------------------------set_all_memory_call----------------------------
1412 void GraphKit::set_all_memory_call(Node* call, bool separate_io_proj) { 1412 void GraphKit::set_all_memory_call(Node* call, bool separate_io_proj) {
1413 Node* newmem = _gvn.transform( new (C, 1) ProjNode(call, TypeFunc::Memory, separate_io_proj) ); 1413 Node* newmem = _gvn.transform( new (C) ProjNode(call, TypeFunc::Memory, separate_io_proj) );
1414 set_all_memory(newmem); 1414 set_all_memory(newmem);
1415 } 1415 }
1416 1416
1417 //============================================================================= 1417 //=============================================================================
1418 // 1418 //
1612 // number. (The prior range check has ensured this.) 1612 // number. (The prior range check has ensured this.)
1613 // This assertion is used by ConvI2LNode::Ideal. 1613 // This assertion is used by ConvI2LNode::Ideal.
1614 int index_max = max_jint - 1; // array size is max_jint, index is one less 1614 int index_max = max_jint - 1; // array size is max_jint, index is one less
1615 if (sizetype != NULL) index_max = sizetype->_hi - 1; 1615 if (sizetype != NULL) index_max = sizetype->_hi - 1;
1616 const TypeLong* lidxtype = TypeLong::make(CONST64(0), index_max, Type::WidenMax); 1616 const TypeLong* lidxtype = TypeLong::make(CONST64(0), index_max, Type::WidenMax);
1617 idx = _gvn.transform( new (C, 2) ConvI2LNode(idx, lidxtype) ); 1617 idx = _gvn.transform( new (C) ConvI2LNode(idx, lidxtype) );
1618 #endif 1618 #endif
1619 Node* scale = _gvn.transform( new (C, 3) LShiftXNode(idx, intcon(shift)) ); 1619 Node* scale = _gvn.transform( new (C) LShiftXNode(idx, intcon(shift)) );
1620 return basic_plus_adr(ary, base, scale); 1620 return basic_plus_adr(ary, base, scale);
1621 } 1621 }
1622 1622
1623 //-------------------------load_array_element------------------------- 1623 //-------------------------load_array_element-------------------------
1624 Node* GraphKit::load_array_element(Node* ctl, Node* ary, Node* idx, const TypeAryPtr* arytype) { 1624 Node* GraphKit::load_array_element(Node* ctl, Node* ary, Node* idx, const TypeAryPtr* arytype) {
1662 } 1662 }
1663 assert(xcall == call, "call identity is stable"); 1663 assert(xcall == call, "call identity is stable");
1664 1664
1665 // Re-use the current map to produce the result. 1665 // Re-use the current map to produce the result.
1666 1666
1667 set_control(_gvn.transform(new (C, 1) ProjNode(call, TypeFunc::Control))); 1667 set_control(_gvn.transform(new (C) ProjNode(call, TypeFunc::Control)));
1668 set_i_o( _gvn.transform(new (C, 1) ProjNode(call, TypeFunc::I_O , separate_io_proj))); 1668 set_i_o( _gvn.transform(new (C) ProjNode(call, TypeFunc::I_O , separate_io_proj)));
1669 set_all_memory_call(xcall, separate_io_proj); 1669 set_all_memory_call(xcall, separate_io_proj);
1670 1670
1671 //return xcall; // no need, caller already has it 1671 //return xcall; // no need, caller already has it
1672 } 1672 }
1673 1673
1677 // Capture the return value, if any. 1677 // Capture the return value, if any.
1678 Node* ret; 1678 Node* ret;
1679 if (call->method() == NULL || 1679 if (call->method() == NULL ||
1680 call->method()->return_type()->basic_type() == T_VOID) 1680 call->method()->return_type()->basic_type() == T_VOID)
1681 ret = top(); 1681 ret = top();
1682 else ret = _gvn.transform(new (C, 1) ProjNode(call, TypeFunc::Parms)); 1682 else ret = _gvn.transform(new (C) ProjNode(call, TypeFunc::Parms));
1683 1683
1684 // Note: Since any out-of-line call can produce an exception, 1684 // Note: Since any out-of-line call can produce an exception,
1685 // we always insert an I_O projection from the call into the result. 1685 // we always insert an I_O projection from the call into the result.
1686 1686
1687 make_slow_call_ex(call, env()->Throwable_klass(), separate_io_proj); 1687 make_slow_call_ex(call, env()->Throwable_klass(), separate_io_proj);
1688 1688
1689 if (separate_io_proj) { 1689 if (separate_io_proj) {
1690 // The caller requested separate projections be used by the fall 1690 // The caller requested separate projections be used by the fall
1691 // through and exceptional paths, so replace the projections for 1691 // through and exceptional paths, so replace the projections for
1692 // the fall through path. 1692 // the fall through path.
1693 set_i_o(_gvn.transform( new (C, 1) ProjNode(call, TypeFunc::I_O) )); 1693 set_i_o(_gvn.transform( new (C) ProjNode(call, TypeFunc::I_O) ));
1694 set_all_memory(_gvn.transform( new (C, 1) ProjNode(call, TypeFunc::Memory) )); 1694 set_all_memory(_gvn.transform( new (C) ProjNode(call, TypeFunc::Memory) ));
1695 } 1695 }
1696 return ret; 1696 return ret;
1697 } 1697 }
1698 1698
1699 //--------------------set_predefined_input_for_runtime_call-------------------- 1699 //--------------------set_predefined_input_for_runtime_call--------------------
1729 // preceding the call. 1729 // preceding the call.
1730 void GraphKit::set_predefined_output_for_runtime_call(Node* call, 1730 void GraphKit::set_predefined_output_for_runtime_call(Node* call,
1731 Node* keep_mem, 1731 Node* keep_mem,
1732 const TypePtr* hook_mem) { 1732 const TypePtr* hook_mem) {
1733 // no i/o 1733 // no i/o
1734 set_control(_gvn.transform( new (C, 1) ProjNode(call,TypeFunc::Control) )); 1734 set_control(_gvn.transform( new (C) ProjNode(call,TypeFunc::Control) ));
1735 if (keep_mem) { 1735 if (keep_mem) {
1736 // First clone the existing memory state 1736 // First clone the existing memory state
1737 set_all_memory(keep_mem); 1737 set_all_memory(keep_mem);
1738 if (hook_mem != NULL) { 1738 if (hook_mem != NULL) {
1739 // Make memory for the call 1739 // Make memory for the call
1740 Node* mem = _gvn.transform( new (C, 1) ProjNode(call, TypeFunc::Memory) ); 1740 Node* mem = _gvn.transform( new (C) ProjNode(call, TypeFunc::Memory) );
1741 // Set the RawPtr memory state only. This covers all the heap top/GC stuff 1741 // Set the RawPtr memory state only. This covers all the heap top/GC stuff
1742 // We also use hook_mem to extract specific effects from arraycopy stubs. 1742 // We also use hook_mem to extract specific effects from arraycopy stubs.
1743 set_memory(mem, hook_mem); 1743 set_memory(mem, hook_mem);
1744 } 1744 }
1745 // ...else the call has NO memory effects. 1745 // ...else the call has NO memory effects.
1839 1839
1840 void GraphKit::increment_counter(Node* counter_addr) { 1840 void GraphKit::increment_counter(Node* counter_addr) {
1841 int adr_type = Compile::AliasIdxRaw; 1841 int adr_type = Compile::AliasIdxRaw;
1842 Node* ctrl = control(); 1842 Node* ctrl = control();
1843 Node* cnt = make_load(ctrl, counter_addr, TypeInt::INT, T_INT, adr_type); 1843 Node* cnt = make_load(ctrl, counter_addr, TypeInt::INT, T_INT, adr_type);
1844 Node* incr = _gvn.transform(new (C, 3) AddINode(cnt, _gvn.intcon(1))); 1844 Node* incr = _gvn.transform(new (C) AddINode(cnt, _gvn.intcon(1)));
1845 store_to_memory( ctrl, counter_addr, incr, T_INT, adr_type ); 1845 store_to_memory( ctrl, counter_addr, incr, T_INT, adr_type );
1846 } 1846 }
1847 1847
1848 1848
1849 //------------------------------uncommon_trap---------------------------------- 1849 //------------------------------uncommon_trap----------------------------------
1955 1955
1956 call->set_req(TypeFunc::ReturnAdr, returnadr()); 1956 call->set_req(TypeFunc::ReturnAdr, returnadr());
1957 // The debug info is the only real input to this call. 1957 // The debug info is the only real input to this call.
1958 1958
1959 // Halt-and-catch fire here. The above call should never return! 1959 // Halt-and-catch fire here. The above call should never return!
1960 HaltNode* halt = new(C, TypeFunc::Parms) HaltNode(control(), frameptr()); 1960 HaltNode* halt = new(C) HaltNode(control(), frameptr());
1961 _gvn.set_type_bottom(halt); 1961 _gvn.set_type_bottom(halt);
1962 root()->add_req(halt); 1962 root()->add_req(halt);
1963 1963
1964 stop_and_kill_map(); 1964 stop_and_kill_map();
1965 } 1965 }
2011 2011
2012 // rounding for strict float precision conformance 2012 // rounding for strict float precision conformance
2013 Node* GraphKit::precision_rounding(Node* n) { 2013 Node* GraphKit::precision_rounding(Node* n) {
2014 return UseStrictFP && _method->flags().is_strict() 2014 return UseStrictFP && _method->flags().is_strict()
2015 && UseSSE == 0 && Matcher::strict_fp_requires_explicit_rounding 2015 && UseSSE == 0 && Matcher::strict_fp_requires_explicit_rounding
2016 ? _gvn.transform( new (C, 2) RoundFloatNode(0, n) ) 2016 ? _gvn.transform( new (C) RoundFloatNode(0, n) )
2017 : n; 2017 : n;
2018 } 2018 }
2019 2019
2020 // rounding for strict double precision conformance 2020 // rounding for strict double precision conformance
2021 Node* GraphKit::dprecision_rounding(Node *n) { 2021 Node* GraphKit::dprecision_rounding(Node *n) {
2022 return UseStrictFP && _method->flags().is_strict() 2022 return UseStrictFP && _method->flags().is_strict()
2023 && UseSSE <= 1 && Matcher::strict_fp_requires_explicit_rounding 2023 && UseSSE <= 1 && Matcher::strict_fp_requires_explicit_rounding
2024 ? _gvn.transform( new (C, 2) RoundDoubleNode(0, n) ) 2024 ? _gvn.transform( new (C) RoundDoubleNode(0, n) )
2025 : n; 2025 : n;
2026 } 2026 }
2027 2027
2028 // rounding for non-strict double stores 2028 // rounding for non-strict double stores
2029 Node* GraphKit::dstore_rounding(Node* n) { 2029 Node* GraphKit::dstore_rounding(Node* n) {
2030 return Matcher::strict_fp_requires_explicit_rounding 2030 return Matcher::strict_fp_requires_explicit_rounding
2031 && UseSSE <= 1 2031 && UseSSE <= 1
2032 ? _gvn.transform( new (C, 2) RoundDoubleNode(0, n) ) 2032 ? _gvn.transform( new (C) RoundDoubleNode(0, n) )
2033 : n; 2033 : n;
2034 } 2034 }
2035 2035
2036 //============================================================================= 2036 //=============================================================================
2037 // Generate a fast path/slow path idiom. Graph looks like: 2037 // Generate a fast path/slow path idiom. Graph looks like:
2100 // Return slow-path control. 2100 // Return slow-path control.
2101 Node* GraphKit::opt_iff(Node* region, Node* iff) { 2101 Node* GraphKit::opt_iff(Node* region, Node* iff) {
2102 IfNode *opt_iff = _gvn.transform(iff)->as_If(); 2102 IfNode *opt_iff = _gvn.transform(iff)->as_If();
2103 2103
2104 // Fast path taken; set region slot 2 2104 // Fast path taken; set region slot 2
2105 Node *fast_taken = _gvn.transform( new (C, 1) IfFalseNode(opt_iff) ); 2105 Node *fast_taken = _gvn.transform( new (C) IfFalseNode(opt_iff) );
2106 region->init_req(2,fast_taken); // Capture fast-control 2106 region->init_req(2,fast_taken); // Capture fast-control
2107 2107
2108 // Fast path not-taken, i.e. slow path 2108 // Fast path not-taken, i.e. slow path
2109 Node *slow_taken = _gvn.transform( new (C, 1) IfTrueNode(opt_iff) ); 2109 Node *slow_taken = _gvn.transform( new (C) IfTrueNode(opt_iff) );
2110 return slow_taken; 2110 return slow_taken;
2111 } 2111 }
2112 2112
2113 //-----------------------------make_runtime_call------------------------------- 2113 //-----------------------------make_runtime_call-------------------------------
2114 Node* GraphKit::make_runtime_call(int flags, 2114 Node* GraphKit::make_runtime_call(int flags,
2120 Node* parm0, Node* parm1, 2120 Node* parm0, Node* parm1,
2121 Node* parm2, Node* parm3, 2121 Node* parm2, Node* parm3,
2122 Node* parm4, Node* parm5, 2122 Node* parm4, Node* parm5,
2123 Node* parm6, Node* parm7) { 2123 Node* parm6, Node* parm7) {
2124 // Slow-path call 2124 // Slow-path call
2125 int size = call_type->domain()->cnt();
2126 bool is_leaf = !(flags & RC_NO_LEAF); 2125 bool is_leaf = !(flags & RC_NO_LEAF);
2127 bool has_io = (!is_leaf && !(flags & RC_NO_IO)); 2126 bool has_io = (!is_leaf && !(flags & RC_NO_IO));
2128 if (call_name == NULL) { 2127 if (call_name == NULL) {
2129 assert(!is_leaf, "must supply name for leaf"); 2128 assert(!is_leaf, "must supply name for leaf");
2130 call_name = OptoRuntime::stub_name(call_addr); 2129 call_name = OptoRuntime::stub_name(call_addr);
2131 } 2130 }
2132 CallNode* call; 2131 CallNode* call;
2133 if (!is_leaf) { 2132 if (!is_leaf) {
2134 call = new(C, size) CallStaticJavaNode(call_type, call_addr, call_name, 2133 call = new(C) CallStaticJavaNode(call_type, call_addr, call_name,
2135 bci(), adr_type); 2134 bci(), adr_type);
2136 } else if (flags & RC_NO_FP) { 2135 } else if (flags & RC_NO_FP) {
2137 call = new(C, size) CallLeafNoFPNode(call_type, call_addr, call_name, adr_type); 2136 call = new(C) CallLeafNoFPNode(call_type, call_addr, call_name, adr_type);
2138 } else { 2137 } else {
2139 call = new(C, size) CallLeafNode(call_type, call_addr, call_name, adr_type); 2138 call = new(C) CallLeafNode(call_type, call_addr, call_name, adr_type);
2140 } 2139 }
2141 2140
2142 // The following is similar to set_edges_for_java_call, 2141 // The following is similar to set_edges_for_java_call,
2143 // except that the memory effects of the call are restricted to AliasIdxRaw. 2142 // except that the memory effects of the call are restricted to AliasIdxRaw.
2144 2143
2195 // Slow path call has few side-effects, and/or sets few values. 2194 // Slow path call has few side-effects, and/or sets few values.
2196 set_predefined_output_for_runtime_call(call, prev_mem, adr_type); 2195 set_predefined_output_for_runtime_call(call, prev_mem, adr_type);
2197 } 2196 }
2198 2197
2199 if (has_io) { 2198 if (has_io) {
2200 set_i_o(_gvn.transform(new (C, 1) ProjNode(call, TypeFunc::I_O))); 2199 set_i_o(_gvn.transform(new (C) ProjNode(call, TypeFunc::I_O)));
2201 } 2200 }
2202 return call; 2201 return call;
2203 2202
2204 } 2203 }
2205 2204
2236 // Make the exception handler hookups for the slow call 2235 // Make the exception handler hookups for the slow call
2237 void GraphKit::make_slow_call_ex(Node* call, ciInstanceKlass* ex_klass, bool separate_io_proj) { 2236 void GraphKit::make_slow_call_ex(Node* call, ciInstanceKlass* ex_klass, bool separate_io_proj) {
2238 if (stopped()) return; 2237 if (stopped()) return;
2239 2238
2240 // Make a catch node with just two handlers: fall-through and catch-all 2239 // Make a catch node with just two handlers: fall-through and catch-all
2241 Node* i_o = _gvn.transform( new (C, 1) ProjNode(call, TypeFunc::I_O, separate_io_proj) ); 2240 Node* i_o = _gvn.transform( new (C) ProjNode(call, TypeFunc::I_O, separate_io_proj) );
2242 Node* catc = _gvn.transform( new (C, 2) CatchNode(control(), i_o, 2) ); 2241 Node* catc = _gvn.transform( new (C) CatchNode(control(), i_o, 2) );
2243 Node* norm = _gvn.transform( new (C, 1) CatchProjNode(catc, CatchProjNode::fall_through_index, CatchProjNode::no_handler_bci) ); 2242 Node* norm = _gvn.transform( new (C) CatchProjNode(catc, CatchProjNode::fall_through_index, CatchProjNode::no_handler_bci) );
2244 Node* excp = _gvn.transform( new (C, 1) CatchProjNode(catc, CatchProjNode::catch_all_index, CatchProjNode::no_handler_bci) ); 2243 Node* excp = _gvn.transform( new (C) CatchProjNode(catc, CatchProjNode::catch_all_index, CatchProjNode::no_handler_bci) );
2245 2244
2246 { PreserveJVMState pjvms(this); 2245 { PreserveJVMState pjvms(this);
2247 set_control(excp); 2246 set_control(excp);
2248 set_i_o(i_o); 2247 set_i_o(i_o);
2249 2248
2250 if (excp != top()) { 2249 if (excp != top()) {
2251 // Create an exception state also. 2250 // Create an exception state also.
2252 // Use an exact type if the caller has specified a specific exception. 2251 // Use an exact type if the caller has specified a specific exception.
2253 const Type* ex_type = TypeOopPtr::make_from_klass_unique(ex_klass)->cast_to_ptr_type(TypePtr::NotNull); 2252 const Type* ex_type = TypeOopPtr::make_from_klass_unique(ex_klass)->cast_to_ptr_type(TypePtr::NotNull);
2254 Node* ex_oop = new (C, 2) CreateExNode(ex_type, control(), i_o); 2253 Node* ex_oop = new (C) CreateExNode(ex_type, control(), i_o);
2255 add_exception_state(make_exception_state(_gvn.transform(ex_oop))); 2254 add_exception_state(make_exception_state(_gvn.transform(ex_oop)));
2256 } 2255 }
2257 } 2256 }
2258 2257
2259 // Get the no-exception control from the CatchNode. 2258 // Get the no-exception control from the CatchNode.
2299 case SSC_always_true: 2298 case SSC_always_true:
2300 return top(); 2299 return top();
2301 case SSC_easy_test: 2300 case SSC_easy_test:
2302 { 2301 {
2303 // Just do a direct pointer compare and be done. 2302 // Just do a direct pointer compare and be done.
2304 Node* cmp = _gvn.transform( new(C, 3) CmpPNode(subklass, superklass) ); 2303 Node* cmp = _gvn.transform( new(C) CmpPNode(subklass, superklass) );
2305 Node* bol = _gvn.transform( new(C, 2) BoolNode(cmp, BoolTest::eq) ); 2304 Node* bol = _gvn.transform( new(C) BoolNode(cmp, BoolTest::eq) );
2306 IfNode* iff = create_and_xform_if(control(), bol, PROB_STATIC_FREQUENT, COUNT_UNKNOWN); 2305 IfNode* iff = create_and_xform_if(control(), bol, PROB_STATIC_FREQUENT, COUNT_UNKNOWN);
2307 set_control( _gvn.transform( new(C, 1) IfTrueNode (iff) ) ); 2306 set_control( _gvn.transform( new(C) IfTrueNode (iff) ) );
2308 return _gvn.transform( new(C, 1) IfFalseNode(iff) ); 2307 return _gvn.transform( new(C) IfFalseNode(iff) );
2309 } 2308 }
2310 case SSC_full_test: 2309 case SSC_full_test:
2311 break; 2310 break;
2312 default: 2311 default:
2313 ShouldNotReachHere(); 2312 ShouldNotReachHere();
2318 // if the subklass is the unique subtype of the superklass, the check 2317 // if the subklass is the unique subtype of the superklass, the check
2319 // will always succeed. We could leave a dependency behind to ensure this. 2318 // will always succeed. We could leave a dependency behind to ensure this.
2320 2319
2321 // First load the super-klass's check-offset 2320 // First load the super-klass's check-offset
2322 Node *p1 = basic_plus_adr( superklass, superklass, in_bytes(Klass::super_check_offset_offset()) ); 2321 Node *p1 = basic_plus_adr( superklass, superklass, in_bytes(Klass::super_check_offset_offset()) );
2323 Node *chk_off = _gvn.transform( new (C, 3) LoadINode( NULL, memory(p1), p1, _gvn.type(p1)->is_ptr() ) ); 2322 Node *chk_off = _gvn.transform( new (C) LoadINode( NULL, memory(p1), p1, _gvn.type(p1)->is_ptr() ) );
2324 int cacheoff_con = in_bytes(Klass::secondary_super_cache_offset()); 2323 int cacheoff_con = in_bytes(Klass::secondary_super_cache_offset());
2325 bool might_be_cache = (find_int_con(chk_off, cacheoff_con) == cacheoff_con); 2324 bool might_be_cache = (find_int_con(chk_off, cacheoff_con) == cacheoff_con);
2326 2325
2327 // Load from the sub-klass's super-class display list, or a 1-word cache of 2326 // Load from the sub-klass's super-class display list, or a 1-word cache of
2328 // the secondary superclass list, or a failing value with a sentinel offset 2327 // the secondary superclass list, or a failing value with a sentinel offset
2329 // if the super-klass is an interface or exceptionally deep in the Java 2328 // if the super-klass is an interface or exceptionally deep in the Java
2330 // hierarchy and we have to scan the secondary superclass list the hard way. 2329 // hierarchy and we have to scan the secondary superclass list the hard way.
2331 // Worst-case type is a little odd: NULL is allowed as a result (usually 2330 // Worst-case type is a little odd: NULL is allowed as a result (usually
2332 // klass loads can never produce a NULL). 2331 // klass loads can never produce a NULL).
2333 Node *chk_off_X = ConvI2X(chk_off); 2332 Node *chk_off_X = ConvI2X(chk_off);
2334 Node *p2 = _gvn.transform( new (C, 4) AddPNode(subklass,subklass,chk_off_X) ); 2333 Node *p2 = _gvn.transform( new (C) AddPNode(subklass,subklass,chk_off_X) );
2335 // For some types like interfaces the following loadKlass is from a 1-word 2334 // For some types like interfaces the following loadKlass is from a 1-word
2336 // cache which is mutable so can't use immutable memory. Other 2335 // cache which is mutable so can't use immutable memory. Other
2337 // types load from the super-class display table which is immutable. 2336 // types load from the super-class display table which is immutable.
2338 Node *kmem = might_be_cache ? memory(p2) : immutable_memory(); 2337 Node *kmem = might_be_cache ? memory(p2) : immutable_memory();
2339 Node *nkls = _gvn.transform( LoadKlassNode::make( _gvn, kmem, p2, _gvn.type(p2)->is_ptr(), TypeKlassPtr::OBJECT_OR_NULL ) ); 2338 Node *nkls = _gvn.transform( LoadKlassNode::make( _gvn, kmem, p2, _gvn.type(p2)->is_ptr(), TypeKlassPtr::OBJECT_OR_NULL ) );
2343 return top(); // false path is dead; no test needed. 2342 return top(); // false path is dead; no test needed.
2344 2343
2345 // See if we get an immediate positive hit. Happens roughly 83% of the 2344 // See if we get an immediate positive hit. Happens roughly 83% of the
2346 // time. Test to see if the value loaded just previously from the subklass 2345 // time. Test to see if the value loaded just previously from the subklass
2347 // is exactly the superklass. 2346 // is exactly the superklass.
2348 Node *cmp1 = _gvn.transform( new (C, 3) CmpPNode( superklass, nkls ) ); 2347 Node *cmp1 = _gvn.transform( new (C) CmpPNode( superklass, nkls ) );
2349 Node *bol1 = _gvn.transform( new (C, 2) BoolNode( cmp1, BoolTest::eq ) ); 2348 Node *bol1 = _gvn.transform( new (C) BoolNode( cmp1, BoolTest::eq ) );
2350 IfNode *iff1 = create_and_xform_if( control(), bol1, PROB_LIKELY(0.83f), COUNT_UNKNOWN ); 2349 IfNode *iff1 = create_and_xform_if( control(), bol1, PROB_LIKELY(0.83f), COUNT_UNKNOWN );
2351 Node *iftrue1 = _gvn.transform( new (C, 1) IfTrueNode ( iff1 ) ); 2350 Node *iftrue1 = _gvn.transform( new (C) IfTrueNode ( iff1 ) );
2352 set_control( _gvn.transform( new (C, 1) IfFalseNode( iff1 ) ) ); 2351 set_control( _gvn.transform( new (C) IfFalseNode( iff1 ) ) );
2353 2352
2354 // Compile speed common case: Check for being deterministic right now. If 2353 // Compile speed common case: Check for being deterministic right now. If
2355 // chk_off is a constant and not equal to cacheoff then we are NOT a 2354 // chk_off is a constant and not equal to cacheoff then we are NOT a
2356 // subklass. In this case we need exactly the 1 test above and we can 2355 // subklass. In this case we need exactly the 1 test above and we can
2357 // return those results immediately. 2356 // return those results immediately.
2360 set_control(iftrue1); // We need exactly the 1 test above 2359 set_control(iftrue1); // We need exactly the 1 test above
2361 return not_subtype_ctrl; 2360 return not_subtype_ctrl;
2362 } 2361 }
2363 2362
2364 // Gather the various success & failures here 2363 // Gather the various success & failures here
2365 RegionNode *r_ok_subtype = new (C, 4) RegionNode(4); 2364 RegionNode *r_ok_subtype = new (C) RegionNode(4);
2366 record_for_igvn(r_ok_subtype); 2365 record_for_igvn(r_ok_subtype);
2367 RegionNode *r_not_subtype = new (C, 3) RegionNode(3); 2366 RegionNode *r_not_subtype = new (C) RegionNode(3);
2368 record_for_igvn(r_not_subtype); 2367 record_for_igvn(r_not_subtype);
2369 2368
2370 r_ok_subtype->init_req(1, iftrue1); 2369 r_ok_subtype->init_req(1, iftrue1);
2371 2370
2372 // Check for immediate negative hit. Happens roughly 11% of the time (which 2371 // Check for immediate negative hit. Happens roughly 11% of the time (which
2373 // is roughly 63% of the remaining cases). Test to see if the loaded 2372 // is roughly 63% of the remaining cases). Test to see if the loaded
2374 // check-offset points into the subklass display list or the 1-element 2373 // check-offset points into the subklass display list or the 1-element
2375 // cache. If it points to the display (and NOT the cache) and the display 2374 // cache. If it points to the display (and NOT the cache) and the display
2376 // missed then it's not a subtype. 2375 // missed then it's not a subtype.
2377 Node *cacheoff = _gvn.intcon(cacheoff_con); 2376 Node *cacheoff = _gvn.intcon(cacheoff_con);
2378 Node *cmp2 = _gvn.transform( new (C, 3) CmpINode( chk_off, cacheoff ) ); 2377 Node *cmp2 = _gvn.transform( new (C) CmpINode( chk_off, cacheoff ) );
2379 Node *bol2 = _gvn.transform( new (C, 2) BoolNode( cmp2, BoolTest::ne ) ); 2378 Node *bol2 = _gvn.transform( new (C) BoolNode( cmp2, BoolTest::ne ) );
2380 IfNode *iff2 = create_and_xform_if( control(), bol2, PROB_LIKELY(0.63f), COUNT_UNKNOWN ); 2379 IfNode *iff2 = create_and_xform_if( control(), bol2, PROB_LIKELY(0.63f), COUNT_UNKNOWN );
2381 r_not_subtype->init_req(1, _gvn.transform( new (C, 1) IfTrueNode (iff2) ) ); 2380 r_not_subtype->init_req(1, _gvn.transform( new (C) IfTrueNode (iff2) ) );
2382 set_control( _gvn.transform( new (C, 1) IfFalseNode(iff2) ) ); 2381 set_control( _gvn.transform( new (C) IfFalseNode(iff2) ) );
2383 2382
2384 // Check for self. Very rare to get here, but it is taken 1/3 the time. 2383 // Check for self. Very rare to get here, but it is taken 1/3 the time.
2385 // No performance impact (too rare) but allows sharing of secondary arrays 2384 // No performance impact (too rare) but allows sharing of secondary arrays
2386 // which has some footprint reduction. 2385 // which has some footprint reduction.
2387 Node *cmp3 = _gvn.transform( new (C, 3) CmpPNode( subklass, superklass ) ); 2386 Node *cmp3 = _gvn.transform( new (C) CmpPNode( subklass, superklass ) );
2388 Node *bol3 = _gvn.transform( new (C, 2) BoolNode( cmp3, BoolTest::eq ) ); 2387 Node *bol3 = _gvn.transform( new (C) BoolNode( cmp3, BoolTest::eq ) );
2389 IfNode *iff3 = create_and_xform_if( control(), bol3, PROB_LIKELY(0.36f), COUNT_UNKNOWN ); 2388 IfNode *iff3 = create_and_xform_if( control(), bol3, PROB_LIKELY(0.36f), COUNT_UNKNOWN );
2390 r_ok_subtype->init_req(2, _gvn.transform( new (C, 1) IfTrueNode ( iff3 ) ) ); 2389 r_ok_subtype->init_req(2, _gvn.transform( new (C) IfTrueNode ( iff3 ) ) );
2391 set_control( _gvn.transform( new (C, 1) IfFalseNode( iff3 ) ) ); 2390 set_control( _gvn.transform( new (C) IfFalseNode( iff3 ) ) );
2392 2391
2393 // -- Roads not taken here: -- 2392 // -- Roads not taken here: --
2394 // We could also have chosen to perform the self-check at the beginning 2393 // We could also have chosen to perform the self-check at the beginning
2395 // of this code sequence, as the assembler does. This would not pay off 2394 // of this code sequence, as the assembler does. This would not pay off
2396 // the same way, since the optimizer, unlike the assembler, can perform 2395 // the same way, since the optimizer, unlike the assembler, can perform
2410 // Since the code is rarely used, there is no penalty for moving it 2409 // Since the code is rarely used, there is no penalty for moving it
2411 // out of line, and it can only improve I-cache density. 2410 // out of line, and it can only improve I-cache density.
2412 // The decision to inline or out-of-line this final check is platform 2411 // The decision to inline or out-of-line this final check is platform
2413 // dependent, and is found in the AD file definition of PartialSubtypeCheck. 2412 // dependent, and is found in the AD file definition of PartialSubtypeCheck.
2414 Node* psc = _gvn.transform( 2413 Node* psc = _gvn.transform(
2415 new (C, 3) PartialSubtypeCheckNode(control(), subklass, superklass) ); 2414 new (C) PartialSubtypeCheckNode(control(), subklass, superklass) );
2416 2415
2417 Node *cmp4 = _gvn.transform( new (C, 3) CmpPNode( psc, null() ) ); 2416 Node *cmp4 = _gvn.transform( new (C) CmpPNode( psc, null() ) );
2418 Node *bol4 = _gvn.transform( new (C, 2) BoolNode( cmp4, BoolTest::ne ) ); 2417 Node *bol4 = _gvn.transform( new (C) BoolNode( cmp4, BoolTest::ne ) );
2419 IfNode *iff4 = create_and_xform_if( control(), bol4, PROB_FAIR, COUNT_UNKNOWN ); 2418 IfNode *iff4 = create_and_xform_if( control(), bol4, PROB_FAIR, COUNT_UNKNOWN );
2420 r_not_subtype->init_req(2, _gvn.transform( new (C, 1) IfTrueNode (iff4) ) ); 2419 r_not_subtype->init_req(2, _gvn.transform( new (C) IfTrueNode (iff4) ) );
2421 r_ok_subtype ->init_req(3, _gvn.transform( new (C, 1) IfFalseNode(iff4) ) ); 2420 r_ok_subtype ->init_req(3, _gvn.transform( new (C) IfFalseNode(iff4) ) );
2422 2421
2423 // Return false path; set default control to true path. 2422 // Return false path; set default control to true path.
2424 set_control( _gvn.transform(r_ok_subtype) ); 2423 set_control( _gvn.transform(r_ok_subtype) );
2425 return _gvn.transform(r_not_subtype); 2424 return _gvn.transform(r_not_subtype);
2426 } 2425 }
2480 float prob, 2479 float prob,
2481 Node* *casted_receiver) { 2480 Node* *casted_receiver) {
2482 const TypeKlassPtr* tklass = TypeKlassPtr::make(klass); 2481 const TypeKlassPtr* tklass = TypeKlassPtr::make(klass);
2483 Node* recv_klass = load_object_klass(receiver); 2482 Node* recv_klass = load_object_klass(receiver);
2484 Node* want_klass = makecon(tklass); 2483 Node* want_klass = makecon(tklass);
2485 Node* cmp = _gvn.transform( new(C, 3) CmpPNode(recv_klass, want_klass) ); 2484 Node* cmp = _gvn.transform( new(C) CmpPNode(recv_klass, want_klass) );
2486 Node* bol = _gvn.transform( new(C, 2) BoolNode(cmp, BoolTest::eq) ); 2485 Node* bol = _gvn.transform( new(C) BoolNode(cmp, BoolTest::eq) );
2487 IfNode* iff = create_and_xform_if(control(), bol, prob, COUNT_UNKNOWN); 2486 IfNode* iff = create_and_xform_if(control(), bol, prob, COUNT_UNKNOWN);
2488 set_control( _gvn.transform( new(C, 1) IfTrueNode (iff) )); 2487 set_control( _gvn.transform( new(C) IfTrueNode (iff) ));
2489 Node* fail = _gvn.transform( new(C, 1) IfFalseNode(iff) ); 2488 Node* fail = _gvn.transform( new(C) IfFalseNode(iff) );
2490 2489
2491 const TypeOopPtr* recv_xtype = tklass->as_instance_type(); 2490 const TypeOopPtr* recv_xtype = tklass->as_instance_type();
2492 assert(recv_xtype->klass_is_exact(), ""); 2491 assert(recv_xtype->klass_is_exact(), "");
2493 2492
2494 // Subsume downstream occurrences of receiver with a cast to 2493 // Subsume downstream occurrences of receiver with a cast to
2495 // recv_xtype, since now we know what the type will be. 2494 // recv_xtype, since now we know what the type will be.
2496 Node* cast = new(C, 2) CheckCastPPNode(control(), receiver, recv_xtype); 2495 Node* cast = new(C) CheckCastPPNode(control(), receiver, recv_xtype);
2497 (*casted_receiver) = _gvn.transform(cast); 2496 (*casted_receiver) = _gvn.transform(cast);
2498 // (User must make the replace_in_map call.) 2497 // (User must make the replace_in_map call.)
2499 2498
2500 return fail; 2499 return fail;
2501 } 2500 }
2578 assert(!TypePtr::NULL_PTR->higher_equal(_gvn.type(superklass)->is_klassptr()), 2577 assert(!TypePtr::NULL_PTR->higher_equal(_gvn.type(superklass)->is_klassptr()),
2579 "must check for not-null not-dead klass in callers"); 2578 "must check for not-null not-dead klass in callers");
2580 2579
2581 // Make the merge point 2580 // Make the merge point
2582 enum { _obj_path = 1, _fail_path, _null_path, PATH_LIMIT }; 2581 enum { _obj_path = 1, _fail_path, _null_path, PATH_LIMIT };
2583 RegionNode* region = new(C, PATH_LIMIT) RegionNode(PATH_LIMIT); 2582 RegionNode* region = new(C) RegionNode(PATH_LIMIT);
2584 Node* phi = new(C, PATH_LIMIT) PhiNode(region, TypeInt::BOOL); 2583 Node* phi = new(C) PhiNode(region, TypeInt::BOOL);
2585 C->set_has_split_ifs(true); // Has chance for split-if optimization 2584 C->set_has_split_ifs(true); // Has chance for split-if optimization
2586 2585
2587 ciProfileData* data = NULL; 2586 ciProfileData* data = NULL;
2588 if (java_bc() == Bytecodes::_instanceof) { // Only for the bytecode 2587 if (java_bc() == Bytecodes::_instanceof) { // Only for the bytecode
2589 data = method()->method_data()->bci_to_data(bci()); 2588 data = method()->method_data()->bci_to_data(bci());
2681 data = method()->method_data()->bci_to_data(bci()); 2680 data = method()->method_data()->bci_to_data(bci());
2682 } 2681 }
2683 2682
2684 // Make the merge point 2683 // Make the merge point
2685 enum { _obj_path = 1, _null_path, PATH_LIMIT }; 2684 enum { _obj_path = 1, _null_path, PATH_LIMIT };
2686 RegionNode* region = new (C, PATH_LIMIT) RegionNode(PATH_LIMIT); 2685 RegionNode* region = new (C) RegionNode(PATH_LIMIT);
2687 Node* phi = new (C, PATH_LIMIT) PhiNode(region, toop); 2686 Node* phi = new (C) PhiNode(region, toop);
2688 C->set_has_split_ifs(true); // Has chance for split-if optimization 2687 C->set_has_split_ifs(true); // Has chance for split-if optimization
2689 2688
2690 // Use null-cast information if it is available 2689 // Use null-cast information if it is available
2691 bool never_see_null = ((failure_control == NULL) // regular case only 2690 bool never_see_null = ((failure_control == NULL) // regular case only
2692 && seems_never_null(obj, data)); 2691 && seems_never_null(obj, data));
2731 2730
2732 // Generate the subtype check 2731 // Generate the subtype check
2733 Node* not_subtype_ctrl = gen_subtype_check( obj_klass, superklass ); 2732 Node* not_subtype_ctrl = gen_subtype_check( obj_klass, superklass );
2734 2733
2735 // Plug in success path into the merge 2734 // Plug in success path into the merge
2736 cast_obj = _gvn.transform(new (C, 2) CheckCastPPNode(control(), 2735 cast_obj = _gvn.transform(new (C) CheckCastPPNode(control(),
2737 not_null_obj, toop)); 2736 not_null_obj, toop));
2738 // Failure path ends in uncommon trap (or may be dead - failure impossible) 2737 // Failure path ends in uncommon trap (or may be dead - failure impossible)
2739 if (failure_control == NULL) { 2738 if (failure_control == NULL) {
2740 if (not_subtype_ctrl != top()) { // If failure is possible 2739 if (not_subtype_ctrl != top()) { // If failure is possible
2741 PreserveJVMState pjvms(this); 2740 PreserveJVMState pjvms(this);
2785 Node* GraphKit::insert_mem_bar(int opcode, Node* precedent) { 2784 Node* GraphKit::insert_mem_bar(int opcode, Node* precedent) {
2786 MemBarNode* mb = MemBarNode::make(C, opcode, Compile::AliasIdxBot, precedent); 2785 MemBarNode* mb = MemBarNode::make(C, opcode, Compile::AliasIdxBot, precedent);
2787 mb->init_req(TypeFunc::Control, control()); 2786 mb->init_req(TypeFunc::Control, control());
2788 mb->init_req(TypeFunc::Memory, reset_memory()); 2787 mb->init_req(TypeFunc::Memory, reset_memory());
2789 Node* membar = _gvn.transform(mb); 2788 Node* membar = _gvn.transform(mb);
2790 set_control(_gvn.transform(new (C, 1) ProjNode(membar,TypeFunc::Control) )); 2789 set_control(_gvn.transform(new (C) ProjNode(membar,TypeFunc::Control) ));
2791 set_all_memory_call(membar); 2790 set_all_memory_call(membar);
2792 return membar; 2791 return membar;
2793 } 2792 }
2794 2793
2795 //-------------------------insert_mem_bar_volatile---------------------------- 2794 //-------------------------insert_mem_bar_volatile----------------------------
2814 } else { 2813 } else {
2815 assert(!(opcode == Op_Initialize && alias_idx != Compile::AliasIdxRaw), "fix caller"); 2814 assert(!(opcode == Op_Initialize && alias_idx != Compile::AliasIdxRaw), "fix caller");
2816 mb->set_req(TypeFunc::Memory, memory(alias_idx)); 2815 mb->set_req(TypeFunc::Memory, memory(alias_idx));
2817 } 2816 }
2818 Node* membar = _gvn.transform(mb); 2817 Node* membar = _gvn.transform(mb);
2819 set_control(_gvn.transform(new (C, 1) ProjNode(membar, TypeFunc::Control))); 2818 set_control(_gvn.transform(new (C) ProjNode(membar, TypeFunc::Control)));
2820 if (alias_idx == Compile::AliasIdxBot) { 2819 if (alias_idx == Compile::AliasIdxBot) {
2821 merged_memory()->set_base_memory(_gvn.transform(new (C, 1) ProjNode(membar, TypeFunc::Memory))); 2820 merged_memory()->set_base_memory(_gvn.transform(new (C) ProjNode(membar, TypeFunc::Memory)));
2822 } else { 2821 } else {
2823 set_memory(_gvn.transform(new (C, 1) ProjNode(membar, TypeFunc::Memory)),alias_idx); 2822 set_memory(_gvn.transform(new (C) ProjNode(membar, TypeFunc::Memory)),alias_idx);
2824 } 2823 }
2825 return membar; 2824 return membar;
2826 } 2825 }
2827 2826
2828 //------------------------------shared_lock------------------------------------ 2827 //------------------------------shared_lock------------------------------------
2838 return NULL; 2837 return NULL;
2839 2838
2840 assert(dead_locals_are_killed(), "should kill locals before sync. point"); 2839 assert(dead_locals_are_killed(), "should kill locals before sync. point");
2841 2840
2842 // Box the stack location 2841 // Box the stack location
2843 Node* box = _gvn.transform(new (C, 1) BoxLockNode(next_monitor())); 2842 Node* box = _gvn.transform(new (C) BoxLockNode(next_monitor()));
2844 Node* mem = reset_memory(); 2843 Node* mem = reset_memory();
2845 2844
2846 FastLockNode * flock = _gvn.transform(new (C, 3) FastLockNode(0, obj, box) )->as_FastLock(); 2845 FastLockNode * flock = _gvn.transform(new (C) FastLockNode(0, obj, box) )->as_FastLock();
2847 if (PrintPreciseBiasedLockingStatistics) { 2846 if (PrintPreciseBiasedLockingStatistics) {
2848 // Create the counters for this fast lock. 2847 // Create the counters for this fast lock.
2849 flock->create_lock_counter(sync_jvms()); // sync_jvms used to get current bci 2848 flock->create_lock_counter(sync_jvms()); // sync_jvms used to get current bci
2850 } 2849 }
2851 // Add monitor to debug info for the slow path. If we block inside the 2850 // Add monitor to debug info for the slow path. If we block inside the
2852 // slow path and de-opt, we need the monitor hanging around 2851 // slow path and de-opt, we need the monitor hanging around
2853 map()->push_monitor( flock ); 2852 map()->push_monitor( flock );
2854 2853
2855 const TypeFunc *tf = LockNode::lock_type(); 2854 const TypeFunc *tf = LockNode::lock_type();
2856 LockNode *lock = new (C, tf->domain()->cnt()) LockNode(C, tf); 2855 LockNode *lock = new (C) LockNode(C, tf);
2857 2856
2858 lock->init_req( TypeFunc::Control, control() ); 2857 lock->init_req( TypeFunc::Control, control() );
2859 lock->init_req( TypeFunc::Memory , mem ); 2858 lock->init_req( TypeFunc::Memory , mem );
2860 lock->init_req( TypeFunc::I_O , top() ) ; // does no i/o 2859 lock->init_req( TypeFunc::I_O , top() ) ; // does no i/o
2861 lock->init_req( TypeFunc::FramePtr, frameptr() ); 2860 lock->init_req( TypeFunc::FramePtr, frameptr() );
2905 2904
2906 // Memory barrier to avoid floating things down past the locked region 2905 // Memory barrier to avoid floating things down past the locked region
2907 insert_mem_bar(Op_MemBarReleaseLock); 2906 insert_mem_bar(Op_MemBarReleaseLock);
2908 2907
2909 const TypeFunc *tf = OptoRuntime::complete_monitor_exit_Type(); 2908 const TypeFunc *tf = OptoRuntime::complete_monitor_exit_Type();
2910 UnlockNode *unlock = new (C, tf->domain()->cnt()) UnlockNode(C, tf); 2909 UnlockNode *unlock = new (C) UnlockNode(C, tf);
2911 uint raw_idx = Compile::AliasIdxRaw; 2910 uint raw_idx = Compile::AliasIdxRaw;
2912 unlock->init_req( TypeFunc::Control, control() ); 2911 unlock->init_req( TypeFunc::Control, control() );
2913 unlock->init_req( TypeFunc::Memory , memory(raw_idx) ); 2912 unlock->init_req( TypeFunc::Memory , memory(raw_idx) );
2914 unlock->init_req( TypeFunc::I_O , top() ) ; // does no i/o 2913 unlock->init_req( TypeFunc::I_O , top() ) ; // does no i/o
2915 unlock->init_req( TypeFunc::FramePtr, frameptr() ); 2914 unlock->init_req( TypeFunc::FramePtr, frameptr() );
2971 const TypeOopPtr* oop_type) { 2970 const TypeOopPtr* oop_type) {
2972 int rawidx = Compile::AliasIdxRaw; 2971 int rawidx = Compile::AliasIdxRaw;
2973 alloc->set_req( TypeFunc::FramePtr, frameptr() ); 2972 alloc->set_req( TypeFunc::FramePtr, frameptr() );
2974 add_safepoint_edges(alloc); 2973 add_safepoint_edges(alloc);
2975 Node* allocx = _gvn.transform(alloc); 2974 Node* allocx = _gvn.transform(alloc);
2976 set_control( _gvn.transform(new (C, 1) ProjNode(allocx, TypeFunc::Control) ) ); 2975 set_control( _gvn.transform(new (C) ProjNode(allocx, TypeFunc::Control) ) );
2977 // create memory projection for i_o 2976 // create memory projection for i_o
2978 set_memory ( _gvn.transform( new (C, 1) ProjNode(allocx, TypeFunc::Memory, true) ), rawidx ); 2977 set_memory ( _gvn.transform( new (C) ProjNode(allocx, TypeFunc::Memory, true) ), rawidx );
2979 make_slow_call_ex(allocx, env()->OutOfMemoryError_klass(), true); 2978 make_slow_call_ex(allocx, env()->OutOfMemoryError_klass(), true);
2980 2979
2981 // create a memory projection as for the normal control path 2980 // create a memory projection as for the normal control path
2982 Node* malloc = _gvn.transform(new (C, 1) ProjNode(allocx, TypeFunc::Memory)); 2981 Node* malloc = _gvn.transform(new (C) ProjNode(allocx, TypeFunc::Memory));
2983 set_memory(malloc, rawidx); 2982 set_memory(malloc, rawidx);
2984 2983
2985 // a normal slow-call doesn't change i_o, but an allocation does 2984 // a normal slow-call doesn't change i_o, but an allocation does
2986 // we create a separate i_o projection for the normal control path 2985 // we create a separate i_o projection for the normal control path
2987 set_i_o(_gvn.transform( new (C, 1) ProjNode(allocx, TypeFunc::I_O, false) ) ); 2986 set_i_o(_gvn.transform( new (C) ProjNode(allocx, TypeFunc::I_O, false) ) );
2988 Node* rawoop = _gvn.transform( new (C, 1) ProjNode(allocx, TypeFunc::Parms) ); 2987 Node* rawoop = _gvn.transform( new (C) ProjNode(allocx, TypeFunc::Parms) );
2989 2988
2990 // put in an initialization barrier 2989 // put in an initialization barrier
2991 InitializeNode* init = insert_mem_bar_volatile(Op_Initialize, rawidx, 2990 InitializeNode* init = insert_mem_bar_volatile(Op_Initialize, rawidx,
2992 rawoop)->as_Initialize(); 2991 rawoop)->as_Initialize();
2993 assert(alloc->initialization() == init, "2-way macro link must work"); 2992 assert(alloc->initialization() == init, "2-way macro link must work");
3019 } 3018 }
3020 } 3019 }
3021 } 3020 }
3022 3021
3023 // Cast raw oop to the real thing... 3022 // Cast raw oop to the real thing...
3024 Node* javaoop = new (C, 2) CheckCastPPNode(control(), rawoop, oop_type); 3023 Node* javaoop = new (C) CheckCastPPNode(control(), rawoop, oop_type);
3025 javaoop = _gvn.transform(javaoop); 3024 javaoop = _gvn.transform(javaoop);
3026 C->set_recent_alloc(control(), javaoop); 3025 C->set_recent_alloc(control(), javaoop);
3027 assert(just_allocated_object(control()) == javaoop, "just allocated"); 3026 assert(just_allocated_object(control()) == javaoop, "just allocated");
3028 3027
3029 #ifdef ASSERT 3028 #ifdef ASSERT
3078 } else { // reflective case 3077 } else { // reflective case
3079 // This reflective path is used by Unsafe.allocateInstance. 3078 // This reflective path is used by Unsafe.allocateInstance.
3080 // (It may be stress-tested by specifying StressReflectiveCode.) 3079 // (It may be stress-tested by specifying StressReflectiveCode.)
3081 // Basically, we want to get into the VM is there's an illegal argument. 3080 // Basically, we want to get into the VM is there's an illegal argument.
3082 Node* bit = intcon(Klass::_lh_instance_slow_path_bit); 3081 Node* bit = intcon(Klass::_lh_instance_slow_path_bit);
3083 initial_slow_test = _gvn.transform( new (C, 3) AndINode(layout_val, bit) ); 3082 initial_slow_test = _gvn.transform( new (C) AndINode(layout_val, bit) );
3084 if (extra_slow_test != intcon(0)) { 3083 if (extra_slow_test != intcon(0)) {
3085 initial_slow_test = _gvn.transform( new (C, 3) OrINode(initial_slow_test, extra_slow_test) ); 3084 initial_slow_test = _gvn.transform( new (C) OrINode(initial_slow_test, extra_slow_test) );
3086 } 3085 }
3087 // (Macro-expander will further convert this to a Bool, if necessary.) 3086 // (Macro-expander will further convert this to a Bool, if necessary.)
3088 } 3087 }
3089 3088
3090 // Find the size in bytes. This is easy; it's the layout_helper. 3089 // Find the size in bytes. This is easy; it's the layout_helper.
3097 size = ConvI2X(layout_val); 3096 size = ConvI2X(layout_val);
3098 3097
3099 // Clear the low bits to extract layout_helper_size_in_bytes: 3098 // Clear the low bits to extract layout_helper_size_in_bytes:
3100 assert((int)Klass::_lh_instance_slow_path_bit < BytesPerLong, "clear bit"); 3099 assert((int)Klass::_lh_instance_slow_path_bit < BytesPerLong, "clear bit");
3101 Node* mask = MakeConX(~ (intptr_t)right_n_bits(LogBytesPerLong)); 3100 Node* mask = MakeConX(~ (intptr_t)right_n_bits(LogBytesPerLong));
3102 size = _gvn.transform( new (C, 3) AndXNode(size, mask) ); 3101 size = _gvn.transform( new (C) AndXNode(size, mask) );
3103 } 3102 }
3104 if (return_size_val != NULL) { 3103 if (return_size_val != NULL) {
3105 (*return_size_val) = size; 3104 (*return_size_val) = size;
3106 } 3105 }
3107 3106
3118 // since GC and deoptimization can happened. 3117 // since GC and deoptimization can happened.
3119 Node *mem = reset_memory(); 3118 Node *mem = reset_memory();
3120 set_all_memory(mem); // Create new memory state 3119 set_all_memory(mem); // Create new memory state
3121 3120
3122 AllocateNode* alloc 3121 AllocateNode* alloc
3123 = new (C, AllocateNode::ParmLimit) 3122 = new (C) AllocateNode(C, AllocateNode::alloc_type(),
3124 AllocateNode(C, AllocateNode::alloc_type(), 3123 control(), mem, i_o(),
3125 control(), mem, i_o(), 3124 size, klass_node,
3126 size, klass_node, 3125 initial_slow_test);
3127 initial_slow_test);
3128 3126
3129 return set_output_for_allocation(alloc, oop_type); 3127 return set_output_for_allocation(alloc, oop_type);
3130 } 3128 }
3131 3129
3132 //-------------------------------new_array------------------------------------- 3130 //-------------------------------new_array-------------------------------------
3145 !too_many_traps(Deoptimization::Reason_class_check)) { 3143 !too_many_traps(Deoptimization::Reason_class_check)) {
3146 // This is a reflective array creation site. 3144 // This is a reflective array creation site.
3147 // Optimistically assume that it is a subtype of Object[], 3145 // Optimistically assume that it is a subtype of Object[],
3148 // so that we can fold up all the address arithmetic. 3146 // so that we can fold up all the address arithmetic.
3149 layout_con = Klass::array_layout_helper(T_OBJECT); 3147 layout_con = Klass::array_layout_helper(T_OBJECT);
3150 Node* cmp_lh = _gvn.transform( new(C, 3) CmpINode(layout_val, intcon(layout_con)) ); 3148 Node* cmp_lh = _gvn.transform( new(C) CmpINode(layout_val, intcon(layout_con)) );
3151 Node* bol_lh = _gvn.transform( new(C, 2) BoolNode(cmp_lh, BoolTest::eq) ); 3149 Node* bol_lh = _gvn.transform( new(C) BoolNode(cmp_lh, BoolTest::eq) );
3152 { BuildCutout unless(this, bol_lh, PROB_MAX); 3150 { BuildCutout unless(this, bol_lh, PROB_MAX);
3153 _sp += nargs; 3151 _sp += nargs;
3154 uncommon_trap(Deoptimization::Reason_class_check, 3152 uncommon_trap(Deoptimization::Reason_class_check,
3155 Deoptimization::Action_maybe_recompile); 3153 Deoptimization::Action_maybe_recompile);
3156 } 3154 }
3170 // Increase the size limit if we have exact knowledge of array type. 3168 // Increase the size limit if we have exact knowledge of array type.
3171 int log2_esize = Klass::layout_helper_log2_element_size(layout_con); 3169 int log2_esize = Klass::layout_helper_log2_element_size(layout_con);
3172 fast_size_limit <<= (LogBytesPerLong - log2_esize); 3170 fast_size_limit <<= (LogBytesPerLong - log2_esize);
3173 } 3171 }
3174 3172
3175 Node* initial_slow_cmp = _gvn.transform( new (C, 3) CmpUNode( length, intcon( fast_size_limit ) ) ); 3173 Node* initial_slow_cmp = _gvn.transform( new (C) CmpUNode( length, intcon( fast_size_limit ) ) );
3176 Node* initial_slow_test = _gvn.transform( new (C, 2) BoolNode( initial_slow_cmp, BoolTest::gt ) ); 3174 Node* initial_slow_test = _gvn.transform( new (C) BoolNode( initial_slow_cmp, BoolTest::gt ) );
3177 if (initial_slow_test->is_Bool()) { 3175 if (initial_slow_test->is_Bool()) {
3178 // Hide it behind a CMoveI, or else PhaseIdealLoop::split_up will get sick. 3176 // Hide it behind a CMoveI, or else PhaseIdealLoop::split_up will get sick.
3179 initial_slow_test = initial_slow_test->as_Bool()->as_int_value(&_gvn); 3177 initial_slow_test = initial_slow_test->as_Bool()->as_int_value(&_gvn);
3180 } 3178 }
3181 3179
3199 header_size_min = hsize; 3197 header_size_min = hsize;
3200 header_size = intcon(hsize + round_mask); 3198 header_size = intcon(hsize + round_mask);
3201 } else { 3199 } else {
3202 Node* hss = intcon(Klass::_lh_header_size_shift); 3200 Node* hss = intcon(Klass::_lh_header_size_shift);
3203 Node* hsm = intcon(Klass::_lh_header_size_mask); 3201 Node* hsm = intcon(Klass::_lh_header_size_mask);
3204 Node* hsize = _gvn.transform( new(C, 3) URShiftINode(layout_val, hss) ); 3202 Node* hsize = _gvn.transform( new(C) URShiftINode(layout_val, hss) );
3205 hsize = _gvn.transform( new(C, 3) AndINode(hsize, hsm) ); 3203 hsize = _gvn.transform( new(C) AndINode(hsize, hsm) );
3206 Node* mask = intcon(round_mask); 3204 Node* mask = intcon(round_mask);
3207 header_size = _gvn.transform( new(C, 3) AddINode(hsize, mask) ); 3205 header_size = _gvn.transform( new(C) AddINode(hsize, mask) );
3208 } 3206 }
3209 3207
3210 Node* elem_shift = NULL; 3208 Node* elem_shift = NULL;
3211 if (layout_is_con) { 3209 if (layout_is_con) {
3212 int eshift = Klass::layout_helper_log2_element_size(layout_con); 3210 int eshift = Klass::layout_helper_log2_element_size(layout_con);
3227 if (tllen != NULL && tllen->_lo < 0) { 3225 if (tllen != NULL && tllen->_lo < 0) {
3228 // Add a manual constraint to a positive range. Cf. array_element_address. 3226 // Add a manual constraint to a positive range. Cf. array_element_address.
3229 jlong size_max = arrayOopDesc::max_array_length(T_BYTE); 3227 jlong size_max = arrayOopDesc::max_array_length(T_BYTE);
3230 if (size_max > tllen->_hi) size_max = tllen->_hi; 3228 if (size_max > tllen->_hi) size_max = tllen->_hi;
3231 const TypeLong* tlcon = TypeLong::make(CONST64(0), size_max, Type::WidenMin); 3229 const TypeLong* tlcon = TypeLong::make(CONST64(0), size_max, Type::WidenMin);
3232 lengthx = _gvn.transform( new (C, 2) ConvI2LNode(length, tlcon)); 3230 lengthx = _gvn.transform( new (C) ConvI2LNode(length, tlcon));
3233 } 3231 }
3234 } 3232 }
3235 #endif 3233 #endif
3236 3234
3237 // Combine header size (plus rounding) and body size. Then round down. 3235 // Combine header size (plus rounding) and body size. Then round down.
3238 // This computation cannot overflow, because it is used only in two 3236 // This computation cannot overflow, because it is used only in two
3239 // places, one where the length is sharply limited, and the other 3237 // places, one where the length is sharply limited, and the other
3240 // after a successful allocation. 3238 // after a successful allocation.
3241 Node* abody = lengthx; 3239 Node* abody = lengthx;
3242 if (elem_shift != NULL) 3240 if (elem_shift != NULL)
3243 abody = _gvn.transform( new(C, 3) LShiftXNode(lengthx, elem_shift) ); 3241 abody = _gvn.transform( new(C) LShiftXNode(lengthx, elem_shift) );
3244 Node* size = _gvn.transform( new(C, 3) AddXNode(headerx, abody) ); 3242 Node* size = _gvn.transform( new(C) AddXNode(headerx, abody) );
3245 if (round_mask != 0) { 3243 if (round_mask != 0) {
3246 Node* mask = MakeConX(~round_mask); 3244 Node* mask = MakeConX(~round_mask);
3247 size = _gvn.transform( new(C, 3) AndXNode(size, mask) ); 3245 size = _gvn.transform( new(C) AndXNode(size, mask) );
3248 } 3246 }
3249 // else if round_mask == 0, the size computation is self-rounding 3247 // else if round_mask == 0, the size computation is self-rounding
3250 3248
3251 if (return_size_val != NULL) { 3249 if (return_size_val != NULL) {
3252 // This is the size 3250 // This is the size
3260 Node *mem = reset_memory(); 3258 Node *mem = reset_memory();
3261 set_all_memory(mem); // Create new memory state 3259 set_all_memory(mem); // Create new memory state
3262 3260
3263 // Create the AllocateArrayNode and its result projections 3261 // Create the AllocateArrayNode and its result projections
3264 AllocateArrayNode* alloc 3262 AllocateArrayNode* alloc
3265 = new (C, AllocateArrayNode::ParmLimit) 3263 = new (C) AllocateArrayNode(C, AllocateArrayNode::alloc_type(),
3266 AllocateArrayNode(C, AllocateArrayNode::alloc_type(), 3264 control(), mem, i_o(),
3267 control(), mem, i_o(), 3265 size, klass_node,
3268 size, klass_node, 3266 initial_slow_test,
3269 initial_slow_test, 3267 length);
3270 length);
3271 3268
3272 // Cast to correct type. Note that the klass_node may be constant or not, 3269 // Cast to correct type. Note that the klass_node may be constant or not,
3273 // and in the latter case the actual array type will be inexact also. 3270 // and in the latter case the actual array type will be inexact also.
3274 // (This happens via a non-constant argument to inline_native_newArray.) 3271 // (This happens via a non-constant argument to inline_native_newArray.)
3275 // In any case, the value of klass_node provides the desired array type. 3272 // In any case, the value of klass_node provides the desired array type.
3384 // do not generate predicate. 3381 // do not generate predicate.
3385 return; 3382 return;
3386 } 3383 }
3387 3384
3388 Node *cont = _gvn.intcon(1); 3385 Node *cont = _gvn.intcon(1);
3389 Node* opq = _gvn.transform(new (C, 2) Opaque1Node(C, cont)); 3386 Node* opq = _gvn.transform(new (C) Opaque1Node(C, cont));
3390 Node *bol = _gvn.transform(new (C, 2) Conv2BNode(opq)); 3387 Node *bol = _gvn.transform(new (C) Conv2BNode(opq));
3391 IfNode* iff = create_and_map_if(control(), bol, PROB_MAX, COUNT_UNKNOWN); 3388 IfNode* iff = create_and_map_if(control(), bol, PROB_MAX, COUNT_UNKNOWN);
3392 Node* iffalse = _gvn.transform(new (C, 1) IfFalseNode(iff)); 3389 Node* iffalse = _gvn.transform(new (C) IfFalseNode(iff));
3393 C->add_predicate_opaq(opq); 3390 C->add_predicate_opaq(opq);
3394 { 3391 {
3395 PreserveJVMState pjvms(this); 3392 PreserveJVMState pjvms(this);
3396 set_control(iffalse); 3393 set_control(iffalse);
3397 _sp += nargs; 3394 _sp += nargs;
3398 uncommon_trap(reason, Deoptimization::Action_maybe_recompile); 3395 uncommon_trap(reason, Deoptimization::Action_maybe_recompile);
3399 } 3396 }
3400 Node* iftrue = _gvn.transform(new (C, 1) IfTrueNode(iff)); 3397 Node* iftrue = _gvn.transform(new (C) IfTrueNode(iff));
3401 set_control(iftrue); 3398 set_control(iftrue);
3402 } 3399 }
3403 3400
3404 //------------------------------add_predicate--------------------------------- 3401 //------------------------------add_predicate---------------------------------
3405 void GraphKit::add_predicate(int nargs) { 3402 void GraphKit::add_predicate(int nargs) {
3588 Node* next_index = __ SubI(index, __ ConI(sizeof(intptr_t))); 3585 Node* next_index = __ SubI(index, __ ConI(sizeof(intptr_t)));
3589 Node* next_indexX = next_index; 3586 Node* next_indexX = next_index;
3590 #ifdef _LP64 3587 #ifdef _LP64
3591 // We could refine the type for what it's worth 3588 // We could refine the type for what it's worth
3592 // const TypeLong* lidxtype = TypeLong::make(CONST64(0), get_size_from_queue); 3589 // const TypeLong* lidxtype = TypeLong::make(CONST64(0), get_size_from_queue);
3593 next_indexX = _gvn.transform( new (C, 2) ConvI2LNode(next_index, TypeLong::make(0, max_jlong, Type::WidenMax)) ); 3590 next_indexX = _gvn.transform( new (C) ConvI2LNode(next_index, TypeLong::make(0, max_jlong, Type::WidenMax)) );
3594 #endif 3591 #endif
3595 3592
3596 // Now get the buffer location we will log the previous value into and store it 3593 // Now get the buffer location we will log the previous value into and store it
3597 Node *log_addr = __ AddP(no_base, buffer, next_indexX); 3594 Node *log_addr = __ AddP(no_base, buffer, next_indexX);
3598 __ store(__ ctrl(), log_addr, pre_val, T_OBJECT, Compile::AliasIdxRaw); 3595 __ store(__ ctrl(), log_addr, pre_val, T_OBJECT, Compile::AliasIdxRaw);
3636 Node* next_index = __ SubI(index, __ ConI(sizeof(intptr_t))); 3633 Node* next_index = __ SubI(index, __ ConI(sizeof(intptr_t)));
3637 Node* next_indexX = next_index; 3634 Node* next_indexX = next_index;
3638 #ifdef _LP64 3635 #ifdef _LP64
3639 // We could refine the type for what it's worth 3636 // We could refine the type for what it's worth
3640 // const TypeLong* lidxtype = TypeLong::make(CONST64(0), get_size_from_queue); 3637 // const TypeLong* lidxtype = TypeLong::make(CONST64(0), get_size_from_queue);
3641 next_indexX = _gvn.transform( new (C, 2) ConvI2LNode(next_index, TypeLong::make(0, max_jlong, Type::WidenMax)) ); 3638 next_indexX = _gvn.transform( new (C) ConvI2LNode(next_index, TypeLong::make(0, max_jlong, Type::WidenMax)) );
3642 #endif // _LP64 3639 #endif // _LP64
3643 Node* log_addr = __ AddP(no_base, buffer, next_indexX); 3640 Node* log_addr = __ AddP(no_base, buffer, next_indexX);
3644 3641
3645 __ store(__ ctrl(), log_addr, card_adr, T_ADDRESS, Compile::AliasIdxRaw); 3642 __ store(__ ctrl(), log_addr, card_adr, T_ADDRESS, Compile::AliasIdxRaw);
3646 __ store(__ ctrl(), index_adr, next_index, T_INT, Compile::AliasIdxRaw); 3643 __ store(__ ctrl(), index_adr, next_index, T_INT, Compile::AliasIdxRaw);