hotspot/src/share/vm/opto/block.cpp
changeset 1070 e03de091796e
parent 1 489c9b5090e2
child 1217 5eb97f366a6a
equal deleted inserted replaced
1069:ef51f81ebe0f 1070:e03de091796e
   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