Class MVarInsn
- java.lang.Object
-
- xyz.cofe.trambda.bc.mth.MAbstractBC
-
- xyz.cofe.trambda.bc.mth.MVarInsn
-
- All Implemented Interfaces:
Serializable,xyz.cofe.collection.ImTree<ByteCode>,xyz.cofe.collection.ImTreeWalk<ByteCode>,ByteCode,MethodByteCode,MethodWriter
public class MVarInsn extends MAbstractBC implements ByteCode, MethodWriter
the opcode of the local variable instruction to be visited. This opcode is either ILOAD, LLOAD, FLOAD, DLOAD, ALOAD, ISTORE, LSTORE, FSTORE, DSTORE, ASTORE or RET.
iload
OpCode.ILOADOperation
Load int from local variableFormat
iload index
Forms
iload = 21 (0x15)Operand Stack
... →
..., value
Description
The index is an unsigned byte that must be an index into the local variable array of the current frame (§2.6). The local variable at index must contain an int. The value of the local variable at index is pushed onto the operand stack.Notes
The iload opcode can be used in conjunction with the wide instruction (§wide) to access a local variable using a two-byte unsigned index.
lloadOperation
OpCode.LLOADLoad long from local variableFormat
lload index
Forms
lload = 22 (0x16)Operand Stack
... → ..., value
Description
The index is an unsigned byte. Both index and index+1 must be indices into the local variable array of the current frame (§2.6). The local variable at index must contain a long. The value of the local variable at index is pushed onto the operand stack.Notes
The lload opcode can be used in conjunction with the wide instruction (§wide) to access a local variable using a two-byte unsigned index.
floadOpCode.FLOADOperation
Load float from local variableFormat
fload index
Forms
fload = 23 (0x17)Operand Stack
... → ..., value
Description
The index is an unsigned byte that must be an index into the local variable array of the current frame (§2.6). The local variable at index must contain a float. The value of the local variable at index is pushed onto the operand stack.Notes
The fload opcode can be used in conjunction with the wide instruction (§wide) to access a local variable using a two-byte unsigned index.
fload_<n>Operation
Load float from local variableFormat
fload_<n>Forms
fload_0 = 34 (0x22) fload_1 = 35 (0x23) fload_2 = 36 (0x24) fload_3 = 37 (0x25)
Operand Stack
... → ..., value
Description
The <n> must be an index into the local variable array of the current frame (§2.6). The local variable at <n> must contain a float. The value of the local variable at <n> is pushed onto the operand stack.Notes
Each of the fload_<n> instructions is the same as fload with an index of <n>, except that the operand <n> is implicit.
dloadOpCode.DLOADOperation
Load double from local variableFormat
dload index
Forms
dload = 24 (0x18)Operand Stack
... → ..., value
Description
The index is an unsigned byte. Both index and index+1 must be indices into the local variable array of the current frame (§2.6). The local variable at index must contain a double. The value of the local variable at index is pushed onto the operand stack.Notes
The dload opcode can be used in conjunction with the wide instruction (§wide) to access a local variable using a two-byte unsigned index.
dload_<n>Operation
Load double from local variableFormat
dload_<n>Forms
dload_0 = 38 (0x26) dload_1 = 39 (0x27) dload_2 = 40 (0x28) dload_3 = 41 (0x29)
Operand Stack
... → ..., value
Description
Both <n> and <n>+1 must be indices into the local variable array of the current frame (§2.6). The local variable at <n> must contain a double. The value of the local variable at <n> is pushed onto the operand stack.Notes
Each of the dload_<n> instructions is the same as dload with an index of <n>, except that the operand <n> is implicit.
aloadOpCode.ALOADOperation
Load reference from local variableFormat
aload index
Forms
aload = 25 (0x19)Operand Stack
... → ..., objectref
Description
The index is an unsigned byte that must be an index into the local variable array of the current frame (§2.6). The local variable at index must contain a reference. The objectref in the local variable at index is pushed onto the operand stack.Notes
The aload instruction cannot be used to load a value of type returnAddress from a local variable onto the operand stack. This asymmetry with the astore instruction (§astore) is intentional.The aload opcode can be used in conjunction with the wide instruction (§wide) to access a local variable using a two-byte unsigned index.
aload_<n>Operation
Load reference from local variableFormat
aload_<n>Forms
aload_0 = 42 (0x2a) aload_1 = 43 (0x2b) aload_2 = 44 (0x2c) aload_3 = 45 (0x2d)
Operand Stack
... → ..., objectref
Description
The <n> must be an index into the local variable array of the current frame (§2.6). The local variable at <n> must contain a reference. The objectref in the local variable at <n> is pushed onto the operand stack.Notes
An aload_<n> instruction cannot be used to load a value of type returnAddress from a local variable onto the operand stack. This asymmetry with the corresponding astore_<n> instruction (§astore_<n>) is intentional.Each of the aload_<n> instructions is the same as aload with an index of <n>, except that the operand <n> is implicit.
istoreOpCode.ISTOREOperation
Store int into local variableFormat
istore index
Forms
istore = 54 (0x36)Operand Stack
..., value → ...
Description
The index is an unsigned byte that must be an index into the local variable array of the current frame (§2.6). The value on the top of the operand stack must be of type int. It is popped from the operand stack, and the value of the local variable at index is set to value. NotesThe istore opcode can be used in conjunction with the wide instruction (§wide) to access a local variable using a two-byte unsigned index.
istore_<n>Operation
Store int into local variableFormat
istore_<n>Forms
istore_0 = 59 (0x3b) istore_1 = 60 (0x3c) istore_2 = 61 (0x3d) istore_3 = 62 (0x3e)
Operand Stack
..., value → ...
Description
The <n> must be an index into the local variable array of the current frame (§2.6). The value on the top of the operand stack must be of type int. It is popped from the operand stack, and the value of the local variable at <n> is set to value.Notes
Each of the istore_<n> instructions is the same as istore with an index of <n>, except that the operand <n> is implicit.
lstoreOpCode.LSTOREOperation
Store long into local variableFormat
lstore index
Forms
lstore = 55 (0x37)Operand Stack
..., value → ...
Description
The index is an unsigned byte. Both index and index+1 must be indices into the local variable array of the current frame (§2.6). The value on the top of the operand stack must be of type long. It is popped from the operand stack, and the local variables at index and index+1 are set to value.Notes
The lstore opcode can be used in conjunction with the wide instruction (§wide) to access a local variable using a two-byte unsigned index.
lstore_<n>Operation
Store long into local variableFormat
lstore_<n>Forms
lstore_0 = 63 (0x3f) lstore_1 = 64 (0x40) lstore_2 = 65 (0x41) lstore_3 = 66 (0x42)
Operand Stack
..., value → ...
Description
Both <n> and <n>+1 must be indices into the local variable array of the current frame (§2.6). The value on the top of the operand stack must be of type long. It is popped from the operand stack, and the local variables at <n> and <n>+1 are set to value.Notes
Each of the lstore_<n> instructions is the same as lstore with an index of <n>, except that the operand <n> is implicit.
fstoreOpCode.FSTOREOperation
Store float into local variableFormat
fstore index
Forms
fstore = 56 (0x38)Operand Stack
..., value → ...
Description
The index is an unsigned byte that must be an index into the local variable array of the current frame (§2.6). The value on the top of the operand stack must be of type float. It is popped from the operand stack and undergoes value set conversion (§2.8.3), resulting in value'. The value of the local variable at index is set to value'.Notes
The fstore opcode can be used in conjunction with the wide instruction (§wide) to access a local variable using a two-byte unsigned index.
fstore_<n>Operation
Store float into local variableFormat
fstore_<n>Forms
fstore_0 = 67 (0x43) fstore_1 = 68 (0x44) fstore_2 = 69 (0x45) fstore_3 = 70 (0x46)
Operand Stack
..., value → ...
Description
The <n> must be an index into the local variable array of the current frame (§2.6). The value on the top of the operand stack must be of type float. It is popped from the operand stack and undergoes value set conversion (§2.8.3), resulting in value'. The value of the local variable at <n> is set to value'.Notes
Each of the fstore_<n> instructions is the same as fstore with an index of <n>, except that the operand <n> is implicit.
dstoreOpCode.DSTOREOperation
Store double into local variableFormat
dstore index
Forms
dstore = 57 (0x39)Operand Stack
..., value → ...
Description
The index is an unsigned byte. Both index and index+1 must be indices into the local variable array of the current frame (§2.6). The value on the top of the operand stack must be of type double. It is popped from the operand stack and undergoes value set conversion (§2.8.3), resulting in value'. The local variables at index and index+1 are set to value'.Notes
The dstore opcode can be used in conjunction with the wide instruction (§wide) to access a local variable using a two-byte unsigned index.
dstore_<n>Operation
Store double into local variableFormat
dstore_<n>Forms
dstore_0 = 71 (0x47) dstore_1 = 72 (0x48) dstore_2 = 73 (0x49) dstore_3 = 74 (0x4a)
Operand Stack
..., value → ...
Description
Both <n> and <n>+1 must be indices into the local variable array of the current frame (§2.6). The value on the top of the operand stack must be of type double. It is popped from the operand stack and undergoes value set conversion (§2.8.3), resulting in value'. The local variables at <n> and <n>+1 are set to value'.Notes
Each of the dstore_<n> instructions is the same as dstore with an index of <n>, except that the operand <n> is implicit.
astoreOpCode.ASTOREOperation
Store reference into local variableFormat
astore index
Forms
astore = 58 (0x3a)Operand Stack
..., objectref → ...
Description
The index is an unsigned byte that must be an index into the local variable array of the current frame (§2.6). The objectref on the top of the operand stack must be of type returnAddress or of type reference. It is popped from the operand stack, and the value of the local variable at index is set to objectref.Notes
The astore instruction is used with an objectref of type returnAddress when implementing the finally clause of the Java programming language (§3.13).The aload instruction (§aload) cannot be used to load a value of type returnAddress from a local variable onto the operand stack. This asymmetry with the astore instruction is intentional.
The astore opcode can be used in conjunction with the wide instruction (§wide) to access a local variable using a two-byte unsigned index.
astore_<n>Operation
Store reference into local variableFormat
astore_<n>Forms
astore_0 = 75 (0x4b) astore_1 = 76 (0x4c) astore_2 = 77 (0x4d) astore_3 = 78 (0x4e)
Operand Stack
..., objectref → ...
Description
The <n> must be an index into the local variable array of the current frame (§2.6). The objectref on the top of the operand stack must be of type returnAddress or of type reference. It is popped from the operand stack, and the value of the local variable at <n> is set to objectref.Notes
An astore_<n> instruction is used with an objectref of type returnAddress when implementing the finally clauses of the Java programming language (§3.13).An aload_<n> instruction (§aload_<n>) cannot be used to load a value of type returnAddress from a local variable onto the operand stack. This asymmetry with the corresponding astore_<n> instruction is intentional.
Each of the astore_<n> instructions is the same as astore with an index of <n>, except that the operand <n> is implicit.
retOpCode.RETOperation
Return from subroutineFormat
ret indexForms
ret = 169 (0xa9)Operand Stack
No changeDescription
The index is an unsigned byte between 0 and 255, inclusive. The local variable at index in the current frame (§2.6) must contain a value of type returnAddress. The contents of the local variable are written into the Java Virtual Machine's pc register, and execution continues there.Notes
Note that jsr (§jsr) pushes the address onto the operand stack and ret gets it out of a local variable. This asymmetry is intentional.In Oracle's implementation of a compiler for the Java programming language prior to Java SE 6, the ret instruction was used with the jsr and jsr_w instructions (§jsr, §jsr_w) in the implementation of the finally clause (§3.13, §4.10.2.5).
The ret instruction should not be confused with the return instruction (§return). A return instruction returns control from a method to its invoker, without passing any value back to the invoker.
The ret opcode can be used in conjunction with the wide instruction (§wide) to access a local variable using a two-byte unsigned index.
Обратите внимание, что jsr (§jsr) помещает адрес в стек операндов, а ret получает его из локальной переменной. Эта асимметрия преднамеренная.В реализации Oracle компилятора для языка программирования Java до Java SE 6 инструкция ret использовалась с инструкциями jsr и jsr_w (§jsr, §jsr_w) в реализации предложения finally (§3.13, §4.10.2.5) ).
Инструкцию ret не следует путать с инструкцией return (§return). Команда возврата возвращает управление от метода вызывающей стороне, не передавая никакого значения обратно вызывающей стороне.
Код операции ret может использоваться вместе с инструкцией wide (§wide) для доступа к локальной переменной с использованием двухбайтового беззнакового индекса.
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MVarInsnclone()intgetOpcode()intgetVariable()voidsetOpcode(int opcode)voidsetVariable(int variable)StringtoString()voidwrite(org.objectweb.asm.MethodVisitor v, MethodWriterCtx ctx)
-
-
-
Constructor Detail
-
MVarInsn
public MVarInsn()
Конструктор по умолчанию
-
MVarInsn
public MVarInsn(int op, int vi)
-
MVarInsn
public MVarInsn(MVarInsn sample)
Конструктор копирования- Parameters:
sample- образец
-
-
Method Detail
-
clone
public MVarInsn clone()
- Specified by:
clonein interfaceMethodByteCode- Specified by:
clonein classMAbstractBC
-
getOpcode
public int getOpcode()
-
setOpcode
public void setOpcode(int opcode)
-
getVariable
public int getVariable()
-
setVariable
public void setVariable(int variable)
-
write
public void write(org.objectweb.asm.MethodVisitor v, MethodWriterCtx ctx)- Specified by:
writein interfaceMethodWriter
-
-