Java byte code

Source: Internet
Author: User
Tags array length goto instance method

Java byte code
    • Javap-c. class files can be bytecode-
    • Discussion https://www.zhihu.com/question/27831730

Stack and local variable operations
Press the constant into the stack's instruction
Aconst_null to press the null object reference into the stack
ICONST_M1 to press the int type constant-1 into the stack
Iconst_0 to press the int type constant 0 into the stack
iconst_1 the int type constant 1 into the stack
iconst_2 pushes the int type constant 2 into the stack
Iconst_3 presses the int type constant 3 into the stack
Iconst_4 presses the int type constant 4 into the stack
Iconst_5 Press the int type constant 5 into the stack
Lconst_0 to press the long type constant 0 into the stack
lconst_1 the long type constant 1 into the stack
Fconst_0 press the float type constant 0 into the stack
Fconst_1 Press the float type constant 1 into the stack
Dconst_0 to press the double type constant 0 into the stack
dconst_1 the double type constant 1 into the stack
Bipush Press a 8-bit signed integer into the stack
Sipush Presses a 16-bit signed integer into the stack
LDC presses an item in a constant pool into the stack
Ldc_w to push items in a constant pool into the stack (using a wide index)
Ldc2_w to press a long or double type item in a constant pool into the stack (using a wide index)
instruction to load values from local variables in the stack
iload to load an int type value from a local variable
lload load a long type value from a local variable
fload load a float type value from a local variable
Dload Load double type value from local variable
aload load reference type value from local variable (refernce)
iload_0 load int type value from local variable 0
iload_1 load int type value from local variable 1
iload _2 load int type value from local variable 2
iload_3 load int type value from local variable 3
lload_0 load long type value from local variable 0
lload_1 load long type value from local variable 1
lload_2 Load a long type value from local variable 2

Lload_3 Load a long type value from local variable 3
fload_0 load float type value from local variable 0
fload_1 load float type value from local variable 1
fload_2 load float type value from local variable 2
Fload_3 load Float type value from local variable 3
dload_0 load double type value from local variable 0
dload_1 load double type value from local variable 1
dload_2 Load double type value from local variable 2
dload_3 load double type value from local variable 3
Aload_0 load reference type value from local variable 0
aload_1 load reference type value from local variable 1
aload_2 Load reference type value from local variable 2
aload_3 load reference type value from local variable 3
iaload load int type value from array
laload load long type value from array
faload load float type value from array
Daload load a double type value from an array
Aaload load a reference type value from an array
baload load a byte type or a Boolean value from an array
caload load a char type value from an array
Saload loading a short type value from an array
instructions for storing values in the stack to local variables
Istore the value of the int type into the local variable
Lstore The Long value into the local variable
Fstore the float type value into the local variable
Dstore The value of a double type into a local variable
Astore the reference type or ReturnAddress type value into the local variable
Istore_0 the value of the int type into the local variable 0
Istore_1 Save int type value to local variable 1
istore_2 int type value to local variable 2

Istore_3 the value of type int to local variable 3
Lstore_0 a Long value into local variable 0
Lstore_1 save a Long value to local variable 1
lstore_2 a Long value into local variable 2
Lstore_3 a Long value into local variable 3
Fstore_0 The value of float type to local variable 0
Fstore_1 The value of float type to local variable 1
fstore_2 save float type value to local variable 2
Fstore_3 The value of float type to local variable 3
Dstore_0 the value of double type to local variable 0
Dstore_1 The value of double type to local variable 1
dstore_2 Save the value of double type to local variable 2
Dstore_3 the value of the double type to local variable 3
Astore_0 the reference type or ReturnAddress type value into the local variable 0
Astore_1 Save the reference type or ReturnAddress type value to local variable 1
astore_2 the reference type or ReturnAddress type value into the local variable 2
Astore_3 Saving a reference type or ReturnAddress type value to a local variable 3
Iastore the value of type int into an array
Lastore storing a Long value in an array
Fastore storing the value of type float in an array
Dastore the value of a double type into an array
Aastore the reference type value into the array
Bastore the byte type or Boolean value into the array
Castore in the array with the Char type value
Sastore the value of the short type into the array
Wide directive
Wide use additional bytes to extend the local variable index
Universal (no type) stack operation
NOP does nothing
Pop popup stack at the top of a word length
Pop2 Pop-up stack top two word-length content
dup the top of the copy stack is a word length
dup_x1 the top of the copy stack with a word length, and then presses the contents of the copied content and the two words that originally popped into the stack

Dup_x2 A word length at the top of the copy stack, and then presses the contents of the copied content and the three words that originally popped up into the stack
dup2 the top of the copy stack with two word lengths
Dup2_x1 the top of the copy stack, two words in length, Then the copy content and the original pop-up content of three words into the stack
dup2_x2 two words on top of the copy stack, and then the contents of the copy and the original four words popped into the stack
swap stack top two word length content
type conversion
I2L Converts data of type int to type long
i2f converts data of type int to float type
i2d converts data of type int to double type
L2i converts Long data to int type
L2F Converts a long type of data to float type
l2d converts a long type of data to a double type
f2i converts data of type float to int type
F2L converts data of type float to type long
f2d Convert data of type float to double type
d2i converts data of type double to int type
D2L converts data of type double to type long
D2F converts data of type double to float type
I2B converts data of type int to byte type
I²c converts data of type int to char type
I2S converts data of type int to short type
integer operation
Iadd performs an addition of type int
Ladd Performs a long type of addition
Isub performs a subtraction of type int
Lsub performs a long type of subtraction
Imul performs a multiplication of type int
Lmul performs a long multiplication
Idiv performs a division of type int
Ldiv performs a long type of division

Irem computes the remainder of the INT type division
Lrem computes the remainder of the long type division
Ineg takes an inverse action on an int type value
Lneg to take a long type value back
Iinc Add a constant value to a local variable of type int
Logical operation
Shift Operation
ISHL to perform a left shift operation of type int
LSHL to perform a long shift to the left,
Ishr to perform a right shift of type int
LSHR performs a long right shift operation
Iushr performs a right-shift operation of type int
Lushr performs a long-type right-shift operation
Bitwise-Boolean operation
Iand to the Int type value "logical and" Operation
Land "Logical AND" operation of the long type value
IOR "logical OR" operation of the value of type int
Lor "logical OR" operation on a long type value
Ixor "Logical xor" of the value of type int
Lxor Perform a "logical XOR" operation on a Long value
floating-point arithmetic
Fadd performs the addition of the float type
Dadd performs the addition of a double type
Fsub performs a subtraction of type float
Dsub performs a subtraction of type double
Fmul performs a multiplication of type float
Dmul performs a multiplication of type double
Fdiv performs a division of type float
Ddiv performs a division of type double
Frem computes the remainder of the float type Division
Drem computes the remainder of a double type division
Fneg the value of a float type to inverse
Dneg The numeric value of a double type against the

Object and Array
Object action Directive
new creates a new object
Checkcast determines whether the object is a given type
GetField gets a field from an object
Putfield set the value of a field in an object
Getstatic Get a static field from a class
Putstatic the value of a static field in a class
instanceof determine whether the object is a given type
Array action Directive
NewArray assign a new array of data member types to essentially data types
Anewarray assign data member type to a new array of reference type
Arraylength get array length
Multianewarray assign new multidimensional array
Control flow
Conditional branch instruction
Ifeq if equals 0, jumps
Ifne if not equal to 0, then jump
Iflt if less than 0, then jump
Ifge if greater than or equal to 0, then jump
IFGT if greater than 0, then jump
Ifle if less than or equal to 0, then jump
If_icmpcq If two int values are equal, jump
If_icmpne if two int values are not equal, jump
if_icmplt if an int type value is less than the value of another int type, the jump
If_icmpge If an int type value is greater than or equal to another int type value, jump
if_icmpgt if an int type value is greater than another int type value, jump
if_icmple if an int type value is less than or equal to another int type value, Jump
Ifnull If equal to null, jump
Ifnonnull if not equal to NULL, jump
If_acmpeq If two objects reference equal, jump
IF_ACMPNC If two object references are not equal, jump
Compare directive
lcmp Compare Long Type value
Fcmpl compare float type value (return-1 when Nan is encountered)
Fcmpg compares float type value (returns 1 when Nan is encountered)
Dcmpl Compares a double type value (returns 1 when Nan is encountered)
Dcmpg compares a double type value (returns 1 when a Nan is encountered)

Unconditional Transfer Instructions
Goto Unconditional Jump
Goto_w unconditional jump (wide index)
Table Jump Instruction
Tableswitch access the Jump table by index and jump
Lookupswitch access to the jump table via key-value matching and perform a jump operation
Abnormal
Athrow throws an exception or error
Finally clause
JSR Jump to subroutine
Jsr_w jump to subroutine (wide index)
RCT returns from subroutine
Method call and return
Method invocation Directives
The Invokcvirtual runtime invokes an instance method according to the class of the object
Invokespecial invoking instance methods based on compile-time type
Invokestatic call Class (Static) method
Invokcinterface Calling interface methods
Method return Instruction
Ireturn returning data of type int from a method
Lreturn returning a long type of data from a method
Freturn returning data of type float from a method
Dreturn returning a double type of data from a method
Areturn returning data from a method from a reference type
Return returned from the method with a return value of void
Thread synchronization
Montiorenter Enter and get Object monitor
Monitorexit releasing and exiting Object monitor

JVM instruction Mnemonic
Variable-to-operand stack: iload,iload_

Create a class-by-fact: New
Create a new array: Newarray,anewarray,multianwarray
Accessing the domain and class instance domain of a class: Getfield,putfield,getstatic,putstatic
Loading data into the operand stack: baload,caload,saload,iaload,laload,faload,daload,aaload
Save from operand stack to array: Bastore,castore,sastore,iastore,lastore,fastore,dastore,aastore
Get array Length: arraylength
To check a similar instance or array property: Instanceof,checkcast
Operand Stack Management: Pop,pop2,dup,dup2,dup_xl,dup2_xl,dup_x2,dup2_x2,swap
Conditional transfer: Ifeq,iflt,ifle,ifne,ifgt,ifge,ifnull,ifnonnull,if_icmpeq,if_icmpene,
? If_icmplt,if_icmpgt,if_icmple,if_icmpge,if_acmpeq,if_acmpne,lcmp,fcmpl
? Fcmpg,dcmpl,dcmpg
Compound Conditional transfer: Tableswitch,lookupswitch
Unconditional transfer: Goto,goto_w,jsr,jsr_w,ret
How to implement a scheduled object: invokevirtual
Call the method implemented by the interface: Invokeinterface
Call an instance method that requires special handling: invokespecial
Call a static method in a named class: Invokestatic
method returns: Ireturn,lreturn,freturn,dreturn,areturn,return
Exception: Athrow
The implementation of the FINALLY keyword uses: jsr,jsr_w,ret

Java byte code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.