Java is dynamic in nature and certain code generation strategies fit less well than others. From the earlier discussion, the following conclusions can be drawn:
- Code generation should be done at runtime, not ahead of time.
- All methods cannot be treated equally by code generator. There needs to be a way to discern a hot method from a cold one. Otherwise unnecessary optimization effort is spent on cold methods, or worse, not enough optimization effort on hot methods.
- In a JIT compiler, bookkeeping needs to be in place in order to keep up with the adaptive runtime. This is because generated native code invalidated by changes to the running program must be thrown away and potentially regenerated.
Achieving code execution efficiency ...