本文整理匯總了Java中org.objectweb.asm.Opcodes.T_CHAR屬性的典型用法代碼示例。如果您正苦於以下問題:Java Opcodes.T_CHAR屬性的具體用法?Java Opcodes.T_CHAR怎麽用?Java Opcodes.T_CHAR使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.objectweb.asm.Opcodes
的用法示例。
在下文中一共展示了Opcodes.T_CHAR屬性的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();
}
}