当前位置: 首页>>代码示例>>Java>>正文


Java ConstantPoolGen.addInterfaceMethodref方法代码示例

本文整理汇总了Java中com.sun.org.apache.bcel.internal.generic.ConstantPoolGen.addInterfaceMethodref方法的典型用法代码示例。如果您正苦于以下问题:Java ConstantPoolGen.addInterfaceMethodref方法的具体用法?Java ConstantPoolGen.addInterfaceMethodref怎么用?Java ConstantPoolGen.addInterfaceMethodref使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.org.apache.bcel.internal.generic.ConstantPoolGen的用法示例。


在下文中一共展示了ConstantPoolGen.addInterfaceMethodref方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: compileDefaultRecursion

import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入方法依赖的package包/类
/**
 * Compiles the default handling for DOM elements: traverse all children
 */
private InstructionList compileDefaultRecursion(ClassGenerator classGen,
                                                MethodGenerator methodGen,
                                                InstructionHandle next) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = new InstructionList();
    final String applyTemplatesSig = classGen.getApplyTemplatesSig();
    final int git = cpg.addInterfaceMethodref(DOM_INTF,
                                              GET_CHILDREN,
                                              GET_CHILDREN_SIG);
    final int applyTemplates = cpg.addMethodref(getClassName(),
                                                functionName(),
                                                applyTemplatesSig);
    il.append(classGen.loadTranslet());
    il.append(methodGen.loadDOM());

    il.append(methodGen.loadDOM());
    il.append(new ILOAD(_currentIndex));
    il.append(new INVOKEINTERFACE(git, 2));
    il.append(methodGen.loadHandler());
    il.append(new INVOKEVIRTUAL(applyTemplates));
    il.append(new GOTO_W(next));
    return il;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:Mode.java

示例2: translate

import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入方法依赖的package包/类
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final InstructionList il = methodGen.getInstructionList();

    if (methodGen instanceof CompareGenerator) {
        il.append(((CompareGenerator)methodGen).loadCurrentNode());
    }
    else if (methodGen instanceof TestGenerator) {
        il.append(new ILOAD(POSITION_INDEX));
    }
    else {
        final ConstantPoolGen cpg = classGen.getConstantPool();
        final int index = cpg.addInterfaceMethodref(NODE_ITERATOR,
                                                   "getPosition",
                                                   "()I");

        il.append(methodGen.loadIterator());
        il.append(new INVOKEINTERFACE(index,1));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:PositionCall.java

示例3: unmapRegister

import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入方法依赖的package包/类
/**
 * Remove the mapping of this variable to a register.
 * Called when we leave the AST scope of the variable's declaration
 */
public void unmapRegister(ClassGenerator classGen, MethodGenerator methodGen) {
    if (_local != null) {
        if (_type instanceof ResultTreeType) {
            final ConstantPoolGen cpg = classGen.getConstantPool();
            final InstructionList il = methodGen.getInstructionList();
            if (classGen.getStylesheet().callsNodeset() && classGen.getDOMClass().equals(MULTI_DOM_CLASS)) {
                final int removeDA = cpg.addMethodref(MULTI_DOM_CLASS, "removeDOMAdapter", "(" + DOM_ADAPTER_SIG + ")V");
                il.append(methodGen.loadDOM());
                il.append(new CHECKCAST(cpg.addClass(MULTI_DOM_CLASS)));
                il.append(loadInstruction());
                il.append(new CHECKCAST(cpg.addClass(DOM_ADAPTER_CLASS)));
                il.append(new INVOKEVIRTUAL(removeDA));
            }
            final int release = cpg.addInterfaceMethodref(DOM_IMPL_CLASS, "release", "()V");
            il.append(loadInstruction());
            il.append(new INVOKEINTERFACE(release, 1));
        }

        _local.setEnd(methodGen.getInstructionList().getEnd());
        methodGen.removeLocalVariable(_local);
        _refs = null;
        _local = null;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:VariableBase.java

示例4: translate

import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入方法依赖的package包/类
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final InstructionList il = methodGen.getInstructionList();

    if (methodGen instanceof CompareGenerator) {
        il.append(((CompareGenerator)methodGen).loadLastNode());
    }
    else if (methodGen instanceof TestGenerator) {
        il.append(new ILOAD(LAST_INDEX));
    }
    else {
        final ConstantPoolGen cpg = classGen.getConstantPool();
        final int getLast = cpg.addInterfaceMethodref(NODE_ITERATOR,
                                                      "getLast",
                                                      "()I");
        il.append(methodGen.loadIterator());
        il.append(new INVOKEINTERFACE(getLast, 1));
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:LastCall.java

示例5: translate

import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入方法依赖的package包/类
/**
 * Translate code that leaves a node's QName (as a String) on the stack
 */
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    final int getName = cpg.addInterfaceMethodref(DOM_INTF,
                                                  GET_NODE_NAME,
                                                  GET_NODE_NAME_SIG);
    super.translate(classGen, methodGen);
    il.append(new INVOKEINTERFACE(getName, 2));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:NameCall.java

示例6: translateTo

import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入方法依赖的package包/类
/**
 * Expects a node on the stack and pushes its string value.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        StringType type) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    switch (_type) {
    case NodeTest.ROOT:
    case NodeTest.ELEMENT:
        il.append(methodGen.loadDOM());
        il.append(SWAP); // dom ref must be below node index
        int index = cpg.addInterfaceMethodref(DOM_INTF,
                                              GET_ELEMENT_VALUE,
                                              GET_ELEMENT_VALUE_SIG);
        il.append(new INVOKEINTERFACE(index, 2));
        break;

    case NodeTest.ANODE:
    case NodeTest.COMMENT:
    case NodeTest.ATTRIBUTE:
    case NodeTest.PI:
        il.append(methodGen.loadDOM());
        il.append(SWAP); // dom ref must be below node index
        index = cpg.addInterfaceMethodref(DOM_INTF,
                                          GET_NODE_VALUE,
                                          GET_NODE_VALUE_SIG);
        il.append(new INVOKEINTERFACE(index, 2));
        break;

    default:
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                    toString(), type.toString());
        classGen.getParser().reportError(Constants.FATAL, err);
        break;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:41,代码来源:NodeType.java

示例7: MethodGenerator

import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入方法依赖的package包/类
public MethodGenerator(int access_flags, Type return_type,
                       Type[] arg_types, String[] arg_names,
                       String method_name, String class_name,
                       InstructionList il, ConstantPoolGen cpg) {
    super(access_flags, return_type, arg_types, arg_names, method_name,
          class_name, il, cpg);

    _astoreHandler  = new ASTORE(HANDLER_INDEX);
    _aloadHandler   = new ALOAD(HANDLER_INDEX);
    _astoreIterator = new ASTORE(ITERATOR_INDEX);
    _aloadIterator  = new ALOAD(ITERATOR_INDEX);
    _aloadDom       = new ALOAD(DOM_INDEX);
    _astoreDom      = new ASTORE(DOM_INDEX);

    final int startElement =
        cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE,
                                  "startElement",
                                  START_ELEMENT_SIG);
    _startElement = new INVOKEINTERFACE(startElement, 2);

    final int endElement =
        cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE,
                                  "endElement",
                                  END_ELEMENT_SIG);
    _endElement = new INVOKEINTERFACE(endElement, 2);

    final int attribute =
        cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE,
                                  "addAttribute",
                                  "("
                                  + STRING_SIG
                                  + STRING_SIG
                                  + ")V");
    _attribute = new INVOKEINTERFACE(attribute, 3);

    final int uniqueAttribute =
        cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE,
                                  "addUniqueAttribute",
                                  "("
                                  + STRING_SIG
                                  + STRING_SIG
                                  + "I)V");
    _uniqueAttribute = new INVOKEINTERFACE(uniqueAttribute, 4);

    final int namespace =
        cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE,
                                  "namespaceAfterStartElement",
                                  "("
                                  + STRING_SIG
                                  + STRING_SIG
                                  + ")V");
    _namespace = new INVOKEINTERFACE(namespace, 3);

    int index = cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE,
                                          "startDocument",
                                          "()V");
    _startDocument = new INVOKEINTERFACE(index, 1);

    index = cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE,
                                      "endDocument",
                                      "()V");
    _endDocument = new INVOKEINTERFACE(index, 1);


    index = cpg.addInterfaceMethodref(NODE_ITERATOR,
                                      SET_START_NODE,
                                      SET_START_NODE_SIG);
    _setStartNode = new INVOKEINTERFACE(index, 2);

    index = cpg.addInterfaceMethodref(NODE_ITERATOR,
                                      "reset", "()"+NODE_ITERATOR_SIG);
    _reset = new INVOKEINTERFACE(index, 1);

    index = cpg.addInterfaceMethodref(NODE_ITERATOR, NEXT, NEXT_SIG);
    _nextNode = new INVOKEINTERFACE(index, 1);

    _slotAllocator = new SlotAllocator();
    _slotAllocator.initialize(getLocalVariableRegistry().getLocals(false));
    _allocatorInit = true;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:81,代码来源:MethodGenerator.java

示例8: translate

import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入方法依赖的package包/类
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    final Type tselect = _select.getType();

    final String CPY1_SIG = "("+NODE_ITERATOR_SIG+TRANSLET_OUTPUT_SIG+")V";
    final int cpy1 = cpg.addInterfaceMethodref(DOM_INTF, "copy", CPY1_SIG);

    final String CPY2_SIG = "("+NODE_SIG+TRANSLET_OUTPUT_SIG+")V";
    final int cpy2 = cpg.addInterfaceMethodref(DOM_INTF, "copy", CPY2_SIG);

    final String getDoc_SIG = "()"+NODE_SIG;
    final int getDoc = cpg.addInterfaceMethodref(DOM_INTF, "getDocument", getDoc_SIG);


    if (tselect instanceof NodeSetType) {
        il.append(methodGen.loadDOM());

        // push NodeIterator
        _select.translate(classGen, methodGen);
        _select.startIterator(classGen, methodGen);

        // call copy from the DOM 'library'
        il.append(methodGen.loadHandler());
        il.append(new INVOKEINTERFACE(cpy1, 3));
    }
    else if (tselect instanceof NodeType) {
        il.append(methodGen.loadDOM());
        _select.translate(classGen, methodGen);
        il.append(methodGen.loadHandler());
        il.append(new INVOKEINTERFACE(cpy2, 3));
    }
    else if (tselect instanceof ResultTreeType) {
        _select.translate(classGen, methodGen);
        // We want the whole tree, so we start with the root node
        il.append(DUP); //need a pointer to the DOM ;
        il.append(new INVOKEINTERFACE(getDoc,1)); //ICONST_0);
        il.append(methodGen.loadHandler());
        il.append(new INVOKEINTERFACE(cpy2, 3));
    }
    else if (tselect instanceof ReferenceType) {
        _select.translate(classGen, methodGen);
        il.append(methodGen.loadHandler());
        il.append(methodGen.loadCurrentNode());
        il.append(methodGen.loadDOM());
        final int copy = cpg.addMethodref(BASIS_LIBRARY_CLASS, "copy",
                                          "("
                                          + OBJECT_SIG
                                          + TRANSLET_OUTPUT_SIG
                                          + NODE_SIG
                                          + DOM_INTF_SIG
                                          + ")V");
        il.append(new INVOKESTATIC(copy));
    }
    else {
        il.append(classGen.loadTranslet());
        _select.translate(classGen, methodGen);
        il.append(methodGen.loadHandler());
        il.append(new INVOKEVIRTUAL(cpg.addMethodref(TRANSLET_CLASS,
                                                     CHARACTERSW,
                                                     CHARACTERSW_SIG)));
    }

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:65,代码来源:CopyOf.java

示例9: translateTo

import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入方法依赖的package包/类
/**
 * Expects a result tree on the stack and pushes a node-set (iterator).
 * Note that the produced iterator is an iterator for the DOM that
 * contains the result tree, and not the DOM that is currently in use.
 * This conversion here will therefore not directly work with elements
 * such as <xsl:apply-templates> and <xsl:for-each> without the DOM
 * parameter/variable being updates as well.
 *
 * @param classGen A BCEL class generator
 * @param methodGen A BCEL method generator
 * @param type An instance of NodeSetType (any)
 * @see com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        NodeSetType type) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // Put an extra copy of the result tree (DOM) on the stack
    il.append(DUP);

    // DOM adapters containing a result tree are not initialised with
    // translet-type to DOM-type mapping. This must be done now for
    // XPath expressions and patterns to work for the iterator we create.
    il.append(classGen.loadTranslet()); // get names array
    il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS,
                                           NAMES_INDEX,
                                           NAMES_INDEX_SIG)));
    il.append(classGen.loadTranslet()); // get uris array
    il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS,
                                           URIS_INDEX,
                                           URIS_INDEX_SIG)));
    il.append(classGen.loadTranslet()); // get types array
    il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS,
                                           TYPES_INDEX,
                                           TYPES_INDEX_SIG)));
    il.append(classGen.loadTranslet()); // get namespaces array
    il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS,
                                           NAMESPACE_INDEX,
                                           NAMESPACE_INDEX_SIG)));
    // Pass the type mappings to the DOM adapter
    final int mapping = cpg.addInterfaceMethodref(DOM_INTF,
                                                  "setupMapping",
                                                  "(["+STRING_SIG+
                                                  "["+STRING_SIG+
                                                  "[I" +
                                                  "["+STRING_SIG+")V");
    il.append(new INVOKEINTERFACE(mapping, 5));
    il.append(DUP);

    // Create an iterator for the root node of the DOM adapter
    final int iter = cpg.addInterfaceMethodref(DOM_INTF,
                                               "getIterator",
                                               "()"+NODE_ITERATOR_SIG);
    il.append(new INVOKEINTERFACE(iter, 1));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:57,代码来源:ResultTreeType.java

示例10: translateSortIterator

import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入方法依赖的package包/类
/**
 * Compiles code that instantiates a SortingIterator object.
 * This object's constructor needs referencdes to the current iterator
 * and a node sort record producing objects as its parameters.
 */
public static void translateSortIterator(ClassGenerator classGen,
                                  MethodGenerator methodGen,
                                  Expression nodeSet,
                                  Vector sortObjects)
{
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // SortingIterator.SortingIterator(NodeIterator,NodeSortRecordFactory);
    final int init = cpg.addMethodref(SORT_ITERATOR, "<init>",
                                      "("
                                      + NODE_ITERATOR_SIG
                                      + NODE_SORT_FACTORY_SIG
                                      + ")V");

    // Backwards branches are prohibited if an uninitialized object is
    // on the stack by section 4.9.4 of the JVM Specification, 2nd Ed.
    // We don't know whether this code might contain backwards branches
    // so we mustn't create the new object until after we've created
    // the suspect arguments to its constructor.  Instead we calculate
    // the values of the arguments to the constructor first, store them
    // in temporary variables, create the object and reload the
    // arguments from the temporaries to avoid the problem.

    LocalVariableGen nodesTemp =
        methodGen.addLocalVariable("sort_tmp1",
                                   Util.getJCRefType(NODE_ITERATOR_SIG),
                                   null, null);

    LocalVariableGen sortRecordFactoryTemp =
        methodGen.addLocalVariable("sort_tmp2",
                                  Util.getJCRefType(NODE_SORT_FACTORY_SIG),
                                  null, null);

    // Get the current node iterator
    if (nodeSet == null) {  // apply-templates default
        final int children = cpg.addInterfaceMethodref(DOM_INTF,
                                                       "getAxisIterator",
                                                       "(I)"+
                                                       NODE_ITERATOR_SIG);
        il.append(methodGen.loadDOM());
        il.append(new PUSH(cpg, Axis.CHILD));
        il.append(new INVOKEINTERFACE(children, 2));
    }
    else {
        nodeSet.translate(classGen, methodGen);
    }

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

    // Compile the code for the NodeSortRecord producing class and pass
    // that as the last argument to the SortingIterator constructor.
    compileSortRecordFactory(sortObjects, classGen, methodGen);
    sortRecordFactoryTemp.setStart(
            il.append(new ASTORE(sortRecordFactoryTemp.getIndex())));

    il.append(new NEW(cpg.addClass(SORT_ITERATOR)));
    il.append(DUP);
    nodesTemp.setEnd(il.append(new ALOAD(nodesTemp.getIndex())));
    sortRecordFactoryTemp.setEnd(
            il.append(new ALOAD(sortRecordFactoryTemp.getIndex())));
    il.append(new INVOKESPECIAL(init));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:69,代码来源:Sort.java

示例11: translate

import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入方法依赖的package包/类
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    if (!_isLiteral) {
        // if the ncname is an AVT, then the ncname has to be checked at runtime if it is a valid ncname
        LocalVariableGen nameValue =
                methodGen.addLocalVariable2("nameValue",
        Util.getJCRefType(STRING_SIG),
                                            null);

        // store the name into a variable first so _name.translate only needs to be called once
        _name.translate(classGen, methodGen);
        nameValue.setStart(il.append(new ASTORE(nameValue.getIndex())));
        il.append(new ALOAD(nameValue.getIndex()));

        // call checkNCName if the name is an AVT
        final int check = cpg.addMethodref(BASIS_LIBRARY_CLASS, "checkNCName",
                            "("
                            +STRING_SIG
                            +")V");
                            il.append(new INVOKESTATIC(check));

        // Save the current handler base on the stack
        il.append(methodGen.loadHandler());
        il.append(DUP);     // first arg to "attributes" call

        // load name value again
        nameValue.setEnd(il.append(new ALOAD(nameValue.getIndex())));
    } else {
        // Save the current handler base on the stack
        il.append(methodGen.loadHandler());
        il.append(DUP);     // first arg to "attributes" call

        // Push attribute name
        _name.translate(classGen, methodGen);// 2nd arg

    }

    il.append(classGen.loadTranslet());
    il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS,
                                           "stringValueHandler",
                                           STRING_VALUE_HANDLER_SIG)));
    il.append(DUP);
    il.append(methodGen.storeHandler());

    // translate contents with substituted handler
    translateContents(classGen, methodGen);

    // get String out of the handler
    il.append(new INVOKEVIRTUAL(cpg.addMethodref(STRING_VALUE_HANDLER,
                                                 "getValueOfPI",
                                                 "()" + STRING_SIG)));
    // call "processingInstruction"
    final int processingInstruction =
        cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE,
                                  "processingInstruction",
                                  "(" + STRING_SIG + STRING_SIG + ")V");
    il.append(new INVOKEINTERFACE(processingInstruction, 3));
    // Restore old handler base from stack
    il.append(methodGen.storeHandler());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:63,代码来源:ProcessingInstruction.java

示例12: translate

import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入方法依赖的package包/类
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    if (_path != null) {
        final int initDFI = cpg.addMethodref(DUP_FILTERED_ITERATOR,
                                            "<init>",
                                            "("
                                            + NODE_ITERATOR_SIG
                                            + ")V");

        // Backwards branches are prohibited if an uninitialized object is
        // on the stack by section 4.9.4 of the JVM Specification, 2nd Ed.
        // We don't know whether this code might contain backwards branches,
        // so we mustn't create the new object until after we've created
        // the suspect arguments to its constructor.  Instead we calculate
        // the values of the arguments to the constructor first, store them
        // in temporary variables, create the object and reload the
        // arguments from the temporaries to avoid the problem.

        // Compile relative path iterator(s)
        LocalVariableGen pathTemp =
           methodGen.addLocalVariable("filtered_absolute_location_path_tmp",
                                      Util.getJCRefType(NODE_ITERATOR_SIG),
                                      null, null);
        _path.translate(classGen, methodGen);
        pathTemp.setStart(il.append(new ASTORE(pathTemp.getIndex())));

        // Create new Dup Filter Iterator
        il.append(new NEW(cpg.addClass(DUP_FILTERED_ITERATOR)));
        il.append(DUP);
        pathTemp.setEnd(il.append(new ALOAD(pathTemp.getIndex())));

        // Initialize Dup Filter Iterator with iterator from the stack
        il.append(new INVOKESPECIAL(initDFI));
    }
    else {
        final int git = cpg.addInterfaceMethodref(DOM_INTF,
                                                  "getIterator",
                                                  "()"+NODE_ITERATOR_SIG);
        il.append(methodGen.loadDOM());
        il.append(new INVOKEINTERFACE(git, 1));
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:44,代码来源:FilteredAbsoluteLocationPath.java

示例13: translate

import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入方法依赖的package包/类
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    if (_left != null) {
        if (_left instanceof StepPattern) {
            final LocalVariableGen local =
                // absolute path pattern temporary
                methodGen.addLocalVariable2("apptmp",
                                            Util.getJCRefType(NODE_SIG),
                                            null);
            il.append(DUP);
            local.setStart(il.append(new ISTORE(local.getIndex())));
            _left.translate(classGen, methodGen);
            il.append(methodGen.loadDOM());
            local.setEnd(il.append(new ILOAD(local.getIndex())));
            methodGen.removeLocalVariable(local);
        }
        else {
            _left.translate(classGen, methodGen);
        }
    }

    final int getParent = cpg.addInterfaceMethodref(DOM_INTF,
                                                    GET_PARENT,
                                                    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);
    }
    il.append(new INVOKEINTERFACE(getType, 2));
    il.append(new PUSH(cpg, DTM.DOCUMENT_NODE));

    final BranchHandle skip = il.append(new IF_ICMPEQ(null));
    _falseList.add(il.append(new GOTO_W(null)));
    skip.setTarget(il.append(NOP));

    if (_left != null) {
        _left.backPatchTrueList(begin);

        /*
         * If _left is an ancestor pattern, backpatch this pattern's false
         * list to the loop that searches for more ancestors.
         */
        if (_left instanceof AncestorPattern) {
            final AncestorPattern ancestor = (AncestorPattern) _left;
            _falseList.backPatch(ancestor.getLoopHandle());         // clears list
        }
        _falseList.append(_left._falseList);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:59,代码来源:AbsolutePathPattern.java

示例14: translate

import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入方法依赖的package包/类
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    if (_path != null) {
        final int initAI = cpg.addMethodref(ABSOLUTE_ITERATOR,
                                            "<init>",
                                            "("
                                            + NODE_ITERATOR_SIG
                                            + ")V");

        // Compile relative path iterator(s)
        //
        // Backwards branches are prohibited if an uninitialized object is
        // on the stack by section 4.9.4 of the JVM Specification, 2nd Ed.
        // We don't know whether this code might contain backwards branches,
        // so we mustn't create the new object until after we've created
        // this argument to its constructor.  Instead we calculate the
        // value of the argument to the constructor first, store it in
        // a temporary variable, create the object and reload the argument
        // from the temporary to avoid the problem.
        _path.translate(classGen, methodGen);
        LocalVariableGen relPathIterator
                = methodGen.addLocalVariable("abs_location_path_tmp",
                                   Util.getJCRefType(NODE_ITERATOR_SIG),
                                   null, null);
        relPathIterator.setStart(
                il.append(new ASTORE(relPathIterator.getIndex())));

        // Create new AbsoluteIterator
        il.append(new NEW(cpg.addClass(ABSOLUTE_ITERATOR)));
        il.append(DUP);
        relPathIterator.setEnd(
                il.append(new ALOAD(relPathIterator.getIndex())));

        // Initialize AbsoluteIterator with iterator from the stack
        il.append(new INVOKESPECIAL(initAI));
    }
    else {
        final int gitr = cpg.addInterfaceMethodref(DOM_INTF,
                                                   "getIterator",
                                                   "()"+NODE_ITERATOR_SIG);
        il.append(methodGen.loadDOM());
        il.append(new INVOKEINTERFACE(gitr, 1));
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:46,代码来源:AbsoluteLocationPath.java

示例15: translate

import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入方法依赖的package包/类
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    final LocalVariableGen local =
        methodGen.addLocalVariable2("ppt",
                                    Util.getJCRefType(NODE_SIG),
                                    null);

    final com.sun.org.apache.bcel.internal.generic.Instruction loadLocal =
        new ILOAD(local.getIndex());
    final com.sun.org.apache.bcel.internal.generic.Instruction storeLocal =
        new ISTORE(local.getIndex());

    if (_right.isWildcard()) {
        il.append(methodGen.loadDOM());
        il.append(SWAP);
    }
    else if (_right instanceof StepPattern) {
        il.append(DUP);
        local.setStart(il.append(storeLocal));

        _right.translate(classGen, methodGen);

        il.append(methodGen.loadDOM());
        local.setEnd(il.append(loadLocal));
    }
    else {
        _right.translate(classGen, methodGen);

        if (_right instanceof AncestorPattern) {
            il.append(methodGen.loadDOM());
            il.append(SWAP);
        }
    }

    final int getParent = cpg.addInterfaceMethodref(DOM_INTF,
                                                    GET_PARENT,
                                                    GET_PARENT_SIG);
    il.append(new INVOKEINTERFACE(getParent, 2));

    final SyntaxTreeNode p = getParent();
    if (p == null || p instanceof Instruction ||
        p instanceof TopLevelElement)
    {
        _left.translate(classGen, methodGen);
    }
    else {
        il.append(DUP);
        InstructionHandle storeInst = il.append(storeLocal);

        if (local.getStart() == null) {
            local.setStart(storeInst);
        }

        _left.translate(classGen, methodGen);

        il.append(methodGen.loadDOM());
        local.setEnd(il.append(loadLocal));
    }

    methodGen.removeLocalVariable(local);

    /*
     * If _right is an ancestor pattern, backpatch _left false
     * list to the loop that searches for more ancestors.
     */
    if (_right instanceof AncestorPattern) {
        final AncestorPattern ancestor = (AncestorPattern) _right;
        _left.backPatchFalseList(ancestor.getLoopHandle());    // clears list
    }

    _trueList.append(_right._trueList.append(_left._trueList));
    _falseList.append(_right._falseList.append(_left._falseList));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:75,代码来源:ParentPattern.java


注:本文中的com.sun.org.apache.bcel.internal.generic.ConstantPoolGen.addInterfaceMethodref方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。