author | Christian Urban <urbanc@in.tum.de> |
Wed, 10 May 2017 17:03:21 +0100 | |
changeset 491 | d5776c6018f0 |
parent 471 | 9476086849ad |
child 545 | 76a98ed71a2a |
permissions | -rw-r--r-- |
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 |
323
4ce07c4abdb4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
211
diff
changeset
|
6 |
aload_0 |
4ce07c4abdb4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
211
diff
changeset
|
7 |
invokenonvirtual java/lang/Object/<init>()V |
4ce07c4abdb4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
211
diff
changeset
|
8 |
return |
93
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 |
373
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
12 |
.limit locals 1 |
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
13 |
.limit stack 2 |
323
4ce07c4abdb4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
211
diff
changeset
|
14 |
getstatic java/lang/System/out Ljava/io/PrintStream; |
373
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
15 |
iload 0 |
323
4ce07c4abdb4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
211
diff
changeset
|
16 |
invokevirtual java/io/PrintStream/println(I)V |
4ce07c4abdb4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
211
diff
changeset
|
17 |
return |
207
f824e1331fc6
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
18 |
.end method |
f824e1331fc6
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
19 |
|
211
deece8c6cf3a
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
208
diff
changeset
|
20 |
.method public static read()I |
373
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
21 |
.limit locals 10 |
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
22 |
.limit stack 10 |
211
deece8c6cf3a
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
208
diff
changeset
|
23 |
|
373
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
24 |
ldc 0 |
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
25 |
istore 1 ; this will hold our final integer |
211
deece8c6cf3a
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
208
diff
changeset
|
26 |
Label1: |
373
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
27 |
getstatic java/lang/System/in Ljava/io/InputStream; |
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
28 |
invokevirtual java/io/InputStream/read()I |
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
29 |
istore 2 |
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
30 |
iload 2 |
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
31 |
ldc 10 ; the newline delimiter |
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
32 |
isub |
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
33 |
ifeq Label2 |
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
34 |
iload 2 |
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
35 |
ldc 32 ; the space delimiter |
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
36 |
isub |
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
37 |
ifeq Label2 |
211
deece8c6cf3a
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
208
diff
changeset
|
38 |
|
373
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
39 |
iload 2 |
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
40 |
ldc 48 ; we have our digit in ASCII, have to subtract it from 48 |
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
41 |
isub |
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
42 |
ldc 10 |
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
43 |
iload 1 |
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
44 |
imul |
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
45 |
iadd |
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
46 |
istore 1 |
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
47 |
goto Label1 |
211
deece8c6cf3a
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
208
diff
changeset
|
48 |
Label2: |
373
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
49 |
;when we come here we have our integer computed in local variable 1 |
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
50 |
iload 1 |
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
51 |
ireturn |
211
deece8c6cf3a
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
208
diff
changeset
|
52 |
.end method |
207
f824e1331fc6
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
53 |
|
93
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
54 |
.method public static main([Ljava/lang/String;)V |
323
4ce07c4abdb4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
211
diff
changeset
|
55 |
.limit locals 200 |
4ce07c4abdb4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
211
diff
changeset
|
56 |
.limit stack 200 |
93
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
57 |
|
211
deece8c6cf3a
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
208
diff
changeset
|
58 |
invokestatic fib/fib/read()I |
93
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
59 |
istore 0 |
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
60 |
ldc 0 |
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
61 |
istore 1 |
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
62 |
ldc 1 |
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
63 |
istore 2 |
323
4ce07c4abdb4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
211
diff
changeset
|
64 |
ldc 0 |
4ce07c4abdb4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
211
diff
changeset
|
65 |
istore 3 |
93
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
66 |
|
471 | 67 |
Loop_begin_2: |
93
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
68 |
|
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
69 |
ldc 0 |
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
70 |
iload 0 |
471 | 71 |
if_icmpge Loop_end_3 |
93
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
72 |
iload 2 |
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
73 |
istore 3 |
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
74 |
iload 1 |
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
75 |
iload 2 |
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
76 |
iadd |
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
77 |
istore 2 |
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
78 |
iload 3 |
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
79 |
istore 1 |
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
80 |
iload 0 |
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
81 |
ldc 1 |
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
82 |
isub |
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
83 |
istore 0 |
471 | 84 |
goto Loop_begin_2 |
93
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
85 |
|
471 | 86 |
Loop_end_3: |
93
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
87 |
|
373
b018234c9126
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
323
diff
changeset
|
88 |
iload 1 |
93
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
89 |
invokestatic fib/fib/write(I)V |
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
90 |
|
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
91 |
|
323
4ce07c4abdb4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
211
diff
changeset
|
92 |
return |
93
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
93 |
|
4794759139ea
better organised
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
94 |
.end method |