Revision: 7869
Author: [email protected]
Date: Fri Apr  2 14:35:01 2010
Log: Removes unnecessary uses of a JProgram instance where it's really not needed.

Also fixes:
- non-final field in JLocalRef
- improved JNonNullType handling for certain nodes
- fixes a bad visit in JVisitor

http://gwt-code-reviews.appspot.com/295802/show
Review by: mike.aizatsky

http://code.google.com/p/google-web-toolkit/source/detail?r=7869

Modified:
 /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JClassLiteral.java
 /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JLocalRef.java
 /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JNameOf.java
 /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JStringLiteral.java
 /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JThisRef.java
 /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JVisitor.java
 /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/AutoboxUtils.java
 /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/CloneExpressionVisitor.java
/trunk/dev/core/src/com/google/gwt/dev/jjs/impl/CompoundAssignmentNormalizer.java
 /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/FixAssignmentToUnbox.java
/trunk/dev/core/src/com/google/gwt/dev/jjs/impl/JavaScriptObjectNormalizer.java
 /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/MethodInliner.java
/trunk/dev/core/src/com/google/gwt/dev/jjs/impl/PostOptimizationCompoundAssignmentNormalizer.java
 /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/ReplaceRebinds.java
/trunk/dev/core/src/com/google/gwt/dev/jjs/impl/SameParameterValueOptimizer.java /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/gflow/DataflowOptimizer.java /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/gflow/constants/ConstantsAnalysis.java /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/gflow/constants/ConstantsIntegratedFlowFunction.java /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/gflow/constants/ConstantsTransformationFunction.java /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/gflow/constants/FoldConstantTransformer.java /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/gflow/constants/FoldConstantsTransformation.java /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/CfgAnalysisTestBase.java /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/CfgIntegratedAnalysisTestBase.java /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/constants/ConstantsAnalysisTest.java /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/constants/ConstantsAnalysisTransformationTest.java /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/copy/CopyAnalysisTest.java /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/copy/CopyAnalysisTransformationTest.java /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/liveness/LivenessAnalysisTest.java /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/liveness/LivenessTransformationTest.java

=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JClassLiteral.java Mon Feb 8 08:29:30 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JClassLiteral.java Fri Apr 2 14:35:01 2010
@@ -53,17 +53,20 @@
     assert method != null;

     JMethodCall call = new JMethodCall(info, null, method);
-    call.addArgs(program.getLiteralString(info, getPackageName(typeName)),
-        program.getLiteralString(info, getClassName(typeName)));
+    JStringLiteral packageName = program.getLiteralString(info,
+        getPackageName(typeName));
+    JStringLiteral className = program.getLiteralString(info,
+        getClassName(typeName));
+    call.addArgs(packageName, className);

     if (type instanceof JArrayType) {
       // There's only one seed function for all arrays
       JDeclaredType arrayType = program.getIndexedType("Array");
-      call.addArg(new JNameOf(info, program, arrayType));
+      call.addArg(new JNameOf(info, className.getType(), arrayType));

     } else if (type instanceof JClassType) {
       // Add the name of the seed function for concrete types
-      call.addArg(new JNameOf(info, program, type));
+      call.addArg(new JNameOf(info, className.getType(), type));

     } else if (type instanceof JPrimitiveType) {
       // And give primitive types an illegal, though meaningful, value
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JLocalRef.java Tue Mar 9 10:54:56 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JLocalRef.java Fri Apr 2 14:35:01 2010
@@ -25,7 +25,7 @@
   /**
    * The referenced local.
    */
-  private JLocal local;
+  private final JLocal local;

   public JLocalRef(SourceInfo info, JLocal local) {
     super(info, local);
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JNameOf.java Wed Oct 28 09:10:53 2009 +++ /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JNameOf.java Fri Apr 2 14:35:01 2010
@@ -23,19 +23,19 @@
 public class JNameOf extends JExpression {

   private final HasName node;
-  private final JType stringType;
-
-  public JNameOf(SourceInfo info, JProgram program, HasName node) {
+  private final JNonNullType stringType;
+
+  public JNameOf(SourceInfo info, JNonNullType stringType, HasName node) {
     super(info);
     this.node = node;
-    stringType = program.getTypeJavaLangString();
+    this.stringType = stringType;
   }

   public HasName getNode() {
     return node;
   }

-  public JType getType() {
+  public JNonNullType getType() {
     return stringType;
   }

=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JStringLiteral.java Wed Dec 9 09:10:40 2009 +++ /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JStringLiteral.java Fri Apr 2 14:35:01 2010
@@ -39,7 +39,7 @@
     throw new UnsupportedOperationException();
   }

-  public JType getType() {
+  public JNonNullType getType() {
     return stringType;
   }

=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JThisRef.java Tue Mar 9 10:54:56 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JThisRef.java Fri Apr 2 14:35:01 2010
@@ -34,7 +34,7 @@
     return (JClassType) type.getUnderlyingType();
   }

-  public JType getType() {
+  public JNonNullType getType() {
     return type;
   }

=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JVisitor.java Thu Mar 11 17:23:20 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JVisitor.java Fri Apr 2 14:35:01 2010
@@ -519,7 +519,7 @@
   }

   public boolean visit(JContinueStatement x, Context ctx) {
-    return visit((JNode) x, ctx);
+    return visit((JStatement) x, ctx);
   }

   public boolean visit(JDeclarationStatement x, Context ctx) {
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/AutoboxUtils.java Mon Apr 20 15:21:46 2009 +++ /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/AutoboxUtils.java Fri Apr 2 14:35:01 2010
@@ -139,14 +139,14 @@

   private void computeBoxablePrimitiveTypes() {
     boxablePrimitiveTypes = new LinkedHashSet<JPrimitiveType>();
-    boxablePrimitiveTypes.add(program.getTypePrimitiveBoolean());
-    boxablePrimitiveTypes.add(program.getTypePrimitiveByte());
-    boxablePrimitiveTypes.add(program.getTypePrimitiveChar());
-    boxablePrimitiveTypes.add(program.getTypePrimitiveShort());
-    boxablePrimitiveTypes.add(program.getTypePrimitiveInt());
-    boxablePrimitiveTypes.add(program.getTypePrimitiveLong());
-    boxablePrimitiveTypes.add(program.getTypePrimitiveFloat());
-    boxablePrimitiveTypes.add(program.getTypePrimitiveDouble());
+    boxablePrimitiveTypes.add(JPrimitiveType.BOOLEAN);
+    boxablePrimitiveTypes.add(JPrimitiveType.BYTE);
+    boxablePrimitiveTypes.add(JPrimitiveType.CHAR);
+    boxablePrimitiveTypes.add(JPrimitiveType.SHORT);
+    boxablePrimitiveTypes.add(JPrimitiveType.INT);
+    boxablePrimitiveTypes.add(JPrimitiveType.LONG);
+    boxablePrimitiveTypes.add(JPrimitiveType.FLOAT);
+    boxablePrimitiveTypes.add(JPrimitiveType.DOUBLE);
   }

   private void computeBoxClassToPrimitiveMap() {
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/CloneExpressionVisitor.java Thu Mar 11 17:23:20 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/CloneExpressionVisitor.java Fri Apr 2 14:35:01 2010
@@ -42,7 +42,6 @@
 import com.google.gwt.dev.jjs.ast.JParameterRef;
 import com.google.gwt.dev.jjs.ast.JPostfixOperation;
 import com.google.gwt.dev.jjs.ast.JPrefixOperation;
-import com.google.gwt.dev.jjs.ast.JProgram;
 import com.google.gwt.dev.jjs.ast.JStringLiteral;
 import com.google.gwt.dev.jjs.ast.JThisRef;
 import com.google.gwt.dev.jjs.ast.JVisitor;
@@ -58,10 +57,8 @@
  */
 public class CloneExpressionVisitor extends JVisitor {
   private JExpression expression;
-  private JProgram program;
-
-  public CloneExpressionVisitor(JProgram program) {
-    this.program = program;
+
+  public CloneExpressionVisitor() {
   }

   @SuppressWarnings("unchecked")
@@ -228,7 +225,7 @@

   @Override
   public boolean visit(JNameOf x, Context ctx) {
-    expression = new JNameOf(x.getSourceInfo(), program, x.getNode());
+    expression = new JNameOf(x.getSourceInfo(), x.getType(), x.getNode());
     return false;
   }

@@ -294,7 +291,7 @@

   @Override
   public boolean visit(JThisRef x, Context ctx) {
- expression = program.getExprThisRef(x.getSourceInfo(), x.getClassType());
+    expression = new JThisRef(x.getSourceInfo(), x.getType());
     return false;
   }
 }
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/CompoundAssignmentNormalizer.java Fri Apr 2 11:54:38 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/CompoundAssignmentNormalizer.java Fri Apr 2 14:35:01 2010
@@ -22,13 +22,17 @@
 import com.google.gwt.dev.jjs.ast.JBinaryOperator;
 import com.google.gwt.dev.jjs.ast.JExpression;
 import com.google.gwt.dev.jjs.ast.JFieldRef;
+import com.google.gwt.dev.jjs.ast.JIntLiteral;
 import com.google.gwt.dev.jjs.ast.JLocal;
 import com.google.gwt.dev.jjs.ast.JLocalRef;
+import com.google.gwt.dev.jjs.ast.JLongLiteral;
 import com.google.gwt.dev.jjs.ast.JMethodBody;
 import com.google.gwt.dev.jjs.ast.JModVisitor;
+import com.google.gwt.dev.jjs.ast.JNode;
 import com.google.gwt.dev.jjs.ast.JParameterRef;
 import com.google.gwt.dev.jjs.ast.JPostfixOperation;
 import com.google.gwt.dev.jjs.ast.JPrefixOperation;
+import com.google.gwt.dev.jjs.ast.JPrimitiveType;
 import com.google.gwt.dev.jjs.ast.JProgram;
 import com.google.gwt.dev.jjs.ast.JThisRef;
 import com.google.gwt.dev.jjs.ast.JType;
@@ -202,13 +206,13 @@
       }

       JExpression one;
-      if (arg.getType() == program.getTypePrimitiveLong()) {
+      if (arg.getType() == JPrimitiveType.LONG) {
// use an explicit long, so that LongEmulationNormalizer does not get
         // confused
-        one = program.getLiteralLong(1);
+        one = JLongLiteral.get(1);
       } else {
         // int is safe to add to all other types
-        one = program.getLiteralInt(1);
+        one = JIntLiteral.get(1);
       }
// arg is cloned below because the caller is allowed to use it somewhere JBinaryOperation asg = new JBinaryOperation(arg.getSourceInfo(), arg.getType(),
@@ -347,7 +351,6 @@
     }
   }

-  protected final JProgram program;
   private final CloneExpressionVisitor cloner;

   private JMethodBody currentMethodBody;
@@ -372,17 +375,15 @@
    */
   private final boolean reuseTemps;

-  protected CompoundAssignmentNormalizer(JProgram program,
-      boolean reuseTemps) {
-    this.program = program;
+  protected CompoundAssignmentNormalizer(boolean reuseTemps) {
     this.reuseTemps = reuseTemps;
-    cloner = new CloneExpressionVisitor(program);
+    cloner = new CloneExpressionVisitor();
     clearLocals();
   }

-  public void breakUpAssignments() {
+  public void accept(JNode node) {
     BreakupAssignOpsVisitor breaker = new BreakupAssignOpsVisitor();
-    breaker.accept(program);
+    breaker.accept(node);
   }

   /**
@@ -439,7 +440,7 @@
     }

     if (temp == null) {
-      temp = program.createLocal(currentMethodBody.getSourceInfo(),
+      temp = JProgram.createLocal(currentMethodBody.getSourceInfo(),
getTempPrefix() + localCounter++, type, false, currentMethodBody);
     }
     tracker.useLocal(temp);
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/FixAssignmentToUnbox.java Thu Apr 9 08:41:34 2009 +++ /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/FixAssignmentToUnbox.java Fri Apr 2 14:35:01 2010
@@ -52,7 +52,7 @@
     private final AutoboxUtils autoboxUtils;

     protected CompoundAssignmentToUnboxNormalizer(JProgram program) {
-      super(program, false);
+      super(false);
       autoboxUtils = new AutoboxUtils(program);
     }

@@ -95,8 +95,8 @@
   }

   public static void exec(JProgram program) {
- (new CompoundAssignmentToUnboxNormalizer(program)).breakUpAssignments();
-    (new FixAssignmentToUnbox(program)).accept(program);
+    new CompoundAssignmentToUnboxNormalizer(program).accept(program);
+    new FixAssignmentToUnbox(program).accept(program);
   }

   private final AutoboxUtils autoboxUtils;
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/JavaScriptObjectNormalizer.java Fri Apr 2 11:54:38 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/JavaScriptObjectNormalizer.java Fri Apr 2 14:35:01 2010
@@ -132,7 +132,7 @@
           localCall.addArgs(x.getArgs());

           // We need a second copy of the arguments for the else expression
- CloneExpressionVisitor cloner = new CloneExpressionVisitor(program);
+          CloneExpressionVisitor cloner = new CloneExpressionVisitor();

           // instance.jsoMethod(arg, arg)
           JMethodCall jsoCall = new JMethodCall(info,
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/MethodInliner.java Fri Apr 2 12:42:00 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/MethodInliner.java Fri Apr 2 14:35:01 2010
@@ -56,12 +56,7 @@
   /**
    * Clones an expression, ensuring no local or this refs.
    */
- private class CloneCalleeExpressionVisitor extends CloneExpressionVisitor {
-
-    public CloneCalleeExpressionVisitor() {
-      super(program);
-    }
-
+ private static class CloneCalleeExpressionVisitor extends CloneExpressionVisitor {
     @Override
     public boolean visit(JLocalRef x, Context ctx) {
       throw new InternalCompilerException(
@@ -452,11 +447,12 @@

     @Override
     public void endVisit(JParameterRef x, Context ctx) {
- int paramIndex = methodCall.getTarget().getParams().indexOf(x.getParameter());
+      int paramIndex = methodCall.getTarget().getParams().indexOf(
+          x.getParameter());
       assert paramIndex != -1;

       // Replace with a cloned call argument.
-      CloneExpressionVisitor cloner = new CloneExpressionVisitor(program);
+      CloneExpressionVisitor cloner = new CloneExpressionVisitor();
       JExpression arg = methodCall.getArgs().get(paramIndex);
       JExpression clone = cloner.cloneExpression(arg);

=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/PostOptimizationCompoundAssignmentNormalizer.java Wed Nov 18 12:17:07 2009 +++ /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/PostOptimizationCompoundAssignmentNormalizer.java Fri Apr 2 14:35:01 2010
@@ -19,6 +19,7 @@
 import com.google.gwt.dev.jjs.ast.JBinaryOperator;
 import com.google.gwt.dev.jjs.ast.JPostfixOperation;
 import com.google.gwt.dev.jjs.ast.JPrefixOperation;
+import com.google.gwt.dev.jjs.ast.JPrimitiveType;
 import com.google.gwt.dev.jjs.ast.JProgram;

 /**
@@ -28,11 +29,11 @@
 public class PostOptimizationCompoundAssignmentNormalizer extends
     CompoundAssignmentNormalizer {
   public static void exec(JProgram program) {
- new PostOptimizationCompoundAssignmentNormalizer(program).breakUpAssignments();
+    new PostOptimizationCompoundAssignmentNormalizer().accept(program);
   }

- protected PostOptimizationCompoundAssignmentNormalizer(JProgram program) {
-    super(program, true);
+  protected PostOptimizationCompoundAssignmentNormalizer() {
+    super(true);
   }

   @Override
@@ -42,12 +43,12 @@

   @Override
   protected boolean shouldBreakUp(JBinaryOperation x) {
-    if (x.getType() == program.getTypePrimitiveLong()) {
+    if (x.getType() == JPrimitiveType.LONG) {
       return true;
     }
     if (x.getOp() == JBinaryOperator.ASG_DIV
-        && x.getType() != program.getTypePrimitiveFloat()
-        && x.getType() != program.getTypePrimitiveDouble()) {
+        && x.getType() != JPrimitiveType.FLOAT
+        && x.getType() != JPrimitiveType.DOUBLE) {
       return true;
     }
     return false;
@@ -55,7 +56,7 @@

   @Override
   protected boolean shouldBreakUp(JPostfixOperation x) {
-    if (x.getType() == program.getTypePrimitiveLong()) {
+    if (x.getType() == JPrimitiveType.LONG) {
       return true;
     }
     return false;
@@ -63,7 +64,7 @@

   @Override
   protected boolean shouldBreakUp(JPrefixOperation x) {
-    if (x.getType() == program.getTypePrimitiveLong()) {
+    if (x.getType() == JPrimitiveType.LONG) {
       return true;
     }
     return false;
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/ReplaceRebinds.java Thu Mar 11 17:23:20 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/ReplaceRebinds.java Fri Apr 2 14:35:01 2010
@@ -31,6 +31,7 @@
 import com.google.gwt.dev.jjs.ast.JMethodCall;
 import com.google.gwt.dev.jjs.ast.JModVisitor;
 import com.google.gwt.dev.jjs.ast.JNameOf;
+import com.google.gwt.dev.jjs.ast.JNullLiteral;
 import com.google.gwt.dev.jjs.ast.JProgram;
 import com.google.gwt.dev.jjs.ast.JReferenceType;
 import com.google.gwt.dev.jjs.ast.JStringLiteral;
@@ -92,12 +93,13 @@
     private void replaceImplNameOf(JMethodCall x, Context ctx) {
       JExpression arg0 = x.getArgs().get(0);
       assert arg0 instanceof JStringLiteral;
-      String stringLiteral = ((JStringLiteral) arg0).getValue();
+      JStringLiteral stringLiteral = (JStringLiteral) arg0;
+      String stringValue = stringLiteral.getValue();

       HasName named = null;

       JDeclaredType refType;
-      JsniRef ref = JsniRef.parse(stringLiteral);
+      JsniRef ref = JsniRef.parse(stringValue);

       if (ref != null) {
         final List<String> errors = new ArrayList<String>();
@@ -120,8 +122,8 @@

       } else {
         // See if it's just @foo.Bar, which would result in the class seed
-        refType = program.getFromTypeMap(stringLiteral.charAt(0) == '@'
-            ? stringLiteral.substring(1) : stringLiteral);
+        refType = program.getFromTypeMap(stringValue.charAt(0) == '@'
+            ? stringValue.substring(1) : stringValue);
         if (refType != null) {
           named = refType;
         }
@@ -129,9 +131,10 @@

       if (named == null) {
         // Not found, must be null
-        ctx.replaceMe(program.getLiteralNull());
+        ctx.replaceMe(JNullLiteral.INSTANCE);
       } else {
-        ctx.replaceMe(new JNameOf(x.getSourceInfo(), program, named));
+ ctx.replaceMe(new JNameOf(x.getSourceInfo(), stringLiteral.getType(),
+            named));
       }
     }
   }
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/SameParameterValueOptimizer.java Fri Apr 2 09:39:56 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/SameParameterValueOptimizer.java Fri Apr 2 14:35:01 2010
@@ -166,7 +166,7 @@
         JExpression expression) {
       this.parameter = parameter;
       this.expression = expression;
-      cloner = new CloneExpressionVisitor(program);
+      cloner = new CloneExpressionVisitor();
     }

     @Override
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/gflow/DataflowOptimizer.java Fri Apr 2 09:39:56 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/gflow/DataflowOptimizer.java Fri Apr 2 14:35:01 2010
@@ -76,7 +76,7 @@
         fwdAnalysis = CombinedIntegratedAnalysis.createAnalysis();

         fwdAnalysis.addAnalysis(new UnreachableAnalysis());
-        fwdAnalysis.addAnalysis(new ConstantsAnalysis(program));
+        fwdAnalysis.addAnalysis(new ConstantsAnalysis());
         fwdAnalysis.addAnalysis(new CopyAnalysis());
         // fwdAnalysis.addAnalysis(new InlineVarAnalysis(program));

=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/gflow/constants/ConstantsAnalysis.java Tue Mar 9 10:54:56 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/gflow/constants/ConstantsAnalysis.java Fri Apr 2 14:35:01 2010
@@ -15,7 +15,6 @@
  */
 package com.google.gwt.dev.jjs.impl.gflow.constants;

-import com.google.gwt.dev.jjs.ast.JProgram;
 import com.google.gwt.dev.jjs.impl.gflow.Analysis;
 import com.google.gwt.dev.jjs.impl.gflow.AssumptionMap;
 import com.google.gwt.dev.jjs.impl.gflow.IntegratedAnalysis;
@@ -34,19 +33,13 @@
 public class ConstantsAnalysis implements
     Analysis<CfgNode<?>, CfgEdge, Cfg, ConstantsAssumption>,
IntegratedAnalysis<CfgNode<?>, CfgEdge, CfgTransformer, Cfg, ConstantsAssumption> {
-
-  private final JProgram program;
-
-  public ConstantsAnalysis(JProgram program) {
-    this.program = program;
-  }

   public ConstantsFlowFunction getFlowFunction() {
     return new ConstantsFlowFunction();
   }

   public ConstantsIntegratedFlowFunction getIntegratedFlowFunction() {
-    return new ConstantsIntegratedFlowFunction(program);
+    return new ConstantsIntegratedFlowFunction();
   }

   public void setInitialGraphAssumptions(Cfg graph,
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/gflow/constants/ConstantsIntegratedFlowFunction.java Tue Mar 9 10:54:56 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/gflow/constants/ConstantsIntegratedFlowFunction.java Fri Apr 2 14:35:01 2010
@@ -15,7 +15,6 @@
  */
 package com.google.gwt.dev.jjs.impl.gflow.constants;

-import com.google.gwt.dev.jjs.ast.JProgram;
 import com.google.gwt.dev.jjs.impl.gflow.AssumptionMap;
 import com.google.gwt.dev.jjs.impl.gflow.IntegratedFlowFunction;
import com.google.gwt.dev.jjs.impl.gflow.TransformationFunction.Transformation;
@@ -35,8 +34,8 @@

   private final ConstantsTransformationFunction transformationFunction;

-  public ConstantsIntegratedFlowFunction(JProgram program) {
-    transformationFunction = new ConstantsTransformationFunction(program);
+  public ConstantsIntegratedFlowFunction() {
+    transformationFunction = new ConstantsTransformationFunction();
   }

   public Transformation<CfgTransformer, Cfg> interpretOrReplace(
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/gflow/constants/ConstantsTransformationFunction.java Tue Mar 9 10:54:56 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/gflow/constants/ConstantsTransformationFunction.java Fri Apr 2 14:35:01 2010
@@ -17,7 +17,6 @@

 import com.google.gwt.dev.jjs.ast.JBooleanLiteral;
 import com.google.gwt.dev.jjs.ast.JExpression;
-import com.google.gwt.dev.jjs.ast.JProgram;
 import com.google.gwt.dev.jjs.ast.JValueLiteral;
 import com.google.gwt.dev.jjs.impl.gflow.AssumptionMap;
 import com.google.gwt.dev.jjs.impl.gflow.AssumptionUtil;
@@ -73,17 +72,10 @@
     @Override
     public void visitReadNode(CfgReadNode node) {
       if (assumption.hasAssumption(node.getTarget())) {
-        result = new FoldConstantsTransformation(program, assumption, node,
-            graph);
+        result = new FoldConstantsTransformation(assumption, node, graph);
       }
     }
   }
-
-  private final JProgram program;
-
-  public ConstantsTransformationFunction(JProgram program) {
-    this.program = program;
-  }

   public Transformation<CfgTransformer, Cfg> transform(
       final CfgNode<?> node, final Cfg graph,
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/gflow/constants/FoldConstantTransformer.java Tue Mar 9 10:54:56 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/gflow/constants/FoldConstantTransformer.java Fri Apr 2 14:35:01 2010
@@ -18,15 +18,14 @@
 import com.google.gwt.dev.jjs.ast.Context;
 import com.google.gwt.dev.jjs.ast.JModVisitor;
 import com.google.gwt.dev.jjs.ast.JNode;
-import com.google.gwt.dev.jjs.ast.JProgram;
 import com.google.gwt.dev.jjs.ast.JValueLiteral;
 import com.google.gwt.dev.jjs.ast.JVariable;
 import com.google.gwt.dev.jjs.ast.JVariableRef;
 import com.google.gwt.dev.jjs.impl.CloneExpressionVisitor;
-import com.google.gwt.dev.jjs.impl.gflow.cfg.CfgTransformer;
 import com.google.gwt.dev.jjs.impl.gflow.cfg.Cfg;
 import com.google.gwt.dev.jjs.impl.gflow.cfg.CfgNode;
 import com.google.gwt.dev.jjs.impl.gflow.cfg.CfgReadNode;
+import com.google.gwt.dev.jjs.impl.gflow.cfg.CfgTransformer;
 import com.google.gwt.dev.util.Preconditions;

 /**
@@ -37,11 +36,11 @@
   private CloneExpressionVisitor cloner;
   private final CfgReadNode nodeToFold;

-  public FoldConstantTransformer(JProgram program,
-      ConstantsAssumption assumptions, CfgReadNode nodeToFold) {
+  public FoldConstantTransformer(ConstantsAssumption assumptions,
+      CfgReadNode nodeToFold) {
     this.assumption = assumptions;
     this.nodeToFold = nodeToFold;
-    cloner = new CloneExpressionVisitor(program);
+    cloner = new CloneExpressionVisitor();
   }

   public boolean transform(CfgNode<?> node, Cfg cfgGraph) {
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/gflow/constants/FoldConstantsTransformation.java Fri Mar 12 08:11:14 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/gflow/constants/FoldConstantsTransformation.java Fri Apr 2 14:35:01 2010
@@ -15,14 +15,13 @@
  */
 package com.google.gwt.dev.jjs.impl.gflow.constants;

-import com.google.gwt.dev.jjs.ast.JProgram;
import com.google.gwt.dev.jjs.impl.gflow.TransformationFunction.Transformation;
-import com.google.gwt.dev.jjs.impl.gflow.cfg.CfgTransformer;
 import com.google.gwt.dev.jjs.impl.gflow.cfg.Cfg;
-import com.google.gwt.dev.jjs.impl.gflow.cfg.CfgUtil;
 import com.google.gwt.dev.jjs.impl.gflow.cfg.CfgNode;
 import com.google.gwt.dev.jjs.impl.gflow.cfg.CfgNopNode;
 import com.google.gwt.dev.jjs.impl.gflow.cfg.CfgReadNode;
+import com.google.gwt.dev.jjs.impl.gflow.cfg.CfgTransformer;
+import com.google.gwt.dev.jjs.impl.gflow.cfg.CfgUtil;

 /**
* Transformation that replaces read node with Nop node in graph, and replaces
@@ -33,19 +32,16 @@
   private final ConstantsAssumption assumption;
   private final Cfg graph;
   private final CfgReadNode node;
-  private final JProgram program;
-
-  FoldConstantsTransformation(JProgram program,
-      ConstantsAssumption assumptions,
+
+  FoldConstantsTransformation(ConstantsAssumption assumptions,
       CfgReadNode node, Cfg graph) {
-    this.program = program;
     this.assumption = assumptions;
     this.node = node;
     this.graph = graph;
   }

   public CfgTransformer getGraphTransformer() {
-    return new FoldConstantTransformer(program, assumption, node);
+    return new FoldConstantTransformer(assumption, node);
   }

   public Cfg getNewSubgraph() {
=======================================
--- /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/CfgAnalysisTestBase.java Tue Mar 9 10:54:56 2010 +++ /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/CfgAnalysisTestBase.java Fri Apr 2 14:35:01 2010
@@ -26,11 +26,11 @@

     assertNotNull(cfgGraph);

- Map<CfgEdge, A> map = AnalysisSolver.solve(cfgGraph, createAnalysis(program), forward); + Map<CfgEdge, A> map = AnalysisSolver.solve(cfgGraph, createAnalysis(), forward);
     return new AnalysisResult(cfgGraph, map);
   }

- protected abstract Analysis<CfgNode<?>, CfgEdge, Cfg, A> createAnalysis(JProgram program); + protected abstract Analysis<CfgNode<?>, CfgEdge, Cfg, A> createAnalysis();

   protected class AnalysisResult {
     private final Map<CfgEdge, A> assumptions;
=======================================
--- /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/CfgIntegratedAnalysisTestBase.java Tue Mar 9 10:54:56 2010 +++ /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/CfgIntegratedAnalysisTestBase.java Fri Apr 2 14:35:01 2010
@@ -25,7 +25,7 @@

     assertNotNull(cfgGraph);

- AnalysisSolver.solveIntegrated(cfgGraph, createIntegratedAnalysis(program), forward); + AnalysisSolver.solveIntegrated(cfgGraph, createIntegratedAnalysis(), forward);
     return new Result(program);
   }

@@ -55,6 +55,5 @@
     }
   }

- protected abstract IntegratedAnalysis<CfgNode<?>, CfgEdge, CfgTransformer, Cfg, A> createIntegratedAnalysis(
-      JProgram program);
-}
+ protected abstract IntegratedAnalysis<CfgNode<?>, CfgEdge, CfgTransformer, Cfg, A> createIntegratedAnalysis();
+}
=======================================
--- /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/constants/ConstantsAnalysisTest.java Tue Mar 9 10:54:56 2010 +++ /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/constants/ConstantsAnalysisTest.java Fri Apr 2 14:35:01 2010
@@ -1,6 +1,5 @@
 package com.google.gwt.dev.jjs.impl.gflow.constants;

-import com.google.gwt.dev.jjs.ast.JProgram;
 import com.google.gwt.dev.jjs.impl.gflow.Analysis;
 import com.google.gwt.dev.jjs.impl.gflow.CfgAnalysisTestBase;
 import com.google.gwt.dev.jjs.impl.gflow.cfg.Cfg;
@@ -213,8 +212,7 @@
   }

   @Override
- protected Analysis<CfgNode<?>, CfgEdge, Cfg, ConstantsAssumption> createAnalysis(
-      JProgram program) {
-    return new ConstantsAnalysis(program);
+ protected Analysis<CfgNode<?>, CfgEdge, Cfg, ConstantsAssumption> createAnalysis() {
+    return new ConstantsAnalysis();
   }
 }
=======================================
--- /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/constants/ConstantsAnalysisTransformationTest.java Tue Mar 9 10:54:56 2010 +++ /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/constants/ConstantsAnalysisTransformationTest.java Fri Apr 2 14:35:01 2010
@@ -15,7 +15,6 @@
  */
 package com.google.gwt.dev.jjs.impl.gflow.constants;

-import com.google.gwt.dev.jjs.ast.JProgram;
 import com.google.gwt.dev.jjs.impl.gflow.CfgIntegratedAnalysisTestBase;
 import com.google.gwt.dev.jjs.impl.gflow.IntegratedAnalysis;
 import com.google.gwt.dev.jjs.impl.gflow.cfg.Cfg;
@@ -138,8 +137,7 @@
   }

   @Override
- protected IntegratedAnalysis<CfgNode<?>, CfgEdge, CfgTransformer, Cfg, ConstantsAssumption> createIntegratedAnalysis(
-      JProgram program) {
-    return new ConstantsAnalysis(program);
+ protected IntegratedAnalysis<CfgNode<?>, CfgEdge, CfgTransformer, Cfg, ConstantsAssumption> createIntegratedAnalysis() {
+    return new ConstantsAnalysis();
   }
 }
=======================================
--- /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/copy/CopyAnalysisTest.java Tue Mar 9 10:54:56 2010 +++ /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/copy/CopyAnalysisTest.java Fri Apr 2 14:35:01 2010
@@ -1,6 +1,5 @@
 package com.google.gwt.dev.jjs.impl.gflow.copy;

-import com.google.gwt.dev.jjs.ast.JProgram;
 import com.google.gwt.dev.jjs.impl.gflow.Analysis;
 import com.google.gwt.dev.jjs.impl.gflow.CfgAnalysisTestBase;
 import com.google.gwt.dev.jjs.impl.gflow.cfg.Cfg;
@@ -88,8 +87,7 @@
   }

   @Override
- protected Analysis<CfgNode<?>, CfgEdge, Cfg, CopyAssumption> createAnalysis(
-      JProgram program) {
+ protected Analysis<CfgNode<?>, CfgEdge, Cfg, CopyAssumption> createAnalysis() {
     return new CopyAnalysis();
   }
 }
=======================================
--- /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/copy/CopyAnalysisTransformationTest.java Tue Mar 9 10:54:56 2010 +++ /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/copy/CopyAnalysisTransformationTest.java Fri Apr 2 14:35:01 2010
@@ -15,7 +15,6 @@
  */
 package com.google.gwt.dev.jjs.impl.gflow.copy;

-import com.google.gwt.dev.jjs.ast.JProgram;
 import com.google.gwt.dev.jjs.impl.gflow.CfgIntegratedAnalysisTestBase;
 import com.google.gwt.dev.jjs.impl.gflow.IntegratedAnalysis;
 import com.google.gwt.dev.jjs.impl.gflow.cfg.Cfg;
@@ -64,8 +63,7 @@
   }

   @Override
- protected IntegratedAnalysis<CfgNode<?>, CfgEdge, CfgTransformer, Cfg, CopyAssumption> createIntegratedAnalysis(
-      JProgram program) {
+ protected IntegratedAnalysis<CfgNode<?>, CfgEdge, CfgTransformer, Cfg, CopyAssumption> createIntegratedAnalysis() {
     return new CopyAnalysis();
   }
 }
=======================================
--- /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/liveness/LivenessAnalysisTest.java Tue Mar 9 10:54:56 2010 +++ /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/liveness/LivenessAnalysisTest.java Fri Apr 2 14:35:01 2010
@@ -15,7 +15,6 @@
  */
 package com.google.gwt.dev.jjs.impl.gflow.liveness;

-import com.google.gwt.dev.jjs.ast.JProgram;
 import com.google.gwt.dev.jjs.impl.gflow.Analysis;
 import com.google.gwt.dev.jjs.impl.gflow.CfgAnalysisTestBase;
 import com.google.gwt.dev.jjs.impl.gflow.cfg.Cfg;
@@ -75,8 +74,7 @@
   }

   @Override
-  protected Analysis<CfgNode<?>, CfgEdge, Cfg, LivenessAssumption>
-  createAnalysis(JProgram program) {
+ protected Analysis<CfgNode<?>, CfgEdge, Cfg, LivenessAssumption> createAnalysis() {
     return new LivenessAnalysis();
   }
 }
=======================================
--- /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/liveness/LivenessTransformationTest.java Tue Mar 9 10:54:56 2010 +++ /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/liveness/LivenessTransformationTest.java Fri Apr 2 14:35:01 2010
@@ -15,7 +15,6 @@
  */
 package com.google.gwt.dev.jjs.impl.gflow.liveness;

-import com.google.gwt.dev.jjs.ast.JProgram;
 import com.google.gwt.dev.jjs.impl.gflow.CfgIntegratedAnalysisTestBase;
 import com.google.gwt.dev.jjs.impl.gflow.IntegratedAnalysis;
 import com.google.gwt.dev.jjs.impl.gflow.cfg.Cfg;
@@ -86,8 +85,7 @@
   }

   @Override
- protected IntegratedAnalysis<CfgNode<?>, CfgEdge, CfgTransformer, Cfg, LivenessAssumption> createIntegratedAnalysis(
-      JProgram program) {
+ protected IntegratedAnalysis<CfgNode<?>, CfgEdge, CfgTransformer, Cfg, LivenessAssumption> createIntegratedAnalysis() {
     return new LivenessAnalysis();
   }
 }

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

To unsubscribe, reply using "remove me" as the subject.

Reply via email to