Content deleted Content added
Added clauses on the d/fcmpl/g instructions to indicate the difference between them |
→top: Fixed reference date error(s) (see CS1 errors: dates for details) and AWB general fixes |
||
(18 intermediate revisions by 14 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>
!Opcode (in binary)
! scope="col" | Other bytes<br>[count]: [operand labels]
Line 75 ⟶ 76:
|2: indexbyte1, indexbyte2
|count → arrayref
|create a new array of references of length ''count'' and component type identified by the class reference ''index'' ({{mono|indexbyte1 << 8
|-
|areturn
Line 180 ⟶ 181:
|2: indexbyte1, indexbyte2
|objectref → objectref
|checks whether an ''objectref'' is of a certain type, the class reference of which is in the constant pool at ''index'' ({{mono|indexbyte1 << 8
|-
|d2f
Line 600 ⟶ 601:
|2: indexbyte1, indexbyte2
|objectref → value
|get a field ''value'' of an object ''objectref'', where the field is identified by field reference in the constant pool ''index'' ({{mono|indexbyte1 << 8
|-
|getstatic
Line 607 ⟶ 608:
|2: indexbyte1, indexbyte2
|→ value
|get a static field ''value'' of a class, where the field is identified by field reference in the constant pool ''index'' ({{mono|indexbyte1 << 8
|-
|goto
Line 614 ⟶ 615:
|2: branchbyte1, branchbyte2
|[no change]
|goes to another instruction at ''branchoffset'' (signed short constructed from unsigned bytes {{mono|branchbyte1 << 8
|-
|goto_w
Line 621 ⟶ 622:
|4: branchbyte1, branchbyte2, branchbyte3, branchbyte4
|[no change]
|goes to another instruction at ''branchoffset'' (signed int constructed from unsigned bytes {{mono|branchbyte1 << 24
|-
|i2b
Line 754 ⟶ 755:
|2: branchbyte1, branchbyte2
|value1, value2 →
|if references are equal, branch to instruction at ''branchoffset'' (signed short constructed from unsigned bytes {{mono|branchbyte1 << 8
|-
|if_acmpne
Line 761 ⟶ 762:
|2: branchbyte1, branchbyte2
|value1, value2 →
|if references are not equal, branch to instruction at ''branchoffset'' (signed short constructed from unsigned bytes {{mono|branchbyte1 << 8
|-
|if_icmpeq
Line 768 ⟶ 769:
|2: branchbyte1, branchbyte2
|value1, value2 →
|if ints are equal, branch to instruction at ''branchoffset'' (signed short constructed from unsigned bytes {{mono|branchbyte1 << 8
|-
|if_icmpge
Line 775 ⟶ 776:
|2: branchbyte1, branchbyte2
|value1, value2 →
|if ''value1'' is greater than or equal to ''value2'', branch to instruction at ''branchoffset'' (signed short constructed from unsigned bytes {{mono|branchbyte1 << 8
|-
|if_icmpgt
Line 782 ⟶ 783:
|2: branchbyte1, branchbyte2
|value1, value2 →
|if ''value1'' is greater than ''value2'', branch to instruction at ''branchoffset'' (signed short constructed from unsigned bytes {{mono|branchbyte1 << 8
|-
|if_icmple
Line 789 ⟶ 790:
|2: branchbyte1, branchbyte2
|value1, value2 →
|if ''value1'' is less than or equal to ''value2'', branch to instruction at ''branchoffset'' (signed short constructed from unsigned bytes {{mono|branchbyte1 << 8
|-
|if_icmplt
Line 796 ⟶ 797:
|2: branchbyte1, branchbyte2
|value1, value2 →
|if ''value1'' is less than ''value2'', branch to instruction at ''branchoffset'' (signed short constructed from unsigned bytes {{mono|branchbyte1 << 8
|-
|if_icmpne
Line 803 ⟶ 804:
|2: branchbyte1, branchbyte2
|value1, value2 →
|if ints are not equal, branch to instruction at ''branchoffset'' (signed short constructed from unsigned bytes {{mono|branchbyte1 << 8
|-
|ifeq
Line 810 ⟶ 811:
|2: branchbyte1, branchbyte2
|value →
|if ''value'' is 0, branch to instruction at ''branchoffset'' (signed short constructed from unsigned bytes {{mono|branchbyte1 << 8
|-
|ifge
Line 817 ⟶ 818:
|2: branchbyte1, branchbyte2
|value →
|if ''value'' is greater than or equal to 0, branch to instruction at ''branchoffset'' (signed short constructed from unsigned bytes {{mono|branchbyte1 << 8
|-
|ifgt
Line 824 ⟶ 825:
|2: branchbyte1, branchbyte2
|value →
|if ''value'' is greater than 0, branch to instruction at ''branchoffset'' (signed short constructed from unsigned bytes {{mono|branchbyte1 << 8
|-
|ifle
Line 831 ⟶ 832:
|2: branchbyte1, branchbyte2
|value →
|if ''value'' is less than or equal to 0, branch to instruction at ''branchoffset'' (signed short constructed from unsigned bytes {{mono|branchbyte1 << 8
|-
|iflt
Line 838 ⟶ 839:
|2: branchbyte1, branchbyte2
|value →
|if ''value'' is less than 0, branch to instruction at ''branchoffset'' (signed short constructed from unsigned bytes {{mono|branchbyte1 << 8
|-
|ifne
Line 845 ⟶ 846:
|2: branchbyte1, branchbyte2
|value →
|if ''value'' is not 0, branch to instruction at ''branchoffset'' (signed short constructed from unsigned bytes {{mono|branchbyte1 << 8
|-
|ifnonnull
Line 852 ⟶ 853:
|2: branchbyte1, branchbyte2
|value →
|if ''value'' is not null, branch to instruction at ''branchoffset'' (signed short constructed from unsigned bytes {{mono|branchbyte1 << 8
|-
|ifnull
Line 859 ⟶ 860:
|2: branchbyte1, branchbyte2
|value →
|if ''value'' is null, branch to instruction at ''branchoffset'' (signed short constructed from unsigned bytes {{mono|branchbyte1 << 8
|-
|iinc
Line 936 ⟶ 937:
|2: indexbyte1, indexbyte2
|objectref → result
|determines if an object ''objectref'' is of a given type, identified by class reference ''index'' in constant pool ({{mono|indexbyte1 << 8
|-
|invokedynamic
Line 942 ⟶ 943:
|1011 1010
|4: indexbyte1, indexbyte2, 0, 0
|[arg1,
|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 << 8
|-
|invokeinterface
Line 950 ⟶ 951:
|4: indexbyte1, indexbyte2, count, 0
|objectref, [arg1, arg2, ...] → result
|invokes an interface method on object ''objectref'' and puts the result on the stack (might be void); the interface method is identified by method reference ''index'' in constant pool ({{mono|indexbyte1 << 8
|-
|invokespecial
Line 957 ⟶ 958:
|2: indexbyte1, indexbyte2
|objectref, [arg1, arg2, ...] → result
|invoke instance method on object ''objectref'' and puts the result on the stack (might be void); the method is identified by method reference ''index'' in constant pool ({{mono|indexbyte1 << 8
|-
|invokestatic
Line 964 ⟶ 965:
|2: indexbyte1, indexbyte2
|[arg1, arg2, ...] → result
|invoke a static method and puts the result on the stack (might be void); the method is identified by method reference ''index'' in constant pool ({{mono|indexbyte1 << 8
|-
|invokevirtual
Line 971 ⟶ 972:
|2: indexbyte1, indexbyte2
|objectref, [arg1, arg2, ...] → result
|invoke virtual method on object ''objectref'' and puts the result on the stack (might be void); the method is identified by method reference ''index'' in constant pool ({{mono|indexbyte1 << 8
|-
|ior
Line 1,064 ⟶ 1,065:
|int xor
|-
|jsr{{ref |Deprecated|†}}
|data-sort-value=168|a8
|1010 1000
|2: branchbyte1, branchbyte2
|→ address
|jump to subroutine at ''branchoffset'' (signed short constructed from unsigned bytes {{mono|branchbyte1 << 8
|-
|jsr_w{{ref |Deprecated|†}}
|data-sort-value=201|c9
|1100 1001
|4: branchbyte1, branchbyte2, branchbyte3, branchbyte4
|→ address
|jump to subroutine at ''branchoffset'' (signed int constructed from unsigned bytes {{mono|branchbyte1 << 24
|-
|l2d
Line 1,160 ⟶ 1,161:
|2: indexbyte1, indexbyte2
|→ value
|push a constant ''#index'' from a constant pool (String, int, float, Class, java.lang.invoke.MethodType, java.lang.invoke.MethodHandle, or a dynamically-computed constant) onto the stack (wide ''index'' is constructed as {{mono|indexbyte1 << 8
|-
|ldc2_w
Line 1,167 ⟶ 1,168:
|2: indexbyte1, indexbyte2
|→ value
|push a constant ''#index'' from a constant pool (double, long, or a dynamically-computed constant) onto the stack (wide ''index'' is constructed as {{mono|indexbyte1 << 8
|-
|ldiv
Line 1,342 ⟶ 1,343:
|3: indexbyte1, indexbyte2, dimensions
|count1, [count2,...] → arrayref
|create a new array of ''dimensions'' dimensions of type identified by class reference in constant pool ''index'' ({{mono|indexbyte1 << 8
|-
|new
Line 1,349 ⟶ 1,350:
|2: indexbyte1, indexbyte2
|→ objectref
|create new object of type identified by class reference in constant pool ''index'' ({{mono|indexbyte1 << 8
|-
|newarray
Line 1,384 ⟶ 1,385:
|2: indexbyte1, indexbyte2
|objectref, value →
|set field to ''value'' in an object ''objectref'', where the field is identified by a field reference ''index'' in constant pool ({{mono|indexbyte1 << 8
|-
|putstatic
Line 1,391 ⟶ 1,392:
|2: indexbyte1, indexbyte2
|value →
|set static field to ''value'' in a class, where the field is identified by a field reference ''index'' in constant pool ({{mono|indexbyte1 << 8
|-
|ret{{ref |Deprecated|†}}
|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
== References ==
{{reflist}}
== External links ==
*[
{{Java (Sun)}}
|