List of usage examples for org.objectweb.asm Opcodes IFNULL
int IFNULL
To view the source code for org.objectweb.asm Opcodes IFNULL.
Click Source Link
From source file:org.adjective.stout.operation.JumpOperation.java
License:Apache License
public void getInstructions(ExecutionStack stack, InstructionCollector collector) { switch (_op) { case Opcodes.IFEQ: case Opcodes.IFNE: case Opcodes.IFLT: case Opcodes.IFGE: case Opcodes.IFGT: case Opcodes.IFLE: checkExpression(TypeDescriptor.INT, stack); break;/* www . j ava 2 s .c o m*/ case Opcodes.IFNULL: case Opcodes.IFNONNULL: checkExpression(TypeDescriptor.OBJECT, stack); break; default: throw new IllegalStateException("Do not know how to handle jump opcode " + getOpcodeDescription(_op)); } _expression.getInstructions(stack, collector); collector.add(new JumpInstruction(_op, _label)); }
From source file:org.apache.cxf.binding.corba.utils.CorbaAnyHelper.java
License:Apache License
private static void addReadOverride(ClassWriter cw) { MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "read_value", "(Lorg/omg/CORBA/portable/InputStream;Lorg/omg/CORBA/TypeCode;)V", null, null); mv.visitCode();/* w w w. j a v a 2 s. c o m*/ Label l0 = new Label(); mv.visitLabel(l0); mv.visitLineNumber(54, l0); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, "org/apache/cxf/binding/corba/utils/FixedAnyImpl", "obj", "Lorg/omg/CORBA/portable/Streamable;"); Label l1 = new Label(); mv.visitJumpInsn(Opcodes.IFNULL, l1); Label l2 = new Label(); mv.visitLabel(l2); mv.visitLineNumber(55, l2); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, "org/apache/cxf/binding/corba/utils/FixedAnyImpl", "obj", "Lorg/omg/CORBA/portable/Streamable;"); mv.visitVarInsn(Opcodes.ALOAD, 1); mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, "org/omg/CORBA/portable/Streamable", "_read", "(Lorg/omg/CORBA/portable/InputStream;)V"); Label l3 = new Label(); mv.visitJumpInsn(Opcodes.GOTO, l3); mv.visitLabel(l1); mv.visitLineNumber(57, l1); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitVarInsn(Opcodes.ALOAD, 1); mv.visitVarInsn(Opcodes.ALOAD, 2); mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "com/sun/corba/se/impl/corba/AnyImpl", "read_value", "(Lorg/omg/CORBA/portable/InputStream;Lorg/omg/CORBA/TypeCode;)V"); mv.visitLabel(l3); mv.visitLineNumber(59, l3); mv.visitInsn(Opcodes.RETURN); Label l4 = new Label(); mv.visitLabel(l4); mv.visitLocalVariable("this", "Lorg/apache/cxf/binding/corba/utils/FixedAnyImpl;", null, l0, l4, 0); mv.visitLocalVariable("is", "Lorg/omg/CORBA/portable/InputStream;", null, l0, l4, 1); mv.visitLocalVariable("t", "Lorg/omg/CORBA/TypeCode;", null, l0, l4, 2); mv.visitMaxs(3, 3); mv.visitEnd(); }
From source file:org.apache.cxf.binding.corba.utils.CorbaAnyHelper.java
License:Apache License
private static void addWriteOverride(ClassWriter cw) { MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "write_value", "(Lorg/omg/CORBA/portable/OutputStream;)V", null, null); mv.visitCode();/*from w w w. ja v a 2 s . co m*/ Label l0 = new Label(); mv.visitLabel(l0); mv.visitLineNumber(61, l0); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, "org/apache/cxf/binding/corba/utils/FixedAnyImpl", "obj", "Lorg/omg/CORBA/portable/Streamable;"); Label l1 = new Label(); mv.visitJumpInsn(Opcodes.IFNULL, l1); Label l2 = new Label(); mv.visitLabel(l2); mv.visitLineNumber(62, l2); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, "org/apache/cxf/binding/corba/utils/FixedAnyImpl", "obj", "Lorg/omg/CORBA/portable/Streamable;"); mv.visitVarInsn(Opcodes.ALOAD, 1); mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, "org/omg/CORBA/portable/Streamable", "_write", "(Lorg/omg/CORBA/portable/OutputStream;)V"); Label l3 = new Label(); mv.visitJumpInsn(Opcodes.GOTO, l3); mv.visitLabel(l1); mv.visitLineNumber(64, l1); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitVarInsn(Opcodes.ALOAD, 1); mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "com/sun/corba/se/impl/corba/AnyImpl", "write_value", "(Lorg/omg/CORBA/portable/OutputStream;)V"); mv.visitLabel(l3); mv.visitLineNumber(66, l3); mv.visitInsn(Opcodes.RETURN); Label l4 = new Label(); mv.visitLabel(l4); mv.visitLocalVariable("this", "Lorg/apache/cxf/binding/corba/utils/FixedAnyImpl;", null, l0, l4, 0); mv.visitLocalVariable("os", "Lorg/omg/CORBA/portable/OutputStream;", null, l0, l4, 1); mv.visitMaxs(2, 2); mv.visitEnd(); }
From source file:org.apache.cxf.binding.corba.utils.CorbaAnyHelper.java
License:Apache License
private static void addExtractOverride(ClassWriter cw) { // TODO Auto-generated method stub MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "extract_Streamable", "()Lorg/omg/CORBA/portable/Streamable;", null, null); mv.visitCode();// w w w. j a v a 2s .c om Label l0 = new Label(); mv.visitLabel(l0); mv.visitLineNumber(47, l0); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, "org/apache/cxf/binding/corba/utils/FixedAnyImpl", "obj", "Lorg/omg/CORBA/portable/Streamable;"); Label l1 = new Label(); mv.visitJumpInsn(Opcodes.IFNULL, l1); Label l2 = new Label(); mv.visitLabel(l2); mv.visitLineNumber(48, l2); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, "org/apache/cxf/binding/corba/utils/FixedAnyImpl", "obj", "Lorg/omg/CORBA/portable/Streamable;"); mv.visitInsn(Opcodes.ARETURN); mv.visitLabel(l1); mv.visitLineNumber(50, l1); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "com/sun/corba/se/impl/corba/AnyImpl", "extract_Streamable", "()Lorg/omg/CORBA/portable/Streamable;"); mv.visitInsn(Opcodes.ARETURN); Label l3 = new Label(); mv.visitLabel(l3); mv.visitLocalVariable("this", "Lorg/apache/cxf/binding/corba/utils/FixedAnyImpl;", null, l0, l3, 0); mv.visitMaxs(1, 1); mv.visitEnd(); }
From source file:org.apache.cxf.jaxb.JAXBUtils.java
License:Apache License
private static Class<?> createNamespaceWrapperInternal(ASMHelper helper, ClassWriter cw) { String className = "org.apache.cxf.jaxb.NamespaceMapperInternal"; FieldVisitor fv;//from w w w . j a v a2s .co m MethodVisitor mv; cw.visit(Opcodes.V1_5, Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_SUPER, "org/apache/cxf/jaxb/NamespaceMapperInternal", null, "com/sun/xml/internal/bind/marshaller/NamespacePrefixMapper", null); cw.visitSource("NamespaceMapper.java", null); fv = cw.visitField(Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL, "nspref", "Ljava/util/Map;", "Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;", null); fv.visitEnd(); mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "<init>", "(Ljava/util/Map;)V", "(Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;)V", null); mv.visitCode(); Label l0 = new Label(); mv.visitLabel(l0); mv.visitLineNumber(30, l0); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "com/sun/xml/internal/bind/marshaller/NamespacePrefixMapper", "<init>", "()V"); Label l1 = new Label(); mv.visitLabel(l1); mv.visitLineNumber(31, l1); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitVarInsn(Opcodes.ALOAD, 1); mv.visitFieldInsn(Opcodes.PUTFIELD, "org/apache/cxf/jaxb/NamespaceMapperInternal", "nspref", "Ljava/util/Map;"); Label l2 = new Label(); mv.visitLabel(l2); mv.visitLineNumber(32, l2); mv.visitInsn(Opcodes.RETURN); Label l3 = new Label(); mv.visitLabel(l3); mv.visitLocalVariable("this", "Lorg/apache/cxf/jaxb/NamespaceMapperInternal;", null, l0, l3, 0); mv.visitLocalVariable("nspref", "Ljava/util/Map;", "Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;", l0, l3, 1); mv.visitMaxs(2, 2); mv.visitEnd(); mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "getPreferredPrefix", "(Ljava/lang/String;Ljava/lang/String;Z)Ljava/lang/String;", null, null); mv.visitCode(); l0 = new Label(); mv.visitLabel(l0); mv.visitLineNumber(38, l0); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, "org/apache/cxf/jaxb/NamespaceMapperInternal", "nspref", "Ljava/util/Map;"); mv.visitVarInsn(Opcodes.ALOAD, 1); mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, "java/util/Map", "get", "(Ljava/lang/Object;)Ljava/lang/Object;"); mv.visitTypeInsn(Opcodes.CHECKCAST, "java/lang/String"); mv.visitVarInsn(Opcodes.ASTORE, 4); l1 = new Label(); mv.visitLabel(l1); mv.visitLineNumber(39, l1); mv.visitVarInsn(Opcodes.ALOAD, 4); l2 = new Label(); mv.visitJumpInsn(Opcodes.IFNULL, l2); l3 = new Label(); mv.visitLabel(l3); mv.visitLineNumber(40, l3); mv.visitVarInsn(Opcodes.ALOAD, 4); mv.visitInsn(Opcodes.ARETURN); mv.visitLabel(l2); mv.visitLineNumber(42, l2); mv.visitVarInsn(Opcodes.ALOAD, 2); mv.visitInsn(Opcodes.ARETURN); Label l4 = new Label(); mv.visitLabel(l4); mv.visitLocalVariable("this", "Lorg/apache/cxf/jaxb/NamespaceMapperInternal;", null, l0, l4, 0); mv.visitLocalVariable("namespaceUri", "Ljava/lang/String;", null, l0, l4, 1); mv.visitLocalVariable("suggestion", "Ljava/lang/String;", null, l0, l4, 2); mv.visitLocalVariable("requirePrefix", "Z", null, l0, l4, 3); mv.visitLocalVariable("prefix", "Ljava/lang/String;", null, l1, l4, 4); mv.visitMaxs(2, 5); mv.visitEnd(); cw.visitEnd(); byte bts[] = cw.toByteArray(); return helper.loadClass(className, JAXBUtils.class, bts); }
From source file:org.apache.cxf.jaxb.WrapperHelperCompiler.java
License:Apache License
private void doCollection(MethodVisitor mv, int x) { // List aVal = obj.getA(); // List newA = (List)lst.get(99); // if (aVal == null) { // obj.setA(newA); // } else if (newA != null) { // aVal.addAll(newA); // }/*from w w w.jav a 2 s .co m*/ Label l3 = new Label(); mv.visitLabel(l3); mv.visitLineNumber(114, l3); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, periodToSlashes(wrapperType.getName()), getMethods[x].getName(), getMethodSignature(getMethods[x])); mv.visitVarInsn(Opcodes.ASTORE, 3); mv.visitVarInsn(Opcodes.ALOAD, 1); mv.visitIntInsn(Opcodes.BIPUSH, x); mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, "java/util/List", "get", "(I)Ljava/lang/Object;"); mv.visitTypeInsn(Opcodes.CHECKCAST, "java/util/List"); mv.visitVarInsn(Opcodes.ASTORE, 4); mv.visitVarInsn(Opcodes.ALOAD, 3); Label nonNullLabel = new Label(); mv.visitJumpInsn(Opcodes.IFNONNULL, nonNullLabel); if (setMethods[x] == null) { mv.visitTypeInsn(Opcodes.NEW, "java/lang/RuntimeException"); mv.visitInsn(Opcodes.DUP); mv.visitLdcInsn(getMethods[x].getName() + " returned null and there isn't a set method."); mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/RuntimeException", "<init>", "(Ljava/lang/String;)V"); mv.visitInsn(Opcodes.ATHROW); } else { mv.visitVarInsn(Opcodes.ALOAD, 2); mv.visitVarInsn(Opcodes.ALOAD, 4); mv.visitTypeInsn(Opcodes.CHECKCAST, getMethods[x].getReturnType().getName().replace('.', '/')); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, periodToSlashes(wrapperType.getName()), setMethods[x].getName(), getMethodSignature(setMethods[x])); } Label jumpOverLabel = new Label(); mv.visitJumpInsn(Opcodes.GOTO, jumpOverLabel); mv.visitLabel(nonNullLabel); mv.visitLineNumber(106, nonNullLabel); mv.visitVarInsn(Opcodes.ALOAD, 4); mv.visitJumpInsn(Opcodes.IFNULL, jumpOverLabel); mv.visitVarInsn(Opcodes.ALOAD, 3); mv.visitVarInsn(Opcodes.ALOAD, 4); mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, "java/util/List", "addAll", "(Ljava/util/Collection;)Z"); mv.visitInsn(Opcodes.POP); mv.visitLabel(jumpOverLabel); mv.visitLineNumber(107, jumpOverLabel); }
From source file:org.batoo.jpa.core.impl.instance.Enhancer.java
License:Open Source License
private static void createMethodCheck(final String enhancedClassName, final String descEnhancer, final ClassWriter cw) { final MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PRIVATE, Enhancer.METHOD_ENHANCED_CHECK, Enhancer.makeDescription(Void.TYPE), null, null); mv.visitCode();/*from w w w .j a v a 2 s . co m*/ final Label lCheckInternal = new Label(); final Label lCheckInitialized = new Label(); final Label lReturn = new Label(); final Label lFind = new Label(); final Label lInitialized = new Label(); final Label lChanged = new Label(); final Label lOut = new Label(); // if (!this.__enhanced__$$__internal) { return } mv.visitLabel(lCheckInternal); mv.visitFrame(Opcodes.F_NEW, 1, new Object[] { enhancedClassName }, 0, new Object[] {}); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, enhancedClassName, Enhancer.FIELD_ENHANCED_INTERNAL, Enhancer.DESCRIPTOR_BOOLEAN); mv.visitJumpInsn(Opcodes.IFEQ, lCheckInitialized); mv.visitInsn(Opcodes.RETURN); // if (!this.__enhanced__$$__initialized) { mv.visitLabel(lCheckInitialized); mv.visitFrame(Opcodes.F_NEW, 1, new Object[] { enhancedClassName }, 0, new Object[] {}); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, enhancedClassName, Enhancer.FIELD_ENHANCED_INITIALIZED, Enhancer.DESCRIPTOR_BOOLEAN); mv.visitJumpInsn(Opcodes.IFNE, lChanged); // if (this.__enhanced_$$__session == null) mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, enhancedClassName, Enhancer.FIELD_ENHANCED_SESSION, Enhancer.DESCRIPTOR_SESSION); mv.visitJumpInsn(Opcodes.IFNONNULL, lFind); // throw new PersistenceException("No session to initialize the instance"); mv.visitTypeInsn(Opcodes.NEW, Enhancer.INTERNAL_PERSISTENCE_EXCEPTION); mv.visitInsn(Opcodes.DUP); mv.visitLdcInsn("No session to initialize the instance"); mv.visitMethodInsn(Opcodes.INVOKESPECIAL, Enhancer.INTERNAL_PERSISTENCE_EXCEPTION, Enhancer.CONSTRUCTOR_INIT, Enhancer.makeDescription(Void.TYPE, String.class)); mv.visitInsn(Opcodes.ATHROW); // this.__enhanced_$$__session.getEntityManager().find(this.__enhanced_$$__type, this.__enhanced__$$__id); mv.visitLabel(lFind); mv.visitFrame(Opcodes.F_NEW, 1, new Object[] { enhancedClassName }, 0, new Object[] {}); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, enhancedClassName, Enhancer.FIELD_ENHANCED_SESSION, Enhancer.DESCRIPTOR_SESSION); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, Enhancer.INTERNAL_SESSION, Enhancer.METHOD_GET_ENTITY_MANAGER, Enhancer.makeDescription(EntityManagerImpl.class)); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, enhancedClassName, Enhancer.FIELD_ENHANCED_TYPE, Enhancer.DESCRIPTOR_CLASS); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, enhancedClassName, Enhancer.FIELD_ENHANCED_ID, Enhancer.DESCRIPTOR_OBJECT); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, Enhancer.INTERNAL_ENTITY_MANAGER, Enhancer.METHOD_FIND, Enhancer.makeDescription(Object.class, Class.class, Object.class)); mv.visitInsn(Opcodes.POP); // this.__enhanced__$$__initialized = true; mv.visitLabel(lInitialized); mv.visitFrame(Opcodes.F_NEW, 1, new Object[] { enhancedClassName }, 0, new Object[] {}); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitInsn(Opcodes.ICONST_1); mv.visitFieldInsn(Opcodes.PUTFIELD, enhancedClassName, Enhancer.FIELD_ENHANCED_INITIALIZED, Enhancer.DESCRIPTOR_BOOLEAN); // if (this.__enhanced_$$__session != null) mv.visitLabel(lChanged); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, enhancedClassName, Enhancer.FIELD_ENHANCED_SESSION, Enhancer.DESCRIPTOR_SESSION); mv.visitJumpInsn(Opcodes.IFNULL, lReturn); // this.__enhanced__$$__managedInstance.changed(); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, enhancedClassName, Enhancer.FIELD_ENHANCED_MANAGED_INSTANCE, Enhancer.DESCRIPTOR_MANAGED_INSTANCE); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, Enhancer.INTERNAL_MANAGED_INSTANCE, Enhancer.METHOD_CHANGED, Enhancer.makeDescription(Void.TYPE)); // return; mv.visitLabel(lReturn); mv.visitFrame(Opcodes.F_NEW, 1, new Object[] { enhancedClassName }, 0, new Object[] {}); mv.visitInsn(Opcodes.RETURN); mv.visitLabel(lOut); mv.visitLocalVariable(Enhancer.THIS, descEnhancer, null, lCheckInternal, lOut, 0); mv.visitMaxs(0, 0); mv.visitEnd(); }
From source file:org.decojer.cavaj.readers.asm.ReadMethodVisitor.java
License:Open Source License
@Override public void visitJumpInsn(final int opcode, final Label label) { T t = null;// w w w. j a v a2 s . co m Object oValue = null; final int targetPc = getPc(label); switch (opcode) { /******** * GOTO * ********/ case Opcodes.GOTO: { final GOTO op = new GOTO(this.ops.size(), opcode, this.line); add(op); op.setTargetPc(targetPc); if (targetPc < 0) { getUnresolved(label).add(op); } break; } /******** * JCMP * ********/ case Opcodes.IF_ACMPEQ: t = T.REF; oValue = CmpType.T_EQ; // fall through case Opcodes.IF_ACMPNE: if (t == null) { t = T.REF; oValue = CmpType.T_NE; } // fall through case Opcodes.IF_ICMPEQ: if (t == null) { t = T.AINT; // boolean too oValue = CmpType.T_EQ; } // fall through case Opcodes.IF_ICMPGE: if (t == null) { t = T.INT; oValue = CmpType.T_GE; } // fall through case Opcodes.IF_ICMPGT: if (t == null) { t = T.INT; oValue = CmpType.T_GT; } // fall through case Opcodes.IF_ICMPLE: if (t == null) { t = T.INT; oValue = CmpType.T_LE; } // fall through case Opcodes.IF_ICMPLT: if (t == null) { t = T.INT; oValue = CmpType.T_LT; } // fall through case Opcodes.IF_ICMPNE: if (t == null) { t = T.AINT; // boolean too oValue = CmpType.T_NE; } { assert oValue instanceof CmpType; final JCMP op = new JCMP(this.ops.size(), opcode, this.line, t, (CmpType) oValue); add(op); op.setTargetPc(targetPc); if (targetPc < 0) { getUnresolved(label).add(op); } } break; /******** * JCND * ********/ case Opcodes.IFNULL: t = T.REF; oValue = CmpType.T_EQ; // fall through case Opcodes.IFNONNULL: if (t == null) { t = T.REF; oValue = CmpType.T_NE; } // fall through case Opcodes.IFEQ: if (t == null) { t = T.AINT; // boolean too oValue = CmpType.T_EQ; } // fall through case Opcodes.IFGE: if (t == null) { t = T.INT; oValue = CmpType.T_GE; } // fall through case Opcodes.IFGT: if (t == null) { t = T.INT; oValue = CmpType.T_GT; } // fall through case Opcodes.IFLE: if (t == null) { t = T.INT; oValue = CmpType.T_LE; } // fall through case Opcodes.IFLT: if (t == null) { t = T.INT; oValue = CmpType.T_LT; } // fall through case Opcodes.IFNE: if (t == null) { t = T.AINT; // boolean too oValue = CmpType.T_NE; } { assert oValue instanceof CmpType; final JCND op = new JCND(this.ops.size(), opcode, this.line, t, (CmpType) oValue); add(op); op.setTargetPc(targetPc); if (targetPc < 0) { getUnresolved(label).add(op); } } break; /******* * JSR * *******/ case Opcodes.JSR: { final JSR op = new JSR(this.ops.size(), opcode, this.line); add(op); op.setTargetPc(targetPc); if (targetPc < 0) { getUnresolved(label).add(op); } break; } default: log.warn(getM() + ": Unknown jump insn opcode '" + opcode + "'!"); } }
From source file:org.evosuite.graphs.cfg.ASMWrapper.java
License:Open Source License
/** * <p>/*from w ww . j a v a 2 s .com*/ * isIfNull * </p> * * @return a boolean. */ public boolean isIfNull() { if (asmNode instanceof JumpInsnNode) { return (asmNode.getOpcode() == Opcodes.IFNULL); } return false; }
From source file:org.evosuite.graphs.cfg.BytecodeInstructionPool.java
License:Open Source License
/** * Determine how many bytes the current instruction occupies together with * its operands// ww w. ja v a 2 s. com * * @return */ private int getBytecodeIncrement(AbstractInsnNode instructionNode) { int opcode = instructionNode.getOpcode(); switch (opcode) { case Opcodes.ALOAD: // index case Opcodes.ASTORE: // index case Opcodes.DLOAD: case Opcodes.DSTORE: case Opcodes.FLOAD: case Opcodes.FSTORE: case Opcodes.ILOAD: case Opcodes.ISTORE: case Opcodes.LLOAD: case Opcodes.LSTORE: VarInsnNode varNode = (VarInsnNode) instructionNode; if (varNode.var > 3) return 1; else return 0; case Opcodes.BIPUSH: // byte case Opcodes.NEWARRAY: case Opcodes.RET: return 1; case Opcodes.LDC: LdcInsnNode ldcNode = (LdcInsnNode) instructionNode; if (ldcNode.cst instanceof Double || ldcNode.cst instanceof Long) return 2; // LDC2_W else return 1; case 19: //LDC_W case 20: //LDC2_W return 2; case Opcodes.ANEWARRAY: // indexbyte1, indexbyte2 case Opcodes.CHECKCAST: // indexbyte1, indexbyte2 case Opcodes.GETFIELD: case Opcodes.GETSTATIC: case Opcodes.GOTO: case Opcodes.IF_ACMPEQ: case Opcodes.IF_ACMPNE: case Opcodes.IF_ICMPEQ: case Opcodes.IF_ICMPNE: case Opcodes.IF_ICMPGE: case Opcodes.IF_ICMPGT: case Opcodes.IF_ICMPLE: case Opcodes.IF_ICMPLT: case Opcodes.IFLE: case Opcodes.IFLT: case Opcodes.IFGE: case Opcodes.IFGT: case Opcodes.IFNE: case Opcodes.IFEQ: case Opcodes.IFNONNULL: case Opcodes.IFNULL: case Opcodes.IINC: case Opcodes.INSTANCEOF: case Opcodes.INVOKESPECIAL: case Opcodes.INVOKESTATIC: case Opcodes.INVOKEVIRTUAL: case Opcodes.JSR: case Opcodes.NEW: case Opcodes.PUTFIELD: case Opcodes.PUTSTATIC: case Opcodes.SIPUSH: // case Opcodes.LDC_W // case Opcodes.LDC2_W return 2; case Opcodes.MULTIANEWARRAY: return 3; case Opcodes.INVOKEDYNAMIC: case Opcodes.INVOKEINTERFACE: return 4; case Opcodes.LOOKUPSWITCH: case Opcodes.TABLESWITCH: // TODO: Could be more return 4; // case Opcodes.GOTO_W // case Opcodes.JSR_W } return 0; }