diff options
author | 2019-07-05 13:26:11 +0100 | |
---|---|---|
committer | 2019-07-16 08:22:46 +0000 | |
commit | 7cde45800e21c270945b43a8989334ffc7422c32 (patch) | |
tree | 61f04cf955031cf5e38211e7c7d09fee00f10e30 /compiler/optimizing/sharpening.cc | |
parent | 6b63d8832a780e8b661595ff0b0610b3cc52aa6a (diff) |
Further clean up boot image address checks.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Test: aosp_taimen-userdebug boots.
Change-Id: Ib7abd10e94e995e61549b3a3111a640802b5e700
Diffstat (limited to 'compiler/optimizing/sharpening.cc')
-rw-r--r-- | compiler/optimizing/sharpening.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/compiler/optimizing/sharpening.cc b/compiler/optimizing/sharpening.cc index 03d277f648..77b41abf7d 100644 --- a/compiler/optimizing/sharpening.cc +++ b/compiler/optimizing/sharpening.cc @@ -38,15 +38,15 @@ namespace art { static bool IsInBootImage(ArtMethod* method) { - const std::vector<gc::space::ImageSpace*>& image_spaces = - Runtime::Current()->GetHeap()->GetBootImageSpaces(); - for (gc::space::ImageSpace* image_space : image_spaces) { - const ImageSection& method_section = image_space->GetImageHeader().GetMethodsSection(); - if (method_section.Contains(reinterpret_cast<uint8_t*>(method) - image_space->Begin())) { - return true; - } - } - return false; + gc::Heap* heap = Runtime::Current()->GetHeap(); + DCHECK_EQ(heap->IsBootImageAddress(method), + std::any_of(heap->GetBootImageSpaces().begin(), + heap->GetBootImageSpaces().end(), + [=](gc::space::ImageSpace* space) REQUIRES_SHARED(Locks::mutator_lock_) { + return space->GetImageHeader().GetMethodsSection().Contains( + reinterpret_cast<uint8_t*>(method) - space->Begin()); + })); + return heap->IsBootImageAddress(method); } static bool BootImageAOTCanEmbedMethod(ArtMethod* method, const CompilerOptions& compiler_options) { |