3 ms·
It's analogous to JVM bytecode. That's only true in the way everything is analogous to everything.
by pvg 9y ago
It's analogous to JVM bytecode.
That's only true in the way everything is analogous to everything.
- chubot 9y agoI think it's a good analogy because it's saying that nontrivial optimizations happen below the code layer. In early CPUs, nothing was optimized. They just executed your instructions. Now there are nontrivial optimizations and rewriting, just like the JVM.
- coldtea 9y agoNope, also in the way the parent explains right after that sentence.
- pvg 9y agoIt's a pretty terrible analogy in nearly every obvious technical way. What an x86 cpu does with its instructions is almost but not entirely unlike what a JVM does.
- admax88q 9y agoNone of the "registers" in x86 assembly are real. Few of the instructions are implemented in hardware, most are impelmented in software microcode. Advanced hardware will re-order and pipeline instructions based upon data dependencies. Sure it's not doing the exact same things the JVM does with bytecode but the point is that x86 assembly is not the language of the hardware. It's a language that the hardware+firmware knows how to interpret and optimize at runtime similar to what your JVM does with java bytecode.
- pvg 9y agoIt isn't at all similar. JVM bytecode is a pretty high-level IR for tokenized Java. The JVM's main unit of optimization is a method, not instructions. Its key component is a compiler, it's even called that. An x86 cpu, as the article points out, spends inordinate resources looking for ILP. It's not a compiler in any reasonable sense of the word, while a JVM is.
- coldacid 9y ago`javac` is a compiler. The JVM is an execution platform, just like modern x86.
- pvg 9y agoWhat's the word that comes after 'JIT'?
- coldtea 9y agoWhat the word is not really important. JITting is also called "dynamic translation", which is what a CPU does with microcode. Whether that's a full compiler or not is beyond pedantic -- and irrelevant to the parent's point.
- pvg 9y agoThe parent is telling me how the JVM doesn't have a compiler, which was my claim. It has a couple full-blown compilers. which is what a CPU does with microcode. Either you know something about current x86 CPUs that I don't or words and technical terms are, indeed, not important and have no meaning.
- admax88q 9y agoThe point I'm trying to make with the analogy is that the x86 instruction set is not representative of what the hardware is actually doing. It is not "low level" because it is an abstraction or virtual platform that the processor exposes and then interprets using its own internal resources and programming interface (microcode). The x86 interface does not map closely to the actual hardware, just as the article states. It exposes a flat memory model with sequential execution and only a handful of registers. Much the same way that the JVM exposes a virtual machine that doesn't directly map to any of the platforms that it runs on. It's an abstraction that is interpreted or compiled at runtime. I don't understand why you think the two are so different just because the JVM is higher level.
- 9y ago