本文整理汇总了Java中org.objectweb.asm.tree.IntInsnNode.getOpcode方法的典型用法代码示例。如果您正苦于以下问题:Java IntInsnNode.getOpcode方法的具体用法?Java IntInsnNode.getOpcode怎么用?Java IntInsnNode.getOpcode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.objectweb.asm.tree.IntInsnNode
的用法示例。
在下文中一共展示了IntInsnNode.getOpcode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateState
import org.objectweb.asm.tree.IntInsnNode; //导入方法依赖的package包/类
private void updateState(IntInsnNode insn) {
switch (insn.getOpcode()) {
case Opcodes.BIPUSH:
case Opcodes.SIPUSH: {
state.push(Type.INT_TYPE);
break;
}
case Opcodes.NEWARRAY: {
String desc = arrayTypeDesc(insn.operand);
Type type = Type.getType(desc);
state.pop();
state.push(type);
break;
}
default:
throw new Unreachable("Unexpected IntInsn opcode: " + insn.getOpcode());
}
}
示例2: build
import org.objectweb.asm.tree.IntInsnNode; //导入方法依赖的package包/类
private void build(IntInsnNode insn, IRBuilder builder) {
switch (insn.getOpcode()) {
case Opcodes.BIPUSH:
case Opcodes.SIPUSH: {
int dest = state.push(Type.INT_TYPE);
builder.addIntConst(dest, insn.operand);
break;
}
case Opcodes.NEWARRAY: {
String desc = arrayTypeDesc(insn.operand);
Type type = Type.getType(desc);
DexType dexType = application.getTypeFromDescriptor(desc);
int count = state.pop(Type.INT_TYPE).register;
int array = state.push(type);
builder.addNewArrayEmpty(array, count, dexType);
break;
}
default:
throw new Unreachable("Unexpected IntInsn opcode: " + insn.getOpcode());
}
}
示例3: readIntInstruction
import org.objectweb.asm.tree.IntInsnNode; //导入方法依赖的package包/类
/**
* Reads the given {@link IntInsnNode} instruction and adds the associated {@link Expression} to
* the given {@link Stack}.
*
* @param intInsnNode the instruction to read
* @param expressionStack the expression stack to put on or pop from.
* @param localVariables the local variables
*/
private static void readIntInstruction(final IntInsnNode intInsnNode,
final Stack<Expression> expressionStack, final LocalVariables localVariables) {
switch (intInsnNode.getOpcode()) {
case Opcodes.BIPUSH:
// expressionStack.add(LiteralFactory.getLiteral(intInsnNode.operand,
// expressionStack.peek()));
final Expression literal = new NumberLiteral(intInsnNode.operand);
LOGGER.trace("Stacking literal {}", literal);
expressionStack.add(literal);
break;
default:
LOGGER.warn("IntInsnNode with OpCode {} was ignored.", intInsnNode.getOpcode());
}
}
示例4: convertIntInsn
import org.objectweb.asm.tree.IntInsnNode; //导入方法依赖的package包/类
private void convertIntInsn(IntInsnNode insn) {
int op = insn.getOpcode();
StackFrame frame = getFrame(insn);
Operand[] out = frame.out();
Operand opr;
if (out == null) {
Value v;
if (op == BIPUSH || op == SIPUSH) {
v = IntConstant.v(insn.operand);
} else {
Type type;
switch (insn.operand) {
case T_BOOLEAN:
type = BooleanType.v();
break;
case T_CHAR:
type = CharType.v();
break;
case T_FLOAT:
type = FloatType.v();
break;
case T_DOUBLE:
type = DoubleType.v();
break;
case T_BYTE:
type = ByteType.v();
break;
case T_SHORT:
type = ShortType.v();
break;
case T_INT:
type = IntType.v();
break;
case T_LONG:
type = LongType.v();
break;
default:
throw new AssertionError("Unknown NEWARRAY type!");
}
Operand size = popImmediate();
NewArrayExpr anew = Jimple.v().newNewArrayExpr(type, size.stackOrValue());
size.addBox(anew.getSizeBox());
frame.in(size);
frame.boxes(anew.getSizeBox());
v = anew;
}
opr = new Operand(insn, v);
frame.out(opr);
} else {
opr = out[0];
if (op == NEWARRAY)
frame.mergeIn(pop());
}
push(opr);
}
示例5: interpret
import org.objectweb.asm.tree.IntInsnNode; //导入方法依赖的package包/类
private void interpret(IntInsnNode insn, FrameState frame, BBInfo block) {
int operand = insn.operand;
switch (insn.getOpcode()) {
case Opcodes.BIPUSH:
case Opcodes.SIPUSH:
frame.stack.push(module.constants().getSmallestIntConstant(insn.operand));
break;
case Opcodes.NEWARRAY:
ArrayType t;
switch (operand) {
case Opcodes.T_BOOLEAN:
t = module.types().getArrayType(boolean[].class);
break;
case Opcodes.T_BYTE:
t = module.types().getArrayType(byte[].class);
break;
case Opcodes.T_CHAR:
t = module.types().getArrayType(char[].class);
break;
case Opcodes.T_SHORT:
t = module.types().getArrayType(short[].class);
break;
case Opcodes.T_INT:
t = module.types().getArrayType(int[].class);
break;
case Opcodes.T_LONG:
t = module.types().getArrayType(long[].class);
break;
case Opcodes.T_FLOAT:
t = module.types().getArrayType(float[].class);
break;
case Opcodes.T_DOUBLE:
t = module.types().getArrayType(double[].class);
break;
default:
throw new AssertionError(operand);
}
NewArrayInst i = new NewArrayInst(t, frame.stack.pop());
block.block.instructions().add(i);
frame.stack.push(i);
break;
default:
throw new UnsupportedOperationException(""+insn.getOpcode());
}
}