diff options
author | 2017-10-11 15:56:48 +0000 | |
---|---|---|
committer | 2017-10-11 10:07:52 -0700 | |
commit | 3dea2121a90cc95c215736ef84d093e396f5525f (patch) | |
tree | 6887dbb76c67c6d5102e125d91e4c648a7d8dae7 /test/1914-get-local-instance | |
parent | 432d91004b79c79deebeee6f6197e43adf6caafd (diff) |
Revert "Revert "Ensure Proxy frames work with JVMTI stack frame functions""
This reverts commit d108d9eaae26df9e4480cf46d26e8c75f142bd6a.
It seems we have a bug somewhere in our proxy or stack-visitor code
causing StackVisitor::GetThisObject to return an object with a null
klass_. Added a temporary skip for the test configurations that expose
this until it can be fixed.
Bug: 66903662
Bug: 67679263
Reason for revert: Added skip for test that exposes a pre-existing bug
in our stack-visitor/proxy-object support.
Test: ./test.py --host -j40
Test: ./test/testrunner/testrunner.py --host --gcstress -t 1939
Change-Id: I8a457112af404c3f4c94e3a2029b744d453ced5d
Diffstat (limited to 'test/1914-get-local-instance')
-rw-r--r-- | test/1914-get-local-instance/expected.txt | 3 | ||||
-rw-r--r-- | test/1914-get-local-instance/src/art/Test1914.java | 30 |
2 files changed, 31 insertions, 2 deletions
diff --git a/test/1914-get-local-instance/expected.txt b/test/1914-get-local-instance/expected.txt index 4117942392..09f0df1937 100644 --- a/test/1914-get-local-instance/expected.txt +++ b/test/1914-get-local-instance/expected.txt @@ -10,3 +10,6 @@ Running public void art.Test1914$TargetClass.InstanceMethod(java.lang.Runnable) Running public native void art.Test1914$TargetClass.NativeInstanceMethod(java.lang.Runnable) with "GetThis" on remote thread. "GetThis" on public native void art.Test1914$TargetClass.NativeInstanceMethod(java.lang.Runnable) got value: TargetClass("NativeInstanceMethodObject") Value is 'TargetClass("NativeInstanceMethodObject")' (class: class art.Test1914$TargetClass) +Running public abstract void art.Test1914$Foo.InterfaceProxyMethod(java.lang.Runnable) with "GetThis" on remote thread. +"GetThis" on public abstract void art.Test1914$Foo.InterfaceProxyMethod(java.lang.Runnable) got value: Proxy for [interface art.Test1914$Foo] + Value is 'Proxy for [interface art.Test1914$Foo]' (class: PROXY CLASS) diff --git a/test/1914-get-local-instance/src/art/Test1914.java b/test/1914-get-local-instance/src/art/Test1914.java index c09f519db8..e47f9cbf38 100644 --- a/test/1914-get-local-instance/src/art/Test1914.java +++ b/test/1914-get-local-instance/src/art/Test1914.java @@ -18,7 +18,9 @@ package art; import java.lang.reflect.Constructor; import java.lang.reflect.Executable; +import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; +import java.lang.reflect.Proxy; import java.nio.ByteBuffer; import java.util.concurrent.Semaphore; import java.util.Arrays; @@ -35,7 +37,7 @@ public class Test1914 { public static void reportValue(Object val) { System.out.println("\tValue is '" + val + "' (class: " - + (val != null ? val.getClass() : "NULL") + ")"); + + (val != null ? (val instanceof Proxy ? "PROXY CLASS" : val.getClass()) : "NULL") + ")"); } public static void StaticMethod(Runnable safepoint) { @@ -151,7 +153,10 @@ public class Test1914 { private StackTrace.StackFrameData findStackFrame(Thread thr) { for (StackTrace.StackFrameData frame : StackTrace.GetStackTrace(thr)) { - if (frame.method.equals(target)) { + if (frame.method.equals(target) || + (frame.method.getName().equals(target.getName()) && + Arrays.deepEquals(frame.method.getParameterTypes(), target.getParameterTypes()) && + ((Method)frame.method).getReturnType().equals(target.getReturnType()))) { return frame; } } @@ -163,6 +168,25 @@ public class Test1914 { return klass.getDeclaredMethod(name, Runnable.class); } + public static interface Foo { + public void InterfaceProxyMethod(Runnable r); + } + + public static Object getProxyObject(final Class... k) { + return Proxy.newProxyInstance( + Test1914.class.getClassLoader(), + k, + (p, m, a) -> { + if (m.getName().equals("toString")) { + return "Proxy for " + Arrays.toString(k); + } else { + ((Runnable)a[0]).run(); + reportValue(p); + return null; + } + }); + } + public static void run() throws Exception { Locals.EnableLocalVariableAccess(); final TestCase[] MAIN_TEST_CASES = new TestCase[] { @@ -172,6 +196,8 @@ public class Test1914 { getMethod(TargetClass.class, "InstanceMethod")), new TestCase(new TargetClass("NativeInstanceMethodObject"), getMethod(TargetClass.class, "NativeInstanceMethod")), + new TestCase(getProxyObject(Foo.class), + getMethod(Foo.class, "InterfaceProxyMethod")), }; for (TestCase t: MAIN_TEST_CASES) { |