Package org.jf.dexlib2

Examples of org.jf.dexlib2.Opcode


        }

        Instruction deodexedInstruction;
        if (isRange) {
            Instruction3rms instruction = (Instruction3rms)analyzedInstruction.instruction;
            Opcode opcode;
            if (isSuper) {
                opcode = Opcode.INVOKE_SUPER_RANGE;
            } else {
                opcode = Opcode.INVOKE_VIRTUAL_RANGE;
            }

            deodexedInstruction = new ImmutableInstruction3rc(opcode, instruction.getStartRegister(),
                    instruction.getRegisterCount(), resolvedMethod);
        } else {
            Instruction35ms instruction = (Instruction35ms)analyzedInstruction.instruction;
            Opcode opcode;
            if (isSuper) {
                opcode = Opcode.INVOKE_SUPER;
            } else {
                opcode = Opcode.INVOKE_VIRTUAL;
            }
View Full Code Here


    private boolean analyzePutGetVolatile(@Nonnull AnalyzedInstruction analyzedInstruction, boolean analyzeResult) {
        FieldReference field = (FieldReference)((ReferenceInstruction)analyzedInstruction.instruction).getReference();
        String fieldType = field.getType();

        Opcode originalOpcode = analyzedInstruction.instruction.getOpcode();

        Opcode opcode = OdexedFieldInstructionMapper.getAndCheckDeodexedOpcodeForOdexedOpcode(fieldType,
                originalOpcode);

        Instruction deodexedInstruction;

        if (originalOpcode.isOdexedStaticVolatile()) {
View Full Code Here

    static Opcode getAndCheckDeodexedOpcodeForOdexedOpcode(@Nonnull String fieldType, @Nonnull Opcode odexedOpcode) {
        int opcodeType = odexedOpcode.setsRegister()?0:1;
        int opcodeSubType = getOpcodeSubtype(odexedOpcode);
        int typeIndex = getTypeIndex(fieldType.charAt(0));

        Opcode correctOdexedOpcode, deodexedOpcode;

        correctOdexedOpcode = opcodeMap[opcodeType][opcodeSubType][0][typeIndex];
        deodexedOpcode = opcodeMap[opcodeType][opcodeSubType][1][typeIndex];

        if (correctOdexedOpcode != odexedOpcode) {
View Full Code Here

        };
    }

    public static TypeReference rewriteTypeReference(@Nonnull final Rewriter<String> typeRewriter,
                                                     @Nonnull final TypeReference typeReference) {
        return new BaseTypeReference() {
            @Nonnull @Override public String getType() {
                return typeRewriter.rewrite(typeReference.getType());
            }
        };
    }
View Full Code Here

        final String exceptionType = getExceptionType();
        if (exceptionType == null) {
            return null;
        }

        return new BaseTypeReference() {
            @Nonnull @Override public String getType() {
                return exceptionType;
            }
        };
    }
View Full Code Here

                            }
                        }
                    }

                    if (needsFix) {
                        MutableMethodImplementation mutableMethodImplementation =
                                classSection.makeMutableMethodImplementation(methodKey);
                        fixInstructions(mutableMethodImplementation);

                        instructions = mutableMethodImplementation.getInstructions();
                        tryBlocks = mutableMethodImplementation.getTryBlocks();
                        debugItems = mutableMethodImplementation.getDebugItems();
                    }
                }

                int debugItemOffset = writeDebugItem(offsetWriter, debugWriter,
                        classSection.getParameterNames(methodKey), debugItems);
View Full Code Here

    @Test
    public void testFixOffsets() {
        MethodImplementationBuilder builder = new MethodImplementationBuilder(1);

        Label firstGotoTarget = builder.getLabel("firstGotoTarget");
        builder.addInstruction(new BuilderInstruction10t(Opcode.GOTO, firstGotoTarget));

        builder.addLineNumber(1);

        for (int i=0; i<250; i++) {
            builder.addInstruction(new BuilderInstruction10x(Opcode.NOP));
        }

        builder.addLabel("tryStart");

        builder.addLineNumber(2);

        for (int i=0; i<250; i++) {
            builder.addInstruction(new BuilderInstruction10x(Opcode.NOP));
        }

        builder.addLineNumber(3);

        Label secondGotoTarget = builder.getLabel("secondGotoTarget");
        builder.addInstruction(new BuilderInstruction10t(Opcode.GOTO, secondGotoTarget));


        builder.addLineNumber(4);
        builder.addLabel("handler");
View Full Code Here

    @Test
    public void testFixGotoToGoto16() {
        MethodImplementationBuilder builder = new MethodImplementationBuilder(1);

        Label gotoTarget = builder.getLabel("gotoTarget");
        builder.addInstruction(new BuilderInstruction10t(Opcode.GOTO, gotoTarget));

        for (int i=0; i<500; i++) {
            builder.addInstruction(new BuilderInstruction10x(Opcode.NOP));
        }
View Full Code Here

    @Test
    public void testFixGotoToGoto32() {
        MethodImplementationBuilder builder = new MethodImplementationBuilder(1);

        Label gotoTarget = builder.getLabel("gotoTarget");
        builder.addInstruction(new BuilderInstruction10t(Opcode.GOTO, gotoTarget));

        for (int i=0; i<70000; i++) {
            builder.addInstruction(new BuilderInstruction10x(Opcode.NOP));
        }
View Full Code Here

        for (int i=0; i<1000; i++) {
            builder.addInstruction(new BuilderInstruction10x(Opcode.NOP));
        }

        Label gotoTarget = builder.getLabel("gotoTarget");
        builder.addInstruction(new BuilderInstruction10t(Opcode.GOTO, gotoTarget));

        for (int i=0; i<499; i++) {
            builder.addInstruction(new BuilderInstruction10x(Opcode.NOP));
        }
View Full Code Here

TOP

Related Classes of org.jf.dexlib2.Opcode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.