List of Java bytecode instructions: Difference between revisions

Content deleted Content added
DayDun (talk | contribs)
m Changed addition to the more standard logical or as written in the specification
BattyBot (talk | contribs)
top: Fixed reference date error(s) (see CS1 errors: dates for details) and AWB general fixes
 
(17 intermediate revisions by 13 users not shown)
Line 1:
{{Short description|none}} <!-- This short description is INTENTIONALLY "none" - please see WP:SDNONE before you consider changing it! -->
{{Main|Java bytecode}}
 
This is a list of the instructions that make up the [[Java bytecode]], an abstract machine language that is ultimately executed by the [[Java virtual machine]].<ref>{{cite web|url=https://docs.oracle.com/javase/specs/jvms/se24/html/index.html |title=The Java® Virtual Machine Specification – Java SE 24 Edition |access-date=July 26, 2025}}</ref> The Java bytecode is generated from languages running on the [[Java Platform]], most notably the [[Java (programming language)|Java programming language]].
 
''Note that any referenced "value" refers to a 32-bit int as per the Java instruction set.''
Line 8 ⟶ 9:
|-
! scope="col" | Mnemonic
! scope="col" | Opcode<br>''(in [[hexadecimal|hex]])''
!Opcode (in binary)
! scope="col" | Other bytes<br>[count]: [operand labels]
Line 942 ⟶ 943:
|1011 1010
|4: indexbyte1, indexbyte2, 0, 0
|[arg1, [arg2, ...]] → result
|invokes a dynamic method and puts the result on the stack (might be void); the method is identified by method reference ''index'' in constant pool ({{mono|indexbyte1 &lt;&lt; 8 {{pipe}} indexbyte2}})
|-
Line 1,064 ⟶ 1,065:
|int xor
|-
|jsr{{ref |Deprecated|†}}
|jsr
|data-sort-value=168|a8
|1010 1000
Line 1,071 ⟶ 1,072:
|jump to subroutine at ''branchoffset'' (signed short constructed from unsigned bytes {{mono|branchbyte1 &lt;&lt; 8 {{pipe}} branchbyte2}}) and place the return address on the stack
|-
|jsr_w{{ref |Deprecated|†}}
|data-sort-value=201|c9
|1100 1001
Line 1,393 ⟶ 1,394:
|set static field to ''value'' in a class, where the field is identified by a field reference ''index'' in constant pool ({{mono|indexbyte1 &lt;&lt; 8 {{pipe}} indexbyte2}})
|-
|ret{{ref |Deprecated|†}}
|ret
|data-sort-value=169|a9
|1010 1001
Line 1,457 ⟶ 1,458:
|-
|}
{{Refbegin}}
{{note label|Deprecated|†||Deprecated in Java 7 (major class version 51).<ref>{{cite web|url=https://docs.oracle.com/javase/specs/jvms/se24/html/jvms-4.html#jvms-4.9.1 |title=Chapter 4. The class File Format 4.9.1. Static Constraints |access-date=July 26, 2025}}</ref> They will not appear in class files generated from a compiler newer than that.}}
{{Refend}}
 
== See also ==
*[[Jazelle]] DBX (Direct Bytecode eXecution), a feature that executes some Java bytecodes in hardware, on some ARM9 CPUs
*[[Common Intermediate Language]] (CIL), a similar bytecode specification that runs on the CLR of the .NET Framework
 
*[[C to Java Virtual Machine compilers]]
== References ==
{{reflist}}
 
== External links ==
*[httphttps://docs.oracle.com/javase/specs/jvms/se12se24/html/indexjvms-6.html Oracle'sThe Java Virtual Machine Specification – Java SE 12Instruction EditionSet]
*[https://docs.oracle.com/javase/specs/jvms/se12/html/jvms-6.html The Java Virtual Machine Instruction Set]
 
{{Java (Sun)}}