2557 case Node::Class_Allocate:
2558 case Node::Class_AllocateArray:
2559 success = eliminate_allocate_node(n->as_Allocate());
2560 break;
2561 case Node::Class_CallStaticJava:
2562 success = eliminate_boxing_node(n->as_CallStaticJava());
2563 break;
2564 case Node::Class_Lock:
2565 case Node::Class_Unlock:
2566 assert(!n->as_AbstractLock()->is_eliminated(), "sanity");
2567 _has_locks = true;
2568 break;
2569 case Node::Class_ArrayCopy:
2570 break;
2571 case Node::Class_OuterStripMinedLoop:
2572 break;
2573 default:
2574 assert(n->Opcode() == Op_LoopLimit ||
2575 n->Opcode() == Op_Opaque1 ||
2576 n->Opcode() == Op_Opaque2 ||
2577 n->Opcode() == Op_Opaque3, "unknown node type in macro list");
2578 }
2579 assert(success == (C->macro_count() < old_macro_count), "elimination reduces macro count");
2580 progress = progress || success;
2581 }
2582 }
2583 }
2584
2585 //------------------------------expand_macro_nodes----------------------
2586 // Returns true if a failure occurred.
2587 bool PhaseMacroExpand::expand_macro_nodes() {
2588 // Last attempt to eliminate macro nodes.
2589 eliminate_macro_nodes();
2590
2591 // Make sure expansion will not cause node limit to be exceeded.
2592 // Worst case is a macro node gets expanded into about 200 nodes.
2593 // Allow 50% more for optimization.
2594 if (C->check_node_count(C->macro_count() * 300, "out of nodes before macro expansion" ) )
2595 return true;
2596
2597 // Eliminate Opaque and LoopLimit nodes. Do it after all loop optimizations.
2639 _igvn.replace_node(n, repl);
2640 success = true;
2641 #endif
2642 } else if (n->Opcode() == Op_OuterStripMinedLoop) {
2643 n->as_OuterStripMinedLoop()->adjust_strip_mined_loop(&_igvn);
2644 C->remove_macro_node(n);
2645 success = true;
2646 }
2647 assert(success == (C->macro_count() < old_macro_count), "elimination reduces macro count");
2648 progress = progress || success;
2649 }
2650 }
2651
2652 // expand arraycopy "macro" nodes first
2653 // For ReduceBulkZeroing, we must first process all arraycopy nodes
2654 // before the allocate nodes are expanded.
2655 int macro_idx = C->macro_count() - 1;
2656 while (macro_idx >= 0) {
2657 Node * n = C->macro_node(macro_idx);
2658 assert(n->is_macro(), "only macro nodes expected here");
2659 if (_igvn.type(n) == Type::TOP || n->in(0)->is_top() ) {
2660 // node is unreachable, so don't try to expand it
2661 C->remove_macro_node(n);
2662 } else if (n->is_ArrayCopy()){
2663 int macro_count = C->macro_count();
2664 expand_arraycopy_node(n->as_ArrayCopy());
2665 assert(C->macro_count() < macro_count, "must have deleted a node from macro list");
2666 }
2667 if (C->failing()) return true;
2668 macro_idx --;
2669 }
2670
2671 // expand "macro" nodes
2672 // nodes are removed from the macro list as they are processed
2673 while (C->macro_count() > 0) {
2674 int macro_count = C->macro_count();
2675 Node * n = C->macro_node(macro_count-1);
2676 assert(n->is_macro(), "only macro nodes expected here");
2677 if (_igvn.type(n) == Type::TOP || n->in(0)->is_top() ) {
2678 // node is unreachable, so don't try to expand it
2679 C->remove_macro_node(n);
2680 continue;
2681 }
2682 switch (n->class_id()) {
2683 case Node::Class_Allocate:
2684 expand_allocate(n->as_Allocate());
2685 break;
2686 case Node::Class_AllocateArray:
2687 expand_allocate_array(n->as_AllocateArray());
2688 break;
2689 case Node::Class_Lock:
2690 expand_lock_node(n->as_Lock());
2691 break;
2692 case Node::Class_Unlock:
2693 expand_unlock_node(n->as_Unlock());
2694 break;
2695 default:
2696 assert(false, "unknown node type in macro list");
2697 }
|
2557 case Node::Class_Allocate:
2558 case Node::Class_AllocateArray:
2559 success = eliminate_allocate_node(n->as_Allocate());
2560 break;
2561 case Node::Class_CallStaticJava:
2562 success = eliminate_boxing_node(n->as_CallStaticJava());
2563 break;
2564 case Node::Class_Lock:
2565 case Node::Class_Unlock:
2566 assert(!n->as_AbstractLock()->is_eliminated(), "sanity");
2567 _has_locks = true;
2568 break;
2569 case Node::Class_ArrayCopy:
2570 break;
2571 case Node::Class_OuterStripMinedLoop:
2572 break;
2573 default:
2574 assert(n->Opcode() == Op_LoopLimit ||
2575 n->Opcode() == Op_Opaque1 ||
2576 n->Opcode() == Op_Opaque2 ||
2577 n->Opcode() == Op_Opaque3 ||
2578 BarrierSet::barrier_set()->barrier_set_c2()->is_gc_barrier_node(n),
2579 "unknown node type in macro list");
2580 }
2581 assert(success == (C->macro_count() < old_macro_count), "elimination reduces macro count");
2582 progress = progress || success;
2583 }
2584 }
2585 }
2586
2587 //------------------------------expand_macro_nodes----------------------
2588 // Returns true if a failure occurred.
2589 bool PhaseMacroExpand::expand_macro_nodes() {
2590 // Last attempt to eliminate macro nodes.
2591 eliminate_macro_nodes();
2592
2593 // Make sure expansion will not cause node limit to be exceeded.
2594 // Worst case is a macro node gets expanded into about 200 nodes.
2595 // Allow 50% more for optimization.
2596 if (C->check_node_count(C->macro_count() * 300, "out of nodes before macro expansion" ) )
2597 return true;
2598
2599 // Eliminate Opaque and LoopLimit nodes. Do it after all loop optimizations.
2641 _igvn.replace_node(n, repl);
2642 success = true;
2643 #endif
2644 } else if (n->Opcode() == Op_OuterStripMinedLoop) {
2645 n->as_OuterStripMinedLoop()->adjust_strip_mined_loop(&_igvn);
2646 C->remove_macro_node(n);
2647 success = true;
2648 }
2649 assert(success == (C->macro_count() < old_macro_count), "elimination reduces macro count");
2650 progress = progress || success;
2651 }
2652 }
2653
2654 // expand arraycopy "macro" nodes first
2655 // For ReduceBulkZeroing, we must first process all arraycopy nodes
2656 // before the allocate nodes are expanded.
2657 int macro_idx = C->macro_count() - 1;
2658 while (macro_idx >= 0) {
2659 Node * n = C->macro_node(macro_idx);
2660 assert(n->is_macro(), "only macro nodes expected here");
2661 if (_igvn.type(n) == Type::TOP || (n->in(0) != NULL && n->in(0)->is_top())) {
2662 // node is unreachable, so don't try to expand it
2663 C->remove_macro_node(n);
2664 } else if (n->is_ArrayCopy()){
2665 int macro_count = C->macro_count();
2666 expand_arraycopy_node(n->as_ArrayCopy());
2667 assert(C->macro_count() < macro_count, "must have deleted a node from macro list");
2668 }
2669 if (C->failing()) return true;
2670 macro_idx --;
2671 }
2672
2673 // expand "macro" nodes
2674 // nodes are removed from the macro list as they are processed
2675 while (C->macro_count() > 0) {
2676 int macro_count = C->macro_count();
2677 Node * n = C->macro_node(macro_count-1);
2678 assert(n->is_macro(), "only macro nodes expected here");
2679 if (_igvn.type(n) == Type::TOP || (n->in(0) != NULL && n->in(0)->is_top())) {
2680 // node is unreachable, so don't try to expand it
2681 C->remove_macro_node(n);
2682 continue;
2683 }
2684 switch (n->class_id()) {
2685 case Node::Class_Allocate:
2686 expand_allocate(n->as_Allocate());
2687 break;
2688 case Node::Class_AllocateArray:
2689 expand_allocate_array(n->as_AllocateArray());
2690 break;
2691 case Node::Class_Lock:
2692 expand_lock_node(n->as_Lock());
2693 break;
2694 case Node::Class_Unlock:
2695 expand_unlock_node(n->as_Unlock());
2696 break;
2697 default:
2698 assert(false, "unknown node type in macro list");
2699 }
|