JVM instruction manual

Time:2021-3-10

Stack and local variable operation

The instruction to push a constant onto the stack

aconst_ Null willnullObject reference is pushed onto the stack-1Push into stack0Push into stack1Push into stack2Push into stack3Push into stack4Push into stack5Push into stack0Push into stack1Push into stack0Push into stack1Push into stack0Push into stack1Push into stack8Bit signed integers are pushed onto the stack16Bit signed integers are pushed onto the stack

An instruction that loads values from local variables in the stack

Iload loads int type values from local variables0Loading int type values in1Loading int type values in2Loading int type values in3Loading int type values in0Load long type values in1Load long type values in2Load long type values in3Load long type values in0Loading float type values in1Loading float type values in2Loading float type values in3Loading float type values in0Load double type values in1Load double type values in2Load double type values in3Load double type values in0Load reference type values in1Load reference type values in2Load reference type values in3Load reference type values in

An instruction that stores a stack value in a local variable

IStore stores int type values into local variables0istore_ 1 store int type values into local variables1istore_ 2. Store int type values into local variables2istore_ 3 store int type values into local variables3lstore_ 0 stores a long type value into a local variable0lstore_ 1 store the long type value into a local variable1lstore_ 2 store the long type value into a local variable2lstore_ 3 store the long type value into the local variable3fstore_ 0 stores a float type value into a local variable0fstore_ 1 store the float type value into a local variable1fstore_ 2 store float type values in local variables2fstore_ 3 store the float type value in the local variable3dstore_ 0 stores a double type value into a local variable0dstore_ 1 store the value of double type into a local variable1dstore_ 2 store the value of double type into local variable2dstore_ 3 store the value of double type into local variable3astore_ 0 stores the reference type or returnaddress type value in a local variable0astore_ 1 store the reference type or returnaddress type value into a local variable1astore_ 2 store the reference type or returnaddress type value into a local variable2astore_ 3 store the reference type or returnaddress type value into a local variable3Iastore stores int type values into an array

Generic (typeless) stack operation

NOP does nothing

Type conversion

I2L converts data of type int into data of type long

Integer operation

Iadd performs int type addition

Logic operation

Shift operation

Ishl performs a shift left operation of type int

Bitwise Boolean operation

Iand performs a logical and operation on an int type value

Floating point operation

FADD performs addition of type float

Objects and arrays

Object operation instruction

newCreate a new objectinstanceofDetermines whether the object is of the given type

Array operation instruction

Newarray allocates the data member type to a new array of basic data types

control flow

Conditional branch instruction

If ifeq is equal to0, then jump0, then jump0, then jump0, then jump0, then jump0, then jumpnull, then jumpnull, then jump

Comparison instruction

Lcmp compares long type valuesNaNReturn to-1NaNReturn to1NaNReturn to-1NaNReturn to1

Unconditional transfer instruction

Goto jump unconditionally

Table jump instruction

The table switch accesses the jump table through the index and jumps

abnormal

Athrow throws an exception or error

Method call and return

Method call instruction

The invokcvirtual runtime calls instance methods according to the class of the object

Method returns the instruction

Ireturn returns data of type int from a methodreturnReturns from a method with the return value ofvoid

Thread synchronization

Montioranter enters and gets the object monitor

JVM instruction mnemonics

Variable to operand stack: Iload,iload_,lload,lload_,fload,fload_,dload,dload_,aload,aload_,istore_,lstore,lstore_,fstore,fstore_,dstore,dstor_,astore,astore_,sipush,ldc,ldc_w,ldc2_w,aconst_null,iconst_ml,iconst_,lconst_,fconst_,dconst_,ladd,fadd,dadd,lsub,fsub,dsub,lmul,fmul,dmul,ldiv,fdiv,ddiv,lrem,frem,drem,lneg,fneg,dneg,lshr,iushr,lshl,lshr,lushr,lor,land,lxor,i2f,i2d,l2f,l2d,f2d(Relax numerical conversion)
i2b,i2c,i2s,l2i,f2i,f2l,d2i,d2l,d2f(Narrowing numerical conversion)To create a class instance:newCreate a new array: newarray,anewarray,multianwarray,putfield,getstatic,putstatic,caload,saload,iaload,laload,faload,daload,aaload,castore,sastore,iastore,lastore,fastore,dastore,aastoreinstanceof,checkcast,pop2,dup,dup2,dup_xl,dup2_xl,dup_x2,dup2_x2,swap,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,lookupswitch,goto_w,jsr,jsr_w,ret,lreturn,freturn,dreturn,areturn,returnException: athrow,jsr_w,ret

JVM

This work adoptsCC agreementReprint must indicate the author and the link of this article