The difference between byte code and machine code?

1. machine code 


CPU is the computer directly read the machine code to run, run the fastest, but very obscure, but also more difficult to write; machine code that the computer can directly execute and perform the fastest code;

Written in machine language program, the programmer must first memorize the meaning of all the instruction code and the code used by computers. When the hand-programmed, programmers have their own storage allocation and processing each instruction and each input and output data have to remember what state during programming unit of work used in each step. This is a very tedious work, time spent programming is often several times or several hundred times the actual running time. Further, a program to compile the code for all such instructions 0 and 1, intuitive difference, error-prone. Now, in addition to computer manufacturers professionals, the vast majority of programmers no longer have to learn the language of the machine.

Machine language understood by a microprocessor and used for controlling the operation of its binary code. 
The machine instruction 8086 to the Pentium length may be from 1 byte to 13 bytes.
While the machine language seems to be very complicated, but it is regular.
There are as many as 100,000 kinds of machine language instructions. This means that these species can not list them all.

 


2. bytecode


Bytecode is an intermediate state (intermediate code) binary code (files), the byte code (Bytecode) comprising a program execution by a sequence of op code / data of the binary composition .

After the interpreter needs to be translated to machine code ; under normal circumstances it is byte code has been built, but nothing to do with the specific machine code.

Bytecode usually not the same people can read the source code, but encode the constant value, references, sequence of instructions and the like.

Regardless of the particular bytecode hardware environment; implementations by bytecode compiler and virtual machines. Compiler to compile the source code into byte code ,

Virtual machine on a particular platform translates bytecode instruction can be executed directly. Typical applications for the Java bytecode bytecode

 

 

3. Comparison with machine code bytecode


That computer can read the machine code of the code, simply put, it is a computer binary code to be executed.
Byte code, JAVA language is proprietary, it is to allow the JVM to execute binary code
, though they are binary code, but because it's not the same execution environment, so they have some differences on the instruction set

Guess you like

Origin www.cnblogs.com/Rivend/p/12044106.html