For the most part, Java tools work with byte code, not source code. If you dynamically load code in Java, it's byte code you will load. If you write a debugger for Java, the unit of single stepping will be the byte code. When a web browser downloads Java code to run, it downloads a "jar" of byte code. If you optimize Java code, you optimize from jars of byte code to better jars of byte code. If you run Findbugs to find errors in your code, you'll be running it across byte code.
Finally, one must ask what the benefit would be. Certainly it would not be possible to run non-Java languages in this way. For the most part, such languages have at least one construct that doesn't map directly to byte code. In most cases, that mapping uses reflection in some way, and GWT doesn't even support reflection. To support such languages via byte code, GWT would have to reverse engineer what those byte codes came from.
Once you reach the point of reverse engineering the low-level format to infer what was intended in the high-level format, every engineer must ask if we couldn't simply use a higher-level format to begin with.
Subscribe to: Post Comments (Atom)
I think source is probably the right abstraction. The sarien.net folks solved the "goto" problem using switches: http://sarien.net/about
Something keeps bringing me back to the fun (actual fun!) I've had lately playing with the Parrot VM and PIR. (http://bit.ly/GqaQW) Writing a language parser that produces PIR, with the provided Parrot tools, is so easy as to border on sheer geeky joy. To me, this validates the idea of an intermediate representation language that captures important information, but isn't necessarily something you want to actually code in.
As a little warm-up exercise to studying this in more detail, I've started trying to make a conceptual map of Java and Scala language constructs that actually impact optimization vs. ones that solely exist for programmer convenience. This is probably knowledge you have in cache already, but it's an eye opener for me so far! Wow. We programmers are lazy. Especially we Scala programmers.
Post a Comment