progs/loops.j
author Christian Urban <christian.urban@kcl.ac.uk>
Fri, 28 Oct 2022 09:08:13 +0100
changeset 893 54a483a33763
parent 710 183663740fb7
permissions -rw-r--r--
updated


.class public loops.loops
.super java/lang/Object

.method public static write(I)V 
    .limit locals 1 
    .limit stack 2 
    getstatic java/lang/System/out Ljava/io/PrintStream; 
    iload 0
    i2c       ; Int => Char
    invokevirtual java/io/PrintStream/print(C)V   ; println(I)V => print(C)V    
    return 
.end method

.method public static main([Ljava/lang/String;)V
   .limit locals 200
   .limit stack 200

; COMPILED CODE STARTS   

   ldc 200000
   istore 0 		; start
   iload 0
   istore 1 		; x1
   iload 0
   istore 2 		; x2
   iload 0
   istore 3 		; x3
Loop_begin_90:
   ldc 0
   iload 1
   if_icmpge Loop_end_91
Loop_begin_92:
   ldc 0
   iload 2
   if_icmpge Loop_end_93
Loop_begin_94:
   ldc 0
   iload 3
   if_icmpge Loop_end_95
   iload 3
   ldc 1
   isub
   istore 3 		; x3
   ;; test start
   bipush 1
   bipush 1
   bipush 1
   bipush 1
   pop
   pop
   pop
   pop
   ;; test end
   goto Loop_begin_94
Loop_end_95:
   iload 0
   istore 3 		; x3
   iload 2
   ldc 1
   isub
   istore 2 		; x2
   goto Loop_begin_92
Loop_end_93:
   iload 0
   istore 2 		; x2
   iload 1
   ldc 1
   isub
   istore 1 		; x1
   goto Loop_begin_90
Loop_end_91:

; COMPILED CODE ENDS
   return

.end method