net.sf.cglib.core

Class CodeEmitter

public class CodeEmitter extends RemappingCodeVisitor

Author: Juozas Baliuka, Chris Nokleberg

Field Summary
static intADD
static intAND
static intDIV
static intEQ
static intGE
static intGT
static intLE
static intLT
static intMUL
static intNE
static intNEG
static intOR
static intREM
static intSUB
static intUSHR
static intXOR
Constructor Summary
CodeEmitter(CodeEmitter wrap)
Method Summary
voidaaload(int index)
voidaaload()
voidaastore()
voidaconst_null()
voidarraylength()
voidarray_load(Type type)
voidarray_store(Type type)
voidathrow()
Blockbegin_block()
voidbox(Type type)
If the argument is a primitive class, replaces the primitive value on the top of the stack with the wrapped (Object) equivalent.
voidcast_numeric(Type from, Type to)
Casts from one primitive numeric type to another
voidcatch_exception(Block block, Type exception)
voidcheckcast(Type type)
voidcheckcast_this()
voidcreate_arg_array()
Allocates and fills an Object[] array with the arguments to the current method.
voiddefine_attribute(Attribute attrs)
voiddup()
voiddup2()
voiddup2_x1()
voiddup2_x2()
voiddup_x1()
voiddup_x2()
voidend_method()
ClassEmittergetClassEmitter()
voidgetfield(String name)
voidgetfield(Type owner, String name, Type type)
MethodInfogetMethodInfo()
TypegetReturnType()
voidgetstatic(Type owner, String name, Type type)
SignaturegetSignature()
voidgoTo(Label label)
voidifnonnull(Label label)
voidifnull(Label label)
voidif_cmp(Type type, int mode, Label label)
voidif_icmp(int mode, Label label)
voidif_jump(int mode, Label label)
voidiinc(Local local, int amount)
voidinstance_of(Type type)
voidinstance_of_this()
voidinvoke(MethodInfo method)
voidinvoke_constructor(Type type)
voidinvoke_constructor(Type type, Signature sig)
voidinvoke_constructor_this()
voidinvoke_constructor_this(Signature sig)
voidinvoke_interface(Type owner, Signature sig)
voidinvoke_static(Type owner, Signature sig)
voidinvoke_static_this(Signature sig)
voidinvoke_virtual(Type owner, Signature sig)
voidinvoke_virtual_this(Signature sig)
booleanisStaticHook()
voidload_arg(int index)
Pushes the specified argument of the current method onto the stack.
voidload_args()
Pushes all of the arguments of the current method onto the stack.
voidload_args(int fromArg, int count)
voidload_local(Local local)
voidload_this()
Labelmake_label()
Localmake_local()
Localmake_local(Type type)
voidmark(Label label)
voidmath(int op, Type type)
voidmonitorenter()
voidmonitorexit()
voidnewarray()
voidnewarray(Type type)
voidnew_instance(Type type)
voidnew_instance_this()
voidnot()
Toggles the integer on the top of the stack from 1 to 0 or vice versa
voidpop()
voidpop2()
voidprocess_switch(int[] keys, ProcessSwitchCallback callback)
voidprocess_switch(int[] keys, ProcessSwitchCallback callback, boolean useTable)
voidpush(int i)
voidpush(long value)
voidpush(float value)
voidpush(double value)
voidpush(String value)
voidpush(boolean value)
voidputfield(String name)
voidputfield(Type owner, String name, Type type)
voidputstatic(Type owner, String name, Type type)
voidreturn_value()
voidstore_local(Local local)
voidsuper_getfield(String name, Type type)
voidsuper_getstatic(String name, Type type)
voidsuper_invoke()
voidsuper_invoke(Signature sig)
voidsuper_invoke_constructor()
voidsuper_invoke_constructor(Signature sig)
voidsuper_putfield(String name, Type type)
voidsuper_putstatic(String name, Type type)
voidswap()
voidswap(Type prev, Type type)
voidthrow_exception(Type type, String msg)
voidunbox(Type type)
If the argument is a primitive class, replaces the object on the top of the stack with the unwrapped (primitive) equivalent.
voidunbox_or_zero(Type type)
Unboxes the object on the top of the stack.
voidvisitMaxs(int maxStack, int maxLocals)
voidzero_or_null(Type type)
Pushes a zero onto the stack if the argument is a primitive class, or a null otherwise.

Field Detail

ADD

public static final int ADD

AND

public static final int AND

DIV

public static final int DIV

EQ

public static final int EQ

GE

public static final int GE

GT

public static final int GT

LE

public static final int LE

LT

public static final int LT

MUL

public static final int MUL

NE

public static final int NE

NEG

public static final int NEG

OR

public static final int OR

REM

public static final int REM

SUB

public static final int SUB

USHR

public static final int USHR

XOR

public static final int XOR

Constructor Detail

CodeEmitter

public CodeEmitter(CodeEmitter wrap)

Method Detail

aaload

public void aaload(int index)

aaload

public void aaload()

aastore

public void aastore()

aconst_null

public void aconst_null()

arraylength

public void arraylength()

array_load

public void array_load(Type type)

array_store

public void array_store(Type type)

athrow

public void athrow()

begin_block

public Block begin_block()

box

public void box(Type type)
If the argument is a primitive class, replaces the primitive value on the top of the stack with the wrapped (Object) equivalent. For example, char -> Character. If the class is Void, a null is pushed onto the stack instead.

Parameters: type the class indicating the current type of the top stack value

cast_numeric

public void cast_numeric(Type from, Type to)
Casts from one primitive numeric type to another

catch_exception

public void catch_exception(Block block, Type exception)

checkcast

public void checkcast(Type type)

checkcast_this

public void checkcast_this()

create_arg_array

public void create_arg_array()
Allocates and fills an Object[] array with the arguments to the current method. Primitive values are inserted as their boxed (Object) equivalents.

define_attribute

public void define_attribute(Attribute attrs)

dup

public void dup()

dup2

public void dup2()

dup2_x1

public void dup2_x1()

dup2_x2

public void dup2_x2()

dup_x1

public void dup_x1()

dup_x2

public void dup_x2()

end_method

public void end_method()

getClassEmitter

public ClassEmitter getClassEmitter()

getfield

public void getfield(String name)

getfield

public void getfield(Type owner, String name, Type type)

getMethodInfo

public MethodInfo getMethodInfo()

getReturnType

public Type getReturnType()

getstatic

public void getstatic(Type owner, String name, Type type)

getSignature

public Signature getSignature()

goTo

public void goTo(Label label)

ifnonnull

public void ifnonnull(Label label)

ifnull

public void ifnull(Label label)

if_cmp

public void if_cmp(Type type, int mode, Label label)

if_icmp

public void if_icmp(int mode, Label label)

if_jump

public void if_jump(int mode, Label label)

iinc

public void iinc(Local local, int amount)

instance_of

public void instance_of(Type type)

instance_of_this

public void instance_of_this()

invoke

public void invoke(MethodInfo method)

invoke_constructor

public void invoke_constructor(Type type)

invoke_constructor

public void invoke_constructor(Type type, Signature sig)

invoke_constructor_this

public void invoke_constructor_this()

invoke_constructor_this

public void invoke_constructor_this(Signature sig)

invoke_interface

public void invoke_interface(Type owner, Signature sig)

invoke_static

public void invoke_static(Type owner, Signature sig)

invoke_static_this

public void invoke_static_this(Signature sig)

invoke_virtual

public void invoke_virtual(Type owner, Signature sig)

invoke_virtual_this

public void invoke_virtual_this(Signature sig)

isStaticHook

public boolean isStaticHook()

load_arg

public void load_arg(int index)
Pushes the specified argument of the current method onto the stack.

Parameters: index the zero-based index into the argument list

load_args

public void load_args()
Pushes all of the arguments of the current method onto the stack.

load_args

public void load_args(int fromArg, int count)

load_local

public void load_local(Local local)

load_this

public void load_this()

make_label

public Label make_label()

make_local

public Local make_local()

make_local

public Local make_local(Type type)

mark

public void mark(Label label)

math

public void math(int op, Type type)

monitorenter

public void monitorenter()

monitorexit

public void monitorexit()

newarray

public void newarray()

newarray

public void newarray(Type type)

new_instance

public void new_instance(Type type)

new_instance_this

public void new_instance_this()

not

public void not()
Toggles the integer on the top of the stack from 1 to 0 or vice versa

pop

public void pop()

pop2

public void pop2()

process_switch

public void process_switch(int[] keys, ProcessSwitchCallback callback)

process_switch

public void process_switch(int[] keys, ProcessSwitchCallback callback, boolean useTable)

push

public void push(int i)

push

public void push(long value)

push

public void push(float value)

push

public void push(double value)

push

public void push(String value)

push

public void push(boolean value)

putfield

public void putfield(String name)

putfield

public void putfield(Type owner, String name, Type type)

putstatic

public void putstatic(Type owner, String name, Type type)

return_value

public void return_value()

store_local

public void store_local(Local local)

super_getfield

public void super_getfield(String name, Type type)

super_getstatic

public void super_getstatic(String name, Type type)

super_invoke

public void super_invoke()

super_invoke

public void super_invoke(Signature sig)

super_invoke_constructor

public void super_invoke_constructor()

super_invoke_constructor

public void super_invoke_constructor(Signature sig)

super_putfield

public void super_putfield(String name, Type type)

super_putstatic

public void super_putstatic(String name, Type type)

swap

public void swap()

swap

public void swap(Type prev, Type type)

throw_exception

public void throw_exception(Type type, String msg)

unbox

public void unbox(Type type)
If the argument is a primitive class, replaces the object on the top of the stack with the unwrapped (primitive) equivalent. For example, Character -> char.

Parameters: type the class indicating the desired type of the top stack value

Returns: true if the value was unboxed

unbox_or_zero

public void unbox_or_zero(Type type)
Unboxes the object on the top of the stack. If the object is null, the unboxed primitive value becomes zero.

visitMaxs

public void visitMaxs(int maxStack, int maxLocals)

zero_or_null

public void zero_or_null(Type type)
Pushes a zero onto the stack if the argument is a primitive class, or a null otherwise.
Copyright (c) 2001 - Apache Software Foundation