Skip to content

Commit 3f5dac8

Browse files
author
Matthias Güdemann
committed
Add regression tests for iload, dup, dup_x1, dup_x2
1 parent 74ac6e1 commit 3f5dac8

20 files changed

+182
-0
lines changed
603 Bytes
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
public class stack_test {
2+
public static void main(String[] args) {
3+
stack_var1 s = new stack_var1();
4+
int n = s.f(1);
5+
assert(n==0);
6+
}
7+
}
205 Bytes
Binary file not shown.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.class public stack_var1
2+
.super java/lang/Object
3+
4+
.method public <init>()V
5+
aload_0
6+
invokenonvirtual java/lang/Object/<init>()V
7+
return
8+
.end method
9+
10+
.method public f(I)I
11+
.limit stack 2
12+
.limit locals 2
13+
14+
;; copy of arg on stack
15+
iload_1
16+
;; increment arg
17+
iinc 1 1
18+
;; incremented copy on stack
19+
iload_1
20+
isub
21+
ireturn
22+
.end method
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
stack_test.class
3+
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^.*assertion at file stack_test.java line 5 function.*: FAILURE$
7+
^VERIFICATION FAILED$
8+
--
9+
^warning: ignoring
603 Bytes
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
public class stack_test {
2+
public static void main(String[] args) {
3+
stack_var2 s = new stack_var2();
4+
int n = s.f(1);
5+
assert(n==0);
6+
}
7+
}
206 Bytes
Binary file not shown.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.class public stack_var2
2+
.super java/lang/Object
3+
4+
.method public <init>()V
5+
aload_0
6+
invokenonvirtual java/lang/Object/<init>()V
7+
return
8+
.end method
9+
10+
.method public f(I)I
11+
.limit stack 3
12+
.limit locals 2
13+
14+
;; push local var1
15+
iload_1
16+
;; duplicate
17+
dup
18+
;; increment local var1
19+
iinc 1 1
20+
;; push local var1
21+
iload_1
22+
isub
23+
;; incremented copy on stack
24+
ireturn
25+
.end method
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
stack_test.class
3+
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^.*assertion at file stack_test.java line 5 function.*: FAILURE$
7+
^VERIFICATION FAILED$
8+
--
9+
^warning: ignoring
601 Bytes
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
public class stack_test {
2+
public static void main(String[] args) {
3+
stack_var3 s = new stack_var3();
4+
int n = s.f();
5+
assert(n==0);
6+
}
7+
}
210 Bytes
Binary file not shown.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.class public stack_var3
2+
.super java/lang/Object
3+
4+
.method public <init>()V
5+
aload_0
6+
invokenonvirtual java/lang/Object/<init>()V
7+
return
8+
.end method
9+
10+
.method public f()I
11+
.limit stack 5
12+
.limit locals 3
13+
14+
;; 1->var1
15+
;; 0->var2
16+
iconst_1
17+
istore_1
18+
iconst_0
19+
istore_2
20+
;; push local var2 / var1
21+
iload_2
22+
iload_1
23+
;; dup var1
24+
dup_x1
25+
;; sub one from var1
26+
iinc 1 -1
27+
;; pop first var1
28+
pop
29+
;; sub
30+
isub
31+
;; incremented copy on stack
32+
ireturn
33+
.end method
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
stack_test.class
3+
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^.*assertion at file stack_test.java line 5 function.*: FAILURE$
7+
^VERIFICATION FAILED$
8+
--
9+
^warning: ignoring
601 Bytes
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
public class stack_test {
2+
public static void main(String[] args) {
3+
stack_var4 s = new stack_var4();
4+
int n = s.f();
5+
assert(n==0);
6+
}
7+
}
214 Bytes
Binary file not shown.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
.class public stack_var4
2+
.super java/lang/Object
3+
4+
.method public <init>()V
5+
aload_0
6+
invokenonvirtual java/lang/Object/<init>()V
7+
return
8+
.end method
9+
10+
.method public f()I
11+
.limit stack 5
12+
.limit locals 4
13+
14+
;; 0->var1
15+
;; 1->var2
16+
;; 2->var3
17+
iconst_0
18+
istore_1
19+
iconst_1
20+
istore_2
21+
iconst_2
22+
istore_3
23+
24+
;; push local var3 / var2 / var1
25+
iload_3
26+
iload_2
27+
iload_1
28+
;; push var1 in front of var3
29+
dup_x2
30+
;; add one to local var 1
31+
iinc 1 1
32+
pop
33+
pop
34+
pop
35+
;; incremented copy on stack
36+
ireturn
37+
.end method
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
stack_test.class
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^.*assertion at file stack_test.java line 5 function.*: SUCCESS
7+
$
8+
^VERIFICATION SUCCESSFUL$
9+
--
10+
^warning: ignoring

0 commit comments

Comments
 (0)