class Frame
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) static int |
ARRAY_OF
Constant to be added to a type to get a type with one more dimension.
|
(package private) static int |
BASE
Kind of the types that are not relative to an input stack map frame.
|
(package private) static int |
BASE_KIND
Mask to get the kind of base types.
|
(package private) static int |
BASE_VALUE
Mask to get the value of base types.
|
(package private) static int |
BOOLEAN
The BOOLEAN type.
|
(package private) static int |
BYTE
The BYTE type.
|
(package private) static int |
CHAR
The CHAR type.
|
(package private) static int |
DIM
Mask to get the dimension of a frame type.
|
(package private) static int |
DOUBLE
The DOUBLE type.
|
(package private) static int |
ELEMENT_OF
Constant to be added to a type to get a type with one less dimension.
|
(package private) static int |
FLOAT
The FLOAT type.
|
private int |
initializationCount
Number of types that are initialized in the basic block.
|
private int[] |
initializations
The types that are initialized in the basic block.
|
(package private) int[] |
inputLocals
The input stack map frame locals.
|
(package private) int[] |
inputStack
The input stack map frame stack.
|
(package private) static int |
INTEGER
The INTEGER type.
|
(package private) static int |
KIND
Mask to get the kind of a frame type.
|
private static int |
LOCAL
Kind of the types that are relative to the local variable types of an
input stack map frame.
|
(package private) static int |
LONG
The LONG type.
|
(package private) static int |
NULL
The NULL type.
|
(package private) static int |
OBJECT
Base kind of the base reference types.
|
private int[] |
outputLocals
The output stack map frame locals.
|
private int[] |
outputStack
The output stack map frame stack.
|
(package private) int |
outputStackTop
Relative size of the output stack.
|
(package private) Label |
owner
The label (i.e.
|
(package private) static int |
SHORT
The SHORT type.
|
(package private) static int[] |
SIZE
The stack size variation corresponding to each JVM instruction.
|
private static int |
STACK
Kind of the types that are relative to the stack of an input stack
map frame.
|
(package private) static int |
TOP
The TOP type.
|
(package private) static int |
TOP_IF_LONG_OR_DOUBLE
Flag used for LOCAL and STACK types.
|
(package private) static int |
UNINITIALIZED
Base kind of the uninitialized base types.
|
(package private) static int |
UNINITIALIZED_THIS
The UNINITIALIZED_THIS type.
|
(package private) static int |
VALUE
Mask to get the value of a frame type.
|
Constructor and Description |
---|
Frame() |
Modifier and Type | Method and Description |
---|---|
private static int |
convert(ClassWriter cw,
int nInput,
java.lang.Object[] input,
int[] output)
Converts types from the MethodWriter.visitFrame() format to the Frame
format.
|
(package private) void |
execute(int opcode,
int arg,
ClassWriter cw,
Item item)
Simulates the action of the given instruction on the output stack frame.
|
private int |
get(int local)
Returns the output frame local variable type at the given index.
|
private int |
init(ClassWriter cw,
int t)
Replaces the given type with the appropriate type if it is one of the
types on which a constructor is invoked in the basic block.
|
private void |
init(int var)
Adds a new type to the list of types on which a constructor is invoked in
the basic block.
|
(package private) void |
initInputFrame(ClassWriter cw,
int access,
Type[] args,
int maxLocals)
Initializes the input frame of the first basic block from the method
descriptor.
|
(package private) boolean |
merge(ClassWriter cw,
Frame frame,
int edge)
Merges the input frame of the given basic block with the input and output
frames of this basic block.
|
private static boolean |
merge(ClassWriter cw,
int t,
int[] types,
int index)
Merges the type at the given index in the given type array with the given
type.
|
private int |
pop()
Pops a type from the output frame stack and returns its value.
|
private void |
pop(int elements)
Pops the given number of types from the output frame stack.
|
private void |
pop(java.lang.String desc)
Pops a type from the output frame stack.
|
private void |
push(ClassWriter cw,
java.lang.String desc)
Pushes a new type onto the output frame stack.
|
private void |
push(int type)
Pushes a new type onto the output frame stack.
|
(package private) void |
set(ClassWriter cw,
int nLocal,
java.lang.Object[] local,
int nStack,
java.lang.Object[] stack)
Sets this frame to the given value.
|
(package private) void |
set(Frame f)
Sets this frame to the value of the given frame.
|
private void |
set(int local,
int type)
Sets the output frame local variable type at the given index.
|
private static int |
type(ClassWriter cw,
java.lang.String desc)
Returns the int encoding of the given type.
|
static final int DIM
static final int ARRAY_OF
static final int ELEMENT_OF
static final int KIND
BASE
,
LOCAL
,
STACK
,
Constant Field Valuesstatic final int TOP_IF_LONG_OR_DOUBLE
static final int VALUE
static final int BASE_KIND
static final int BASE_VALUE
static final int BASE
static final int OBJECT
static final int UNINITIALIZED
private static final int LOCAL
private static final int STACK
static final int TOP
static final int BOOLEAN
static final int BYTE
static final int CHAR
static final int SHORT
static final int INTEGER
static final int FLOAT
static final int DOUBLE
static final int LONG
static final int NULL
static final int UNINITIALIZED_THIS
static final int[] SIZE
Label owner
int[] inputLocals
int[] inputStack
private int[] outputLocals
private int[] outputStack
int outputStackTop
outputStack
.private int initializationCount
initializations
private int[] initializations
final void set(ClassWriter cw, int nLocal, java.lang.Object[] local, int nStack, java.lang.Object[] stack)
cw
- the ClassWriter to which this label belongs.nLocal
- the number of local variables.local
- the local variable types. Primitive types are represented by
Opcodes.TOP
, Opcodes.INTEGER
,
Opcodes.FLOAT
, Opcodes.LONG
,
Opcodes.DOUBLE
,Opcodes.NULL
or
Opcodes.UNINITIALIZED_THIS
(long and double are
represented by a single element). Reference types are
represented by String objects (representing internal names),
and uninitialized types by Label objects (this label
designates the NEW instruction that created this uninitialized
value).nStack
- the number of operand stack elements.stack
- the operand stack types (same format as the "local" array).private static int convert(ClassWriter cw, int nInput, java.lang.Object[] input, int[] output)
cw
- the ClassWriter to which this label belongs.nInput
- the number of types to convert.input
- the types to convert. Primitive types are represented by
Opcodes.TOP
, Opcodes.INTEGER
,
Opcodes.FLOAT
, Opcodes.LONG
,
Opcodes.DOUBLE
,Opcodes.NULL
or
Opcodes.UNINITIALIZED_THIS
(long and double are
represented by a single element). Reference types are
represented by String objects (representing internal names),
and uninitialized types by Label objects (this label
designates the NEW instruction that created this uninitialized
value).output
- where to store the converted types.final void set(Frame f)
f
- The new frame value.private int get(int local)
local
- the index of the local that must be returned.private void set(int local, int type)
local
- the index of the local that must be set.type
- the value of the local that must be set.private void push(int type)
type
- the type that must be pushed.private void push(ClassWriter cw, java.lang.String desc)
cw
- the ClassWriter to which this label belongs.desc
- the descriptor of the type to be pushed. Can also be a method
descriptor (in this case this method pushes its return type
onto the output frame stack).private static int type(ClassWriter cw, java.lang.String desc)
cw
- the ClassWriter to which this label belongs.desc
- a type descriptor.private int pop()
private void pop(int elements)
elements
- the number of types that must be popped.private void pop(java.lang.String desc)
desc
- the descriptor of the type to be popped. Can also be a method
descriptor (in this case this method pops the types
corresponding to the method arguments).private void init(int var)
var
- a type on a which a constructor is invoked.private int init(ClassWriter cw, int t)
cw
- the ClassWriter to which this label belongs.t
- a typefinal void initInputFrame(ClassWriter cw, int access, Type[] args, int maxLocals)
cw
- the ClassWriter to which this label belongs.access
- the access flags of the method to which this label belongs.args
- the formal parameter types of this method.maxLocals
- the maximum number of local variables of this method.void execute(int opcode, int arg, ClassWriter cw, Item item)
opcode
- the opcode of the instruction.arg
- the operand of the instruction, if any.cw
- the class writer to which this label belongs.item
- the operand of the instructions, if any.final boolean merge(ClassWriter cw, Frame frame, int edge)
private static boolean merge(ClassWriter cw, int t, int[] types, int index)
cw
- the ClassWriter to which this label belongs.t
- the type with which the type array element must be merged.types
- an array of types.index
- the index of the type that must be merged in 'types'.