/** * Parses a given option setting string and adds the parsed key and value {@code dst}. * * @param optionSetting a string matching the pattern {@code <name>=<value>} */ public static void parseOptionSettingTo(String optionSetting, EconomicMap<String, String> dst) { int eqIndex = optionSetting.indexOf('='); if (eqIndex == -1) { throw new InternalError("Option setting has does not match the pattern <name>=<value>: " + optionSetting); } dst.put(optionSetting.substring(0, eqIndex), optionSetting.substring(eqIndex + 1)); }
@Override public void registerSnippetTemplateCache(SnippetTemplateCache templates) { assert snippetTemplateCache.get(templates.getClass().getName()) == null; snippetTemplateCache.put(templates.getClass().getName(), templates); }
public void set(EndNode end, InfoElement infoElement) { if (infoElements == null) { infoElements = EconomicMap.create(Equivalence.IDENTITY); } infoElements.put(end, infoElement); }
public NativeImageGenerator(ImageClassLoader loader, HostedOptionProvider optionProvider) { this.loader = loader; this.featureHandler = new FeatureHandler(); this.optionProvider = optionProvider; /* * Substrate VM parses all graphs, including snippets, early. We do not support bytecode * parsing at run time. */ optionProvider.getHostedValues().put(GraalOptions.EagerSnippets, true); optionProvider.getRuntimeValues().put(GraalOptions.EagerSnippets, true); }
public EconomicMap<LocationIdentity, MemoryNode> toMap() { EconomicMap<LocationIdentity, MemoryNode> res = EconomicMap.create(Equivalence.DEFAULT, locationIdentities.size()); for (int i = 0; i < nodes.size(); i++) { res.put(locationIdentities.get(i), (MemoryNode) nodes.get(i)); } return res; }
public void trackDuplicatedCallsite(Invokable sibling, Invokable newInvoke) { Callsite siblingCallsite = leaves.get(sibling); Callsite parentCallsite = siblingCallsite.parent; Callsite callsite = parentCallsite.addChild(newInvoke); leaves.put(newInvoke, callsite); }
public Data createDataItem(Constant constant) { Data data = dataCache.get(constant); if (data == null) { data = dataBuilder.createDataItem(constant); dataCache.put(constant, data); } return data; }
protected LabelHint requestHint(SPARCMacroAssembler masm, Label label) { LabelHint hint = labelHints.get(label); if (hint == null) { hint = masm.requestLabelHint(label); labelHints.put(label, hint); } return hint; }
protected ValuePhiNode getCachedPhi(CacheEntry<?> virtual, Stamp stamp) { ValuePhiNode result = materializedPhis.get(virtual); if (result == null) { result = createValuePhi(stamp); materializedPhis.put(virtual, result); } return result; }
private void releaseFloatingNode(Node node) { ArrayDeque<Node> cachedNodes = reusableFloatingNodes.get(node.getNodeClass()); if (cachedNodes == null) { cachedNodes = new ArrayDeque<>(2); reusableFloatingNodes.put(node.getNodeClass(), cachedNodes); } cachedNodes.push(node); }
private EncodedGraph createGraph(ResolvedJavaMethod method, boolean trackNodeSourcePosition) { EncodedGraph result = GraalSupport.encodedGraph((SharedRuntimeMethod) method, trackNodeSourcePosition); if (result == null) { throw shouldNotReachHere("Graph not available for runtime compilation: " + method.format("%H.%n(%p)")); } graphCache.put(method, result); return result; } }
private static void processIdentity(LocationIdentity identity, MemoryCheckpoint checkpoint, MemoryMapImpl state) { if (identity.isAny()) { state.lastMemorySnapshot.clear(); } if (identity.isMutable()) { state.lastMemorySnapshot.put(identity, checkpoint); } }
/** * Adds a comment to a {@link LIRInstruction}. Existing comments are replaced. */ public final void setComment(LIRInstruction op, String comment) { DebugContext debug = lir.getDebug(); if (debug.isDumpEnabled(DebugContext.BASIC_LEVEL)) { if (comments == null) { comments = EconomicMap.create(Equivalence.IDENTITY); } comments.put(op, comment); } }
/** * 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()); } }
public void addReadCache(ValueNode object, LocationIdentity identity, int index, JavaKind kind, boolean overflowAccess, ValueNode value, PartialEscapeClosure<?> closure) { ValueNode cacheObject; ObjectState obj = closure.getObjectState(this, object); if (obj != null) { assert !obj.isVirtual(); cacheObject = obj.getMaterializedValue(); } else { cacheObject = object; } readCache.put(new ReadCacheEntry(identity, cacheObject, index, kind, overflowAccess), value); }
/** * Copies all of the mappings from {@code other} to this map. * * @since 1.0 */ default void putAll(EconomicMap<K, V> other) { MapCursor<K, V> e = other.getEntries(); while (e.advance()) { put(e.getKey(), e.getValue()); } }
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())); } }
private static void createMemoryPhi(LoopBeginNode loop, MemoryMapImpl initialState, EconomicMap<LocationIdentity, MemoryPhiNode> phis, LocationIdentity location) { MemoryPhiNode phi = loop.graph().addWithoutUnique(new MemoryPhiNode(loop, location)); phi.addInput(ValueNodeUtil.asNode(initialState.getLastLocationAccess(location))); phis.put(location, phi); } }