protected LoadFieldNode genLoadFieldNode(Assumptions assumptions, ValueNode originalAlias, ResolvedJavaField field) { return LoadFieldNode.create(assumptions, originalAlias, field); }
private boolean processLoadField(LoadFieldNode load, PEReadEliminationBlockState state, GraphEffectList effects) { if (load.isVolatile()) { state.killReadCache(); return false; } return processLoad(load, load.object(), new FieldLocationIdentity(load.field()), -1, load.field().getJavaKind(), state, effects); }
private static ValueNode canonical(LoadFieldNode loadFieldNode, StampPair stamp, ValueNode forObject, ResolvedJavaField field, ConstantFieldProvider constantFields, ConstantReflectionProvider constantReflection, OptionValues options, MetaAccessProvider metaAccess, boolean canonicalizeReads, boolean allUsagesAvailable) { LoadFieldNode self = loadFieldNode; if (canonicalizeReads && metaAccess != null) { ConstantNode constant = asConstant(constantFields, constantReflection, metaAccess, options, forObject, field); if (constant != null) { return constant; } if (allUsagesAvailable) { PhiNode phi = asPhi(constantFields, constantReflection, metaAccess, options, forObject, field, stamp.getTrustedStamp()); if (phi != null) { return phi; } } } if (self != null && !field.isStatic() && forObject.isNullConstant()) { return new DeoptimizeNode(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.NullCheckException); } if (self == null) { self = new LoadFieldNode(stamp, forObject, field); } return self; }
protected void lowerLoadFieldNode(LoadFieldNode loadField, LoweringTool tool) { assert loadField.getStackKind() != JavaKind.Illegal; StructuredGraph graph = loadField.graph(); ResolvedJavaField field = loadField.field(); ValueNode object = loadField.isStatic() ? staticFieldBase(graph, field) : loadField.object(); object = createNullCheckedValue(object, loadField, tool); Stamp loadStamp = loadStamp(loadField.stamp(NodeView.DEFAULT), getStorageKind(field)); AddressNode address = createFieldAddress(graph, object, field); assert address != null : "Field that is loaded must not be eliminated: " + field.getDeclaringClass().toJavaName(true) + "." + field.getName(); ReadNode memoryRead = graph.add(new ReadNode(address, fieldLocationIdentity(field), loadStamp, fieldLoadBarrierType(field))); ValueNode readValue = implicitLoadConvert(graph, getStorageKind(field), memoryRead); loadField.replaceAtUsages(readValue); graph.replaceFixed(loadField, memoryRead); if (loadField.isVolatile()) { MembarNode preMembar = graph.add(new MembarNode(JMM_PRE_VOLATILE_READ)); graph.addBeforeFixed(memoryRead, preMembar); MembarNode postMembar = graph.add(new MembarNode(JMM_POST_VOLATILE_READ)); graph.addAfterFixed(memoryRead, postMembar); } }
AnalysisField field = (AnalysisField) node.field(); assert field.isAccessed(); if (node.getStackKind() == JavaKind.Object) { TypeFlowBuilder<? extends LoadFieldTypeFlow> loadFieldBuilder; if (node.isStatic()) { loadFieldBuilder = TypeFlowBuilder.create(bb, node, LoadStaticFieldTypeFlow.class, () -> { FieldTypeFlow fieldFlow = field.getStaticFieldFlow(); }); } else { TypeFlowBuilder<?> objectBuilder = state.lookup(node.object()); loadFieldBuilder = TypeFlowBuilder.create(bb, node, LoadInstanceFieldTypeFlow.class, () -> { LoadInstanceFieldTypeFlow loadFieldFLow = new LoadInstanceFieldTypeFlow(node, objectBuilder.get());
LoadFieldNode loadFieldNode = (LoadFieldNode) node; PEAppendGraphBuilderContext graphBuilderContext = new PEAppendGraphBuilderContext(methodScope, loadFieldNode); ResolvedJavaField field = loadFieldNode.field(); if (loadFieldNode.isStatic()) { for (NodePlugin nodePlugin : nodePlugins) { if (nodePlugin.handleLoadStaticField(graphBuilderContext, field)) { ValueNode object = loadFieldNode.object(); for (NodePlugin nodePlugin : nodePlugins) { if (nodePlugin.handleLoadField(graphBuilderContext, object, field)) {
public LoadFieldTypeFlow(LoadFieldNode node) { super(node, null); this.field = (AnalysisField) node.field(); }
@Override public ValueNode canonical(CanonicalizerTool tool, ValueNode forObject) { NodeView view = NodeView.from(tool); if (tool.allUsagesAvailable() && hasNoUsages() && !isVolatile()) { if (isStatic() || StampTool.isPointerNonNull(forObject.stamp(view))) { return null; } if (graph().getGuardsStage().allowsGuardInsertion()) { return new FixedGuardNode(new IsNullNode(forObject), DeoptimizationReason.NullCheckException, DeoptimizationAction.InvalidateReprofile, true, getNodeSourcePosition()); } } return canonical(this, StampPair.create(stamp, uncheckedStamp), forObject, field, tool.getConstantFieldProvider(), tool.getConstantReflection(), tool.getOptions(), tool.getMetaAccess(), tool.canonicalizeReads(), tool.allUsagesAvailable()); }
@Override public void virtualize(VirtualizerTool tool) { ValueNode alias = tool.getAlias(object()); if (alias instanceof VirtualObjectNode) { int fieldIndex = ((VirtualInstanceNode) alias).fieldIndex(field()); if (fieldIndex != -1) { ValueNode entry = tool.getEntry((VirtualObjectNode) alias, fieldIndex); if (stamp.isCompatible(entry.stamp(NodeView.DEFAULT))) { tool.replaceWith(entry); } else { assert stamp(NodeView.DEFAULT).getStackKind() == JavaKind.Int && (entry.stamp(NodeView.DEFAULT).getStackKind() == JavaKind.Long || entry.getStackKind() == JavaKind.Double || entry.getStackKind() == JavaKind.Illegal) : "Can only allow different stack kind two slot marker writes on one stot fields."; } } } }
protected ValueNode genLoadField(ValueNode receiver, ResolvedJavaField field) { StampPair stamp = graphBuilderConfig.getPlugins().getOverridingStamp(this, field.getType(), false); if (stamp == null) { return LoadFieldNode.create(getConstantFieldProvider(), getConstantReflection(), getMetaAccess(), getOptions(), getAssumptions(), receiver, field, false, false); } else { return LoadFieldNode.createOverrideStamp(getConstantFieldProvider(), getConstantReflection(), getMetaAccess(), getOptions(), stamp, receiver, field, false, false); } }
@Override public ValueNode getValue() { return object(); }
@Override public boolean handleLoadField(GraphBuilderContext b, ValueNode receiver, ResolvedJavaField field) { StampPair wordStamp = interceptType(b, field.getType(), false); if (wordStamp != null) { LoadFieldNode loadFieldNode = LoadFieldNode.createOverrideStamp(wordStamp, receiver, field); b.addPush(field.getJavaKind(), loadFieldNode); return true; } return false; }
public static LoadFieldNode createOverrideStamp(StampPair stamp, ValueNode object, ResolvedJavaField field) { return new LoadFieldNode(stamp, object, field); }
/** * Gets a constant value for this load if possible. */ public ConstantNode asConstant(CanonicalizerTool tool, ValueNode forObject) { return asConstant(tool.getConstantFieldProvider(), tool.getConstantReflection(), tool.getMetaAccess(), tool.getOptions(), forObject, field); }
/** * If the node corresponding to the compared value is an instance field load then mark that * field as being used in a comparison. * * @param comparedValue the node corresponding to the compared value */ private static void markFieldsUsedInComparison(ValueNode comparedValue) { if (comparedValue instanceof LoadFieldNode) { LoadFieldNode load = (LoadFieldNode) comparedValue; AnalysisField field = (AnalysisField) load.field(); if (!field.isStatic()) { field.markAsUsedInComparison(); } } }
@Override protected LoadFieldNode genLoadFieldNode(Assumptions assumptions, ValueNode originalAlias, ResolvedJavaField field) { if (field.getJavaKind() == JavaKind.Object && field.getType() instanceof SharedType) { /* * We have the static analysis to check interface types, e.g.., if a parameter of field * has a declared interface type and is assigned something that does not implement the * interface, the static analysis reports an error. */ TypeReference trusted = TypeReference.createTrustedWithoutAssumptions((SharedType) field.getType()); StampPair pair = StampPair.createSingle(StampFactory.object(trusted, false)); return LoadFieldNode.createOverrideStamp(pair, originalAlias, field); } else { return super.genLoadFieldNode(assumptions, originalAlias, field); } }
public static LoadFieldNode create(Assumptions assumptions, ValueNode object, ResolvedJavaField field, boolean volatileAccess) { return new LoadFieldNode(StampFactory.forDeclaredType(assumptions, field.getType(), false), object, field, volatileAccess); }
@Override protected ValueNode cloneAsFieldAccess(Assumptions assumptions, ResolvedJavaField field, boolean volatileAccess) { return LoadFieldNode.create(assumptions, object(), field, volatileAccess); }
if (load.field().equals(indexScaleField)) {