Examples of IFNE


Examples of org.apache.bcel.generic.IFNE

      il.append(methodGen.loadDOM());
      il.append(SWAP);
      il.append(new INVOKEINTERFACE(check, 2));
 
      // Need to allow for long jumps here
      final BranchHandle icmp = il.append(new IFNE(null));
      _falseList.add(il.append(new GOTO_W(null)));
      icmp.setTarget(il.append(NOP));
  }
  else if (_nodeType == DOM.ATTRIBUTE) {
      final int check = cpg.addInterfaceMethodref(DOM_INTF,
              "isAttribute", "(I)Z");
      il.append(methodGen.loadDOM());
      il.append(SWAP);
      il.append(new INVOKEINTERFACE(check, 2));
 
      // Need to allow for long jumps here
      final BranchHandle icmp = il.append(new IFNE(null));
      _falseList.add(il.append(new GOTO_W(null)));
      icmp.setTarget(il.append(NOP));
  }
  else {
      // context node is on the stack
View Full Code Here

Examples of org.apache.bcel.generic.IFNE

      _right.translate(classGen, methodGen);

      if (tleft instanceof RealType) {
    il.append(DCMPG);
        _falseList.add(il.append(_op == Operators.EQ ?
           (BranchInstruction)new IFNE(null) :
           (BranchInstruction)new IFEQ(null)));
      }
      else {
            _falseList.add(il.append(_op == Operators.EQ ?
           (BranchInstruction)new IF_ICMPNE(null) :
View Full Code Here

Examples of org.apache.bcel.generic.IFNE

    tleft.translateTo(classGen, methodGen, Type.Real);
    _right.translate(classGen, methodGen);

    il.append(DCMPG);
        falsec = il.append(_op == Operators.EQ ?
           (BranchInstruction) new IFNE(null) :
           (BranchInstruction) new IFEQ(null));
    il.append(ICONST_1);
    truec = il.append(new GOTO(null));
    falsec.setTarget(il.append(ICONST_0));
    truec.setTarget(il.append(NOP));
View Full Code Here

Examples of org.apache.bcel.generic.IFNE

      il.append(methodGen.loadDOM());
      il.append(SWAP);
      il.append(new INVOKEINTERFACE(check, 2));
 
      // Need to allow for long jumps here
      final BranchHandle icmp = il.append(new IFNE(null));
      _falseList.add(il.append(new GOTO_W(null)));
      icmp.setTarget(il.append(NOP));
  }
  else if (_nodeType == DTM.ATTRIBUTE_NODE) {
      final int check = cpg.addInterfaceMethodref(DOM_INTF,
              "isAttribute", "(I)Z");
      il.append(methodGen.loadDOM());
      il.append(SWAP);
      il.append(new INVOKEINTERFACE(check, 2));
 
      // Need to allow for long jumps here
      final BranchHandle icmp = il.append(new IFNE(null));
      _falseList.add(il.append(new GOTO_W(null)));
      icmp.setTarget(il.append(NOP));
  }
  else {
      // context node is on the stack
View Full Code Here

Examples of org.apache.bcel.generic.IFNE

  //!!! call isNaN
  // Compare it to itself to see if NaN
  il.append(new DLOAD(local.getIndex()));
  il.append(new DLOAD(local.getIndex()));
  il.append(DCMPG);
  flowlist.add(il.append(new IFNE(null)))// NaN != NaN
  return flowlist;
    }
View Full Code Here

Examples of org.apache.bcel.generic.IFNE

  //!!! call isNaN
  // Compare it to itself to see if NaN
  il.append(new DLOAD(local.getIndex()));
  il.append(new DLOAD(local.getIndex()));
  il.append(DCMPG);
  flowlist.add(il.append(new IFNE(null)))// NaN != NaN
  return flowlist;
    }
View Full Code Here

Examples of org.apache.bcel.generic.IFNE

            il.append(checkFmNotNull);
            createThrowException(ClassEnhancer.CN_IllegalArgumentException, "ObjectIdFieldConsumer is null");
            checkFmNotNull.setTarget(il.append(InstructionConstants.ALOAD_2));
            il.append(factory.createInstanceOf(oidType));

            BranchInstruction isInstanceof = new IFNE(null);
            il.append(isInstanceof);
            createThrowException(ClassEnhancer.CN_ClassCastException, "oid is not instanceof " + oidClassName);

            isInstanceof.setTarget(il.append(InstructionConstants.ALOAD_2));
            il.append(factory.createCast(Type.OBJECT, oidType));
            lv_o[0] = il.append(new ASTORE(3));

            if (fields != null)
            {
View Full Code Here

Examples of org.apache.bcel.generic.IFNE

            il.append(factory.createGetStatic(className, ClassEnhancer.FN_JdoInheritedFieldCount, Type.INT));
            il.append(InstructionConstants.IADD);
        }
        il.append(factory.createInvoke(ClassEnhancer.CN_StateManager, "isLoaded", Type.BOOLEAN,
            new Type[]{BCELClassEnhancer.OT_PersistenceCapable, Type.INT}, Constants.INVOKEINTERFACE));
        BranchInstruction jump3 = new IFNE(null);
        il.append(jump3);

        // statemanager.getXXXfield();
        il.append(InstructionConstants.ALOAD_0);
        il.append(factory.createGetField(className, ClassEnhancer.FN_StateManager, BCELClassEnhancer.OT_StateManager));
        il.append(InstructionConstants.ALOAD_0);
        il.append(BCELUtils.getBIPUSH(fieldConfig.getFieldId()));
        if (cmd.getPersistenceCapableSuperclass() != null)
        {
            il.append(factory.createGetStatic(className, ClassEnhancer.FN_JdoInheritedFieldCount, Type.INT));
            il.append(InstructionConstants.IADD);
        }
        //jdoGetXXX
        il.append(InstructionConstants.ALOAD_0);
        il.append(factory.createInvoke(
            className,
            "jdo"+BCELUtils.getGetterName(fieldName),
            nativeType,
            new Type[] {},
            Constants.INVOKEVIRTUAL));

        il.append(factory.createInvoke(ClassEnhancer.CN_StateManager, "get" + BCELUtils.getJDOMethodName(targetField.getType()) + "Field",
            smType, new Type[]{BCELClassEnhancer.OT_PersistenceCapable, Type.INT, smType}, Constants.INVOKEINTERFACE));

        if (nativeType instanceof ReferenceType)
        {
            String type = null;
            if (nativeType instanceof ArrayType)
            {
                type = nativeType.getSignature();
            }
            else
            {
                type = nativeType.toString();
            }
            il.append(new CHECKCAST(constantPoolGen.addClass(type)));
        }
        il.append(InstructionFactory.createReturn(nativeType));

        //----detach------
        if (cmd.isDetachable())
        {
            // jdoIsDetached()
            jumpTarget = il.append(InstructionConstants.ALOAD_0);
            il.append(factory.createInvoke(ClassEnhancer.CN_PersistenceCapable, ClassEnhancer.MN_JdoIsDetached,
                Type.BOOLEAN, Type.NO_ARGS, Constants.INVOKEINTERFACE));

            //0
            il.append(InstructionConstants.ICONST_0);
            // if (jdoIsDetached() == 0)
            IF_ICMPEQ ifIsDetached = new IF_ICMPEQ(null);
            il.append(ifIsDetached);

            // if (jdoDetachedState[2].get(?) == 1)
            //   jdoDetachedState[2]
            ifIsDetached.setTarget(il.append(InstructionConstants.ALOAD_0));
            il.append(factory.createGetField(className, ClassEnhancer.FN_JdoDetachedState, BCELClassEnhancer.OT_ObjectArray));
            il.append(InstructionConstants.ICONST_2);
            il.append(InstructionConstants.AALOAD);
            il.append(factory.createCheckCast(BCELClassEnhancer.OT_BitSet)); // Cast to BitSet

            //   the field index: 0, 1, 2...
            il.append(BCELUtils.getBIPUSH(fieldConfig.getFieldId()));
            if (cmd.getPersistenceCapableSuperclass() != null)
            {
                // add to field index the parentFieldCount
                il.append(factory.createGetStatic(className, ClassEnhancer.FN_JdoInheritedFieldCount, Type.INT));
                il.append(InstructionConstants.IADD);
            }
            //   get(?)
            il.append(factory.createInvoke(ClassEnhancer.CN_BitSet, "get", Type.BOOLEAN, new Type[]{Type.INT}, Constants.INVOKEVIRTUAL));

            // 1
            il.append(InstructionConstants.ICONST_1);
            // if (jdoLoadedFields.get(?) == 1)
            IF_ICMPEQ ifLoaded = new IF_ICMPEQ(null);
            il.append(ifLoaded);

            // throw new JDODetachedFieldAccessException("XXXX was not loaded.");
            createThrowException(ClassEnhancer.CN_JDODetachedFieldAccessException, LOCALISER.msg("Enhancer.DetachedFieldAccess", fieldName));

            //----detach------

            // return <target field>
            InstructionHandle jumpTarget2;
            jumpTarget2 = il.append(InstructionConstants.ALOAD_0);
            il.append(factory.createInvoke(
                className,
                "jdo"+BCELUtils.getGetterName(fieldName),
                nativeType,
                new Type[] { },
                Constants.INVOKEVIRTUAL));

            if (nativeType instanceof ReferenceType)
            {
                String type = null;
                if (nativeType instanceof ArrayType)
                {
                    type = nativeType.getSignature();
                }
                else
                {
                    type = nativeType.toString();
                }
                il.append(new CHECKCAST(constantPoolGen.addClass(type)));
            }
            il.append(InstructionFactory.createReturn(nativeType));

            if( (fieldConfig.getJdoFieldFlag() & PersistenceCapable.CHECK_READ) == PersistenceCapable.CHECK_READ)
            {
                jump1.setTarget(jumpTarget);
            }
            jump2.setTarget(jumpTarget);
            jump3.setTarget(jumpTarget);
            ifIsDetached.setTarget(jumpTarget2);
            ifLoaded.setTarget(jumpTarget2);
        }
        else
        {
            // return <target field>
            jumpTarget = il.append(InstructionConstants.ALOAD_0);
            il.append(factory.createInvoke(
                className,
                "jdo"+BCELUtils.getGetterName(fieldName),
                nativeType,
                new Type[] { },
                Constants.INVOKEVIRTUAL));

            if (nativeType instanceof ReferenceType)
            {
                String type = null;
                if (nativeType instanceof ArrayType)
                {
                    type = nativeType.getSignature();
                }
                else
                {
                    type = nativeType.toString();
                }
                il.append(new CHECKCAST(constantPoolGen.addClass(type)));
            }
            il.append(InstructionFactory.createReturn(nativeType));

            if( (fieldConfig.getJdoFieldFlag() & PersistenceCapable.CHECK_READ) == PersistenceCapable.CHECK_READ)
            {
                jump1.setTarget(jumpTarget);
            }
            jump2.setTarget(jumpTarget);
            jump3.setTarget(jumpTarget);
        }
        methodGen.setMaxLocals();
        methodGen.setMaxStack();
        classGen.replaceMethod(method, methodGen.getMethod());
    }
View Full Code Here

Examples of org.apache.bcel.generic.IFNE

        }
        else if ((objectIdClass != null) && (objectIdClass.length() > 0))
        {
            ObjectType objectIdClassType = new ObjectType(objectIdClass);
            il.append(InstructionConstants.ALOAD_1);
            IFNE oidClassIsNotNull = new IFNE(null);
            il.append(factory.createInstanceOf(objectIdClassType));
            il.append(oidClassIsNotNull);
            createThrowException(
                ClassEnhancer.CN_ClassCastException,
                "key class is not " + objectIdClass + " or null");

            oidClassIsNotNull.setTarget(il.append(InstructionConstants.ALOAD_1));
            il.append(factory.createCast(Type.OBJECT, objectIdClassType));
            lv_o[0] = il.append(new ASTORE(objectIdInstance));
            if (fields != null)
            {
View Full Code Here

Examples of org.apache.bcel.generic.IFNE

            il.append(factory.createGetStatic(className, ClassEnhancer.FN_JdoInheritedFieldCount, Type.INT));
            il.append(InstructionConstants.IADD);
        }
        il.append(factory.createInvoke(ClassEnhancer.CN_StateManager, "isLoaded", Type.BOOLEAN,
            new Type[]{BCELClassEnhancer.OT_PersistenceCapable, Type.INT}, Constants.INVOKEINTERFACE));
        BranchInstruction jump3 = new IFNE(null);
        il.append(jump3);

        // statemanager.getXXXfield();
        il.append(InstructionConstants.ALOAD_0);
        il.append(factory.createGetField(className, ClassEnhancer.FN_StateManager, BCELClassEnhancer.OT_StateManager));
        il.append(InstructionConstants.ALOAD_0);
        il.append(BCELUtils.getBIPUSH(fieldConfig.getFieldId()));
        if (cmd.getPersistenceCapableSuperclass() != null)
        {
            il.append(factory.createGetStatic(className, ClassEnhancer.FN_JdoInheritedFieldCount, Type.INT));
            il.append(InstructionConstants.IADD);
        }
        il.append(InstructionConstants.ALOAD_0);
        il.append(factory.createGetField(className, fieldName, nativeType));
        il.append(factory.createInvoke(ClassEnhancer.CN_StateManager, "get" + BCELUtils.getJDOMethodName(targetField.getType()) + "Field",
            smType, new Type[]{BCELClassEnhancer.OT_PersistenceCapable, Type.INT, smType}, Constants.INVOKEINTERFACE));

        if (nativeType instanceof ReferenceType)
        {
            String type = null;
            if (nativeType instanceof ArrayType)
                type = nativeType.getSignature();
            else
                type = nativeType.toString();
            il.append(new CHECKCAST(constantPoolGen.addClass(type)));
        }
        il.append(InstructionFactory.createReturn(nativeType));

        //----detach------
        if (cmd.isDetachable())
        {
            // jdoIsDetached()
            jumpTarget = il.append(InstructionConstants.ALOAD_0);
            il.append(factory.createInvoke(ClassEnhancer.CN_PersistenceCapable, ClassEnhancer.MN_JdoIsDetached,
                Type.BOOLEAN, Type.NO_ARGS, Constants.INVOKEINTERFACE));

            //0
            il.append(InstructionConstants.ICONST_0);
            // if (jdoIsDetached() == 0)
            IF_ICMPEQ ifIsDetached = new IF_ICMPEQ(null);
            il.append(ifIsDetached);

            // if (jdoDetachedState[2].get(?) == 1)
            //   jdoDetachedState[2]
            ifIsDetached.setTarget(il.append(InstructionConstants.ALOAD_0));
            il.append(factory.createGetField(className, ClassEnhancer.FN_JdoDetachedState, BCELClassEnhancer.OT_ObjectArray));
            il.append(InstructionConstants.ICONST_2);
            il.append(InstructionConstants.AALOAD);
            il.append(factory.createCheckCast(BCELClassEnhancer.OT_BitSet)); // Cast to BitSet

            //   the field index: 0, 1, 2...
            il.append(BCELUtils.getBIPUSH(fieldConfig.getFieldId()));
            if (cmd.getPersistenceCapableSuperclass() != null)
            {
                // add to field index the parentFieldCount
                il.append(factory.createGetStatic(className, ClassEnhancer.FN_JdoInheritedFieldCount, Type.INT));
                il.append(InstructionConstants.IADD);
            }
            //   get(?)
            il.append(factory.createInvoke(ClassEnhancer.CN_BitSet, "get", Type.BOOLEAN, new Type[]{Type.INT}, Constants.INVOKEVIRTUAL));

            // 1
            il.append(InstructionConstants.ICONST_1);
            // if (jdoLoadedFields.get(?) == 1)
            IF_ICMPEQ ifLoaded = new IF_ICMPEQ(null);
            il.append(ifLoaded);

            // throw new JDODetachedFieldAccessException("XXXX was not loaded.");
            createThrowException(ClassEnhancer.CN_JDODetachedFieldAccessException, LOCALISER.msg("Enhancer.DetachedFieldAccess", fieldName));

            //----detach------

            // return <target field>
            InstructionHandle jumpTarget2;
            jumpTarget2 = il.append(InstructionConstants.ALOAD_0);
            il.append(factory.createGetField(className, fieldName, nativeType));
            il.append(InstructionFactory.createReturn(nativeType));

            jump1.setTarget(jumpTarget);
            jump2.setTarget(jumpTarget);
            jump3.setTarget(jumpTarget);
            ifIsDetached.setTarget(jumpTarget2);
            ifLoaded.setTarget(jumpTarget2);
        }
        else
        {
            // return <target field>
            jumpTarget = il.append(InstructionConstants.ALOAD_0);
            il.append(factory.createGetField(className, fieldName, nativeType));
            il.append(InstructionFactory.createReturn(nativeType));

            jump1.setTarget(jumpTarget);
            jump2.setTarget(jumpTarget);
            jump3.setTarget(jumpTarget);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.