diff options
author | 2024-09-24 10:45:44 +0000 | |
---|---|---|
committer | 2024-09-24 17:21:37 +0000 | |
commit | 3c4f9761bca89108b75b4d132bcb243c9a7e7f43 (patch) | |
tree | cdb8ad38db73702adc788c0a6ba9a4854437b544 /compiler/optimizing/intrinsics_x86_64.cc | |
parent | 9ff2b617341bfe574e2d8706553f0cd65a1a2fc8 (diff) |
x86_64: remove subtype check from invoke-virtual fast path.
After aosp/3248173 and aosp/3250172 a MH object with
invoke-virtual kind can target only virtual methods. As there is
callsite check against MH type no receiver checks are needed.
That's in line with JVMS 4.4.8.
Bug: 297147201
Test: ./art/test/testrunner/testrunner.py --host --64 --optimizing -b
Test: ./art/test.py --host -g
Test: CtsLibcoreTestCases
Test: CtsLibcoreOjTestCases
Change-Id: I2c12760a75b83ddf7cc21d34bcc8bb58621e6cca
Diffstat (limited to 'compiler/optimizing/intrinsics_x86_64.cc')
-rw-r--r-- | compiler/optimizing/intrinsics_x86_64.cc | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/compiler/optimizing/intrinsics_x86_64.cc b/compiler/optimizing/intrinsics_x86_64.cc index 67ef16e4a6..ba254ee705 100644 --- a/compiler/optimizing/intrinsics_x86_64.cc +++ b/compiler/optimizing/intrinsics_x86_64.cc @@ -4157,11 +4157,6 @@ void IntrinsicCodeGeneratorX86_64::VisitMethodHandleInvokeExact(HInvoke* invoke) Address method_handle_kind = Address(method_handle, mirror::MethodHandle::HandleKindOffset()); if (invoke->AsInvokePolymorphic()->CanTargetInstanceMethod()) { // Handle invoke-virtual case. - // Even if MethodHandle's kind is kInvokeVirtual, the underlying method can still be an - // interface or a direct method (that's what current `MethodHandles$Lookup.findVirtual` is - // doing). We don't check whether `method` is an interface method explicitly: in that case the - // subtype check below will fail. - // TODO(b/297147201): check whether it can be more precise and what d8/r8 can produce. __ cmpl(method_handle_kind, Immediate(mirror::MethodHandle::Kind::kInvokeVirtual)); __ j(kNotEqual, &static_dispatch); CpuRegister receiver = locations->InAt(1).AsRegister<CpuRegister>(); @@ -4173,15 +4168,7 @@ void IntrinsicCodeGeneratorX86_64::VisitMethodHandleInvokeExact(HInvoke* invoke) __ testl(Address(method, ArtMethod::AccessFlagsOffset()), Immediate(kAccPrivate)); __ j(kNotZero, &execute_target_method); - // Using vtable_index register as temporary in subtype check. It will be overridden later. - // If `method` is an interface method this check will fail. CpuRegister vtable_index = locations->GetTemp(0).AsRegister<CpuRegister>(); - // We deliberately avoid the read barrier, letting the slow path handle the false negatives. - GenerateSubTypeObjectCheckNoReadBarrier(codegen_, - slow_path, - receiver, - vtable_index, - Address(method, ArtMethod::DeclaringClassOffset())); // MethodIndex is uint16_t. __ movzxw(vtable_index, Address(method, ArtMethod::MethodIndexOffset())); |