• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java InstructionList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: initialize

import com.sun.org.apache.bcel.internal.generic.InstructionList; //导入依赖的package包/类
/**
 * This method is part of a little trick that is needed to use local
 * variables inside nested for-each loops. See the initializeVariables()
 * method in the ForEach class for an explanation
 */
public void initialize(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // This is only done for local variables that are actually used
    if (isLocal() && !_refs.isEmpty()) {
        // Create a variable slot if none is allocated
        if (_local == null) {
            _local = methodGen.addLocalVariable2(getEscapedName(),
                                                 _type.toJCType(),
                                                 null);
        }
        // Push the default value on the JVM's stack
        if ((_type instanceof IntType) ||
            (_type instanceof NodeType) ||
            (_type instanceof BooleanType))
            il.append(new ICONST(0)); // 0 for node-id, integer and boolean
        else if (_type instanceof RealType)
            il.append(new DCONST(0)); // 0.0 for floating point numbers
        else
            il.append(new ACONST_NULL()); // and 'null' for anything else

        // Mark the store as the start of the live range of the variable
        _local.setStart(il.append(_type.STORE(_local.getIndex())));

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


示例17: mapRegister

import com.sun.org.apache.bcel.internal.generic.InstructionList; //导入依赖的package包/类
/**
 * Map this variable to a register
 */
public void mapRegister(MethodGenerator methodGen) {
    if (_local == null) {
        final InstructionList il = methodGen.getInstructionList();
        final String name = getEscapedName(); // TODO: namespace ?
        final com.sun.org.apache.bcel.internal.generic.Type varType = _type.toJCType();
        _local = methodGen.addLocalVariable2(name, varType, il.getEnd());
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:VariableBase.java


示例18: translateTo

import com.sun.org.apache.bcel.internal.generic.InstructionList; //导入依赖的package包/类
/**
 * Translates a node-set into a synthesized boolean.
 * The boolean value of a node-set is "true" if non-empty
 * and "false" otherwise. Notice that the
 * function getFirstNode() is called in translateToDesynthesized().
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        BooleanType type) {
    final InstructionList il = methodGen.getInstructionList();
    FlowList falsel = translateToDesynthesized(classGen, methodGen, type);
    il.append(ICONST_1);
    final BranchHandle truec = il.append(new GOTO(null));
    falsel.backPatch(il.append(ICONST_0));
    truec.setTarget(il.append(NOP));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:NodeSetType.java


示例19: translateUnBox

import com.sun.org.apache.bcel.internal.generic.InstructionList; //导入依赖的package包/类
/**
 * Translates an object of this type to its unboxed representation.
 */
public void translateUnBox(ClassGenerator classGen,
                           MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    il.append(new CHECKCAST(cpg.addClass(BOOLEAN_CLASS)));
    il.append(new INVOKEVIRTUAL(cpg.addMethodref(BOOLEAN_CLASS,
                                                 BOOLEAN_VALUE,
                                                 BOOLEAN_VALUE_SIG)));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:BooleanType.java


示例20: 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();
    // Feck the this pointer on the stack...
    il.append(methodGen.loadDOM());
    // ...then the entity name...
    _entity.translate(classGen, methodGen);
    // ...to get the URI from the DOM object.
    il.append(new INVOKEINTERFACE(
                     cpg.addInterfaceMethodref(DOM_INTF,
                                               GET_UNPARSED_ENTITY_URI,
                                               GET_UNPARSED_ENTITY_URI_SIG),
                     2));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:UnparsedEntityUriCall.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ValueProvider类代码示例发布时间:2022-05-23
下一篇:
Java UpnpInputArgument类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap