use of org.graalvm.compiler.nodes.java.StoreFieldNode in project graal by oracle.
the class EnsureVirtualizedNode method ensureVirtualFailure.
public static void ensureVirtualFailure(Node location, Stamp stamp) {
String additionalReason = "";
if (location instanceof FixedWithNextNode && !(location instanceof EnsureVirtualizedNode)) {
FixedWithNextNode fixedWithNextNode = (FixedWithNextNode) location;
FixedNode next = fixedWithNextNode.next();
if (next instanceof StoreFieldNode) {
additionalReason = " (must not store virtual object into a field)";
} else if (next instanceof Invoke) {
additionalReason = " (must not pass virtual object into an invoke that cannot be inlined)";
} else {
additionalReason = " (must not let virtual object escape at node " + next + ")";
}
}
Throwable exception = new VerificationError("Object of type %s should not be materialized%s:", StampTool.typeOrNull(stamp).getName(), additionalReason);
Node pos;
if (location instanceof FixedWithNextNode) {
pos = ((FixedWithNextNode) location).next();
} else if (location instanceof AbstractEndNode) {
pos = ((AbstractEndNode) location).merge();
} else {
pos = location;
}
throw GraphUtil.approxSourceException(pos, exception);
}
use of org.graalvm.compiler.nodes.java.StoreFieldNode in project graal by oracle.
the class EarlyReadEliminationTest method testPhi.
@Test
public void testPhi() {
StructuredGraph graph = processMethod("testPhiSnippet", false);
assertTrue(graph.getNodes().filter(LoadFieldNode.class).isEmpty());
List<ReturnNode> returnNodes = graph.getNodes(ReturnNode.TYPE).snapshot();
assertDeepEquals(2, returnNodes.size());
assertTrue(returnNodes.get(0).predecessor() instanceof StoreFieldNode);
assertTrue(returnNodes.get(1).predecessor() instanceof StoreFieldNode);
assertTrue(returnNodes.get(0).result().isConstant());
assertTrue(returnNodes.get(1).result().isConstant());
}
Aggregations