progs/fib.j
changeset 323 4ce07c4abdb4
parent 211 deece8c6cf3a
child 373 b018234c9126
equal deleted inserted replaced
322:698ed1c96cd0 323:4ce07c4abdb4
     1 
     1 
     2 .class public fib.fib
     2 .class public fib.fib
     3 .super java/lang/Object
     3 .super java/lang/Object
     4 
     4 
     5 .method public <init>()V
     5 .method public <init>()V
     6         aload_0
     6    aload_0
     7         invokenonvirtual java/lang/Object/<init>()V
     7    invokenonvirtual java/lang/Object/<init>()V
     8         return
     8    return
     9 .end method
     9 .end method
    10 
    10 
    11 .method public static write(I)V 
    11 .method public static write(I)V 
    12         .limit locals 5 
    12     .limit locals 5 
    13         .limit stack 5 
    13     .limit stack 5 
    14         iload 0 
    14     iload 0 
    15         getstatic java/lang/System/out Ljava/io/PrintStream; 
    15     getstatic java/lang/System/out Ljava/io/PrintStream; 
    16         swap 
    16     swap 
    17         invokevirtual java/io/PrintStream/println(I)V 
    17     invokevirtual java/io/PrintStream/println(I)V 
    18         return 
    18     return 
    19 .end method
       
    20 
       
    21 .method public static writes(Ljava/lang/String;)V
       
    22        .limit stack 2
       
    23        .limit locals 2
       
    24        getstatic java/lang/System/out Ljava/io/PrintStream;
       
    25        aload 0
       
    26        invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
       
    27        return
       
    28 .end method
    19 .end method
    29 
    20 
    30 .method public static read()I 
    21 .method public static read()I 
    31       .limit locals 10 
    22       .limit locals 10 
    32       .limit stack 10
    23       .limit stack 10
    59       ;when we come here we have our integer computed in Local Variable 1 
    50       ;when we come here we have our integer computed in Local Variable 1 
    60       iload 1 
    51       iload 1 
    61       ireturn 
    52       ireturn 
    62 .end method
    53 .end method
    63 
    54 
       
    55 
    64 .method public static main([Ljava/lang/String;)V
    56 .method public static main([Ljava/lang/String;)V
    65       .limit locals 200
    57    .limit locals 200
    66       .limit stack 200
    58    .limit stack 200
    67 
    59 
    68 ldc "Fib"
       
    69 invokestatic fib/fib/writes(Ljava/lang/String;)V
       
    70 invokestatic fib/fib/read()I
    60 invokestatic fib/fib/read()I
    71 istore 0
    61 istore 0
    72 ldc 0
    62 ldc 0
    73 istore 1
    63 istore 1
    74 ldc 1
    64 ldc 1
    75 istore 2
    65 istore 2
       
    66 ldc 0
       
    67 istore 3
    76 
    68 
    77 Loop_begin_0:
    69 Loop_begin_0:
    78 
    70 
    79 ldc 0
    71 ldc 0
    80 iload 0
    72 iload 0
    93 istore 0
    85 istore 0
    94 goto Loop_begin_0
    86 goto Loop_begin_0
    95 
    87 
    96 Loop_end_1:
    88 Loop_end_1:
    97 
    89 
    98 ldc "Result"
       
    99 invokestatic fib/fib/writes(Ljava/lang/String;)V
       
   100 iload 2
    90 iload 2
   101 invokestatic fib/fib/write(I)V
    91 invokestatic fib/fib/write(I)V
   102 
    92 
   103 
    93 
   104       return
    94    return
   105 
    95 
   106 .end method
    96 .end method
       
    97