Modifying graph to include InvokeNode
ATKIN-GRANVILLE Chris
s1255753 at sms.ed.ac.uk
Tue Jul 16 05:31:29 PDT 2013
I forgot to mention that I have disabled inlining, via PhasePlan.disablePhase(InliningPhase.class);.
On 16 Jul 2013, at 13:22, ATKIN-GRANVILLE Chris <s1255753 at sms.ed.ac.uk>
wrote:
> Hi there,
>
> I'm trying to modify the graph to include an invoke node to a static function after certain node types. I'm modifying the graph at a high level before LoweringPhase.class (not a requirement, can change if required). However, I'm running into issues with JVM fatal errors. The code I have at the moment looks like this:
>
> public class MyPhase extends Phase {
> public void run(StructuredGraph graph) {
> for (Node node: graph.getNode()) {
>
> if ( node instanceof RandomFixedNode) {
> RandomFixedNode rfm = (RandomFixedNode) node;
>
> try {
> ResolvedJavaMethod method = getMethod(…);
> MethodCallTargetMode callTarget = graph.add(new MethodCallTargetNode(MethodCallTargetNode.InvokeKind.Static,
> method, new ValueNode[] {}, new HotSpotResolvedPrimitiveType(Kind.Void)));
>
> InvokeNode invoke = graph.add(new InvokeNode(callTarget, FrameState.UNKNOWN_BCI));
> invoke.setStateAfter(graph.add(new FrameState(FrameState.UNKNOWN_BCI)));
> graph.addAfterFixed(rfm, invoke);
>
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
>
> }
> }
> }
>
> I'm pretty sure the problem is do with the BCIs and/or the FrameStates, but I don't know how to fix it. The error that I get is:
>
> Internal Error (/Volumes/Acme/Development/graal/src/share/vm/graal/graalCompilerToVM.cpp:44), pid=8466, tid=5379
> assert(hotspot_method != NULL && hotspot_method->is_a(HotSpotResolvedJavaMethod::klass())) failed: sanity
>
> Does anyone have any ideas?
>
> Thanks, Chris
>
> --
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
>
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
More information about the graal-dev
mailing list