Content deleted Content added
WP Randomno (talk | contribs) |
|||
(5 intermediate revisions by 5 users not shown) | |||
Line 5:
'''Java bytecode''' is the instruction set of the [[Java virtual machine]] (JVM), the language to which [[Java (programming language)|Java]] and other JVM-compatible [[source code]] is [[compiler|compiled]].<ref name="oracle jvm spec">{{Cite web|url=http://docs.oracle.com/javase/specs/jvms/se8/html/|title=Java Virtual Machine Specification|publisher=Oracle|access-date=14 November 2023}}</ref> Each instruction is represented by a single [[byte]], hence the name [[bytecode]], making it a compact form of [[data]].<ref name="JVM Book">{{Cite book|last=Lindholm|first=Tim|title=The Java Virtual Machine Specification|year=2015|publisher=Oracle|isbn=978-0133905908}}</ref>
Due to the nature of bytecode, a Java bytecode [[computer program|program]] is runnable on any machine with a compatible JVM
Java bytecode is used at [[Runtime (program lifecycle phase)|runtime]] either [[interpreter (computing)|interpreted]] by a JVM or compiled to machine code via [[Just-in-time compilation|just-in-time]] (JIT) compilation and run as a native application.
Line 39:
There are also a few instructions for a number of more specialized tasks such as exception throwing, synchronization, etc.
Many instructions have [[Opcode prefix|prefixes]] and/or suffixes referring to the types of operands they operate on.<ref name="jvm"/>{{rp|2.11.1}} These are as follows:
{| class="wikitable"
Line 77:
continue outer;
}
System.out.println
}
</syntaxhighlight>
Line 118:
Some projects provide Java assemblers to enable writing Java bytecode by hand. Assembly code may be also generated by machine, for example by a compiler targeting a [[Java virtual machine]]. Notable Java assemblers include:
*[[Jasmin (Java assembler)|Jasmin]], takes text descriptions for Java classes, written in a simple assembly-like syntax using Java virtual machine instruction set and generates a Java class file<ref>{{Cite web|url=https://jasmin.sourceforge.net/|title=Jasmin Home Page|website=jasmin.sourceforge.net|accessdate=2 June 2024}}</ref>
*Jamaica, a [[Macro (computer science)|macro]] [[assembly language]] for the [[Java virtual machine]]. Java syntax is used for class or interface definition. Method bodies are specified using bytecode instructions.<ref>{{Cite web|url=https://www.javaworld.com/article/2072355/core-java/learn-to-speak-jamaican.html|title=Jamaica: The Java virtual machine (JVM) macro assembler<!-- Bot generated title -->|archive-url=https://web.archive.org/web/20231114000632/https://www.infoworld.com/article/2072355/learn-to-speak-jamaican.html|archive-date=14 November 2023|work=JavaWorld |accessdate=2 June 2024 |last1=Huang |first1=James Jianbo }}</ref>
*Krakatau Bytecode Tools, currently contains three tools: a decompiler and disassembler for Java classfiles and an assembler to create classfiles.<ref>{{Cite web|url=https://github.com/Storyyeller/Krakatau|title=Storyyeller/Krakatau|date=1 June 2024|accessdate=2 June 2024|via=GitHub}}</ref>
*Lilac, an assembler and disassembler for the [[Java virtual machine]].<ref>{{Cite web|url=https://lilac.sourceforge.net/|title=Lilac - a Java assembler|website=lilac.sourceforge.net|accessdate=2 June 2024}}</ref>
Others have developed compilers, for different programming languages, to target the Java virtual machine, such as:
*[[ColdFusion Markup Language|ColdFusion]]
*[[JRuby]] and [[Jython]], two [[scripting language]]s based on [[Ruby (programming language)|Ruby]] and [[Python (programming language)|Python]]
*[[Groovy (programming language)|Apache Groovy]], optionally typed and dynamic general-purpose language, with static-typing and static compilation capabilities
Line 145:
The [[Java virtual machine]] provides some support for [[Type system#Dynamic typing|dynamically typed languages]]. Most of the extant JVM instruction set is [[Type system#Static typing|statically typed]] - in the sense that method calls have their signatures type-checked at [[compile time]], without a mechanism to defer this decision to [[Run time (program lifecycle phase)|run time]], or to choose the method dispatch by an alternative approach.<ref>{{cite web
| url=
| title=InvokeDynamic: Actually Useful?
| date=2007-01-03
|