diff options
| author | 2016-02-17 11:59:05 -0800 | |
|---|---|---|
| committer | 2016-02-17 13:02:11 -0800 | |
| commit | fcea56f9cc51957161fe7a6e35e895fd8c4c4a7f (patch) | |
| tree | b43c197e9370eab38a58e1d54ec319ea45df613d /compiler | |
| parent | aaf56c4c95331d4dd8ac298e6c234d4d58d28308 (diff) | |
Fix issue with copied methods not being checked.
In several places we were using IsMiranda to check if a method is
copied. This misses cases involving default methods.
Bug: 27216437
Change-Id: I8c800e3e622a9c0ca0f8752c3d5202f433af9a1c
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/image_writer.cc | 4 | ||||
| -rw-r--r-- | compiler/oat_test.cc | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc index 73574ba673..2e9e2879a6 100644 --- a/compiler/image_writer.cc +++ b/compiler/image_writer.cc @@ -907,10 +907,10 @@ void ImageWriter::PruneNonImageClasses() { mirror::DexCache::GetElementPtrSize(resolved_methods, i, target_ptr_size_); DCHECK(method != nullptr) << "Expected resolution method instead of null method"; mirror::Class* declaring_class = method->GetDeclaringClass(); - // Miranda methods may be held live by a class which was not an image class but have a + // Copied methods may be held live by a class which was not an image class but have a // declaring class which is an image class. Set it to the resolution method to be safe and // prevent dangling pointers. - if (method->IsMiranda() || !KeepClass(declaring_class)) { + if (method->MightBeCopied() || !KeepClass(declaring_class)) { mirror::DexCache::SetElementPtrSize(resolved_methods, i, resolution_method, diff --git a/compiler/oat_test.cc b/compiler/oat_test.cc index 894d29ee99..d3b404a3b6 100644 --- a/compiler/oat_test.cc +++ b/compiler/oat_test.cc @@ -415,7 +415,9 @@ TEST_F(OatTest, WriteRead) { size_t visited_virtuals = 0; // TODO We should also check copied methods in this test. for (auto& m : klass->GetDeclaredVirtualMethods(pointer_size)) { - EXPECT_FALSE(m.IsMiranda()); + if (!klass->IsInterface()) { + EXPECT_FALSE(m.MightBeCopied()); + } CheckMethod(&m, oat_class.GetOatMethod(method_index), dex_file); ++method_index; ++visited_virtuals; |