# HG changeset patch # User Christian Wimmer # Date 1330708722 28800 # Node ID fab98b5118458f819e4b2c0e14980b543ca9302b # Parent 25a46490146e762cae0ac9f2057d43a237f62753 Additional infrastructure methods diff -r 25a46490146e -r fab98b511845 graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/BitMap.java --- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/BitMap.java Fri Mar 02 09:17:59 2012 -0800 +++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/BitMap.java Fri Mar 02 09:18:42 2012 -0800 @@ -261,6 +261,27 @@ } /** + * Performs the union operation on this bitmap with the specified bitmap. That is, all bits set in either of the two + * bitmaps will be set in this bitmap following this operation. It returns whether this bitmap was changed by the operation. + * + * @param other the other bitmap for the union operation + */ + public boolean setUnionWithResult(BitMap other) { + long temp = low | other.low; + boolean changed = temp != low; + low = temp; + + if (extra != null && other.extra != null) { + for (int i = 0; i < extra.length && i < other.extra.length; i++) { + temp = extra[i] | other.extra[i]; + changed = changed || temp != extra[i]; + extra[i] |= temp; + } + } + return changed; + } + + /** * Performs the union operation on this bitmap with the specified bitmap. That is, a bit is set in this * bitmap if and only if it is set in both this bitmap and the specified bitmap. * diff -r 25a46490146e -r fab98b511845 graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeMap.java --- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeMap.java Fri Mar 02 09:17:59 2012 -0800 +++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeMap.java Fri Mar 02 09:18:42 2012 -0800 @@ -39,6 +39,12 @@ size = values.length; } + public NodeMap(NodeMap copyFrom) { + this.graph = copyFrom.graph; + this.values = Arrays.copyOf(copyFrom.values, copyFrom.values.length); + this.size = copyFrom.size; + } + @SuppressWarnings("unchecked") public T get(Node node) { check(node);