Mercurial > hg > truffle
changeset 5014:fab98b511845
Additional infrastructure methods
author | Christian Wimmer <Christian.Wimmer@Oracle.com> |
---|---|
date | Fri, 02 Mar 2012 09:18:42 -0800 |
parents | 25a46490146e |
children | 7333fc50905d |
files | graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/BitMap.java graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeMap.java |
diffstat | 2 files changed, 27 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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. *
--- 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<T> 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);