private int[] addElement(E element) { if (lastMask == -1 || lastMask == 0x80000000) { lastMask = 1; lastBlock++; } else { lastMask <<= 1; } int[] pointer = new int[]{lastBlock, lastMask}; colValuesInternal.putWithKey(pointer, element); return pointer; }
public FastSparseSetFactory(Collection<? extends E> set) { int block = -1; int mask = -1; int index = 0; for (E element : set) { block = index / 32; if (index % 32 == 0) { mask = 1; } else { mask <<= 1; } colValuesInternal.putWithKey(new int[]{block, mask}, element); index++; } lastBlock = block; lastMask = mask; }
public FastFixedSetFactory(Collection<E> set) { dataLength = set.size() / 32 + 1; int index = 0; int mask = 1; for (E element : set) { int block = index / 32; if (index % 32 == 0) { mask = 1; } colValuesInternal.putWithKey(new int[]{block, mask}, element); index++; mask <<= 1; } }
private void calcIDoms() { orderNodes(); List<IGraphNode> lstNodes = colOrderedIDoms.getLstKeys(); while (true) { boolean changed = false; for (IGraphNode node : lstNodes) { IGraphNode idom = null; if (!setRoots.contains(node)) { for (IGraphNode pred : node.getPredecessors()) { if (colOrderedIDoms.getWithKey(pred) != null) { idom = getCommonIDom(idom, pred, colOrderedIDoms); if (idom == null) { break; // no idom found: merging point of two trees } } } } if (idom == null) { idom = node; } IGraphNode oldidom = colOrderedIDoms.putWithKey(idom, node); if (!idom.equals(oldidom)) { // oldidom is null iff the node is touched for the first time changed = true; } } if (!changed) { break; } } }
private void calcIDoms() { orderStatements(); colOrderedIDoms.putWithKey(statement.getFirst().id, statement.getFirst().id); // exclude first statement List<Integer> lstIds = colOrderedIDoms.getLstKeys().subList(1, colOrderedIDoms.getLstKeys().size()); while (true) { boolean changed = false; for (Integer id : lstIds) { Statement stat = statement.getStats().getWithKey(id); Integer idom = null; for (StatEdge edge : stat.getAllPredecessorEdges()) { if (colOrderedIDoms.getWithKey(edge.getSource().id) != null) { idom = getCommonIDom(idom, edge.getSource().id, colOrderedIDoms); } } Integer oldidom = colOrderedIDoms.putWithKey(idom, id); if (!idom.equals(oldidom)) { changed = true; } } if (!changed) { break; } } }
node.exprents = stat.getExprents(); graph.nodes.putWithKey(node, node.id); mapDestinationNodes.put(stat.id, new String[]{node.id, null}); DirectNode tail = new DirectNode(DirectNode.NODE_TAIL, stat, stat.id + "_tail"); tail.exprents = tailExprentList; graph.nodes.putWithKey(tail, tail.id); graph.nodes.putWithKey(firstnd, firstnd.id); node = new DirectNode(DirectNode.NODE_CONDITION, stat, stat.id + "_cond"); node.exprents = dostat.getConditionExprentList(); graph.nodes.putWithKey(node, node.id); nodeinit.exprents = dostat.getInitExprentList(); graph.nodes.putWithKey(nodeinit, nodeinit.id); graph.nodes.putWithKey(nodecond, nodecond.id); graph.nodes.putWithKey(nodeinc, nodeinc.id);
private int[] addElement(E element) { if (lastMask == -1 || lastMask == 0x80000000) { lastMask = 1; lastBlock++; } else { lastMask <<= 1; } int[] pointer = new int[]{lastBlock, lastMask}; colValuesInternal.putWithKey(pointer, element); return pointer; }
private int[] addElement(E element) { if (lastMask == -1 || lastMask == 0x80000000) { lastMask = 1; lastBlock++; } else { lastMask <<= 1; } int[] pointer = new int[]{lastBlock, lastMask}; colValuesInternal.putWithKey(pointer, element); return pointer; }
public FastSetFactory(Collection<E> set) { int block = -1; int mask = -1; int index = 0; for (E element : set) { block = index / 32; if (index % 32 == 0) { mask = 1; } else { mask <<= 1; } colValuesInternal.putWithKey(new int[]{block, mask}, element); index++; } lastBlock = block; lastMask = mask; }
public FastSparseSetFactory(Collection<E> set) { int block = -1; int mask = -1; int index = 0; for (E element : set) { block = index / 32; if (index % 32 == 0) { mask = 1; } else { mask <<= 1; } colValuesInternal.putWithKey(new int[]{block, mask}, element); index++; } lastBlock = block; lastMask = mask; }
public FastFixedSetFactory(Collection<E> set) { dataLength = set.size() / 32 + 1; int index = 0; int mask = 1; for (E element : set) { int block = index / 32; if (index % 32 == 0) { mask = 1; } colValuesInternal.putWithKey(new int[]{block, mask}, element); index++; mask <<= 1; } }
private void calcIDoms() { orderNodes(); List<IGraphNode> lstNodes = colOrderedIDoms.getLstKeys(); while (true) { boolean changed = false; for (IGraphNode node : lstNodes) { IGraphNode idom = null; if (!setRoots.contains(node)) { for (IGraphNode pred : node.getPredecessors()) { if (colOrderedIDoms.getWithKey(pred) != null) { idom = getCommonIDom(idom, pred, colOrderedIDoms); if (idom == null) { break; // no idom found: merging point of two trees } } } } if (idom == null) { idom = node; } IGraphNode oldidom = colOrderedIDoms.putWithKey(idom, node); if (!idom.equals(oldidom)) { // oldidom is null iff the node is touched for the first time changed = true; } } if (!changed) { break; } } }
private void calcIDoms() { orderStatements(); colOrderedIDoms.putWithKey(statement.getFirst().id, statement.getFirst().id); // exclude first statement List<Integer> lstIds = colOrderedIDoms.getLstKeys().subList(1, colOrderedIDoms.getLstKeys().size()); while (true) { boolean changed = false; for (Integer id : lstIds) { Statement stat = statement.getStats().getWithKey(id); Integer idom = null; for (StatEdge edge : stat.getAllPredecessorEdges()) { if (colOrderedIDoms.getWithKey(edge.getSource().id) != null) { idom = getCommonIDom(idom, edge.getSource().id, colOrderedIDoms); } } Integer oldidom = colOrderedIDoms.putWithKey(idom, id); if (!idom.equals(oldidom)) { changed = true; } } if (!changed) { break; } } }
node.exprents = stat.getExprents(); graph.nodes.putWithKey(node, node.id); mapDestinationNodes.put(stat.id, new String[]{node.id, null}); DirectNode tail = new DirectNode(DirectNode.NODE_TAIL, stat, stat.id + "_tail"); tail.exprents = tailExprentList; graph.nodes.putWithKey(tail, tail.id); graph.nodes.putWithKey(firstnd, firstnd.id); node = new DirectNode(DirectNode.NODE_CONDITION, stat, stat.id + "_cond"); node.exprents = dostat.getConditionExprentList(); graph.nodes.putWithKey(node, node.id); nodeinit.exprents = dostat.getInitExprentList(); graph.nodes.putWithKey(nodeinit, nodeinit.id); graph.nodes.putWithKey(nodecond, nodecond.id); graph.nodes.putWithKey(nodeinc, nodeinc.id);