summaryrefslogtreecommitdiffstats
path: root/test/083-compiler-regressions/src
diff options
context:
space:
mode:
authorYevgeny Rouban <yevgeny.y.rouban@intel.com>2014-03-18 15:55:16 +0700
committerIan Rogers <irogers@google.com>2014-03-26 15:06:23 -0700
commitd3a2dfad0e1231b354e4bf77b67a4e179fa0e837 (patch)
tree1f439e9a466aeb91c449fb81ba2417af2d46ff6f /test/083-compiler-regressions/src
parent223efbe5164f6fe83cf04e7f9121adb29b8dd231 (diff)
downloadart-d3a2dfad0e1231b354e4bf77b67a4e179fa0e837.zip
art-d3a2dfad0e1231b354e4bf77b67a4e179fa0e837.tar.gz
art-d3a2dfad0e1231b354e4bf77b67a4e179fa0e837.tar.bz2
Reuse promoted register temporarily
AtomicLong (x86) is implemented as an intrinsic, which uses the cmpxchng8b instruction. This instruction requires 4 physical registers plus 2 more used for the memory operand. On x86 we have only 4 temporaries. The code tried to solve this by using MarkTemp utility, but this was not meant to be used with promoted registers. The problem is that MarkTemp does not spill anything and as a result we can lose VR. If the registers are promoted this patch just reuses the values pushed on the stack. Change-Id: Ifec9183e2483cf704d0d1166a1004a9aa07b4f1d Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com> Signed-off-by: Yevgeny Rouban <yevgeny.y.rouban@intel.com>
Diffstat (limited to 'test/083-compiler-regressions/src')
-rw-r--r--test/083-compiler-regressions/src/Main.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/083-compiler-regressions/src/Main.java b/test/083-compiler-regressions/src/Main.java
index 96c71cf..2745c27 100644
--- a/test/083-compiler-regressions/src/Main.java
+++ b/test/083-compiler-regressions/src/Main.java
@@ -15,6 +15,7 @@
*/
import java.util.concurrent.*;
+import java.util.concurrent.atomic.AtomicLong;
/**
* Test for Jit regressions.
@@ -47,6 +48,18 @@ public class Main {
ZeroTests.longModTest();
MirOpSelectTests.testIfCcz();
ManyFloatArgs();
+ atomicLong();
+ }
+
+ public static void atomicLong() {
+ AtomicLong atomicLong = new AtomicLong();
+ atomicLong.addAndGet(3);
+ atomicLong.addAndGet(2);
+ atomicLong.addAndGet(1);
+ long result = atomicLong.get();
+ System.out.println(result == 6L ? "atomicLong passes" :
+ ("atomicLong failes: returns " + result + ", expected 6")
+ );
}
public static void returnConstantTest() {