From 25b9c7da44cd4652aa2ba26aa105509a6d035632 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Thu, 17 Sep 2020 17:34:34 +0100 Subject: Don't store copied methods in BSS. Otherwise, we can end up in a state where the method on the stack is unrelated to the receiver. Also fix a comment related to GetCanonicalMethod and StackVisitor::ValidateFrame. Test: 810-checker-invoke-super-default Change-Id: I3030e4af6059f7a4a7a1f046f2aabae8ce9057da --- compiler/optimizing/instruction_builder.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'compiler/optimizing/instruction_builder.cc') diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc index ab28e4b86f..e9d1ee2e0b 100644 --- a/compiler/optimizing/instruction_builder.cc +++ b/compiler/optimizing/instruction_builder.cc @@ -964,7 +964,9 @@ static ArtMethod* ResolveMethod(uint16_t method_idx, // could resolve the callee to the wrong method. return nullptr; } - resolved_method = actual_method; + // Call GetCanonicalMethod in case the resolved method is a copy: for super calls, the encoding + // of ArtMethod in BSS relies on not having copies there. + resolved_method = actual_method->GetCanonicalMethod(class_linker->GetImagePointerSize()); } if (*invoke_type == kInterface) { -- cgit v1.2.3-59-g8ed1b