Encyclopedia > Bytecode

  Article Content

Byte-code

Redirected from Bytecode

Byte-code is a sort of intermediate code[?] that is more abstract than machine code. It is often treated as a binary file containing an executable program much like an object module[?], which is a binary file[?] containing a machine code produced by compilers.

Byte-code is called so because usually each op code is one-byte length but the length of instruction code varies. Each instruction has one byte operation code from 0 to 255 followed by parameters such as registers or memory address. This is a typical case, but the specification of bytecode largely varies in language.

As is in intermediate code, it is a form of output code used by programming language implementors to reduce dependence on specific hardware and ease interpretation.

Less commonly, bytecode is used as an intermediate[?] code of a compiler. Some systems, called dynamic translators, or "just-in-time" (JIT) compilers, translate bytecode into machine language immediately prior to runtime to improve execution speed.

A byte-code program is normally interpreted by a byte-code interpreter (usually called virtual machine since it is like a computer machine). The advantage is portability, that is, the same binary code can be executed across different platforms or architectures. This is the same advantage as that of interpreted languages. However, because bytecode is usually less abstract, more compact, and more computer-centric than program code that is intended for human modification, the performance is usually better than mere interpretation. Because of its performance advantage, today many interpreted languages are actually compiled into bytecode once then executed by bytecode interpreter. Such languages include Perl and Python. Java code is typically transmitted as bytecode to a receiving machine, which then uses a JIT to translate the bytecode to machine code before execution. The current implementation of the Ruby programming language actually does not use bytecode, instead, it relies on tree-like structures, which resembles intermediate representation used in compilers.

Also of interest are p-codes, which are just like byte codes, but may be physically larger than a single byte and may vary in size (much like Opcodes do). They work at very high levels, such as "print this string" and "clear the screen". Both BASIC and some versions of Pascal use p-codes.

Examples



All Wikipedia text is available under the terms of the GNU Free Documentation License

 
  Search Encyclopedia

Search over one million articles, find something about almost anything!
 
 
  
  Featured Article
Springs, New York

... As of the census of 2000, there are 4,950 people, 1,924 households, and 1,252 families residing in the town. The population density is 225.9/km² (584.8/mi²). ...

 
 
 
This page was created in 32.6 ms