本文整理汇总了Java中org.objectweb.asm.Opcodes.BIPUSH属性的典型用法代码示例。如果您正苦于以下问题:Java Opcodes.BIPUSH属性的具体用法?Java Opcodes.BIPUSH怎么用?Java Opcodes.BIPUSH使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.objectweb.asm.Opcodes
的用法示例。
在下文中一共展示了Opcodes.BIPUSH属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitIntInsn
@Override
public void visitIntInsn(final int opcode, final int operand) {
checkStartCode();
checkEndCode();
checkOpcode(opcode, 1);
switch (opcode) {
case Opcodes.BIPUSH:
checkSignedByte(operand, "Invalid operand");
break;
case Opcodes.SIPUSH:
checkSignedShort(operand, "Invalid operand");
break;
// case Constants.NEWARRAY:
default:
if (operand < Opcodes.T_BOOLEAN || operand > Opcodes.T_LONG) {
throw new IllegalArgumentException(
"Invalid operand (must be an array type code T_...): "
+ operand);
}
}
super.visitIntInsn(opcode, operand);
++insnCount;
}
示例2: updateState
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());
}
}
示例3: build
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());
}
}
示例4: getPushInsn
static AbstractInsnNode getPushInsn(int value) {
if (value == -1) {
return new InsnNode(Opcodes.ICONST_M1);
} else if (value == 0) {
return new InsnNode(Opcodes.ICONST_0);
} else if (value == 1) {
return new InsnNode(Opcodes.ICONST_1);
} else if (value == 2) {
return new InsnNode(Opcodes.ICONST_2);
} else if (value == 3) {
return new InsnNode(Opcodes.ICONST_3);
} else if (value == 4) {
return new InsnNode(Opcodes.ICONST_4);
} else if (value == 5) {
return new InsnNode(Opcodes.ICONST_5);
} else if ((value >= -128) && (value <= 127)) {
return new IntInsnNode(Opcodes.BIPUSH, value);
} else if ((value >= -32768) && (value <= 32767)) {
return new IntInsnNode(Opcodes.SIPUSH, value);
} else {
return new LdcInsnNode(value);
}
}
示例5: isSimpleConstant
private static boolean isSimpleConstant(Object previousInstructionObject) {
// CHECKSTYLE:OFF
final AbstractInsnNode previousInstruction = (AbstractInsnNode) previousInstructionObject;
// CHECKSTYLE:ON
final int opcode = previousInstruction.getOpcode();
return (opcode >= Opcodes.ACONST_NULL && opcode <= Opcodes.DCONST_1
|| opcode == Opcodes.SIPUSH || opcode == Opcodes.BIPUSH)
&& (previousInstruction instanceof InsnNode
|| previousInstruction instanceof IntInsnNode);
}
示例6: visitIntInsn
/**
* Imports instructions with a single integer operand (byte push, short push
* and allocation of primitive arrays).
*
* @param opcode Opcode.
* @param operand Integer operand.
*/
@Override
public void visitIntInsn(final int opcode, final int operand) {
switch(opcode) {
// Constants
case Opcodes.BIPUSH: createConstant(new Byte((byte) operand)); break;
case Opcodes.SIPUSH: createConstant(new Short((short) operand)); break;
// New Array (Primitive)
case Opcodes.NEWARRAY:
Type type = null;
switch(operand) {
case Opcodes.T_BOOLEAN: type = Type.BOOL; break;
case Opcodes.T_CHAR: type = Type.CHAR; break;
case Opcodes.T_FLOAT: type = Type.FLOAT; break;
case Opcodes.T_DOUBLE: type = Type.DOUBLE; break;
case Opcodes.T_BYTE: type = Type.BYTE; break;
case Opcodes.T_SHORT: type = Type.SHORT; break;
case Opcodes.T_INT: type = Type.INT; break;
case Opcodes.T_LONG: type = Type.LONG; break;
}
ordered.add(stack.push(new NewArray(type, stack.pop())));
break;
}
}
示例7: visitIntInsn
@Override
public void visitIntInsn(final int opcode, final int operand) {
switch (opcode) {
case Opcodes.BIPUSH:
iconst(operand);
break;
case Opcodes.SIPUSH:
iconst(operand);
break;
case Opcodes.NEWARRAY:
switch (operand) {
case Opcodes.T_BOOLEAN:
newarray(Type.BOOLEAN_TYPE);
break;
case Opcodes.T_CHAR:
newarray(Type.CHAR_TYPE);
break;
case Opcodes.T_BYTE:
newarray(Type.BYTE_TYPE);
break;
case Opcodes.T_SHORT:
newarray(Type.SHORT_TYPE);
break;
case Opcodes.T_INT:
newarray(Type.INT_TYPE);
break;
case Opcodes.T_FLOAT:
newarray(Type.FLOAT_TYPE);
break;
case Opcodes.T_LONG:
newarray(Type.LONG_TYPE);
break;
case Opcodes.T_DOUBLE:
newarray(Type.DOUBLE_TYPE);
break;
default:
throw new IllegalArgumentException();
}
break;
default:
throw new IllegalArgumentException();
}
}