Mercurial > hg > graal-jvmci-8
changeset 16171:3534a68bb8b9
add contains to NodeWorkList
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Mon, 23 Jun 2014 18:00:31 -0700 |
parents | 8322735c7540 |
children | dc62f6e66459 |
files | graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeWorkList.java |
diffstat | 1 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeWorkList.java Mon Jun 23 18:00:14 2014 -0700 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeWorkList.java Mon Jun 23 18:00:31 2014 -0700 @@ -50,6 +50,8 @@ public abstract void add(Node node); + public abstract boolean contains(Node node); + private abstract class QueueConsumingIterator implements Iterator<Node> { protected void dropDeleted() { @@ -140,6 +142,20 @@ } } + @Override + public boolean contains(Node node) { + if (inQueue != null) { + return inQueue.isMarked(node); + } else { + for (Node queuedNode : worklist) { + if (queuedNode == node) { + return true; + } + } + return false; + } + } + private boolean checkInfiniteWork(Node node) { if (lastPull == node) { if (firstNoChange == null) { @@ -186,6 +202,11 @@ } @Override + public boolean contains(Node node) { + return visited.isMarked(node); + } + + @Override public Iterator<Node> iterator() { return new QueueConsumingIterator() { @Override