예제 #1
0
파일: GraphUtil.java 프로젝트: smarr/graal
 public static void removeFixedWithUnusedInputs(FixedWithNextNode fixed) {
   if (fixed instanceof StateSplit) {
     FrameState stateAfter = ((StateSplit) fixed).stateAfter();
     ((StateSplit) fixed).setStateAfter(null);
     if (stateAfter.usages().isEmpty()) {
       killWithUnusedFloatingInputs(stateAfter);
     }
   }
   unlinkFixedNode(fixed);
   killWithUnusedFloatingInputs(fixed);
 }
예제 #2
0
파일: GraphUtil.java 프로젝트: smarr/graal
  /**
   * Gets an approximate source code location for a node if possible.
   *
   * @return the StackTraceElements if an approximate source location is found, null otherwise
   */
  public static StackTraceElement[] approxSourceStackTraceElement(Node node) {
    ArrayList<StackTraceElement> elements = new ArrayList<>();
    Node n = node;
    while (n != null) {
      if (n instanceof MethodCallTargetNode) {
        elements.add(((MethodCallTargetNode) n).targetMethod().asStackTraceElement(-1));
        n = ((MethodCallTargetNode) n).invoke().asNode();
      }

      if (n instanceof StateSplit) {
        FrameState state = ((StateSplit) n).stateAfter();
        while (state != null) {
          ResolvedJavaMethod method = state.method();
          if (method != null) {
            elements.add(method.asStackTraceElement(state.bci - 1));
          }
          state = state.outerFrameState();
        }
        break;
      }
      n = n.predecessor();
    }
    return elements.toArray(new StackTraceElement[elements.size()]);
  }