This looks good except that it's all static state and static methods. I believe Tracing should have instance state and instance methods. It's not out of the question to run two compiler instances in separate threads.
That means that an instance of Tracing needs to be stashed somewhere, in the worst case in JProgram. It would be better if it could be a local variable in some method in JavaToJavaScriptCompiler, though, and then passed to MethodInliner as part of the call to MethodInliner.exec. The counting should be extremely cheap, so I don't see a big need to disable the actual counting. For outputting the data, what would you think of making it a compiler artifact in the extras output? To see how to do that, look at JavaToJavaScriptCompiler.makeSoycArtifact. Finally, I don't understand the pattern of clearing out the stats along the way. I would have thought that the counts would be accumulated for an entire compiler run and then output at the end. So, I don't understand the true goal, but perhaps MethodInliner could make a separate Tracing instance rather than clearing out the main one? Or, maybe MethodInliner should simply have some local variables to do its counts? http://gwt-code-reviews.appspot.com/64813/diff/1/2 File dev/core/src/com/google/gwt/dev/jjs/impl/MethodInliner.java (right): http://gwt-code-reviews.appspot.com/64813/diff/1/2#newcode529 Line 529: Tracing.clearStats(); I'm surprised that the inliner would clear the compiler-wide stats. Doesn't that mean that all stats until now are forgotten? http://gwt-code-reviews.appspot.com/64813/diff/1/3 File dev/core/src/com/google/gwt/dev/jjs/impl/Tracing.java (right): http://gwt-code-reviews.appspot.com/64813/diff/1/3#newcode56 Line 56: Boolean.parseBoolean(System.getProperty("gwt.tracestats")); Instead of a property, how about logging at a low log level? Properties are at a very large scope. http://gwt-code-reviews.appspot.com/64813/diff/1/3#newcode76 Line 76: System.err.println(results.toString()); This would seem better to go to a logger, whether or not a property is used to enable or disable tracing. Best of all would be if it made a compiler artifact in the -aux directory, but I suppose that's too much to get into right now. http://gwt-code-reviews.appspot.com/64813 --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
