I thought I've always understood why Java was portable, until I took Computer Organization.
This is my interpretation of a C program from start to finish:
C program --> compiler --> assembly --> machine code --> ISA --> micro architecture (how the computer interprets ISA) --> logic gate --> circuit --> device
Where the compiler must have knowledge of the ISA. Also, the assembly and machine code will vary based on ISA.
Java is as such:
(inside JVM): Java program --> compiler --> bytecode
bytecode is the ISA for a JVM.
So, I am guessing the JVM also has it's own micro architecture to interpret it's
ISA (bytecode).
Is this accurate?
So the overall cycle would be:
(inside JVM) Java program --> bytecode(ISA) --> JVM micro architecture --> host hardware
Also, if the micro architecture is implemented in the processor, does the JVM need to use one of the hosts' processors?
question from:
https://stackoverflow.com/questions/65865029/how-does-jvm-compile-to-machine-code-from-bytecode 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…