1528 // Iterative Global Value Numbering, including ideal transforms 1529 // Initialize IterGVN with types and values from parse-time GVN 1530 PhaseIterGVN igvn(initial_gvn()); 1531 { 1532 NOT_PRODUCT( TracePhase t2("iterGVN", &_t_iterGVN, TimeCompiler); ) 1533 igvn.optimize(); 1534 } 1535 1536 print_method("Iter GVN 1", 2); 1537 1538 if (failing()) return; 1539 1540 // Loop transforms on the ideal graph. Range Check Elimination, 1541 // peeling, unrolling, etc. 1542 1543 // Set loop opts counter 1544 loop_opts_cnt = num_loop_opts(); 1545 if((loop_opts_cnt > 0) && (has_loops() || has_split_ifs())) { 1546 { 1547 TracePhase t2("idealLoop", &_t_idealLoop, true); 1548 PhaseIdealLoop ideal_loop( igvn, NULL, true ); 1549 loop_opts_cnt--; 1550 if (major_progress()) print_method("PhaseIdealLoop 1", 2); 1551 if (failing()) return; 1552 } 1553 // Loop opts pass if partial peeling occurred in previous pass 1554 if(PartialPeelLoop && major_progress() && (loop_opts_cnt > 0)) { 1555 TracePhase t3("idealLoop", &_t_idealLoop, true); 1556 PhaseIdealLoop ideal_loop( igvn, NULL, false ); 1557 loop_opts_cnt--; 1558 if (major_progress()) print_method("PhaseIdealLoop 2", 2); 1559 if (failing()) return; 1560 } 1561 // Loop opts pass for loop-unrolling before CCP 1562 if(major_progress() && (loop_opts_cnt > 0)) { 1563 TracePhase t4("idealLoop", &_t_idealLoop, true); 1564 PhaseIdealLoop ideal_loop( igvn, NULL, false ); 1565 loop_opts_cnt--; 1566 if (major_progress()) print_method("PhaseIdealLoop 3", 2); 1567 } 1568 } 1569 if (failing()) return; 1570 1571 // Conditional Constant Propagation; 1572 PhaseCCP ccp( &igvn ); 1573 assert( true, "Break here to ccp.dump_nodes_and_types(_root,999,1)"); 1574 { 1575 TracePhase t2("ccp", &_t_ccp, true); 1576 ccp.do_transform(); 1577 } 1578 print_method("PhaseCPP 1", 2); 1579 1580 assert( true, "Break here to ccp.dump_old2new_map()"); 1581 1582 // Iterative Global Value Numbering, including ideal transforms 1583 { 1584 NOT_PRODUCT( TracePhase t2("iterGVN2", &_t_iterGVN2, TimeCompiler); ) 1585 igvn = ccp; 1586 igvn.optimize(); 1587 } 1588 1589 print_method("Iter GVN 2", 2); 1590 1591 if (failing()) return; 1592 1593 // Loop transforms on the ideal graph. Range Check Elimination, 1594 // peeling, unrolling, etc. 1595 if(loop_opts_cnt > 0) { 1596 debug_only( int cnt = 0; ); 1597 while(major_progress() && (loop_opts_cnt > 0)) { 1598 TracePhase t2("idealLoop", &_t_idealLoop, true); 1599 assert( cnt++ < 40, "infinite cycle in loop optimization" ); 1600 PhaseIdealLoop ideal_loop( igvn, NULL, true ); 1601 loop_opts_cnt--; 1602 if (major_progress()) print_method("PhaseIdealLoop iterations", 2); 1603 if (failing()) return; 1604 } 1605 } 1606 { 1607 NOT_PRODUCT( TracePhase t2("macroExpand", &_t_macroExpand, TimeCompiler); ) 1608 PhaseMacroExpand mex(igvn); 1609 if (mex.expand_macro_nodes()) { 1610 assert(failing(), "must bail out w/ explicit message"); 1611 return; 1612 } 1613 } 1614 1615 } // (End scope of igvn; run destructor if necessary for asserts.) 1616 1617 // A method with only infinite loops has no edges entering loops from root 1618 { 1619 NOT_PRODUCT( TracePhase t2("graphReshape", &_t_graphReshaping, TimeCompiler); ) 1620 if (final_graph_reshaping()) { 1621 assert(failing(), "must bail out w/ explicit message"); 1622 return; 1623 } 1624 } 1625 1626 print_method("Optimize finished", 2); | 1528 // Iterative Global Value Numbering, including ideal transforms 1529 // Initialize IterGVN with types and values from parse-time GVN 1530 PhaseIterGVN igvn(initial_gvn()); 1531 { 1532 NOT_PRODUCT( TracePhase t2("iterGVN", &_t_iterGVN, TimeCompiler); ) 1533 igvn.optimize(); 1534 } 1535 1536 print_method("Iter GVN 1", 2); 1537 1538 if (failing()) return; 1539 1540 // Loop transforms on the ideal graph. Range Check Elimination, 1541 // peeling, unrolling, etc. 1542 1543 // Set loop opts counter 1544 loop_opts_cnt = num_loop_opts(); 1545 if((loop_opts_cnt > 0) && (has_loops() || has_split_ifs())) { 1546 { 1547 TracePhase t2("idealLoop", &_t_idealLoop, true); 1548 PhaseIdealLoop ideal_loop( igvn, true ); 1549 loop_opts_cnt--; 1550 if (major_progress()) print_method("PhaseIdealLoop 1", 2); 1551 if (failing()) return; 1552 } 1553 // Loop opts pass if partial peeling occurred in previous pass 1554 if(PartialPeelLoop && major_progress() && (loop_opts_cnt > 0)) { 1555 TracePhase t3("idealLoop", &_t_idealLoop, true); 1556 PhaseIdealLoop ideal_loop( igvn, false ); 1557 loop_opts_cnt--; 1558 if (major_progress()) print_method("PhaseIdealLoop 2", 2); 1559 if (failing()) return; 1560 } 1561 // Loop opts pass for loop-unrolling before CCP 1562 if(major_progress() && (loop_opts_cnt > 0)) { 1563 TracePhase t4("idealLoop", &_t_idealLoop, true); 1564 PhaseIdealLoop ideal_loop( igvn, false ); 1565 loop_opts_cnt--; 1566 if (major_progress()) print_method("PhaseIdealLoop 3", 2); 1567 } 1568 if (!failing()) { 1569 // Verify that last round of loop opts produced a valid graph 1570 NOT_PRODUCT( TracePhase t2("idealLoopVerify", &_t_idealLoopVerify, TimeCompiler); ) 1571 PhaseIdealLoop::verify(igvn); 1572 } 1573 } 1574 if (failing()) return; 1575 1576 // Conditional Constant Propagation; 1577 PhaseCCP ccp( &igvn ); 1578 assert( true, "Break here to ccp.dump_nodes_and_types(_root,999,1)"); 1579 { 1580 TracePhase t2("ccp", &_t_ccp, true); 1581 ccp.do_transform(); 1582 } 1583 print_method("PhaseCPP 1", 2); 1584 1585 assert( true, "Break here to ccp.dump_old2new_map()"); 1586 1587 // Iterative Global Value Numbering, including ideal transforms 1588 { 1589 NOT_PRODUCT( TracePhase t2("iterGVN2", &_t_iterGVN2, TimeCompiler); ) 1590 igvn = ccp; 1591 igvn.optimize(); 1592 } 1593 1594 print_method("Iter GVN 2", 2); 1595 1596 if (failing()) return; 1597 1598 // Loop transforms on the ideal graph. Range Check Elimination, 1599 // peeling, unrolling, etc. 1600 if(loop_opts_cnt > 0) { 1601 debug_only( int cnt = 0; ); 1602 while(major_progress() && (loop_opts_cnt > 0)) { 1603 TracePhase t2("idealLoop", &_t_idealLoop, true); 1604 assert( cnt++ < 40, "infinite cycle in loop optimization" ); 1605 PhaseIdealLoop ideal_loop( igvn, true ); 1606 loop_opts_cnt--; 1607 if (major_progress()) print_method("PhaseIdealLoop iterations", 2); 1608 if (failing()) return; 1609 } 1610 } 1611 1612 { 1613 // Verify that all previous optimizations produced a valid graph 1614 // at least to this point, even if no loop optimizations were done. 1615 NOT_PRODUCT( TracePhase t2("idealLoopVerify", &_t_idealLoopVerify, TimeCompiler); ) 1616 PhaseIdealLoop::verify(igvn); 1617 } 1618 1619 { 1620 NOT_PRODUCT( TracePhase t2("macroExpand", &_t_macroExpand, TimeCompiler); ) 1621 PhaseMacroExpand mex(igvn); 1622 if (mex.expand_macro_nodes()) { 1623 assert(failing(), "must bail out w/ explicit message"); 1624 return; 1625 } 1626 } 1627 1628 } // (End scope of igvn; run destructor if necessary for asserts.) 1629 1630 // A method with only infinite loops has no edges entering loops from root 1631 { 1632 NOT_PRODUCT( TracePhase t2("graphReshape", &_t_graphReshaping, TimeCompiler); ) 1633 if (final_graph_reshaping()) { 1634 assert(failing(), "must bail out w/ explicit message"); 1635 return; 1636 } 1637 } 1638 1639 print_method("Optimize finished", 2); |