Skip to content

Commit 0aec9b1

Browse files
author
Matthias Güdemann
committed
Add regression tests for dup2, dup2_x1 and dup2_x2
1 parent 3f5dac8 commit 0aec9b1

15 files changed

+152
-0
lines changed
602 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_var5 s = new stack_var5();
4+
int n = s.f();
5+
assert(n==1);
6+
}
7+
}
209 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_var5
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 4
12+
.limit locals 4
13+
14+
;; 1->var1
15+
;; 2->var2
16+
iconst_1
17+
istore_1
18+
iconst_2
19+
istore_2
20+
21+
;; push local var2 / var1
22+
iload_2
23+
iload_1
24+
25+
;; duplicate var2 / var1
26+
dup2
27+
;; add one to local var 1
28+
iinc 1 1
29+
;; sub
30+
isub
31+
;; incremented copy on stack
32+
ireturn
33+
.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
609 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_var6 s = new stack_var6();
4+
int n = s.f(1,2,4);
5+
assert(n==-2);
6+
}
7+
}
209 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_var6
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(III)I
11+
.limit stack 8
12+
.limit locals 5
13+
14+
;; push local var3 / var2 / var1
15+
iload_1
16+
iload_2
17+
iload_3
18+
dup2_x1
19+
;; add one to local var 2
20+
iinc 2 1
21+
;; sub
22+
isub
23+
;; incremented copy on stack
24+
ireturn
25+
.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
602 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_var7 s = new stack_var7();
4+
int n = s.f();
5+
assert(n==1);
6+
}
7+
}
223 Bytes
Binary file not shown.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
.class public stack_var7
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 8
12+
.limit locals 5
13+
14+
;; 1->var1
15+
;; 2->var2
16+
;; 4->var3
17+
;; 8->var4
18+
iconst_1
19+
istore_1
20+
iconst_2
21+
istore_2
22+
iconst_4
23+
istore_3
24+
bipush 8
25+
istore 4
26+
;; push local var4 / var3 / var2 / var1
27+
iload 4
28+
iload_3
29+
iload_2
30+
iload 1
31+
;; push var2 / var1 in on head
32+
dup2_x2
33+
;; add one to local var 1
34+
iinc 1 1
35+
pop
36+
pop
37+
pop
38+
pop
39+
;; sub
40+
isub
41+
;; incremented copy on stack
42+
ireturn
43+
.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)