本文整理汇总了Java中org.objectweb.asm.Opcodes.T_INT属性的典型用法代码示例。如果您正苦于以下问题:Java Opcodes.T_INT属性的具体用法?Java Opcodes.T_INT怎么用?Java Opcodes.T_INT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.objectweb.asm.Opcodes
的用法示例。
在下文中一共展示了Opcodes.T_INT属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: arrayTypeDesc
private static String arrayTypeDesc(int arrayTypeCode) {
switch (arrayTypeCode) {
case Opcodes.T_BOOLEAN:
return "[Z";
case Opcodes.T_CHAR:
return "[C";
case Opcodes.T_FLOAT:
return "[F";
case Opcodes.T_DOUBLE:
return "[D";
case Opcodes.T_BYTE:
return "[B";
case Opcodes.T_SHORT:
return "[S";
case Opcodes.T_INT:
return "[I";
case Opcodes.T_LONG:
return "[J";
default:
throw new Unreachable("Unexpected array-type code " + arrayTypeCode);
}
}
示例2: newarray
public void newarray(final Type type) {
int typ;
switch (type.getSort()) {
case Type.BOOLEAN:
typ = Opcodes.T_BOOLEAN;
break;
case Type.CHAR:
typ = Opcodes.T_CHAR;
break;
case Type.BYTE:
typ = Opcodes.T_BYTE;
break;
case Type.SHORT:
typ = Opcodes.T_SHORT;
break;
case Type.INT:
typ = Opcodes.T_INT;
break;
case Type.FLOAT:
typ = Opcodes.T_FLOAT;
break;
case Type.LONG:
typ = Opcodes.T_LONG;
break;
case Type.DOUBLE:
typ = Opcodes.T_DOUBLE;
break;
default:
mv.visitTypeInsn(Opcodes.ANEWARRAY, type.getInternalName());
return;
}
mv.visitIntInsn(Opcodes.NEWARRAY, typ);
}
示例3: newArray
/**
* Generates the instruction to create a new array.
*
* @param type
* the type of the array elements.
*/
public void newArray(final Type type) {
int typ;
switch (type.getSort()) {
case Type.BOOLEAN:
typ = Opcodes.T_BOOLEAN;
break;
case Type.CHAR:
typ = Opcodes.T_CHAR;
break;
case Type.BYTE:
typ = Opcodes.T_BYTE;
break;
case Type.SHORT:
typ = Opcodes.T_SHORT;
break;
case Type.INT:
typ = Opcodes.T_INT;
break;
case Type.FLOAT:
typ = Opcodes.T_FLOAT;
break;
case Type.LONG:
typ = Opcodes.T_LONG;
break;
case Type.DOUBLE:
typ = Opcodes.T_DOUBLE;
break;
default:
typeInsn(Opcodes.ANEWARRAY, type);
return;
}
mv.visitIntInsn(Opcodes.NEWARRAY, typ);
}
示例4: 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;
}
}
示例5: visit
/**
* Output instructions for allocating arrays, both for primitive and
* reference types.
*
* @param instruction Array allocation instruction.
* @return <code>null</code>
*/
@Override
public Void visit(NewArray instruction) {
if(instruction.getElementType().getSort() == Type.Sort.REF) {
mv.visitTypeInsn(
Opcodes.ANEWARRAY,
instruction.getElementType().getInternalName()
);
} else {
int type;
switch(instruction.getElementType().getSort()) {
case BOOL: type = Opcodes.T_BOOLEAN; break;
case CHAR: type = Opcodes.T_CHAR; break;
case FLOAT: type = Opcodes.T_FLOAT; break;
case DOUBLE: type = Opcodes.T_DOUBLE; break;
case BYTE: type = Opcodes.T_BYTE; break;
case SHORT: type = Opcodes.T_SHORT; break;
case INT: type = Opcodes.T_INT; break;
case LONG: type = Opcodes.T_LONG; break;
default: throw new RuntimeException("Unknown array element type");
}
mv.visitIntInsn(Opcodes.NEWARRAY, type);
}
return null;
}
示例6: 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();
}
}