Top Description Inners Fields Constructors Methods
org.glassfish.pfl.dynamic.codegen.impl

public Class ASMUtil

extends Object
Class Inheritance
Imports
java.io.File, .FileOutputStream, .IOException, .PrintStream, .PrintWriter, java.util.HashMap, .HashSet, .Properties, org.glassfish.pfl.basic.contain.Pair, org.glassfish.pfl.basic.func.NullaryFunction, org.glassfish.pfl.dynamic.codegen.spi.ImportList, .Type, .Variable, .Wrapper, org.objectweb.asm.ClassReader, .ClassVisitor, .ClassWriter, .MethodVisitor, .Opcodes, org.objectweb.asm.util.CheckClassAdapter

Simple class containing a few ASM-related utilities and dynamic attributes needs for the byte code generator.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
public static class
public static enum
public static class

Field Summary

Modifier and TypeField and Description
pack-priv static Attribute<Integer>
pack-priv static Attribute<EmitterFactory.Emitter>
pack-priv static Attribute<EmitterFactory.Emitter>
pack-priv static Attribute<BlockStatement>
pack-priv static Attribute<Statement>
pack-priv static Attribute<ASMUtil.LineNumberTable>
private static NullaryFunction<MyLabel>
makeLabel

References Deprecated NullaryFunction is deprecated or references (maybe indirectly) at least one deprecated element.
pack-priv static Attribute<Node>
pack-priv static Attribute<ASMUtil.RequiredEmitterType>
pack-priv static Attribute<Variable>
pack-priv static Attribute<MyLabel>
pack-priv static Attribute<Variable>
pack-priv static Attribute<EmitterFactory.Emitter>
pack-priv static Attribute<Integer>
pack-priv static Attribute<MyLabel>
pack-priv static Attribute<MyLabel>
private static NullaryFunction<ASMUtil.LineNumberTable>
tableMaker

References Deprecated NullaryFunction is deprecated or references (maybe indirectly) at least one deprecated element.
pack-priv static Attribute<MyLabel>
pack-priv static Attribute<Variable>
pack-priv static Attribute<MyLabel>
pack-priv static Attribute<ASMUtil.VariablesInMethod>
private static NullaryFunction<ASMUtil.VariablesInMethod>
vmMaker

References Deprecated NullaryFunction is deprecated or references (maybe indirectly) at least one deprecated element.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static String
bcName(Type type)

private static void
private static byte[]
fixStackSize(byte[] code)

public static byte[]
generate(ClassLoader cl, ClassGeneratorImpl cg, ImportList imports, Properties options, PrintStream debugOutput)

Given a completed ClassGeneratorImpl, use ASM to construct the byte array representing the compiled class.

public static void
public static void
public static File
getFile(String genDir, String className, String suffix)

private static void
verify(final PrintStream ps, byte[] classData)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ctrback to summary
pack-priv static Attribute<Integer> ctr
emitterback to summary
pack-priv static Attribute<EmitterFactory.Emitter> emitter
getEmitterback to summary
pack-priv static Attribute<EmitterFactory.Emitter> getEmitter
lastBlockback to summary
pack-priv static Attribute<BlockStatement> lastBlock
lastStatementback to summary
pack-priv static Attribute<Statement> lastStatement
lineNumberTableback to summary
pack-priv static Attribute<ASMUtil.LineNumberTable> lineNumberTable
makeLabelback to summary
private static NullaryFunction<MyLabel> makeLabel

References Deprecated

NullaryFunction is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

nextback to summary
pack-priv static Attribute<Node> next
requiredEmitterTypeback to summary
pack-priv static Attribute<ASMUtil.RequiredEmitterType> requiredEmitterType
returnAddressback to summary
pack-priv static Attribute<Variable> returnAddress
returnLabelback to summary
pack-priv static Attribute<MyLabel> returnLabel
returnVariableback to summary
pack-priv static Attribute<Variable> returnVariable
setEmitterback to summary
pack-priv static Attribute<EmitterFactory.Emitter> setEmitter
stackFrameSlotback to summary
pack-priv static Attribute<Integer> stackFrameSlot
statementEndLabelback to summary
pack-priv static Attribute<MyLabel> statementEndLabel
statementStartLabelback to summary
pack-priv static Attribute<MyLabel> statementStartLabel
tableMakerback to summary
private static NullaryFunction<ASMUtil.LineNumberTable> tableMaker

References Deprecated

NullaryFunction is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

throwEndLabelback to summary
pack-priv static Attribute<MyLabel> throwEndLabel
uncaughtExceptionback to summary
pack-priv static Attribute<Variable> uncaughtException
uncaughtExceptionHandlerback to summary
pack-priv static Attribute<MyLabel> uncaughtExceptionHandler
variablesInMethodback to summary
pack-priv static Attribute<ASMUtil.VariablesInMethod> variablesInMethod
vmMakerback to summary
private static NullaryFunction<ASMUtil.VariablesInMethod> vmMaker

References Deprecated

NullaryFunction is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Constructor Detail

ASMUtilback to summary
public ASMUtil()

Method Detail

bcNameback to summary
public static String bcName(Type type)
displayNodeback to summary
private static void displayNode(PrintStream ps, String msg, Node node)
fixStackSizeback to summary
private static byte[] fixStackSize(byte[] code)
generateback to summary
public static byte[] generate(ClassLoader cl, ClassGeneratorImpl cg, ImportList imports, Properties options, PrintStream debugOutput)

Given a completed ClassGeneratorImpl, use ASM to construct the byte array representing the compiled class.

generateSourceCodeback to summary
public static void generateSourceCode(PrintStream ps, ClassGeneratorImpl cg, ImportList imports, Properties options) throws IOException
generateSourceCodeback to summary
public static void generateSourceCode(String sourceGenDir, ClassGeneratorImpl cg, ImportList imports, Properties options) throws IOException
getFileback to summary
public static File getFile(String genDir, String className, String suffix)
verifyback to summary
private static void verify(final PrintStream ps, byte[] classData)
org.glassfish.pfl.dynamic.codegen.impl back to summary

private Class ASMUtil.FixStackSizeClassVisitor

extends ClassVisitor
Class Inheritance

Field Summary

Inherited from org.objectweb.asm.ClassVisitor:
apicv

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public MethodVisitor
visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions)

Overrides org.objectweb.asm.ClassVisitor.visitMethod.

Visits a method of the class.

Inherited from org.objectweb.asm.ClassVisitor:
getDelegatevisitvisitAnnotationvisitAttributevisitEndvisitFieldvisitInnerClassvisitModulevisitNestHostvisitNestMembervisitOuterClassvisitPermittedSubclassvisitRecordComponentvisitSourcevisitTypeAnnotation

Constructor Detail

FixStackSizeClassVisitorback to summary
public FixStackSizeClassVisitor(final ClassVisitor cv)

Method Detail

visitMethodback to summary
public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions)

Overrides org.objectweb.asm.ClassVisitor.visitMethod.

Doc from org.objectweb.asm.ClassVisitor.visitMethod.

Visits a method of the class. This method must return a new MethodVisitor instance (or null) each time it is called, i.e., it should not return a previously returned visitor.

Annotations
@Override
org.glassfish.pfl.dynamic.codegen.impl back to summary

private Class ASMUtil.FixStackSizeMethodVisitor

extends MethodVisitor
Class Inheritance

Field Summary

Inherited from org.objectweb.asm.MethodVisitor:
apimv

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
visitMaxs(int maxStack, int maxLocals)

Overrides org.objectweb.asm.MethodVisitor.visitMaxs.

Visits the maximum stack size and the maximum number of local variables of the method.

Inherited from org.objectweb.asm.MethodVisitor:
getDelegatevisitAnnotableParameterCountvisitAnnotationvisitAnnotationDefaultvisitAttributevisitCodevisitEndvisitFieldInsnvisitFramevisitIincInsnvisitInsnvisitInsnAnnotationvisitIntInsnvisitInvokeDynamicInsnvisitJumpInsnvisitLabelvisitLdcInsnvisitLineNumbervisitLocalVariablevisitLocalVariableAnnotationvisitLookupSwitchInsnvisitMethodInsnvisitMethodInsnvisitMultiANewArrayInsnvisitParametervisitParameterAnnotationvisitTableSwitchInsnvisitTryCatchAnnotationvisitTryCatchBlockvisitTypeAnnotationvisitTypeInsnvisitVarInsn

Constructor Detail

FixStackSizeMethodVisitorback to summary
public FixStackSizeMethodVisitor(final MethodVisitor mv)

Method Detail

visitMaxsback to summary
public void visitMaxs(int maxStack, int maxLocals)

Overrides org.objectweb.asm.MethodVisitor.visitMaxs.

Doc from org.objectweb.asm.MethodVisitor.visitMaxs.

Visits the maximum stack size and the maximum number of local variables of the method.

Annotations
@Override
org.glassfish.pfl.dynamic.codegen.impl back to summary

public Class ASMUtil.LineNumberTable

extends HashMap<MyLabel, Integer>
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from java.util.HashMap:
clearclonecomputecomputeIfAbsentcomputeIfPresentcontainsKeycontainsValueentrySetforEachgetgetOrDefaultisEmptykeySetmergenewHashMapputputAllputIfAbsentremoveremovereplacereplacereplaceAllsizevalues

Constructor Detail

LineNumberTableback to summary
public LineNumberTable()
org.glassfish.pfl.dynamic.codegen.impl back to summary

public final Enum ASMUtil.RequiredEmitterType

extends Enum<ASMUtil.RequiredEmitterType>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final ASMUtil.RequiredEmitterType
public static final ASMUtil.RequiredEmitterType
public static final ASMUtil.RequiredEmitterType

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static ASMUtil.RequiredEmitterType
public static ASMUtil.RequiredEmitterType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

GETTERback to summary
public static final ASMUtil.RequiredEmitterType GETTER
NONEback to summary
public static final ASMUtil.RequiredEmitterType NONE
SETTERback to summary
public static final ASMUtil.RequiredEmitterType SETTER

Constructor Detail

RequiredEmitterTypeback to summary
private RequiredEmitterType()

Method Detail

valueOfback to summary
public static ASMUtil.RequiredEmitterType valueOf(String name)
valuesback to summary
public static ASMUtil.RequiredEmitterType[] values()
org.glassfish.pfl.dynamic.codegen.impl back to summary

public Class ASMUtil.VariablesInMethod

extends HashSet<Variable>
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from java.util.HashSet:
addclearclonecontainsisEmptyiteratornewHashSetremovesizespliteratortoArraytoArray

Constructor Detail

VariablesInMethodback to summary
public VariablesInMethod()