Java 类com.sun.org.apache.bcel.internal.generic.NOP 实例源码

项目:OpenJSharp    文件:Sort.java   
/**
 * Compiles a method that overloads NodeSortRecord.extractValueFromDOM()
 */
private static MethodGenerator compileExtract(Vector sortObjects,
                                     NodeSortRecordGenerator sortRecord,
                                     ConstantPoolGen cpg,
                                     String className) {
    final InstructionList il = new InstructionList();

    // String NodeSortRecord.extractValueFromDOM(dom,node,level);
    final CompareGenerator extractMethod =
        new CompareGenerator(ACC_PUBLIC | ACC_FINAL,
                             com.sun.org.apache.bcel.internal.generic.Type.STRING,
                             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,
                                 Util.getJCRefType(TRANSLET_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT
                             },
                             new String[] { "dom",
                                            "current",
                                            "level",
                                            "translet",
                                            "last"
                             },
                             "extractValueFromDOM", className, il, cpg);

    // Values needed for the switch statement
    final int levels = sortObjects.size();
    final int match[] = new int[levels];
    final InstructionHandle target[] = new InstructionHandle[levels];
    InstructionHandle tblswitch = null;

    // Compile switch statement only if the key has multiple levels
    if (levels > 1) {
        // Put the parameter to the swtich statement on the stack
        il.append(new ILOAD(extractMethod.getLocalIndex("level")));
        // Append the switch statement here later on
        tblswitch = il.append(new NOP());
    }

    // Append all the cases for the switch statment
    for (int level = 0; level < levels; level++) {
        match[level] = level;
        final Sort sort = (Sort)sortObjects.elementAt(level);
        target[level] = il.append(NOP);
        sort.translateSelect(sortRecord, extractMethod);
        il.append(ARETURN);
    }

    // Compile def. target for switch statement if key has multiple levels
    if (levels > 1) {
        // Append the default target - it will _NEVER_ be reached
        InstructionHandle defaultTarget =
            il.append(new PUSH(cpg, EMPTYSTRING));
        il.insert(tblswitch,new TABLESWITCH(match, target, defaultTarget));
        il.append(ARETURN);
    }

    return extractMethod;
}
项目:openjdk-jdk10    文件:Sort.java   
/**
 * Compiles a method that overloads NodeSortRecord.extractValueFromDOM()
 */
private static MethodGenerator compileExtract(Vector<Sort> sortObjects,
                                     NodeSortRecordGenerator sortRecord,
                                     ConstantPoolGen cpg,
                                     String className) {
    final InstructionList il = new InstructionList();

    // String NodeSortRecord.extractValueFromDOM(dom,node,level);
    final CompareGenerator extractMethod =
        new CompareGenerator(ACC_PUBLIC | ACC_FINAL,
                             com.sun.org.apache.bcel.internal.generic.Type.STRING,
                             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,
                                 Util.getJCRefType(TRANSLET_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT
                             },
                             new String[] { "dom",
                                            "current",
                                            "level",
                                            "translet",
                                            "last"
                             },
                             "extractValueFromDOM", className, il, cpg);

    // Values needed for the switch statement
    final int levels = sortObjects.size();
    final int match[] = new int[levels];
    final InstructionHandle target[] = new InstructionHandle[levels];
    InstructionHandle tblswitch = null;

    // Compile switch statement only if the key has multiple levels
    if (levels > 1) {
        // Put the parameter to the swtich statement on the stack
        il.append(new ILOAD(extractMethod.getLocalIndex("level")));
        // Append the switch statement here later on
        tblswitch = il.append(new NOP());
    }

    // Append all the cases for the switch statment
    for (int level = 0; level < levels; level++) {
        match[level] = level;
        final Sort sort = sortObjects.elementAt(level);
        target[level] = il.append(NOP);
        sort.translateSelect(sortRecord, extractMethod);
        il.append(ARETURN);
    }

    // Compile def. target for switch statement if key has multiple levels
    if (levels > 1) {
        // Append the default target - it will _NEVER_ be reached
        InstructionHandle defaultTarget =
            il.append(new PUSH(cpg, EMPTYSTRING));
        il.insert(tblswitch,new TABLESWITCH(match, target, defaultTarget));
        il.append(ARETURN);
    }

    return extractMethod;
}
项目:openjdk9    文件:Sort.java   
/**
 * Compiles a method that overloads NodeSortRecord.extractValueFromDOM()
 */
private static MethodGenerator compileExtract(Vector<Sort> sortObjects,
                                     NodeSortRecordGenerator sortRecord,
                                     ConstantPoolGen cpg,
                                     String className) {
    final InstructionList il = new InstructionList();

    // String NodeSortRecord.extractValueFromDOM(dom,node,level);
    final CompareGenerator extractMethod =
        new CompareGenerator(ACC_PUBLIC | ACC_FINAL,
                             com.sun.org.apache.bcel.internal.generic.Type.STRING,
                             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,
                                 Util.getJCRefType(TRANSLET_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT
                             },
                             new String[] { "dom",
                                            "current",
                                            "level",
                                            "translet",
                                            "last"
                             },
                             "extractValueFromDOM", className, il, cpg);

    // Values needed for the switch statement
    final int levels = sortObjects.size();
    final int match[] = new int[levels];
    final InstructionHandle target[] = new InstructionHandle[levels];
    InstructionHandle tblswitch = null;

    // Compile switch statement only if the key has multiple levels
    if (levels > 1) {
        // Put the parameter to the swtich statement on the stack
        il.append(new ILOAD(extractMethod.getLocalIndex("level")));
        // Append the switch statement here later on
        tblswitch = il.append(new NOP());
    }

    // Append all the cases for the switch statment
    for (int level = 0; level < levels; level++) {
        match[level] = level;
        final Sort sort = sortObjects.elementAt(level);
        target[level] = il.append(NOP);
        sort.translateSelect(sortRecord, extractMethod);
        il.append(ARETURN);
    }

    // Compile def. target for switch statement if key has multiple levels
    if (levels > 1) {
        // Append the default target - it will _NEVER_ be reached
        InstructionHandle defaultTarget =
            il.append(new PUSH(cpg, EMPTYSTRING));
        il.insert(tblswitch,new TABLESWITCH(match, target, defaultTarget));
        il.append(ARETURN);
    }

    return extractMethod;
}
项目:lookaside_java-1.8.0-openjdk    文件:Sort.java   
/**
 * Compiles a method that overloads NodeSortRecord.extractValueFromDOM()
 */
private static MethodGenerator compileExtract(Vector<Sort> sortObjects,
                                     NodeSortRecordGenerator sortRecord,
                                     ConstantPoolGen cpg,
                                     String className) {
    final InstructionList il = new InstructionList();

    // String NodeSortRecord.extractValueFromDOM(dom,node,level);
    final CompareGenerator extractMethod =
        new CompareGenerator(ACC_PUBLIC | ACC_FINAL,
                             com.sun.org.apache.bcel.internal.generic.Type.STRING,
                             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,
                                 Util.getJCRefType(TRANSLET_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT
                             },
                             new String[] { "dom",
                                            "current",
                                            "level",
                                            "translet",
                                            "last"
                             },
                             "extractValueFromDOM", className, il, cpg);

    // Values needed for the switch statement
    final int levels = sortObjects.size();
    final int match[] = new int[levels];
    final InstructionHandle target[] = new InstructionHandle[levels];
    InstructionHandle tblswitch = null;

    // Compile switch statement only if the key has multiple levels
    if (levels > 1) {
        // Put the parameter to the swtich statement on the stack
        il.append(new ILOAD(extractMethod.getLocalIndex("level")));
        // Append the switch statement here later on
        tblswitch = il.append(new NOP());
    }

    // Append all the cases for the switch statment
    for (int level = 0; level < levels; level++) {
        match[level] = level;
        final Sort sort = sortObjects.elementAt(level);
        target[level] = il.append(NOP);
        sort.translateSelect(sortRecord, extractMethod);
        il.append(ARETURN);
    }

    // Compile def. target for switch statement if key has multiple levels
    if (levels > 1) {
        // Append the default target - it will _NEVER_ be reached
        InstructionHandle defaultTarget =
            il.append(new PUSH(cpg, EMPTYSTRING));
        il.insert(tblswitch,new TABLESWITCH(match, target, defaultTarget));
        il.append(ARETURN);
    }

    return extractMethod;
}
项目:infobip-open-jdk-8    文件:Sort.java   
/**
 * Compiles a method that overloads NodeSortRecord.extractValueFromDOM()
 */
private static MethodGenerator compileExtract(Vector sortObjects,
                                     NodeSortRecordGenerator sortRecord,
                                     ConstantPoolGen cpg,
                                     String className) {
    final InstructionList il = new InstructionList();

    // String NodeSortRecord.extractValueFromDOM(dom,node,level);
    final CompareGenerator extractMethod =
        new CompareGenerator(ACC_PUBLIC | ACC_FINAL,
                             com.sun.org.apache.bcel.internal.generic.Type.STRING,
                             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,
                                 Util.getJCRefType(TRANSLET_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT
                             },
                             new String[] { "dom",
                                            "current",
                                            "level",
                                            "translet",
                                            "last"
                             },
                             "extractValueFromDOM", className, il, cpg);

    // Values needed for the switch statement
    final int levels = sortObjects.size();
    final int match[] = new int[levels];
    final InstructionHandle target[] = new InstructionHandle[levels];
    InstructionHandle tblswitch = null;

    // Compile switch statement only if the key has multiple levels
    if (levels > 1) {
        // Put the parameter to the swtich statement on the stack
        il.append(new ILOAD(extractMethod.getLocalIndex("level")));
        // Append the switch statement here later on
        tblswitch = il.append(new NOP());
    }

    // Append all the cases for the switch statment
    for (int level = 0; level < levels; level++) {
        match[level] = level;
        final Sort sort = (Sort)sortObjects.elementAt(level);
        target[level] = il.append(NOP);
        sort.translateSelect(sortRecord, extractMethod);
        il.append(ARETURN);
    }

    // Compile def. target for switch statement if key has multiple levels
    if (levels > 1) {
        // Append the default target - it will _NEVER_ be reached
        InstructionHandle defaultTarget =
            il.append(new PUSH(cpg, EMPTYSTRING));
        il.insert(tblswitch,new TABLESWITCH(match, target, defaultTarget));
        il.append(ARETURN);
    }

    return extractMethod;
}
项目:OLD-OpenJDK8    文件:Sort.java   
/**
 * Compiles a method that overloads NodeSortRecord.extractValueFromDOM()
 */
private static MethodGenerator compileExtract(Vector sortObjects,
                                     NodeSortRecordGenerator sortRecord,
                                     ConstantPoolGen cpg,
                                     String className) {
    final InstructionList il = new InstructionList();

    // String NodeSortRecord.extractValueFromDOM(dom,node,level);
    final CompareGenerator extractMethod =
        new CompareGenerator(ACC_PUBLIC | ACC_FINAL,
                             com.sun.org.apache.bcel.internal.generic.Type.STRING,
                             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,
                                 Util.getJCRefType(TRANSLET_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT
                             },
                             new String[] { "dom",
                                            "current",
                                            "level",
                                            "translet",
                                            "last"
                             },
                             "extractValueFromDOM", className, il, cpg);

    // Values needed for the switch statement
    final int levels = sortObjects.size();
    final int match[] = new int[levels];
    final InstructionHandle target[] = new InstructionHandle[levels];
    InstructionHandle tblswitch = null;

    // Compile switch statement only if the key has multiple levels
    if (levels > 1) {
        // Put the parameter to the swtich statement on the stack
        il.append(new ILOAD(extractMethod.getLocalIndex("level")));
        // Append the switch statement here later on
        tblswitch = il.append(new NOP());
    }

    // Append all the cases for the switch statment
    for (int level = 0; level < levels; level++) {
        match[level] = level;
        final Sort sort = (Sort)sortObjects.elementAt(level);
        target[level] = il.append(NOP);
        sort.translateSelect(sortRecord, extractMethod);
        il.append(ARETURN);
    }

    // Compile def. target for switch statement if key has multiple levels
    if (levels > 1) {
        // Append the default target - it will _NEVER_ be reached
        InstructionHandle defaultTarget =
            il.append(new PUSH(cpg, EMPTYSTRING));
        il.insert(tblswitch,new TABLESWITCH(match, target, defaultTarget));
        il.append(ARETURN);
    }

    return extractMethod;
}
项目:openjdk-icedtea7    文件:Sort.java   
/**
 * Compiles a method that overloads NodeSortRecord.extractValueFromDOM()
 */
private static MethodGenerator compileExtract(Vector sortObjects,
                                     NodeSortRecordGenerator sortRecord,
                                     ConstantPoolGen cpg,
                                     String className) {
    final InstructionList il = new InstructionList();

    // String NodeSortRecord.extractValueFromDOM(dom,node,level);
    final CompareGenerator extractMethod =
        new CompareGenerator(ACC_PUBLIC | ACC_FINAL,
                             com.sun.org.apache.bcel.internal.generic.Type.STRING,
                             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,
                                 Util.getJCRefType(TRANSLET_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT
                             },
                             new String[] { "dom",
                                            "current",
                                            "level",
                                            "translet",
                                            "last"
                             },
                             "extractValueFromDOM", className, il, cpg);

    // Values needed for the switch statement
    final int levels = sortObjects.size();
    final int match[] = new int[levels];
    final InstructionHandle target[] = new InstructionHandle[levels];
    InstructionHandle tblswitch = null;

    // Compile switch statement only if the key has multiple levels
    if (levels > 1) {
        // Put the parameter to the swtich statement on the stack
        il.append(new ILOAD(extractMethod.getLocalIndex("level")));
        // Append the switch statement here later on
        tblswitch = il.append(new NOP());
    }

    // Append all the cases for the switch statment
    for (int level = 0; level < levels; level++) {
        match[level] = level;
        final Sort sort = (Sort)sortObjects.elementAt(level);
        target[level] = il.append(NOP);
        sort.translateSelect(sortRecord, extractMethod);
        il.append(ARETURN);
    }

    // Compile def. target for switch statement if key has multiple levels
    if (levels > 1) {
        // Append the default target - it will _NEVER_ be reached
        InstructionHandle defaultTarget =
            il.append(new PUSH(cpg, EMPTYSTRING));
        il.insert(tblswitch,new TABLESWITCH(match, target, defaultTarget));
        il.append(ARETURN);
    }

    return extractMethod;
}