本文整理了Java中javassist.bytecode.Bytecode.addIndex()
方法的一些代码示例,展示了Bytecode.addIndex()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytecode.addIndex()
方法的具体详情如下:
包路径:javassist.bytecode.Bytecode
类名称:Bytecode
方法名:addIndex
[英]Appends a 16bit value to the end of the bytecode sequence. It never changes the current stack depth.
[中]将16位值追加到字节码序列的末尾。它从不更改当前堆栈深度。
代码示例来源:origin: redisson/redisson
private void jsrJmp(Bytecode b) {
b.addOpcode(Opcode.GOTO);
jsrList.add(new int[] {b.currentPc(), var});
b.addIndex(0);
}
代码示例来源:origin: redisson/redisson
/**
* Appends CHECKCAST.
*
* @param classname a fully-qualified class name.
*/
public void addCheckcast(String classname) {
addOpcode(CHECKCAST);
addIndex(constPool.addClassInfo(classname));
}
代码示例来源:origin: redisson/redisson
/**
* Appends ANEWARRAY.
*
* @param classname the qualified class name of the element type.
*/
public void addAnewarray(String classname) {
addOpcode(ANEWARRAY);
addIndex(constPool.addClassInfo(classname));
}
代码示例来源:origin: redisson/redisson
/**
* Appends CHECKCAST.
*
* @param c the type.
*/
public void addCheckcast(CtClass c) {
addOpcode(CHECKCAST);
addIndex(constPool.addClassInfo(c));
}
代码示例来源:origin: redisson/redisson
/**
* Appends INSTANCEOF.
*
* @param classname the class name.
*/
public void addInstanceof(String classname) {
addOpcode(INSTANCEOF);
addIndex(constPool.addClassInfo(classname));
}
代码示例来源:origin: redisson/redisson
/**
* Appends NEW.
*
* @param clazz the class of the created instance.
*/
public void addNew(CtClass clazz) {
addOpcode(NEW);
addIndex(constPool.addClassInfo(clazz));
}
代码示例来源:origin: redisson/redisson
/**
* Appends LDC2_W. The pushed item is a long value.
*/
public void addLdc2w(long l) {
addOpcode(LDC2_W);
addIndex(constPool.addLongInfo(l));
}
代码示例来源:origin: redisson/redisson
/**
* Appends LDC2_W. The pushed item is a double value.
*/
public void addLdc2w(double d) {
addOpcode(LDC2_W);
addIndex(constPool.addDoubleInfo(d));
}
代码示例来源:origin: redisson/redisson
/**
* Appends NEW.
*
* @param classname the fully-qualified class name.
*/
public void addNew(String classname) {
addOpcode(NEW);
addIndex(constPool.addClassInfo(classname));
}
代码示例来源:origin: redisson/redisson
private void atBreakStmnt(Stmnt st, boolean notCont)
throws CompileError
{
if (st.head() != null)
throw new CompileError(
"sorry, not support labeled break or continue");
bytecode.addOpcode(Opcode.GOTO);
Integer pc = new Integer(bytecode.currentPc());
bytecode.addIndex(0);
if (notCont)
breakList.add(pc);
else
continueList.add(pc);
}
代码示例来源:origin: redisson/redisson
/**
* Appends ICONST and ANEWARRAY.
*
* @param clazz the elememnt type.
* @param length the array length.
*/
public void addAnewarray(CtClass clazz, int length) {
addIconst(length);
addOpcode(ANEWARRAY);
addIndex(constPool.addClassInfo(clazz));
}
代码示例来源:origin: redisson/redisson
public void doit(JvstCodeGen gen, Bytecode bytecode, ASTList args)
throws CompileError
{
bytecode.addOpcode(NEW);
bytecode.addIndex(newIndex);
bytecode.addOpcode(DUP);
gen.atMethodCallCore(newType, MethodInfo.nameInit, args,
false, true, -1, null);
gen.setType(newType);
}
代码示例来源:origin: redisson/redisson
/**
* Appends MULTINEWARRAY.
*
* @param desc the type descriptor of the created array.
* @param dim dimensions.
* @return the value of <code>dim</code>.
*/
public int addMultiNewarray(String desc, int dim) {
add(MULTIANEWARRAY);
addIndex(constPool.addClassInfo(desc));
add(dim);
growStack(1 - dim);
return dim;
}
代码示例来源:origin: redisson/redisson
public void doit(JvstCodeGen gen, Bytecode bytecode, ASTList args)
throws CompileError
{
if (gen.getMethodArgsLength(args) != 1)
throw new CompileError(Javac.proceedName
+ "() cannot take more than one parameter "
+ "for cast");
gen.atMethodArgs(args, new int[1], new int[1], new String[1]);
bytecode.addOpcode(Opcode.CHECKCAST);
bytecode.addIndex(index);
gen.setType(retType);
}
代码示例来源:origin: redisson/redisson
private void addInvokestatic(int clazz, String name, String desc,
boolean isInterface) {
add(INVOKESTATIC);
int index;
if (isInterface)
index = constPool.addInterfaceMethodrefInfo(clazz, name, desc);
else
index = constPool.addMethodrefInfo(clazz, name, desc);
addIndex(index);
growStack(Descriptor.dataSize(desc));
}
代码示例来源:origin: redisson/redisson
public void doit(JvstCodeGen gen, Bytecode bytecode, ASTList args)
throws CompileError
{
if (gen.getMethodArgsLength(args) != 1)
throw new CompileError(Javac.proceedName
+ "() cannot take more than one parameter "
+ "for instanceof");
gen.atMethodArgs(args, new int[1], new int[1], new String[1]);
bytecode.addOpcode(Opcode.INSTANCEOF);
bytecode.addIndex(index);
gen.setType(CtClass.booleanType);
}
代码示例来源:origin: redisson/redisson
/**
* Appends GETSTATIC.
*
* @param c the class
* @param name the field name
* @param type the descriptor of the field type.
*
* @see Descriptor#of(CtClass)
*/
public void addGetstatic(CtClass c, String name, String type) {
add(GETSTATIC);
int ci = constPool.addClassInfo(c);
addIndex(constPool.addFieldrefInfo(ci, name, type));
growStack(Descriptor.dataSize(type));
}
代码示例来源:origin: redisson/redisson
/**
* Appends GETFIELD.
*
* @param c the class.
* @param name the field name.
* @param type the descriptor of the field type.
*
* @see Descriptor#of(CtClass)
*/
public void addGetfield(CtClass c, String name, String type) {
add(GETFIELD);
int ci = constPool.addClassInfo(c);
addIndex(constPool.addFieldrefInfo(ci, name, type));
growStack(Descriptor.dataSize(type) - 1);
}
代码示例来源:origin: redisson/redisson
private void addPutstatic0(CtClass target, String classname,
String fieldName, String desc) {
add(PUTSTATIC);
// target is null if it represents THIS.
int ci = classname == null ? constPool.addClassInfo(target)
: constPool.addClassInfo(classname);
addIndex(constPool.addFieldrefInfo(ci, fieldName, desc));
growStack(-Descriptor.dataSize(desc));
}
代码示例来源:origin: redisson/redisson
private void addPutfield0(CtClass target, String classname,
String name, String desc) {
add(PUTFIELD);
// target is null if it represents THIS.
int ci = classname == null ? constPool.addClassInfo(target)
: constPool.addClassInfo(classname);
addIndex(constPool.addFieldrefInfo(ci, name, desc));
growStack(-1 - Descriptor.dataSize(desc));
}
内容来源于网络,如有侵权,请联系作者删除!