Skip to content

Commit 9368613

Browse files
author
Matthias Güdemann
committed
Add regression test for ?astore
1 parent 0b81ed6 commit 9368613

File tree

5 files changed

+47
-0
lines changed

5 files changed

+47
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
This regression test is created from the .j file with the jasmin assembler.
2+
https://github.com/Sable/jasmin
3+
4+
On Ubuntu, it is available as jasmin-sable. To convert a .j file, it is
5+
sufficient to do
6+
7+
> jasmin $FILE.j
8+
9+
and it will create the corresponding $FILE.class file.
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_var11 s = new stack_var11();
4+
int n = s.f();
5+
assert(n==0);
6+
}
7+
}
249 Bytes
Binary file not shown.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.class public stack_var11
2+
.super java/lang/Object
3+
4+
.field private arr [I
5+
6+
.method public <init>()V
7+
.limit stack 5
8+
aload_0
9+
invokenonvirtual java/lang/Object/<init>()V
10+
aload_0
11+
iconst_2
12+
newarray int
13+
putfield stack_var11/arr [I
14+
return
15+
.end method
16+
17+
.method public f()I
18+
.limit stack 8
19+
.limit locals 5
20+
aload_0
21+
getfield stack_var11/arr [I
22+
iconst_0
23+
iaload ;; put arr[0] on stack (currently 0)
24+
aload_0
25+
getfield stack_var11/arr [I
26+
iconst_0
27+
iconst_1
28+
iastore ;; store 1 in arr[0],
29+
;; value on stack should not be touched
30+
ireturn
31+
.end method

0 commit comments

Comments
 (0)