# HG changeset patch # User Thomas Wuerthinger # Date 1451668447 -3600 # Node ID 4b117cc6ae9c5cc8030e1d137f34e988a2401c6e # Parent fd7e0ecf89ba3f35e68fe60b2630c6476ca72d6d Remove DistinctFilteredNodeIterable. diff -r fd7e0ecf89ba -r 4b117cc6ae9c graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/DistinctFilteredNodeIterable.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/DistinctFilteredNodeIterable.java Fri Jan 01 18:12:51 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.graph.iterators; - -import java.util.Iterator; - -import com.oracle.graal.graph.Node; - -public class DistinctFilteredNodeIterable extends FilteredNodeIterable { - - public DistinctFilteredNodeIterable(NodeIterable nodeIterable) { - super(nodeIterable); - } - - @Override - public DistinctFilteredNodeIterable distinct() { - return this; - } - - @Override - public Iterator iterator() { - return new DistinctPredicatedProxyNodeIterator<>(nodeIterable.iterator(), predicate); - } -} diff -r fd7e0ecf89ba -r 4b117cc6ae9c graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/DistinctPredicatedProxyNodeIterator.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/DistinctPredicatedProxyNodeIterator.java Fri Jan 01 18:12:51 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.graph.iterators; - -import java.util.Iterator; - -import com.oracle.graal.graph.Node; -import com.oracle.graal.graph.NodeBitMap; - -public class DistinctPredicatedProxyNodeIterator extends PredicatedProxyNodeIterator { - - private NodeBitMap visited; - - public DistinctPredicatedProxyNodeIterator(Iterator iterator, NodePredicate predicate) { - super(iterator, predicate); - } - - @Override - protected void forward() { - if (current == null) { - super.forward(); - while (!accept(current)) { - current = null; - super.forward(); - } - } - } - - private boolean accept(T n) { - if (n == null) { - return true; - } - if (visited == null) { - visited = n.graph().createNodeBitMap(); - } - boolean accept = !visited.isMarked(n); - visited.mark(n); - return accept; - } -}