Package org.apache.bcel.generic

Examples of org.apache.bcel.generic.INVOKEVIRTUAL


  if (stylesheet.hasLocalParams() || hasContents()) {
      il.append(classGen.loadTranslet());
      final int pushFrame = cpg.addMethodref(TRANSLET_CLASS,
               PUSH_PARAM_FRAME,
               PUSH_PARAM_FRAME_SIG);
      il.append(new INVOKEVIRTUAL(pushFrame));
      // translate with-params
      translateContents(classGen, methodGen);
  }


  il.append(classGen.loadTranslet());

  // The 'select' expression is a result-tree
  if ((_type != null) && (_type instanceof ResultTreeType)) {
      // <xsl:sort> cannot be applied to a result tree - issue warning
      if (sortObjects.size() > 0) {
    ErrorMsg err = new ErrorMsg(ErrorMsg.RESULT_TREE_SORT_ERR,this);
    getParser().reportError(WARNING, err);
      }
      // Put the result tree (a DOM adapter) on the stack
      _select.translate(classGen, methodGen)
      // Get back the DOM and iterator (not just iterator!!!)
      _type.translateTo(classGen, methodGen, Type.NodeSet);
  }
  else {
      il.append(methodGen.loadDOM());

      // compute node iterator for applyTemplates
      if (sortObjects.size() > 0) {
    Sort.translateSortIterator(classGen, methodGen,
             _select, sortObjects);
    int setStartNode = cpg.addInterfaceMethodref(NODE_ITERATOR,
                   SET_START_NODE,
                   "(I)"+
                   NODE_ITERATOR_SIG);
    il.append(methodGen.loadCurrentNode());
    il.append(new INVOKEINTERFACE(setStartNode,2));
    setStartNodeCalled = true
      }
      else {
    if (_select == null)
        Mode.compileGetChildren(classGen, methodGen, current);
    else
        _select.translate(classGen, methodGen);
      }
  }

  if (_select != null && !setStartNodeCalled) {
      _select.startIterator(classGen, methodGen);
  }

  //!!! need to instantiate all needed modes
  final String className = classGen.getStylesheet().getClassName();
  il.append(methodGen.loadHandler());
  final String applyTemplatesSig = classGen.getApplyTemplatesSig();
  final int applyTemplates = cpg.addMethodref(className,
                _functionName,
                applyTemplatesSig);
  il.append(new INVOKEVIRTUAL(applyTemplates));
 
  // Pop parameter frame
  if (stylesheet.hasLocalParams() || hasContents()) {
      il.append(classGen.loadTranslet());
      final int popFrame = cpg.addMethodref(TRANSLET_CLASS,
              POP_PARAM_FRAME,
              POP_PARAM_FRAME_SIG);
      il.append(new INVOKEVIRTUAL(popFrame));
  }
    }
View Full Code Here


      handler.setStart(il.append(new ASTORE(handler.getIndex())));

      // Call the method that implements this result tree
      index = cpg.addMethodref(className, _methodName,
             "("+DOM_INTF_SIG+TRANSLET_OUTPUT_SIG+")V");
      il.append(new INVOKEVIRTUAL(index));
     
      // Restore new handler and call getValue()
      handler.setEnd(il.append(new ALOAD(handler.getIndex())));
      index = cpg.addMethodref(STRING_VALUE_HANDLER,
             "getValue",
             "()" + STRING_SIG);
      il.append(new INVOKEVIRTUAL(index));
  }
    }
View Full Code Here

             _methodName,
             "("
             + DOM_INTF_SIG
             + TRANSLET_OUTPUT_SIG
             +")V");
      il.append(new INVOKEVIRTUAL(index));

      // Call endDocument on the DOM handler
      domBuilder.setEnd(il.append(new ALOAD(domBuilder.getIndex())));
      index = cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE,
                "endDocument", "()V");
View Full Code Here

  final InstructionList il = methodGen.getInstructionList();
  il.append(new CHECKCAST(cpg.addClass(INTEGER_CLASS)));
  final int index = cpg.addMethodref(INTEGER_CLASS,
             INT_VALUE,
             INT_VALUE_SIG);
  il.append(new INVOKEVIRTUAL(index));
    }
View Full Code Here

  il.append(methodGen.loadDOM());
  il.append(methodGen.loadCurrentNode());
  il.append(new INVOKEINTERFACE(getNodeValue, 2));   

  // Finally do the call to add an entry in the index for this key.
  il.append(new INVOKEVIRTUAL(buildKeyIndex));
 
  il.append(classGen.loadTranslet());
  il.append(new PUSH(cpg, getName()));
  il.append(methodGen.loadDOM());
  il.append(new INVOKEVIRTUAL(keyDom));

  nextNode.setTarget(il.append(methodGen.loadIterator()));
  il.append(methodGen.nextNode())

  il.append(DUP);
View Full Code Here

      il.append(DUP);
      il.append(new PUSH(cpg, _name.toString()));
      il.append(DUP_X1);
      il.append(methodGen.loadCurrentNode());
      _use.translate(classGen, methodGen);
      il.append(new INVOKEVIRTUAL(key));
     
      il.append(methodGen.loadDOM());
      il.append(new INVOKEVIRTUAL(keyDom));
  }
 
  // Get the next node from the iterator and do loop again...
  final InstructionHandle skip = il.append(NOP);
 
View Full Code Here

  // Add the various iterators to the UnionIterator
  final int length = _components.length;
  for (int i = 0; i < length; i++) {
      _components[i].translate(classGen, methodGen);
      il.append(new INVOKEVIRTUAL(iter));
  }

  // Order the iterator only if strictly needed
  if (_reverse) {
      final int order = cpg.addInterfaceMethodref(DOM_INTF,
View Full Code Here

      final ConstantPoolGen cpg = classGen.getConstantPool();
      final InstructionList il = methodGen.getInstructionList();
      final int initBuffer = cpg.addMethodref(STRING_BUFFER_CLASS,
                "<init>", "()V");
      final Instruction append =
    new INVOKEVIRTUAL(cpg.addMethodref(STRING_BUFFER_CLASS,
               "append",
               "(" + STRING_SIG + ")"
               + STRING_BUFFER_SIG));
     
      final int toString = cpg.addMethodref(STRING_BUFFER_CLASS,
              "toString",
              "()"+STRING_SIG);
      il.append(new NEW(cpg.addClass(STRING_BUFFER_CLASS)));
      il.append(DUP);
      il.append(new INVOKESPECIAL(initBuffer));
      // StringBuffer is on the stack
      final Enumeration elements = elements();
      while (elements.hasMoreElements()) {
    final Expression exp = (Expression)elements.nextElement();
    exp.translate(classGen, methodGen);
    il.append(append);
      }
      il.append(new INVOKEVIRTUAL(toString));
  }
    }
View Full Code Here

      final int equals = cpg.addMethodref(STRING_CLASS,
            "equals",
            "(" + OBJECT_SIG +")Z");
      _left.translate(classGen, methodGen);
      _right.translate(classGen, methodGen);
      il.append(new INVOKEVIRTUAL(equals));

        if (_op == Operators.NE) {
    il.append(ICONST_1);
    il.append(IXOR);      // not x <-> x xor 1
      }
      return;
  }

  BranchHandle truec, falsec;
 
  if (tleft instanceof ResultTreeType) {
      if (tright instanceof BooleanType) {
    _right.translate(classGen, methodGen);
        if (_op == Operators.NE) {
        il.append(ICONST_1);
        il.append(IXOR); // not x <-> x xor 1
    }
    return;
      }

      if (tright instanceof RealType) {
    _left.translate(classGen, methodGen);
    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));
    return;
      }

      // Next, result-tree/string and result-tree/result-tree comparisons

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

      if (tright instanceof ResultTreeType) {
    tright.translateTo(classGen, methodGen, Type.String);
      }

      final int equals = cpg.addMethodref(STRING_CLASS,
            "equals",
            "(" +OBJECT_SIG+ ")Z");
      il.append(new INVOKEVIRTUAL(equals));

        if (_op == Operators.NE) {
    il.append(ICONST_1);
    il.append(IXOR);      // not x <-> x xor 1
      }
View Full Code Here

      il.append(new PUSH(cpg, _resolvedQName.toString()));
  }
  else {
      _name.translate(classGen, methodGen);
  }
  il.append(new INVOKEVIRTUAL(get));
  il.append(new INVOKESTATIC(fn3arg));
    }
View Full Code Here

TOP

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

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.