src/share/vm/opto/cfgnode.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8054033 Sdiff src/share/vm/opto

src/share/vm/opto/cfgnode.cpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


1859           if (n->is_MergeMem() && n->as_MergeMem()->base_memory() == this)
1860             continue;              // skip known cases
1861           if (!is_unsafe_data_reference(n)) {
1862             saw_safe_input = true; // found safe input
1863             break;
1864           }
1865         }
1866         if (!saw_safe_input)
1867           return top; // all inputs reference back to this phi - dead loop
1868 
1869         // Phi(...MergeMem(m0, m1:AT1, m2:AT2)...) into
1870         //     MergeMem(Phi(...m0...), Phi:AT1(...m1...), Phi:AT2(...m2...))
1871         PhaseIterGVN *igvn = phase->is_IterGVN();
1872         Node* hook = new Node(1);
1873         PhiNode* new_base = (PhiNode*) clone();
1874         // Must eagerly register phis, since they participate in loops.
1875         if (igvn) {
1876           igvn->register_new_node_with_optimizer(new_base);
1877           hook->add_req(new_base);
1878         }
1879         MergeMemNode* result = MergeMemNode::make(phase->C, new_base);
1880         for (uint i = 1; i < req(); ++i) {
1881           Node *ii = in(i);
1882           if (ii->is_MergeMem()) {
1883             MergeMemNode* n = ii->as_MergeMem();
1884             for (MergeMemStream mms(result, n); mms.next_non_empty2(); ) {
1885               // If we have not seen this slice yet, make a phi for it.
1886               bool made_new_phi = false;
1887               if (mms.is_empty()) {
1888                 Node* new_phi = new_base->slice_memory(mms.adr_type(phase->C));
1889                 made_new_phi = true;
1890                 if (igvn) {
1891                   igvn->register_new_node_with_optimizer(new_phi);
1892                   hook->add_req(new_phi);
1893                 }
1894                 mms.set_memory(new_phi);
1895               }
1896               Node* phi = mms.memory();
1897               assert(made_new_phi || phi->in(i) == n, "replace the i-th merge by a slice");
1898               phi->set_req(i, mms.memory2());
1899             }


   1 /*
   2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


1859           if (n->is_MergeMem() && n->as_MergeMem()->base_memory() == this)
1860             continue;              // skip known cases
1861           if (!is_unsafe_data_reference(n)) {
1862             saw_safe_input = true; // found safe input
1863             break;
1864           }
1865         }
1866         if (!saw_safe_input)
1867           return top; // all inputs reference back to this phi - dead loop
1868 
1869         // Phi(...MergeMem(m0, m1:AT1, m2:AT2)...) into
1870         //     MergeMem(Phi(...m0...), Phi:AT1(...m1...), Phi:AT2(...m2...))
1871         PhaseIterGVN *igvn = phase->is_IterGVN();
1872         Node* hook = new Node(1);
1873         PhiNode* new_base = (PhiNode*) clone();
1874         // Must eagerly register phis, since they participate in loops.
1875         if (igvn) {
1876           igvn->register_new_node_with_optimizer(new_base);
1877           hook->add_req(new_base);
1878         }
1879         MergeMemNode* result = MergeMemNode::make(new_base);
1880         for (uint i = 1; i < req(); ++i) {
1881           Node *ii = in(i);
1882           if (ii->is_MergeMem()) {
1883             MergeMemNode* n = ii->as_MergeMem();
1884             for (MergeMemStream mms(result, n); mms.next_non_empty2(); ) {
1885               // If we have not seen this slice yet, make a phi for it.
1886               bool made_new_phi = false;
1887               if (mms.is_empty()) {
1888                 Node* new_phi = new_base->slice_memory(mms.adr_type(phase->C));
1889                 made_new_phi = true;
1890                 if (igvn) {
1891                   igvn->register_new_node_with_optimizer(new_phi);
1892                   hook->add_req(new_phi);
1893                 }
1894                 mms.set_memory(new_phi);
1895               }
1896               Node* phi = mms.memory();
1897               assert(made_new_phi || phi->in(i) == n, "replace the i-th merge by a slice");
1898               phi->set_req(i, mms.memory2());
1899             }


src/share/vm/opto/cfgnode.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File