File tree Expand file tree Collapse file tree 3 files changed +37
-1
lines changed Expand file tree Collapse file tree 3 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ public class IfIntegerCompare
21
21
{
22
22
private static int res1 ;
23
23
private static int res2 ;
24
+ private static int res3 ;
25
+ private static int res4 ;
24
26
private static int cmp0 = 0 ;
25
27
private static int cmp3 = 3 ;
26
28
@@ -38,6 +40,18 @@ public static void main(String [] args)
38
40
} else {
39
41
res2 = 0xBABE ;
40
42
}
43
+ // if_icmplt
44
+ if ( cmp0 >= cmp3 ) {
45
+ res3 = 0 ;
46
+ } else {
47
+ res3 = 0xBEEF ;
48
+ }
49
+ // if_icmpgt
50
+ if ( cmp0 <= cmp3 ) {
51
+ res4 = 0xAFFE ;
52
+ } else {
53
+ res4 = 0 ;
54
+ }
41
55
}
42
56
43
57
}
Original file line number Diff line number Diff line change
1
+
2
+
Original file line number Diff line number Diff line change @@ -200,17 +200,36 @@ program_sipush write-programm
200
200
assert( depth 0 = )
201
201
;
202
202
203
+ : ldc_integer_test
204
+ assert( depth 0 = )
205
+ s" ../testfiles/" jvm_classpath.add()
206
+ s" LdcInteger" 2dup
207
+ jvm_java
208
+ jvm_stack.findClass() throw
209
+ s" babe|I" jvm_class.getStatic() throw
210
+ assert( 0xBABE = )
211
+ assert( depth 0 = )
212
+ ;
213
+
203
214
: if_icmp_test1
204
215
assert( depth 0 = )
205
216
s" ../testfiles/" jvm_classpath.add()
206
- s" IfIntegerCompare" 2dup
217
+ s" IfIntegerCompare" 2dup
207
218
jvm_java
208
219
jvm_stack.findClass() throw
209
220
dup
210
221
s" res1|I" jvm_class.getStatic() throw
211
222
assert( 0xDEAD = )
223
+ dup
212
224
s" res2|I" jvm_class.getStatic() throw
213
225
assert( 0xBABE = )
226
+ dup
227
+ s" res3|I" jvm_class.getStatic() throw
228
+ assert( 0xBEEF = )
229
+ dup
230
+ s" res4|I" jvm_class.getStatic() throw
231
+ assert( 0xAFFE = )
232
+ drop
214
233
\ TODO test: eq ne lt gt ifeq ifne iflt ifge ifgt ifle
215
234
assert( depth 0 = )
216
235
;
@@ -229,4 +248,5 @@ program_sipush write-programm
229
248
static_inititilazer_test1
230
249
static_inititilazer_test2
231
250
if_icmp_test1
251
+ ldc_integer_test
232
252
;
You can’t perform that action at this time.
0 commit comments