public static String toString(UnmodifiableEconomicMap<OptionKey<?>, Object> values) { Comparator<OptionKey<?>> comparator = new Comparator<OptionKey<?>>() { @Override public int compare(OptionKey<?> o1, OptionKey<?> o2) { return o1.getName().compareTo(o2.getName()); } }; SortedMap<OptionKey<?>, Object> sorted = new TreeMap<>(comparator); UnmodifiableMapCursor<OptionKey<?>, Object> cursor = values.getEntries(); while (cursor.advance()) { sorted.put(cursor.getKey(), decodeNull(cursor.getValue())); } return sorted.toString(); }
@Override public String toString() { UnmodifiableMapCursor<String, List<Binding>> entries = getBindings(false, false).getEntries(); List<String> all = new ArrayList<>(); while (entries.advance()) { String c = MetaUtil.internalNameToJava(entries.getKey(), true, false); for (Binding b : entries.getValue()) { all.add(c + '.' + b); } } Collections.sort(all); StringBuilder buf = new StringBuilder(); String nl = String.format("%n"); for (String s : all) { if (buf.length() != 0) { buf.append(nl); } buf.append(s); } if (parent != null) { if (buf.length() != 0) { buf.append(nl); } buf.append("// parent").append(nl).append(parent); } return buf.toString(); }
/** * Copies all of the mappings from {@code other} to this map. * * @since 1.0 */ default void putAll(UnmodifiableEconomicMap<? extends K, ? extends V> other) { UnmodifiableMapCursor<? extends K, ? extends V> entry = other.getEntries(); while (entry.advance()) { put(entry.getKey(), entry.getValue()); } }
/** * Copies all of the mappings from {@code other} to this map. * * @since 1.0 */ default void putAll(UnmodifiableEconomicMap<? extends K, ? extends V> other) { UnmodifiableMapCursor<? extends K, ? extends V> entry = other.getEntries(); while (entry.advance()) { put(entry.getKey(), entry.getValue()); } }
@Override public ValueNode valueForOperand(Value value) { assert nodeOperands != null; UnmodifiableMapCursor<Node, Value> cursor = nodeOperands.getEntries(); while (cursor.advance()) { if (cursor.getValue().equals(value)) { return (ValueNode) cursor.getKey(); } } return null; }
/** * Returns true if every value in subMap is also present in the superMap (according to "equals" * semantics). */ protected static <K, V> boolean isSubMapOf(EconomicMap<K, V> superMap, EconomicMap<K, V> subMap) { if (superMap == subMap) { return true; } UnmodifiableMapCursor<K, V> cursor = subMap.getEntries(); while (cursor.advance()) { K key = cursor.getKey(); V value = cursor.getValue(); assert value != null; V otherValue = superMap.get(key); if (otherValue != value && !value.equals(otherValue)) { return false; } } return true; }
@Override public Map<String, Object> createInitialOptions() { final UnmodifiableMapCursor<OptionKey<?>, Object> optionValues = getOptions(OptionValues.class).getMap().getEntries(); Map<String, Object> res = new HashMap<>(); while (optionValues.advance()) { final OptionKey<?> key = optionValues.getKey(); Object value = optionValues.getValue(); if (value == null) { value = key.getDefaultValue(); } res.put(key.getName(), value); } return res; }
@Override protected Map<String, Object> createInitialOptions() { Map<String, Object> res = new HashMap<>(); UnmodifiableMapCursor<OptionKey<?>, Object> optionValues = RuntimeOptionValues.singleton().getMap().getEntries(); while (optionValues.advance()) { final OptionKey<?> key = optionValues.getKey(); Object value = optionValues.getValue(); if (value == null) { value = key.getDefaultValue(); } res.put(key.getName(), value); } return res; }
protected static void initMap(EconomicMap<OptionKey<?>, Object> map, UnmodifiableEconomicMap<OptionKey<?>, Object> values) { UnmodifiableMapCursor<OptionKey<?>, Object> cursor = values.getEntries(); while (cursor.advance()) { map.put(cursor.getKey(), encodeNull(cursor.getValue())); } }
public OptionValuesImpl( final OptionDescriptors descriptors, final UnmodifiableEconomicMap<OptionKey<?>, Object> values) { this.descriptors = descriptors; this.values = EconomicMap.create(); final UnmodifiableMapCursor<OptionKey<?>, Object> cursor = values.getEntries(); while (cursor.advance()) { this.values.put(cursor.getKey(), maskNull(cursor.getValue())); } }
OptionValuesImpl( final OptionValuesImpl owner, final UnmodifiableEconomicMap<OptionKey<?>, Object> overrides) { this.descriptors = owner.descriptors; this.values = EconomicMap.create(); UnmodifiableMapCursor<OptionKey<?>, Object> cursor = owner.values.getEntries(); while (cursor.advance()) { this.values.put(cursor.getKey(), maskNull(cursor.getValue())); } cursor = overrides.getEntries(); while (cursor.advance()) { this.values.put(cursor.getKey(), maskNull(cursor.getValue())); } }
/** * Updates this object with the key/value pairs in {@code values}. * * @see #UNSET_KEY */ public void update(UnmodifiableEconomicMap<OptionKey<?>, Object> values) { if (values.isEmpty()) { return; } UnmodifiableEconomicMap<OptionKey<?>, Object> expect; EconomicMap<OptionKey<?>, Object> newMap; do { expect = v.get(); newMap = EconomicMap.create(Equivalence.IDENTITY, expect); UnmodifiableMapCursor<OptionKey<?>, Object> cursor = values.getEntries(); while (cursor.advance()) { OptionKey<?> key = cursor.getKey(); Object value = cursor.getValue(); if (value == UNSET_KEY) { newMap.removeKey(key); } else { key.update(newMap, value); // Need to do the null encoding here as `key.update()` doesn't do it newMap.put(key, encodeNull(value)); } } } while (!v.compareAndSet(expect, newMap)); }
currentOptions = optionsRef.get(); UnmodifiableMapCursor<OptionKey<?>, Object> cursor = currentOptions.getMap().getEntries(); while (cursor.advance()) { OptionKey<?> key = cursor.getKey(); if (!resetValues.contains(key) && !newValues.containsKey(key)) {
@Override protected EconomicMap<LoopExitNode, MemoryMapImpl> processLoop(LoopBeginNode loop, MemoryMapImpl initialState) { EconomicSet<LocationIdentity> modifiedLocations = modifiedInLoops.get(loop); EconomicMap<LocationIdentity, MemoryPhiNode> phis = EconomicMap.create(Equivalence.DEFAULT); if (modifiedLocations.contains(LocationIdentity.any())) { // create phis for all locations if ANY is modified in the loop modifiedLocations = EconomicSet.create(Equivalence.DEFAULT, modifiedLocations); modifiedLocations.addAll(initialState.lastMemorySnapshot.getKeys()); } for (LocationIdentity location : modifiedLocations) { createMemoryPhi(loop, initialState, phis, location); } initialState.lastMemorySnapshot.putAll(phis); LoopInfo<MemoryMapImpl> loopInfo = ReentrantNodeIterator.processLoop(this, loop, initialState); UnmodifiableMapCursor<LoopEndNode, MemoryMapImpl> endStateCursor = loopInfo.endStates.getEntries(); while (endStateCursor.advance()) { int endIndex = loop.phiPredecessorIndex(endStateCursor.getKey()); UnmodifiableMapCursor<LocationIdentity, MemoryPhiNode> phiCursor = phis.getEntries(); while (phiCursor.advance()) { LocationIdentity key = phiCursor.getKey(); PhiNode phi = phiCursor.getValue(); phi.initializeValueAt(endIndex, ValueNodeUtil.asNode(endStateCursor.getValue().getLastLocationAccess(key))); } } return loopInfo.exitStates; }
while (cursor.advance()) { ResolvedJavaMethod method = cursor.getKey(); InvocationPlugin plugin = cursor.getValue();
UnmodifiableMapCursor<Node, Node> cursor = duplicates.getEntries(); ResolvedJavaMethod inlineeRoot = null; while (cursor.advance()) { Node value = cursor.getValue(); if (!newNodes.contains(value)) {
private void printNodes(Block block) { printedNodes = new NodeBitMap(cfg.graph); begin("IR"); out.println("HIR"); out.disableIndentation(); if (block.getBeginNode() instanceof AbstractMergeNode) { // Currently phi functions are not in the schedule, so print them separately here. for (ValueNode phi : ((AbstractMergeNode) block.getBeginNode()).phis()) { printNode(phi, false); } } Node cur = block.getBeginNode(); while (true) { printNode(cur, false); if (cur == block.getEndNode()) { UnmodifiableMapCursor<Node, Block> cursor = latestScheduling.getEntries(); while (cursor.advance()) { if (cursor.getValue() == block && !inFixedSchedule(cursor.getKey()) && !printedNodes.isMarked(cursor.getKey())) { printNode(cursor.getKey(), true); } } break; } assert cur.successors().count() == 1; cur = cur.successors().first(); } out.enableIndentation(); end("IR"); printedNodes = null; }
while (cursor.advance()) { Node node = cursor.getKey(); Integer orderId = cursor.getValue();