美文网首页
jimple to BAF to bytecode

jimple to BAF to bytecode

作者: 转身一世铅华尽 | 来源:发表于2019-08-13 14:58 被阅读0次

    first steps:
    word r0,stak0#1,r1,stack0#2,l1,stack1#1,l2,stack2#1,l3,stack3#1
    r0:=@this.test
    load.r r0
    stack0#1 = r0stack0#2 = r1 specialinvoke <java.lang.Object: void <init>()> r0:=@parameter0: java.lang.String[] push 1 store.i l1 load.i l1 store.istack1#1
    push 2
    store.i l2
    load.i l2
    store.i $stack2#1
    staticget <java.lang.System: java.io.printStream Out>
    store.i l3
    load.i l3
    add.i
    virtualinvoke <java.io.printStream: void println(int)>

    next steps: load/store

    word r0,r1,stack0#2,l1,l2,l3
    r0:=this.test
    load.r r0
    specialinvoke <java.lang.Object: void <init>()>
    r0:=@parameter0:java.lang.String[]
    push 1
    store.i l1
    load.i l1
    store.i l1#1
    push 2
    store.i l2
    load.i l2
    store.i l2#1
    staticget <java.lang.System: java.io.printStream Out>
    store.i l3
    load.i l3
    add.i
    virtualinvoke <java.io.printStream: void println(int)>

    next steps: packing

    word r0,l1,l2,l3
    r0:=this.test
    load.r r0
    specialinvoke <java.lang.Object: void <init>()>
    r0:=@parameter0:java.lang.String[]
    push 1
    store.i l1
    load.i l1

    push 2
    store.i l2
    load.i l2

    staticget <java.lang.System: java.io.printStream Out>
    store.i l3
    load.i l3
    add.i
    virtualinvoke <java.io.printStream: void println(int)>

    last steps:

    aload_0
    invokespecial
    return

    iconst_1
    istore_1
    iload_1

    iconst_2
    istore_2
    iload_2

    getstatic

    istore_3
    iload_3
    iadd
    virtualinvoke
    return

    最终得到

    public test();
    flags: ACC_PUBLIC
    Code:
    stack=1, locals=1, args_size=1
    0: aload_0
    1: invokespecial #1 // Method java/lang/Object."<init>":()V
    4: return

    public static void main(java.lang.String[]);
    flags: ACC_PUBLIC, ACC_STATIC
    Code:
    stack=2, locals=4, args_size=1
    0: iconst_1
    1: istore_1
    2: iconst_2
    3: istore_2
    4: iload_1
    5: iload_2
    6: iadd
    7: istore_3
    8: getstatic #2 // Field java/lang/System.out:Ljava/io/PrintStream;
    11: iload_3
    12: invokevirtual #3 // Method java/io/PrintStream.println:(I)V
    15: return

    相关文章

      网友评论

          本文标题:jimple to BAF to bytecode

          本文链接:https://www.haomeiwen.com/subject/ahgvjctx.html