Java Code Examples for com.sun.tools.classfile.Instruction#getPC()

The following examples show how to use com.sun.tools.classfile.Instruction#getPC() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClassReader.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitLookupSwitch(Instruction i, int i1, int i2, int[] ints,
                                 int[] ints1, Void p) {
    Element ie = new Element(i.getMnemonic());
    int pc = i.getPC();
    ie.setAttr("lab", "" + (pc + i1));
    for (int k = 0 ; k < i2 ; k++) {
        Element c = new Element("Case");
        c.setAttr("num", "" + (ints[k]));
        c.setAttr("lab", "" + (pc + ints1[k]));
        c.trimToSize();
        ie.add(c);
    }
    return ie;
}
 
Example 2
Source File: CodeWriter.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public Void visitTableSwitch(Instruction instr,
        int default_, int low, int high, int[] offsets, Integer indent) {
    int pc = instr.getPC();
    print("{ // " + low + " to " + high);
    indent(indent);
    for (int i = 0; i < offsets.length; i++) {
        print(String.format("%n%12d: %d", (low + i), (pc + offsets[i])));
    }
    print("\n     default: " + (pc + default_) + "\n}");
    indent(-indent);
    return null;
}
 
Example 3
Source File: ClassReader.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitTableSwitch(Instruction i, int i1, int i2, int i3,
                                int[] ints, Void p) {
    Element ie = new Element(i.getMnemonic());
    int pc = i.getPC();
    ie.setAttr("lab", "" + (pc + i1));
    for (int k : ints) {
        Element c = new Element("Case");
        c.setAttr("num", "" + (k + i2));
        c.setAttr("lab", "" + (pc + k));
        c.trimToSize();
        ie.add(c);
    }
    return ie;
}
 
Example 4
Source File: TryBlockWriter.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void writeTrys(Instruction instr, NoteKind kind) {
    String indent = space(2); // get from Options?
    int pc = instr.getPC();
    List<Exception_data> entries = pcMap.get(pc);
    if (entries != null) {
        for (ListIterator<Exception_data> iter =
                entries.listIterator(kind == NoteKind.END ? entries.size() : 0);
                kind == NoteKind.END ? iter.hasPrevious() : iter.hasNext() ; ) {
            Exception_data entry =
                    kind == NoteKind.END ? iter.previous() : iter.next();
            if (kind.match(entry, pc)) {
                print(indent);
                print(kind.text);
                print("[");
                print(indexMap.get(entry));
                print("] ");
                if (entry.catch_type == 0)
                    print("finally");
                else {
                    print("#" + entry.catch_type);
                    print(" // ");
                    constantWriter.write(entry.catch_type);
                }
                println();
            }
        }
    }
}
 
Example 5
Source File: CodeWriter.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public Void visitTableSwitch(Instruction instr,
        int default_, int low, int high, int[] offsets, Integer indent) {
    int pc = instr.getPC();
    print("{ // " + low + " to " + high);
    indent(indent);
    for (int i = 0; i < offsets.length; i++) {
        print(String.format("%n%12d: %d", (low + i), (pc + offsets[i])));
    }
    print("\n     default: " + (pc + default_) + "\n}");
    indent(-indent);
    return null;
}
 
Example 6
Source File: CodeWriter.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public Void visitLookupSwitch(Instruction instr,
        int default_, int npairs, int[] matches, int[] offsets, Integer indent) {
    int pc = instr.getPC();
    print("{ // " + npairs);
    indent(indent);
    for (int i = 0; i < npairs; i++) {
        print(String.format("%n%12d: %d", matches[i], (pc + offsets[i])));
    }
    print("\n     default: " + (pc + default_) + "\n}");
    indent(-indent);
    return null;
}
 
Example 7
Source File: CodeWriter.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public Void visitLookupSwitch(Instruction instr,
        int default_, int npairs, int[] matches, int[] offsets, Integer indent) {
    int pc = instr.getPC();
    print("{ // " + npairs);
    indent(indent);
    for (int i = 0; i < npairs; i++) {
        print(String.format("%n%12d: %d", matches[i], (pc + offsets[i])));
    }
    print("\n     default: " + (pc + default_) + "\n}");
    indent(-indent);
    return null;
}
 
Example 8
Source File: ClassReader.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitLookupSwitch(Instruction i, int i1, int i2, int[] ints,
                                 int[] ints1, Void p) {
    Element ie = new Element(i.getMnemonic());
    int pc = i.getPC();
    ie.setAttr("lab", "" + (pc + i1));
    for (int k = 0 ; k < i2 ; k++) {
        Element c = new Element("Case");
        c.setAttr("num", "" + (ints[k]));
        c.setAttr("lab", "" + (pc + ints1[k]));
        c.trimToSize();
        ie.add(c);
    }
    return ie;
}
 
Example 9
Source File: ClassReader.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitTableSwitch(Instruction i, int i1, int i2, int i3,
                                int[] ints, Void p) {
    Element ie = new Element(i.getMnemonic());
    int pc = i.getPC();
    ie.setAttr("lab", "" + (pc + i1));
    for (int k : ints) {
        Element c = new Element("Case");
        c.setAttr("num", "" + (k + i2));
        c.setAttr("lab", "" + (pc + k));
        c.trimToSize();
        ie.add(c);
    }
    return ie;
}
 
Example 10
Source File: ClassReader.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitTableSwitch(Instruction i, int i1, int i2, int i3,
                                int[] ints, Void p) {
    Element ie = new Element(i.getMnemonic());
    int pc = i.getPC();
    ie.setAttr("lab", "" + (pc + i1));
    for (int k : ints) {
        Element c = new Element("Case");
        c.setAttr("num", "" + (k + i2));
        c.setAttr("lab", "" + (pc + k));
        c.trimToSize();
        ie.add(c);
    }
    return ie;
}
 
Example 11
Source File: TypeAnnotationWriter.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
void writeDetails(Instruction instr) {
    String indent = space(2); // get from Options?
    int pc = instr.getPC();
    List<Note> notes = pcMap.get(pc);
    if (notes != null) {
        for (Note n: notes) {
            print(indent);
            print("@");
            annotationWriter.write(n.anno, false, true);
            print(", ");
            println(StringUtils.toLowerCase(n.kind.toString()));
        }
    }
}
 
Example 12
Source File: ClassReader.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitTableSwitch(Instruction i, int i1, int i2, int i3,
                                int[] ints, Void p) {
    Element ie = new Element(i.getMnemonic());
    int pc = i.getPC();
    ie.setAttr("lab", "" + (pc + i1));
    for (int k : ints) {
        Element c = new Element("Case");
        c.setAttr("num", "" + (k + i2));
        c.setAttr("lab", "" + (pc + k));
        c.trimToSize();
        ie.add(c);
    }
    return ie;
}
 
Example 13
Source File: CodeWriter.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public Void visitTableSwitch(Instruction instr,
        int default_, int low, int high, int[] offsets, Integer indent) {
    int pc = instr.getPC();
    print("{ // " + low + " to " + high);
    indent(indent);
    for (int i = 0; i < offsets.length; i++) {
        print(String.format("%n%12d: %d", (low + i), (pc + offsets[i])));
    }
    print("\n     default: " + (pc + default_) + "\n}");
    indent(-indent);
    return null;
}
 
Example 14
Source File: TypeAnnotationWriter.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
void writeDetails(Instruction instr) {
    String indent = space(2); // get from Options?
    int pc = instr.getPC();
    List<Note> notes = pcMap.get(pc);
    if (notes != null) {
        for (Note n: notes) {
            print(indent);
            print("@");
            annotationWriter.write(n.anno, false, true);
            print(", ");
            println(n.kind.toString().toLowerCase());
        }
    }
}
 
Example 15
Source File: TypeAnnotationWriter.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
void writeDetails(Instruction instr) {
    String indent = space(2); // get from Options?
    int pc = instr.getPC();
    List<Note> notes = pcMap.get(pc);
    if (notes != null) {
        for (Note n: notes) {
            print(indent);
            print("@");
            annotationWriter.write(n.anno, false, true);
            print(", ");
            println(n.kind.toString().toLowerCase());
        }
    }
}
 
Example 16
Source File: ClassReader.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitLookupSwitch(Instruction i, int i1, int i2, int[] ints,
                                 int[] ints1, Void p) {
    Element ie = new Element(i.getMnemonic());
    int pc = i.getPC();
    ie.setAttr("lab", "" + (pc + i1));
    for (int k = 0 ; k < i2 ; k++) {
        Element c = new Element("Case");
        c.setAttr("num", "" + (ints[k]));
        c.setAttr("lab", "" + (pc + ints1[k]));
        c.trimToSize();
        ie.add(c);
    }
    return ie;
}
 
Example 17
Source File: LocalVariableTypeTableWriter.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public void writeDetails(Instruction instr) {
    int pc = instr.getPC();
    writeLocalVariables(pc, NoteKind.END);
    writeLocalVariables(pc, NoteKind.START);
}
 
Example 18
Source File: LocalVariableTypeTableWriter.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public void writeDetails(Instruction instr) {
    int pc = instr.getPC();
    writeLocalVariables(pc, NoteKind.END);
    writeLocalVariables(pc, NoteKind.START);
}
 
Example 19
Source File: LocalVariableTypeTableWriter.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void writeDetails(Instruction instr) {
    int pc = instr.getPC();
    writeLocalVariables(pc, NoteKind.END);
    writeLocalVariables(pc, NoteKind.START);
}
 
Example 20
Source File: LocalVariableTableWriter.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public void writeDetails(Instruction instr) {
    int pc = instr.getPC();
    writeLocalVariables(pc, NoteKind.END);
    writeLocalVariables(pc, NoteKind.START);
}