Mercurial > hg > truffle
comparison src/share/vm/opto/ifg.cpp @ 12167:650868c062a9
8023691: Create interface for nodes in class Block
Summary: Create public methods for accessing the nodes in a block
Reviewed-by: kvn, roland
author | adlertz |
---|---|
date | Mon, 26 Aug 2013 12:50:23 +0200 |
parents | adb9a7d94cb5 |
children | d8a449d2f5b2 |
comparison
equal
deleted
inserted
replaced
12161:e1fbb86b47e4 | 12167:650868c062a9 |
---|---|
317 // (and removes it from the live-ness set) that value is certainly live. | 317 // (and removes it from the live-ness set) that value is certainly live. |
318 // The defined value interferes with everything currently live. The | 318 // The defined value interferes with everything currently live. The |
319 // value is then removed from the live-ness set and it's inputs are | 319 // value is then removed from the live-ness set and it's inputs are |
320 // added to the live-ness set. | 320 // added to the live-ness set. |
321 for (uint j = block->end_idx() + 1; j > 1; j--) { | 321 for (uint j = block->end_idx() + 1; j > 1; j--) { |
322 Node* n = block->_nodes[j - 1]; | 322 Node* n = block->get_node(j - 1); |
323 | 323 |
324 // Get value being defined | 324 // Get value being defined |
325 uint r = _lrg_map.live_range_id(n); | 325 uint r = _lrg_map.live_range_id(n); |
326 | 326 |
327 // Some special values do not allocate | 327 // Some special values do not allocate |
454 IndexSet liveout(_live->live(block)); | 454 IndexSet liveout(_live->live(block)); |
455 uint last_inst = block->end_idx(); | 455 uint last_inst = block->end_idx(); |
456 // Compute first nonphi node index | 456 // Compute first nonphi node index |
457 uint first_inst; | 457 uint first_inst; |
458 for (first_inst = 1; first_inst < last_inst; first_inst++) { | 458 for (first_inst = 1; first_inst < last_inst; first_inst++) { |
459 if (!block->_nodes[first_inst]->is_Phi()) { | 459 if (!block->get_node(first_inst)->is_Phi()) { |
460 break; | 460 break; |
461 } | 461 } |
462 } | 462 } |
463 | 463 |
464 // Spills could be inserted before CreateEx node which should be | 464 // Spills could be inserted before CreateEx node which should be |
465 // first instruction in block after Phis. Move CreateEx up. | 465 // first instruction in block after Phis. Move CreateEx up. |
466 for (uint insidx = first_inst; insidx < last_inst; insidx++) { | 466 for (uint insidx = first_inst; insidx < last_inst; insidx++) { |
467 Node *ex = block->_nodes[insidx]; | 467 Node *ex = block->get_node(insidx); |
468 if (ex->is_SpillCopy()) { | 468 if (ex->is_SpillCopy()) { |
469 continue; | 469 continue; |
470 } | 470 } |
471 if (insidx > first_inst && ex->is_Mach() && ex->as_Mach()->ideal_Opcode() == Op_CreateEx) { | 471 if (insidx > first_inst && ex->is_Mach() && ex->as_Mach()->ideal_Opcode() == Op_CreateEx) { |
472 // If the CreateEx isn't above all the MachSpillCopies | 472 // If the CreateEx isn't above all the MachSpillCopies |
473 // then move it to the top. | 473 // then move it to the top. |
474 block->_nodes.remove(insidx); | 474 block->remove_node(insidx); |
475 block->_nodes.insert(first_inst, ex); | 475 block->insert_node(ex, first_inst); |
476 } | 476 } |
477 // Stop once a CreateEx or any other node is found | 477 // Stop once a CreateEx or any other node is found |
478 break; | 478 break; |
479 } | 479 } |
480 | 480 |
521 // The defined value interferes with everything currently live. The | 521 // The defined value interferes with everything currently live. The |
522 // value is then removed from the live-ness set and it's inputs are added | 522 // value is then removed from the live-ness set and it's inputs are added |
523 // to the live-ness set. | 523 // to the live-ness set. |
524 uint j; | 524 uint j; |
525 for (j = last_inst + 1; j > 1; j--) { | 525 for (j = last_inst + 1; j > 1; j--) { |
526 Node* n = block->_nodes[j - 1]; | 526 Node* n = block->get_node(j - 1); |
527 | 527 |
528 // Get value being defined | 528 // Get value being defined |
529 uint r = _lrg_map.live_range_id(n); | 529 uint r = _lrg_map.live_range_id(n); |
530 | 530 |
531 // Some special values do not allocate | 531 // Some special values do not allocate |
539 if( !liveout.member(r) && n->Opcode() != Op_SafePoint ) { | 539 if( !liveout.member(r) && n->Opcode() != Op_SafePoint ) { |
540 Node *def = n->in(0); | 540 Node *def = n->in(0); |
541 if( !n->is_Proj() || | 541 if( !n->is_Proj() || |
542 // Could also be a flags-projection of a dead ADD or such. | 542 // Could also be a flags-projection of a dead ADD or such. |
543 (_lrg_map.live_range_id(def) && !liveout.member(_lrg_map.live_range_id(def)))) { | 543 (_lrg_map.live_range_id(def) && !liveout.member(_lrg_map.live_range_id(def)))) { |
544 block->_nodes.remove(j - 1); | 544 block->remove_node(j - 1); |
545 if (lrgs(r)._def == n) { | 545 if (lrgs(r)._def == n) { |
546 lrgs(r)._def = 0; | 546 lrgs(r)._def = 0; |
547 } | 547 } |
548 n->disconnect_inputs(NULL, C); | 548 n->disconnect_inputs(NULL, C); |
549 _cfg.unmap_node_from_block(n); | 549 _cfg.unmap_node_from_block(n); |
603 | 603 |
604 // Find first non SpillCopy 'm' that follows the current instruction | 604 // Find first non SpillCopy 'm' that follows the current instruction |
605 // (j - 1) is index for current instruction 'n' | 605 // (j - 1) is index for current instruction 'n' |
606 Node *m = n; | 606 Node *m = n; |
607 for (uint i = j; i <= last_inst && m->is_SpillCopy(); ++i) { | 607 for (uint i = j; i <= last_inst && m->is_SpillCopy(); ++i) { |
608 m = block->_nodes[i]; | 608 m = block->get_node(i); |
609 } | 609 } |
610 if (m == single_use) { | 610 if (m == single_use) { |
611 lrgs(r)._area = 0.0; | 611 lrgs(r)._area = 0.0; |
612 } | 612 } |
613 } | 613 } |
770 } | 770 } |
771 } | 771 } |
772 | 772 |
773 // Compute high pressure indice; avoid landing in the middle of projnodes | 773 // Compute high pressure indice; avoid landing in the middle of projnodes |
774 j = hrp_index[0]; | 774 j = hrp_index[0]; |
775 if (j < block->_nodes.size() && j < block->end_idx() + 1) { | 775 if (j < block->number_of_nodes() && j < block->end_idx() + 1) { |
776 Node* cur = block->_nodes[j]; | 776 Node* cur = block->get_node(j); |
777 while (cur->is_Proj() || (cur->is_MachNullCheck()) || cur->is_Catch()) { | 777 while (cur->is_Proj() || (cur->is_MachNullCheck()) || cur->is_Catch()) { |
778 j--; | 778 j--; |
779 cur = block->_nodes[j]; | 779 cur = block->get_node(j); |
780 } | 780 } |
781 } | 781 } |
782 block->_ihrp_index = j; | 782 block->_ihrp_index = j; |
783 j = hrp_index[1]; | 783 j = hrp_index[1]; |
784 if (j < block->_nodes.size() && j < block->end_idx() + 1) { | 784 if (j < block->number_of_nodes() && j < block->end_idx() + 1) { |
785 Node* cur = block->_nodes[j]; | 785 Node* cur = block->get_node(j); |
786 while (cur->is_Proj() || (cur->is_MachNullCheck()) || cur->is_Catch()) { | 786 while (cur->is_Proj() || (cur->is_MachNullCheck()) || cur->is_Catch()) { |
787 j--; | 787 j--; |
788 cur = block->_nodes[j]; | 788 cur = block->get_node(j); |
789 } | 789 } |
790 } | 790 } |
791 block->_fhrp_index = j; | 791 block->_fhrp_index = j; |
792 | 792 |
793 #ifndef PRODUCT | 793 #ifndef PRODUCT |