Revision: 6532
Author: sco...@google.com
Date: Wed Oct 28 16:53:03 2009
Log: 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
Review by: cromwellian


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

Modified:
  /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java

=======================================
---  
/trunk/dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java        
 
Fri Aug 21 10:53:16 2009
+++  
/trunk/dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java        
 
Wed Oct 28 16:53:03 2009
@@ -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