ART: Do not emit load when inlining unused Thread.currentThread()
When the result is not used, do not emit the load. This avoids
uninitialized registers leading to size-check errors.
Change-Id: I212392ffea7243720f120b2f12679df286106a02
diff --git a/test/082-inline-execute/src/Main.java b/test/082-inline-execute/src/Main.java
index 5b8134d..3b11879 100644
--- a/test/082-inline-execute/src/Main.java
+++ b/test/082-inline-execute/src/Main.java
@@ -49,6 +49,7 @@
test_String_indexOf();
test_String_isEmpty();
test_String_length();
+ test_Thread_currentThread();
}
/*
@@ -70,6 +71,17 @@
return (b - a) < maxDelta;
}
+ /**
+ * Will test inlining Thread.currentThread().
+ */
+ public static void test_Thread_currentThread() {
+ // 1. Do not use result.
+ Thread.currentThread();
+
+ // 2. Result should not be null.
+ Assert.assertNotNull(Thread.currentThread());
+ }
+
public static void test_String_length() {
String str0 = "";
String str1 = "x";