Package serp.bytecode
Class ClassConstantInstruction
java.lang.Object
serp.bytecode.ClassConstantInstruction
Pseudo-instruction used to place
Class
objects onto the stack.
This logical instruction may actually involve a large chunk of code, and
may even add static synthetic fields and methods to the owning class.
Therefore, once the type of class being loaded is set, it cannot
be changed. Also, this instruction is invalid as the target of
any jump instruction or exception handler.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate BCField
addClassField
(String name) Adds a static field to hold the loaded class constant.private BCMethod
Adds the standardclass$
method used inernally by classes to load class constants for object types.
private static Class
getWrapperClass
(String name) Return the wrapper type for the given primitive class, or null if the given name is not a primitive type.Set the type of class being loaded.Set the type of class being loaded.Set the type of class being loaded.private void
setClassName
(String name, Class wrapper) Set the name of the class to load.private void
Adds fields and methods as necessary to load a class constant of an object type.
-
Field Details
-
_params
-
_wrappers
-
_ins
-
_code
-
_class
-
_invalid
private boolean _invalid
-
-
Constructor Details
-
ClassConstantInstruction
ClassConstantInstruction(BCClass bc, Code code, Instruction nop)
-
-
Method Details
-
setClass
Set the type of class being loaded.- Returns:
- the first Instruction of the block added by setting the type
- Throws:
IllegalStateException
- if type has already been set
-
setClass
Set the type of class being loaded.- Returns:
- the first Instruction of the block added by setting the type
- Throws:
IllegalStateException
- if type has already been set
-
setClass
Set the type of class being loaded.- Returns:
- the first Instruction of the block added by setting the type
- Throws:
IllegalStateException
- if type has already been set
-
setClassName
Set the name of the class to load. -
setObject
Adds fields and methods as necessary to load a class constant of an object type. -
addClassField
Adds a static field to hold the loaded class constant. -
addClassLoadMethod
Adds the standardclass$
method used inernally by classes to load class constants for object types.
-
getWrapperClass
Return the wrapper type for the given primitive class, or null if the given name is not a primitive type. The given name should be in external form.
-