Class EmitterFactory
java.lang.Object
org.glassfish.pfl.dynamic.codegen.impl.EmitterFactory
This class provides methods that allow the construction of an
object that can later be used to emit a bytecode. This is useful
when multiple visitors are needed for first preparing an AST,
then generating the bytecode.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static interface
Simple wrapper class around a UnaryVoidFunction.private static class
private static class
static class
static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final EmitterFactory.Emitter
private static final EmitterFactory.Emitter
private static final EmitterFactory.Emitter
private static final int
private static String[]
private static BitSet
private static BitSet
private static BitSet
private static BitSet
private static BitSet
private static BitSet
private static BitSet
private static BitSet
private static BitSet
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
private static int
getVarInsnOpcode
(Type type, boolean isStore) private static BitSet
makeBitSet
(int... args) static EmitterFactory.Emitter
makeEmitter
(ExpressionFactory.ArrayIndexExpression expr, boolean isStore) Create an emitter that generates the instruction needed to either store the TOS value into an array (aastore) (isStore==true) or push the array element's value onto the stack (aaload) (isStore==false).static EmitterFactory.Emitter
static EmitterFactory.Emitter
makeEmitter
(ExpressionFactory.NonStaticFieldAccessExpression expr, boolean isStore) Create an emitter that generates the instruction needed to either store the TOS value into the non-static field (isStore==true) or push the non-static fields's value onto the stack (isStore==false).static EmitterFactory.Emitter
makeEmitter
(ExpressionFactory.StaticFieldAccessExpression expr, boolean isStore) Create an emitter that generates the instruction needed to either store the TOS value into the static field (isStore==true) or push the static fields's value onto the stack (isStore==false).static EmitterFactory.Emitter
makeEmitter
(Variable var, boolean isStore) Create an emitter that generates the instruction needed to either store the TOS value into the variable (isStore==true) or push the variable's value onto the stack (isStore==false).private static EmitterFactory.Emitter
makeFieldInsnEmitter
(boolean isStore, boolean isStatic, Type targetType, String name, Type varType)
-
Field Details
-
MAX_OPCODE
private static final int MAX_OPCODE- See Also:
-
opcodeNames
-
visitInsnSet
-
visitIntInsnSet
-
visitVarInsnSet
-
visitFieldInsnSet
-
visitMethodInsnSet
-
visitTypeInsnSet
-
visitJumpInsnSet
-
specialOpcodeSet
-
validOpcodeSet
-
arrayStore
-
arrayLoad
-
arrayLength
-
-
Constructor Details
-
EmitterFactory
private EmitterFactory()
-
-
Method Details
-
makeBitSet
-
check
-
getVarInsnOpcode
-
makeFieldInsnEmitter
private static EmitterFactory.Emitter makeFieldInsnEmitter(boolean isStore, boolean isStatic, Type targetType, String name, Type varType) -
makeEmitter
Create an emitter that generates the instruction needed to either store the TOS value into the variable (isStore==true) or push the variable's value onto the stack (isStore==false). The stack index must be set on var in the stackFrameSlot attribute. -
makeEmitter
public static EmitterFactory.Emitter makeEmitter(ExpressionFactory.NonStaticFieldAccessExpression expr, boolean isStore) Create an emitter that generates the instruction needed to either store the TOS value into the non-static field (isStore==true) or push the non-static fields's value onto the stack (isStore==false). -
makeEmitter
public static EmitterFactory.Emitter makeEmitter(ExpressionFactory.StaticFieldAccessExpression expr, boolean isStore) Create an emitter that generates the instruction needed to either store the TOS value into the static field (isStore==true) or push the static fields's value onto the stack (isStore==false). -
makeEmitter
public static EmitterFactory.Emitter makeEmitter(ExpressionFactory.ArrayIndexExpression expr, boolean isStore) Create an emitter that generates the instruction needed to either store the TOS value into an array (aastore) (isStore==true) or push the array element's value onto the stack (aaload) (isStore==false). This emitter assumes that arrayref and index are already on the stack, and value is on the stack either before (aastore) or after (aaload) the instruction executes. -
makeEmitter
-