-
Notifications
You must be signed in to change notification settings - Fork 273
Introduce temporary stack variables for getfield/-static and ?load #931
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2e4e0b5
d9e3bbc
319ff01
75b770b
3569806
74ac6e1
3f5dac8
0aec9b1
8cacd7d
52f522d
fc1a852
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ Break.class | |
^SIGNAL=0$ | ||
dead i; | ||
-- | ||
GOTO 10 | ||
GOTO 11 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
This regression test is created from the .j file with the jasmin assembler. | ||
https://github.com/Sable/jasmin | ||
|
||
On Ubuntu, it is available as jasmin-sable. To convert a .j file, it is | ||
sufficient to do | ||
|
||
> jasmin $FILE.j | ||
|
||
and it will create the corresponding $FILE.class file. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
public class stack_test { | ||
public static void main(String[] args) { | ||
stack_var1 s = new stack_var1(); | ||
int n = s.f(1); | ||
assert(n==0); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
.class public stack_var1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this file (and the other .j files) included? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these are the source files I used to create the classes. This is very bytecode specific, in particular the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, cool. Would you mind adding information in either the commit message or some extra readme file so that these steps become reproducible? I had naively thought that the .class files had been produced from the accompanying .java. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, will do, the |
||
.super java/lang/Object | ||
|
||
.method public <init>()V | ||
aload_0 | ||
invokenonvirtual java/lang/Object/<init>()V | ||
return | ||
.end method | ||
|
||
.method public f(I)I | ||
.limit stack 2 | ||
.limit locals 2 | ||
|
||
;; copy of arg on stack | ||
iload_1 | ||
;; increment arg | ||
iinc 1 1 | ||
;; incremented copy on stack | ||
iload_1 | ||
isub | ||
ireturn | ||
.end method |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
CORE | ||
stack_test.class | ||
|
||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^.*assertion at file stack_test.java line 5 function.*: FAILURE$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
This regression test is created from the .j file with the jasmin assembler. | ||
https://github.com/Sable/jasmin | ||
|
||
On Ubuntu, it is available as jasmin-sable. To convert a .j file, it is | ||
sufficient to do | ||
|
||
> jasmin $FILE.j | ||
|
||
and it will create the corresponding $FILE.class file. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
public class stack_test { | ||
public static void main(String[] args) { | ||
stack_var2 s = new stack_var2(); | ||
int n = s.f(1); | ||
assert(n==0); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.class public stack_var2 | ||
.super java/lang/Object | ||
|
||
.method public <init>()V | ||
aload_0 | ||
invokenonvirtual java/lang/Object/<init>()V | ||
return | ||
.end method | ||
|
||
.method public f(I)I | ||
.limit stack 3 | ||
.limit locals 2 | ||
|
||
;; push local var1 | ||
iload_1 | ||
;; duplicate | ||
dup | ||
;; increment local var1 | ||
iinc 1 1 | ||
;; push local var1 | ||
iload_1 | ||
isub | ||
;; incremented copy on stack | ||
ireturn | ||
.end method |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
CORE | ||
stack_test.class | ||
|
||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^.*assertion at file stack_test.java line 5 function.*: FAILURE$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
This regression test is created from the .j file with the jasmin assembler. | ||
https://github.com/Sable/jasmin | ||
|
||
On Ubuntu, it is available as jasmin-sable. To convert a .j file, it is | ||
sufficient to do | ||
|
||
> jasmin $FILE.j | ||
|
||
and it will create the corresponding $FILE.class file. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
public class stack_test { | ||
public static void main(String[] args) { | ||
stack_var3 s = new stack_var3(); | ||
int n = s.f(); | ||
assert(n==0); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
.class public stack_var3 | ||
.super java/lang/Object | ||
|
||
.method public <init>()V | ||
aload_0 | ||
invokenonvirtual java/lang/Object/<init>()V | ||
return | ||
.end method | ||
|
||
.method public f()I | ||
.limit stack 5 | ||
.limit locals 3 | ||
|
||
;; 1->var1 | ||
;; 0->var2 | ||
iconst_1 | ||
istore_1 | ||
iconst_0 | ||
istore_2 | ||
;; push local var2 / var1 | ||
iload_2 | ||
iload_1 | ||
;; dup var1 | ||
dup_x1 | ||
;; sub one from var1 | ||
iinc 1 -1 | ||
;; pop first var1 | ||
pop | ||
;; sub | ||
isub | ||
;; incremented copy on stack | ||
ireturn | ||
.end method |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
CORE | ||
stack_test.class | ||
|
||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^.*assertion at file stack_test.java line 5 function.*: FAILURE$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
This regression test is created from the .j file with the jasmin assembler. | ||
https://github.com/Sable/jasmin | ||
|
||
On Ubuntu, it is available as jasmin-sable. To convert a .j file, it is | ||
sufficient to do | ||
|
||
> jasmin $FILE.j | ||
|
||
and it will create the corresponding $FILE.class file. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
public class stack_test { | ||
public static void main(String[] args) { | ||
stack_var4 s = new stack_var4(); | ||
int n = s.f(); | ||
assert(n==0); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
.class public stack_var4 | ||
.super java/lang/Object | ||
|
||
.method public <init>()V | ||
aload_0 | ||
invokenonvirtual java/lang/Object/<init>()V | ||
return | ||
.end method | ||
|
||
.method public f()I | ||
.limit stack 5 | ||
.limit locals 4 | ||
|
||
;; 0->var1 | ||
;; 1->var2 | ||
;; 2->var3 | ||
iconst_0 | ||
istore_1 | ||
iconst_1 | ||
istore_2 | ||
iconst_2 | ||
istore_3 | ||
|
||
;; push local var3 / var2 / var1 | ||
iload_3 | ||
iload_2 | ||
iload_1 | ||
;; push var1 in front of var3 | ||
dup_x2 | ||
;; add one to local var 1 | ||
iinc 1 1 | ||
pop | ||
pop | ||
pop | ||
;; incremented copy on stack | ||
ireturn | ||
.end method |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CORE | ||
stack_test.class | ||
|
||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^.*assertion at file stack_test.java line 5 function.*: SUCCESS | ||
$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
^warning: ignoring |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
This regression test is created from the .j file with the jasmin assembler. | ||
https://github.com/Sable/jasmin | ||
|
||
On Ubuntu, it is available as jasmin-sable. To convert a .j file, it is | ||
sufficient to do | ||
|
||
> jasmin $FILE.j | ||
|
||
and it will create the corresponding $FILE.class file. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
public class stack_test { | ||
public static void main(String[] args) { | ||
stack_var5 s = new stack_var5(); | ||
int n = s.f(); | ||
assert(n==1); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
.class public stack_var5 | ||
.super java/lang/Object | ||
|
||
.method public <init>()V | ||
aload_0 | ||
invokenonvirtual java/lang/Object/<init>()V | ||
return | ||
.end method | ||
|
||
.method public f()I | ||
.limit stack 4 | ||
.limit locals 4 | ||
|
||
;; 1->var1 | ||
;; 2->var2 | ||
iconst_1 | ||
istore_1 | ||
iconst_2 | ||
istore_2 | ||
|
||
;; push local var2 / var1 | ||
iload_2 | ||
iload_1 | ||
|
||
;; duplicate var2 / var1 | ||
dup2 | ||
;; add one to local var 1 | ||
iinc 1 1 | ||
;; sub | ||
isub | ||
;; incremented copy on stack | ||
ireturn | ||
.end method |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CORE | ||
stack_test.class | ||
|
||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^.*assertion at file stack_test.java line 5 function.*: SUCCESS | ||
$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
^warning: ignoring |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
This regression test is created from the .j file with the jasmin assembler. | ||
https://github.com/Sable/jasmin | ||
|
||
On Ubuntu, it is available as jasmin-sable. To convert a .j file, it is | ||
sufficient to do | ||
|
||
> jasmin $FILE.j | ||
|
||
and it will create the corresponding $FILE.class file. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
public class stack_test { | ||
public static void main(String[] args) { | ||
stack_var6 s = new stack_var6(); | ||
int n = s.f(1,2,4); | ||
assert(n==-2); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.class public stack_var6 | ||
.super java/lang/Object | ||
|
||
.method public <init>()V | ||
aload_0 | ||
invokenonvirtual java/lang/Object/<init>()V | ||
return | ||
.end method | ||
|
||
.method public f(III)I | ||
.limit stack 8 | ||
.limit locals 5 | ||
|
||
;; push local var3 / var2 / var1 | ||
iload_1 | ||
iload_2 | ||
iload_3 | ||
dup2_x1 | ||
;; add one to local var 2 | ||
iinc 2 1 | ||
;; sub | ||
isub | ||
;; incremented copy on stack | ||
ireturn | ||
.end method |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CORE | ||
stack_test.class | ||
|
||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^.*assertion at file stack_test.java line 5 function.*: SUCCESS | ||
$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
^warning: ignoring |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
This regression test is created from the .j file with the jasmin assembler. | ||
https://github.com/Sable/jasmin | ||
|
||
On Ubuntu, it is available as jasmin-sable. To convert a .j file, it is | ||
sufficient to do | ||
|
||
> jasmin $FILE.j | ||
|
||
and it will create the corresponding $FILE.class file. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
public class stack_test { | ||
public static void main(String[] args) { | ||
stack_var7 s = new stack_var7(); | ||
int n = s.f(); | ||
assert(n==1); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to add as many details as possible, such as the precise command line? This is information that you've now got right at hand, but it will be much more work to reproduce later on. Memory is weak, git is strong!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:-) it is actually
jasmin $FILE.j
but I'll add this to the READMEsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added some comments about jasmin, how to get it and how to use it on
.j
filesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!