Reviewers: Lex, cromwellian_google.com, mike.aizatsky,

Description:
(All the more proof we need better, more intuitive optimization
mechanisms than static impls.)

Fixes a very obscure bug in ControlFlowAnalyzer.

In TypeTightener, we create synthetic references between an instance
method and its staticImpl, to guard against the case where the instance
method inlines the static (thus losing the direct reference) but some
call site later rebinds to the staticImpl.  Turns out, we need to do the
same in CFA.

Found by: mike.aizatsky (whose if->cond patch exposed this by opening up
many new inlining opportunities)


Please review this at http://gwt-code-reviews.appspot.com/89804

Affected files:
   dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java


Index: dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java
===================================================================
--- dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java    
(revision 6528)
+++ dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java    
(working copy)
@@ -506,6 +506,19 @@
              maybeRescueJavaScriptObjectPassingIntoJava(method.getType());
            }
            rescueOverridingMethods(method);
+
+          /*
+           * Special case: also rescue an associated staticImpl. Most of  
the
+           * time, this would happen naturally since the instance method
+           * delegates to the static. However, in cases where the static  
has
+           * been inlined into the instance method, future optimization  
could
+           * tighten an instance call into a static call, reaching code  
that
+           * was pruned.
+           */
+          JMethod staticImpl = program.getStaticImpl(method);
+          if (staticImpl != null) {
+            rescue(staticImpl);
+          }
            return true;
          }
        }



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

Reply via email to