public class Gen extends JCTree.Visitor
This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.
Modifier and Type | Class and Description |
---|---|
static class |
Gen.CodeSizeOverflow
Thrown when the byte code size exceeds limit.
|
Modifier and Type | Field and Description |
---|---|
protected static Context.Key<Gen> |
genKey |
Modifier | Constructor and Description |
---|---|
protected |
Gen(Context context) |
Modifier and Type | Method and Description |
---|---|
void |
genArgs(List<JCTree.JCExpression> trees,
List<Type> pts)
Derived visitor method: generate code for a list of method arguments.
|
boolean |
genClass(Env<AttrContext> env,
JCTree.JCClassDecl cdef)
Generate code for a class definition.
|
com.sun.tools.javac.jvm.Items.CondItem |
genCond(JCTree _tree,
boolean markBranches)
Derived visitor method: generate code for a boolean
expression in a control-flow context.
|
com.sun.tools.javac.jvm.Items.CondItem |
genCond(JCTree tree,
int crtFlags)
Derived visitor method: check whether CharacterRangeTable
should be emitted, if so, put a new entry into CRTable
and call method to generate bytecode.
|
void |
genDef(JCTree tree,
Env<com.sun.tools.javac.jvm.Gen.GenContext> env)
Visitor method: generate code for a definition, catching and reporting
any completion failures.
|
com.sun.tools.javac.jvm.Items.Item |
genExpr(JCTree tree,
Type pt)
Visitor method: generate code for an expression, catching and reporting
any completion failures.
|
void |
genStat(JCTree tree,
Env<com.sun.tools.javac.jvm.Gen.GenContext> env)
Derived visitor method: generate code for a statement.
|
void |
genStat(JCTree tree,
Env<com.sun.tools.javac.jvm.Gen.GenContext> env,
int crtFlags)
Derived visitor method: check whether CharacterRangeTable
should be emitted, if so, put a new entry into CRTable
and call method to generate bytecode.
|
void |
genStats(List<? extends JCTree> trees,
Env<com.sun.tools.javac.jvm.Gen.GenContext> env)
Derived visitor method: generate code for a list of statements.
|
void |
genStats(List<JCTree.JCStatement> trees,
Env<com.sun.tools.javac.jvm.Gen.GenContext> env,
int crtFlags)
Derived visitor method: check whether CharacterRangeTable
should be emitted, if so, put a new entry into CRTable
and call method to generate bytecode.
|
static Gen |
instance(Context context) |
boolean |
isInvokeDynamic(Symbol sym) |
static int |
one(int tc)
The opcode that loads a one constant of a given type code.
|
void |
visitApply(JCTree.JCMethodInvocation tree) |
void |
visitAssign(JCTree.JCAssign tree) |
void |
visitAssignop(JCTree.JCAssignOp tree) |
void |
visitBinary(JCTree.JCBinary tree) |
void |
visitBlock(JCTree.JCBlock tree) |
void |
visitBreak(JCTree.JCBreak tree) |
void |
visitConditional(JCTree.JCConditional tree) |
void |
visitContinue(JCTree.JCContinue tree) |
void |
visitDoLoop(JCTree.JCDoWhileLoop tree) |
void |
visitExec(JCTree.JCExpressionStatement tree) |
void |
visitForeachLoop(JCTree.JCEnhancedForLoop tree) |
void |
visitForLoop(JCTree.JCForLoop tree) |
void |
visitIdent(JCTree.JCIdent tree) |
void |
visitIf(JCTree.JCIf tree) |
void |
visitIndexed(JCTree.JCArrayAccess tree) |
void |
visitLabelled(JCTree.JCLabeledStatement tree) |
void |
visitLetExpr(JCTree.LetExpr tree) |
void |
visitLiteral(JCTree.JCLiteral tree) |
void |
visitMethodDef(JCTree.JCMethodDecl tree) |
void |
visitNewArray(JCTree.JCNewArray tree) |
void |
visitNewClass(JCTree.JCNewClass tree) |
void |
visitParens(JCTree.JCParens tree) |
void |
visitReturn(JCTree.JCReturn tree) |
void |
visitSelect(JCTree.JCFieldAccess tree) |
void |
visitSkip(JCTree.JCSkip tree) |
void |
visitSwitch(JCTree.JCSwitch tree) |
void |
visitSynchronized(JCTree.JCSynchronized tree) |
void |
visitThrow(JCTree.JCThrow tree) |
void |
visitTry(JCTree.JCTry tree) |
void |
visitTypeCast(JCTree.JCTypeCast tree) |
void |
visitTypeTest(JCTree.JCInstanceOf tree) |
void |
visitUnary(JCTree.JCUnary tree) |
void |
visitVarDef(JCTree.JCVariableDecl tree) |
void |
visitWhileLoop(JCTree.JCWhileLoop tree) |
void |
visitWildcard(JCTree.JCWildcard tree) |
static int |
zero(int tc)
The opcode that loads a zero constant of a given type code.
|
visitAnnotatedType, visitAnnotation, visitAssert, visitCase, visitCatch, visitClassDef, visitErroneous, visitImport, visitLambda, visitModifiers, visitReference, visitTopLevel, visitTree, visitTypeApply, visitTypeArray, visitTypeBoundKind, visitTypeIdent, visitTypeIntersection, visitTypeParameter, visitTypeUnion
protected static final Context.Key<Gen> genKey
protected Gen(Context context)
public static int zero(int tc)
tc
- The given type code (@see ByteCode).public static int one(int tc)
tc
- The given type code (@see ByteCode).public void genDef(JCTree tree, Env<com.sun.tools.javac.jvm.Gen.GenContext> env)
tree
- The definition to be visited.env
- The environment current at the definition.public void genStat(JCTree tree, Env<com.sun.tools.javac.jvm.Gen.GenContext> env, int crtFlags)
tree
- The tree to be visited.env
- The environment to use.crtFlags
- The CharacterRangeTable flags
indicating type of the entry.genStat(JCTree, Env)
public void genStat(JCTree tree, Env<com.sun.tools.javac.jvm.Gen.GenContext> env)
public void genStats(List<JCTree.JCStatement> trees, Env<com.sun.tools.javac.jvm.Gen.GenContext> env, int crtFlags)
trees
- The list of trees to be visited.env
- The environment to use.crtFlags
- The CharacterRangeTable flags
indicating type of the entry.genStats(List, Env)
public void genStats(List<? extends JCTree> trees, Env<com.sun.tools.javac.jvm.Gen.GenContext> env)
public com.sun.tools.javac.jvm.Items.CondItem genCond(JCTree tree, int crtFlags)
tree
- The tree to be visited.crtFlags
- The CharacterRangeTable flags
indicating type of the entry.genCond(JCTree,boolean)
public com.sun.tools.javac.jvm.Items.CondItem genCond(JCTree _tree, boolean markBranches)
_tree
- The expression to be visited.markBranches
- The flag to indicate that the condition is
a flow controller so produced conditions
should contain a proper tree to generate
CharacterRangeTable branches for them.public com.sun.tools.javac.jvm.Items.Item genExpr(JCTree tree, Type pt)
tree
- The expression to be visited.pt
- The expression's expected type (proto-type).public void genArgs(List<JCTree.JCExpression> trees, List<Type> pts)
trees
- The argument expressions to be visited.pts
- The expression's expected types (i.e. the formal parameter
types of the invoked method).public void visitMethodDef(JCTree.JCMethodDecl tree)
visitMethodDef
in class JCTree.Visitor
public void visitVarDef(JCTree.JCVariableDecl tree)
visitVarDef
in class JCTree.Visitor
public void visitSkip(JCTree.JCSkip tree)
visitSkip
in class JCTree.Visitor
public void visitBlock(JCTree.JCBlock tree)
visitBlock
in class JCTree.Visitor
public void visitDoLoop(JCTree.JCDoWhileLoop tree)
visitDoLoop
in class JCTree.Visitor
public void visitWhileLoop(JCTree.JCWhileLoop tree)
visitWhileLoop
in class JCTree.Visitor
public void visitForLoop(JCTree.JCForLoop tree)
visitForLoop
in class JCTree.Visitor
public void visitForeachLoop(JCTree.JCEnhancedForLoop tree)
visitForeachLoop
in class JCTree.Visitor
public void visitLabelled(JCTree.JCLabeledStatement tree)
visitLabelled
in class JCTree.Visitor
public void visitSwitch(JCTree.JCSwitch tree)
visitSwitch
in class JCTree.Visitor
public void visitSynchronized(JCTree.JCSynchronized tree)
visitSynchronized
in class JCTree.Visitor
public void visitTry(JCTree.JCTry tree)
visitTry
in class JCTree.Visitor
public void visitIf(JCTree.JCIf tree)
visitIf
in class JCTree.Visitor
public void visitExec(JCTree.JCExpressionStatement tree)
visitExec
in class JCTree.Visitor
public void visitBreak(JCTree.JCBreak tree)
visitBreak
in class JCTree.Visitor
public void visitContinue(JCTree.JCContinue tree)
visitContinue
in class JCTree.Visitor
public void visitReturn(JCTree.JCReturn tree)
visitReturn
in class JCTree.Visitor
public void visitThrow(JCTree.JCThrow tree)
visitThrow
in class JCTree.Visitor
public void visitApply(JCTree.JCMethodInvocation tree)
visitApply
in class JCTree.Visitor
public void visitConditional(JCTree.JCConditional tree)
visitConditional
in class JCTree.Visitor
public void visitNewClass(JCTree.JCNewClass tree)
visitNewClass
in class JCTree.Visitor
public void visitNewArray(JCTree.JCNewArray tree)
visitNewArray
in class JCTree.Visitor
public void visitParens(JCTree.JCParens tree)
visitParens
in class JCTree.Visitor
public void visitAssign(JCTree.JCAssign tree)
visitAssign
in class JCTree.Visitor
public void visitAssignop(JCTree.JCAssignOp tree)
visitAssignop
in class JCTree.Visitor
public void visitUnary(JCTree.JCUnary tree)
visitUnary
in class JCTree.Visitor
public void visitBinary(JCTree.JCBinary tree)
visitBinary
in class JCTree.Visitor
public void visitTypeCast(JCTree.JCTypeCast tree)
visitTypeCast
in class JCTree.Visitor
public void visitWildcard(JCTree.JCWildcard tree)
visitWildcard
in class JCTree.Visitor
public void visitTypeTest(JCTree.JCInstanceOf tree)
visitTypeTest
in class JCTree.Visitor
public void visitIndexed(JCTree.JCArrayAccess tree)
visitIndexed
in class JCTree.Visitor
public void visitIdent(JCTree.JCIdent tree)
visitIdent
in class JCTree.Visitor
public void visitSelect(JCTree.JCFieldAccess tree)
visitSelect
in class JCTree.Visitor
public boolean isInvokeDynamic(Symbol sym)
public void visitLiteral(JCTree.JCLiteral tree)
visitLiteral
in class JCTree.Visitor
public void visitLetExpr(JCTree.LetExpr tree)
visitLetExpr
in class JCTree.Visitor
public boolean genClass(Env<AttrContext> env, JCTree.JCClassDecl cdef)
env
- The attribution environment that belongs to the
outermost class containing this class definition.
We need this for resolving some additional symbols.cdef
- The tree representing the class definition.Copyright © 2017 earcam. All rights reserved.