Mercurial > hg > truffle
annotate graal/com.oracle.truffle.sl.test/tests/LoopInvalidate.sl @ 18279:46e10fe1ade1
made Replacements interface extend Remote
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 06 Nov 2014 13:18:23 +0100 |
parents | afd6fa5e8229 |
children |
rev | line source |
---|---|
13882
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
1 function add(a, b) { |
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
2 return a + b; |
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
3 } |
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
4 |
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
5 function loop(n) { |
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
6 i = 0; |
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
7 while (i < n) { |
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
8 i = add(i, 1); |
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
9 } |
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
10 return i; |
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
11 } |
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
12 |
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
13 function main() { |
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
14 i = 0; |
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
15 while (i < 20) { |
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
16 loop(1000); |
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
17 i = i + 1; |
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
18 } |
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
19 add("a", "b"); |
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
20 println(loop(1000)); |
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
21 } |