Roberto Lublinerman has uploaded a new change for review.

  https://gwt-review.googlesource.com/2490


Change subject: Remove one source of non determinism in MethodInliner.
......................................................................

Remove one source of non determinism in MethodInliner.

The results of multiple calls to DeadCodeElimination on different nodes depend on
the ordering.

Change-Id: I31882b7cd7a0965643e15c3859042efc24cb0c6a
---
M dev/core/src/com/google/gwt/dev/jjs/impl/MethodInliner.java
M dev/core/test/com/google/gwt/dev/jjs/impl/DeadCodeEliminationTest.java
2 files changed, 14 insertions(+), 1 deletion(-)



diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/MethodInliner.java b/dev/core/src/com/google/gwt/dev/jjs/impl/MethodInliner.java
index beaf790..d2b05ae 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/MethodInliner.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/MethodInliner.java
@@ -42,6 +42,7 @@
 import com.google.gwt.dev.util.log.speedtracer.SpeedTracerLogger.Event;

 import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;

@@ -76,7 +77,7 @@
    * Method inlining visitor.
    */
   private class InliningVisitor extends JModVisitor {
-    protected final Set<JMethod> modifiedMethods = new HashSet<JMethod>();
+ protected final Set<JMethod> modifiedMethods = new LinkedHashSet<JMethod>();

     /**
* Resets with each new visitor, which is good since things that couldn't be diff --git a/dev/core/test/com/google/gwt/dev/jjs/impl/DeadCodeEliminationTest.java b/dev/core/test/com/google/gwt/dev/jjs/impl/DeadCodeEliminationTest.java
index 878780a..1087ea1 100644
--- a/dev/core/test/com/google/gwt/dev/jjs/impl/DeadCodeEliminationTest.java
+++ b/dev/core/test/com/google/gwt/dev/jjs/impl/DeadCodeEliminationTest.java
@@ -231,6 +231,18 @@
     OptimizerStats result = DeadCodeElimination.exec(program, method);
     if (result.didChange()) {
       // Make sure we converge in one pass.
+      //
+ // TODO(rluble): It does not appear to be true in general unless we iterate until a
+      // fixpoint in exec().
+      //
+      // Example:
+      //
+      //     Constructor( ) { deadcode }
+      //     m( new Constructor(); }
+      //
+ // If m is processed first, it will see the constructor as having side effects. + // Then the constructor will become empty enabling m() become empty in the next round.
+      //
       assertFalse(DeadCodeElimination.exec(program, method).didChange());
     }
     return result.didChange();

--
To view, visit https://gwt-review.googlesource.com/2490
To unsubscribe, visit https://gwt-review.googlesource.com/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I31882b7cd7a0965643e15c3859042efc24cb0c6a
Gerrit-PatchSet: 1
Gerrit-Project: gwt
Gerrit-Branch: master
Gerrit-Owner: Roberto Lublinerman <rlu...@google.com>

--
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
--- You received this message because you are subscribed to the Google Groups "Google Web Toolkit Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to