diff options
author | 2019-06-13 10:52:32 +0100 | |
---|---|---|
committer | 2019-06-17 09:30:53 +0000 | |
commit | 024d69fb9936ca5a0031d35c9f248853cbc25d3f (patch) | |
tree | c1eeddf91ea15eda5d139d4592ac7f0df80e9be0 /runtime/runtime.cc | |
parent | 43ae4acf219fe25a56e2055ebcebc4d08020a25d (diff) |
Use cleared JNI weak sentinel from boot image.
We were already adding the sentinel to the boot image,
so we may as well reuse the boot image copy.
Also move pre-allocated objects from class roots to the
boot image live objects.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Test: aosp_taimen-userdebug boots.
Change-Id: I635dcdd146ca2c6b55d187e9a545a9990b0b35ca
Diffstat (limited to 'runtime/runtime.cc')
-rw-r--r-- | runtime/runtime.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/runtime/runtime.cc b/runtime/runtime.cc index cda1fd9d5b..3ba888f8bb 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -1094,7 +1094,7 @@ static size_t OpenBootDexFiles(ArrayRef<const std::string> dex_filenames, return failure_count; } -void Runtime::SetSentinel(mirror::Object* sentinel) { +void Runtime::SetSentinel(ObjPtr<mirror::Object> sentinel) { CHECK(sentinel_.Read() == nullptr); CHECK(sentinel != nullptr); CHECK(!heap_->IsMovableObject(sentinel)); @@ -1612,20 +1612,23 @@ bool Runtime::Init(RuntimeArgumentMap&& runtime_options_in) { if (GetHeap()->HasBootImageSpace()) { const ImageHeader& image_header = GetHeap()->GetBootImageSpaces()[0]->GetImageHeader(); + ObjPtr<mirror::ObjectArray<mirror::Object>> boot_image_live_objects = + ObjPtr<mirror::ObjectArray<mirror::Object>>::DownCast( + image_header.GetImageRoot(ImageHeader::kBootImageLiveObjects)); pre_allocated_OutOfMemoryError_when_throwing_exception_ = GcRoot<mirror::Throwable>( - image_header.GetImageRoot(ImageHeader::kOomeWhenThrowingException)->AsThrowable()); + boot_image_live_objects->Get(ImageHeader::kOomeWhenThrowingException)->AsThrowable()); DCHECK(pre_allocated_OutOfMemoryError_when_throwing_exception_.Read()->GetClass() ->DescriptorEquals("Ljava/lang/OutOfMemoryError;")); pre_allocated_OutOfMemoryError_when_throwing_oome_ = GcRoot<mirror::Throwable>( - image_header.GetImageRoot(ImageHeader::kOomeWhenThrowingOome)->AsThrowable()); + boot_image_live_objects->Get(ImageHeader::kOomeWhenThrowingOome)->AsThrowable()); DCHECK(pre_allocated_OutOfMemoryError_when_throwing_oome_.Read()->GetClass() ->DescriptorEquals("Ljava/lang/OutOfMemoryError;")); pre_allocated_OutOfMemoryError_when_handling_stack_overflow_ = GcRoot<mirror::Throwable>( - image_header.GetImageRoot(ImageHeader::kOomeWhenHandlingStackOverflow)->AsThrowable()); + boot_image_live_objects->Get(ImageHeader::kOomeWhenHandlingStackOverflow)->AsThrowable()); DCHECK(pre_allocated_OutOfMemoryError_when_handling_stack_overflow_.Read()->GetClass() ->DescriptorEquals("Ljava/lang/OutOfMemoryError;")); pre_allocated_NoClassDefFoundError_ = GcRoot<mirror::Throwable>( - image_header.GetImageRoot(ImageHeader::kNoClassDefFoundError)->AsThrowable()); + boot_image_live_objects->Get(ImageHeader::kNoClassDefFoundError)->AsThrowable()); DCHECK(pre_allocated_NoClassDefFoundError_.Read()->GetClass() ->DescriptorEquals("Ljava/lang/NoClassDefFoundError;")); } else { |