Merge "ART: Fix lookup class used by invoke-custom"
diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc
index 91b2d0e..a8ab626 100644
--- a/runtime/interpreter/interpreter_common.cc
+++ b/runtime/interpreter/interpreter_common.cc
@@ -936,7 +936,8 @@
// The first parameter is a MethodHandles lookup instance.
{
- Handle<mirror::Class> lookup_class(hs.NewHandle(bootstrap->GetTargetClass()));
+ Handle<mirror::Class> lookup_class =
+ hs.NewHandle(shadow_frame.GetMethod()->GetDeclaringClass());
ObjPtr<mirror::MethodHandlesLookup> lookup =
mirror::MethodHandlesLookup::Create(self, lookup_class);
if (lookup.IsNull()) {
diff --git a/test/952-invoke-custom-lookup/build b/test/952-invoke-custom-lookup/build
new file mode 100644
index 0000000..f3fe95c
--- /dev/null
+++ b/test/952-invoke-custom-lookup/build
@@ -0,0 +1,27 @@
+#!/bin/bash
+#
+# Copyright 2018 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
+
+# This test uses previously prepared dex and jar files. They need to
+# be re-packaged to match the files that the run-test-jar script
+# expects.
+if [[ $@ != *"--jvm"* ]]; then
+ zip ${TEST_NAME}.jar classes.dex
+else
+ unzip -d classes classes.jar
+fi
diff --git a/test/952-invoke-custom-lookup/classes.dex b/test/952-invoke-custom-lookup/classes.dex
new file mode 100644
index 0000000..670d93d
--- /dev/null
+++ b/test/952-invoke-custom-lookup/classes.dex
Binary files differ
diff --git a/test/952-invoke-custom-lookup/classes.jar b/test/952-invoke-custom-lookup/classes.jar
new file mode 100644
index 0000000..aa6a1f6
--- /dev/null
+++ b/test/952-invoke-custom-lookup/classes.jar
Binary files differ
diff --git a/test/952-invoke-custom-lookup/expected.txt b/test/952-invoke-custom-lookup/expected.txt
new file mode 100644
index 0000000..0da2b86
--- /dev/null
+++ b/test/952-invoke-custom-lookup/expected.txt
@@ -0,0 +1,10 @@
+NAME: 1
+CALLER: Main
+CALLER CLASS: class Main
+THIS CLASS: class com.android.tools.r8.maindexlist.desugar.BootstrapHolder
+invokedynamic target on Main
+NAME: 2
+CALLER: Main
+CALLER CLASS: class Main
+THIS CLASS: class com.android.tools.r8.maindexlist.desugar.BootstrapHolder
+invokedynamic target on BootstrapHolder
diff --git a/test/952-invoke-custom-lookup/info.txt b/test/952-invoke-custom-lookup/info.txt
new file mode 100644
index 0000000..3bfe87d
--- /dev/null
+++ b/test/952-invoke-custom-lookup/info.txt
@@ -0,0 +1 @@
+A temporary test for the lookup class used for invoke-custom (see b/73056094).