Package com.sun.org.apache.bcel.internal.generic

Examples of com.sun.org.apache.bcel.internal.generic.InstructionHandle


    }

    public static void compileStripSpace(BranchHandle strip[],
           int sCount,
           InstructionList il) {
  final InstructionHandle target = il.append(ICONST_1);
  il.append(IRETURN);
  for (int i = 0; i < sCount; i++) {
      strip[i].setTarget(target);
  }
    }
View Full Code Here


    }

    public static void compilePreserveSpace(BranchHandle preserve[],
              int pCount,
              InstructionList il) {
  final InstructionHandle target = il.append(ICONST_0);
  il.append(IRETURN);
  for (int i = 0; i < pCount; i++) {
      preserve[i].setTarget(target);
  }
    }
View Full Code Here

         "extractValueFromDOM", className, il, cpg);

  // Values needed for the switch statement
  final int levels = sortObjects.size();
  final int match[] = new int[levels];
  final InstructionHandle target[] = new InstructionHandle[levels];
  InstructionHandle tblswitch = null;

  // Compile switch statement only if the key has multiple levels
  if (levels > 1) {
      // Put the parameter to the swtich statement on the stack
      il.append(new ILOAD(extractMethod.getLocalIndex("level")));
      // Append the switch statement here later on
      tblswitch = il.append(new NOP());
  }

  // Append all the cases for the switch statment
  for (int level = 0; level < levels; level++) {
      match[level] = level;
      final Sort sort = (Sort)sortObjects.elementAt(level);
      target[level] = il.append(NOP);
      sort.translateSelect(sortRecord, extractMethod);
      il.append(ARETURN);
  }
 
  // Compile def. target for switch statement if key has multiple levels
  if (levels > 1) {
      // Append the default target - it will _NEVER_ be reached
      InstructionHandle defaultTarget =
    il.append(new PUSH(cpg, EMPTYSTRING));
      il.insert(tblswitch,new TABLESWITCH(match, target, defaultTarget));
      il.append(ARETURN);
  }
View Full Code Here

                                 "extractValueFromDOM", className, il, cpg);

        // Values needed for the switch statement
        final int levels = sortObjects.size();
        final int match[] = new int[levels];
        final InstructionHandle target[] = new InstructionHandle[levels];
        InstructionHandle tblswitch = null;

        // Compile switch statement only if the key has multiple levels
        if (levels > 1) {
            // Put the parameter to the swtich statement on the stack
            il.append(new ILOAD(extractMethod.getLocalIndex("level")));
            // Append the switch statement here later on
            tblswitch = il.append(new NOP());
        }

        // Append all the cases for the switch statment
        for (int level = 0; level < levels; level++) {
            match[level] = level;
            final Sort sort = (Sort)sortObjects.elementAt(level);
            target[level] = il.append(NOP);
            sort.translateSelect(sortRecord, extractMethod);
            il.append(ARETURN);
        }

        // Compile def. target for switch statement if key has multiple levels
        if (levels > 1) {
            // Append the default target - it will _NEVER_ be reached
            InstructionHandle defaultTarget =
                il.append(new PUSH(cpg, EMPTYSTRING));
            il.insert(tblswitch,new TABLESWITCH(match, target, defaultTarget));
            il.append(ARETURN);
        }
View Full Code Here

    }

    public static void compileStripSpace(BranchHandle strip[],
                                         int sCount,
                                         InstructionList il) {
        final InstructionHandle target = il.append(ICONST_1);
        il.append(IRETURN);
        for (int i = 0; i < sCount; i++) {
            strip[i].setTarget(target);
        }
    }
View Full Code Here

    }

    public static void compilePreserveSpace(BranchHandle preserve[],
                                            int pCount,
                                            InstructionList il) {
        final InstructionHandle target = il.append(ICONST_0);
        il.append(IRETURN);
        for (int i = 0; i < pCount; i++) {
            preserve[i].setTarget(target);
        }
    }
View Full Code Here

        // next element will hold a handle to the beginning of next
        // When/Otherwise if test on current When fails
        BranchHandle nextElement = null;
        Vector exitHandles = new Vector();
        InstructionHandle exit = null;

        Enumeration whens = whenElements.elements();
        while (whens.hasMoreElements()) {
            final When when = (When)whens.nextElement();
            final Expression test = when.getTest();

            InstructionHandle truec = il.getEnd();

            if (nextElement != null)
                nextElement.setTarget(il.append(NOP));
            test.translateDesynthesized(classGen, methodGen);

            if (test instanceof FunctionCall) {
                FunctionCall call = (FunctionCall)test;
                try {
                    Type type = call.typeCheck(getParser().getSymbolTable());
                    if (type != Type.Boolean) {
                        test._falseList.add(il.append(new IFEQ(null)));
                    }
                }
                catch (TypeCheckError e) {
                    // handled later!
                }
            }
            // remember end of condition
            truec = il.getEnd();

            // The When object should be ignored completely in case it tests
            // for the support of a non-available element
            if (!when.ignore()) when.translateContents(classGen, methodGen);

            // goto exit after executing the body of when
            exitHandles.addElement(il.append(new GOTO(null)));
            if (whens.hasMoreElements() || otherwise != null) {
                nextElement = il.append(new GOTO(null));
                test.backPatchFalseList(nextElement);
            }
            else
                test.backPatchFalseList(exit = il.append(NOP));
            test.backPatchTrueList(truec.getNext());
        }

        // Translate any <xsl:otherwise> element
        if (otherwise != null) {
            nextElement.setTarget(il.append(NOP));
View Full Code Here

            // Add a new local variable and store value
            boolean createLocal = _local == null;
            if (createLocal) {
                mapRegister(methodGen);
            }
            InstructionHandle storeInst =
            il.append(_type.STORE(_local.getIndex()));

            // If the local is just being created, mark the store as the start
            // of its live range.  Note that it might have been created by
            // initializeVariables already, which would have set the start of
View Full Code Here

        final int n = _elements.size();
        final Iterator oldIter = oldList.iterator();
        final Iterator newIter = newList.iterator();

        while (oldIter.hasNext()) {
            final InstructionHandle oldIh = (InstructionHandle) oldIter.next();
            final InstructionHandle newIh = (InstructionHandle) newIter.next();

            for (int i = 0; i < n; i++) {
                if (_elements.elementAt(i) == oldIh) {
                    result.add(newIh);
                }
View Full Code Here

                                                        GET_PARENT_SIG);
        final int getType = cpg.addInterfaceMethodref(DOM_INTF,
                                                      "getExpandedTypeID",
                                                      "(I)I");

        InstructionHandle begin = il.append(methodGen.loadDOM());
        il.append(SWAP);
        il.append(new INVOKEINTERFACE(getParent, 2));
        if (_left instanceof AncestorPattern) {
            il.append(methodGen.loadDOM());
            il.append(SWAP);
View Full Code Here

TOP

Related Classes of com.sun.org.apache.bcel.internal.generic.InstructionHandle

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.