progs/fib.j
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Wed, 27 Nov 2013 21:36:30 +0000
changeset 208 bd5a8a6b3871
parent 207 f824e1331fc6
child 211 deece8c6cf3a
permissions -rw-r--r--
added


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

.method public <init>()V
   aload_0
   invokenonvirtual java/lang/Object/<init>()V
   return
.end method

.method public static write(I)V 
    .limit locals 5 
    .limit stack 5 
    iload 0 
    getstatic java/lang/System/out Ljava/io/PrintStream; 
    swap 
    invokevirtual java/io/PrintStream/println(I)V 
    return 
.end method


.method public static writes(Ljava/lang/String;)V
   .limit stack 2
   .limit locals 2
   getstatic java/lang/System/out Ljava/io/PrintStream;
   aload 0
   invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
   return
.end method


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

ldc "Fib"
invokestatic fib/fib/writes(Ljava/lang/String;)V
ldc 19
istore 0
ldc 0
istore 1
ldc 1
istore 2

Loop_begin_0:

ldc 0
iload 0
if_icmpge Loop_end_1
iload 2
istore 3
iload 1
iload 2
iadd
istore 2
iload 3
istore 1
iload 0
ldc 1
isub
istore 0
goto Loop_begin_0

Loop_end_1:

ldc "Result"
invokestatic fib/fib/writes(Ljava/lang/String;)V
iload 2
invokestatic fib/fib/write(I)V


   return

.end method