< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/NodeClass.java

Print this page
rev 56282 : [mq]: graal
   1 /*
   2  * Copyright (c) 2011, 2018, 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  */


1200     public boolean equalSuccessors(Node node, Node other) {
1201         return equalEdges(node, other, successorIteration);
1202     }
1203 
1204     public boolean equalInputs(Node node, Node other) {
1205         return equalEdges(node, other, inputsIteration);
1206     }
1207 
1208     private boolean equalEdges(Node node, Node other, long mask) {
1209         long myMask = mask;
1210         assert other.getNodeClass() == this;
1211         while (myMask != 0) {
1212             long offset = (myMask & OFFSET_MASK);
1213             if ((myMask & LIST_MASK) == 0) {
1214                 Object v1 = Edges.getNodeUnsafe(node, offset);
1215                 Object v2 = Edges.getNodeUnsafe(other, offset);
1216                 if (v1 != v2) {
1217                     return false;
1218                 }
1219             } else {
1220                 Object v1 = Edges.getNodeListUnsafe(node, offset);
1221                 Object v2 = Edges.getNodeListUnsafe(other, offset);
1222                 if (!Objects.equals(v1, v2)) {
1223                     return false;
1224                 }
1225             }
1226             myMask >>>= NEXT_EDGE;
1227         }
1228         return true;
1229     }
1230 
1231     public void pushInputs(Node node, NodeStack stack) {
1232         long myMask = this.inputsIteration;
1233         while (myMask != 0) {
1234             long offset = (myMask & OFFSET_MASK);
1235             if ((myMask & LIST_MASK) == 0) {
1236                 Node curNode = Edges.getNodeUnsafe(node, offset);
1237                 if (curNode != null) {
1238                     stack.push(curNode);
1239                 }
1240             } else {
1241                 pushAllHelper(stack, node, offset);


   1 /*
   2  * Copyright (c) 2011, 2019, 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  */


1200     public boolean equalSuccessors(Node node, Node other) {
1201         return equalEdges(node, other, successorIteration);
1202     }
1203 
1204     public boolean equalInputs(Node node, Node other) {
1205         return equalEdges(node, other, inputsIteration);
1206     }
1207 
1208     private boolean equalEdges(Node node, Node other, long mask) {
1209         long myMask = mask;
1210         assert other.getNodeClass() == this;
1211         while (myMask != 0) {
1212             long offset = (myMask & OFFSET_MASK);
1213             if ((myMask & LIST_MASK) == 0) {
1214                 Object v1 = Edges.getNodeUnsafe(node, offset);
1215                 Object v2 = Edges.getNodeUnsafe(other, offset);
1216                 if (v1 != v2) {
1217                     return false;
1218                 }
1219             } else {
1220                 NodeList<Node> v1 = Edges.getNodeListUnsafe(node, offset);
1221                 NodeList<Node> v2 = Edges.getNodeListUnsafe(other, offset);
1222                 if (!Objects.equals(v1, v2)) {
1223                     return false;
1224                 }
1225             }
1226             myMask >>>= NEXT_EDGE;
1227         }
1228         return true;
1229     }
1230 
1231     public void pushInputs(Node node, NodeStack stack) {
1232         long myMask = this.inputsIteration;
1233         while (myMask != 0) {
1234             long offset = (myMask & OFFSET_MASK);
1235             if ((myMask & LIST_MASK) == 0) {
1236                 Node curNode = Edges.getNodeUnsafe(node, offset);
1237                 if (curNode != null) {
1238                     stack.push(curNode);
1239                 }
1240             } else {
1241                 pushAllHelper(stack, node, offset);


< prev index next >