progs/fib.j
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Wed, 27 Nov 2013 08:49:51 +0000
changeset 207 f824e1331fc6
parent 93 4794759139ea
child 208 bd5a8a6b3871
permissions -rw-r--r--
added slides
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
93
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     1
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     2
.class public fib.fib
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     3
.super java/lang/Object
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     4
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     5
.method public <init>()V
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     6
   aload_0
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     7
   invokenonvirtual java/lang/Object/<init>()V
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     8
   return
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     9
.end method
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    10
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    11
.method public static write(I)V 
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    12
    .limit locals 5 
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    13
    .limit stack 5 
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    14
    iload 0 
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    15
    getstatic java/lang/System/out Ljava/io/PrintStream; 
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    16
    swap 
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    17
    invokevirtual java/io/PrintStream/println(I)V 
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    18
    return 
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    19
.end method
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    20
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    21
207
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    22
.method public static writes(Ljava/lang/String;)V
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    23
   .limit stack 2
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    24
   .limit locals 2
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    25
   getstatic java/lang/System/out Ljava/io/PrintStream;
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    26
   aload 0
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    27
   invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    28
   return
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    29
.end method
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    30
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    31
93
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    32
.method public static main([Ljava/lang/String;)V
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    33
   .limit locals 200
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    34
   .limit stack 200
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    35
207
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    36
getstatic java/lang/System/in Ljava/io/InputStream;
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    37
invokevirtual java/io/InputStream/read()I
93
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    38
istore 0
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    39
ldc 0
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    40
istore 1
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    41
ldc 1
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    42
istore 2
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    43
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    44
Loop_begin_0:
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    45
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    46
ldc 0
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    47
iload 0
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    48
if_icmpge Loop_end_1
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    49
iload 2
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    50
istore 3
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    51
iload 1
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    52
iload 2
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    53
iadd
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    54
istore 2
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    55
iload 3
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    56
istore 1
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    57
iload 0
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    58
ldc 1
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    59
isub
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    60
istore 0
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    61
goto Loop_begin_0
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    62
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    63
Loop_end_1:
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    64
207
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    65
ldc "Result"
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    66
invokestatic fib/fib/writes(Ljava/lang/String;)V
93
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    67
iload 2
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    68
invokestatic fib/fib/write(I)V
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    69
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    70
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    71
   return
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    72
4794759139ea better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    73
.end method