http://gwt-code-reviews.appspot.com/1351801/diff/1/2
File dev/core/src/com/google/gwt/dev/jjs/ast/JTypeOracle.java (right):

http://gwt-code-reviews.appspot.com/1351801/diff/1/2#newcode585
dev/core/src/com/google/gwt/dev/jjs/ast/JTypeOracle.java:585:
(getSingleJsoImpl(refType) != null && !isDualJsoInterface(refType));

Probably hit a key by accident when window focus changed in my ide.

On 2011/02/09 01:19:08, scottb wrote:
Can we factor "getSingleJsoImpl(refType) != null" into a
"isSingleJsoInterface"
here (and elsewhere)?

http://gwt-code-reviews.appspot.com/1351801/diff/1/2#newcode618
dev/core/src/com/google/gwt/dev/jjs/ast/JTypeOracle.java:618: // for any
concrete type not a JSO, check if it implements a JSO interface

Ah ok, I was thinking of something like that, but thought I would need
to recompute the isImplementedMap too, forgot that its cheap to check if
something's instantiated.

On 2011/02/09 01:19:08, scottb wrote:
I was going to make several comments, because some of the logic isn't
clear
here.  But then I thought maybe there's a simpler way to do this...

nextDual : for (Iterator<JInterfaceType> it = dualImpls.iterator();
it.hasNext();) {
   JInterfaceType dualIntf = it.next();
   Set<JClassType> implementors = get(isImplementedMap, dualIntf);
   for (JClassType implementor : implementors) {
     if (instantiatedTypes.contains(implementor)
         && !program.isJavaScriptObject(implementor)) {
       // This dual is still implemented by a Java class.
       continue nextDual;
     }
   }
   // No Java implementors.
   it.remove();
}


http://gwt-code-reviews.appspot.com/1351801/diff/1/4
File
dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Cast.java
(right):

http://gwt-code-reviews.appspot.com/1351801/diff/1/4#newcode92
dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Cast.java:92:
return src != null && (isNonStringJavaObject(src) || isJavaString(src));
On 2011/02/09 01:19:08, scottb wrote:
Can you explain this change a bit?

Sure. JSOs can legally dispatch on null values, e.g.

final public class Null extends JavaScriptObject {
   protected Null() {}
   public static Null create() /*-{
      return null;
   }-*/;

   public void someMethod() { ... }
}

This works, but if you hide 'Null' behind an interface, the
JsoVirtualizer will generate code that throws an NPE, since
Util.getTypeMarker(null) will be a null deref.

Being able to do this makes the Json API very clean and orthogonal in
Elemental, and absolutely efficient in terms of output.   This reminds
me that I need to update JsoVirtualizer since if a dual-interface isn't
really a dual, it shouldn't devirtualize with a trampoline.

http://gwt-code-reviews.appspot.com/1351801/show

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

Reply via email to