@Miguel,
FWIW, since we the time bounds of further optimizing this patch are
not yet
clear, I'd be in favor of landing it and then doing a second round of optimizations.
This patch achieves its stated goal, although there are some code style issues that need to be addressed. @Scott, Do you have any further input on the implementation changes to the JS runtime in the patch as it stands (modulo any future optimizations)? http://gwt-code-reviews.appspot.com/750801/diff/18001/19002 File dev/core/src/com/google/gwt/core/ext/linker/impl/StandardSymbolData.java (right): http://gwt-code-reviews.appspot.com/750801/diff/18001/19002#newcode36 dev/core/src/com/google/gwt/core/ext/linker/impl/StandardSymbolData.java:36: typeId, castableTypeMap); GWT code style: Make sure the Linker types don't retain references to any AST nodes at this point. Converting to the CastableTypeMap interface here will ensure this. http://gwt-code-reviews.appspot.com/750801/diff/18001/19005 File dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java (right): http://gwt-code-reviews.appspot.com/750801/diff/18001/19005#newcode1496 dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java:1496: private void generateCastableTypeIds(JClassType x, List<JsStatement> globalStmts) { Add comments that give example JS that will be generated by this method. http://gwt-code-reviews.appspot.com/750801/diff/18001/19011 File user/src/com/google/gwt/rpc/server/ClientOracle.java (right): http://gwt-code-reviews.appspot.com/750801/diff/18001/19011#newcode56 user/src/com/google/gwt/rpc/server/ClientOracle.java:56: public abstract Object getCastableTypeMap(Class<?> clazz); Make this return type /** * An opaque encapsulation of client-side type data. */ interface CastableTypeMap { CastableTypeMap DEFAULT = new CastableTypeMap() { public String toJs() {return "{}";} } /** * Returns a eval-able JavaScript representation of the type data. */ String toJs(); } Passing Object around an API isn't helpful. http://gwt-code-reviews.appspot.com/750801/diff/18001/19014 File user/src/com/google/gwt/rpc/server/WebModeClientOracle.java (right): http://gwt-code-reviews.appspot.com/750801/diff/18001/19014#newcode112 user/src/com/google/gwt/rpc/server/WebModeClientOracle.java:112: private static final long serialVersionUID = 3L; Bump this number. http://gwt-code-reviews.appspot.com/750801/diff/18001/19014#newcode121 user/src/com/google/gwt/rpc/server/WebModeClientOracle.java:121: public Object castableTypeMap; Code style: Sort this field. http://gwt-code-reviews.appspot.com/750801/diff/18001/19015 File user/src/com/google/gwt/rpc/server/WebModePayloadSink.java (right): http://gwt-code-reviews.appspot.com/750801/diff/18001/19015#newcode560 user/src/com/google/gwt/rpc/server/WebModePayloadSink.java:560: if (castableTypeMap == null) { Don't allow getCastableTypeMap() to return null. Instead, return the DEFAULT instance. http://gwt-code-reviews.appspot.com/750801/diff/18001/19015#newcode585 user/src/com/google/gwt/rpc/server/WebModePayloadSink.java:585: push(String.valueOf(castableTypeMap)); GWT code style: Object.toString() is generally only used for debugging info and shouldn't be used like this. http://gwt-code-reviews.appspot.com/750801/diff/18001/19016 File user/super/com/google/gwt/emul/java/lang/Object.java (right): http://gwt-code-reviews.appspot.com/750801/diff/18001/19016#newcode51 user/super/com/google/gwt/emul/java/lang/Object.java:51: private transient Object castableTypeMap; Make this field JavaScriptObject and tighten other references to it, since the data is this field isn't actually a Java object and afaict, it's only read through a JSNI method. The comment should also reflect the format of the data contained within the map. http://gwt-code-reviews.appspot.com/750801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors