It looks like I had some unpublished comments in this review, so just
sending them out now.


http://gwt-code-reviews.appspot.com/1428808/diff/1/dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java
File dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java
(right):

http://gwt-code-reviews.appspot.com/1428808/diff/1/dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java#newcode273
dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java:273:
"String y = fruit.staticField;");
Interesting, yeah the side-effects of evaluation of fruit would be the
other case where it differs from Fruit.staticMethod() (along with the
null case).  So isn't it incorrect to not check for the NPE in that
case?  Also, after more optimizations happen and the 'fruit' reference
goes away, would not that open up the possibility for enum
ordinalization at that point, on a subsequent pass?

I've also been planning another opportunity for ordinalization for the
case where enums are assigned or compared to null, by representing this
as -1.  This would only be possible in cases where it's directly clear
that the cast is to null and not an evaluated expression that might be
null, etc.  But that possibility would probably not be compatible with
allowing fruit.staticMethod to be ordinalized, if fruit is determined to
be null and ordinalized to -1, etc., unless we want to synthetically
create the code to throw the NPE (but maybe we don't care about the NPE
possibility anyway?)....

http://gwt-code-reviews.appspot.com/1428808/diff/1/dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java#newcode456
dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java:456:
"}");
Yeah, actually the ordinalization can proceed in this case, and the
ordinalization process doesn't seem to actually need to change the AST
for the instanceof test itself.  I'll make a note to test this scenario
fully and enable subsequently.  Adding a TODO.

http://gwt-code-reviews.appspot.com/1428808/

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

Reply via email to