--- a/hotspot/src/share/vm/opto/compile.cpp Thu Aug 15 11:59:19 2013 -0700
+++ b/hotspot/src/share/vm/opto/compile.cpp Fri Aug 16 10:23:55 2013 +0200
@@ -2136,7 +2136,9 @@
//------------------------------Code_Gen---------------------------------------
// Given a graph, generate code for it
void Compile::Code_Gen() {
- if (failing()) return;
+ if (failing()) {
+ return;
+ }
// Perform instruction selection. You might think we could reclaim Matcher
// memory PDQ, but actually the Matcher is used in generating spill code.
@@ -2148,12 +2150,11 @@
// nodes. Mapping is only valid at the root of each matched subtree.
NOT_PRODUCT( verify_graph_edges(); )
- Node_List proj_list;
- Matcher m(proj_list);
- _matcher = &m;
+ Matcher matcher;
+ _matcher = &matcher;
{
TracePhase t2("matcher", &_t_matcher, true);
- m.match();
+ matcher.match();
}
// In debug mode can dump m._nodes.dump() for mapping of ideal to machine
// nodes. Mapping is only valid at the root of each matched subtree.
@@ -2161,31 +2162,26 @@
// If you have too many nodes, or if matching has failed, bail out
check_node_count(0, "out of nodes matching instructions");
- if (failing()) return;
+ if (failing()) {
+ return;
+ }
// Build a proper-looking CFG
- PhaseCFG cfg(node_arena(), root(), m);
+ PhaseCFG cfg(node_arena(), root(), matcher);
_cfg = &cfg;
{
NOT_PRODUCT( TracePhase t2("scheduler", &_t_scheduler, TimeCompiler); )
- cfg.Dominators();
- if (failing()) return;
-
- NOT_PRODUCT( verify_graph_edges(); )
-
- cfg.Estimate_Block_Frequency();
- cfg.GlobalCodeMotion(m,unique(),proj_list);
- if (failing()) return;
+ bool success = cfg.do_global_code_motion();
+ if (!success) {
+ return;
+ }
print_method(PHASE_GLOBAL_CODE_MOTION, 2);
-
NOT_PRODUCT( verify_graph_edges(); )
-
debug_only( cfg.verify(); )
}
- NOT_PRODUCT( verify_graph_edges(); )
-
- PhaseChaitin regalloc(unique(), cfg, m);
+
+ PhaseChaitin regalloc(unique(), cfg, matcher);
_regalloc = ®alloc;
{
TracePhase t2("regalloc", &_t_registerAllocation, true);
@@ -2206,7 +2202,7 @@
// can now safely remove it.
{
NOT_PRODUCT( TracePhase t2("blockOrdering", &_t_blockOrdering, TimeCompiler); )
- cfg.remove_empty();
+ cfg.remove_empty_blocks();
if (do_freq_based_layout()) {
PhaseBlockLayout layout(cfg);
} else {
@@ -2253,38 +2249,50 @@
_regalloc->dump_frame();
Node *n = NULL;
- for( uint i=0; i<_cfg->_num_blocks; i++ ) {
- if (VMThread::should_terminate()) { cut_short = true; break; }
- Block *b = _cfg->_blocks[i];
- if (b->is_connector() && !Verbose) continue;
- n = b->_nodes[0];
- if (pcs && n->_idx < pc_limit)
+ for (uint i = 0; i < _cfg->number_of_blocks(); i++) {
+ if (VMThread::should_terminate()) {
+ cut_short = true;
+ break;
+ }
+ Block* block = _cfg->get_block(i);
+ if (block->is_connector() && !Verbose) {
+ continue;
+ }
+ n = block->_nodes[0];
+ if (pcs && n->_idx < pc_limit) {
tty->print("%3.3x ", pcs[n->_idx]);
- else
+ } else {
tty->print(" ");
- b->dump_head(_cfg);
- if (b->is_connector()) {
+ }
+ block->dump_head(_cfg);
+ if (block->is_connector()) {
tty->print_cr(" # Empty connector block");
- } else if (b->num_preds() == 2 && b->pred(1)->is_CatchProj() && b->pred(1)->as_CatchProj()->_con == CatchProjNode::fall_through_index) {
+ } else if (block->num_preds() == 2 && block->pred(1)->is_CatchProj() && block->pred(1)->as_CatchProj()->_con == CatchProjNode::fall_through_index) {
tty->print_cr(" # Block is sole successor of call");
}
// For all instructions
Node *delay = NULL;
- for( uint j = 0; j<b->_nodes.size(); j++ ) {
- if (VMThread::should_terminate()) { cut_short = true; break; }
- n = b->_nodes[j];
+ for (uint j = 0; j < block->_nodes.size(); j++) {
+ if (VMThread::should_terminate()) {
+ cut_short = true;
+ break;
+ }
+ n = block->_nodes[j];
if (valid_bundle_info(n)) {
- Bundle *bundle = node_bundling(n);
+ Bundle* bundle = node_bundling(n);
if (bundle->used_in_unconditional_delay()) {
delay = n;
continue;
}
- if (bundle->starts_bundle())
+ if (bundle->starts_bundle()) {
starts_bundle = '+';
+ }
}
- if (WizardMode) n->dump();
+ if (WizardMode) {
+ n->dump();
+ }
if( !n->is_Region() && // Dont print in the Assembly
!n->is_Phi() && // a few noisely useless nodes