use of org.graalvm.compiler.nodes.NodeView in project graal by oracle.
the class GetClassNode method canonical.
@Override
public ValueNode canonical(CanonicalizerTool tool) {
NodeView view = NodeView.from(tool);
ValueNode folded = tryFold(tool.getMetaAccess(), tool.getConstantReflection(), view, getObject());
return folded == null ? this : folded;
}
use of org.graalvm.compiler.nodes.NodeView in project graal by oracle.
the class InstanceOfNode method canonical.
@Override
public ValueNode canonical(CanonicalizerTool tool, ValueNode forValue) {
NodeView view = NodeView.from(tool);
LogicNode synonym = findSynonym(checkedStamp, forValue, view);
if (synonym != null) {
return synonym;
} else {
return this;
}
}
use of org.graalvm.compiler.nodes.NodeView in project graal by oracle.
the class IntegerSwitchNode method simplify.
@Override
public void simplify(SimplifierTool tool) {
NodeView view = NodeView.from(tool);
if (blockSuccessorCount() == 1) {
tool.addToWorkList(defaultSuccessor());
graph().removeSplitPropagate(this, defaultSuccessor());
} else if (value() instanceof ConstantNode) {
killOtherSuccessors(tool, successorIndexAtKey(value().asJavaConstant().asInt()));
} else if (tryOptimizeEnumSwitch(tool)) {
return;
} else if (tryRemoveUnreachableKeys(tool, value().stamp(view))) {
return;
}
}
use of org.graalvm.compiler.nodes.NodeView in project graal by oracle.
the class NewArrayNode method simplify.
@Override
public void simplify(SimplifierTool tool) {
if (hasNoUsages()) {
NodeView view = NodeView.from(tool);
Stamp lengthStamp = length().stamp(view);
if (lengthStamp instanceof IntegerStamp) {
IntegerStamp lengthIntegerStamp = (IntegerStamp) lengthStamp;
if (lengthIntegerStamp.isPositive()) {
GraphUtil.removeFixedWithUnusedInputs(this);
return;
}
}
// RuntimeConstraint
if (graph().getGuardsStage().allowsFloatingGuards()) {
LogicNode lengthNegativeCondition = CompareNode.createCompareNode(graph(), CanonicalCondition.LT, length(), ConstantNode.forInt(0, graph()), tool.getConstantReflection(), view);
// we do not have a non-deopting path for that at the moment so action=None.
FixedGuardNode guard = graph().add(new FixedGuardNode(lengthNegativeCondition, DeoptimizationReason.RuntimeConstraint, DeoptimizationAction.None, true));
graph().replaceFixedWithFixed(this, guard);
}
}
}
use of org.graalvm.compiler.nodes.NodeView in project graal by oracle.
the class RawLoadNode method canonical.
@Override
public Node canonical(CanonicalizerTool tool) {
if (!isAnyLocationForced() && getLocationIdentity().isAny()) {
ValueNode targetObject = object();
if (offset().isConstant() && targetObject.isConstant() && !targetObject.isNullConstant()) {
ConstantNode objectConstant = (ConstantNode) targetObject;
ResolvedJavaType type = StampTool.typeOrNull(objectConstant);
if (type != null && type.isArray()) {
JavaConstant arrayConstant = objectConstant.asJavaConstant();
if (arrayConstant != null) {
int stableDimension = objectConstant.getStableDimension();
if (stableDimension > 0) {
NodeView view = NodeView.from(tool);
long constantOffset = offset().asJavaConstant().asLong();
Constant constant = stamp(view).readConstant(tool.getConstantReflection().getMemoryAccessProvider(), arrayConstant, constantOffset);
boolean isDefaultStable = objectConstant.isDefaultStable();
if (constant != null && (isDefaultStable || !constant.isDefaultForKind())) {
return ConstantNode.forConstant(stamp(view), constant, stableDimension - 1, isDefaultStable, tool.getMetaAccess());
}
}
}
}
}
}
return super.canonical(tool);
}
Aggregations