Mercurial > hg > truffle
comparison src/share/vm/opto/phaseX.cpp @ 41:874b2c4f43d1
6667605: (Escape Analysis) inline java constructors when EA is on
Summary: java constructors should be inlined to be able scalar replace a new object
Reviewed-by: rasbold
author | kvn |
---|---|
date | Fri, 07 Mar 2008 11:09:13 -0800 |
parents | a61af66fc99e |
children | 99269dbf4ba8 |
comparison
equal
deleted
inserted
replaced
40:7c1f32ae4a20 | 41:874b2c4f43d1 |
---|---|
646 | 646 |
647 | 647 |
648 //============================================================================= | 648 //============================================================================= |
649 //------------------------------transform-------------------------------------- | 649 //------------------------------transform-------------------------------------- |
650 // Return a node which computes the same function as this node, but in a | 650 // Return a node which computes the same function as this node, but in a |
651 // faster or cheaper fashion. The Node passed in here must have no other | 651 // faster or cheaper fashion. |
652 // pointers to it, as its storage will be reclaimed if the Node can be | |
653 // optimized away. | |
654 Node *PhaseGVN::transform( Node *n ) { | 652 Node *PhaseGVN::transform( Node *n ) { |
655 NOT_PRODUCT( set_transforms(); ) | 653 return transform_no_reclaim(n); |
656 | |
657 // Apply the Ideal call in a loop until it no longer applies | |
658 Node *k = n; | |
659 NOT_PRODUCT( uint loop_count = 0; ) | |
660 while( 1 ) { | |
661 Node *i = k->Ideal(this, /*can_reshape=*/false); | |
662 if( !i ) break; | |
663 assert( i->_idx >= k->_idx, "Idealize should return new nodes, use Identity to return old nodes" ); | |
664 // Can never reclaim storage for Ideal calls, because the Ideal call | |
665 // returns a new Node, bumping the High Water Mark and our old Node | |
666 // is caught behind the new one. | |
667 //if( k != i ) { | |
668 //k->destruct(); // Reclaim storage for recent node | |
669 k = i; | |
670 //} | |
671 assert(loop_count++ < K, "infinite loop in PhaseGVN::transform"); | |
672 } | |
673 NOT_PRODUCT( if( loop_count != 0 ) { set_progress(); } ) | |
674 | |
675 // If brand new node, make space in type array. | |
676 ensure_type_or_null(k); | |
677 | |
678 // Cache result of Value call since it can be expensive | |
679 // (abstract interpretation of node 'k' using phase->_types[ inputs ]) | |
680 const Type *t = k->Value(this); // Get runtime Value set | |
681 assert(t != NULL, "value sanity"); | |
682 if (type_or_null(k) != t) { | |
683 #ifndef PRODUCT | |
684 // Do not record transformation or value construction on first visit | |
685 if (type_or_null(k) == NULL) { | |
686 inc_new_values(); | |
687 set_progress(); | |
688 } | |
689 #endif | |
690 set_type(k, t); | |
691 // If k is a TypeNode, capture any more-precise type permanently into Node | |
692 k->raise_bottom_type(t); | |
693 } | |
694 | |
695 if( t->singleton() && !k->is_Con() ) { | |
696 //k->destruct(); // Reclaim storage for recent node | |
697 NOT_PRODUCT( set_progress(); ) | |
698 return makecon(t); // Turn into a constant | |
699 } | |
700 | |
701 // Now check for Identities | |
702 Node *i = k->Identity(this); // Look for a nearby replacement | |
703 if( i != k ) { // Found? Return replacement! | |
704 //k->destruct(); // Reclaim storage for recent node | |
705 NOT_PRODUCT( set_progress(); ) | |
706 return i; | |
707 } | |
708 | |
709 // Try Global Value Numbering | |
710 i = hash_find_insert(k); // Found older value when i != NULL | |
711 if( i && i != k ) { // Hit? Return the old guy | |
712 NOT_PRODUCT( set_progress(); ) | |
713 return i; | |
714 } | |
715 | |
716 // Collect points-to information for escape analysys | |
717 ConnectionGraph *cgr = C->congraph(); | |
718 if (cgr != NULL) { | |
719 cgr->record_escape(k, this); | |
720 } | |
721 | |
722 // Return Idealized original | |
723 return k; | |
724 } | 654 } |
725 | 655 |
726 //------------------------------transform-------------------------------------- | 656 //------------------------------transform-------------------------------------- |
727 // Return a node which computes the same function as this node, but | 657 // Return a node which computes the same function as this node, but |
728 // in a faster or cheaper fashion. | 658 // in a faster or cheaper fashion. |
780 i = hash_find_insert(k); // Insert if new | 710 i = hash_find_insert(k); // Insert if new |
781 if( i && (i != k) ) { | 711 if( i && (i != k) ) { |
782 // Return the pre-existing node | 712 // Return the pre-existing node |
783 NOT_PRODUCT( set_progress(); ) | 713 NOT_PRODUCT( set_progress(); ) |
784 return i; | 714 return i; |
715 } | |
716 | |
717 // Collect points-to information for escape analysys | |
718 ConnectionGraph *cgr = C->congraph(); | |
719 if (cgr != NULL) { | |
720 cgr->record_escape(k, this); | |
785 } | 721 } |
786 | 722 |
787 // Return Idealized original | 723 // Return Idealized original |
788 return k; | 724 return k; |
789 } | 725 } |