-
Notifications
You must be signed in to change notification settings - Fork 0
/
simple.j
314 lines (294 loc) · 6.08 KB
/
simple.j
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
; Begin standard header
.class public simple
.super java/lang/Object
.method public <init>()V
aload_0
invokenonvirtual java/lang/Object/<init>()V
return
.end method
.method public static main([Ljava/lang/String;)V
invokestatic simple/main()F
return
.end method
; End standard header
.method public static gt(FF)I
.limit stack 50
.limit locals 50
fload 0 ;a
fload 1 ;b
fcmpl
ireturn
.end method
.method public static count(F)F
.limit stack 50
.limit locals 50
ldc 0.0
fstore 1 ; i
ldc 0.0
fstore 1 ; i
label2:
fload 1 ;i
fload 0 ;n
fcmpl
ifge label3
fload 1 ;i
ldc 2.0
invokestatic simple/pow(FF)F
invokestatic simple/println(F)F
pop
fload 1 ;i
ldc 1.0
fadd
fstore 1 ; i
goto label2
label3:
fload 1 ;i
freturn
.end method
.method public static numtester(FF)F
.limit stack 50
.limit locals 50
fload 0 ;x
invokestatic simple/println(F)F
pop
fload 1 ;y
invokestatic simple/println(F)F
pop
fload 0 ;x
fload 1 ;y
fadd
invokestatic simple/println(F)F
pop
fload 0 ;x
fload 1 ;y
fsub
invokestatic simple/println(F)F
pop
fload 0 ;x
fload 1 ;y
fmul
invokestatic simple/println(F)F
pop
fload 0 ;x
fload 1 ;y
fdiv
invokestatic simple/println(F)F
pop
fload 0 ;x
fload 1 ;y
invokestatic simple/pow(FF)F
invokestatic simple/println(F)F
pop
fload 0 ;x
fload 1 ;y
frem
invokestatic simple/println(F)F
pop
fload 0 ;x
freturn
.end method
.method public static booltester(II)I
.limit stack 50
.limit locals 50
iload 0 ;x
invokestatic simple/println(I)I
pop
iload 1 ;y
invokestatic simple/println(I)I
pop
iload 0 ;x
iload 1 ;y
iand
invokestatic simple/println(I)I
pop
iload 0 ;x
iload 1 ;y
ior
invokestatic simple/println(I)I
pop
iload 0 ;x
ireturn
.end method
.method public static inittest()I
.limit stack 50
.limit locals 50
ldc 0
istore 0 ; x
iload 0 ;x
invokestatic simple/println(I)I
pop
ldc 0
ireturn
.end method
.method public static nottest(I)I
.limit stack 50
.limit locals 50
ldc 1
ireturn
.end method
.method public static main()F
.limit stack 50
.limit locals 50
ldc 0.0
fstore 0 ; x
ldc 1
invokestatic simple/nottest(I)I
invokestatic simple/println(I)I
pop
fload 0 ;x
freturn
.end method
; Begin standard trailer
.method public static print(F)F
.limit stack 2
.limit locals 1
getstatic java/lang/System/out Ljava/io/PrintStream;
fload 0
invokestatic java/lang/Float/toString(F)Ljava/lang/String;
invokevirtual java/io/PrintStream/print(Ljava/lang/String;)V
fload 0
freturn
.end method
.method public static print(Ljava/lang/String;)Ljava/lang/String;
.limit stack 2
.limit locals 2
getstatic java/lang/System/out Ljava/io/PrintStream;
aload 0
invokevirtual java/io/PrintStream/print(Ljava/lang/String;)V
aload 0
areturn
.end method
.method public static print(I)I
.limit stack 5
.limit locals 2
getstatic java/lang/System/out Ljava/io/PrintStream;
iload 0
ifeq false_label
ldc "true"
goto print_it
false_label:
ldc "false"
print_it:
invokevirtual java/io/PrintStream/print(Ljava/lang/String;)V
iload 0
ireturn
.end method
.method public static println(F)F
.limit stack 2
.limit locals 1
getstatic java/lang/System/out Ljava/io/PrintStream;
fload 0
invokestatic java/lang/Float/toString(F)Ljava/lang/String;
invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
fload 0
freturn
.end method
.method public static println(Ljava/lang/String;)Ljava/lang/String;
.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
aload 0
areturn
.end method
.method public static println(I)I
.limit stack 5
.limit locals 2
getstatic java/lang/System/out Ljava/io/PrintStream;
iload 0
ifeq false_label
ldc "true"
goto print_it
false_label:
ldc "false"
print_it:
invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
iload 0
ireturn
.end method
.method public static pow(FF)F
.limit stack 5
.limit locals 2
fload 0
f2d
fload 1
f2d
invokestatic java/lang/Math/pow(DD)D
d2f
freturn
.end method
.method public static cos(F)F
.limit stack 5
.limit locals 2
fload 0
f2d
invokestatic java/lang/Math/cos(D)D
d2f
freturn
.end method
.method public static sin(F)F
.limit stack 5
.limit locals 2
fload 0
f2d
invokestatic java/lang/Math/sin(D)D
d2f
freturn
.end method
.method public static concat(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
.limit stack 20
.limit locals 20
new java/lang/StringBuffer
dup
invokespecial java/lang/StringBuffer/<init>()V
aload 0
invokevirtual java/lang/StringBuffer/append(Ljava/lang/String;)Ljava/lang/StringBuffer;
aload 1
invokevirtual java/lang/StringBuffer/append(Ljava/lang/String;)Ljava/lang/StringBuffer;
invokevirtual java/lang/StringBuffer/toString()Ljava/lang/String;
areturn
.end method
.method public static concat(Ljava/lang/String;I)Ljava/lang/String;
.limit stack 20
.limit locals 20
new java/lang/StringBuffer
dup
invokespecial java/lang/StringBuffer/<init>()V
aload 0
invokevirtual java/lang/StringBuffer/append(Ljava/lang/String;)Ljava/lang/StringBuffer;
iload 1
ifeq retFalse
;pop
ldc "true "
goto end
retFalse:
;pop
ldc "false "
end:
invokevirtual java/lang/StringBuffer/append(Ljava/lang/String;)Ljava/lang/StringBuffer;
invokevirtual java/lang/StringBuffer/toString()Ljava/lang/String;
areturn
.end method
.method public static concat(ILjava/lang/String;)Ljava/lang/String;
.limit stack 20
.limit locals 20
new java/lang/StringBuffer
dup
invokespecial java/lang/StringBuffer/<init>()V
iload 0
ifeq retFalse
;pop
ldc "true "
goto end
retFalse:
;pop
ldc "false "
end:
invokevirtual java/lang/StringBuffer/append(Ljava/lang/String;)Ljava/lang/StringBuffer;
aload 1
invokevirtual java/lang/StringBuffer/append(Ljava/lang/String;)Ljava/lang/StringBuffer;
invokevirtual java/lang/StringBuffer/toString()Ljava/lang/String;
areturn
.end method
; End of standard trailer