Will, that’s an interesting question but I doubt that Hotspot could generate code that is as good as mine. Not because I think I’m better at this than the Hotspot authors, but because I am compiling directly from a description of the .proto file into machine code. In the Hotspot case, the flow is more like:
.proto file -> Java -> JVM byte-code -> machine code
The fact that you have to go through Java and JVM byte-code first means that you are limited by what can be expressed in Java. For example, Java doesn’t even have unsigned types!
In fact I think the JIT part is a bit of a distraction, because upb isn’t actually using any run-time information that isn’t available as part of the .proto file to begin with. So even the C++ protobuf compiler (which works ahead-of-time) has just as much information as upb’s JIT does. I’m JITting for convenience, not because I’m using any runtime information (well, at least not yet
.