use of org.graalvm.compiler.nodes.memory.ReadNode in project graal by oracle.
the class DefaultJavaLoweringProvider method createReadArrayLength.
/**
* Creates a read node that read the array length and is guarded by a null-check.
*
* The created node is placed before {@code before} in the CFG.
*/
protected ReadNode createReadArrayLength(ValueNode array, FixedNode before, LoweringTool tool) {
StructuredGraph graph = array.graph();
ValueNode canonicalArray = this.createNullCheckedValue(skipPiWhileNonNull(array), before, tool);
AddressNode address = createOffsetAddress(graph, canonicalArray, arrayLengthOffset());
ReadNode readArrayLength = graph.add(new ReadNode(address, ARRAY_LENGTH_LOCATION, StampFactory.positiveInt(), BarrierType.NONE));
graph.addBeforeFixed(before, readArrayLength);
return readArrayLength;
}
use of org.graalvm.compiler.nodes.memory.ReadNode in project graal by oracle.
the class PEGraphDecoderTest method registerPlugins.
private static void registerPlugins(InvocationPlugins plugins) {
Registration r = new Registration(plugins, PEGraphDecoderTest.class);
r.register2("readInt", Object.class, long.class, new InvocationPlugin() {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver unused, ValueNode obj, ValueNode offset) {
AddressNode address = b.add(new OffsetAddressNode(obj, offset));
ReadNode read = b.addPush(JavaKind.Int, new ReadNode(address, LocationIdentity.any(), StampFactory.forKind(JavaKind.Int), BarrierType.NONE));
read.setGuard(AbstractBeginNode.prevBegin(read));
return true;
}
});
}
Aggregations