summaryrefslogtreecommitdiffstats
path: root/test/082-inline-execute
diff options
context:
space:
mode:
authorZuo Wang <zuo.wang@intel.com>2014-07-10 04:26:41 -0700
committerMathieu Chartier <mathieuc@google.com>2014-07-11 18:32:07 -0700
commitf37a88b8e6db6c587fa449a12e40cb46be1689fc (patch)
tree2e1d8b20e87796e1ad5d682dcce2a52a37f20123 /test/082-inline-execute
parent9531f62ef260cbd0d0512e4c96f5d5dd2f4fdbb2 (diff)
downloadart-f37a88b8e6db6c587fa449a12e40cb46be1689fc.tar.gz
art-f37a88b8e6db6c587fa449a12e40cb46be1689fc.tar.bz2
art-f37a88b8e6db6c587fa449a12e40cb46be1689fc.zip
ART: Compacting ROS/DlMalloc spaces with semispace copy GC
Current semispace copy GC is mainly associated with bump pointer spaces. Though it squeezes fragmentation most aggressively, an extra copy is required to re-establish the data in the ROS/DlMalloc space to allow CMS GCs to happen afterwards. As semispace copy GC is still stop-the-world, this not only introduces unnecessary overheads but also longer response time. Response time indicates the time duration between the start of transition request and the start of transition animation, which may impact the user experience. Using semispace copy GC to compact the data in a ROS space to another ROS(or DlMalloc space to another DlMalloc) space solves this problem. Although it squeezes less fragmentation, CMS GCs can run immediately after the compaction. We apply this algorithm in two cases: 1) Right before throwing an OOM if -XX:EnableHSpaceCompactForOOM is passed in as true. 2) When app is switched to background if the -XX:BackgroundGC option has value HSpaceCompact. For case 1), OOMs are significantly delayed in the harmony GC stress test, with compaction ratio up to 0.87. For case 2), compaction ratio around 0.5 is observed in both built-in SMS and browser. Similar results have been obtained on other apps as well. Change-Id: Iad9eabc6d046659fda3535ae20f21bc31f89ded3 Signed-off-by: Wang, Zuo <zuo.wang@intel.com> Signed-off-by: Chang, Yang <yang.chang@intel.com> Signed-off-by: Lei Li <lei.l.li@intel.com> Signed-off-by: Lin Zang <lin.zang@intel.com>
Diffstat (limited to 'test/082-inline-execute')
-rw-r--r--test/082-inline-execute/src/Main.java75
1 files changed, 10 insertions, 65 deletions
diff --git a/test/082-inline-execute/src/Main.java b/test/082-inline-execute/src/Main.java
index f412034de2..739dbf81c0 100644
--- a/test/082-inline-execute/src/Main.java
+++ b/test/082-inline-execute/src/Main.java
@@ -61,9 +61,6 @@ public class Main {
test_Memory_pokeShort();
test_Memory_pokeInt();
test_Memory_pokeLong();
- test_AtomicBoolean_compareAndSet();
- test_AtomicInteger_compareAndSet();
- test_AtomicLong_compareAndSet();
}
/*
@@ -96,60 +93,6 @@ public class Main {
Assert.assertNotNull(Thread.currentThread());
}
- /**
- * Will test inlining CAS, by inclusion of AtomicBoolean in core.oat.
- */
- public static void test_AtomicBoolean_compareAndSet() {
- java.util.concurrent.atomic.AtomicBoolean ab = new java.util.concurrent.atomic.AtomicBoolean();
- Assert.assertEquals(ab.compareAndSet(false, false), true);
- Assert.assertEquals(ab.compareAndSet(true, false), false);
- Assert.assertEquals(ab.compareAndSet(true, true), false);
- Assert.assertEquals(ab.compareAndSet(false, true), true);
- Assert.assertEquals(ab.compareAndSet(false, true), false);
- Assert.assertEquals(ab.compareAndSet(false, false), false);
- Assert.assertEquals(ab.compareAndSet(true, true), true);
- Assert.assertEquals(ab.compareAndSet(true, false), true);
- Assert.assertEquals(ab.compareAndSet(true, false), false);
- Assert.assertEquals(ab.compareAndSet(true, true), false);
- Assert.assertEquals(ab.compareAndSet(false, false), true);
- }
-
- /**
- * Will test inlining CAS, by inclusion of AtomicInteger in core.oat.
- */
- public static void test_AtomicInteger_compareAndSet() {
- java.util.concurrent.atomic.AtomicInteger ab = new java.util.concurrent.atomic.AtomicInteger();
- Assert.assertEquals(ab.compareAndSet(0, 0), true);
- Assert.assertEquals(ab.compareAndSet(0x12345678, 0), false);
- Assert.assertEquals(ab.compareAndSet(0x12345678, 0x12345678), false);
- Assert.assertEquals(ab.compareAndSet(0, 0x12345678), true);
- Assert.assertEquals(ab.compareAndSet(0, 0x12345678), false);
- Assert.assertEquals(ab.compareAndSet(0, 0), false);
- Assert.assertEquals(ab.compareAndSet(0x12345678, 0x12345678), true);
- Assert.assertEquals(ab.compareAndSet(0x12345678, 0), true);
- Assert.assertEquals(ab.compareAndSet(0x12345678, 0), false);
- Assert.assertEquals(ab.compareAndSet(0x12345678, 0x12345678), false);
- Assert.assertEquals(ab.compareAndSet(0, 0), true);
- }
-
- /**
- * Will test inlining CAS, by inclusion of AtomicLong in core.oat.
- */
- public static void test_AtomicLong_compareAndSet() {
- java.util.concurrent.atomic.AtomicLong ab = new java.util.concurrent.atomic.AtomicLong();
- Assert.assertEquals(ab.compareAndSet(0l, 0l), true);
- Assert.assertEquals(ab.compareAndSet(0x1234567890l, 0l), false);
- Assert.assertEquals(ab.compareAndSet(0x1234567890l, 0x1234567890l), false);
- Assert.assertEquals(ab.compareAndSet(0l, 0x1234567890l), true);
- Assert.assertEquals(ab.compareAndSet(0l, 0x1234567890l), false);
- Assert.assertEquals(ab.compareAndSet(0l, 0l), false);
- Assert.assertEquals(ab.compareAndSet(0x1234567890l, 0x1234567890l), true);
- Assert.assertEquals(ab.compareAndSet(0x1234567890l, 0l), true);
- Assert.assertEquals(ab.compareAndSet(0x1234567890l, 0l), false);
- Assert.assertEquals(ab.compareAndSet(0x1234567890l, 0x1234567890l), false);
- Assert.assertEquals(ab.compareAndSet(0l, 0l), true);
- }
-
public static void test_String_length() {
String str0 = "";
String str1 = "x";
@@ -580,6 +523,7 @@ public class Main {
static Object runtime;
static Method address_of;
+ static Method new_non_movable_array;
static Method peek_byte;
static Method peek_short;
static Method peek_int;
@@ -594,6 +538,7 @@ public class Main {
Method get_runtime = vm_runtime.getDeclaredMethod("getRuntime");
runtime = get_runtime.invoke(null);
address_of = vm_runtime.getDeclaredMethod("addressOf", Object.class);
+ new_non_movable_array = vm_runtime.getDeclaredMethod("newNonMovableArray", Class.class, Integer.TYPE);
Class<?> io_memory = Class.forName("libcore.io.Memory");
peek_byte = io_memory.getDeclaredMethod("peekByte", Long.TYPE);
@@ -607,7 +552,7 @@ public class Main {
}
public static void test_Memory_peekByte() throws Exception {
- byte[] b = new byte [2];
+ byte[] b = (byte[])new_non_movable_array.invoke(runtime, Byte.TYPE, 2);
b[0] = 0x12;
b[1] = 0x11;
long address = (long)address_of.invoke(runtime, b);
@@ -616,7 +561,7 @@ public class Main {
}
public static void test_Memory_peekShort() throws Exception {
- byte[] b = new byte [3];
+ byte[] b = (byte[])new_non_movable_array.invoke(runtime, Byte.TYPE, 3);
b[0] = 0x13;
b[1] = 0x12;
b[2] = 0x11;
@@ -626,7 +571,7 @@ public class Main {
}
public static void test_Memory_peekInt() throws Exception {
- byte[] b = new byte [5];
+ byte[] b = (byte[])new_non_movable_array.invoke(runtime, Byte.TYPE, 5);
b[0] = 0x15;
b[1] = 0x14;
b[2] = 0x13;
@@ -638,7 +583,7 @@ public class Main {
}
public static void test_Memory_peekLong() throws Exception {
- byte[] b = new byte [9];
+ byte[] b = (byte[])new_non_movable_array.invoke(runtime, Byte.TYPE, 9);
b[0] = 0x19;
b[1] = 0x18;
b[2] = 0x17;
@@ -655,7 +600,7 @@ public class Main {
public static void test_Memory_pokeByte() throws Exception {
byte[] r = {0x11, 0x12};
- byte[] b = new byte [2];
+ byte[] b = (byte[])new_non_movable_array.invoke(runtime, Byte.TYPE, 2);
long address = (long)address_of.invoke(runtime, b);
poke_byte.invoke(null, address, (byte)0x11);
poke_byte.invoke(null, address + 1, (byte)0x12);
@@ -665,7 +610,7 @@ public class Main {
public static void test_Memory_pokeShort() throws Exception {
byte[] ra = {0x12, 0x11, 0x13};
byte[] ru = {0x12, 0x22, 0x21};
- byte[] b = new byte [3];
+ byte[] b = (byte[])new_non_movable_array.invoke(runtime, Byte.TYPE, 3);
long address = (long)address_of.invoke(runtime, b);
// Aligned write
@@ -681,7 +626,7 @@ public class Main {
public static void test_Memory_pokeInt() throws Exception {
byte[] ra = {0x14, 0x13, 0x12, 0x11, 0x15};
byte[] ru = {0x14, 0x24, 0x23, 0x22, 0x21};
- byte[] b = new byte [5];
+ byte[] b = (byte[])new_non_movable_array.invoke(runtime, Byte.TYPE, 5);
long address = (long)address_of.invoke(runtime, b);
b[4] = 0x15;
@@ -695,7 +640,7 @@ public class Main {
public static void test_Memory_pokeLong() throws Exception {
byte[] ra = {0x18, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x19};
byte[] ru = {0x18, 0x28, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21};
- byte[] b = new byte [9];
+ byte[] b = (byte[])new_non_movable_array.invoke(runtime, Byte.TYPE, 9);
long address = (long)address_of.invoke(runtime, b);
b[8] = 0x19;