use of com.sun.tools.classfile.ConstantPool.CPInfo in project jdk8u_jdk by JetBrains.
the class LambdaAsm method checkMethod.
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);
}
}
}
}
use of com.sun.tools.classfile.ConstantPool.CPInfo in project ceylon-compiler by ceylon.
the class ClassTranslator method translate.
ConstantPool.CPInfo translate(ConstantPool.CPInfo cpInfo, Map<Object, Object> translations) {
ConstantPool.CPInfo cpInfo2 = (ConstantPool.CPInfo) translations.get(cpInfo);
if (cpInfo2 == null) {
cpInfo2 = cpInfo.accept(this, translations);
translations.put(cpInfo, cpInfo2);
}
return cpInfo2;
}
use of com.sun.tools.classfile.ConstantPool.CPInfo in project ceylon-compiler by ceylon.
the class ClassTranslator method translate.
ConstantPool translate(ConstantPool cp, Map<Object, Object> translations) {
ConstantPool cp2 = (ConstantPool) translations.get(cp);
if (cp2 == null) {
ConstantPool.CPInfo[] pool2 = new ConstantPool.CPInfo[cp.size()];
boolean eq = true;
for (int i = 0; i < cp.size(); ) {
ConstantPool.CPInfo cpInfo;
try {
cpInfo = cp.get(i);
} catch (ConstantPool.InvalidIndex e) {
throw new IllegalStateException(e);
}
ConstantPool.CPInfo cpInfo2 = translate(cpInfo, translations);
eq &= (cpInfo == cpInfo2);
pool2[i] = cpInfo2;
if (cpInfo.getTag() != cpInfo2.getTag())
throw new IllegalStateException();
i += cpInfo.size();
}
if (eq)
cp2 = cp;
else
cp2 = new ConstantPool(pool2);
translations.put(cp, cp2);
}
return cp2;
}
Aggregations