List of usage examples for org.objectweb.asm Opcodes T_SHORT
int T_SHORT
To view the source code for org.objectweb.asm Opcodes T_SHORT.
Click Source Link
From source file:asmlib.Type.java
License:Open Source License
public static Type fromOpcode(int opcode) { char type;/* w ww . java 2 s .c om*/ switch (opcode) { case Opcodes.T_BOOLEAN: type = 'Z'; break; case Opcodes.T_BYTE: type = 'B'; break; case Opcodes.T_CHAR: type = 'C'; break; case Opcodes.T_SHORT: type = 'S'; break; case Opcodes.T_INT: type = 'I'; break; case Opcodes.T_LONG: type = 'J'; break; case Opcodes.T_FLOAT: type = 'F'; break; case Opcodes.T_DOUBLE: type = 'D'; break; default: throw new InstrumentationException("Unknown or invalid bytecode type"); } return Type.fromBytecode(type); }
From source file:bytecode.InstructionExporter.java
License:Apache License
/** * Output instructions for allocating arrays, both for primitive and * reference types.// ww w . j av a 2s. c om * * @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; }
From source file:bytecode.MethodImporter.java
License:Apache License
/** * Imports instructions with a single integer operand (byte push, short push * and allocation of primitive arrays).//from w w w . j a v a 2 s . co m * * @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; } }
From source file:cl.inria.stiq.instrumenter.BCIUtils.java
License:Open Source License
/** * Returns the primitive type that corresponds to the given operand * /*w ww .j av a2 s.co m*/ * @param aOperand * {@link Opcodes#T_BOOLEAN} etc. */ public static PrimitiveTypeInfo getPrimitiveType(int aOperand) { switch (aOperand) { case Opcodes.T_BOOLEAN: return PrimitiveTypeInfo.BOOLEAN; case Opcodes.T_BYTE: return PrimitiveTypeInfo.BYTE; case Opcodes.T_CHAR: return PrimitiveTypeInfo.CHAR; case Opcodes.T_DOUBLE: return PrimitiveTypeInfo.DOUBLE; case Opcodes.T_FLOAT: return PrimitiveTypeInfo.FLOAT; case Opcodes.T_INT: return PrimitiveTypeInfo.INT; case Opcodes.T_LONG: return PrimitiveTypeInfo.LONG; case Opcodes.T_SHORT: return PrimitiveTypeInfo.SHORT; default: return null; } }
From source file:com.devexperts.aprof.transformer.AbstractMethodVisitor.java
License:Open Source License
@Override public void visitIntInsn(final int opcode, final int operand) { if (opcode == Opcodes.NEWARRAY && !context.isIntrinsicArraysCopyOf()) { String arrayDesc;//from w ww. j av a2s . co m switch (operand) { case Opcodes.T_BOOLEAN: arrayDesc = BOOLEAN_ARR_T_DESC; break; case Opcodes.T_CHAR: arrayDesc = CHAR_ARR_T_DESC; break; case Opcodes.T_FLOAT: arrayDesc = FLOAT_ARR_T_DESC; break; case Opcodes.T_DOUBLE: arrayDesc = DOUBLE_ARR_T_DESC; break; case Opcodes.T_BYTE: arrayDesc = BYTE_ARR_T_DESC; break; case Opcodes.T_SHORT: arrayDesc = SHORT_ARR_T_DESC; break; case Opcodes.T_INT: arrayDesc = INT_ARR_T_DESC; break; case Opcodes.T_LONG: arrayDesc = LONG_ARR_T_DESC; break; default: assert false; // should not happen return; } visitAllocateArrayBefore(arrayDesc); mv.visitIntInsn(opcode, operand); visitAllocateArrayAfter(arrayDesc); } else mv.visitIntInsn(opcode, operand); }
From source file:com.github.anba.es6draft.compiler.assembler.InstructionAssembler.java
License:Open Source License
private static final int arrayType(Type type) { switch (type.getSort()) { case Type.Sort.BOOLEAN: return Opcodes.T_BOOLEAN; case Type.Sort.CHAR: return Opcodes.T_CHAR; case Type.Sort.BYTE: return Opcodes.T_BYTE; case Type.Sort.SHORT: return Opcodes.T_SHORT; case Type.Sort.INT: return Opcodes.T_INT; case Type.Sort.FLOAT: return Opcodes.T_FLOAT; case Type.Sort.LONG: return Opcodes.T_LONG; case Type.Sort.DOUBLE: return Opcodes.T_DOUBLE; case Type.Sort.OBJECT: case Type.Sort.ARRAY: case Type.Sort.METHOD: case Type.Sort.VOID: default:/*from w w w .java2 s . c om*/ throw new IllegalArgumentException(); } }
From source file:com.google.devtools.build.android.desugar.BytecodeTypeInference.java
License:Open Source License
@Override public void visitIntInsn(int opcode, int operand) { switch (opcode) { case Opcodes.BIPUSH: case Opcodes.SIPUSH: push(InferredType.INT);/*from www. j a v a2 s .com*/ break; case Opcodes.NEWARRAY: pop(); switch (operand) { case Opcodes.T_BOOLEAN: pushDescriptor("[Z"); break; case Opcodes.T_CHAR: pushDescriptor("[C"); break; case Opcodes.T_FLOAT: pushDescriptor("[F"); break; case Opcodes.T_DOUBLE: pushDescriptor("[D"); break; case Opcodes.T_BYTE: pushDescriptor("[B"); break; case Opcodes.T_SHORT: pushDescriptor("[S"); break; case Opcodes.T_INT: pushDescriptor("[I"); break; case Opcodes.T_LONG: pushDescriptor("[J"); break; default: throw new RuntimeException("Unhandled operand value: " + operand); } break; default: throw new RuntimeException("Unhandled opcode " + opcode); } super.visitIntInsn(opcode, operand); }
From source file:com.google.test.metric.asm.MethodVisitorBuilder.java
License:Apache License
private Type toType(int operand) { switch (operand) { case Opcodes.T_BOOLEAN: return JavaType.BOOLEAN; case Opcodes.T_BYTE: return JavaType.BYTE; case Opcodes.T_CHAR: return JavaType.CHAR; case Opcodes.T_DOUBLE: return JavaType.DOUBLE; case Opcodes.T_FLOAT: return JavaType.FLOAT; case Opcodes.T_INT: return JavaType.INT; case Opcodes.T_LONG: return JavaType.LONG; case Opcodes.T_SHORT: return JavaType.SHORT; default:/* w ww .j a v a 2s .c o m*/ throw new IllegalArgumentException(); } }
From source file:com.yahoo.yqlplus.engine.internal.compiler.CodeEmitter.java
public void emitNewArray(TypeWidget elementType, BytecodeExpression e) { MethodVisitor mv = getMethodVisitor(); exec(e);/*from w w w . ja v a 2s . co m*/ cast(BaseTypeAdapter.INT32, e.getType()); switch (elementType.getJVMType().getSort()) { case Type.BYTE: mv.visitIntInsn(Opcodes.NEWARRAY, Opcodes.T_BYTE); break; case Type.BOOLEAN: mv.visitIntInsn(Opcodes.NEWARRAY, Opcodes.T_BOOLEAN); break; case Type.SHORT: mv.visitIntInsn(Opcodes.NEWARRAY, Opcodes.T_SHORT); break; case Type.INT: mv.visitIntInsn(Opcodes.NEWARRAY, Opcodes.T_INT); break; case Type.CHAR: mv.visitIntInsn(Opcodes.NEWARRAY, Opcodes.T_CHAR); break; case Type.FLOAT: mv.visitIntInsn(Opcodes.NEWARRAY, Opcodes.T_FLOAT); break; case Type.LONG: mv.visitIntInsn(Opcodes.NEWARRAY, Opcodes.T_LONG); break; case Type.DOUBLE: mv.visitIntInsn(Opcodes.NEWARRAY, Opcodes.T_DOUBLE); break; case Type.OBJECT: mv.visitTypeInsn(Opcodes.ANEWARRAY, elementType.getJVMType().getInternalName()); break; default: throw new UnsupportedOperationException("unknown sort for newArray" + elementType.getJVMType()); } }
From source file:de.tuberlin.uebb.jbop.optimizer.ClassNodeBuilder.java
License:Open Source License
private int getSort(final Type type) { final int sort = type.getSort(); switch (sort) { case Type.INT: return Opcodes.T_INT; case Type.FLOAT: return Opcodes.T_FLOAT; case Type.LONG: return Opcodes.T_LONG; case Type.DOUBLE: return Opcodes.T_DOUBLE; case Type.SHORT: return Opcodes.T_SHORT; case Type.CHAR: return Opcodes.T_CHAR; case Type.BOOLEAN: return Opcodes.T_BOOLEAN; case Type.BYTE: return Opcodes.T_BYTE; default:/* w w w .java 2 s.c om*/ return -1; } }