美文网首页
BAF to Jimple

BAF to Jimple

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

    first steps:

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

    next steps:

    unkown ro,r1,l1,l2,l3                                                                       unkown ro,$stack1#1,r1,#stack1#2,l1,$stack0#1,l2,$stack0#2,l3,$stack0#3
    r0:=@this.test                                                                                    r0:=@this.test
    $stack1= r0                                                                                      $stack1#1 = r0
     $stack1 = $r1                                                                                     $stack1#2 = $r1
    specialinvoke  <java.lang.Object: void <init>()>                         specialinvoke  <java.lang.Object: void <init>()>
    
    r0:=@parameter0: java.lang.String[];                                            r0:=@parameter0: java.lang.String[];
    $stack0 = 1                                                                                        $stack1#1 = 1
     l1 = $stack0                                                                                      l1 = $stack0#1            //等同于l1#1 = $stack1#1  ,如果后面的是#1可以不用写
    $stack0 = 2                                                                                        $stack0#1 = 2        //为了方便,后续的#1都省略了
     l2 = $stack0                                                                                      l2 = $stack0#2
    $stack0 = l1                                                                                       $stack0#1 = l1
     $stack0 = l2                                                                                      $stack0#2 = l2
    $stack0 = $stack0 + $stack0                                                             $stack0#3= $stack0#1 + $stack0#2
    staticget <java.lang.System: java.io.printStream Out>                staticget <java.lang.System: java.io.printStream Out>
    l3 = $stack0                                                                                        l3 = $stack0#3
    virtualinvoke <java.io.printStream: void println(int)>;                  virtualinvoke <java.io.printStream: void println(int)>;
    

    next steps:

    unkown ro,$stack1#1,l1,$stack0#1,l2,$stack0#2,l3,$stack0#3   unkown ro,$stack1#1
                                                                                                                    byte l1,$stack0#1,l2,$stack0#2,l3,$stack0#3
    r0:=@this.test                                                                                     r0:=@this.test
    $stack0#1 = r0                                                                                   $stack0#1 = r0
    specialinvoke  <java.lang.Object: void <init>()>                           specialinvoke  <java.lang.Object: void <init>()>()
    
    r0:=@parameter0: java.lang.String[];                                              r0
     $stack0#2 = $r1                                                                                  $r1
    $stack0#1 = 1                                                                                     l1
    l1 = $stack0#1                                                                                         l1 = 1      
    $stack0#1 = 2                                                                                     l2 
    l2 = $stack0#2                                                                                         l2 = 2
    $stack0#1 = l1                                                                                         r0:=@parameter0: java.lang.String[]; 
    $stack0#2 = l2                                                                                         l3
    $stack0#3 = $stack0#1 + $stack0# 2                                                              l3 = l1 + l2
    staticget <java.lang.System: java.io.printStream Out>                  $r1 = <java.lang.System: java.io.printStream Out> 
    l3 = $stack3
    virtualinvoke <java.io.printStream: void println(int)>;                    virtualinvoke $r1.<java.io.printStream: void println(int)>(i2);
    

    next steps:

    unkown ro,$stack0#1
    byte l1,$stack1#1,l2,$stack2#1,l3,$stack#1
    r0:=@this.test                                                                                        test r0
    $stack0#1 = r0                                                                                       r0:=@this:test
    specialinvoke  <java.lang.Object: void <init>()> ()                              specialinvoke  <java.lang.Object: void <init>()>()
    
    r0                                                                                                              java.lang.String[] r0;
    $r1                                                                                                              java.io.PrintStream $r1
    l1                                                                                                              byte l1;
    l1 = 1                                                                                                        l1 = 1;
    l2                                                                                                               byte l2; 
    l2 = 2                                                                                                        l2 = 2;
    r0:=@parameter0: java.lang.String[];                                                  r0:=@parameter0: java.lang.String[];
    l3                                                                                                               int l3;
    l3 = l1 + l2                                                                                                l3 = l1 + l2;
     $r1 = <java.lang.System: java.io.printStream Out>                         $r1 = <java.lang.System: java.io.printStream Out>
    virtualinvoke $r1.<java.io.printStream: void println(int)>(i2);                virtualinvoke $r1.<java.io.printStream: void println(int)>(i2);
    

    the end we get :

    public class test extends java.lang.Object
    {
    
        public void <init>()
        {
            test r0;
    
            r0 := @this: test;
            specialinvoke r0.<java.lang.Object: void <init>()>();
            return;
        }
    
        public static void main(java.lang.String[])
        {
            java.lang.String[] r0;
            byte l1, l2;
            int l3;
            java.io.PrintStream $r1;
    
            r0 := @parameter0: java.lang.String[];
            l1 = 1;
            l2 = 2;
            l3 = l1 + l2;
            $r1 = <java.lang.System: java.io.PrintStream out>;
            virtualinvoke $r1.<java.io.PrintStream: void println(int)>(i2);
            return;
        }
    }
    

    相关文章

      网友评论

          本文标题:BAF to Jimple

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