Mercurial > hg > truffle
comparison src/share/vm/opto/postaloc.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 | f01788f13696 |
comparison
equal
deleted
inserted
replaced
12161:e1fbb86b47e4 | 12167:650868c062a9 |
---|---|
421 uint j; | 421 uint j; |
422 Block* block = _cfg.get_block(i); | 422 Block* block = _cfg.get_block(i); |
423 | 423 |
424 // Count of Phis in block | 424 // Count of Phis in block |
425 uint phi_dex; | 425 uint phi_dex; |
426 for (phi_dex = 1; phi_dex < block->_nodes.size(); phi_dex++) { | 426 for (phi_dex = 1; phi_dex < block->number_of_nodes(); phi_dex++) { |
427 Node* phi = block->_nodes[phi_dex]; | 427 Node* phi = block->get_node(phi_dex); |
428 if (!phi->is_Phi()) { | 428 if (!phi->is_Phi()) { |
429 break; | 429 break; |
430 } | 430 } |
431 } | 431 } |
432 | 432 |
437 Block *freed = NULL; | 437 Block *freed = NULL; |
438 for (j = 1; j < block->num_preds(); j++) { | 438 for (j = 1; j < block->num_preds(); j++) { |
439 Block* pb = _cfg.get_block_for_node(block->pred(j)); | 439 Block* pb = _cfg.get_block_for_node(block->pred(j)); |
440 // Remove copies along phi edges | 440 // Remove copies along phi edges |
441 for (uint k = 1; k < phi_dex; k++) { | 441 for (uint k = 1; k < phi_dex; k++) { |
442 elide_copy(block->_nodes[k], j, block, *blk2value[pb->_pre_order], *blk2regnd[pb->_pre_order], false); | 442 elide_copy(block->get_node(k), j, block, *blk2value[pb->_pre_order], *blk2regnd[pb->_pre_order], false); |
443 } | 443 } |
444 if (blk2value[pb->_pre_order]) { // Have a mapping on this edge? | 444 if (blk2value[pb->_pre_order]) { // Have a mapping on this edge? |
445 // See if this predecessor's mappings have been used by everybody | 445 // See if this predecessor's mappings have been used by everybody |
446 // who wants them. If so, free 'em. | 446 // who wants them. If so, free 'em. |
447 uint k; | 447 uint k; |
508 } | 508 } |
509 | 509 |
510 // For all Phi's | 510 // For all Phi's |
511 for (j = 1; j < phi_dex; j++) { | 511 for (j = 1; j < phi_dex; j++) { |
512 uint k; | 512 uint k; |
513 Node *phi = block->_nodes[j]; | 513 Node *phi = block->get_node(j); |
514 uint pidx = _lrg_map.live_range_id(phi); | 514 uint pidx = _lrg_map.live_range_id(phi); |
515 OptoReg::Name preg = lrgs(_lrg_map.live_range_id(phi)).reg(); | 515 OptoReg::Name preg = lrgs(_lrg_map.live_range_id(phi)).reg(); |
516 | 516 |
517 // Remove copies remaining on edges. Check for junk phi. | 517 // Remove copies remaining on edges. Check for junk phi. |
518 Node *u = NULL; | 518 Node *u = NULL; |
520 Node *x = phi->in(k); | 520 Node *x = phi->in(k); |
521 if( phi != x && u != x ) // Found a different input | 521 if( phi != x && u != x ) // Found a different input |
522 u = u ? NodeSentinel : x; // Capture unique input, or NodeSentinel for 2nd input | 522 u = u ? NodeSentinel : x; // Capture unique input, or NodeSentinel for 2nd input |
523 } | 523 } |
524 if (u != NodeSentinel) { // Junk Phi. Remove | 524 if (u != NodeSentinel) { // Junk Phi. Remove |
525 block->_nodes.remove(j--); | 525 block->remove_node(j--); |
526 phi_dex--; | 526 phi_dex--; |
527 _cfg.unmap_node_from_block(phi); | 527 _cfg.unmap_node_from_block(phi); |
528 phi->replace_by(u); | 528 phi->replace_by(u); |
529 phi->disconnect_inputs(NULL, C); | 529 phi->disconnect_inputs(NULL, C); |
530 continue; | 530 continue; |
550 } | 550 } |
551 } | 551 } |
552 } | 552 } |
553 | 553 |
554 // For all remaining instructions | 554 // For all remaining instructions |
555 for (j = phi_dex; j < block->_nodes.size(); j++) { | 555 for (j = phi_dex; j < block->number_of_nodes(); j++) { |
556 Node* n = block->_nodes[j]; | 556 Node* n = block->get_node(j); |
557 | 557 |
558 if(n->outcnt() == 0 && // Dead? | 558 if(n->outcnt() == 0 && // Dead? |
559 n != C->top() && // (ignore TOP, it has no du info) | 559 n != C->top() && // (ignore TOP, it has no du info) |
560 !n->is_Proj() ) { // fat-proj kills | 560 !n->is_Proj() ) { // fat-proj kills |
561 j -= yank_if_dead(n, block, &value, ®nd); | 561 j -= yank_if_dead(n, block, &value, ®nd); |