src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/MacroStateSplitNode.java
changeset 58877 aec7bf35d6f5
parent 52910 583fd71c47d6
equal deleted inserted replaced
58876:1a8d65e71a66 58877:aec7bf35d6f5
     1 /*
     1 /*
     2  * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    73     public boolean hasSideEffect() {
    73     public boolean hasSideEffect() {
    74         return true;
    74         return true;
    75     }
    75     }
    76 
    76 
    77     @Override
    77     @Override
    78     public LocationIdentity getLocationIdentity() {
    78     public LocationIdentity getKilledLocationIdentity() {
    79         return LocationIdentity.any();
    79         return LocationIdentity.any();
    80     }
    80     }
    81 
    81 
    82     protected void replaceSnippetInvokes(StructuredGraph snippetGraph) {
    82     protected void replaceSnippetInvokes(StructuredGraph snippetGraph) {
    83         for (MethodCallTargetNode call : snippetGraph.getNodes(MethodCallTargetNode.TYPE)) {
    83         for (MethodCallTargetNode call : snippetGraph.getNodes(MethodCallTargetNode.TYPE)) {
    85             if (!call.targetMethod().equals(getTargetMethod())) {
    85             if (!call.targetMethod().equals(getTargetMethod())) {
    86                 throw new GraalError("unexpected invoke %s in snippet", getClass().getSimpleName());
    86                 throw new GraalError("unexpected invoke %s in snippet", getClass().getSimpleName());
    87             }
    87             }
    88             assert invoke.stateAfter().bci == BytecodeFrame.AFTER_BCI;
    88             assert invoke.stateAfter().bci == BytecodeFrame.AFTER_BCI;
    89             // Here we need to fix the bci of the invoke
    89             // Here we need to fix the bci of the invoke
    90             InvokeNode newInvoke = snippetGraph.add(new InvokeNode(invoke.callTarget(), bci(), invoke.getLocationIdentity()));
    90             InvokeNode newInvoke = snippetGraph.add(new InvokeNode(invoke.callTarget(), bci(), invoke.getKilledLocationIdentity()));
    91             newInvoke.setStateAfter(invoke.stateAfter());
    91             newInvoke.setStateAfter(invoke.stateAfter());
    92             snippetGraph.replaceFixedWithFixed((InvokeNode) invoke.asNode(), newInvoke);
    92             snippetGraph.replaceFixedWithFixed((InvokeNode) invoke.asNode(), newInvoke);
    93         }
    93         }
    94     }
    94     }
    95 }
    95 }