protected OperandModeAnnotation getOperandModeAnnotation(Field field) { OperandModeAnnotation result = null; MapCursor<Class<? extends Annotation>, OperandModeAnnotation> cursor = valueAnnotations.getEntries(); while (cursor.advance()) { Annotation annotation = field.getAnnotation(cursor.getKey()); if (annotation != null) { assert result == null : "Field has two operand mode annotations: " + field; result = cursor.getValue(); } } return result; }
private static void collectBindingsTo(EconomicMap<String, List<Binding>> res, String type, ClassPlugins cp) { MapCursor<String, Binding> methods = cp.bindings.getEntries(); while (methods.advance()) { List<Binding> bindings = res.get(type); if (bindings == null) { bindings = new ArrayList<>(); res.put(type, bindings); } for (Binding b = methods.getValue(); b != null; b = b.next) { bindings.add(b); } } }
@Override public String toString() { MapCursor<Node, T> i = getEntries(); if (!i.advance()) { return "{}"; } StringBuilder sb = new StringBuilder(); sb.append('{'); while (true) { Node key = i.getKey(); T value = i.getValue(); sb.append(key); sb.append('='); sb.append(value); if (!i.advance()) { return sb.append('}').toString(); } sb.append(',').append(' '); } }
@Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append(isSet ? "set(size=" : "map(size=").append(size()).append(", {"); String sep = ""; MapCursor<K, V> cursor = getEntries(); while (cursor.advance()) { builder.append(sep); if (isSet) { builder.append(cursor.getKey()); } else { builder.append("(").append(cursor.getKey()).append(",").append(cursor.getValue()).append(")"); } sep = ","; } builder.append("})"); return builder.toString(); }
@Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append(isSet ? "set(size=" : "map(size=").append(size()).append(", {"); String sep = ""; MapCursor<K, V> cursor = getEntries(); while (cursor.advance()) { builder.append(sep); if (isSet) { builder.append(cursor.getKey()); } else { builder.append("(").append(cursor.getKey()).append(",").append(cursor.getValue()).append(")"); } sep = ","; } builder.append("})"); return builder.toString(); }
/** * Parses a map representing assignments of values to options. * * @param optionSettings option settings (i.e., assignments of values to options) * @param values the object in which to store the parsed values * @param loader source of the available {@link OptionDescriptors} * @throws IllegalArgumentException if there's a problem parsing {@code option} */ public static void parseOptions(EconomicMap<String, String> optionSettings, EconomicMap<OptionKey<?>, Object> values, Iterable<OptionDescriptors> loader) { if (optionSettings != null && !optionSettings.isEmpty()) { MapCursor<String, String> cursor = optionSettings.getEntries(); while (cursor.advance()) { parseOption(cursor.getKey(), cursor.getValue(), values, loader); } } }
protected void registerCombinedStamps(MergeNode node) { EconomicMap<ValueNode, Stamp> endMap = endMaps.get(node); MapCursor<ValueNode, Stamp> entries = endMap.getEntries(); while (entries.advance()) { ValueNode value = entries.getKey(); if (value.isDeleted()) { // nodes from this map can be deleted when a loop dies continue; } if (registerNewValueStamp(value, entries.getValue())) { counterBetterMergedStamps.increment(debug); } } }
@Override protected void processLoopExit(LoopExitNode exitNode, PEReadEliminationBlockState initialState, PEReadEliminationBlockState exitState, GraphEffectList effects) { super.processLoopExit(exitNode, initialState, exitState, effects); if (exitNode.graph().hasValueProxies()) { MapCursor<ReadCacheEntry, ValueNode> entry = exitState.getReadCache().getEntries(); while (entry.advance()) { if (initialState.getReadCache().get(entry.getKey()) != entry.getValue()) { ValueNode value = exitState.getReadCache(entry.getKey().object, entry.getKey().identity, entry.getKey().index, entry.getKey().kind, this); assert value != null : "Got null from read cache, entry's value:" + entry.getValue(); if (!(value instanceof ProxyNode) || ((ProxyNode) value).proxyPoint() != exitNode) { ProxyNode proxy = new ValueProxyNode(value, exitNode); effects.addFloatingNode(proxy, "readCacheProxy"); exitState.getReadCache().put(entry.getKey(), proxy); } } } } }
public MemoryMapNode(EconomicMap<LocationIdentity, MemoryNode> mmap) { super(TYPE, StampFactory.forVoid()); int size = mmap.size(); locationIdentities = new ArrayList<>(size); nodes = new NodeInputList<>(this, size); int index = 0; MapCursor<LocationIdentity, MemoryNode> cursor = mmap.getEntries(); while (cursor.advance()) { locationIdentities.add(cursor.getKey()); nodes.initialize(index, (ValueNode) cursor.getValue()); index++; } assert checkOrder(mmap); }
@Override protected void processLoopExit(LoopExitNode exitNode, ReadEliminationBlockState initialState, ReadEliminationBlockState exitState, GraphEffectList effects) { if (exitNode.graph().hasValueProxies()) { MapCursor<CacheEntry<?>, ValueNode> entry = exitState.getReadCache().getEntries(); while (entry.advance()) { if (initialState.getReadCache().get(entry.getKey()) != entry.getValue()) { ProxyNode proxy = new ValueProxyNode(exitState.getCacheEntry(entry.getKey()), exitNode); effects.addFloatingNode(proxy, "readCacheProxy"); exitState.getReadCache().put(entry.getKey(), proxy); } } } }
/** * Removes the plugins from {@code other} in this object that were added by * {@link #addTestPlugins}. */ public synchronized void removeTestPlugins(InvocationPlugins other) { assert resolvedRegistrations == null : "registration is closed"; if (testExtensions != null) { MapCursor<String, List<Binding>> c = other.getBindings(false).getEntries(); while (c.advance()) { String declaringClass = c.getKey(); List<Binding> bindings = testExtensions.get(declaringClass); if (bindings != null) { for (Binding b : c.getValue()) { int index = findBinding(bindings, b); if (index != -1) { bindings.remove(index); } } if (bindings.isEmpty()) { testExtensions.removeKey(declaringClass); } } } if (testExtensions.isEmpty()) { testExtensions = null; } } }
/** * Updates a given stub with respect to the registers it destroys. * <p> * Any entry in {@code calleeSaveInfo} that {@linkplain SaveRegistersOp#supportsRemove() * supports} pruning will have {@code destroyedRegisters} * {@linkplain SaveRegistersOp#remove(EconomicSet) removed} as these registers are declared as * temporaries in the stub's {@linkplain ForeignCallLinkage linkage} (and thus will be saved by * the stub's caller). * * @param stub the stub to update * @param destroyedRegisters the registers destroyed by the stub * @param calleeSaveInfo a map from debug infos to the operations that provide their * {@linkplain RegisterSaveLayout callee-save information} * @param frameMap used to {@linkplain FrameMap#offsetForStackSlot(StackSlot) convert} a virtual * slot to a frame slot index */ protected void updateStub(Stub stub, EconomicSet<Register> destroyedRegisters, EconomicMap<LIRFrameState, SaveRegistersOp> calleeSaveInfo, FrameMap frameMap) { stub.initDestroyedCallerRegisters(destroyedRegisters); MapCursor<LIRFrameState, SaveRegistersOp> cursor = calleeSaveInfo.getEntries(); while (cursor.advance()) { SaveRegistersOp save = cursor.getValue(); if (save.supportsRemove()) { save.remove(destroyedRegisters); } if (cursor.getKey() != LIRFrameState.NO_STATE) { cursor.getKey().debugInfo().setCalleeSaveInfo(save.getMap(frameMap)); } } }
/** * Completely replace the current log with the copy of the specified log. * * The precondition is that the current inlining log is completely empty. This is usually called * when copying the entire graph. * * @see InliningLog#addDecision */ public void replaceLog(UnmodifiableEconomicMap<Node, Node> replacements, InliningLog replacementLog) { assert root.decisions.isEmpty(); assert root.children.isEmpty(); assert leaves.isEmpty(); EconomicMap<Callsite, Callsite> mapping = EconomicMap.create(Equivalence.IDENTITY_WITH_SYSTEM_HASHCODE); copyTree(root, replacementLog.root, replacements, mapping); MapCursor<Invokable, Callsite> replacementEntries = replacementLog.leaves.getEntries(); while (replacementEntries.advance()) { Invokable replacementInvoke = replacementEntries.getKey(); Callsite replacementSite = replacementEntries.getValue(); if (replacementInvoke.isAlive()) { Invokable invoke = (Invokable) replacements.get((Node) replacementInvoke); Callsite site = mapping.get(replacementSite); leaves.put(invoke, site); } } }
while (e.advance()) { MetricKey key = e.getKey(); if (csv) { Pair<String, String> valueAndUnit = key.toCSVFormat(e.getValue()); CSVUtil.Escape.println(p, csvFormat, key.getName(), valueAndUnit.getLeft(), valueAndUnit.getRight()); } else { p.println(key.getName() + "=" + key.toHumanReadableFormat(e.getValue()));
/** * Append the inlining decision tree from the specified log. * * The subtrees of the specified log are appended below the root of this log. This is usually * called when a node in the graph is replaced with its snippet. * * @see InliningLog#addDecision */ public void addLog(UnmodifiableEconomicMap<Node, Node> replacements, InliningLog replacementLog) { EconomicMap<Callsite, Callsite> mapping = EconomicMap.create(Equivalence.IDENTITY_WITH_SYSTEM_HASHCODE); for (Callsite calleeChild : replacementLog.root.children) { Callsite child = root.addChild(calleeChild.invoke); copyTree(child, calleeChild, replacements, mapping); } MapCursor<Invokable, Callsite> entries = replacementLog.leaves.getEntries(); while (entries.advance()) { Invokable replacementInvoke = entries.getKey(); Callsite replacementCallsite = entries.getValue(); if (replacementInvoke.asFixedNode().isDeleted()) { // Some invoke nodes could have been removed by optimizations. continue; } Invokable invoke = (Invokable) replacements.get(replacementInvoke.asFixedNode()); Callsite callsite = mapping.get(replacementCallsite); leaves.put(invoke, callsite); } }