Package com.google.gwt.dev.jjs.impl.gflow.copy.CopyAssumption

Examples of com.google.gwt.dev.jjs.impl.gflow.copy.CopyAssumption.Updater


    FlowFunction<CfgNode<?>, CfgEdge, Cfg, CopyAssumption> {
  @Override
  public void interpret(CfgNode<?> node,
      Cfg g, AssumptionMap<CfgEdge, CopyAssumption> assumptionMap) {
    CopyAssumption in = AssumptionUtil.join(g.getInEdges(node), assumptionMap);
    final Updater result = new Updater(in);

    node.accept(new CfgVisitor() {
      @Override
      public void visitReadWriteNode(CfgReadWriteNode node) {
        JVariable targetVariable = node.getTargetVariable();
        if (isSupportedVar(targetVariable)) {
          result.kill(targetVariable);
        }
      }

      @Override
      public void visitWriteNode(CfgWriteNode node) {
        JVariable targetVariable = node.getTargetVariable();
        if (!isSupportedVar(targetVariable)) {
          return;
        }

        if (!(node.getValue() instanceof JVariableRef)) {
          result.kill(targetVariable);
          return;
        }

        JVariable original = ((JVariableRef) node.getValue()).getTarget();
        original = result.getMostOriginal(original);

        if (original != targetVariable) {
          result.kill(targetVariable);
          if (isSupportedVar(original) &&
              original.getType() == targetVariable.getType()) {
            result.addCopy(original, targetVariable);
          }
        } else {
          // We don't have to kill any assumptions after i = i assignment.
        }
      }

      private boolean isSupportedVar(JVariable targetVariable) {
        return targetVariable instanceof JParameter ||
            targetVariable instanceof JLocal;
      }
    });

    AssumptionUtil.setAssumptions(g.getOutEdges(node), result.unwrap(), assumptionMap);
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.jjs.impl.gflow.copy.CopyAssumption.Updater

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.