Package org.apache.bcel.generic

Examples of org.apache.bcel.generic.IF_ICMPEQ


                Type.BOOLEAN, Type.NO_ARGS, Constants.INVOKEINTERFACE));

            // 0
            il.append(InstructionConstants.ICONST_1);
            // if (jdoIsDetached() == 1)
            IF_ICMPEQ ifIsDetached = new IF_ICMPEQ(null);
            il.append(ifIsDetached);
            // return null;
            il.append(InstructionConstants.ACONST_NULL);
            il.append(InstructionConstants.ARETURN);

            // return jdoDetachedState[0];
            ifIsDetached.setTarget(il.append(InstructionConstants.ALOAD_0));
            il.append(factory.createGetField(className, ClassEnhancer.FN_JdoDetachedState, BCELClassEnhancer.OT_ObjectArray));
            il.append(InstructionConstants.ICONST_0);
            il.append(InstructionConstants.AALOAD);

            il.append(InstructionConstants.ARETURN);
View Full Code Here


                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);
View Full Code Here

                Type.BOOLEAN, Type.NO_ARGS, Constants.INVOKEINTERFACE));

            // 1
            il.append(InstructionConstants.ICONST_1);
            // if (jdoIsDetached() == 1)
            IF_ICMPEQ ifIsDetached = new IF_ICMPEQ(null);
            il.append(ifIsDetached);
            // return;
            il.append(InstructionConstants.ALOAD_0);
            il.append(InstructionFactory.createLoad(nativeType, 1));
                il.append(factory.createInvoke(
                    className,
                    "jdo"+BCELUtils.getSetterName(fieldName),
                    Type.VOID,
                    new Type[] {nativeType},
                    Constants.INVOKEVIRTUAL));           
            il.append(InstructionConstants.RETURN);

            // ((BitSet)jdoDetachedState[3]).set(?)
            //   jdoDetachedState[3]
            ifIsDetached.setTarget(il.append(InstructionConstants.ALOAD_0));
            il.append(factory.createGetField(className, ClassEnhancer.FN_JdoDetachedState, BCELClassEnhancer.OT_ObjectArray));
            il.append(InstructionConstants.ICONST_3);
            il.append(InstructionConstants.AALOAD);
            il.append(factory.createCheckCast(BCELClassEnhancer.OT_BitSet)); // Cast to BitSet
View Full Code Here

            il.append(checkFmNotNull);
            createThrowException(ClassEnhancer.CN_IllegalArgumentException, "ObjectIdFieldSupplier is null");
            checkFmNotNull.setTarget(il.append(InstructionConstants.ALOAD_2));
            il.append(factory.createInstanceOf(oidType));
            il.append(InstructionConstants.ICONST_1);
            BranchInstruction isInstanceof = new IF_ICMPEQ(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

                Type.BOOLEAN, Type.NO_ARGS, Constants.INVOKEINTERFACE));

            // 1
            il.append(InstructionConstants.ICONST_1);
            // if (jdoIsDetached() == 1)
            IF_ICMPEQ ifIsDetached = new IF_ICMPEQ(null);
            il.append(ifIsDetached);
            // return;
            il.append(InstructionConstants.RETURN);

            // ((BitSet)jdoDetachedState[3]).set(?)
            //   jdoDetachedState[3]
            ifIsDetached.setTarget(il.append(InstructionConstants.ALOAD_0));
            il.append(factory.createGetField(className, ClassEnhancer.FN_JdoDetachedState, BCELClassEnhancer.OT_ObjectArray));
            il.append(InstructionConstants.ICONST_3);
            il.append(InstructionConstants.AALOAD);
            il.append(factory.createCheckCast(BCELClassEnhancer.OT_BitSet)); // Cast to BitSet
View Full Code Here

                Type.BOOLEAN, Type.NO_ARGS, Constants.INVOKEINTERFACE));

            // 0
            il.append(InstructionConstants.ICONST_1);
            // if (jdoIsDetached() == 1)
            IF_ICMPEQ ifIsDetached = new IF_ICMPEQ(null);
            il.append(ifIsDetached);
            // return null;
            il.append(InstructionConstants.ACONST_NULL);
            il.append(InstructionConstants.ARETURN);

            // return jdoDetachedState[1];
            ifIsDetached.setTarget(il.append(InstructionConstants.ALOAD_0));
            il.append(factory.createGetField(className, ClassEnhancer.FN_JdoDetachedState, BCELClassEnhancer.OT_ObjectArray));
            il.append(InstructionConstants.ICONST_1);
            il.append(InstructionConstants.AALOAD);

            il.append(InstructionConstants.ARETURN);
View Full Code Here

                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 (((BitSet)jdoDetachedState[2]).get(?) == 1)
            //   (BitSet)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 (jdoDetachedState[2].get(?) == 1)
            IF_ICMPEQ ifLoaded = new IF_ICMPEQ(null);
            il.append(ifLoaded);

            // if (jdoDetachedState[3].get(?) == 1 )
            //   (BitSet)jdoDetachedState[3]
            ifLoaded.setTarget(il.append(InstructionConstants.ALOAD_0));
            il.append(factory.createGetField(className, ClassEnhancer.FN_JdoDetachedState, BCELClassEnhancer.OT_ObjectArray));
            il.append(InstructionConstants.ICONST_3);
            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 (jdoDetachedState[3].get(?) == 1)
            IF_ICMPEQ ifModified = new IF_ICMPEQ(null);
            il.append(ifModified);

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

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

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

            jump2.setTarget(jumpTarget);
            jump3.setTarget(jumpTarget);
            ifIsDetached.setTarget(jumpTarget2);
            ifLoaded.setTarget(jumpTarget2);
            ifModified.setTarget(jumpTarget2);
        }
        else
        {
            // return <target field>
            jumpTarget = il.append(InstructionConstants.ALOAD_0);
View Full Code Here

    il.append(new PUSH(cpg, rule.getNamespace()));
    il.append(new INVOKEVIRTUAL(strcmp));
    il.append(ICONST_0);

    if (rule.getAction() == STRIP_SPACE) {
        strip[sCount++] = il.append(new IF_ICMPEQ(null));
    }
    else {
        preserve[pCount++] = il.append(new IF_ICMPEQ(null));
    }
      }
      // Handle elements="ns:el" type rule
      else if (rule.getStrength() == RULE_ELEMENT) {
    // Create the QName for the element
    final Parser parser = classGen.getParser();
    QName qname;
    if (rule.getNamespace() != Constants.EMPTYSTRING )
        qname = parser.getQName(rule.getNamespace(), null,
              rule.getElement());
    else
        qname = parser.getQName(rule.getElement());

    // Register the element.
    final int elementType = xsltc.registerElement(qname);
    il.append(new ILOAD(paramType));
    il.append(new PUSH(cpg, elementType));

    // Compare current node type with wanted element type
    if (rule.getAction() == STRIP_SPACE)
        strip[sCount++] = il.append(new IF_ICMPEQ(null));
    else
        preserve[pCount++] = il.append(new IF_ICMPEQ(null));
      }
  }

  if (defaultAction == STRIP_SPACE) {
      compileStripSpace(strip, sCount, il);
View Full Code Here

      il.append(SWAP);
      il.append(new INVOKEINTERFACE(getEType, 2));
      il.append(new PUSH(cpg, _nodeType));
 
      // Need to allow for long jumps here
      final BranchHandle icmp = il.append(new IF_ICMPEQ(null));
      _falseList.add(il.append(new GOTO_W(null)));
      icmp.setTarget(il.append(NOP));
  }
    }
View Full Code Here

  if (tleft instanceof BooleanType) {
      _left.translate(classGen, methodGen);
      _right.translate(classGen, methodGen);
      _falseList.add(il.append(_op == Operators.EQ ?
             (BranchInstruction)new IF_ICMPNE(null) :
             (BranchInstruction)new IF_ICMPEQ(null)));
  }
  else if (tleft instanceof NumberType) {
      _left.translate(classGen, methodGen);
      _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) :
           (BranchInstruction)new IF_ICMPEQ(null)));
      }
  }
  else {
      translate(classGen, methodGen);
      desynthesize(classGen, methodGen);
View Full Code Here

TOP

Related Classes of org.apache.bcel.generic.IF_ICMPEQ

Copyright © 2018 www.massapicom. 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.