Stack and local variable operations

An instruction to push a constant on the stack

Aconst_null pushes the null object reference to the stack iconst_m1 pushes the int constant -1 to the stack iconst_0 pushes the int constant 0 to the stack iconst_1 pushes the int constant 1 to the stack of operands iconst_2 pushes the int constant 2 to the stack Iconst_3 pushes the int constant 3 iconst_4 pushes the int constant 4 iconst_5 pushes the int constant 5 lCONST_0 pushes the long constant 0 lconst_1 pushes the long constant 1 fconst_0 Push the float constant 0, fconst_1 push the float constant 1, dconst_0 push the double constant 0, dconst_1 push the double constant 1, bipush an 8-bit signed integer, sipush Push a 16-bit signed integer LDC push an item from the constant pool LDc_w push an item from the constant pool ldc2_w Push an item of type long or type double from the constant pool ldc2_w Push an item of type long or type double from the constant pool

An instruction to load a value from a local variable on the stack

Iload loads an int from a local variable lload loads a long from a local variable fload loads a float from a local variable dload loads a double from a local variable aload loads a reference from a local variable Iload_0 loads an int from local variable 0. Iload_1 loads an int from local variable 1. Iload_2 loads an int from local variable 2 Lload_1 loads long values from local variable 1. Lload_2 loads long values from local variable 2. Lload_3 loads long values from local variable 3. Fload_0 Loads float values from local variable 0 Fload_2 loads a float value from local variable 1 fload_3 loads a float value from local variable 3 dload_0 Loads a double value from local variable 0 dload_1 Dload_2 loads a double from local variable 2. Dload_3 loads a double from local variable 3. Aload_0 loads a reference from local variable 0 Aload_2 loads a reference type from local variable 2, aload_3 loads a reference type from local variable 3, iaload loads an int from an array, laload loads a long from an array, faload loads a float value from an array, daload Aaload loads a reference value from an array. Baload loads a byte or Boolean value from an array. Caload loads a char value from an array

An instruction to store a value from the stack into a local variable

Istore stores int values in the local variable lstore stores long values in the local variable fstore stores float values in the local variable dstore stores double values in the local variable astore We’ll store the reference type or the returnAddress type in the local variable istore_0 we’ll store the int value in the local variable 0, istore_1 we’ll store the int value in the local variable 1, istore_2 we’ll store the int value in the local variable 2, istore_3 Store the int value in the local variable 3. Lstore_0 Stores the long value in the local variable 0. Lstore_1 stores the long value in the local variable 1 Fstore_0 Stores the float value in local variable 0. Fstore_1 stores the float value in local variable 1. Fstore_2 stores the float value in local variable 2. Fstore_3 stores the float value in local variable 3 Store the double in the local variable 0 dstore_1 store the double in the local variable 1 dstore_2 store the double in the local variable 2 dstore_3 store the double in the local variable 3 astore_0 Store the value of the reference type or returnAddress type in the local variable 0 astore_1 store the value of the reference type or returnAddress type in the local variable 1 astore_2 store the value of the reference type or returnAddress type in the local variable 2 ASTore_3 Store the reference or returnAddress value in the local variable 3. Iastore stores the int value in the array. Lastore stores the long value in the array Aastore stores reference values in arrays Bastore stores byte or Boolean values in arrays Castore stores char values in arrays Sastore stores short values in arrays

Wide instruction

Wide uses additional bytes to extend the local variable index

Generic (untyped) stack operations

Nop does nothing pop pops the top of the stack one word long pop2 the top of the stack two words long dUP copies the top of the stack dup_X1 copies the top of the stack one word long And then I’m going to push the copy onto the stack, and I’m going to push the copy onto the stack, and I’m going to push the copy onto the stack, and I’m going to push the copy onto the stack, and I’m going to push the copy onto the stack, and I’m going to push the copy onto the stack, and I’m going to push the copy onto the stack, and I’m going to push the copy onto the stack, and I’m going to push the copy onto the stack, and I’m going to push the copy onto the stack, and I’m going to push the copy onto the stack, And then push the copy and the three words that popped up on the stack dup2_x2 copy the top two words of the stack, I2l converts an int to a long. I2f converts an int to a float. I2d converts an int to a double L2i converts long data to int l2f converts long data to float l2D converts long data to double f2i converts float data to int f2l Convert float to long f2d convert float to double d2i convert double to int d2L convert double to long d2f I2b converts int to byte i2c converts int to char i2s converts int to short

Integer arithmetic

Iadd adds ints ladd adds longs Isub subtracts ints Lsub subtracts longs IMul multiplies ints lMUl multiplies longs idiv divides ints ldiv Perform the long division irem calculates the remainder of the int division Lrem calculates the remainder of the long division ineg inverts an int lNEg inverts a long iINC adds a constant value to a local variable of int

Logical operations

Shift operation

Ishl performs a left shift of an int. LSHL performs a left shift of a long. Ishr performs a right shift of an int. LSHR performs a right shift of a long Performs a logical shift to the right of type long

Bitwise Boolean operation

Iand Performs the “and” operation on an int. Land Performs the “and” operation on a long. Ior performs the “or” operation on an int Perform the logical XOR operation on a value of the long type

Floating point arithmetic

Fadd performs the addition of float, dadd performs the addition of double, fsub performs the subtraction of float, dsub performs the subtraction of double, fMUl performs the multiplication of float, dMUL performs the multiplication of double, fdiv Perform a division of type float ddiv performs a division of type double Frem evaluates the remainder of a division of type float drem evaluates the remainder of a division of type double fneg inverts a number of type float dneg inverts a number of type double

Objects and Arrays

Object operation instruction

New Creates a new object checkCast Determines that the object is of the given type getField Gets the fields from the object putField sets the values of the fields in the object getStatic gets the static fields from the class putStatic sets the values of the static fields in the class Instanceof determines whether the object is of the given type

Array operation instruction

Newarray allocates anewarray of data member type anewarray for the basic data type anewarray allocates anewarray of data member type arraylength for the reference type multianewarray allocates anew multidimensional array

The control flow

Conditional branching instruction

If ifeq is equal to 0, go to ifne. If iFLT is less than 0, go to ifge. If ifge is greater than or equal to 0. If_icmpne if two ints are not equal, if_ICmplt if one int is less than the other int, if_ICMPge If one int is greater than or equal to another int, If_icmpgt if an int is greater than or equal to another int, if_icmple if an int is less than or equal to another int, ifnull ifnull, If the references are not equal to NULL, go to if_ACmPEq. If the references are equal to if_ACMPNC. If the references are not equal, go to IF_ACMPNC

More instructions

LCMP compares a long value FCMPL compares a float value (returns -1 when NaN is encountered) FCMPG compares a float value (returns 1 when NaN is encountered) DCMPL compares a double value (when NaN is encountered, Return -1) DCMPG compares a value of type double (returns 1 when NaN is encountered)

Unconditional transfer instruction

Goto_w Unconditional jump (wide index)

Table jump instruction

Tableswitch Uses indexes to access a jump table and performs a jump lookUpSwitch Uses key values to access a jump table and performs a jump operation

abnormal

Athrow throws an exception or error Finally clause JSR jumps to subroutine JSR_W jumps to subroutine (wide index) RCT returns from subroutine

Method calls and returns

Method call instruction

The invokCVirtual runtime invokes instance methods based on the class of the object. Invokespecial invokes instance methods based on the compile time type. Invokestatic invokes class (static) methods

Method return instruction

Ireturn returns an int from a method, lreturn returns a long from a method, freturn returns a float from a method, dreturn returns a double from a method, areturn returns a reference from a method Return returns from a method with a value of void

Thread synchronization

Montiorenter enters and gets the object monitor Monitorexit releases and exits the object monitor

JVM instruction mnemonic

Variables to operand stack: iload,iload_,lload,lload_,fload,fload_,dload,dload_,aload,aload_

Operands stack to variables:

istore,istore_,lstore,lstore_,fstore,fstore_,dstore,dstor_,astore,astore_

Constant to operand stack:

Bipush,sipush, LDC,ldc_w,ldc2_w,aconst_null, iconST_ml,iconst_, lCONST_,fconst_,dconst_ + : iadd,ladd,fadd,dadd minus: Isub,lsub,fsub, dSUB multiply: IMul, LMUL, FMUL, dMUL divide: idiv,ldiv,fdiv,ddiv Remainder: Irem, Lrem,frem, DREm Negative: INEg, LNEg, FNEg, DNEG shift: Ishl, LSHR iushr, LSHL LSHR, lushr bitwise or: the ior, lor the bitwise and: iand, land bitwise xor: ixor, lxor type conversion: I2l, i2f i2d, l2f, l2d, f2d i2b numerical transformation (relax), i2c, i2s, l2i, f2i, f2l, d2i, d2l, d2f (narrowing conversion) then create real classes: new to create a new array: Newarray anewarray, multianwarray access class and class instance domains:, getfield, putfield getstatic, putstatic data is loaded into the operand stack: Baload, caload saload, iaload laload, faload, daload, aaload from operand stack memory stored in the array: Bastore, castore sastore, iastore lastore, fastore and dastore, aastore for array length: arraylength check similar instance or array properties: Instanceof,checkcast operand stack management: pop,pop2,dup,dup2,dup_xl,dup2_xl,dup_x2,dup2_x2,swap 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 Tableswitch, lookupSwitch Unconditional transfer: GOto,goto_w, JSR, jSR_W, RET Actual method of the schedule object: invokevirtual Calls a method implemented by the interface: Invokeinterface invokes instance methods that require special handling: Invokespecial invokes static methods in named classes: invokeStatic methods return: Ireturn lreturn, freturn dreturn, areturn, abnormal return: athrow finally the realization of the keywords used: JSR, jsr_w, ret