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


Java BranchHandle类代码示例

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


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

示例1: translateFrom

import com.sun.org.apache.bcel.internal.generic.BranchHandle; //导入依赖的package包/类
/**
 * Translates an external (primitive) Java type into a string.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateFrom
 */
public void translateFrom(ClassGenerator classGen,
    MethodGenerator methodGen, Class clazz)
{
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    if (clazz.getName().equals("java.lang.String")) {
        // same internal representation, convert null to ""
        il.append(DUP);
        final BranchHandle ifNonNull = il.append(new IFNONNULL(null));
        il.append(POP);
        il.append(new PUSH(cpg, ""));
        ifNonNull.setTarget(il.append(NOP));
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                    toString(), clazz.getName());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:StringType.java

示例2: translateTo

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

示例3: updateBranchTargets

import com.sun.org.apache.bcel.internal.generic.BranchHandle; //导入依赖的package包/类
private void updateBranchTargets() {
    for (final BranchInstruction bi : branches) {
        final BranchHandle bh = (BranchHandle) branch_map.get(bi);
        final int pos = bh.getPosition();
        final String name = bi.getName() + "_" + pos;
        int t_pos = bh.getTarget().getPosition();
        _out.println("    " + name + ".setTarget(ih_" + t_pos + ");");
        if (bi instanceof Select) {
            final InstructionHandle[] ihs = ((Select) bi).getTargets();
            for (int j = 0; j < ihs.length; j++) {
                t_pos = ihs[j].getPosition();
                _out.println("    " + name + ".setTarget(" + j + ", ih_" + t_pos + ");");
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:BCELFactory.java

示例4: backPatch

import com.sun.org.apache.bcel.internal.generic.BranchHandle; //导入依赖的package包/类
/**
 * Back patch a flow list. All instruction handles must be branch handles.
 */
public void backPatch(InstructionHandle target) {
    if (_elements != null) {
        final int n = _elements.size();
        for (int i = 0; i < n; i++) {
            BranchHandle bh = (BranchHandle)_elements.elementAt(i);
            bh.setTarget(target);
        }
        _elements.clear();          // avoid backpatching more than once
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:FlowList.java

示例5: translateDesynthesized

import com.sun.org.apache.bcel.internal.generic.BranchHandle; //导入依赖的package包/类
public void translateDesynthesized(ClassGenerator classGen,
                                   MethodGenerator methodGen) {
    final InstructionList il = methodGen.getInstructionList();
    final Expression exp = argument();
    exp.translateDesynthesized(classGen, methodGen);
    final BranchHandle gotoh = il.append(new GOTO(null));
    _trueList = exp._falseList;     // swap flow lists
    _falseList = exp._trueList;
    _falseList.add(gotoh);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:NotCall.java

示例6: synthesize

import com.sun.org.apache.bcel.internal.generic.BranchHandle; //导入依赖的package包/类
/**
 * Synthesize a boolean expression, i.e., either push a 0 or 1 onto the
 * operand stack for the next statement to succeed. Returns the handle
 * of the instruction to be backpatched.
 */
public void synthesize(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    _trueList.backPatch(il.append(ICONST_1));
    final BranchHandle truec = il.append(new GOTO_W(null));
    _falseList.backPatch(il.append(ICONST_0));
    truec.setTarget(il.append(NOP));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:Expression.java

示例7: compileStripSpace

import com.sun.org.apache.bcel.internal.generic.BranchHandle; //导入依赖的package包/类
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);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:Whitespace.java

示例8: compilePreserveSpace

import com.sun.org.apache.bcel.internal.generic.BranchHandle; //导入依赖的package包/类
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);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:Whitespace.java

示例9: translateTo

import com.sun.org.apache.bcel.internal.generic.BranchHandle; //导入依赖的package包/类
/**
 * Translates a string into a synthesized boolean.
 *
 * @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:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:StringType.java

示例10: translateTo

import com.sun.org.apache.bcel.internal.generic.BranchHandle; //导入依赖的package包/类
/**
 * Expects an integer on the stack and pushes a 0 if its value is 0 and
 * a 1 otherwise.
 *
 * @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();
    final BranchHandle falsec = il.append(new IFEQ(null));
    il.append(ICONST_1);
    final BranchHandle truec = il.append(new GOTO(null));
    falsec.setTarget(il.append(ICONST_0));
    truec.setTarget(il.append(NOP));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:IntType.java

示例11: translateTo

import com.sun.org.apache.bcel.internal.generic.BranchHandle; //导入依赖的package包/类
/**
 * Expects a real on the stack and pushes a 0 if that number is 0.0 and
 * a 1 otherwise.
 *
 * @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:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:RealType.java

示例12: translateTo

import com.sun.org.apache.bcel.internal.generic.BranchHandle; //导入依赖的package包/类
/**
 * Expects a boolean on the stack and pushes a string. If the value on the
 * stack is zero, then the string 'false' is pushed. Otherwise, the string
 * 'true' is pushed.
 *
 * @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();
    final BranchHandle falsec = il.append(new IFEQ(null));
    il.append(new PUSH(cpg, "true"));
    final BranchHandle truec = il.append(new GOTO(null));
    falsec.setTarget(il.append(new PUSH(cpg, "false")));
    truec.setTarget(il.append(NOP));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:BooleanType.java

示例13: translateTo

import com.sun.org.apache.bcel.internal.generic.BranchHandle; //导入依赖的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:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:NodeSetType.java

示例14: translateTo

import com.sun.org.apache.bcel.internal.generic.BranchHandle; //导入依赖的package包/类
/**
 * Translates a node into a synthesized boolean.
 * If the expression is "@attr",
 * then "true" is pushed iff "attr" is an attribute of the current node.
 * If the expression is ".", the result is always "true".
 *
 * @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:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:NodeType.java


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