BookRags.com Literature Guides Literature
Guides
Criticism & Essays Criticism &
Essays
Questions & Answers Questions &
Answers
Lesson Plans Lesson
Plans
My Bibliography Periodic Table U.S. Presidents Shakespeare Sonnet Shake-Up
Research Anything:        
History | Encyclopedias | Films | News | Create a Bibliography | More... Login | Register | Help
Not What You Meant?  There are 10 definitions for BCI.

Bytecode

Print-Friendly
About 2 pages (608 words)

Bookmark and Share Know this topic well? Help others and get FREE products!

Bytecode is a binary representation of an executable program designed to be executed by a virtual machine rather than by dedicated hardware. Since it is processed by software, it is usually more abstract than machine code. Different parts of a program are often stored in separate files, similar to object modules. Bytecode is called so because, historically, most instruction sets had one-byte opcodes, followed by zero or more parameters such as registers or memory address. It is a form of output code used by programming language implementations to reduce dependence on specific hardware (the same binary code can be executed across different platforms) and ease interpretation. After compiling to bytecode, the resulting output may be used as the input of a compiler targeting machine code, or executed directly on a virtual machine. Compared to source code (intended to be human-readable), bytecodes are less abstract, more compact, and more computer-centric. For example, bytecodes encode the results of semantic analysis such as the scope of each variable access (that is, whether the variable is global or local). Thus, performance is usually better than interpretation of source code.

Contents

Execution

A bytecode program is normally executed by parsing the instructions one at a time. This kind of bytecode interpreter is very portable. Some systems, called dynamic translators, or "just-in-time" (JIT) compilers, translate bytecode into machine language as necessary at runtime: this makes the virtual machine unportable, but doesn't lose the portability of the bytecode itself. For example, Java and Smalltalk code is typically stored in bytecoded format, which is typically then JIT compiled to translate the bytecode to machine code before execution. This introduces a delay before a program is run, when bytecode is compiled to native machine code, but improves execution speed considerably compared to interpretation - normally by several times. Because of its performance advantage, today many language implementations execute a program in two phases, first compiling the source code into bytecode, and then passing them to the virtual machine. Therefore, there are virtual machines for Java, Python, PHP[1], Forth, and Tcl. The current reference implementation of Perl and Ruby programming language instead resembles more that of an interpreter, since it works by walking the abstract syntax tree derived from the source code.

Examples

References

  1. ^ Although PHP opcodes are generated each time the program is launched, and are always interpreted and not Just-In-Time compiled

See also

View More Summaries on Bytecode
 
Ask any question on Bytecode and get it answered FAST!
Answer questions in BookRags Q&A and earn points toward
discounted or even FREE Study Guides and other BookRags products!
Learn more about BookRags Q&A
Copyrights
Bytecode from Wíkipedia. ©2006 by Wíkipedia. Licensed under the GNU Free Documentation License. View a list of authors or edit this article.

Article Navigation
Join BookRagslearn moreJoin BookRags




About BookRags | Customer Service | Report an Error | Terms of Use | Privacy Policy