Difference between JIT machine specific operations and static binary
One of the "wins" listed by proponents of JIT is that it can generate machine-specific assembly instructions, based on the CPU of the machine on which the code is running.
How is this different than statically compiling a file? If a statically compiled file is going to run on a given machine, it must at so开发者_C百科me point generate/use machine code for the CPU of that machine. Why is the JIT version better or faster?
Because what the JIT makes is different for each system.
If we provide a statically compiled binary, it will only work for systems compatible with that system. Java is trying to be platform independent.
So instead of you providing the statically compiled binary (which only works for one) you provide bytecode which will work in any JVM, and allow the JIT to turn it into compiled code if it feels the need to.
精彩评论