progs/loops.j
changeset 710 183663740fb7
parent 207 f824e1331fc6
equal deleted inserted replaced
709:c112a6cb5e52 710:183663740fb7
     1 
     1 
     2 .class public loops.loops
     2 .class public loops.loops
     3 .super java/lang/Object
     3 .super java/lang/Object
     4 
     4 
     5 .method public <init>()V
       
     6    aload_0
       
     7    invokenonvirtual java/lang/Object/<init>()V
       
     8    return
       
     9 .end method
       
    10 
       
    11 .method public static write(I)V 
     5 .method public static write(I)V 
    12     .limit locals 5 
     6     .limit locals 1 
    13     .limit stack 5 
     7     .limit stack 2 
    14     iload 0 
       
    15     getstatic java/lang/System/out Ljava/io/PrintStream; 
     8     getstatic java/lang/System/out Ljava/io/PrintStream; 
    16     swap 
     9     iload 0
    17     invokevirtual java/io/PrintStream/println(I)V 
    10     i2c       ; Int => Char
    18     return 
    11     invokevirtual java/io/PrintStream/print(C)V   ; println(I)V => print(C)V    
    19 .end method
       
    20 
       
    21 .method public static write(S)V 
       
    22     .limit locals 5 
       
    23     .limit stack 5 
       
    24     iload 0 
       
    25     getstatic java/lang/System/out Ljava/io/PrintStream; 
       
    26     swap 
       
    27     invokevirtual java/io/PrintStream/println(S)V 
       
    28     return 
    12     return 
    29 .end method
    13 .end method
    30 
    14 
    31 .method public static main([Ljava/lang/String;)V
    15 .method public static main([Ljava/lang/String;)V
    32    .limit locals 200
    16    .limit locals 200
    33    .limit stack 200
    17    .limit stack 200
    34 
    18 
    35 ldc 1000
    19 ; COMPILED CODE STARTS   
    36 istore 0
       
    37 iload 0
       
    38 istore 1
       
    39 iload 0
       
    40 istore 2
       
    41 iload 0
       
    42 istore 3
       
    43 
    20 
    44 Loop_begin_0:
    21    ldc 200000
       
    22    istore 0 		; start
       
    23    iload 0
       
    24    istore 1 		; x1
       
    25    iload 0
       
    26    istore 2 		; x2
       
    27    iload 0
       
    28    istore 3 		; x3
       
    29 Loop_begin_90:
       
    30    ldc 0
       
    31    iload 1
       
    32    if_icmpge Loop_end_91
       
    33 Loop_begin_92:
       
    34    ldc 0
       
    35    iload 2
       
    36    if_icmpge Loop_end_93
       
    37 Loop_begin_94:
       
    38    ldc 0
       
    39    iload 3
       
    40    if_icmpge Loop_end_95
       
    41    iload 3
       
    42    ldc 1
       
    43    isub
       
    44    istore 3 		; x3
       
    45    ;; test start
       
    46    bipush 1
       
    47    bipush 1
       
    48    bipush 1
       
    49    bipush 1
       
    50    pop
       
    51    pop
       
    52    pop
       
    53    pop
       
    54    ;; test end
       
    55    goto Loop_begin_94
       
    56 Loop_end_95:
       
    57    iload 0
       
    58    istore 3 		; x3
       
    59    iload 2
       
    60    ldc 1
       
    61    isub
       
    62    istore 2 		; x2
       
    63    goto Loop_begin_92
       
    64 Loop_end_93:
       
    65    iload 0
       
    66    istore 2 		; x2
       
    67    iload 1
       
    68    ldc 1
       
    69    isub
       
    70    istore 1 		; x1
       
    71    goto Loop_begin_90
       
    72 Loop_end_91:
    45 
    73 
    46 ldc 0
    74 ; COMPILED CODE ENDS
    47 iload 1
       
    48 if_icmpge Loop_end_1
       
    49 
       
    50 Loop_begin_2:
       
    51 
       
    52 ldc 0
       
    53 iload 2
       
    54 if_icmpge Loop_end_3
       
    55 
       
    56 Loop_begin_4:
       
    57 
       
    58 ldc 0
       
    59 iload 3
       
    60 if_icmpge Loop_end_5
       
    61 iload 3
       
    62 ldc 1
       
    63 isub
       
    64 istore 3
       
    65 goto Loop_begin_4
       
    66 
       
    67 Loop_end_5:
       
    68 
       
    69 iload 0
       
    70 istore 3
       
    71 iload 2
       
    72 ldc 1
       
    73 isub
       
    74 istore 2
       
    75 goto Loop_begin_2
       
    76 
       
    77 Loop_end_3:
       
    78 
       
    79 iload 0
       
    80 istore 2
       
    81 iload 1
       
    82 ldc 1
       
    83 isub
       
    84 istore 1
       
    85 goto Loop_begin_0
       
    86 
       
    87 Loop_end_1:
       
    88 
       
    89 
       
    90 
       
    91    return
    75    return
    92 
    76 
    93 .end method
    77 .end method