< prev index next >

src/share/vm/opto/cfgnode.cpp

Print this page




1919               return top;
1920             }
1921             // If transformed to a MergeMem, get the desired slice
1922             // Otherwise the returned node represents memory for every slice
1923             Node *new_mem = (m->is_MergeMem()) ?
1924                              m->as_MergeMem()->memory_at(alias_idx) : m;
1925             // Update input if it is progress over what we have now
1926             if (new_mem != ii) {
1927               set_req(i, new_mem);
1928               progress = this;
1929             }
1930           }
1931         }
1932       } else {
1933         // We know that at least one MergeMem->base_memory() == this
1934         // (saw_self == true). If all other inputs also references this phi
1935         // (directly or through data nodes) - it is dead loop.
1936         bool saw_safe_input = false;
1937         for (uint j = 1; j < req(); ++j) {
1938           Node *n = in(j);
1939           if (n->is_MergeMem() && n->as_MergeMem()->base_memory() == this)
1940             continue;              // skip known cases







1941           if (!is_unsafe_data_reference(n)) {
1942             saw_safe_input = true; // found safe input
1943             break;
1944           }
1945         }
1946         if (!saw_safe_input)
1947           return top; // all inputs reference back to this phi - dead loop
1948 
1949         // Phi(...MergeMem(m0, m1:AT1, m2:AT2)...) into
1950         //     MergeMem(Phi(...m0...), Phi:AT1(...m1...), Phi:AT2(...m2...))
1951         PhaseIterGVN *igvn = phase->is_IterGVN();
1952         Node* hook = new Node(1);
1953         PhiNode* new_base = (PhiNode*) clone();
1954         // Must eagerly register phis, since they participate in loops.
1955         if (igvn) {
1956           igvn->register_new_node_with_optimizer(new_base);
1957           hook->add_req(new_base);
1958         }
1959         MergeMemNode* result = MergeMemNode::make(new_base);
1960         for (uint i = 1; i < req(); ++i) {




1919               return top;
1920             }
1921             // If transformed to a MergeMem, get the desired slice
1922             // Otherwise the returned node represents memory for every slice
1923             Node *new_mem = (m->is_MergeMem()) ?
1924                              m->as_MergeMem()->memory_at(alias_idx) : m;
1925             // Update input if it is progress over what we have now
1926             if (new_mem != ii) {
1927               set_req(i, new_mem);
1928               progress = this;
1929             }
1930           }
1931         }
1932       } else {
1933         // We know that at least one MergeMem->base_memory() == this
1934         // (saw_self == true). If all other inputs also references this phi
1935         // (directly or through data nodes) - it is dead loop.
1936         bool saw_safe_input = false;
1937         for (uint j = 1; j < req(); ++j) {
1938           Node *n = in(j);
1939           if (n->is_MergeMem() && n->as_MergeMem()->base_memory() == this) {
1940             continue;              // skip known cases
1941           }
1942           // TOP inputs should not be counted as safe inputs because if the
1943           // Phi references itself through all other inputs then splitting the
1944           // Phi through memory merges would create dead loop at later stage.
1945           if (n == top) {
1946             continue;
1947           }
1948           if (!is_unsafe_data_reference(n)) {
1949             saw_safe_input = true; // found safe input
1950             break;
1951           }
1952         }
1953         if (!saw_safe_input)
1954           return top; // all inputs reference back to this phi - dead loop
1955 
1956         // Phi(...MergeMem(m0, m1:AT1, m2:AT2)...) into
1957         //     MergeMem(Phi(...m0...), Phi:AT1(...m1...), Phi:AT2(...m2...))
1958         PhaseIterGVN *igvn = phase->is_IterGVN();
1959         Node* hook = new Node(1);
1960         PhiNode* new_base = (PhiNode*) clone();
1961         // Must eagerly register phis, since they participate in loops.
1962         if (igvn) {
1963           igvn->register_new_node_with_optimizer(new_base);
1964           hook->add_req(new_base);
1965         }
1966         MergeMemNode* result = MergeMemNode::make(new_base);
1967         for (uint i = 1; i < req(); ++i) {


< prev index next >