On Tue, Jun 9, 2009 at 11:01 AM, Matt Mastracci<[email protected]> wrote: > Yeah... I would love to have a single AST to represent both of the > language states - many optimizations don't happen because we toss all > the Java type info during the conversion to JS. > > For instance, you can't safely optimize this: > > if (blah != null) > > to this: > > if (blah) > > without knowing what type blah was at the beginning.
I expect this would work well, too. > In addition, a lot of optimizations would be a lot simpler to write > (and some would just "fall out" of that structure) if we were dealing > with a more abstract SSA version of the code, rather than a more > direct AST. To be precise, I think what you're getting at is that within-method data flow would be helpful to represent. It's safer to stay with an AST representation due to the fact that the GWT compiler must output valid JavaScript syntax, and in particular does not have the luxury of using any kind of goto. However, it could certainly use an AST but either have the AST follow the SSA invariant, or else augment the AST with a data-flow graph. Either way, the goal is to get data flow information in there, so that silly code like "(x=10,x)" can be replaced by simply "10". -Lex --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
