diff options
| -rw-r--r-- | runtime/interpreter/interpreter_common.cc | 3 | ||||
| -rw-r--r-- | test/952-invoke-custom-lookup/build | 27 | ||||
| -rw-r--r-- | test/952-invoke-custom-lookup/classes.dex | bin | 0 -> 2700 bytes | |||
| -rw-r--r-- | test/952-invoke-custom-lookup/classes.jar | bin | 0 -> 3005 bytes | |||
| -rw-r--r-- | test/952-invoke-custom-lookup/expected.txt | 10 | ||||
| -rw-r--r-- | test/952-invoke-custom-lookup/info.txt | 1 |
6 files changed, 40 insertions, 1 deletions
diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc index 91b2d0e1e3..a8ab626a62 100644 --- a/runtime/interpreter/interpreter_common.cc +++ b/runtime/interpreter/interpreter_common.cc @@ -936,7 +936,8 @@ static ObjPtr<mirror::CallSite> InvokeBootstrapMethod(Thread* self, // 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 0000000000..f3fe95c135 --- /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 Binary files differnew file mode 100644 index 0000000000..670d93dedf --- /dev/null +++ b/test/952-invoke-custom-lookup/classes.dex diff --git a/test/952-invoke-custom-lookup/classes.jar b/test/952-invoke-custom-lookup/classes.jar Binary files differnew file mode 100644 index 0000000000..aa6a1f65fa --- /dev/null +++ b/test/952-invoke-custom-lookup/classes.jar diff --git a/test/952-invoke-custom-lookup/expected.txt b/test/952-invoke-custom-lookup/expected.txt new file mode 100644 index 0000000000..0da2b866d2 --- /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 0000000000..3bfe87dfd3 --- /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). |