summaryrefslogtreecommitdiff
path: root/test/044-proxy/src
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2020-07-29 13:30:24 +0100
committer Nicolas Geoffray <ngeoffray@google.com> 2020-07-30 13:48:49 +0000
commitab7eccef71be2f88a99e71b240bdd98e34357b7c (patch)
tree9579c320db71ca2a16c58f7134c084618afed5b8 /test/044-proxy/src
parent1525960736d4d8fd6d18195097e45145d2177d2c (diff)
Disable support for proxy method in nterp.
They do not fall into the regular baseline JIT path (ie they cannot have profiling info), so just bail on them for now. Test: 044-proxy, wifi-tests Bug: 112676029 Bug: 157658616 Bug: 160543640 Change-Id: I292d85f5d6bfd0edaad1d26e53f85f3780254fd7
Diffstat (limited to 'test/044-proxy/src')
-rw-r--r--test/044-proxy/src/HotProxy.java55
-rw-r--r--test/044-proxy/src/Main.java1
2 files changed, 56 insertions, 0 deletions
diff --git a/test/044-proxy/src/HotProxy.java b/test/044-proxy/src/HotProxy.java
new file mode 100644
index 0000000000..0c5ec1c8a4
--- /dev/null
+++ b/test/044-proxy/src/HotProxy.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2011 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.
+ */
+import java.lang.reflect.*;
+
+public class HotProxy {
+
+ public static final String testName = "HotProxy";
+
+ interface MyInterface {
+ void voidFoo();
+ }
+
+ static void check(boolean x) {
+ if (!x) {
+ throw new AssertionError(testName + " Check failed");
+ }
+ }
+
+ static class MyInvocationHandler implements InvocationHandler {
+ public Object invoke(Object proxy, Method method, Object[] args) {
+ check(proxy instanceof Proxy);
+ check(method.getDeclaringClass() == MyInterface.class);
+ return null;
+ }
+ }
+
+ static void testProxy() {
+ MyInvocationHandler myHandler = new MyInvocationHandler();
+ MyInterface proxyMyInterface =
+ (MyInterface)Proxy.newProxyInstance(HotProxy.class.getClassLoader(),
+ new Class<?>[] { MyInterface.class },
+ myHandler);
+ // Invoke the proxy method multiple times to ensure it becomes hot and the JIT handles it.
+ for (int i = 0; i < 0x10000; i++) {
+ proxyMyInterface.voidFoo();
+ }
+ }
+
+ public static void main(String args[]) {
+ testProxy();
+ }
+}
diff --git a/test/044-proxy/src/Main.java b/test/044-proxy/src/Main.java
index 7b70e65b8c..8be09cf688 100644
--- a/test/044-proxy/src/Main.java
+++ b/test/044-proxy/src/Main.java
@@ -33,6 +33,7 @@ public class Main {
NativeProxy.main(args);
ConstructorProxy.main();
OOMEOnDispatch.main(args);
+ HotProxy.main(args);
}
// The following code maps from the actual proxy class names (eg $Proxy2) to their test output