List of usage examples for org.objectweb.asm Opcodes ACONST_NULL
int ACONST_NULL
To view the source code for org.objectweb.asm Opcodes ACONST_NULL.
Click Source Link
From source file:com.codename1.tools.translator.bytecodes.BasicInstruction.java
License:Open Source License
@Override public boolean assignTo(String varName, StringBuilder sb) { StringBuilder b = new StringBuilder(); //StringBuilder b2 = new StringBuilder(); //if (typeVarName != null) { // b2.append(typeVarName).append(" = "); // /* w w w .j a va 2 s .c o m*/ //} if (varName != null) { b.append(varName).append(" = "); } switch (opcode) { case Opcodes.ACONST_NULL: b.append("JAVA_NULL /* ACONST_NULL */"); //b2.append("CN1_TYPE_OBJECT"); break; case Opcodes.ICONST_M1: b.append("-1 /* ICONST_M1 */"); //b2.append("CN1_TYPE_INT"); break; case Opcodes.ICONST_0: b.append("0 /* ICONST_0 */"); //b2.append("CN1_TYPE_INT"); break; case Opcodes.ICONST_1: b.append("1 /* ICONST_1 */"); //b2.append("CN1_TYPE_INT"); break; case Opcodes.ICONST_2: b.append("2 /* ICONST_2 */"); //b2.append("CN1_TYPE_INT"); break; case Opcodes.ICONST_3: b.append("3 /* ICONST_3 */"); //b2.append("CN1_TYPE_INT"); break; case Opcodes.ICONST_4: b.append("4/* ICONST_4 */"); //b2.append("CN1_TYPE_INT"); break; case Opcodes.ICONST_5: b.append("5 /* ICONST_5 */"); ///b2.append("CN1_TYPE_INT"); break; case Opcodes.LCONST_0: b.append("0 /* LCONST_0 */"); //b2.append("CN1_TYPE_LONG"); break; case Opcodes.LCONST_1: b.append("1 /* LCONST_1 */"); //b2.append("CN1_TYPE_LONG"); break; case Opcodes.FCONST_0: b.append("0 /* FCONST_0 */"); //b2.append("CN1_TYPE_FLOAT"); break; case Opcodes.FCONST_1: b.append("1 /* FCONST_1 */"); //b2.append("CN1_TYPE_FLOAT"); break; case Opcodes.FCONST_2: b.append("2 /* FCONST_2 */"); //b2.append("CN1_TYPE_FLOAT"); break; case Opcodes.DCONST_0: b.append("0 /* DCONST_0 */"); //b2.append("CN1_TYPE_DOUBLE"); break; case Opcodes.DCONST_1: b.append("1 /* DCONST_1 */"); //b2.append("CN1_TYPE_DOUBLE"); break; // int instructions case Opcodes.SIPUSH: case Opcodes.BIPUSH: b.append(value); b.append("/* SIPUSH */"); //b2.append("CN1_TYPE_INT"); break; default: return false; } if (varName != null) { sb.append(" "); b.append("; \n"); } //if (typeVarName != null) { // sb.append(b2).append("; "); //} sb.append(b); return true; }
From source file:com.codename1.tools.translator.Util.java
License:Open Source License
public static char[] getStackInputTypes(Instruction instr) { char[] out = instr.getStackInputTypes(); if (out != null) { return out; }// ww w .j a v a 2s . co m switch (instr.getOpcode()) { case Opcodes.NOP: case Opcodes.ACONST_NULL: case Opcodes.ICONST_M1: case Opcodes.ICONST_0: case Opcodes.ICONST_2: case Opcodes.ICONST_3: case Opcodes.ICONST_4: case Opcodes.ICONST_5: case Opcodes.LCONST_0: case Opcodes.LCONST_1: case Opcodes.FCONST_0: case Opcodes.FCONST_1: case Opcodes.FCONST_2: case Opcodes.DCONST_0: case Opcodes.DCONST_1: case Opcodes.SIPUSH: case Opcodes.BIPUSH: return new char[0]; case Opcodes.BALOAD: case Opcodes.CALOAD: case Opcodes.IALOAD: case Opcodes.SALOAD: case Opcodes.LALOAD: case Opcodes.FALOAD: case Opcodes.DALOAD: case Opcodes.AALOAD: return new char[] { 'i', 'o' }; case Opcodes.BASTORE: case Opcodes.CASTORE: case Opcodes.SASTORE: case Opcodes.IASTORE: return new char[] { 'i', 'i', 'o' }; case Opcodes.LASTORE: return new char[] { 'l', 'i', 'o' }; case Opcodes.FASTORE: return new char[] { 'f', 'i', 'o' }; case Opcodes.DASTORE: return new char[] { 'd', 'i', 'o' }; case Opcodes.AASTORE: return new char[] { 'o', 'i', 'o' }; case Opcodes.POP: return new char[] { '*' }; case Opcodes.POP2: return new char[] { '*', '*' }; case Opcodes.DUP: return new char[] { '0' }; case Opcodes.DUP2: case Opcodes.DUP_X2: case Opcodes.DUP2_X2: return null; // DUP2 depends on the types on the stack so we don't statically know the input types case Opcodes.DUP_X1: case Opcodes.DUP2_X1: return new char[] { '0', '1' }; case Opcodes.SWAP: return new char[] { '0', '1' }; case Opcodes.IADD: case Opcodes.ISUB: case Opcodes.IMUL: case Opcodes.IDIV: case Opcodes.IREM: case Opcodes.ISHL: case Opcodes.ISHR: case Opcodes.IUSHR: case Opcodes.IAND: case Opcodes.IOR: case Opcodes.IXOR: return new char[] { 'i', 'i' }; case Opcodes.LADD: case Opcodes.LSUB: case Opcodes.LMUL: case Opcodes.LDIV: case Opcodes.LREM: case Opcodes.LSHL: case Opcodes.LSHR: case Opcodes.LAND: case Opcodes.LOR: case Opcodes.LXOR: case Opcodes.LCMP: return new char[] { 'l', 'l' }; case Opcodes.FADD: case Opcodes.FSUB: case Opcodes.FMUL: case Opcodes.FDIV: case Opcodes.FREM: case Opcodes.FCMPG: case Opcodes.FCMPL: return new char[] { 'f', 'f' }; case Opcodes.DADD: case Opcodes.DSUB: case Opcodes.DMUL: case Opcodes.DDIV: case Opcodes.DREM: case Opcodes.DCMPL: case Opcodes.DCMPG: return new char[] { 'd', 'd' }; case Opcodes.INEG: case Opcodes.I2L: case Opcodes.I2F: case Opcodes.I2D: case Opcodes.I2B: case Opcodes.I2C: case Opcodes.I2S: case Opcodes.NEWARRAY: return new char[] { 'i' }; case Opcodes.LNEG: case Opcodes.L2I: case Opcodes.L2F: case Opcodes.L2D: return new char[] { 'l' }; case Opcodes.FNEG: case Opcodes.F2I: case Opcodes.F2L: case Opcodes.F2D: return new char[] { 'f' }; case Opcodes.DNEG: case Opcodes.D2I: case Opcodes.D2L: case Opcodes.D2F: return new char[] { 'd' }; case Opcodes.LUSHR: return new char[] { 'i', 'l' }; case Opcodes.ARRAYLENGTH: case Opcodes.MONITORENTER: case Opcodes.MONITOREXIT: case Opcodes.ATHROW: return new char[] { 'o' }; default: return null; } }
From source file:com.codename1.tools.translator.Util.java
License:Open Source License
public static char[] getStackOutputTypes(Instruction instr) { char[] out = instr.getStackOutputTypes(); if (out != null) { return out; }/* w w w.j av a 2s . co m*/ switch (instr.getOpcode()) { case Opcodes.NOP: case Opcodes.BASTORE: case Opcodes.CASTORE: case Opcodes.SASTORE: case Opcodes.IASTORE: case Opcodes.LASTORE: case Opcodes.FASTORE: case Opcodes.DASTORE: case Opcodes.AASTORE: case Opcodes.POP: case Opcodes.POP2: case Opcodes.MONITORENTER: case Opcodes.MONITOREXIT: case Opcodes.ATHROW: return new char[0]; case Opcodes.ACONST_NULL: case Opcodes.AALOAD: case Opcodes.NEWARRAY: return new char[] { 'o' }; case Opcodes.ICONST_M1: case Opcodes.ICONST_0: case Opcodes.ICONST_1: case Opcodes.ICONST_2: case Opcodes.ICONST_3: case Opcodes.ICONST_4: case Opcodes.ICONST_5: case Opcodes.BALOAD: case Opcodes.CALOAD: case Opcodes.IALOAD: case Opcodes.SALOAD: case Opcodes.IADD: case Opcodes.ISUB: case Opcodes.IMUL: case Opcodes.IDIV: case Opcodes.IREM: case Opcodes.INEG: case Opcodes.ISHL: case Opcodes.ISHR: case Opcodes.IUSHR: case Opcodes.IAND: case Opcodes.IOR: case Opcodes.IXOR: case Opcodes.F2I: case Opcodes.D2I: case Opcodes.L2I: case Opcodes.I2C: case Opcodes.I2S: case Opcodes.LCMP: case Opcodes.FCMPG: case Opcodes.FCMPL: case Opcodes.DCMPL: case Opcodes.DCMPG: case Opcodes.ARRAYLENGTH: case Opcodes.SIPUSH: case Opcodes.BIPUSH: return new char[] { 'i' }; case Opcodes.LCONST_0: case Opcodes.LCONST_1: case Opcodes.LALOAD: case Opcodes.LADD: case Opcodes.LSUB: case Opcodes.LMUL: case Opcodes.LDIV: case Opcodes.LREM: case Opcodes.LNEG: case Opcodes.LSHL: case Opcodes.LSHR: case Opcodes.LUSHR: case Opcodes.LAND: case Opcodes.LOR: case Opcodes.LXOR: case Opcodes.I2L: case Opcodes.F2L: case Opcodes.D2L: return new char[] { 'l' }; case Opcodes.FCONST_0: case Opcodes.FCONST_1: case Opcodes.FCONST_2: case Opcodes.FALOAD: case Opcodes.FADD: case Opcodes.FSUB: case Opcodes.FMUL: case Opcodes.FDIV: case Opcodes.FREM: case Opcodes.FNEG: case Opcodes.I2F: case Opcodes.D2F: case Opcodes.L2F: return new char[] { 'f' }; case Opcodes.DCONST_0: case Opcodes.DCONST_1: case Opcodes.DALOAD: case Opcodes.DADD: case Opcodes.DSUB: case Opcodes.DMUL: case Opcodes.DDIV: case Opcodes.DREM: case Opcodes.DNEG: case Opcodes.I2D: case Opcodes.F2D: case Opcodes.L2D: return new char[] { 'd' }; case Opcodes.DUP: return new char[] { '0', '0' }; case Opcodes.DUP2: case Opcodes.DUP_X2: case Opcodes.DUP2_X2: return null; case Opcodes.DUP_X1: case Opcodes.DUP2_X1: return new char[] { '0', '1', '0' }; case Opcodes.SWAP: return new char[] { '1', '0' }; default: return null; } }
From source file:com.devexperts.aprof.transformer.MethodTransformer.java
License:Open Source License
private void pushLocationStack() { assert context.isLocationStackNeeded() : context; if (context.isInternalLocation()) { mv.visitInsn(Opcodes.ACONST_NULL); return;//from w w w.j a v a 2 s . c om } int locationStack = context.getLocationStack(); if (context.isMethodBodyTracked()) { assert locationStack >= 0 : context; mv.loadLocal(locationStack); return; } if (locationStack < 0) { mv.visitMethodInsn(Opcodes.INVOKESTATIC, TransformerUtil.LOCATION_STACK, "get", TransformerUtil.NOARG_RETURNS_STACK, false); return; } Label done = new Label(); mv.loadLocal(locationStack); mv.dup(); mv.ifNonNull(done); mv.pop(); mv.visitMethodInsn(Opcodes.INVOKESTATIC, TransformerUtil.LOCATION_STACK, "get", TransformerUtil.NOARG_RETURNS_STACK, false); mv.dup(); mv.storeLocal(locationStack); mv.visitLabel(done); }
From source file:com.devexperts.aprof.transformer.MethodTransformer.java
License:Open Source License
@Override protected void visitMarkDeclareLocationStack() { if (context.isLocationStackNeeded()) { int locationStack = mv.newLocal(Type.getType(LocationStack.class)); if (context.isMethodBodyTracked()) { mv.visitMethodInsn(Opcodes.INVOKESTATIC, TransformerUtil.LOCATION_STACK, "get", TransformerUtil.NOARG_RETURNS_STACK, false); } else {//from w w w . j a va 2 s . c o m mv.visitInsn(Opcodes.ACONST_NULL); } mv.storeLocal(locationStack); context.setLocationStack(locationStack); } }
From source file:com.foxelbox.spigotpatcher.patchers.HideShowPlayerPatcher.java
License:Open Source License
@Override public MethodVisitor getVisitor(int api, MethodVisitor parent) { return new MethodPatcherVisitor(api, parent) { @Override//w w w.j av a 2 s . c o m protected boolean checkMethodInsn(int opcode, String clazz, String name, String desc) { if (opcode == Opcodes.INVOKEVIRTUAL && clazz.endsWith("/PlayerConnection") && name.equals("sendPacket")) { visitInsn(Opcodes.POP); visitInsn(Opcodes.ACONST_NULL); System.out.println("HideShowPatcher: PATCHED (2 times = OK)"); } return true; } }; }
From source file:com.geeksaga.light.profiler.util.ASMUtil.java
License:Apache License
public static AbstractInsnNode createPushNode(Object value) { AbstractInsnNode insnNode;/*w w w. j a v a2 s. co m*/ if (value == null) { insnNode = new InsnNode(Opcodes.ACONST_NULL); } else { insnNode = new LdcInsnNode(value); } return insnNode; }
From source file:com.geeksaga.light.profiler.util.ASMUtil.java
License:Apache License
public static InsnNode createACONST_NULL() { return new InsnNode(Opcodes.ACONST_NULL); }
From source file:com.github.anba.es6draft.compiler.assembler.InstructionAssembler.java
License:Open Source License
public void anull() { methodVisitor.visitInsn(Opcodes.ACONST_NULL); stack.anull(); }
From source file:com.github.fge.grappa.transform.CodeBlock.java
License:Apache License
public CodeBlock aconst_null() { instructionList.add(new InsnNode(Opcodes.ACONST_NULL)); return this; }