use of com.android.dx.dex.code.MultiCstInsn in project J2ME-Loader by nikita36078.
the class Form45cc method writeTo.
/**
* {@inheritDoc}
*/
@Override
public void writeTo(AnnotatedOutput out, DalvInsn insn) {
MultiCstInsn mci = (MultiCstInsn) insn;
// B is the method index
short regB = (short) mci.getIndex(0);
// H is the call site proto index
short regH = (short) mci.getIndex(1);
RegisterSpecList regs = explicitize(insn.getRegisters());
int regA = regs.size();
int regC = (regA > 0) ? regs.get(0).getReg() : 0;
int regD = (regA > 1) ? regs.get(1).getReg() : 0;
int regE = (regA > 2) ? regs.get(2).getReg() : 0;
int regF = (regA > 3) ? regs.get(3).getReg() : 0;
int regG = (regA > 4) ? regs.get(4).getReg() : 0;
// The output format is: A|G|op BBBB F|E|D|C HHHHH
write(out, opcodeUnit(insn, makeByte(regG, regA)), regB, codeUnit(regC, regD, regE, regF), regH);
}
use of com.android.dx.dex.code.MultiCstInsn in project J2ME-Loader by nikita36078.
the class Form4rcc method isCompatible.
/**
* {@inheritDoc}
*/
@Override
public boolean isCompatible(DalvInsn insn) {
if (!(insn instanceof MultiCstInsn)) {
return false;
}
MultiCstInsn mci = (MultiCstInsn) insn;
int methodIdx = mci.getIndex(0);
int protoIdx = mci.getIndex(1);
if (!unsignedFitsInShort(methodIdx) || !unsignedFitsInShort(protoIdx)) {
return false;
}
Constant methodRef = mci.getConstant(0);
if (!(methodRef instanceof CstMethodRef)) {
return false;
}
Constant protoRef = mci.getConstant(1);
if (!(protoRef instanceof CstProtoRef)) {
return false;
}
RegisterSpecList regs = mci.getRegisters();
int sz = regs.size();
if (sz == 0) {
return true;
}
return (unsignedFitsInByte(regs.getWordCount()) && unsignedFitsInShort(sz) && unsignedFitsInShort(regs.get(0).getReg()) && isRegListSequential(regs));
}
use of com.android.dx.dex.code.MultiCstInsn in project J2ME-Loader by nikita36078.
the class Form45cc method isCompatible.
/**
* {@inheritDoc}
*/
@Override
public boolean isCompatible(DalvInsn insn) {
if (!(insn instanceof MultiCstInsn)) {
return false;
}
MultiCstInsn mci = (MultiCstInsn) insn;
if (mci.getNumberOfConstants() != 2) {
return false;
}
int methodIdx = mci.getIndex(0);
int protoIdx = mci.getIndex(1);
if (!unsignedFitsInShort(methodIdx) || !unsignedFitsInShort(protoIdx)) {
return false;
}
Constant methodRef = mci.getConstant(0);
if (!(methodRef instanceof CstMethodRef)) {
return false;
}
Constant protoRef = mci.getConstant(1);
if (!(protoRef instanceof CstProtoRef)) {
return false;
}
RegisterSpecList regs = mci.getRegisters();
return (wordCount(regs) >= 0);
}
use of com.android.dx.dex.code.MultiCstInsn in project J2ME-Loader by nikita36078.
the class Form4rcc method writeTo.
/**
* {@inheritDoc}
*/
@Override
public void writeTo(AnnotatedOutput out, DalvInsn insn) {
MultiCstInsn mci = (MultiCstInsn) insn;
// B is the method index
short regB = (short) mci.getIndex(0);
// H is the call site proto index
short regH = (short) mci.getIndex(1);
RegisterSpecList regs = insn.getRegisters();
short regC = 0;
if (regs.size() > 0) {
regC = (short) regs.get(0).getReg();
}
int regA = regs.getWordCount();
// The output format is: AA|op BBBB CCCC HHHH
write(out, opcodeUnit(insn, regA), regB, regC, regH);
}
Aggregations