Package org.jf.dexlib2.iface.instruction

Examples of org.jf.dexlib2.iface.instruction.Instruction


        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");

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

        builder.addLineNumber(5);

        builder.addLabel("tryEnd");

        builder.addLabel("firstGotoTarget");
        builder.addLabel("secondGotoTarget");
        builder.addInstruction(new BuilderInstruction10x(Opcode.RETURN_VOID));

        Label tryStart = builder.getLabel("tryStart");
        Label tryEnd = builder.getLabel("tryEnd");
        Label handler = builder.getLabel("handler");
View Full Code Here


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

        builder.addLabel("gotoTarget");
        builder.addInstruction(new BuilderInstruction10x(Opcode.RETURN_VOID));

        MethodImplementation impl = builder.getMethodImplementation();

        List<? extends Instruction> instructions = Lists.newArrayList(impl.getInstructions());
        Assert.assertEquals(502, instructions.size());
View Full Code Here

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

        builder.addLabel("gotoTarget");
        builder.addInstruction(new BuilderInstruction10x(Opcode.RETURN_VOID));

        MethodImplementation impl = builder.getMethodImplementation();

        List<? extends Instruction> instructions = Lists.newArrayList(impl.getInstructions());
        Assert.assertEquals(70002, instructions.size());
View Full Code Here

        Label gotoTarget = builder.getLabel("gotoTarget");
        builder.addInstruction(new BuilderInstruction20t(Opcode.GOTO_16, gotoTarget));

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

        builder.addLabel("gotoTarget");
        builder.addInstruction(new BuilderInstruction10x(Opcode.RETURN_VOID));

        MethodImplementation impl = builder.getMethodImplementation();

        List<? extends Instruction> instructions = Lists.newArrayList(impl.getInstructions());
        Assert.assertEquals(70002, instructions.size());
View Full Code Here

        Label goto16Target = builder.getLabel("goto16Target");
        builder.addInstruction(new BuilderInstruction20t(Opcode.GOTO_16, goto16Target));

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

        builder.addLabel("gotoTarget");

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

        builder.addLabel("goto16Target");
        builder.addInstruction(new BuilderInstruction10x(Opcode.RETURN_VOID));

        MethodImplementation impl = builder.getMethodImplementation();

        List<? extends Instruction> instructions = Lists.newArrayList(impl.getInstructions());
        Assert.assertEquals(32767, instructions.size());
View Full Code Here

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

        Label gotoTarget = builder.getLabel("gotoTarget");
        builder.addInstruction(new BuilderInstruction20t(Opcode.GOTO_16, gotoTarget));

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

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

        Label goto16Target = builder.getLabel("goto16Target");
        builder.addInstruction(new BuilderInstruction20t(Opcode.GOTO_16, goto16Target));

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

            Instruction instruction = instructions.get(i);

            if (instruction.getOpcode() == Opcode.CONST_STRING) {
                if (stringSection.getItemIndex(
                        (StringRef)((ReferenceInstruction)instruction).getReference()) >= 65536) {
                    methodImplementation.replaceInstruction(i, new BuilderInstruction31c(Opcode.CONST_STRING_JUMBO,
                            ((OneRegisterInstruction)instruction).getRegisterA(),
                            ((ReferenceInstruction)instruction).getReference()));
                }
            }
        }
View Full Code Here

            return new FixedSizeSet<DexBackedAnnotation>() {
                @Nonnull
                @Override
                public DexBackedAnnotation readItem(int index) {
                    int annotationOffset = dexFile.readSmallUint(annotationSetOffset + 4 + (4*index));
                    return new DexBackedAnnotation(dexFile, annotationOffset);
                }

                @Override public int size() { return size; }
            };
        }
View Full Code Here

            } else if (fileLength > Integer.MAX_VALUE) {
                throw new ExceptionWithContext("The " + dexEntry + " file in %s is too large to read in", dexFile.getName());
            }
            byte[] dexBytes = new byte[(int)fileLength];
            ByteStreams.readFully(zipFile.getInputStream(zipEntry), dexBytes);
            return new DexBackedDexFile(opcodes, dexBytes);
        } catch (IOException ex) {
            // don't continue on if we know it's a zip file
            if (isZipFile) {
                throw ex;
            }
View Full Code Here

TOP

Related Classes of org.jf.dexlib2.iface.instruction.Instruction

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.