Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Bytecode
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Execution== A bytecode program may be executed by parsing and ''directly'' executing the instructions, one at a time. This kind of ''bytecode interpreter'' is very portable. Some systems, called dynamic translators, or ''[[just-in-time compilation|just-in-time]]'' (JIT) compilers, translate bytecode into [[machine code]] as necessary at [[Run time (program lifecycle phase)|runtime]]. This makes the virtual machine hardware-specific but does not lose the portability of the bytecode. For example, [[Java (programming language)|Java]] and [[Smalltalk]] code is typically stored in bytecode 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 the bytecode is compiled to native machine code, but improves execution speed considerably compared to interpreting source code directly, normally by around an order of magnitude (10x).<ref name="Byte_Machine"/> 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 the bytecode to the virtual machine. There are bytecode based virtual machines of this sort for [[Java (programming language)|Java]], [[Raku (programming language)|Raku]], [[Python (programming language)|Python]], [[PHP]],{{efn|PHP has [[just-in-time compilation]] in PHP 8,<ref>{{Cite web|last=O’Phinney|first=Matthew Weier|title=Exploring the New PHP JIT Compiler|url=https://www.zend.com/blog/exploring-new-php-jit-compiler|access-date=2021-02-19|website=Zend by Perforce|language=en}}</ref><ref>{{Cite web|title=PHP 8: The JIT - stitcher.io|url=https://stitcher.io/blog/php-jit|access-date=2021-02-19|website=stitcher.io|language=en}}</ref> and before while not on in the default version, had options like [[HHVM]]. For older versions of PHP: Although [[PHP]] opcodes are generated each time the program is launched, and are always interpreted and not [[just-in-time compilation|just-in-time compiled]].}} [[Tcl]], [[AWK|mawk]] and [[Forth (programming language)|Forth]] (however, Forth is seldom compiled via bytecodes in this way, and its virtual machine is more generic instead). The implementation of [[Perl]] and [[Ruby (programming language)|Ruby]] 1.8 instead work by walking an [[abstract syntax tree]] representation derived from the source code. More recently, the authors of [[V8 (JavaScript engine)|V8]]<ref name="Dynamic_Machine_Code"/> and [[Dart (programming language)|Dart]]<ref name="Loitsch_Bytecode"/> have challenged the notion that intermediate bytecode is needed for fast and efficient VM implementation. Both of these language implementations currently do direct JIT compiling from source code to machine code with no bytecode intermediary.<ref name="Javascript"/>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)