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


Java Instruction.getMnemonic方法代码示例

本文整理汇总了Java中com.sun.tools.classfile.Instruction.getMnemonic方法的典型用法代码示例。如果您正苦于以下问题:Java Instruction.getMnemonic方法的具体用法?Java Instruction.getMnemonic怎么用?Java Instruction.getMnemonic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.tools.classfile.Instruction的用法示例。


在下文中一共展示了Instruction.getMnemonic方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkMethod

import com.sun.tools.classfile.Instruction; //导入方法依赖的package包/类
static void checkMethod(String cname, String mname, ConstantPool cp,
        Code_attribute code) throws ConstantPool.InvalidIndex {
    for (Instruction i : code.getInstructions()) {
        String iname = i.getMnemonic();
        if ("invokespecial".equals(iname)
                || "invokestatic".equals(iname)) {
            int idx = i.getByte(2);
            System.out.println("Verifying " + cname + ":" + mname +
                    " instruction:" + iname + " index @" + idx);
            CPInfo cpinfo = cp.get(idx);
            if (cpinfo instanceof ConstantPool.CONSTANT_Methodref_info) {
                throw new RuntimeException("unexpected CP type expected "
                        + "InterfaceMethodRef, got MethodRef, " + cname
                        + ", " + mname);
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:LambdaAsm.java

示例2: visitNoOperands

import com.sun.tools.classfile.Instruction; //导入方法依赖的package包/类
@Override
public Element visitNoOperands(Instruction i, Void p) {
    Opcode o = i.getOpcode();
    Element e = new Element(i.getMnemonic());
    if (o.opcode > 0xab && o.opcode <= 0xb1) {
        e.setAttr("pc", "" + i.getPC());
    }
    return e;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:ClassReader.java

示例3: visitArrayType

import com.sun.tools.classfile.Instruction; //导入方法依赖的package包/类
@Override
public Element visitArrayType(Instruction i, TypeKind tk, Void p) {
    Element ie = new Element(i.getMnemonic());
    ie.setAttr("num", "" + tk.value);
    ie.setAttr("val", tk.name);
    return ie;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:ClassReader.java

示例4: visitConstantPoolRefAndValue

import com.sun.tools.classfile.Instruction; //导入方法依赖的package包/类
@Override
public Element visitConstantPoolRefAndValue(Instruction i, int i1, int i2, Void p) {
    // workaround for a potential bug in classfile
    Element ie = new Element(i.getMnemonic());
    if (i.getOpcode().equals(Opcode.IINC_W)) {
        ie.setAttr("loc", "" + i1);
        ie.setAttr("num", "" + i2);
    } else {
        ie.setAttr("ref", x.getCpString(i1));
        ie.setAttr("val", "" + i2);
    }
    return ie;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:14,代码来源:ClassReader.java

示例5: visitTableSwitch

import com.sun.tools.classfile.Instruction; //导入方法依赖的package包/类
@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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:ClassReader.java

示例6: visitUnknown

import com.sun.tools.classfile.Instruction; //导入方法依赖的package包/类
@Override
public Element visitUnknown(Instruction i, Void p) {
    Element e = new Element(i.getMnemonic());
    e.setAttr("pc", "" + i.getPC());
    e.setAttr("opcode", "" + i.getOpcode().opcode);
    return e;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:ClassReader.java

示例7: visitLookupSwitch

import com.sun.tools.classfile.Instruction; //导入方法依赖的package包/类
@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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:ClassReader.java

示例8: visitLocalAndValue

import com.sun.tools.classfile.Instruction; //导入方法依赖的package包/类
@Override
public Element visitLocalAndValue(Instruction i, int i1, int i2, Void p) {
    Element ie = new Element(i.getMnemonic());
    ie.setAttr("loc", "" + i1);
    ie.setAttr("num", "" + i2);
    return ie;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:ClassReader.java

示例9: visitValue

import com.sun.tools.classfile.Instruction; //导入方法依赖的package包/类
@Override
public Element visitValue(Instruction i, int i1, Void p) {
    Element ie = new Element(i.getMnemonic());
    ie.setAttr("num", "" + i1);
    return ie;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:ClassReader.java

示例10: visitBranch

import com.sun.tools.classfile.Instruction; //导入方法依赖的package包/类
@Override
public Element visitBranch(Instruction i, int i1, Void p) {
    Element ie = new Element(i.getMnemonic());
    ie.setAttr("lab", "" + (i.getPC() + i1));
    return ie;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:7,代码来源:ClassReader.java

示例11: visitConstantPoolRef

import com.sun.tools.classfile.Instruction; //导入方法依赖的package包/类
@Override
public Element visitConstantPoolRef(Instruction i, int i1, Void p) {
    Element ie = new Element(i.getMnemonic());
    ie.setAttr("ref", x.getCpString(i1));
    return ie;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:7,代码来源:ClassReader.java

示例12: visitLocal

import com.sun.tools.classfile.Instruction; //导入方法依赖的package包/类
@Override
public Element visitLocal(Instruction i, int i1, Void p) {
    Element ie = new Element(i.getMnemonic());
    ie.setAttr("loc", "" + i1);
    return ie;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:7,代码来源:ClassReader.java


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