use of com.android.dx.dex.code.CstInsn in project J2ME-Loader by nikita36078.
the class Form35c method isCompatible.
/**
* {@inheritDoc}
*/
@Override
public boolean isCompatible(DalvInsn insn) {
if (!(insn instanceof CstInsn)) {
return false;
}
CstInsn ci = (CstInsn) insn;
int cpi = ci.getIndex();
if (!unsignedFitsInShort(cpi)) {
return false;
}
Constant cst = ci.getConstant();
if (!((cst instanceof CstMethodRef) || (cst instanceof CstType))) {
return false;
}
RegisterSpecList regs = ci.getRegisters();
return (wordCount(regs) >= 0);
}
use of com.android.dx.dex.code.CstInsn in project J2ME-Loader by nikita36078.
the class Form35c method writeTo.
/**
* {@inheritDoc}
*/
@Override
public void writeTo(AnnotatedOutput out, DalvInsn insn) {
int cpi = ((CstInsn) insn).getIndex();
RegisterSpecList regs = explicitize(insn.getRegisters());
int sz = regs.size();
int r0 = (sz > 0) ? regs.get(0).getReg() : 0;
int r1 = (sz > 1) ? regs.get(1).getReg() : 0;
int r2 = (sz > 2) ? regs.get(2).getReg() : 0;
int r3 = (sz > 3) ? regs.get(3).getReg() : 0;
int r4 = (sz > 4) ? regs.get(4).getReg() : 0;
write(out, opcodeUnit(insn, // encode the fifth operand here
makeByte(r4, sz)), (short) cpi, codeUnit(r0, r1, r2, r3));
}
use of com.android.dx.dex.code.CstInsn in project J2ME-Loader by nikita36078.
the class Form3rc method isCompatible.
/**
* {@inheritDoc}
*/
@Override
public boolean isCompatible(DalvInsn insn) {
if (!(insn instanceof CstInsn)) {
return false;
}
CstInsn ci = (CstInsn) insn;
int cpi = ci.getIndex();
Constant cst = ci.getConstant();
if (!unsignedFitsInShort(cpi)) {
return false;
}
if (!((cst instanceof CstMethodRef) || (cst instanceof CstType))) {
return false;
}
RegisterSpecList regs = ci.getRegisters();
int sz = regs.size();
return (regs.size() == 0) || (isRegListSequential(regs) && unsignedFitsInShort(regs.get(0).getReg()) && unsignedFitsInByte(regs.getWordCount()));
}
use of com.android.dx.dex.code.CstInsn in project J2ME-Loader by nikita36078.
the class Form51l method isCompatible.
/**
* {@inheritDoc}
*/
@Override
public boolean isCompatible(DalvInsn insn) {
RegisterSpecList regs = insn.getRegisters();
if (!((insn instanceof CstInsn) && (regs.size() == 1) && unsignedFitsInByte(regs.get(0).getReg()))) {
return false;
}
CstInsn ci = (CstInsn) insn;
Constant cst = ci.getConstant();
return (cst instanceof CstLiteral64);
}
Aggregations