Building a graph manually
Bahram Yarahmadi
bahram.yarahmadi at gmail.com
Tue Jun 14 08:44:46 UTC 2016
Hello guys,
I want to build a graph manually but when I want to add an invokeNode to
the graph I get an error
this is my code :
StructuredGraph graph = new StructuredGraph(AllowAssumptions.YES);
ReturnNode returnNode = graph.add(new ReturnNode(null));
ValueNode valueNode1 = new ConstantNode(JavaConstant.forInt(154),
StampFactory.intValue());
ValueNode valueNode2 = new ConstantNode(JavaConstant.forInt(25),
StampFactory.intValue());
ValueNode[] valueNodes = new ValueNode[2];
valueNodes[0] = valueNode1;
valueNodes[1] = valueNode2;
ResolvedJavaMethod method = findMethod(AA.class, "SubInt");
MethodCallTargetNode callTarget = graph.add(new
MethodCallTargetNode(MethodCallTargetNode.InvokeKind.Static,
method, valueNodes,
StampFactory.forDeclaredType(null,
method.getSignature().getReturnType(null), false), null));
InvokeNode ink = graph.add(new InvokeNode(callTarget,
BytecodeFrame.UNWIND_BCI));
graph.start().setNext(ink);
ink.setNext(returnNode);
Debug.dump(Debug.BASIC_LOG_LEVEL, graph, "Graph");
and my SubInt method is
public static void SubInt(int a, int b) {
System.out.println("///");
}
but when I try to test with inittest I get this error :
testPrintBytecodes(com.oracle.graal.compiler.test.tutorial.GraalTutorial)
java.lang.AssertionError: Input not alive
at
com.oracle.graal.graph.NodeClass.registerAtInputsAsUsageHelper(NodeClass.java:1257)
at
com.oracle.graal.graph.NodeClass.registerAtInputsAsUsage(NodeClass.java:1245)
at com.oracle.graal.graph.Node.initialize(Node.java:593)
at com.oracle.graal.graph.Graph.addHelper(Graph.java:446)
at com.oracle.graal.graph.Graph.add(Graph.java:398)
at
com.oracle.graal.compiler.test.tutorial.GraalTutorial.testPrintBytecodes(GraalTutorial.java:278)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
Thanks again
Bahram,
More information about the graal-dev
mailing list