List of usage examples for org.objectweb.asm.util Printer OPCODES
String[] OPCODES
To view the source code for org.objectweb.asm.util Printer OPCODES.
Click Source Link
From source file:com.friz.instruction.utility.InstructionUtil.java
License:Open Source License
/** * Reads the value of a numeric push instruction (which can be an * {@code ICONST_*} instruction, an {@code BIPUSH} instruction, an * {@code SIPUSH} instruction or a {@code LDC_*} instruction. * /*w w w . ja v a 2 s . com*/ * @param push * The instruction node. * @return The numeric value. */ public static Number getNumericPush(AbstractInsnNode push) { if (push instanceof InsnNode) { switch (push.getOpcode()) { case ICONST_M1: return -1; case ICONST_0: return 0; case LCONST_0: return 0L; case FCONST_0: return 0.0F; case DCONST_0: return 0.0D; case ICONST_1: return 1; case LCONST_1: return 1L; case FCONST_1: return 1.0F; case DCONST_1: return 1.0D; case ICONST_2: return 2; case FCONST_2: return 2.0F; case ICONST_3: return 3; case ICONST_4: return 4; case ICONST_5: return 5; default: throw new AssertionError(Printer.OPCODES[push.getOpcode()]); } } else if (push instanceof IntInsnNode) { return ((IntInsnNode) push).operand; } else { return ((Number) ((LdcInsnNode) push).cst); } }
From source file:com.github.fge.grappa.transform.base.InstructionGraphNode.java
License:Open Source License
@Override public String toString() { return instruction.getOpcode() != -1 ? Printer.OPCODES[instruction.getOpcode()] : super.toString(); }
From source file:com.google.template.soy.jbcsrc.BytecodeUtils.java
License:Apache License
private static void checkIntComparisonOpcode(Type comparisonType, int opcode) { switch (opcode) { case Opcodes.IFEQ: case Opcodes.IFNE: return;//from www . j ava 2 s . c om case Opcodes.IFGT: case Opcodes.IFGE: case Opcodes.IFLT: case Opcodes.IFLE: if (comparisonType.getSort() == Type.ARRAY || comparisonType.getSort() == Type.OBJECT) { throw new IllegalArgumentException( "Type: " + comparisonType + " cannot be compared via " + Printer.OPCODES[opcode]); } return; } throw new IllegalArgumentException("Unsupported opcode for comparison operation: " + opcode); }
From source file:com.google.template.soy.jbcsrc.restricted.BytecodeUtils.java
License:Apache License
private static void checkIntComparisonOpcode(Type comparisonType, int opcode) { switch (opcode) { case Opcodes.IFEQ: case Opcodes.IFNE: return;//from ww w . java2 s .c o m case Opcodes.IFGT: case Opcodes.IFGE: case Opcodes.IFLT: case Opcodes.IFLE: if (comparisonType.getSort() == Type.ARRAY || comparisonType.getSort() == Type.OBJECT) { throw new IllegalArgumentException( "Type: " + comparisonType + " cannot be compared via " + Printer.OPCODES[opcode]); } return; default: throw new IllegalArgumentException("Unsupported opcode for comparison operation: " + opcode); } }
From source file:com.mebigfatguy.baremetal4j.Sourcifier.java
License:Apache License
public void visitInsn(int opcode) { lines.add("\t\tBCO = " + String.format("%05d", byteOffset) + "; // " + Printer.OPCODES[opcode]); byteOffset++;/* ww w . j a v a2 s . c om*/ }
From source file:com.mebigfatguy.baremetal4j.Sourcifier.java
License:Apache License
public void visitIntInsn(int opcode, int operand) { lines.add("\t\tBCO = " + String.format("%05d", byteOffset) + "; // " + Printer.OPCODES[opcode] + " " + operand);//w ww .ja va 2 s . co m byteOffset += (opcode == Opcodes.SIPUSH) ? 3 : 2; }
From source file:com.mebigfatguy.baremetal4j.Sourcifier.java
License:Apache License
public void visitVarInsn(int opcode, int var) { boolean isShortForm = var <= 3; lines.add("\t\tBCO = " + String.format("%05d", byteOffset) + "; // " + Printer.OPCODES[opcode] + (isShortForm ? "_" : " ") + var); byteOffset += isShortForm ? 1 : 2;// w w w . j a va2 s. c o m }
From source file:com.mebigfatguy.baremetal4j.Sourcifier.java
License:Apache License
public void visitTypeInsn(int opcode, String type) { lines.add("\t\tBCO = " + String.format("%05d", byteOffset) + "; // " + Printer.OPCODES[opcode] + " " + type.replace('/', '.')); byteOffset += 3;// w ww .j a v a 2 s. c om }
From source file:com.mebigfatguy.baremetal4j.Sourcifier.java
License:Apache License
public void visitFieldInsn(int opcode, String owner, String name, String desc) { lines.add("\t\tBCO = " + String.format("%05d", byteOffset) + "; // " + Printer.OPCODES[opcode] + " " + owner.replace('/', '.') + "." + name); byteOffset += 3;/* w w w. j ava2s . c om*/ }
From source file:com.mebigfatguy.baremetal4j.Sourcifier.java
License:Apache License
public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc, final boolean itf) { lines.add("\t\tBCO = " + String.format("%05d", byteOffset) + "; // " + Printer.OPCODES[opcode] + " " + owner.replace('/', '.') + "." + name + argumentSignature(desc) + " ===> " + methodReturnType(desc));//w w w .ja v a 2 s . c om byteOffset += 3; }