Mercurial > hg > truffle
comparison src/share/vm/opto/block.cpp @ 308:756b58154237
6611837: block frequency is zero
Summary: insert_goto_at should set frequency for newly created blocks
Reviewed-by: never
author | rasbold |
---|---|
date | Thu, 28 Aug 2008 10:22:12 -0700 |
parents | a61af66fc99e |
children | 9ee9cf798b59 |
comparison
equal
deleted
inserted
replaced
307:892493c3d862 | 308:756b58154237 |
---|---|
465 assert(block_no < _num_blocks, "illegal block number"); | 465 assert(block_no < _num_blocks, "illegal block number"); |
466 Block* in = _blocks[block_no]; | 466 Block* in = _blocks[block_no]; |
467 // get successor block succ_no | 467 // get successor block succ_no |
468 assert(succ_no < in->_num_succs, "illegal successor number"); | 468 assert(succ_no < in->_num_succs, "illegal successor number"); |
469 Block* out = in->_succs[succ_no]; | 469 Block* out = in->_succs[succ_no]; |
470 // Compute frequency of the new block. Do this before inserting | |
471 // new block in case succ_prob() needs to infer the probability from | |
472 // surrounding blocks. | |
473 float freq = in->_freq * in->succ_prob(succ_no); | |
470 // get ProjNode corresponding to the succ_no'th successor of the in block | 474 // get ProjNode corresponding to the succ_no'th successor of the in block |
471 ProjNode* proj = in->_nodes[in->_nodes.size() - in->_num_succs + succ_no]->as_Proj(); | 475 ProjNode* proj = in->_nodes[in->_nodes.size() - in->_num_succs + succ_no]->as_Proj(); |
472 // create region for basic block | 476 // create region for basic block |
473 RegionNode* region = new (C, 2) RegionNode(2); | 477 RegionNode* region = new (C, 2) RegionNode(2); |
474 region->init_req(1, proj); | 478 region->init_req(1, proj); |
489 for (uint i = 1; i < out->num_preds(); i++) { | 493 for (uint i = 1; i < out->num_preds(); i++) { |
490 if (out->pred(i) == proj) out->head()->set_req(i, gto); | 494 if (out->pred(i) == proj) out->head()->set_req(i, gto); |
491 } | 495 } |
492 // remap predecessor's successor to new block | 496 // remap predecessor's successor to new block |
493 in->_succs.map(succ_no, block); | 497 in->_succs.map(succ_no, block); |
498 // Set the frequency of the new block | |
499 block->_freq = freq; | |
494 // add new basic block to basic block list | 500 // add new basic block to basic block list |
495 _blocks.insert(block_no + 1, block); | 501 _blocks.insert(block_no + 1, block); |
496 _num_blocks++; | 502 _num_blocks++; |
497 } | 503 } |
498 | 504 |