2

I know several interpreted programming languages ​​(PHP, Python, Java, Smalltalk) are using Bytecode as an intermediate step to execute code.

Is there a difference between the form of Bytecode generated by different languages' interpreters​, as the differences between Assembly opcodes for different machines?

In addition, just to be sure, Bytecode can be used only in interpreted languages, right?

Reflection
  • 1,936
  • 3
  • 21
  • 39

2 Answers2

4

Bytecode is a generic word for the instructions executed by a virtual machine, in the same way that machine language is a generic term for the instructions executed by a real processor. Just as there are many different machine instruction sets, there are many different bytecode instruction sets. Some, like Java bytecode, are a documented part of a platform. All Java virtual machines execute exactly the same bytecode, by definition. Others are just an implementation detail, and differ from version to version.

To answer your last question: no, that is not correct. Java is not an interpreted language; it is just-in-time compiled. C# is similar. Bytecode can be a part of many different architectures.

Ernest Friedman-Hill
  • 80,601
  • 10
  • 150
  • 186
1

As Ernest mentioned it is vendor dependent bytecode implementation from different languages. While there are already attempts to standardize bytecode. Have alook at solution from Microsoft CIL

Worth to mention LLVM compiler which becoming glue for different bytecodes providing optimizing compilation to any CPU instruction set.

Boris Ivanov
  • 4,145
  • 1
  • 32
  • 40
  • 1
    Isn't CIL just a .NET-specific bytecode? What standardization attempt in it, compared to the Java's JIT bytecode? – Reflection Nov 23 '13 at 17:46
  • Yes it is low level .NET, also have a look at this thread http://stackoverflow.com/questions/95163/differences-between-msil-and-java-bytecode – Boris Ivanov Nov 23 '13 at 17:49