diff options
Diffstat (limited to 'test')
30 files changed, 1860 insertions, 92 deletions
diff --git a/test/1912-get-set-local-primitive/expected.txt b/test/1912-get-set-local-primitive/expected.txt index f2c5ce8640..8a0356644d 100644 --- a/test/1912-get-set-local-primitive/expected.txt +++ b/test/1912-get-set-local-primitive/expected.txt @@ -10,6 +10,9 @@ Running public static void art.Test1912.IntMethod(java.lang.Runnable) with "GetF Running public static void art.Test1912.IntMethod(java.lang.Runnable) with "GetDouble" on remote thread. "GetDouble" on public static void art.Test1912.IntMethod(java.lang.Runnable) failed due to JVMTI_ERROR_TYPE_MISMATCH Value is '42' (class: class java.lang.Integer) +Running public static void art.Test1912.IntMethod(java.lang.Runnable) with "GetObject" on remote thread. +"GetObject" on public static void art.Test1912.IntMethod(java.lang.Runnable) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is '42' (class: class java.lang.Integer) Running public static void art.Test1912.IntMethod(java.lang.Runnable) with "SetInt" on remote thread. "SetInt" on public static void art.Test1912.IntMethod(java.lang.Runnable) set value: 2147483647 Value is '2147483647' (class: class java.lang.Integer) @@ -22,6 +25,12 @@ Running public static void art.Test1912.IntMethod(java.lang.Runnable) with "SetF Running public static void art.Test1912.IntMethod(java.lang.Runnable) with "SetDouble" on remote thread. "SetDouble" on public static void art.Test1912.IntMethod(java.lang.Runnable) failed to set value 12.4 due to JVMTI_ERROR_TYPE_MISMATCH Value is '42' (class: class java.lang.Integer) +Running public static void art.Test1912.IntMethod(java.lang.Runnable) with "SetObject" on remote thread. +"SetObject" on public static void art.Test1912.IntMethod(java.lang.Runnable) failed to set value NEW_VALUE_FOR_SET due to JVMTI_ERROR_TYPE_MISMATCH + Value is '42' (class: class java.lang.Integer) +Running public static void art.Test1912.IntMethod(java.lang.Runnable) with "SetNullObject" on remote thread. +"SetNullObject" on public static void art.Test1912.IntMethod(java.lang.Runnable) failed to set value null due to JVMTI_ERROR_TYPE_MISMATCH + Value is '42' (class: class java.lang.Integer) Running public static void art.Test1912.LongMethod(java.lang.Runnable) with "GetInt" on remote thread. "GetInt" on public static void art.Test1912.LongMethod(java.lang.Runnable) failed due to JVMTI_ERROR_TYPE_MISMATCH Value is '9001' (class: class java.lang.Long) @@ -34,6 +43,9 @@ Running public static void art.Test1912.LongMethod(java.lang.Runnable) with "Get Running public static void art.Test1912.LongMethod(java.lang.Runnable) with "GetDouble" on remote thread. "GetDouble" on public static void art.Test1912.LongMethod(java.lang.Runnable) failed due to JVMTI_ERROR_TYPE_MISMATCH Value is '9001' (class: class java.lang.Long) +Running public static void art.Test1912.LongMethod(java.lang.Runnable) with "GetObject" on remote thread. +"GetObject" on public static void art.Test1912.LongMethod(java.lang.Runnable) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is '9001' (class: class java.lang.Long) Running public static void art.Test1912.LongMethod(java.lang.Runnable) with "SetInt" on remote thread. "SetInt" on public static void art.Test1912.LongMethod(java.lang.Runnable) failed to set value 2147483647 due to JVMTI_ERROR_TYPE_MISMATCH Value is '9001' (class: class java.lang.Long) @@ -46,6 +58,12 @@ Running public static void art.Test1912.LongMethod(java.lang.Runnable) with "Set Running public static void art.Test1912.LongMethod(java.lang.Runnable) with "SetDouble" on remote thread. "SetDouble" on public static void art.Test1912.LongMethod(java.lang.Runnable) failed to set value 12.4 due to JVMTI_ERROR_TYPE_MISMATCH Value is '9001' (class: class java.lang.Long) +Running public static void art.Test1912.LongMethod(java.lang.Runnable) with "SetObject" on remote thread. +"SetObject" on public static void art.Test1912.LongMethod(java.lang.Runnable) failed to set value NEW_VALUE_FOR_SET due to JVMTI_ERROR_TYPE_MISMATCH + Value is '9001' (class: class java.lang.Long) +Running public static void art.Test1912.LongMethod(java.lang.Runnable) with "SetNullObject" on remote thread. +"SetNullObject" on public static void art.Test1912.LongMethod(java.lang.Runnable) failed to set value null due to JVMTI_ERROR_TYPE_MISMATCH + Value is '9001' (class: class java.lang.Long) Running public static void art.Test1912.FloatMethod(java.lang.Runnable) with "GetInt" on remote thread. "GetInt" on public static void art.Test1912.FloatMethod(java.lang.Runnable) failed due to JVMTI_ERROR_TYPE_MISMATCH Value is '1.618' (class: class java.lang.Float) @@ -58,6 +76,9 @@ Running public static void art.Test1912.FloatMethod(java.lang.Runnable) with "Ge Running public static void art.Test1912.FloatMethod(java.lang.Runnable) with "GetDouble" on remote thread. "GetDouble" on public static void art.Test1912.FloatMethod(java.lang.Runnable) failed due to JVMTI_ERROR_TYPE_MISMATCH Value is '1.618' (class: class java.lang.Float) +Running public static void art.Test1912.FloatMethod(java.lang.Runnable) with "GetObject" on remote thread. +"GetObject" on public static void art.Test1912.FloatMethod(java.lang.Runnable) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is '1.618' (class: class java.lang.Float) Running public static void art.Test1912.FloatMethod(java.lang.Runnable) with "SetInt" on remote thread. "SetInt" on public static void art.Test1912.FloatMethod(java.lang.Runnable) failed to set value 2147483647 due to JVMTI_ERROR_TYPE_MISMATCH Value is '1.618' (class: class java.lang.Float) @@ -70,6 +91,12 @@ Running public static void art.Test1912.FloatMethod(java.lang.Runnable) with "Se Running public static void art.Test1912.FloatMethod(java.lang.Runnable) with "SetDouble" on remote thread. "SetDouble" on public static void art.Test1912.FloatMethod(java.lang.Runnable) failed to set value 12.4 due to JVMTI_ERROR_TYPE_MISMATCH Value is '1.618' (class: class java.lang.Float) +Running public static void art.Test1912.FloatMethod(java.lang.Runnable) with "SetObject" on remote thread. +"SetObject" on public static void art.Test1912.FloatMethod(java.lang.Runnable) failed to set value NEW_VALUE_FOR_SET due to JVMTI_ERROR_TYPE_MISMATCH + Value is '1.618' (class: class java.lang.Float) +Running public static void art.Test1912.FloatMethod(java.lang.Runnable) with "SetNullObject" on remote thread. +"SetNullObject" on public static void art.Test1912.FloatMethod(java.lang.Runnable) failed to set value null due to JVMTI_ERROR_TYPE_MISMATCH + Value is '1.618' (class: class java.lang.Float) Running public static void art.Test1912.DoubleMethod(java.lang.Runnable) with "GetInt" on remote thread. "GetInt" on public static void art.Test1912.DoubleMethod(java.lang.Runnable) failed due to JVMTI_ERROR_TYPE_MISMATCH Value is '3.1415' (class: class java.lang.Double) @@ -82,6 +109,9 @@ Running public static void art.Test1912.DoubleMethod(java.lang.Runnable) with "G Running public static void art.Test1912.DoubleMethod(java.lang.Runnable) with "GetDouble" on remote thread. "GetDouble" on public static void art.Test1912.DoubleMethod(java.lang.Runnable) got value: 3.1415 Value is '3.1415' (class: class java.lang.Double) +Running public static void art.Test1912.DoubleMethod(java.lang.Runnable) with "GetObject" on remote thread. +"GetObject" on public static void art.Test1912.DoubleMethod(java.lang.Runnable) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is '3.1415' (class: class java.lang.Double) Running public static void art.Test1912.DoubleMethod(java.lang.Runnable) with "SetInt" on remote thread. "SetInt" on public static void art.Test1912.DoubleMethod(java.lang.Runnable) failed to set value 2147483647 due to JVMTI_ERROR_TYPE_MISMATCH Value is '3.1415' (class: class java.lang.Double) @@ -94,6 +124,78 @@ Running public static void art.Test1912.DoubleMethod(java.lang.Runnable) with "S Running public static void art.Test1912.DoubleMethod(java.lang.Runnable) with "SetDouble" on remote thread. "SetDouble" on public static void art.Test1912.DoubleMethod(java.lang.Runnable) set value: 12.4 Value is '12.4' (class: class java.lang.Double) +Running public static void art.Test1912.DoubleMethod(java.lang.Runnable) with "SetObject" on remote thread. +"SetObject" on public static void art.Test1912.DoubleMethod(java.lang.Runnable) failed to set value NEW_VALUE_FOR_SET due to JVMTI_ERROR_TYPE_MISMATCH + Value is '3.1415' (class: class java.lang.Double) +Running public static void art.Test1912.DoubleMethod(java.lang.Runnable) with "SetNullObject" on remote thread. +"SetNullObject" on public static void art.Test1912.DoubleMethod(java.lang.Runnable) failed to set value null due to JVMTI_ERROR_TYPE_MISMATCH + Value is '3.1415' (class: class java.lang.Double) +Running public static void art.Test1912.ObjectMethod(java.lang.Runnable) with "GetInt" on remote thread. +"GetInt" on public static void art.Test1912.ObjectMethod(java.lang.Runnable) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'TARGET OBJECT' (class: class java.lang.String) +Running public static void art.Test1912.ObjectMethod(java.lang.Runnable) with "GetLong" on remote thread. +"GetLong" on public static void art.Test1912.ObjectMethod(java.lang.Runnable) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'TARGET OBJECT' (class: class java.lang.String) +Running public static void art.Test1912.ObjectMethod(java.lang.Runnable) with "GetFloat" on remote thread. +"GetFloat" on public static void art.Test1912.ObjectMethod(java.lang.Runnable) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'TARGET OBJECT' (class: class java.lang.String) +Running public static void art.Test1912.ObjectMethod(java.lang.Runnable) with "GetDouble" on remote thread. +"GetDouble" on public static void art.Test1912.ObjectMethod(java.lang.Runnable) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'TARGET OBJECT' (class: class java.lang.String) +Running public static void art.Test1912.ObjectMethod(java.lang.Runnable) with "GetObject" on remote thread. +"GetObject" on public static void art.Test1912.ObjectMethod(java.lang.Runnable) got value: TARGET OBJECT + Value is 'TARGET OBJECT' (class: class java.lang.String) +Running public static void art.Test1912.ObjectMethod(java.lang.Runnable) with "SetInt" on remote thread. +"SetInt" on public static void art.Test1912.ObjectMethod(java.lang.Runnable) failed to set value 2147483647 due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'TARGET OBJECT' (class: class java.lang.String) +Running public static void art.Test1912.ObjectMethod(java.lang.Runnable) with "SetLong" on remote thread. +"SetLong" on public static void art.Test1912.ObjectMethod(java.lang.Runnable) failed to set value 9223372036854775807 due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'TARGET OBJECT' (class: class java.lang.String) +Running public static void art.Test1912.ObjectMethod(java.lang.Runnable) with "SetFloat" on remote thread. +"SetFloat" on public static void art.Test1912.ObjectMethod(java.lang.Runnable) failed to set value 9.2 due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'TARGET OBJECT' (class: class java.lang.String) +Running public static void art.Test1912.ObjectMethod(java.lang.Runnable) with "SetDouble" on remote thread. +"SetDouble" on public static void art.Test1912.ObjectMethod(java.lang.Runnable) failed to set value 12.4 due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'TARGET OBJECT' (class: class java.lang.String) +Running public static void art.Test1912.ObjectMethod(java.lang.Runnable) with "SetObject" on remote thread. +"SetObject" on public static void art.Test1912.ObjectMethod(java.lang.Runnable) set value: NEW_VALUE_FOR_SET + Value is 'NEW_VALUE_FOR_SET' (class: class java.lang.String) +Running public static void art.Test1912.ObjectMethod(java.lang.Runnable) with "SetNullObject" on remote thread. +"SetNullObject" on public static void art.Test1912.ObjectMethod(java.lang.Runnable) set value: null + Value is 'null' (class: null) +Running public static void art.Test1912.NullObjectMethod(java.lang.Runnable) with "GetInt" on remote thread. +"GetInt" on public static void art.Test1912.NullObjectMethod(java.lang.Runnable) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'null' (class: null) +Running public static void art.Test1912.NullObjectMethod(java.lang.Runnable) with "GetLong" on remote thread. +"GetLong" on public static void art.Test1912.NullObjectMethod(java.lang.Runnable) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'null' (class: null) +Running public static void art.Test1912.NullObjectMethod(java.lang.Runnable) with "GetFloat" on remote thread. +"GetFloat" on public static void art.Test1912.NullObjectMethod(java.lang.Runnable) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'null' (class: null) +Running public static void art.Test1912.NullObjectMethod(java.lang.Runnable) with "GetDouble" on remote thread. +"GetDouble" on public static void art.Test1912.NullObjectMethod(java.lang.Runnable) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'null' (class: null) +Running public static void art.Test1912.NullObjectMethod(java.lang.Runnable) with "GetObject" on remote thread. +"GetObject" on public static void art.Test1912.NullObjectMethod(java.lang.Runnable) got value: null + Value is 'null' (class: null) +Running public static void art.Test1912.NullObjectMethod(java.lang.Runnable) with "SetInt" on remote thread. +"SetInt" on public static void art.Test1912.NullObjectMethod(java.lang.Runnable) failed to set value 2147483647 due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'null' (class: null) +Running public static void art.Test1912.NullObjectMethod(java.lang.Runnable) with "SetLong" on remote thread. +"SetLong" on public static void art.Test1912.NullObjectMethod(java.lang.Runnable) failed to set value 9223372036854775807 due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'null' (class: null) +Running public static void art.Test1912.NullObjectMethod(java.lang.Runnable) with "SetFloat" on remote thread. +"SetFloat" on public static void art.Test1912.NullObjectMethod(java.lang.Runnable) failed to set value 9.2 due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'null' (class: null) +Running public static void art.Test1912.NullObjectMethod(java.lang.Runnable) with "SetDouble" on remote thread. +"SetDouble" on public static void art.Test1912.NullObjectMethod(java.lang.Runnable) failed to set value 12.4 due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'null' (class: null) +Running public static void art.Test1912.NullObjectMethod(java.lang.Runnable) with "SetObject" on remote thread. +"SetObject" on public static void art.Test1912.NullObjectMethod(java.lang.Runnable) set value: NEW_VALUE_FOR_SET + Value is 'NEW_VALUE_FOR_SET' (class: class java.lang.String) +Running public static void art.Test1912.NullObjectMethod(java.lang.Runnable) with "SetNullObject" on remote thread. +"SetNullObject" on public static void art.Test1912.NullObjectMethod(java.lang.Runnable) set value: null + Value is 'null' (class: null) Running public static void art.Test1912.BooleanMethod(java.lang.Runnable) with "SetIntBoolSize" on remote thread. "SetIntBoolSize" on public static void art.Test1912.BooleanMethod(java.lang.Runnable) set value: 1 Value is 'true' (class: class java.lang.Boolean) diff --git a/test/1912-get-set-local-primitive/src/art/Test1912.java b/test/1912-get-set-local-primitive/src/art/Test1912.java index 24149f4cbe..f0a606596e 100644 --- a/test/1912-get-set-local-primitive/src/art/Test1912.java +++ b/test/1912-get-set-local-primitive/src/art/Test1912.java @@ -20,29 +20,39 @@ import java.lang.reflect.Constructor; import java.lang.reflect.Executable; import java.lang.reflect.Method; import java.nio.ByteBuffer; -import java.util.concurrent.Semaphore; import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.Set; +import java.util.concurrent.Semaphore; +import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Predicate; import java.util.function.Supplier; -import java.util.function.Consumer; // TODO Rename test to set-get-local-prim public class Test1912 { public static final String TARGET_VAR = "TARGET"; - public static void reportValue(Object val) { if (val instanceof Character) { val = "<Char: " + Character.getNumericValue(((Character)val).charValue()) + ">"; } - System.out.println("\tValue is '" + val + "' (class: " + val.getClass() + ")"); + System.out.println("\tValue is '" + val + + "' (class: " + (val != null ? val.getClass().toString() : "null") + ")"); } + public static void NullObjectMethod(Runnable safepoint) { + Object TARGET = null; + safepoint.run(); + reportValue(TARGET); + } + public static void ObjectMethod(Runnable safepoint) { + Object TARGET = "TARGET OBJECT"; + safepoint.run(); + reportValue(TARGET); + } public static void BooleanMethod(Runnable safepoint) { boolean TARGET = false; safepoint.run(); @@ -85,31 +95,27 @@ public class Test1912 { } public static interface SafepointFunction { - public void invoke( - Thread thread, - Method target, - Locals.VariableDescription TARGET_desc, - int depth) throws Exception; + public void + invoke(Thread thread, Method target, Locals.VariableDescription TARGET_desc, int depth) + throws Exception; } public static interface SetterFunction { public void SetVar(Thread t, int depth, int slot, Object v); } - public static interface GetterFunction { - public Object GetVar(Thread t, int depth, int slot); - } + public static interface GetterFunction { public Object GetVar(Thread t, int depth, int slot); } - public static SafepointFunction NamedSet( - final String type, final SetterFunction get, final Object v) { + public static SafepointFunction + NamedSet(final String type, final SetterFunction get, final Object v) { return new SafepointFunction() { public void invoke(Thread t, Method method, Locals.VariableDescription desc, int depth) { try { get.SetVar(t, depth, desc.slot, v); System.out.println(this + " on " + method + " set value: " + v); } catch (Exception e) { - System.out.println( - this + " on " + method + " failed to set value " + v + " due to " + e.getMessage()); + System.out.println(this + " on " + method + " failed to set value " + v + " due to " + + e.getMessage()); } } public String toString() { @@ -171,15 +177,13 @@ public class Test1912 { public void exec(final SafepointFunction safepoint) throws Exception { System.out.println("Running " + target + " with " + safepoint + " on remote thread."); final ThreadPauser pause = new ThreadPauser(); - Thread remote = new Thread( - () -> { - try { - target.invoke(null, pause); - } catch (Exception e) { - throw new Error("Error invoking remote thread " + Thread.currentThread(), e); - } - }, - "remote thread for " + target + " with " + safepoint); + Thread remote = new Thread(() -> { + try { + target.invoke(null, pause); + } catch (Exception e) { + throw new Error("Error invoking remote thread " + Thread.currentThread(), e); + } + }, "remote thread for " + target + " with " + safepoint); remote.start(); pause.waitForOtherThreadToPause(); try { @@ -196,14 +200,12 @@ public class Test1912 { private Locals.VariableDescription findTargetVar(long loc) { for (Locals.VariableDescription var : Locals.GetLocalVariableTable(target)) { - if (var.start_location <= loc && - var.length + var.start_location > loc && + if (var.start_location <= loc && var.length + var.start_location > loc && var.name.equals(TARGET_VAR)) { return var; } } - throw new Error( - "Unable to find variable " + TARGET_VAR + " in " + target + " at loc " + loc); + throw new Error("Unable to find variable " + TARGET_VAR + " in " + target + " at loc " + loc); } private StackTrace.StackFrameData findStackFrame(Thread thr) { @@ -222,10 +224,9 @@ public class Test1912 { public static void run() throws Exception { Locals.EnableLocalVariableAccess(); final TestCase[] MAIN_TEST_CASES = new TestCase[] { - new TestCase(getMethod("IntMethod")), - new TestCase(getMethod("LongMethod")), - new TestCase(getMethod("FloatMethod")), - new TestCase(getMethod("DoubleMethod")), + new TestCase(getMethod("IntMethod")), new TestCase(getMethod("LongMethod")), + new TestCase(getMethod("FloatMethod")), new TestCase(getMethod("DoubleMethod")), + new TestCase(getMethod("ObjectMethod")), new TestCase(getMethod("NullObjectMethod")), }; final SafepointFunction[] SAFEPOINTS = new SafepointFunction[] { @@ -233,28 +234,30 @@ public class Test1912 { NamedGet("Long", Locals::GetLocalVariableLong), NamedGet("Float", Locals::GetLocalVariableFloat), NamedGet("Double", Locals::GetLocalVariableDouble), + NamedGet("Object", Locals::GetLocalVariableObject), NamedSet("Int", Locals::SetLocalVariableInt, Integer.MAX_VALUE), NamedSet("Long", Locals::SetLocalVariableLong, Long.MAX_VALUE), NamedSet("Float", Locals::SetLocalVariableFloat, 9.2f), NamedSet("Double", Locals::SetLocalVariableDouble, 12.4d), + NamedSet("Object", Locals::SetLocalVariableObject, "NEW_VALUE_FOR_SET"), + NamedSet("NullObject", Locals::SetLocalVariableObject, null), }; - for (TestCase t: MAIN_TEST_CASES) { + for (TestCase t : MAIN_TEST_CASES) { for (SafepointFunction s : SAFEPOINTS) { t.exec(s); } } // Test int for small values. - new TestCase(getMethod("BooleanMethod")).exec( - NamedSet("IntBoolSize", Locals::SetLocalVariableInt, 1)); - new TestCase(getMethod("ByteMethod")).exec( - NamedSet("IntByteSize", Locals::SetLocalVariableInt, Byte.MAX_VALUE - 1)); + new TestCase(getMethod("BooleanMethod")) + .exec(NamedSet("IntBoolSize", Locals::SetLocalVariableInt, 1)); + new TestCase(getMethod("ByteMethod")) + .exec(NamedSet("IntByteSize", Locals::SetLocalVariableInt, Byte.MAX_VALUE - 1)); - new TestCase(getMethod("CharMethod")).exec( - NamedSet("IntCharSize", Locals::SetLocalVariableInt, Character.MAX_VALUE - 1)); - new TestCase(getMethod("ShortMethod")).exec( - NamedSet("IntShortSize", Locals::SetLocalVariableInt, Short.MAX_VALUE - 1)); + new TestCase(getMethod("CharMethod")) + .exec(NamedSet("IntCharSize", Locals::SetLocalVariableInt, Character.MAX_VALUE - 1)); + new TestCase(getMethod("ShortMethod")) + .exec(NamedSet("IntShortSize", Locals::SetLocalVariableInt, Short.MAX_VALUE - 1)); } } - diff --git a/test/1913-get-set-local-objects/expected.txt b/test/1913-get-set-local-objects/expected.txt index 23f49920c9..2338915635 100644 --- a/test/1913-get-set-local-objects/expected.txt +++ b/test/1913-get-set-local-objects/expected.txt @@ -70,3 +70,57 @@ Running public static void art.Test1913.PrimitiveMethod(java.lang.Runnable) with Running public static void art.Test1913.PrimitiveMethod(java.lang.Runnable) with "SetTestClass2impl" on remote thread. "SetTestClass2impl" on public static void art.Test1913.PrimitiveMethod(java.lang.Runnable) failed to set value TestClass2impl("TestClass2("Set TestClass2impl")") due to JVMTI_ERROR_TYPE_MISMATCH Value is '42' (class: class java.lang.Integer) +Running public static void art.Test1913.NullObjectMethod(java.lang.Runnable) with "GetGetObject" on remote thread. +"GetGetObject" on public static void art.Test1913.NullObjectMethod(java.lang.Runnable) got value: null + Value is 'null' (class: NULL) +Running public static void art.Test1913.NullObjectMethod(java.lang.Runnable) with "SetNull" on remote thread. +"SetNull" on public static void art.Test1913.NullObjectMethod(java.lang.Runnable) set value: null + Value is 'null' (class: NULL) +Running public static void art.Test1913.NullObjectMethod(java.lang.Runnable) with "SetTestClass1" on remote thread. +"SetTestClass1" on public static void art.Test1913.NullObjectMethod(java.lang.Runnable) set value: TestClass1("Set TestClass1") + Value is 'TestClass1("Set TestClass1")' (class: class art.Test1913$TestClass1) +Running public static void art.Test1913.NullObjectMethod(java.lang.Runnable) with "SetTestClass1ext" on remote thread. +"SetTestClass1ext" on public static void art.Test1913.NullObjectMethod(java.lang.Runnable) set value: TestClass1ext("TestClass1("Set TestClass1ext")") + Value is 'TestClass1ext("TestClass1("Set TestClass1ext")")' (class: class art.Test1913$TestClass1ext) +Running public static void art.Test1913.NullObjectMethod(java.lang.Runnable) with "SetTestClass2" on remote thread. +"SetTestClass2" on public static void art.Test1913.NullObjectMethod(java.lang.Runnable) set value: TestClass2("Set TestClass2") + Value is 'TestClass2("Set TestClass2")' (class: class art.Test1913$TestClass2) +Running public static void art.Test1913.NullObjectMethod(java.lang.Runnable) with "SetTestClass2impl" on remote thread. +"SetTestClass2impl" on public static void art.Test1913.NullObjectMethod(java.lang.Runnable) set value: TestClass2impl("TestClass2("Set TestClass2impl")") + Value is 'TestClass2impl("TestClass2("Set TestClass2impl")")' (class: class art.Test1913$TestClass2impl) +Running public static void art.Test1913.NullInterfaceMethod(java.lang.Runnable) with "GetGetObject" on remote thread. +"GetGetObject" on public static void art.Test1913.NullInterfaceMethod(java.lang.Runnable) got value: null + Value is 'null' (class: NULL) +Running public static void art.Test1913.NullInterfaceMethod(java.lang.Runnable) with "SetNull" on remote thread. +"SetNull" on public static void art.Test1913.NullInterfaceMethod(java.lang.Runnable) set value: null + Value is 'null' (class: NULL) +Running public static void art.Test1913.NullInterfaceMethod(java.lang.Runnable) with "SetTestClass1" on remote thread. +"SetTestClass1" on public static void art.Test1913.NullInterfaceMethod(java.lang.Runnable) set value: TestClass1("Set TestClass1") + Value is 'TestClass1("Set TestClass1")' (class: class art.Test1913$TestClass1) +Running public static void art.Test1913.NullInterfaceMethod(java.lang.Runnable) with "SetTestClass1ext" on remote thread. +"SetTestClass1ext" on public static void art.Test1913.NullInterfaceMethod(java.lang.Runnable) set value: TestClass1ext("TestClass1("Set TestClass1ext")") + Value is 'TestClass1ext("TestClass1("Set TestClass1ext")")' (class: class art.Test1913$TestClass1ext) +Running public static void art.Test1913.NullInterfaceMethod(java.lang.Runnable) with "SetTestClass2" on remote thread. +"SetTestClass2" on public static void art.Test1913.NullInterfaceMethod(java.lang.Runnable) failed to set value TestClass2("Set TestClass2") due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'null' (class: NULL) +Running public static void art.Test1913.NullInterfaceMethod(java.lang.Runnable) with "SetTestClass2impl" on remote thread. +"SetTestClass2impl" on public static void art.Test1913.NullInterfaceMethod(java.lang.Runnable) set value: TestClass2impl("TestClass2("Set TestClass2impl")") + Value is 'TestClass2impl("TestClass2("Set TestClass2impl")")' (class: class art.Test1913$TestClass2impl) +Running public static void art.Test1913.NullSpecificClassMethod(java.lang.Runnable) with "GetGetObject" on remote thread. +"GetGetObject" on public static void art.Test1913.NullSpecificClassMethod(java.lang.Runnable) got value: null + Value is 'null' (class: NULL) +Running public static void art.Test1913.NullSpecificClassMethod(java.lang.Runnable) with "SetNull" on remote thread. +"SetNull" on public static void art.Test1913.NullSpecificClassMethod(java.lang.Runnable) set value: null + Value is 'null' (class: NULL) +Running public static void art.Test1913.NullSpecificClassMethod(java.lang.Runnable) with "SetTestClass1" on remote thread. +"SetTestClass1" on public static void art.Test1913.NullSpecificClassMethod(java.lang.Runnable) set value: TestClass1("Set TestClass1") + Value is 'TestClass1("Set TestClass1")' (class: class art.Test1913$TestClass1) +Running public static void art.Test1913.NullSpecificClassMethod(java.lang.Runnable) with "SetTestClass1ext" on remote thread. +"SetTestClass1ext" on public static void art.Test1913.NullSpecificClassMethod(java.lang.Runnable) set value: TestClass1ext("TestClass1("Set TestClass1ext")") + Value is 'TestClass1ext("TestClass1("Set TestClass1ext")")' (class: class art.Test1913$TestClass1ext) +Running public static void art.Test1913.NullSpecificClassMethod(java.lang.Runnable) with "SetTestClass2" on remote thread. +"SetTestClass2" on public static void art.Test1913.NullSpecificClassMethod(java.lang.Runnable) failed to set value TestClass2("Set TestClass2") due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'null' (class: NULL) +Running public static void art.Test1913.NullSpecificClassMethod(java.lang.Runnable) with "SetTestClass2impl" on remote thread. +"SetTestClass2impl" on public static void art.Test1913.NullSpecificClassMethod(java.lang.Runnable) failed to set value TestClass2impl("TestClass2("Set TestClass2impl")") due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'null' (class: NULL) diff --git a/test/1913-get-set-local-objects/src/art/Test1913.java b/test/1913-get-set-local-objects/src/art/Test1913.java index 417138a194..df864934f4 100644 --- a/test/1913-get-set-local-objects/src/art/Test1913.java +++ b/test/1913-get-set-local-objects/src/art/Test1913.java @@ -20,15 +20,15 @@ import java.lang.reflect.Constructor; import java.lang.reflect.Executable; import java.lang.reflect.Method; import java.nio.ByteBuffer; -import java.util.concurrent.Semaphore; import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.Set; +import java.util.concurrent.Semaphore; +import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Predicate; import java.util.function.Supplier; -import java.util.function.Consumer; public class Test1913 { public static final String TARGET_VAR = "TARGET"; @@ -38,27 +38,43 @@ public class Test1913 { } public static class TestClass1 implements TestInterface { public String id; - public TestClass1(String id) { this.id = id; } - public String toString() { return String.format("TestClass1(\"%s\")", id); } + public TestClass1(String id) { + this.id = id; + } + public String toString() { + return String.format("TestClass1(\"%s\")", id); + } } public static class TestClass1ext extends TestClass1 { - public TestClass1ext(String id) { super(id); } - public String toString() { return String.format("TestClass1ext(\"%s\")", super.toString()); } + public TestClass1ext(String id) { + super(id); + } + public String toString() { + return String.format("TestClass1ext(\"%s\")", super.toString()); + } } public static class TestClass2 { public String id; - public TestClass2(String id) { this.id = id; } - public String toString() { return String.format("TestClass2(\"%s\")", id); } + public TestClass2(String id) { + this.id = id; + } + public String toString() { + return String.format("TestClass2(\"%s\")", id); + } } public static class TestClass2impl extends TestClass2 implements TestInterface { - public TestClass2impl(String id) { super(id); } - public String toString() { return String.format("TestClass2impl(\"%s\")", super.toString()); } + public TestClass2impl(String id) { + super(id); + } + public String toString() { + return String.format("TestClass2impl(\"%s\")", super.toString()); + } } public static void reportValue(Object val) { - System.out.println("\tValue is '" + val + "' (class: " - + (val != null ? val.getClass() : "NULL") + ")"); + System.out.println("\tValue is '" + val + + "' (class: " + (val != null ? val.getClass() : "NULL") + ")"); } public static void PrimitiveMethod(Runnable safepoint) { @@ -68,7 +84,28 @@ public class Test1913 { } // b/64115302: Needed to make sure that DX doesn't change the type of TARGET to TestClass1. - private static Object AsObject(Object o) { return o; } + private static Object AsObject(Object o) { + return o; + } + + public static void NullObjectMethod(Runnable safepoint) { + Object TARGET = null; + safepoint.run(); + reportValue(TARGET); + } + + public static void NullInterfaceMethod(Runnable safepoint) { + TestInterface TARGET = null; + safepoint.run(); + reportValue(TARGET); + } + + public static void NullSpecificClassMethod(Runnable safepoint) { + TestClass1 TARGET = null; + safepoint.run(); + reportValue(TARGET); + } + public static void ObjectMethod(Runnable safepoint) { Object TARGET = AsObject(new TestClass1("ObjectMethod")); safepoint.run(); @@ -88,31 +125,27 @@ public class Test1913 { } public static interface SafepointFunction { - public void invoke( - Thread thread, - Method target, - Locals.VariableDescription TARGET_desc, - int depth) throws Exception; + public void + invoke(Thread thread, Method target, Locals.VariableDescription TARGET_desc, int depth) + throws Exception; } public static interface SetterFunction { public void SetVar(Thread t, int depth, int slot, Object v); } - public static interface GetterFunction { - public Object GetVar(Thread t, int depth, int slot); - } + public static interface GetterFunction { public Object GetVar(Thread t, int depth, int slot); } - public static SafepointFunction NamedSet( - final String type, final SetterFunction get, final Object v) { + public static SafepointFunction + NamedSet(final String type, final SetterFunction get, final Object v) { return new SafepointFunction() { public void invoke(Thread t, Method method, Locals.VariableDescription desc, int depth) { try { get.SetVar(t, depth, desc.slot, v); System.out.println(this + " on " + method + " set value: " + v); } catch (Exception e) { - System.out.println( - this + " on " + method + " failed to set value " + v + " due to " + e.getMessage()); + System.out.println(this + " on " + method + " failed to set value " + v + " due to " + + e.getMessage()); } } public String toString() { @@ -174,15 +207,13 @@ public class Test1913 { public void exec(final SafepointFunction safepoint) throws Exception { System.out.println("Running " + target + " with " + safepoint + " on remote thread."); final ThreadPauser pause = new ThreadPauser(); - Thread remote = new Thread( - () -> { - try { - target.invoke(null, pause); - } catch (Exception e) { - throw new Error("Error invoking remote thread " + Thread.currentThread(), e); - } - }, - "remote thread for " + target + " with " + safepoint); + Thread remote = new Thread(() -> { + try { + target.invoke(null, pause); + } catch (Exception e) { + throw new Error("Error invoking remote thread " + Thread.currentThread(), e); + } + }, "remote thread for " + target + " with " + safepoint); remote.start(); pause.waitForOtherThreadToPause(); try { @@ -199,14 +230,12 @@ public class Test1913 { private Locals.VariableDescription findTargetVar(long loc) { for (Locals.VariableDescription var : Locals.GetLocalVariableTable(target)) { - if (var.start_location <= loc && - var.length + var.start_location > loc && + if (var.start_location <= loc && var.length + var.start_location > loc && var.name.equals(TARGET_VAR)) { return var; } } - throw new Error( - "Unable to find variable " + TARGET_VAR + " in " + target + " at loc " + loc); + throw new Error("Unable to find variable " + TARGET_VAR + " in " + target + " at loc " + loc); } private StackTrace.StackFrameData findStackFrame(Thread thr) { @@ -225,27 +254,27 @@ public class Test1913 { public static void run() throws Exception { Locals.EnableLocalVariableAccess(); final TestCase[] MAIN_TEST_CASES = new TestCase[] { - new TestCase(getMethod("ObjectMethod")), - new TestCase(getMethod("InterfaceMethod")), - new TestCase(getMethod("SpecificClassMethod")), - new TestCase(getMethod("PrimitiveMethod")), + new TestCase(getMethod("ObjectMethod")), new TestCase(getMethod("InterfaceMethod")), + new TestCase(getMethod("SpecificClassMethod")), new TestCase(getMethod("PrimitiveMethod")), + new TestCase(getMethod("NullObjectMethod")), + new TestCase(getMethod("NullInterfaceMethod")), + new TestCase(getMethod("NullSpecificClassMethod")), }; final SetterFunction set_obj = Locals::SetLocalVariableObject; final SafepointFunction[] SAFEPOINTS = new SafepointFunction[] { - NamedGet("GetObject", Locals::GetLocalVariableObject), - NamedSet("Null", set_obj, null), - NamedSet("TestClass1", set_obj, new TestClass1("Set TestClass1")), - NamedSet("TestClass1ext", set_obj, new TestClass1ext("Set TestClass1ext")), - NamedSet("TestClass2", set_obj, new TestClass2("Set TestClass2")), + NamedGet("GetObject", Locals::GetLocalVariableObject), + NamedSet("Null", set_obj, null), + NamedSet("TestClass1", set_obj, new TestClass1("Set TestClass1")), + NamedSet("TestClass1ext", set_obj, new TestClass1ext("Set TestClass1ext")), + NamedSet("TestClass2", set_obj, new TestClass2("Set TestClass2")), NamedSet("TestClass2impl", set_obj, new TestClass2impl("Set TestClass2impl")), }; - for (TestCase t: MAIN_TEST_CASES) { + for (TestCase t : MAIN_TEST_CASES) { for (SafepointFunction s : SAFEPOINTS) { t.exec(s); } } } } - diff --git a/test/1965-get-set-local-primitive-no-tables/build b/test/1965-get-set-local-primitive-no-tables/build new file mode 100644 index 0000000000..6631df91b7 --- /dev/null +++ b/test/1965-get-set-local-primitive-no-tables/build @@ -0,0 +1,25 @@ +#!/bin/bash +# +# Copyright 2019 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# make us exit on a failure +set -e + +if [[ $@ != *"--jvm"* ]]; then + mv jasmin jasmin-unused +else + mv smali smali-unused +fi +./default-build "$@" diff --git a/test/1965-get-set-local-primitive-no-tables/expected.txt b/test/1965-get-set-local-primitive-no-tables/expected.txt new file mode 100644 index 0000000000..97f8ab0594 --- /dev/null +++ b/test/1965-get-set-local-primitive-no-tables/expected.txt @@ -0,0 +1,210 @@ +Running public static void art_test.TestCases1965.IntMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetInt" on remote thread. +"GetInt" on public static void art_test.TestCases1965.IntMethod(java.util.function.IntConsumer,java.util.function.Consumer) got value: 42 + Value is '42' (class: class java.lang.Integer) +Running public static void art_test.TestCases1965.IntMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetLong" on remote thread. +"GetLong" on public static void art_test.TestCases1965.IntMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is '42' (class: class java.lang.Integer) +Running public static void art_test.TestCases1965.IntMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetFloat" on remote thread. +"GetFloat" on public static void art_test.TestCases1965.IntMethod(java.util.function.IntConsumer,java.util.function.Consumer) got value: 5.9E-44 + Value is '42' (class: class java.lang.Integer) +Running public static void art_test.TestCases1965.IntMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetDouble" on remote thread. +"GetDouble" on public static void art_test.TestCases1965.IntMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is '42' (class: class java.lang.Integer) +Running public static void art_test.TestCases1965.IntMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetObject" on remote thread. +"GetObject" on public static void art_test.TestCases1965.IntMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is '42' (class: class java.lang.Integer) +Running public static void art_test.TestCases1965.IntMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetInt" on remote thread. +"SetInt" on public static void art_test.TestCases1965.IntMethod(java.util.function.IntConsumer,java.util.function.Consumer) set value: 2147483647 + Value is '2147483647' (class: class java.lang.Integer) +Running public static void art_test.TestCases1965.IntMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetLong" on remote thread. +"SetLong" on public static void art_test.TestCases1965.IntMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed to set value 9223372036854775807 due to JVMTI_ERROR_TYPE_MISMATCH + Value is '42' (class: class java.lang.Integer) +Running public static void art_test.TestCases1965.IntMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetFloat" on remote thread. +"SetFloat" on public static void art_test.TestCases1965.IntMethod(java.util.function.IntConsumer,java.util.function.Consumer) set value: 9.2 + Value is '1091777331' (class: class java.lang.Integer) +Running public static void art_test.TestCases1965.IntMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetDouble" on remote thread. +"SetDouble" on public static void art_test.TestCases1965.IntMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed to set value 12.4 due to JVMTI_ERROR_TYPE_MISMATCH + Value is '42' (class: class java.lang.Integer) +Running public static void art_test.TestCases1965.IntMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetObject" on remote thread. +"SetObject" on public static void art_test.TestCases1965.IntMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed to set value NEW_VALUE_FOR_SET due to JVMTI_ERROR_TYPE_MISMATCH + Value is '42' (class: class java.lang.Integer) +Running public static void art_test.TestCases1965.IntMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetNullObject" on remote thread. +"SetNullObject" on public static void art_test.TestCases1965.IntMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed to set value null due to JVMTI_ERROR_TYPE_MISMATCH + Value is '42' (class: class java.lang.Integer) +Running public static void art_test.TestCases1965.LongMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetInt" on remote thread. +"GetInt" on public static void art_test.TestCases1965.LongMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is '9001' (class: class java.lang.Long) +Running public static void art_test.TestCases1965.LongMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetLong" on remote thread. +"GetLong" on public static void art_test.TestCases1965.LongMethod(java.util.function.IntConsumer,java.util.function.Consumer) got value: 9001 + Value is '9001' (class: class java.lang.Long) +Running public static void art_test.TestCases1965.LongMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetFloat" on remote thread. +"GetFloat" on public static void art_test.TestCases1965.LongMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is '9001' (class: class java.lang.Long) +Running public static void art_test.TestCases1965.LongMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetDouble" on remote thread. +"GetDouble" on public static void art_test.TestCases1965.LongMethod(java.util.function.IntConsumer,java.util.function.Consumer) got value: 4.447E-320 + Value is '9001' (class: class java.lang.Long) +Running public static void art_test.TestCases1965.LongMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetObject" on remote thread. +"GetObject" on public static void art_test.TestCases1965.LongMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is '9001' (class: class java.lang.Long) +Running public static void art_test.TestCases1965.LongMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetInt" on remote thread. +"SetInt" on public static void art_test.TestCases1965.LongMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed to set value 2147483647 due to JVMTI_ERROR_TYPE_MISMATCH + Value is '9001' (class: class java.lang.Long) +Running public static void art_test.TestCases1965.LongMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetLong" on remote thread. +"SetLong" on public static void art_test.TestCases1965.LongMethod(java.util.function.IntConsumer,java.util.function.Consumer) set value: 9223372036854775807 + Value is '9223372036854775807' (class: class java.lang.Long) +Running public static void art_test.TestCases1965.LongMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetFloat" on remote thread. +"SetFloat" on public static void art_test.TestCases1965.LongMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed to set value 9.2 due to JVMTI_ERROR_TYPE_MISMATCH + Value is '9001' (class: class java.lang.Long) +Running public static void art_test.TestCases1965.LongMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetDouble" on remote thread. +"SetDouble" on public static void art_test.TestCases1965.LongMethod(java.util.function.IntConsumer,java.util.function.Consumer) set value: 12.4 + Value is '4623170197477182669' (class: class java.lang.Long) +Running public static void art_test.TestCases1965.LongMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetObject" on remote thread. +"SetObject" on public static void art_test.TestCases1965.LongMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed to set value NEW_VALUE_FOR_SET due to JVMTI_ERROR_TYPE_MISMATCH + Value is '9001' (class: class java.lang.Long) +Running public static void art_test.TestCases1965.LongMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetNullObject" on remote thread. +"SetNullObject" on public static void art_test.TestCases1965.LongMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed to set value null due to JVMTI_ERROR_TYPE_MISMATCH + Value is '9001' (class: class java.lang.Long) +Running public static void art_test.TestCases1965.FloatMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetInt" on remote thread. +"GetInt" on public static void art_test.TestCases1965.FloatMethod(java.util.function.IntConsumer,java.util.function.Consumer) got value: 1070537376 + Value is '1.618' (class: class java.lang.Float) +Running public static void art_test.TestCases1965.FloatMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetLong" on remote thread. +"GetLong" on public static void art_test.TestCases1965.FloatMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is '1.618' (class: class java.lang.Float) +Running public static void art_test.TestCases1965.FloatMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetFloat" on remote thread. +"GetFloat" on public static void art_test.TestCases1965.FloatMethod(java.util.function.IntConsumer,java.util.function.Consumer) got value: 1.618 + Value is '1.618' (class: class java.lang.Float) +Running public static void art_test.TestCases1965.FloatMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetDouble" on remote thread. +"GetDouble" on public static void art_test.TestCases1965.FloatMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is '1.618' (class: class java.lang.Float) +Running public static void art_test.TestCases1965.FloatMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetObject" on remote thread. +"GetObject" on public static void art_test.TestCases1965.FloatMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is '1.618' (class: class java.lang.Float) +Running public static void art_test.TestCases1965.FloatMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetInt" on remote thread. +"SetInt" on public static void art_test.TestCases1965.FloatMethod(java.util.function.IntConsumer,java.util.function.Consumer) set value: 2147483647 + Value is 'NaN' (class: class java.lang.Float) +Running public static void art_test.TestCases1965.FloatMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetLong" on remote thread. +"SetLong" on public static void art_test.TestCases1965.FloatMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed to set value 9223372036854775807 due to JVMTI_ERROR_TYPE_MISMATCH + Value is '1.618' (class: class java.lang.Float) +Running public static void art_test.TestCases1965.FloatMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetFloat" on remote thread. +"SetFloat" on public static void art_test.TestCases1965.FloatMethod(java.util.function.IntConsumer,java.util.function.Consumer) set value: 9.2 + Value is '9.2' (class: class java.lang.Float) +Running public static void art_test.TestCases1965.FloatMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetDouble" on remote thread. +"SetDouble" on public static void art_test.TestCases1965.FloatMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed to set value 12.4 due to JVMTI_ERROR_TYPE_MISMATCH + Value is '1.618' (class: class java.lang.Float) +Running public static void art_test.TestCases1965.FloatMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetObject" on remote thread. +"SetObject" on public static void art_test.TestCases1965.FloatMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed to set value NEW_VALUE_FOR_SET due to JVMTI_ERROR_TYPE_MISMATCH + Value is '1.618' (class: class java.lang.Float) +Running public static void art_test.TestCases1965.FloatMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetNullObject" on remote thread. +"SetNullObject" on public static void art_test.TestCases1965.FloatMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed to set value null due to JVMTI_ERROR_TYPE_MISMATCH + Value is '1.618' (class: class java.lang.Float) +Running public static void art_test.TestCases1965.DoubleMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetInt" on remote thread. +"GetInt" on public static void art_test.TestCases1965.DoubleMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is '3.1415' (class: class java.lang.Double) +Running public static void art_test.TestCases1965.DoubleMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetLong" on remote thread. +"GetLong" on public static void art_test.TestCases1965.DoubleMethod(java.util.function.IntConsumer,java.util.function.Consumer) got value: 4614256447914709615 + Value is '3.1415' (class: class java.lang.Double) +Running public static void art_test.TestCases1965.DoubleMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetFloat" on remote thread. +"GetFloat" on public static void art_test.TestCases1965.DoubleMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is '3.1415' (class: class java.lang.Double) +Running public static void art_test.TestCases1965.DoubleMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetDouble" on remote thread. +"GetDouble" on public static void art_test.TestCases1965.DoubleMethod(java.util.function.IntConsumer,java.util.function.Consumer) got value: 3.1415 + Value is '3.1415' (class: class java.lang.Double) +Running public static void art_test.TestCases1965.DoubleMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetObject" on remote thread. +"GetObject" on public static void art_test.TestCases1965.DoubleMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is '3.1415' (class: class java.lang.Double) +Running public static void art_test.TestCases1965.DoubleMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetInt" on remote thread. +"SetInt" on public static void art_test.TestCases1965.DoubleMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed to set value 2147483647 due to JVMTI_ERROR_TYPE_MISMATCH + Value is '3.1415' (class: class java.lang.Double) +Running public static void art_test.TestCases1965.DoubleMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetLong" on remote thread. +"SetLong" on public static void art_test.TestCases1965.DoubleMethod(java.util.function.IntConsumer,java.util.function.Consumer) set value: 9223372036854775807 + Value is 'NaN' (class: class java.lang.Double) +Running public static void art_test.TestCases1965.DoubleMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetFloat" on remote thread. +"SetFloat" on public static void art_test.TestCases1965.DoubleMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed to set value 9.2 due to JVMTI_ERROR_TYPE_MISMATCH + Value is '3.1415' (class: class java.lang.Double) +Running public static void art_test.TestCases1965.DoubleMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetDouble" on remote thread. +"SetDouble" on public static void art_test.TestCases1965.DoubleMethod(java.util.function.IntConsumer,java.util.function.Consumer) set value: 12.4 + Value is '12.4' (class: class java.lang.Double) +Running public static void art_test.TestCases1965.DoubleMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetObject" on remote thread. +"SetObject" on public static void art_test.TestCases1965.DoubleMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed to set value NEW_VALUE_FOR_SET due to JVMTI_ERROR_TYPE_MISMATCH + Value is '3.1415' (class: class java.lang.Double) +Running public static void art_test.TestCases1965.DoubleMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetNullObject" on remote thread. +"SetNullObject" on public static void art_test.TestCases1965.DoubleMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed to set value null due to JVMTI_ERROR_TYPE_MISMATCH + Value is '3.1415' (class: class java.lang.Double) +Running public static void art_test.TestCases1965.ObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetInt" on remote thread. +"GetInt" on public static void art_test.TestCases1965.ObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'TARGET_VALUE' (class: class java.lang.String) +Running public static void art_test.TestCases1965.ObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetLong" on remote thread. +"GetLong" on public static void art_test.TestCases1965.ObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'TARGET_VALUE' (class: class java.lang.String) +Running public static void art_test.TestCases1965.ObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetFloat" on remote thread. +"GetFloat" on public static void art_test.TestCases1965.ObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'TARGET_VALUE' (class: class java.lang.String) +Running public static void art_test.TestCases1965.ObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetDouble" on remote thread. +"GetDouble" on public static void art_test.TestCases1965.ObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'TARGET_VALUE' (class: class java.lang.String) +Running public static void art_test.TestCases1965.ObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetObject" on remote thread. +"GetObject" on public static void art_test.TestCases1965.ObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) got value: TARGET_VALUE + Value is 'TARGET_VALUE' (class: class java.lang.String) +Running public static void art_test.TestCases1965.ObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetInt" on remote thread. +"SetInt" on public static void art_test.TestCases1965.ObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed to set value 2147483647 due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'TARGET_VALUE' (class: class java.lang.String) +Running public static void art_test.TestCases1965.ObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetLong" on remote thread. +"SetLong" on public static void art_test.TestCases1965.ObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed to set value 9223372036854775807 due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'TARGET_VALUE' (class: class java.lang.String) +Running public static void art_test.TestCases1965.ObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetFloat" on remote thread. +"SetFloat" on public static void art_test.TestCases1965.ObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed to set value 9.2 due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'TARGET_VALUE' (class: class java.lang.String) +Running public static void art_test.TestCases1965.ObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetDouble" on remote thread. +"SetDouble" on public static void art_test.TestCases1965.ObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed to set value 12.4 due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'TARGET_VALUE' (class: class java.lang.String) +Running public static void art_test.TestCases1965.ObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetObject" on remote thread. +"SetObject" on public static void art_test.TestCases1965.ObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) set value: NEW_VALUE_FOR_SET + Value is 'NEW_VALUE_FOR_SET' (class: class java.lang.String) +Running public static void art_test.TestCases1965.ObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetNullObject" on remote thread. +"SetNullObject" on public static void art_test.TestCases1965.ObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) set value: null + Value is 'null' (class: null) +Running public static void art_test.TestCases1965.NullObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetInt" on remote thread. +"GetInt" on public static void art_test.TestCases1965.NullObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) got value: 0 + Value is 'null' (class: null) +Running public static void art_test.TestCases1965.NullObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetLong" on remote thread. +"GetLong" on public static void art_test.TestCases1965.NullObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'null' (class: null) +Running public static void art_test.TestCases1965.NullObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetFloat" on remote thread. +"GetFloat" on public static void art_test.TestCases1965.NullObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) got value: 0.0 + Value is 'null' (class: null) +Running public static void art_test.TestCases1965.NullObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetDouble" on remote thread. +"GetDouble" on public static void art_test.TestCases1965.NullObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'null' (class: null) +Running public static void art_test.TestCases1965.NullObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "GetObject" on remote thread. +"GetObject" on public static void art_test.TestCases1965.NullObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) got value: null + Value is 'null' (class: null) +Running public static void art_test.TestCases1965.NullObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetInt" on remote thread. +"SetInt" on public static void art_test.TestCases1965.NullObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed to set value 2147483647 due to JVMTI_ERROR_INTERNAL + Value is 'null' (class: null) +Running public static void art_test.TestCases1965.NullObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetLong" on remote thread. +"SetLong" on public static void art_test.TestCases1965.NullObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed to set value 9223372036854775807 due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'null' (class: null) +Running public static void art_test.TestCases1965.NullObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetFloat" on remote thread. +"SetFloat" on public static void art_test.TestCases1965.NullObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed to set value 9.2 due to JVMTI_ERROR_INTERNAL + Value is 'null' (class: null) +Running public static void art_test.TestCases1965.NullObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetDouble" on remote thread. +"SetDouble" on public static void art_test.TestCases1965.NullObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed to set value 12.4 due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'null' (class: null) +Running public static void art_test.TestCases1965.NullObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetObject" on remote thread. +"SetObject" on public static void art_test.TestCases1965.NullObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed to set value NEW_VALUE_FOR_SET due to JVMTI_ERROR_INTERNAL + Value is 'null' (class: null) +Running public static void art_test.TestCases1965.NullObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetNullObject" on remote thread. +"SetNullObject" on public static void art_test.TestCases1965.NullObjectMethod(java.util.function.IntConsumer,java.util.function.Consumer) set value: null + Value is 'null' (class: null) +Running public static void art_test.TestCases1965.BooleanMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetIntBoolSize" on remote thread. +"SetIntBoolSize" on public static void art_test.TestCases1965.BooleanMethod(java.util.function.IntConsumer,java.util.function.Consumer) failed to set value 1 due to JVMTI_ERROR_INTERNAL + Value is 'false' (class: class java.lang.Boolean) +Running public static void art_test.TestCases1965.ByteMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetIntByteSize" on remote thread. +"SetIntByteSize" on public static void art_test.TestCases1965.ByteMethod(java.util.function.IntConsumer,java.util.function.Consumer) set value: 126 + Value is '126' (class: class java.lang.Byte) +Running public static void art_test.TestCases1965.CharMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetIntCharSize" on remote thread. +"SetIntCharSize" on public static void art_test.TestCases1965.CharMethod(java.util.function.IntConsumer,java.util.function.Consumer) set value: 65534 + Value is '<Char: -1>' (class: class java.lang.String) +Running public static void art_test.TestCases1965.ShortMethod(java.util.function.IntConsumer,java.util.function.Consumer) with "SetIntShortSize" on remote thread. +"SetIntShortSize" on public static void art_test.TestCases1965.ShortMethod(java.util.function.IntConsumer,java.util.function.Consumer) set value: 32766 + Value is '32766' (class: class java.lang.Short) diff --git a/test/1965-get-set-local-primitive-no-tables/info.txt b/test/1965-get-set-local-primitive-no-tables/info.txt new file mode 100644 index 0000000000..87a7b35333 --- /dev/null +++ b/test/1965-get-set-local-primitive-no-tables/info.txt @@ -0,0 +1,2 @@ +Tests for jvmti get/set Local variable primitives. + diff --git a/test/1965-get-set-local-primitive-no-tables/jasmin/TestCases1965.j b/test/1965-get-set-local-primitive-no-tables/jasmin/TestCases1965.j new file mode 100644 index 0000000000..63742621f9 --- /dev/null +++ b/test/1965-get-set-local-primitive-no-tables/jasmin/TestCases1965.j @@ -0,0 +1,173 @@ +; Copyright (C) 2019 The Android Open Source Project +; +; Licensed under the Apache License, Version 2.0 (the "License"); +; you may not use this file except in compliance with the License. +; You may obtain a copy of the License at +; +; http://www.apache.org/licenses/LICENSE-2.0 +; +; Unless required by applicable law or agreed to in writing, software +; distributed under the License is distributed on an "AS IS" BASIS, +; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +; See the License for the specific language governing permissions and +; limitations under the License. + +.class public final art_test/TestCases1965 +.super java/lang/Object + +.method public <init>()V + .limit stack 1 + .limit locals 1 + 0: aload_0 + 1: invokespecial java/lang/Object/<init>()V + 4: return +.end method + +; NB We limit locals 4 so that every method has space to fit a long/double in it. +.method public static NullObjectMethod(Ljava/util/function/IntConsumer;Ljava/util/function/Consumer;)V + .limit stack 2 + .limit locals 4 + 0: aconst_null + 1: astore_2 + 2: aload_0 + 3: sipush 2 + 6: invokeinterface java/util/function/IntConsumer/accept(I)V 2 + 11: aload_1 + 12: aload_2 + 13: invokeinterface java/util/function/Consumer/accept(Ljava/lang/Object;)V 2 + 18: return +.end method + +.method public static ObjectMethod(Ljava/util/function/IntConsumer;Ljava/util/function/Consumer;)V + .limit stack 2 + .limit locals 4 + 0: ldc "TARGET_VALUE" + 2: astore_2 + 3: aload_0 + 4: sipush 2 + 7: invokeinterface java/util/function/IntConsumer/accept(I)V 2 + 12: aload_1 + 13: aload_2 + 14: invokeinterface java/util/function/Consumer/accept(Ljava/lang/Object;)V 2 + 19: return +.end method + +.method public static BooleanMethod(Ljava/util/function/IntConsumer;Ljava/util/function/Consumer;)V + .limit stack 2 + .limit locals 4 + 0: iconst_0 + 1: istore_2 + 2: aload_0 + 3: sipush 2 + 6: invokeinterface java/util/function/IntConsumer/accept(I)V 2 + 11: aload_1 + 12: iload_2 + 13: invokestatic java/lang/Boolean/valueOf(Z)Ljava/lang/Boolean; + 16: invokeinterface java/util/function/Consumer/accept(Ljava/lang/Object;)V 2 + 21: return +.end method + +.method public static ByteMethod(Ljava/util/function/IntConsumer;Ljava/util/function/Consumer;)V + .limit stack 2 + .limit locals 4 + 0: bipush 8 + 2: istore_2 + 3: aload_0 + 4: sipush 2 + 7: invokeinterface java/util/function/IntConsumer/accept(I)V 2 + 12: aload_1 + 13: iload_2 + 14: invokestatic java/lang/Byte/valueOf(B)Ljava/lang/Byte; + 17: invokeinterface java/util/function/Consumer/accept(Ljava/lang/Object;)V 2 + 22: return +.end method + +.method public static CharMethod(Ljava/util/function/IntConsumer;Ljava/util/function/Consumer;)V + .limit stack 2 + .limit locals 4 + 0: bipush 113 + 2: istore_2 + 3: aload_0 + 4: sipush 2 + 7: invokeinterface java/util/function/IntConsumer/accept(I)V 2 + 12: aload_1 + 13: iload_2 + 14: invokestatic java/lang/Character/valueOf(C)Ljava/lang/Character; + 17: invokeinterface java/util/function/Consumer/accept(Ljava/lang/Object;)V 2 + 22: return +.end method + +.method public static ShortMethod(Ljava/util/function/IntConsumer;Ljava/util/function/Consumer;)V + .limit stack 2 + .limit locals 4 + 0: sipush 321 + 3: istore_2 + 4: aload_0 + 5: sipush 2 + 8: invokeinterface java/util/function/IntConsumer/accept(I)V 2 + 13: aload_1 + 14: iload_2 + 15: invokestatic java/lang/Short/valueOf(S)Ljava/lang/Short; + 18: invokeinterface java/util/function/Consumer/accept(Ljava/lang/Object;)V 2 + 23: return +.end method + +.method public static IntMethod(Ljava/util/function/IntConsumer;Ljava/util/function/Consumer;)V + .limit stack 2 + .limit locals 4 + 0: bipush 42 + 2: istore_2 + 3: aload_0 + 4: sipush 2 + 7: invokeinterface java/util/function/IntConsumer/accept(I)V 2 + 12: aload_1 + 13: iload_2 + 14: invokestatic java/lang/Integer/valueOf(I)Ljava/lang/Integer; + 17: invokeinterface java/util/function/Consumer/accept(Ljava/lang/Object;)V 2 + 22: return +.end method + +.method public static LongMethod(Ljava/util/function/IntConsumer;Ljava/util/function/Consumer;)V + .limit stack 3 + .limit locals 4 + 0: ldc2_w 9001 + 3: lstore_2 + 4: aload_0 + 5: sipush 2 + 8: invokeinterface java/util/function/IntConsumer/accept(I)V 2 + 13: aload_1 + 14: lload_2 + 15: invokestatic java/lang/Long/valueOf(J)Ljava/lang/Long; + 18: invokeinterface java/util/function/Consumer/accept(Ljava/lang/Object;)V 2 + 23: return +.end method + +.method public static FloatMethod(Ljava/util/function/IntConsumer;Ljava/util/function/Consumer;)V + .limit stack 2 + .limit locals 4 + 0: ldc 1.618 + 2: fstore_2 + 3: aload_0 + 4: sipush 2 + 7: invokeinterface java/util/function/IntConsumer/accept(I)V 2 + 12: aload_1 + 13: fload_2 + 14: invokestatic java/lang/Float/valueOf(F)Ljava/lang/Float; + 17: invokeinterface java/util/function/Consumer/accept(Ljava/lang/Object;)V 2 + 22: return +.end method + +.method public static DoubleMethod(Ljava/util/function/IntConsumer;Ljava/util/function/Consumer;)V + .limit stack 3 + .limit locals 4 + 0: ldc2_w 3.1415 + 3: dstore_2 + 4: aload_0 + 5: sipush 2 + 8: invokeinterface java/util/function/IntConsumer/accept(I)V 2 + 13: aload_1 + 14: dload_2 + 15: invokestatic java/lang/Double/valueOf(D)Ljava/lang/Double; + 18: invokeinterface java/util/function/Consumer/accept(Ljava/lang/Object;)V 2 + 23: return +.end method diff --git a/test/1965-get-set-local-primitive-no-tables/run b/test/1965-get-set-local-primitive-no-tables/run new file mode 100755 index 0000000000..9b741ee47f --- /dev/null +++ b/test/1965-get-set-local-primitive-no-tables/run @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Copyright 2019 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# If we compile the .oat files non-debuggable we could end up with dex2dex running over the files +# which will cause some instructions to be removed from smali/TestCases1966.smali. This test relies +# on the instructions being exactly as written so pass --debuggable to 'dex2oat' only to prevent +# this from happening. +./default-run "$@" --jvmti --compiler-only-option --debuggable diff --git a/test/1965-get-set-local-primitive-no-tables/smali/TestCases1965.smali b/test/1965-get-set-local-primitive-no-tables/smali/TestCases1965.smali new file mode 100644 index 0000000000..29aa08cb2e --- /dev/null +++ b/test/1965-get-set-local-primitive-no-tables/smali/TestCases1965.smali @@ -0,0 +1,140 @@ +# Copyright (C) 2019 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +.class public final Lart_test/TestCases1965; +.super Ljava/lang/Object; + + +# direct methods +.method public constructor <init>()V + .registers 1 + invoke-direct {p0}, Ljava/lang/Object;-><init>()V + return-void +.end method + +.method public static BooleanMethod(Ljava/util/function/IntConsumer;Ljava/util/function/Consumer;)V + .registers 4 + const/4 v0, 0x0 + # Slot for value. + const/16 v1, 0x0 + invoke-interface {p0, v1}, Ljava/util/function/IntConsumer;->accept(I)V + invoke-static {v0}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean; + move-result-object v1 + invoke-interface {p1, v1}, Ljava/util/function/Consumer;->accept(Ljava/lang/Object;)V + return-void +.end method + +.method public static ByteMethod(Ljava/util/function/IntConsumer;Ljava/util/function/Consumer;)V + .registers 4 + const/16 v0, 0x8 + # Slot for value. + const/16 v1, 0x0 + invoke-interface {p0, v1}, Ljava/util/function/IntConsumer;->accept(I)V + invoke-static {v0}, Ljava/lang/Byte;->valueOf(B)Ljava/lang/Byte; + move-result-object v1 + invoke-interface {p1, v1}, Ljava/util/function/Consumer;->accept(Ljava/lang/Object;)V + return-void +.end method + +.method public static CharMethod(Ljava/util/function/IntConsumer;Ljava/util/function/Consumer;)V + .registers 4 + const/16 v0, 0x71 + # Slot for value + const/16 v1, 0x0 + invoke-interface {p0, v1}, Ljava/util/function/IntConsumer;->accept(I)V + invoke-static {v0}, Ljava/lang/Character;->valueOf(C)Ljava/lang/Character; + move-result-object v1 + invoke-interface {p1, v1}, Ljava/util/function/Consumer;->accept(Ljava/lang/Object;)V + return-void +.end method + +.method public static DoubleMethod(Ljava/util/function/IntConsumer;Ljava/util/function/Consumer;)V + .registers 5 + const-wide v0, 0x400921cac083126fL # 3.1415 + # Slot for value + const/16 v2, 0x0 + invoke-interface {p0, v2}, Ljava/util/function/IntConsumer;->accept(I)V + invoke-static {v0, v1}, Ljava/lang/Double;->valueOf(D)Ljava/lang/Double; + move-result-object v2 + invoke-interface {p1, v2}, Ljava/util/function/Consumer;->accept(Ljava/lang/Object;)V + return-void +.end method + +.method public static FloatMethod(Ljava/util/function/IntConsumer;Ljava/util/function/Consumer;)V + .registers 4 + const v0, 0x3fcf1aa0 # 1.618f + # Slot for value + const/16 v1, 0x0 + invoke-interface {p0, v1}, Ljava/util/function/IntConsumer;->accept(I)V + invoke-static {v0}, Ljava/lang/Float;->valueOf(F)Ljava/lang/Float; + move-result-object v1 + invoke-interface {p1, v1}, Ljava/util/function/Consumer;->accept(Ljava/lang/Object;)V + return-void +.end method + +.method public static IntMethod(Ljava/util/function/IntConsumer;Ljava/util/function/Consumer;)V + .registers 4 + const/16 v0, 0x2a + # Slot for value + const/16 v1, 0x0 + invoke-interface {p0, v1}, Ljava/util/function/IntConsumer;->accept(I)V + invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer; + move-result-object v1 + invoke-interface {p1, v1}, Ljava/util/function/Consumer;->accept(Ljava/lang/Object;)V + return-void +.end method + +.method public static LongMethod(Ljava/util/function/IntConsumer;Ljava/util/function/Consumer;)V + .registers 5 + const-wide/16 v0, 0x2329 + # Slot for value + const/16 v2, 0x0 + invoke-interface {p0, v2}, Ljava/util/function/IntConsumer;->accept(I)V + invoke-static {v0, v1}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long; + move-result-object v2 + invoke-interface {p1, v2}, Ljava/util/function/Consumer;->accept(Ljava/lang/Object;)V + return-void +.end method + +.method public static NullObjectMethod(Ljava/util/function/IntConsumer;Ljava/util/function/Consumer;)V + .registers 4 + const/4 v0, 0x0 + # Slot for value + const/16 v1, 0x0 + invoke-interface {p0, v1}, Ljava/util/function/IntConsumer;->accept(I)V + invoke-interface {p1, v0}, Ljava/util/function/Consumer;->accept(Ljava/lang/Object;)V + return-void +.end method + +.method public static ObjectMethod(Ljava/util/function/IntConsumer;Ljava/util/function/Consumer;)V + .registers 4 + const-string v0, "TARGET_VALUE" + # Slot for value + const/16 v1, 0x0 + invoke-interface {p0, v1}, Ljava/util/function/IntConsumer;->accept(I)V + invoke-interface {p1, v0}, Ljava/util/function/Consumer;->accept(Ljava/lang/Object;)V + return-void +.end method + +.method public static ShortMethod(Ljava/util/function/IntConsumer;Ljava/util/function/Consumer;)V + .registers 4 + const/16 v0, 0x141 + # slot for value + const/16 v1, 0x0 + invoke-interface {p0, v1}, Ljava/util/function/IntConsumer;->accept(I)V + invoke-static {v0}, Ljava/lang/Short;->valueOf(S)Ljava/lang/Short; + move-result-object v1 + invoke-interface {p1, v1}, Ljava/util/function/Consumer;->accept(Ljava/lang/Object;)V + return-void +.end method diff --git a/test/1965-get-set-local-primitive-no-tables/src/Main.java b/test/1965-get-set-local-primitive-no-tables/src/Main.java new file mode 100644 index 0000000000..73ce85f096 --- /dev/null +++ b/test/1965-get-set-local-primitive-no-tables/src/Main.java @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +public class Main { + public static void main(String[] args) throws Exception { + art.Test1965.run(); + } +} diff --git a/test/1965-get-set-local-primitive-no-tables/src/art/Breakpoint.java b/test/1965-get-set-local-primitive-no-tables/src/art/Breakpoint.java new file mode 120000 index 0000000000..3673916cc6 --- /dev/null +++ b/test/1965-get-set-local-primitive-no-tables/src/art/Breakpoint.java @@ -0,0 +1 @@ +../../../jvmti-common/Breakpoint.java
\ No newline at end of file diff --git a/test/1965-get-set-local-primitive-no-tables/src/art/Locals.java b/test/1965-get-set-local-primitive-no-tables/src/art/Locals.java new file mode 120000 index 0000000000..29983862bc --- /dev/null +++ b/test/1965-get-set-local-primitive-no-tables/src/art/Locals.java @@ -0,0 +1 @@ +../../../jvmti-common/Locals.java
\ No newline at end of file diff --git a/test/1965-get-set-local-primitive-no-tables/src/art/StackTrace.java b/test/1965-get-set-local-primitive-no-tables/src/art/StackTrace.java new file mode 120000 index 0000000000..e1a08aadbd --- /dev/null +++ b/test/1965-get-set-local-primitive-no-tables/src/art/StackTrace.java @@ -0,0 +1 @@ +../../../jvmti-common/StackTrace.java
\ No newline at end of file diff --git a/test/1965-get-set-local-primitive-no-tables/src/art/Suspension.java b/test/1965-get-set-local-primitive-no-tables/src/art/Suspension.java new file mode 120000 index 0000000000..bcef96f69d --- /dev/null +++ b/test/1965-get-set-local-primitive-no-tables/src/art/Suspension.java @@ -0,0 +1 @@ +../../../jvmti-common/Suspension.java
\ No newline at end of file diff --git a/test/1965-get-set-local-primitive-no-tables/src/art/Test1965.java b/test/1965-get-set-local-primitive-no-tables/src/art/Test1965.java new file mode 100644 index 0000000000..f516d187a9 --- /dev/null +++ b/test/1965-get-set-local-primitive-no-tables/src/art/Test1965.java @@ -0,0 +1,213 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package art; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Executable; +import java.lang.reflect.Method; +import java.nio.ByteBuffer; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.Set; +import java.util.concurrent.Semaphore; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.function.IntConsumer; +import java.util.function.IntFunction; +import java.util.function.Predicate; +import java.util.function.Supplier; + +public class Test1965 { + public static final String TARGET_VAR = "TARGET"; + + public static void reportValue(Object val) { + if (val instanceof Character) { + val = "<Char: " + Character.getNumericValue(((Character)val).charValue()) + ">"; + } + System.out.println("\tValue is '" + val + + "' (class: " + (val != null ? val.getClass().toString() : "null") + ")"); + } + + public static interface SafepointFunction { + public void invoke(Thread thread, Method target, int slot, int depth) throws Exception; + } + + public static interface SetterFunction { + public void SetVar(Thread t, int depth, int slot, Object v); + } + + public static interface GetterFunction { public Object GetVar(Thread t, int depth, int slot); } + + public static SafepointFunction + NamedSet(final String type, final SetterFunction get, final Object v) { + return new SafepointFunction() { + public void invoke(Thread t, Method method, int slot, int depth) { + try { + get.SetVar(t, depth, slot, v); + System.out.println(this + " on " + method + " set value: " + v); + } catch (Exception e) { + System.out.println(this + " on " + method + " failed to set value " + v + " due to " + + e.getMessage()); + } + } + public String toString() { + return "\"Set" + type + "\""; + } + }; + } + + public static SafepointFunction NamedGet(final String type, final GetterFunction get) { + return new SafepointFunction() { + public void invoke(Thread t, Method method, int slot, int depth) { + try { + Object res = get.GetVar(t, depth, slot); + System.out.println(this + " on " + method + " got value: " + res); + } catch (Exception e) { + System.out.println(this + " on " + method + " failed due to " + e.getMessage()); + } + } + public String toString() { + return "\"Get" + type + "\""; + } + }; + } + + public static class TestCase { + public final Method target; + + public TestCase(Method target) { + this.target = target; + } + + public static class ThreadPauser implements IntConsumer { + public final Semaphore sem_wakeup_main; + public final Semaphore sem_wait; + public int slot = -1; + + public ThreadPauser() { + sem_wakeup_main = new Semaphore(0); + sem_wait = new Semaphore(0); + } + + public void accept(int v) { + try { + slot = v; + sem_wakeup_main.release(); + sem_wait.acquire(); + } catch (Exception e) { + throw new Error("Error with semaphores!", e); + } + } + + public void waitForOtherThreadToPause() throws Exception { + sem_wakeup_main.acquire(); + } + + public void wakeupOtherThread() throws Exception { + sem_wait.release(); + } + } + + public void exec(final SafepointFunction safepoint) throws Exception { + System.out.println("Running " + target + " with " + safepoint + " on remote thread."); + final ThreadPauser pause = new ThreadPauser(); + final Consumer<?> reporter = Test1965::reportValue; + Thread remote = new Thread(() -> { + try { + target.invoke(null, pause, reporter); + } catch (Exception e) { + throw new Error("Error invoking remote thread " + Thread.currentThread(), e); + } + }, "remote thread for " + target + " with " + safepoint); + remote.start(); + pause.waitForOtherThreadToPause(); + try { + Suspension.suspend(remote); + StackTrace.StackFrameData frame = findStackFrame(remote); + safepoint.invoke(remote, target, pause.slot, frame.depth); + } finally { + Suspension.resume(remote); + pause.wakeupOtherThread(); + remote.join(); + } + } + + private Locals.VariableDescription findTargetVar(long loc) { + for (Locals.VariableDescription var : Locals.GetLocalVariableTable(target)) { + if (var.start_location <= loc && var.length + var.start_location > loc && + var.name.equals(TARGET_VAR)) { + return var; + } + } + throw new Error("Unable to find variable " + TARGET_VAR + " in " + target + " at loc " + loc); + } + + private StackTrace.StackFrameData findStackFrame(Thread thr) { + for (StackTrace.StackFrameData frame : StackTrace.GetStackTrace(thr)) { + if (frame.method.equals(target)) { + return frame; + } + } + throw new Error("Unable to find stack frame in method " + target + " on thread " + thr); + } + } + public static Method getMethod(String name) throws Exception { + return Class.forName("art_test.TestCases1965") + .getDeclaredMethod(name, IntConsumer.class, Consumer.class); + } + + public static void run() throws Exception { + Locals.EnableLocalVariableAccess(); + final TestCase[] MAIN_TEST_CASES = new TestCase[] { + new TestCase(getMethod("IntMethod")), new TestCase(getMethod("LongMethod")), + new TestCase(getMethod("FloatMethod")), new TestCase(getMethod("DoubleMethod")), + new TestCase(getMethod("ObjectMethod")), new TestCase(getMethod("NullObjectMethod")), + }; + + final SafepointFunction[] SAFEPOINTS = new SafepointFunction[] { + NamedGet("Int", Locals::GetLocalVariableInt), + NamedGet("Long", Locals::GetLocalVariableLong), + NamedGet("Float", Locals::GetLocalVariableFloat), + NamedGet("Double", Locals::GetLocalVariableDouble), + NamedGet("Object", Locals::GetLocalVariableObject), + NamedSet("Int", Locals::SetLocalVariableInt, Integer.MAX_VALUE), + NamedSet("Long", Locals::SetLocalVariableLong, Long.MAX_VALUE), + NamedSet("Float", Locals::SetLocalVariableFloat, 9.2f), + NamedSet("Double", Locals::SetLocalVariableDouble, 12.4d), + NamedSet("Object", Locals::SetLocalVariableObject, "NEW_VALUE_FOR_SET"), + NamedSet("NullObject", Locals::SetLocalVariableObject, null), + }; + + for (TestCase t : MAIN_TEST_CASES) { + for (SafepointFunction s : SAFEPOINTS) { + t.exec(s); + } + } + + // Test int for small values. + new TestCase(getMethod("BooleanMethod")) + .exec(NamedSet("IntBoolSize", Locals::SetLocalVariableInt, 1)); + new TestCase(getMethod("ByteMethod")) + .exec(NamedSet("IntByteSize", Locals::SetLocalVariableInt, Byte.MAX_VALUE - 1)); + + new TestCase(getMethod("CharMethod")) + .exec(NamedSet("IntCharSize", Locals::SetLocalVariableInt, Character.MAX_VALUE - 1)); + new TestCase(getMethod("ShortMethod")) + .exec(NamedSet("IntShortSize", Locals::SetLocalVariableInt, Short.MAX_VALUE - 1)); + } +} diff --git a/test/1966-get-set-local-objects-no-table/build b/test/1966-get-set-local-objects-no-table/build new file mode 100644 index 0000000000..6631df91b7 --- /dev/null +++ b/test/1966-get-set-local-objects-no-table/build @@ -0,0 +1,25 @@ +#!/bin/bash +# +# Copyright 2019 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# make us exit on a failure +set -e + +if [[ $@ != *"--jvm"* ]]; then + mv jasmin jasmin-unused +else + mv smali smali-unused +fi +./default-build "$@" diff --git a/test/1966-get-set-local-objects-no-table/expected.txt b/test/1966-get-set-local-objects-no-table/expected.txt new file mode 100644 index 0000000000..f24dfe78a5 --- /dev/null +++ b/test/1966-get-set-local-objects-no-table/expected.txt @@ -0,0 +1,162 @@ +Running public static void art_test.TestCases1966.ObjectMethod(java.util.function.IntConsumer) with "GetGetObject" on remote thread. +"GetGetObject" on public static void art_test.TestCases1966.ObjectMethod(java.util.function.IntConsumer) got value: TestClass1("ObjectMethod") + Value is 'TestClass1("ObjectMethod")' (class: class art.Test1966$TestClass1) +Running public static void art_test.TestCases1966.ObjectMethod(java.util.function.IntConsumer) with "SetNull" on remote thread. +"SetNull" on public static void art_test.TestCases1966.ObjectMethod(java.util.function.IntConsumer) set value: null + Value is 'null' (class: NULL) +Running public static void art_test.TestCases1966.ObjectMethod(java.util.function.IntConsumer) with "SetTestClass1" on remote thread. +"SetTestClass1" on public static void art_test.TestCases1966.ObjectMethod(java.util.function.IntConsumer) set value: TestClass1("Set TestClass1") + Value is 'TestClass1("Set TestClass1")' (class: class art.Test1966$TestClass1) +Running public static void art_test.TestCases1966.ObjectMethod(java.util.function.IntConsumer) with "SetTestClass1ext" on remote thread. +"SetTestClass1ext" on public static void art_test.TestCases1966.ObjectMethod(java.util.function.IntConsumer) set value: TestClass1ext("TestClass1("Set TestClass1ext")") + Value is 'TestClass1ext("TestClass1("Set TestClass1ext")")' (class: class art.Test1966$TestClass1ext) +Running public static void art_test.TestCases1966.ObjectMethod(java.util.function.IntConsumer) with "SetTestClass2" on remote thread. +"SetTestClass2" on public static void art_test.TestCases1966.ObjectMethod(java.util.function.IntConsumer) set value: TestClass2("Set TestClass2") + Value is 'TestClass2("Set TestClass2")' (class: class art.Test1966$TestClass2) +Running public static void art_test.TestCases1966.ObjectMethod(java.util.function.IntConsumer) with "SetTestClass2impl" on remote thread. +"SetTestClass2impl" on public static void art_test.TestCases1966.ObjectMethod(java.util.function.IntConsumer) set value: TestClass2impl("TestClass2("Set TestClass2impl")") + Value is 'TestClass2impl("TestClass2("Set TestClass2impl")")' (class: class art.Test1966$TestClass2impl) +Running public static void art_test.TestCases1966.CastInterfaceMethod(java.util.function.IntConsumer) with "GetGetObject" on remote thread. +"GetGetObject" on public static void art_test.TestCases1966.CastInterfaceMethod(java.util.function.IntConsumer) got value: TestClass1("ObjectMethod") + Value is 'TestClass1("ObjectMethod")' (class: class art.Test1966$TestClass1) +Running public static void art_test.TestCases1966.CastInterfaceMethod(java.util.function.IntConsumer) with "SetNull" on remote thread. +"SetNull" on public static void art_test.TestCases1966.CastInterfaceMethod(java.util.function.IntConsumer) set value: null + Value is 'null' (class: NULL) +Running public static void art_test.TestCases1966.CastInterfaceMethod(java.util.function.IntConsumer) with "SetTestClass1" on remote thread. +"SetTestClass1" on public static void art_test.TestCases1966.CastInterfaceMethod(java.util.function.IntConsumer) set value: TestClass1("Set TestClass1") + Value is 'TestClass1("Set TestClass1")' (class: class art.Test1966$TestClass1) +Running public static void art_test.TestCases1966.CastInterfaceMethod(java.util.function.IntConsumer) with "SetTestClass1ext" on remote thread. +"SetTestClass1ext" on public static void art_test.TestCases1966.CastInterfaceMethod(java.util.function.IntConsumer) set value: TestClass1ext("TestClass1("Set TestClass1ext")") + Value is 'TestClass1ext("TestClass1("Set TestClass1ext")")' (class: class art.Test1966$TestClass1ext) +Running public static void art_test.TestCases1966.CastInterfaceMethod(java.util.function.IntConsumer) with "SetTestClass2" on remote thread. +"SetTestClass2" on public static void art_test.TestCases1966.CastInterfaceMethod(java.util.function.IntConsumer) failed to set value TestClass2("Set TestClass2") due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'TestClass1("ObjectMethod")' (class: class art.Test1966$TestClass1) +Running public static void art_test.TestCases1966.CastInterfaceMethod(java.util.function.IntConsumer) with "SetTestClass2impl" on remote thread. +"SetTestClass2impl" on public static void art_test.TestCases1966.CastInterfaceMethod(java.util.function.IntConsumer) failed to set value TestClass2impl("TestClass2("Set TestClass2impl")") due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'TestClass1("ObjectMethod")' (class: class art.Test1966$TestClass1) +Running public static void art_test.TestCases1966.CastExactMethod(java.util.function.IntConsumer) with "GetGetObject" on remote thread. +"GetGetObject" on public static void art_test.TestCases1966.CastExactMethod(java.util.function.IntConsumer) got value: TestClass1("ObjectMethod") + Value is 'TestClass1("ObjectMethod")' (class: class art.Test1966$TestClass1) +Running public static void art_test.TestCases1966.CastExactMethod(java.util.function.IntConsumer) with "SetNull" on remote thread. +"SetNull" on public static void art_test.TestCases1966.CastExactMethod(java.util.function.IntConsumer) set value: null + Value is 'null' (class: NULL) +Running public static void art_test.TestCases1966.CastExactMethod(java.util.function.IntConsumer) with "SetTestClass1" on remote thread. +"SetTestClass1" on public static void art_test.TestCases1966.CastExactMethod(java.util.function.IntConsumer) set value: TestClass1("Set TestClass1") + Value is 'TestClass1("Set TestClass1")' (class: class art.Test1966$TestClass1) +Running public static void art_test.TestCases1966.CastExactMethod(java.util.function.IntConsumer) with "SetTestClass1ext" on remote thread. +"SetTestClass1ext" on public static void art_test.TestCases1966.CastExactMethod(java.util.function.IntConsumer) set value: TestClass1ext("TestClass1("Set TestClass1ext")") + Value is 'TestClass1ext("TestClass1("Set TestClass1ext")")' (class: class art.Test1966$TestClass1ext) +Running public static void art_test.TestCases1966.CastExactMethod(java.util.function.IntConsumer) with "SetTestClass2" on remote thread. +"SetTestClass2" on public static void art_test.TestCases1966.CastExactMethod(java.util.function.IntConsumer) failed to set value TestClass2("Set TestClass2") due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'TestClass1("ObjectMethod")' (class: class art.Test1966$TestClass1) +Running public static void art_test.TestCases1966.CastExactMethod(java.util.function.IntConsumer) with "SetTestClass2impl" on remote thread. +"SetTestClass2impl" on public static void art_test.TestCases1966.CastExactMethod(java.util.function.IntConsumer) failed to set value TestClass2impl("TestClass2("Set TestClass2impl")") due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'TestClass1("ObjectMethod")' (class: class art.Test1966$TestClass1) +Running public static void art_test.TestCases1966.InterfaceMethod(java.util.function.IntConsumer) with "GetGetObject" on remote thread. +"GetGetObject" on public static void art_test.TestCases1966.InterfaceMethod(java.util.function.IntConsumer) got value: TestClass1("InterfaceMethod") + Value is 'TestClass1("InterfaceMethod")' (class: class art.Test1966$TestClass1) +Running public static void art_test.TestCases1966.InterfaceMethod(java.util.function.IntConsumer) with "SetNull" on remote thread. +"SetNull" on public static void art_test.TestCases1966.InterfaceMethod(java.util.function.IntConsumer) set value: null + Value is 'null' (class: NULL) +Running public static void art_test.TestCases1966.InterfaceMethod(java.util.function.IntConsumer) with "SetTestClass1" on remote thread. +"SetTestClass1" on public static void art_test.TestCases1966.InterfaceMethod(java.util.function.IntConsumer) set value: TestClass1("Set TestClass1") + Value is 'TestClass1("Set TestClass1")' (class: class art.Test1966$TestClass1) +Running public static void art_test.TestCases1966.InterfaceMethod(java.util.function.IntConsumer) with "SetTestClass1ext" on remote thread. +"SetTestClass1ext" on public static void art_test.TestCases1966.InterfaceMethod(java.util.function.IntConsumer) set value: TestClass1ext("TestClass1("Set TestClass1ext")") + Value is 'TestClass1ext("TestClass1("Set TestClass1ext")")' (class: class art.Test1966$TestClass1ext) +Running public static void art_test.TestCases1966.InterfaceMethod(java.util.function.IntConsumer) with "SetTestClass2" on remote thread. +"SetTestClass2" on public static void art_test.TestCases1966.InterfaceMethod(java.util.function.IntConsumer) failed to set value TestClass2("Set TestClass2") due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'TestClass1("InterfaceMethod")' (class: class art.Test1966$TestClass1) +Running public static void art_test.TestCases1966.InterfaceMethod(java.util.function.IntConsumer) with "SetTestClass2impl" on remote thread. +"SetTestClass2impl" on public static void art_test.TestCases1966.InterfaceMethod(java.util.function.IntConsumer) set value: TestClass2impl("TestClass2("Set TestClass2impl")") + Value is 'TestClass2impl("TestClass2("Set TestClass2impl")")' (class: class art.Test1966$TestClass2impl) +Running public static void art_test.TestCases1966.ExactClassMethod(java.util.function.IntConsumer) with "GetGetObject" on remote thread. +"GetGetObject" on public static void art_test.TestCases1966.ExactClassMethod(java.util.function.IntConsumer) got value: TestClass1("SpecificClassMethod") + Value is 'TestClass1("SpecificClassMethod")' (class: class art.Test1966$TestClass1) +Running public static void art_test.TestCases1966.ExactClassMethod(java.util.function.IntConsumer) with "SetNull" on remote thread. +"SetNull" on public static void art_test.TestCases1966.ExactClassMethod(java.util.function.IntConsumer) set value: null + Value is 'null' (class: NULL) +Running public static void art_test.TestCases1966.ExactClassMethod(java.util.function.IntConsumer) with "SetTestClass1" on remote thread. +"SetTestClass1" on public static void art_test.TestCases1966.ExactClassMethod(java.util.function.IntConsumer) set value: TestClass1("Set TestClass1") + Value is 'TestClass1("Set TestClass1")' (class: class art.Test1966$TestClass1) +Running public static void art_test.TestCases1966.ExactClassMethod(java.util.function.IntConsumer) with "SetTestClass1ext" on remote thread. +"SetTestClass1ext" on public static void art_test.TestCases1966.ExactClassMethod(java.util.function.IntConsumer) set value: TestClass1ext("TestClass1("Set TestClass1ext")") + Value is 'TestClass1ext("TestClass1("Set TestClass1ext")")' (class: class art.Test1966$TestClass1ext) +Running public static void art_test.TestCases1966.ExactClassMethod(java.util.function.IntConsumer) with "SetTestClass2" on remote thread. +"SetTestClass2" on public static void art_test.TestCases1966.ExactClassMethod(java.util.function.IntConsumer) failed to set value TestClass2("Set TestClass2") due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'TestClass1("SpecificClassMethod")' (class: class art.Test1966$TestClass1) +Running public static void art_test.TestCases1966.ExactClassMethod(java.util.function.IntConsumer) with "SetTestClass2impl" on remote thread. +"SetTestClass2impl" on public static void art_test.TestCases1966.ExactClassMethod(java.util.function.IntConsumer) failed to set value TestClass2impl("TestClass2("Set TestClass2impl")") due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'TestClass1("SpecificClassMethod")' (class: class art.Test1966$TestClass1) +Running public static void art_test.TestCases1966.PrimitiveMethod(java.util.function.IntConsumer) with "GetGetObject" on remote thread. +"GetGetObject" on public static void art_test.TestCases1966.PrimitiveMethod(java.util.function.IntConsumer) failed due to JVMTI_ERROR_TYPE_MISMATCH + Value is '42' (class: class java.lang.Integer) +Running public static void art_test.TestCases1966.PrimitiveMethod(java.util.function.IntConsumer) with "SetNull" on remote thread. +"SetNull" on public static void art_test.TestCases1966.PrimitiveMethod(java.util.function.IntConsumer) failed to set value null due to JVMTI_ERROR_TYPE_MISMATCH + Value is '42' (class: class java.lang.Integer) +Running public static void art_test.TestCases1966.PrimitiveMethod(java.util.function.IntConsumer) with "SetTestClass1" on remote thread. +"SetTestClass1" on public static void art_test.TestCases1966.PrimitiveMethod(java.util.function.IntConsumer) failed to set value TestClass1("Set TestClass1") due to JVMTI_ERROR_TYPE_MISMATCH + Value is '42' (class: class java.lang.Integer) +Running public static void art_test.TestCases1966.PrimitiveMethod(java.util.function.IntConsumer) with "SetTestClass1ext" on remote thread. +"SetTestClass1ext" on public static void art_test.TestCases1966.PrimitiveMethod(java.util.function.IntConsumer) failed to set value TestClass1ext("TestClass1("Set TestClass1ext")") due to JVMTI_ERROR_TYPE_MISMATCH + Value is '42' (class: class java.lang.Integer) +Running public static void art_test.TestCases1966.PrimitiveMethod(java.util.function.IntConsumer) with "SetTestClass2" on remote thread. +"SetTestClass2" on public static void art_test.TestCases1966.PrimitiveMethod(java.util.function.IntConsumer) failed to set value TestClass2("Set TestClass2") due to JVMTI_ERROR_TYPE_MISMATCH + Value is '42' (class: class java.lang.Integer) +Running public static void art_test.TestCases1966.PrimitiveMethod(java.util.function.IntConsumer) with "SetTestClass2impl" on remote thread. +"SetTestClass2impl" on public static void art_test.TestCases1966.PrimitiveMethod(java.util.function.IntConsumer) failed to set value TestClass2impl("TestClass2("Set TestClass2impl")") due to JVMTI_ERROR_TYPE_MISMATCH + Value is '42' (class: class java.lang.Integer) +Running public static void art_test.TestCases1966.NullMethod(java.util.function.IntConsumer) with "GetGetObject" on remote thread. +"GetGetObject" on public static void art_test.TestCases1966.NullMethod(java.util.function.IntConsumer) got value: null + Value is 'null' (class: NULL) +Running public static void art_test.TestCases1966.NullMethod(java.util.function.IntConsumer) with "SetNull" on remote thread. +"SetNull" on public static void art_test.TestCases1966.NullMethod(java.util.function.IntConsumer) set value: null + Value is 'null' (class: NULL) +Running public static void art_test.TestCases1966.NullMethod(java.util.function.IntConsumer) with "SetTestClass1" on remote thread. +"SetTestClass1" on public static void art_test.TestCases1966.NullMethod(java.util.function.IntConsumer) failed to set value TestClass1("Set TestClass1") due to JVMTI_ERROR_INTERNAL + Value is 'null' (class: NULL) +Running public static void art_test.TestCases1966.NullMethod(java.util.function.IntConsumer) with "SetTestClass1ext" on remote thread. +"SetTestClass1ext" on public static void art_test.TestCases1966.NullMethod(java.util.function.IntConsumer) failed to set value TestClass1ext("TestClass1("Set TestClass1ext")") due to JVMTI_ERROR_INTERNAL + Value is 'null' (class: NULL) +Running public static void art_test.TestCases1966.NullMethod(java.util.function.IntConsumer) with "SetTestClass2" on remote thread. +"SetTestClass2" on public static void art_test.TestCases1966.NullMethod(java.util.function.IntConsumer) failed to set value TestClass2("Set TestClass2") due to JVMTI_ERROR_INTERNAL + Value is 'null' (class: NULL) +Running public static void art_test.TestCases1966.NullMethod(java.util.function.IntConsumer) with "SetTestClass2impl" on remote thread. +"SetTestClass2impl" on public static void art_test.TestCases1966.NullMethod(java.util.function.IntConsumer) failed to set value TestClass2impl("TestClass2("Set TestClass2impl")") due to JVMTI_ERROR_INTERNAL + Value is 'null' (class: NULL) +Running public static void art_test.TestCases1966.CastExactNullMethod(java.util.function.IntConsumer) with "GetGetObject" on remote thread. +"GetGetObject" on public static void art_test.TestCases1966.CastExactNullMethod(java.util.function.IntConsumer) got value: null + Value is 'null' (class: NULL) +Running public static void art_test.TestCases1966.CastExactNullMethod(java.util.function.IntConsumer) with "SetNull" on remote thread. +"SetNull" on public static void art_test.TestCases1966.CastExactNullMethod(java.util.function.IntConsumer) set value: null + Value is 'null' (class: NULL) +Running public static void art_test.TestCases1966.CastExactNullMethod(java.util.function.IntConsumer) with "SetTestClass1" on remote thread. +"SetTestClass1" on public static void art_test.TestCases1966.CastExactNullMethod(java.util.function.IntConsumer) set value: TestClass1("Set TestClass1") + Value is 'TestClass1("Set TestClass1")' (class: class art.Test1966$TestClass1) +Running public static void art_test.TestCases1966.CastExactNullMethod(java.util.function.IntConsumer) with "SetTestClass1ext" on remote thread. +"SetTestClass1ext" on public static void art_test.TestCases1966.CastExactNullMethod(java.util.function.IntConsumer) set value: TestClass1ext("TestClass1("Set TestClass1ext")") + Value is 'TestClass1ext("TestClass1("Set TestClass1ext")")' (class: class art.Test1966$TestClass1ext) +Running public static void art_test.TestCases1966.CastExactNullMethod(java.util.function.IntConsumer) with "SetTestClass2" on remote thread. +"SetTestClass2" on public static void art_test.TestCases1966.CastExactNullMethod(java.util.function.IntConsumer) failed to set value TestClass2("Set TestClass2") due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'null' (class: NULL) +Running public static void art_test.TestCases1966.CastExactNullMethod(java.util.function.IntConsumer) with "SetTestClass2impl" on remote thread. +"SetTestClass2impl" on public static void art_test.TestCases1966.CastExactNullMethod(java.util.function.IntConsumer) failed to set value TestClass2impl("TestClass2("Set TestClass2impl")") due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'null' (class: NULL) +Running public static void art_test.TestCases1966.CastInterfaceNullMethod(java.util.function.IntConsumer) with "GetGetObject" on remote thread. +"GetGetObject" on public static void art_test.TestCases1966.CastInterfaceNullMethod(java.util.function.IntConsumer) got value: null + Value is 'null' (class: NULL) +Running public static void art_test.TestCases1966.CastInterfaceNullMethod(java.util.function.IntConsumer) with "SetNull" on remote thread. +"SetNull" on public static void art_test.TestCases1966.CastInterfaceNullMethod(java.util.function.IntConsumer) set value: null + Value is 'null' (class: NULL) +Running public static void art_test.TestCases1966.CastInterfaceNullMethod(java.util.function.IntConsumer) with "SetTestClass1" on remote thread. +"SetTestClass1" on public static void art_test.TestCases1966.CastInterfaceNullMethod(java.util.function.IntConsumer) set value: TestClass1("Set TestClass1") + Value is 'TestClass1("Set TestClass1")' (class: class art.Test1966$TestClass1) +Running public static void art_test.TestCases1966.CastInterfaceNullMethod(java.util.function.IntConsumer) with "SetTestClass1ext" on remote thread. +"SetTestClass1ext" on public static void art_test.TestCases1966.CastInterfaceNullMethod(java.util.function.IntConsumer) set value: TestClass1ext("TestClass1("Set TestClass1ext")") + Value is 'TestClass1ext("TestClass1("Set TestClass1ext")")' (class: class art.Test1966$TestClass1ext) +Running public static void art_test.TestCases1966.CastInterfaceNullMethod(java.util.function.IntConsumer) with "SetTestClass2" on remote thread. +"SetTestClass2" on public static void art_test.TestCases1966.CastInterfaceNullMethod(java.util.function.IntConsumer) failed to set value TestClass2("Set TestClass2") due to JVMTI_ERROR_TYPE_MISMATCH + Value is 'null' (class: NULL) +Running public static void art_test.TestCases1966.CastInterfaceNullMethod(java.util.function.IntConsumer) with "SetTestClass2impl" on remote thread. +"SetTestClass2impl" on public static void art_test.TestCases1966.CastInterfaceNullMethod(java.util.function.IntConsumer) set value: TestClass2impl("TestClass2("Set TestClass2impl")") + Value is 'TestClass2impl("TestClass2("Set TestClass2impl")")' (class: class art.Test1966$TestClass2impl) diff --git a/test/1966-get-set-local-objects-no-table/info.txt b/test/1966-get-set-local-objects-no-table/info.txt new file mode 100644 index 0000000000..86ac7435ec --- /dev/null +++ b/test/1966-get-set-local-objects-no-table/info.txt @@ -0,0 +1,2 @@ +Tests for jvmti get and set local variable object. + diff --git a/test/1966-get-set-local-objects-no-table/jasmin/TestCases1966.j b/test/1966-get-set-local-objects-no-table/jasmin/TestCases1966.j new file mode 100644 index 0000000000..721f7ced53 --- /dev/null +++ b/test/1966-get-set-local-objects-no-table/jasmin/TestCases1966.j @@ -0,0 +1,161 @@ +; Copyright (C) 2019 The Android Open Source Project +; +; Licensed under the Apache License, Version 2.0 (the "License"); +; you may not use this file except in compliance with the License. +; You may obtain a copy of the License at +; +; http://www.apache.org/licenses/LICENSE-2.0 +; +; Unless required by applicable law or agreed to in writing, software +; distributed under the License is distributed on an "AS IS" BASIS, +; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +; See the License for the specific language governing permissions and +; limitations under the License. + +.class public art_test/TestCases1966 +.super java/lang/Object +.inner class public static TestClass1 inner art/Test1966$TestClass1 outer art/Test1966 +.inner interface public static abstract TestInterface inner art/Test1966$TestInterface outer art/Test1966 + +.method public <init>()V + .limit stack 1 + .limit locals 1 + 0: aload_0 + 1: invokespecial java/lang/Object/<init>()V + 4: return +.end method + +.method public static PrimitiveMethod(Ljava/util/function/IntConsumer;)V + .limit stack 2 + .limit locals 2 + 0: bipush 42 + 2: istore_1 + 3: aload_0 + 4: sipush 1 + 7: invokeinterface java/util/function/IntConsumer/accept(I)V 2 + 12: iload_1 + 13: invokestatic java/lang/Integer/valueOf(I)Ljava/lang/Integer; + 16: invokestatic art/Test1966/reportValue(Ljava/lang/Object;)V + 19: return +.end method + +.method public static CastInterfaceMethod(Ljava/util/function/IntConsumer;)V + .limit stack 2 + .limit locals 3 + 0: ldc "ObjectMethod" + 2: invokestatic art/Test1966$TestClass1/create(Ljava/lang/String;)Ljava/lang/Object; + 5: astore_1 + 6: aload_1 + 7: checkcast art/Test1966$TestClass1 + 10: astore_2 + 11: aload_0 + 12: sipush 2 + 15: invokeinterface java/util/function/IntConsumer/accept(I)V 2 + 20: aload_2 + 21: invokestatic art/Test1966/reportValue(Ljava/lang/Object;)V + 24: return +.end method + +.method public static CastExactMethod(Ljava/util/function/IntConsumer;)V + .limit stack 2 + .limit locals 3 + 0: ldc "ObjectMethod" + 2: invokestatic art/Test1966$TestClass1/create(Ljava/lang/String;)Ljava/lang/Object; + 5: astore_1 + 6: aload_1 + 7: checkcast art/Test1966$TestClass1 + 10: astore_2 + 11: aload_0 + 12: sipush 2 + 15: invokeinterface java/util/function/IntConsumer/accept(I)V 2 + 20: aload_2 + 21: invokestatic art/Test1966/reportValue(Ljava/lang/Object;)V + 24: return +.end method + +.method public static ObjectMethod(Ljava/util/function/IntConsumer;)V + .limit stack 2 + .limit locals 2 + 0: ldc "ObjectMethod" + 2: invokestatic art/Test1966$TestClass1/create(Ljava/lang/String;)Ljava/lang/Object; + 5: astore_1 + 6: aload_0 + 7: sipush 1 + 10: invokeinterface java/util/function/IntConsumer/accept(I)V 2 + 15: aload_1 + 16: invokestatic art/Test1966/reportValue(Ljava/lang/Object;)V + 19: return +.end method + +.method public static InterfaceMethod(Ljava/util/function/IntConsumer;)V + .limit stack 2 + .limit locals 2 + 0: ldc "InterfaceMethod" + 2: invokestatic art/Test1966$TestClass1/createInterface(Ljava/lang/String;)Lart/Test1966$TestInterface; + 5: astore_1 + 6: aload_0 + 7: sipush 1 + 10: invokeinterface java/util/function/IntConsumer/accept(I)V 2 + 15: aload_1 + 16: invokestatic art/Test1966/reportValue(Ljava/lang/Object;)V + 19: return +.end method + +.method public static ExactClassMethod(Ljava/util/function/IntConsumer;)V + .limit stack 2 + .limit locals 2 + 0: ldc "SpecificClassMethod" + 2: invokestatic art/Test1966$TestClass1/createExact(Ljava/lang/String;)Lart/Test1966$TestClass1; + 5: astore_1 + 6: aload_0 + 7: sipush 1 + 10: invokeinterface java/util/function/IntConsumer/accept(I)V 2 + 15: aload_1 + 16: invokestatic art/Test1966/reportValue(Ljava/lang/Object;)V + 19: return +.end method + +.method public static CastExactNullMethod(Ljava/util/function/IntConsumer;)V + .limit stack 2 + .limit locals 3 + 0: aconst_null + 1: astore_1 + 2: aload_1 + 3: checkcast art/Test1966$TestClass1 + 6: astore_2 + 7: aload_0 + 8: sipush 2 + 11: invokeinterface java/util/function/IntConsumer/accept(I)V 2 + 16: aload_2 + 17: invokestatic art/Test1966/reportValue(Ljava/lang/Object;)V + 20: return +.end method + +.method public static CastInterfaceNullMethod(Ljava/util/function/IntConsumer;)V + .limit stack 2 + .limit locals 3 + 0: aconst_null + 1: astore_1 + 2: aload_1 + 3: checkcast art/Test1966$TestInterface + 6: astore_2 + 7: aload_0 + 8: sipush 2 + 11: invokeinterface java/util/function/IntConsumer/accept(I)V 2 + 16: aload_2 + 17: invokestatic art/Test1966/reportValue(Ljava/lang/Object;)V + 20: return +.end method + +.method public static NullMethod(Ljava/util/function/IntConsumer;)V + .limit stack 2 + .limit locals 2 + 0: aconst_null + 1: astore_1 + 2: aload_0 + 3: sipush 1 + 6: invokeinterface java/util/function/IntConsumer/accept(I)V 2 + 11: aload_1 + 12: invokestatic art/Test1966/reportValue(Ljava/lang/Object;)V + 15: return +.end method diff --git a/test/1966-get-set-local-objects-no-table/run b/test/1966-get-set-local-objects-no-table/run new file mode 100755 index 0000000000..9b741ee47f --- /dev/null +++ b/test/1966-get-set-local-objects-no-table/run @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Copyright 2019 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# If we compile the .oat files non-debuggable we could end up with dex2dex running over the files +# which will cause some instructions to be removed from smali/TestCases1966.smali. This test relies +# on the instructions being exactly as written so pass --debuggable to 'dex2oat' only to prevent +# this from happening. +./default-run "$@" --jvmti --compiler-only-option --debuggable diff --git a/test/1966-get-set-local-objects-no-table/smali/TestCases1966.smali b/test/1966-get-set-local-objects-no-table/smali/TestCases1966.smali new file mode 100644 index 0000000000..d460dcd573 --- /dev/null +++ b/test/1966-get-set-local-objects-no-table/smali/TestCases1966.smali @@ -0,0 +1,121 @@ +# Copyright (C) 2019 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +.class public Lart_test/TestCases1966; +.super Ljava/lang/Object; + +# direct methods +.method public constructor <init>()V + .registers 1 + invoke-direct {p0}, Ljava/lang/Object;-><init>()V + return-void +.end method + +.method public static CastExactMethod(Ljava/util/function/IntConsumer;)V + .registers 3 + const-string v0, "ObjectMethod" + invoke-static {v0}, Lart/Test1966$TestClass1;->create(Ljava/lang/String;)Ljava/lang/Object; + move-result-object v0 + check-cast v0, Lart/Test1966$TestClass1; + const/16 v1, 0x0 + invoke-interface {p0, v1}, Ljava/util/function/IntConsumer;->accept(I)V + invoke-static {v0}, Lart/Test1966;->reportValue(Ljava/lang/Object;)V + return-void +.end method + +.method public static CastInterfaceMethod(Ljava/util/function/IntConsumer;)V + .registers 3 + const-string v0, "ObjectMethod" + invoke-static {v0}, Lart/Test1966$TestClass1;->create(Ljava/lang/String;)Ljava/lang/Object; + move-result-object v0 + check-cast v0, Lart/Test1966$TestClass1; + const/16 v1, 0x0 + invoke-interface {p0, v1}, Ljava/util/function/IntConsumer;->accept(I)V + invoke-static {v0}, Lart/Test1966;->reportValue(Ljava/lang/Object;)V + return-void +.end method + +.method public static ExactClassMethod(Ljava/util/function/IntConsumer;)V + .registers 3 + const-string v0, "SpecificClassMethod" + invoke-static {v0}, Lart/Test1966$TestClass1;->createExact(Ljava/lang/String;)Lart/Test1966$TestClass1; + move-result-object v0 + const/16 v1, 0x0 + invoke-interface {p0, v1}, Ljava/util/function/IntConsumer;->accept(I)V + invoke-static {v0}, Lart/Test1966;->reportValue(Ljava/lang/Object;)V + return-void +.end method + +.method public static InterfaceMethod(Ljava/util/function/IntConsumer;)V + .registers 3 + const-string v0, "InterfaceMethod" + invoke-static {v0}, Lart/Test1966$TestClass1;->createInterface(Ljava/lang/String;)Lart/Test1966$TestInterface; + move-result-object v0 + const/16 v1, 0x0 + invoke-interface {p0, v1}, Ljava/util/function/IntConsumer;->accept(I)V + invoke-static {v0}, Lart/Test1966;->reportValue(Ljava/lang/Object;)V + return-void +.end method + +.method public static ObjectMethod(Ljava/util/function/IntConsumer;)V + .registers 3 + const-string v0, "ObjectMethod" + invoke-static {v0}, Lart/Test1966$TestClass1;->create(Ljava/lang/String;)Ljava/lang/Object; + move-result-object v0 + const/16 v1, 0x0 + invoke-interface {p0, v1}, Ljava/util/function/IntConsumer;->accept(I)V + invoke-static {v0}, Lart/Test1966;->reportValue(Ljava/lang/Object;)V + return-void +.end method + +.method public static PrimitiveMethod(Ljava/util/function/IntConsumer;)V + .registers 3 + const/16 v0, 0x2a + const/16 v1, 0x0 + invoke-interface {p0, v1}, Ljava/util/function/IntConsumer;->accept(I)V + invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer; + move-result-object p0 + invoke-static {p0}, Lart/Test1966;->reportValue(Ljava/lang/Object;)V + return-void +.end method + +.method public static NullMethod(Ljava/util/function/IntConsumer;)V + .registers 3 + const/4 v0, 0x0 + const/16 v1, 0x0 + invoke-interface {p0, v1}, Ljava/util/function/IntConsumer;->accept(I)V + invoke-static {v0}, Lart/Test1966;->reportValue(Ljava/lang/Object;)V + return-void +.end method + +.method public static CastInterfaceNullMethod(Ljava/util/function/IntConsumer;)V + .registers 3 + const/4 v0, 0x0 + check-cast v0, Lart/Test1966$TestInterface; + const/16 v1, 0x0 + invoke-interface {p0, v1}, Ljava/util/function/IntConsumer;->accept(I)V + invoke-static {v0}, Lart/Test1966;->reportValue(Ljava/lang/Object;)V + return-void +.end method + +.method public static CastExactNullMethod(Ljava/util/function/IntConsumer;)V + .registers 3 + const/4 v0, 0x0 + check-cast v0, Lart/Test1966$TestClass1; + const/16 v1, 0x0 + invoke-interface {p0, v1}, Ljava/util/function/IntConsumer;->accept(I)V + invoke-static {v0}, Lart/Test1966;->reportValue(Ljava/lang/Object;)V + return-void +.end method
\ No newline at end of file diff --git a/test/1966-get-set-local-objects-no-table/src/Main.java b/test/1966-get-set-local-objects-no-table/src/Main.java new file mode 100644 index 0000000000..198f319421 --- /dev/null +++ b/test/1966-get-set-local-objects-no-table/src/Main.java @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +public class Main { + public static void main(String[] args) throws Exception { + art.Test1966.run(); + } +} diff --git a/test/1966-get-set-local-objects-no-table/src/art/Breakpoint.java b/test/1966-get-set-local-objects-no-table/src/art/Breakpoint.java new file mode 120000 index 0000000000..3673916cc6 --- /dev/null +++ b/test/1966-get-set-local-objects-no-table/src/art/Breakpoint.java @@ -0,0 +1 @@ +../../../jvmti-common/Breakpoint.java
\ No newline at end of file diff --git a/test/1966-get-set-local-objects-no-table/src/art/Locals.java b/test/1966-get-set-local-objects-no-table/src/art/Locals.java new file mode 120000 index 0000000000..29983862bc --- /dev/null +++ b/test/1966-get-set-local-objects-no-table/src/art/Locals.java @@ -0,0 +1 @@ +../../../jvmti-common/Locals.java
\ No newline at end of file diff --git a/test/1966-get-set-local-objects-no-table/src/art/StackTrace.java b/test/1966-get-set-local-objects-no-table/src/art/StackTrace.java new file mode 120000 index 0000000000..e1a08aadbd --- /dev/null +++ b/test/1966-get-set-local-objects-no-table/src/art/StackTrace.java @@ -0,0 +1 @@ +../../../jvmti-common/StackTrace.java
\ No newline at end of file diff --git a/test/1966-get-set-local-objects-no-table/src/art/Suspension.java b/test/1966-get-set-local-objects-no-table/src/art/Suspension.java new file mode 120000 index 0000000000..bcef96f69d --- /dev/null +++ b/test/1966-get-set-local-objects-no-table/src/art/Suspension.java @@ -0,0 +1 @@ +../../../jvmti-common/Suspension.java
\ No newline at end of file diff --git a/test/1966-get-set-local-objects-no-table/src/art/Test1966.java b/test/1966-get-set-local-objects-no-table/src/art/Test1966.java new file mode 100644 index 0000000000..00f3c4ed91 --- /dev/null +++ b/test/1966-get-set-local-objects-no-table/src/art/Test1966.java @@ -0,0 +1,237 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package art; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Executable; +import java.lang.reflect.Method; +import java.nio.ByteBuffer; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.Set; +import java.util.concurrent.Semaphore; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.function.IntConsumer; +import java.util.function.Predicate; +import java.util.function.Supplier; + +public class Test1966 { + public static final String TARGET_VAR = "TARGET"; + + public static interface TestInterface { + public default void doNothing() {} + } + public static class TestClass1 implements TestInterface { + public String id; + public TestClass1(String id) { + this.id = id; + } + public String toString() { + return String.format("TestClass1(\"%s\")", id); + } + + public static TestInterface createInterface(String id) { + return new TestClass1(id); + } + public static TestClass1 createExact(String id) { + return new TestClass1(id); + } + public static Object create(String id) { + return new TestClass1(id); + } + } + + public static class TestClass1ext extends TestClass1 { + public TestClass1ext(String id) { + super(id); + } + public String toString() { + return String.format("TestClass1ext(\"%s\")", super.toString()); + } + } + public static class TestClass2 { + public String id; + public TestClass2(String id) { + this.id = id; + } + public String toString() { + return String.format("TestClass2(\"%s\")", id); + } + } + public static class TestClass2impl extends TestClass2 implements TestInterface { + public TestClass2impl(String id) { + super(id); + } + public String toString() { + return String.format("TestClass2impl(\"%s\")", super.toString()); + } + } + + public static void reportValue(Object val) { + System.out.println("\tValue is '" + val + + "' (class: " + (val != null ? val.getClass() : "NULL") + ")"); + } + + public static interface SafepointFunction { + public void invoke(Thread thread, Method target, int slot, int depth) throws Exception; + } + + public static interface SetterFunction { + public void SetVar(Thread t, int depth, int slot, Object v); + } + + public static interface GetterFunction { public Object GetVar(Thread t, int depth, int slot); } + + public static SafepointFunction + NamedSet(final String type, final SetterFunction get, final Object v) { + return new SafepointFunction() { + public void invoke(Thread t, Method method, int slot, int depth) { + try { + get.SetVar(t, depth, slot, v); + System.out.println(this + " on " + method + " set value: " + v); + } catch (Exception e) { + System.out.println(this + " on " + method + " failed to set value " + v + " due to " + + e.getMessage()); + } + } + public String toString() { + return "\"Set" + type + "\""; + } + }; + } + + public static SafepointFunction NamedGet(final String type, final GetterFunction get) { + return new SafepointFunction() { + public void invoke(Thread t, Method method, int slot, int depth) { + try { + Object res = get.GetVar(t, depth, slot); + System.out.println(this + " on " + method + " got value: " + res); + } catch (Exception e) { + System.out.println(this + " on " + method + " failed due to " + e.getMessage()); + } + } + public String toString() { + return "\"Get" + type + "\""; + } + }; + } + + public static class TestCase { + public final Method target; + + public TestCase(Method target) { + this.target = target; + } + + public static class ThreadPauser implements IntConsumer { + public final Semaphore sem_wakeup_main; + public final Semaphore sem_wait; + public int slot = -1; + + public ThreadPauser() { + sem_wakeup_main = new Semaphore(0); + sem_wait = new Semaphore(0); + } + + public void accept(int i) { + try { + slot = i; + sem_wakeup_main.release(); + sem_wait.acquire(); + } catch (Exception e) { + throw new Error("Error with semaphores!", e); + } + } + + public void waitForOtherThreadToPause() throws Exception { + sem_wakeup_main.acquire(); + } + + public void wakeupOtherThread() throws Exception { + sem_wait.release(); + } + } + + public void exec(final SafepointFunction safepoint) throws Exception { + System.out.println("Running " + target + " with " + safepoint + " on remote thread."); + final ThreadPauser pause = new ThreadPauser(); + Thread remote = new Thread(() -> { + try { + target.invoke(null, pause); + } catch (Exception e) { + throw new Error("Error invoking remote thread " + Thread.currentThread(), e); + } + }, "remote thread for " + target + " with " + safepoint); + remote.start(); + pause.waitForOtherThreadToPause(); + try { + Suspension.suspend(remote); + StackTrace.StackFrameData frame = findStackFrame(remote); + safepoint.invoke(remote, target, pause.slot, frame.depth); + } finally { + Suspension.resume(remote); + pause.wakeupOtherThread(); + remote.join(); + } + } + + private StackTrace.StackFrameData findStackFrame(Thread thr) { + for (StackTrace.StackFrameData frame : StackTrace.GetStackTrace(thr)) { + if (frame.method.equals(target)) { + return frame; + } + } + throw new Error("Unable to find stack frame in method " + target + " on thread " + thr); + } + } + public static Method getMethod(String name) throws Exception { + return Class.forName("art_test.TestCases1966").getDeclaredMethod(name, IntConsumer.class); + } + + public static void run() throws Exception { + Locals.EnableLocalVariableAccess(); + final TestCase[] MAIN_TEST_CASES = new TestCase[] { + new TestCase(getMethod("ObjectMethod")), + new TestCase(getMethod("CastInterfaceMethod")), + new TestCase(getMethod("CastExactMethod")), + new TestCase(getMethod("InterfaceMethod")), + new TestCase(getMethod("ExactClassMethod")), + new TestCase(getMethod("PrimitiveMethod")), + new TestCase(getMethod("NullMethod")), + new TestCase(getMethod("CastExactNullMethod")), + new TestCase(getMethod("CastInterfaceNullMethod")), + }; + + final SetterFunction set_obj = Locals::SetLocalVariableObject; + final SafepointFunction[] SAFEPOINTS = new SafepointFunction[] { + NamedGet("GetObject", Locals::GetLocalVariableObject), + NamedSet("Null", set_obj, null), + NamedSet("TestClass1", set_obj, new TestClass1("Set TestClass1")), + NamedSet("TestClass1ext", set_obj, new TestClass1ext("Set TestClass1ext")), + NamedSet("TestClass2", set_obj, new TestClass2("Set TestClass2")), + NamedSet("TestClass2impl", set_obj, new TestClass2impl("Set TestClass2impl")), + }; + + for (TestCase t : MAIN_TEST_CASES) { + for (SafepointFunction s : SAFEPOINTS) { + t.exec(s); + } + } + } +} diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar index bcd35e6e35..6804091a9e 100755 --- a/test/etc/run-test-jar +++ b/test/etc/run-test-jar @@ -157,6 +157,11 @@ while true; do fi ARGS="${ARGS} $1" shift + elif [ "x$1" = "x--compiler-only-option" ]; then + shift + option="$1" + COMPILE_FLAGS="${COMPILE_FLAGS} $option" + shift elif [ "x$1" = "x-Xcompiler-option" ]; then shift option="$1" diff --git a/test/knownfailures.json b/test/knownfailures.json index 963d33513f..ad0cbe875d 100644 --- a/test/knownfailures.json +++ b/test/knownfailures.json @@ -777,6 +777,18 @@ "description": ["Requires zip, which isn't available on device"] }, { + "tests": [ + "1965-get-set-local-primitive-no-tables", + "1966-get-set-local-objects-no-table" + ], + "variant": "jvm", + "bug": "133241695", + "description": [ + "The RI is wildly inconsistent about how it handles Get/SetLocalVariable when classes ", + "lack debug info." + ] + }, + { "tests": ["683-clinit-inline-static-invoke"], "variant": "jvm", "description": ["Uses android-specific boot image class."] |