Search code examples
javajvmvm-implementation

abstract machine concept of jvm


I am trying to understand the real advantage of implementing java as an abstract or virtual machine or in other words the advantage of compiling a language into a language for an abstract machine. As far as platform independence is concerned I was thinking of the following two alternative implementations:

  • just having an interpreter which translates java directly into machine code of the machine it is running on and having multiple implementations of such an interpreter for different type s of machine.

  • the first option is not efficient in space so how about compiling the source code to an intermediate language which is not a language for an abstract machine but just some language which can be interpreted to machine code and then having multiple implementations of such interpreters.

If performance is not considered how does having an abstract machine compare with these options. In other words what if java byte code is not a language for a virtual machine but just some intermediate language.What features and benefits would be lost (except for performance)?


Solution

  • Bytecode is just an intermediate language.

    Or the other way round: The implementation of an intermediate language is a virtual machine.