本文整理汇总了Java中scouter.javassist.bytecode.Bytecode.addLconst方法的典型用法代码示例。如果您正苦于以下问题:Java Bytecode.addLconst方法的具体用法?Java Bytecode.addLconst怎么用?Java Bytecode.addLconst使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scouter.javassist.bytecode.Bytecode
的用法示例。
在下文中一共展示了Bytecode.addLconst方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compile
import scouter.javassist.bytecode.Bytecode; //导入方法依赖的package包/类
int compile(Bytecode code) throws CannotCompileException {
code.addLconst(param);
return 2;
}
示例2: insertAfterHandler
import scouter.javassist.bytecode.Bytecode; //导入方法依赖的package包/类
private int insertAfterHandler(boolean asFinally, Bytecode b,
CtClass rtype, int returnVarNo,
Javac javac, String src)
throws CompileError
{
if (!asFinally)
return 0;
int var = b.getMaxLocals();
b.incMaxLocals(1);
int pc = b.currentPc();
b.addAstore(var); // store an exception
if (rtype.isPrimitive()) {
char c = ((CtPrimitiveType)rtype).getDescriptor();
if (c == 'D') {
b.addDconst(0.0);
b.addDstore(returnVarNo);
}
else if (c == 'F') {
b.addFconst(0);
b.addFstore(returnVarNo);
}
else if (c == 'J') {
b.addLconst(0);
b.addLstore(returnVarNo);
}
else if (c == 'V') {
b.addOpcode(Opcode.ACONST_NULL);
b.addAstore(returnVarNo);
}
else { // int, boolean, char, short, ...
b.addIconst(0);
b.addIstore(returnVarNo);
}
}
else {
b.addOpcode(Opcode.ACONST_NULL);
b.addAstore(returnVarNo);
}
javac.compileStmnt(src);
b.addAload(var);
b.addOpcode(Opcode.ATHROW);
return b.currentPc() - pc;
}
示例3: addClassInitializer
import scouter.javassist.bytecode.Bytecode; //导入方法依赖的package包/类
private static void addClassInitializer(ClassFile cf, ConstPool cp,
String classname, int size, ArrayList forwarders)
throws CannotCompileException
{
FieldInfo finfo = new FieldInfo(cp, HOLDER, HOLDER_TYPE);
finfo.setAccessFlags(AccessFlag.PRIVATE | AccessFlag.STATIC);
cf.addField(finfo);
MethodInfo minfo = new MethodInfo(cp, "<clinit>", "()V");
minfo.setAccessFlags(AccessFlag.STATIC);
setThrows(minfo, cp, new Class[] { ClassNotFoundException.class });
Bytecode code = new Bytecode(cp, 0, 2);
code.addIconst(size * 2);
code.addAnewarray("java.lang.reflect.Method");
final int varArray = 0;
code.addAstore(varArray);
// forName() must be called here. Otherwise, the class might be
// invisible.
code.addLdc(classname);
code.addInvokestatic("java.lang.Class",
"forName", "(Ljava/lang/String;)Ljava/lang/Class;");
final int varClass = 1;
code.addAstore(varClass);
Iterator it = forwarders.iterator();
while (it.hasNext()) {
Find2MethodsArgs args = (Find2MethodsArgs)it.next();
callFind2Methods(code, args.methodName, args.delegatorName,
args.origIndex, args.descriptor, varClass, varArray);
}
code.addAload(varArray);
code.addPutstatic(classname, HOLDER, HOLDER_TYPE);
code.addLconst(SERIAL_VERSION_UID_VALUE);
code.addPutstatic(classname, SERIAL_VERSION_UID_FIELD, SERIAL_VERSION_UID_TYPE);
code.addOpcode(Bytecode.RETURN);
minfo.setCodeAttribute(code.toCodeAttribute());
cf.addMethod(minfo);
}