Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Bytecode
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
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"/>
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Bytecode
(section)
Add topic