Top Fields Constructors Methods
javassist.compiler

public Class JvstCodeGen

extends MemberCodeGen
Class Inheritance
Imports
javassist.ClassPool, .CtClass, .CtPrimitiveType, .NotFoundException, javassist.bytecode.Bytecode, .Descriptor, javassist.compiler.ast.ASTList, .ASTree, .CallExpr, .CastExpr, .Declarator, .Expr, .Member, .Stmnt, .Symbol

Field Summary

Modifier and TypeField and Description
public static final String
public static final String
private CtClass
public static final String
private String
pack-priv String
pack-priv String
pack-priv CtClass[]
private int
pack-priv String
pack-priv ProceedHandler
pack-priv String
pack-priv CtClass
private String
public static final String
private boolean
public static final String
Inherited from javassist.compiler.MemberCodeGen:
resolverresultStaticthisClassthisMethod

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
protected void
public void
public void
protected void
atCastToRtype(CastExpr expr)

Inserts a cast operator to the return type.

protected void
protected void
protected void
atFieldAssign(Expr expr, int op, ASTree left, ASTree right, boolean doDup)

Overrides javassist.compiler.MemberCodeGen.atFieldAssign.

public void
public void
atMethodArgs(ASTList args, int[] types, int[] dims, String[] cnames)

Overrides javassist.compiler.MemberCodeGen.atMethodArgs.

protected void
private void
pack-priv void
compileInvokeSpecial(ASTree target, int methodIndex, String descriptor, ASTList args)

public static int
compileParameterList(Bytecode code, CtClass[] params, int regno)

protected void
public void
public int
private int
public boolean
private static void
public int
recordParams(CtClass[] params, boolean isStatic, String prefix, String paramVarName, String paramsName, SymbolTable tbl)

Makes method parameters $0, $1, ..., $args, $$, and $class available.

public int
recordParams(CtClass[]
the parameter types (the types of $1, $2, ..)
params
,
boolean
true if the method in which the compiled bytecode is embedded is static.
isStatic
,
String
it must be "$" (the first letter of $0, $1, ...)
prefix
,
String
it must be "$args"
paramVarName
,
String
it must be "$$"
paramsName
,
boolean
true if $0 is used.
use0
,
int
the register number of $0 (use0 is true) or $1 (otherwise).
paramBase
,
String
the class of $0. If use0 is false, target can be null. The value of "target" is also used as the name of the type represented by $class.
target
,
SymbolTable tbl)

Makes method parameters $0, $1, ..., $args, $$, and $class available.

public int

Returns:

-1 or the variable index assigned to $_.
recordReturnType
(CtClass type, String castName, String
null if $_ is not used.
resultName
,
SymbolTable tbl)

Makes a cast to the return type ($r) available.

public void
recordType(CtClass t)

Makes $type available.

private int
recordVar(CtClass cc, String varName, int varNo, SymbolTable tbl)

public int
recordVariable(CtClass
variable type
type
,
String
variable name
varName
,
SymbolTable tbl)

Makes the given variable name available.

public void
recordVariable(String
the type descriptor of the variable
typeDesc
,
String
variable name
varName
,
int
an index into the local variable array
varNo
,
SymbolTable tbl)

Makes the given variable name available.

public void
public void
private void
setType(CtClass type, int dim)

Inherited from javassist.compiler.MemberCodeGen:
atArrayInitatArrayVariableAssignatClassObject2atFieldPlusPlusatFieldReadatMethodCallCoreatMultiNewArrayatNewArrayExpratNewExpratTryStmntfieldAccessgetAccessibleConstructorgetAccessiblePrivategetMajorVersiongetSuperNamegetThisClassgetThisNameinsertDefaultSuperCallmakeParamListmakeThrowsListresolveClassNameresolveClassNamesetReturnTypesetThisMethod

Field Detail

cflowNameback to summary
public static final String cflowName
clazzNameback to summary
public static final String clazzName
dollarTypeback to summary
private CtClass dollarType
dollarTypeNameback to summary
public static final String dollarTypeName
param0Typeback to summary
private String param0Type
paramArrayNameback to summary
pack-priv String paramArrayName
paramListNameback to summary
pack-priv String paramListName
paramTypeListback to summary
pack-priv CtClass[] paramTypeList
paramVarBaseback to summary
private int paramVarBase
proceedNameback to summary
pack-priv String proceedName
procHandlerback to summary
pack-priv ProceedHandler procHandler
returnCastNameback to summary
pack-priv String returnCastName
returnTypeback to summary
pack-priv CtClass returnType
returnVarNameback to summary
private String returnVarName
Annotations
@SuppressWarnings:unused
sigNameback to summary
public static final String sigName
useParam0back to summary
private boolean useParam0
wrapperCastNameback to summary
public static final String wrapperCastName

Constructor Detail

JvstCodeGenback to summary
public JvstCodeGen(Bytecode b, CtClass cc, ClassPool cp)

Method Detail

addNullIfVoidback to summary
public void addNullIfVoid()
atAssignParamListback to summary
protected void atAssignParamList(CtClass[] params, Bytecode code) throws CompileError
atCallExprback to summary
public void atCallExpr(CallExpr expr) throws CompileError

Overrides javassist.compiler.MemberCodeGen.atCallExpr.

Annotations
@Override
atCastExprback to summary
public void atCastExpr(CastExpr expr) throws CompileError

Overrides javassist.compiler.CodeGen.atCastExpr.

Annotations
@Override
atCastToRtypeback to summary
protected void atCastToRtype(CastExpr expr) throws CompileError

Inserts a cast operator to the return type. If the return type is void, this does nothing.

atCastToWrapperback to summary
protected void atCastToWrapper(CastExpr expr) throws CompileError
atCflowback to summary
protected void atCflow(ASTList cname) throws CompileError
atFieldAssignback to summary
protected void atFieldAssign(Expr expr, int op, ASTree left, ASTree right, boolean doDup) throws CompileError

Overrides javassist.compiler.MemberCodeGen.atFieldAssign.

Annotations
@Override
atMemberback to summary
public void atMember(Member mem) throws CompileError

Overrides javassist.compiler.MemberCodeGen.atMember.

Annotations
@Override
atMethodArgsback to summary
public void atMethodArgs(ASTList args, int[] types, int[] dims, String[] cnames) throws CompileError

Overrides javassist.compiler.MemberCodeGen.atMethodArgs.

Annotations
@Override
atReturnStmntback to summary
protected void atReturnStmnt(Stmnt st) throws CompileError

Overrides javassist.compiler.CodeGen.atReturnStmnt.

Annotations
@Override
callGetTypeback to summary
private void callGetType(String method)
compileInvokeSpecialback to summary
pack-priv void compileInvokeSpecial(ASTree target, int methodIndex, String descriptor, ASTList args) throws CompileError
compileParameterListback to summary
public static int compileParameterList(Bytecode code, CtClass[] params, int regno)
compileUnwrapValueback to summary
protected void compileUnwrapValue(CtClass type, Bytecode code) throws CompileError
doNumCastback to summary
public void doNumCast(CtClass type) throws CompileError
getMethodArgsLengthback to summary
public int getMethodArgsLength(ASTList args)

Overrides javassist.compiler.MemberCodeGen.getMethodArgsLength.

Annotations
@Override
indexOfParam1back to summary
private int indexOfParam1()
isParamListNameback to summary
public boolean isParamListName(ASTList args)
makeCflowNameback to summary
private static void makeCflowName(StringBuilder sbuf, ASTree name) throws CompileError
recordParamsback to summary
public int recordParams(CtClass[] params, boolean isStatic, String prefix, String paramVarName, String paramsName, SymbolTable tbl) throws CompileError

Makes method parameters $0, $1, ..., $args, $$, and $class available. $0 is equivalent to THIS if the method is not static. Otherwise, if the method is static, then $0 is not available.

recordParamsback to summary
public int recordParams(CtClass[] params, boolean isStatic, String prefix, String paramVarName, String paramsName, boolean use0, int paramBase, String target, SymbolTable tbl) throws CompileError

Makes method parameters $0, $1, ..., $args, $$, and $class available. $0 is available only if use0 is true. It might not be equivalent to THIS.

Parameters
params:CtClass[]

the parameter types (the types of $1, $2, ..)

isStatic:boolean

true if the method in which the compiled bytecode is embedded is static.

prefix:String

it must be "$" (the first letter of $0, $1, ...)

paramVarName:String

it must be "$args"

paramsName:String

it must be "$$"

use0:boolean

true if $0 is used.

paramBase:int

the register number of $0 (use0 is true) or $1 (otherwise).

target:String

the class of $0. If use0 is false, target can be null. The value of "target" is also used as the name of the type represented by $class.

recordReturnTypeback to summary
public int recordReturnType(CtClass type, String castName, String resultName, SymbolTable tbl) throws CompileError

Makes a cast to the return type ($r) available. It also enables $_.

If the return type is void, ($r) does nothing. The type of $_ is java.lang.Object.

Parameters
resultName:String

null if $_ is not used.

Returns:int

-1 or the variable index assigned to $_.

recordTypeback to summary
public void recordType(CtClass t)

Makes $type available.

recordVarback to summary
private int recordVar(CtClass cc, String varName, int varNo, SymbolTable tbl) throws CompileError
recordVariableback to summary
public int recordVariable(CtClass type, String varName, SymbolTable tbl) throws CompileError

Makes the given variable name available.

Parameters
type:CtClass

variable type

varName:String

variable name

recordVariableback to summary
public void recordVariable(String typeDesc, String varName, int varNo, SymbolTable tbl) throws CompileError

Makes the given variable name available.

Parameters
typeDesc:String

the type descriptor of the variable

varName:String

variable name

varNo:int

an index into the local variable array

setProceedHandlerback to summary
public void setProceedHandler(ProceedHandler h, String name)
setTypeback to summary
public void setType(CtClass type) throws CompileError
setTypeback to summary
private void setType(CtClass type, int dim) throws CompileError