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


Java InstructionList类代码示例

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


InstructionList类属于com.sun.org.apache.bcel.internal.generic包,在下文中一共展示了InstructionList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: compileInit

import com.sun.org.apache.bcel.internal.generic.InstructionList; //导入依赖的package包/类
/**
 * Create a constructor for the new class. Updates the reference to the
 * collator in the super calls only when the stylesheet specifies a new
 * language in xsl:sort.
 */
private static MethodGenerator compileInit(Vector sortObjects,
                                       NodeSortRecordGenerator sortRecord,
                                       ConstantPoolGen cpg,
                                       String className)
{
    final InstructionList il = new InstructionList();
    final MethodGenerator init =
        new MethodGenerator(ACC_PUBLIC,
                            com.sun.org.apache.bcel.internal.generic.Type.VOID,
                            null, null, "<init>", className,
                            il, cpg);

    // Call the constructor in the NodeSortRecord superclass
    il.append(ALOAD_0);
    il.append(new INVOKESPECIAL(cpg.addMethodref(NODE_SORT_RECORD,
                                                 "<init>", "()V")));



    il.append(RETURN);

    return init;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:Sort.java

示例2: compileDefaultText

import com.sun.org.apache.bcel.internal.generic.InstructionList; //导入依赖的package包/类
/**
 * Compiles the default action for DOM text nodes and attribute nodes:
 * output the node's text value
 */
private InstructionList compileDefaultText(ClassGenerator classGen,
                                           MethodGenerator methodGen,
                                           InstructionHandle next) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = new InstructionList();

    final int chars = cpg.addInterfaceMethodref(DOM_INTF,
                                                CHARACTERS,
                                                CHARACTERS_SIG);
    il.append(methodGen.loadDOM());
    il.append(new ILOAD(_currentIndex));
    il.append(methodGen.loadHandler());
    il.append(new INVOKEINTERFACE(chars, 3));
    il.append(new GOTO_W(next));
    return il;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:Mode.java

示例3: translateTo

import com.sun.org.apache.bcel.internal.generic.InstructionList; //导入依赖的package包/类
/**
 * Translates reference into object of internal type <code>type</code>.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        StringType type) {
    final int current = methodGen.getLocalIndex("current");
    ConstantPoolGen cpg = classGen.getConstantPool();
    InstructionList il = methodGen.getInstructionList();

    // If no current, conversion is a top-level
    if (current < 0) {
        il.append(new PUSH(cpg, DTM.ROOT_NODE));  // push root node
    }
    else {
        il.append(new ILOAD(current));
    }
    il.append(methodGen.loadDOM());
    final int stringF = cpg.addMethodref(BASIS_LIBRARY_CLASS,
                                         "stringF",
                                         "("
                                         + OBJECT_SIG
                                         + NODE_SIG
                                         + DOM_INTF_SIG
                                         + ")" + STRING_SIG);
    il.append(new INVOKESTATIC(stringF));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:ReferenceType.java

示例4: translateTo

import com.sun.org.apache.bcel.internal.generic.InstructionList; //导入依赖的package包/类
/**
 * Casts a reference into a NodeIterator.
 *
 * @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();
    int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "referenceToNodeSet",
                                 "("
                                 + OBJECT_SIG
                                 + ")"
                                 + NODE_ITERATOR_SIG);
    il.append(new INVOKESTATIC(index));

    // Reset this iterator
    index = cpg.addInterfaceMethodref(NODE_ITERATOR, RESET, RESET_SIG);
    il.append(new INVOKEINTERFACE(index, 1));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:ReferenceType.java

示例5: translate

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

    if (argumentCount() == 0) {
        il.append(methodGen.loadContextNode());
        targ = Type.Node;
    }
    else {
        final Expression arg = argument();
        arg.translate(classGen, methodGen);
        arg.startIterator(classGen, methodGen);
        targ = arg.getType();
    }

    if (!targ.identicalTo(Type.String)) {
        targ.translateTo(classGen, methodGen, Type.String);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:StringCall.java

示例6: startIterator

import com.sun.org.apache.bcel.internal.generic.InstructionList; //导入依赖的package包/类
/**
 * If this expression is of type node-set and it is not a variable
 * reference, then call setStartNode() passing the context node.
 */
public void startIterator(ClassGenerator classGen,
                               MethodGenerator methodGen) {
    // Ignore if type is not node-set
    if (_type instanceof NodeSetType == false) {
        return;
    }

    // setStartNode() should not be called if expr is a variable ref
    Expression expr = this;
    if (expr instanceof CastExpr) {
        expr = ((CastExpr) expr).getExpr();
    }
    if (expr instanceof VariableRefBase == false) {
        final InstructionList il = methodGen.getInstructionList();
        il.append(methodGen.loadContextNode());
        il.append(methodGen.setStartNode());
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:Expression.java

示例7: translate

import com.sun.org.apache.bcel.internal.generic.InstructionList; //导入依赖的package包/类
/**
 * This method is called when the constructor is compiled in
 * Stylesheet.compileConstructor() and not as the syntax tree is traversed.
 */
public void translate(ClassGenerator classGen,
                      MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // Returns the name of a node in the DOM
    final int getNodeName = cpg.addInterfaceMethodref(DOM_INTF,
                                                      "getNodeName",
                                                      "(I)"+STRING_SIG);

    final int getLocalName = cpg.addMethodref(BASIS_LIBRARY_CLASS,
                                              "getLocalName",
                                              "(Ljava/lang/String;)"+
                                              "Ljava/lang/String;");
    super.translate(classGen, methodGen);
    il.append(new INVOKEINTERFACE(getNodeName, 2));
    il.append(new INVOKESTATIC(getLocalName));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:LocalNameCall.java

示例8: copyAndRedirect

import com.sun.org.apache.bcel.internal.generic.InstructionList; //导入依赖的package包/类
/**
 * Redirect the handles from oldList to newList. "This" flow list
 * is assumed to be relative to oldList.
 */
public FlowList copyAndRedirect(InstructionList oldList,
    InstructionList newList)
{
    final FlowList result = new FlowList();
    if (_elements == null) {
        return result;
    }

    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);
            }
        }
    }
    return result;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:FlowList.java

示例9: translate

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

    if (hasPredicates()) {
        switch (_contextCase) {
        case NO_CONTEXT:
            translateNoContext(classGen, methodGen);
            break;

        case SIMPLE_CONTEXT:
            translateSimpleContext(classGen, methodGen);
            break;

        default:
            translateGeneralContext(classGen, methodGen);
            break;
        }
    }
    else if (isWildcard()) {
        il.append(POP);     // true list falls through
    }
    else {
        translateKernel(classGen, methodGen);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:StepPattern.java

示例10: translate

import com.sun.org.apache.bcel.internal.generic.InstructionList; //导入依赖的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

示例11: loadAsArrayOffsetLength

import com.sun.org.apache.bcel.internal.generic.InstructionList; //导入依赖的package包/类
/**
 * Generates code that loads the array that will contain the character
 * data represented by this Text node, followed by the offset of the
 * data from the start of the array, and then the length of the data.
 *
 * The pre-condition to calling this method is that
 * canLoadAsArrayOffsetLength() returns true.
 * @see #canLoadArrayOffsetLength()
 */
public void loadAsArrayOffsetLength(ClassGenerator classGen,
                                    MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    final XSLTC xsltc = classGen.getParser().getXSLTC();

    // The XSLTC object keeps track of character data
    // that is to be stored in char arrays.
    final int offset = xsltc.addCharacterData(_text);
    final int length = _text.length();
    String charDataFieldName =
        STATIC_CHAR_DATA_FIELD + (xsltc.getCharacterDataCount()-1);

    il.append(new GETSTATIC(cpg.addFieldref(xsltc.getClassName(),
                                   charDataFieldName,
                                   STATIC_CHAR_DATA_FIELD_SIG)));
    il.append(new PUSH(cpg, offset));
    il.append(new PUSH(cpg, _text.length()));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:Text.java

示例12: translateTo

import com.sun.org.apache.bcel.internal.generic.InstructionList; //导入依赖的package包/类
/**
 * Expects an integer on the stack and pushes its string value by calling
 * <code>Integer.toString(int i)</code>.
 *
 * @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();

    il.append(DUP);
    final BranchHandle ifNull = il.append(new IFNULL(null));
    il.append(new INVOKEVIRTUAL(cpg.addMethodref(_javaClassName,
                                                "toString",
                                                "()" + STRING_SIG)));
    final BranchHandle gotobh = il.append(new GOTO(null));
    ifNull.setTarget(il.append(POP));
    il.append(new PUSH(cpg, ""));
    gotobh.setTarget(il.append(NOP));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:ObjectType.java

示例13: AttributeSetMethodGenerator

import com.sun.org.apache.bcel.internal.generic.InstructionList; //导入依赖的package包/类
public AttributeSetMethodGenerator(String methodName, ClassGenerator classGen) {
     super(com.sun.org.apache.bcel.internal.Const.ACC_PRIVATE,
           com.sun.org.apache.bcel.internal.generic.Type.VOID,
           argTypes, argNames, methodName,
           classGen.getClassName(),
           new InstructionList(),
           classGen.getConstantPool());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:AttributeSetMethodGenerator.java

示例14: compileDefault

import com.sun.org.apache.bcel.internal.generic.InstructionList; //导入依赖的package包/类
/**
 * Compiles the predicate method
 */
private static void compileDefault(int defaultAction,
                                   ClassGenerator classGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = new InstructionList();
    final XSLTC xsltc = classGen.getParser().getXSLTC();

    // private boolean Translet.stripSpace(int type) - cannot be static
    final MethodGenerator stripSpace =
        new MethodGenerator(ACC_PUBLIC | ACC_FINAL ,
                    com.sun.org.apache.bcel.internal.generic.Type.BOOLEAN,
                    new com.sun.org.apache.bcel.internal.generic.Type[] {
                        Util.getJCRefType(DOM_INTF_SIG),
                        com.sun.org.apache.bcel.internal.generic.Type.INT,
                        com.sun.org.apache.bcel.internal.generic.Type.INT
                    },
                    new String[] { "dom","node","type" },
                    "stripSpace",classGen.getClassName(),il,cpg);

    classGen.addInterface("com/sun/org/apache/xalan/internal/xsltc/StripFilter");

    if (defaultAction == STRIP_SPACE)
        il.append(ICONST_1);
    else
        il.append(ICONST_0);
    il.append(IRETURN);

    classGen.addMethod(stripSpace);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:Whitespace.java

示例15: translateTo

import com.sun.org.apache.bcel.internal.generic.InstructionList; //导入依赖的package包/类
/**
 * Translates a node-set into a string. The string value of a node-set is
 * value of its first element.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        StringType type) {
    final InstructionList il = methodGen.getInstructionList();
    getFirstNode(classGen, methodGen);
    il.append(DUP);
    final BranchHandle falsec = il.append(new IFLT(null));
    Type.Node.translateTo(classGen, methodGen, type);
    final BranchHandle truec = il.append(new GOTO(null));
    falsec.setTarget(il.append(POP));
    il.append(new PUSH(classGen.getConstantPool(), ""));
    truec.setTarget(il.append(NOP));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:NodeSetType.java


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