本文整理汇总了Java中org.jf.dexlib2.iface.instruction.formats.Instruction21c类的典型用法代码示例。如果您正苦于以下问题:Java Instruction21c类的具体用法?Java Instruction21c怎么用?Java Instruction21c使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Instruction21c类属于org.jf.dexlib2.iface.instruction.formats包,在下文中一共展示了Instruction21c类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: jimplify
import org.jf.dexlib2.iface.instruction.formats.Instruction21c; //导入依赖的package包/类
public void jimplify (DexBody body) {
Instruction21c i = (Instruction21c)instruction;
int dest = i.getRegisterA();
String className = dottedClassName(((TypeReference)(i.getReference())).toString());
RefType type = RefType.v(className);
NewExpr n = Jimple.v().newNewExpr(type);
assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), n);
setUnit(assign);
addTags(assign);
body.add(assign);
if (IDalvikTyper.ENABLE_DVKTYPER) {
Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ assign);
int op = (int)instruction.getOpcode().value;
//DalvikTyper.v().captureAssign((JAssignStmt)assign, op); // TODO: ref. type may be null!
DalvikTyper.v().setType(assign.getLeftOpBox(), type, false);
}
}
示例2: jimplify
import org.jf.dexlib2.iface.instruction.formats.Instruction21c; //导入依赖的package包/类
public void jimplify (DexBody body) {
if(!(instruction instanceof Instruction21c))
throw new IllegalArgumentException("Expected Instruction21c but got: "+instruction.getClass());
Instruction21c checkCastInstr = (Instruction21c)instruction;
Local castValue = body.getRegisterLocal(checkCastInstr.getRegisterA());
Type checkCastType = DexType.toSoot((TypeReference) checkCastInstr.getReference());
CastExpr castExpr = Jimple.v().newCastExpr(castValue, checkCastType);
//generate "x = (Type) x"
//splitter will take care of the rest
assign = Jimple.v().newAssignStmt(castValue, castExpr);
setUnit(assign);
addTags(assign);
body.add(assign);
if (IDalvikTyper.ENABLE_DVKTYPER) {
Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ assign);
DalvikTyper.v().setType(assign.getLeftOpBox(), checkCastType, false);
}
}
示例3: jimplify
import org.jf.dexlib2.iface.instruction.formats.Instruction21c; //导入依赖的package包/类
public void jimplify (DexBody body) {
if(!(instruction instanceof Instruction21c))
throw new IllegalArgumentException("Expected Instruction21c but got: "+instruction.getClass());
ReferenceInstruction constClass = (ReferenceInstruction) this.instruction;
TypeReference tidi = (TypeReference)(constClass.getReference());
String type = tidi.getType();
if (type.startsWith("L") && type.endsWith(";"))
type = type.replaceAll("^L", "").replaceAll(";$", "");
int dest = ((OneRegisterInstruction) instruction).getRegisterA();
Constant cst = ClassConstant.v(type);
assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), cst);
setUnit(assign);
addTags(assign);
body.add(assign);
if (IDalvikTyper.ENABLE_DVKTYPER) {
Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ assign);
int op = (int)instruction.getOpcode().value;
//DalvikTyper.v().captureAssign((JAssignStmt)assign, op); //TODO: classtype could be null!
DalvikTyper.v().setType(assign.getLeftOpBox(), cst.getType(), false);
}
}
示例4: rewrite
import org.jf.dexlib2.iface.instruction.formats.Instruction21c; //导入依赖的package包/类
@Nonnull
@Override
public Instruction rewrite(@Nonnull Instruction instruction) {
if (instruction instanceof ReferenceInstruction) {
switch (instruction.getOpcode().format) {
case Format20bc:
return new RewrittenInstruction20bc((Instruction20bc) instruction);
case Format21c:
return new RewrittenInstruction21c((Instruction21c) instruction);
case Format22c:
return new RewrittenInstruction22c((Instruction22c) instruction);
case Format31c:
return new RewrittenInstruction31c((Instruction31c) instruction);
case Format35c:
return new RewrittenInstruction35c((Instruction35c) instruction);
case Format3rc:
return new RewrittenInstruction3rc((Instruction3rc) instruction);
default:
throw new IllegalArgumentException();
}
}
return instruction;
}
示例5: newBuilderInstruction21c
import org.jf.dexlib2.iface.instruction.formats.Instruction21c; //导入依赖的package包/类
@Nonnull
private BuilderInstruction21c newBuilderInstruction21c(@Nonnull Instruction21c instruction) {
return new BuilderInstruction21c(
instruction.getOpcode(),
instruction.getRegisterA(),
convertReference(instruction.getReference()));
}
示例6: of
import org.jf.dexlib2.iface.instruction.formats.Instruction21c; //导入依赖的package包/类
public static ImmutableInstruction21c of(Instruction21c instruction) {
if (instruction instanceof ImmutableInstruction21c) {
return (ImmutableInstruction21c)instruction;
}
return new ImmutableInstruction21c(
instruction.getOpcode(),
instruction.getRegisterA(),
instruction.getReference());
}
示例7: sourceRegister
import org.jf.dexlib2.iface.instruction.formats.Instruction21c; //导入依赖的package包/类
/**
* Return the source register for this instruction.
*/
private int sourceRegister() {
// I hate smali's API ..
if (instruction instanceof Instruction23x)
return ((Instruction23x) instruction).getRegisterA();
else if (instruction instanceof Instruction22c)
return ((Instruction22c) instruction).getRegisterA();
else if (instruction instanceof Instruction21c)
return ((Instruction21c) instruction).getRegisterA();
else throw new RuntimeException("Instruction is not a instance, array or static op");
}
示例8: of
import org.jf.dexlib2.iface.instruction.formats.Instruction21c; //导入依赖的package包/类
public static ImmutableInstruction21c of(Instruction21c instruction) {
if (instruction instanceof ImmutableInstruction21c) {
return (ImmutableInstruction21c) instruction;
}
return new ImmutableInstruction21c(
instruction.getOpcode(),
instruction.getRegisterA(),
instruction.getReference());
}
示例9: write
import org.jf.dexlib2.iface.instruction.formats.Instruction21c; //导入依赖的package包/类
public void write(@Nonnull Instruction21c instruction) {
try {
writer.write(instruction.getOpcode().value);
writer.write(instruction.getRegisterA());
writer.writeUshort(getReferenceIndex(instruction));
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
示例10: newBuilderInstruction21c
import org.jf.dexlib2.iface.instruction.formats.Instruction21c; //导入依赖的package包/类
@Nonnull
private BuilderInstruction21c newBuilderInstruction21c(@Nonnull Instruction21c instruction) {
return new BuilderInstruction21c(
instruction.getOpcode(),
instruction.getRegisterA(),
instruction.getReference());
}
示例11: findFieldsSetInStaticConstructor
import org.jf.dexlib2.iface.instruction.formats.Instruction21c; //导入依赖的package包/类
@Nonnull
private HashSet<String> findFieldsSetInStaticConstructor() {
HashSet<String> fieldsSetInStaticConstructor = new HashSet<String>();
for (Method method: classDef.getDirectMethods()) {
if (method.getName().equals("<clinit>")) {
MethodImplementation impl = method.getImplementation();
if (impl != null) {
for (Instruction instruction: impl.getInstructions()) {
switch (instruction.getOpcode()) {
case SPUT:
case SPUT_BOOLEAN:
case SPUT_BYTE:
case SPUT_CHAR:
case SPUT_OBJECT:
case SPUT_SHORT:
case SPUT_WIDE: {
Instruction21c ins = (Instruction21c)instruction;
FieldReference fieldRef = null;
try {
fieldRef = (FieldReference)ins.getReference();
} catch (InvalidItemIndex ex) {
// just ignore it for now. We'll deal with it later, when processing the instructions
// themselves
}
if (fieldRef != null &&
fieldRef.getDefiningClass().equals((classDef.getType()))) {
fieldsSetInStaticConstructor.add(ReferenceUtil.getShortFieldDescriptor(fieldRef));
}
break;
}
}
}
}
}
}
return fieldsSetInStaticConstructor;
}
示例12: RewrittenInstruction21c
import org.jf.dexlib2.iface.instruction.formats.Instruction21c; //导入依赖的package包/类
public RewrittenInstruction21c(@Nonnull Instruction21c instruction) {
super(instruction);
}