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


Java Instruction21c类代码示例

本文整理汇总了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);
      }
  }
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:19,代码来源:NewInstanceInstruction.java

示例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);
}

  }
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:27,代码来源:CheckCastInstruction.java

示例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);
      }
  }
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:26,代码来源:ConstClassInstruction.java

示例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;
}
 
开发者ID:niranjan94,项目名称:show-java,代码行数:24,代码来源:InstructionRewriter.java

示例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()));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:BuilderMutableMethodImplementation.java

示例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());
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:10,代码来源:ImmutableInstruction21c.java

示例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");
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:14,代码来源:FieldInstruction.java

示例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());
}
 
开发者ID:niranjan94,项目名称:show-java,代码行数:10,代码来源:ImmutableInstruction21c.java

示例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);
    }
}
 
开发者ID:niranjan94,项目名称:show-java,代码行数:10,代码来源:InstructionWriter.java

示例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());
}
 
开发者ID:niranjan94,项目名称:show-java,代码行数:8,代码来源:MutableMethodImplementation.java

示例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;
}
 
开发者ID:YaphetsH,项目名称:ZJDroid,代码行数:39,代码来源:ClassDefinition.java

示例12: RewrittenInstruction21c

import org.jf.dexlib2.iface.instruction.formats.Instruction21c; //导入依赖的package包/类
public RewrittenInstruction21c(@Nonnull Instruction21c instruction) {
    super(instruction);
}
 
开发者ID:niranjan94,项目名称:show-java,代码行数:4,代码来源:InstructionRewriter.java


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