diff options
| -rw-r--r-- | runtime/gc/heap.cc | 6 | ||||
| -rw-r--r-- | runtime/gc/space/image_space.cc | 6 | ||||
| -rw-r--r-- | runtime/mirror/dex_cache-inl.h | 10 | ||||
| -rw-r--r-- | runtime/mirror/dex_cache.h | 4 | ||||
| -rw-r--r-- | runtime/read_barrier.h | 3 | ||||
| -rw-r--r-- | test/566-polymorphic-inlining/polymorphic_inline.cc | 2 |
6 files changed, 17 insertions, 14 deletions
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc index 84483b4370..d76a8d149f 100644 --- a/runtime/gc/heap.cc +++ b/runtime/gc/heap.cc @@ -357,7 +357,11 @@ Heap::Heap(size_t initial_size, std::unique_ptr<MemMap> main_mem_map_2; // Gross hack to make dex2oat deterministic. - if (requested_alloc_space_begin == nullptr && Runtime::Current()->IsAotCompiler()) { + if (foreground_collector_type_ == kCollectorTypeMS && + requested_alloc_space_begin == nullptr && + Runtime::Current()->IsAotCompiler()) { + // Currently only enabled for MS collector since that is what the deterministic dex2oat uses. + // b/26849108 requested_alloc_space_begin = reinterpret_cast<uint8_t*>(kAllocSpaceBeginForDeterministicAoT); } uint8_t* request_begin = requested_alloc_space_begin; diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc index 891e280ab2..f6079232bf 100644 --- a/runtime/gc/space/image_space.cc +++ b/runtime/gc/space/image_space.cc @@ -1041,7 +1041,7 @@ static bool RelocateInPlace(ImageHeader& image_header, auto* dex_caches = image_header.GetImageRoot<kWithoutReadBarrier>(ImageHeader::kDexCaches)-> AsObjectArray<mirror::DexCache>(); for (int32_t i = 0, count = dex_caches->GetLength(); i < count; ++i) { - mirror::DexCache* dex_cache = dex_caches->Get(i); + mirror::DexCache* dex_cache = dex_caches->Get<kVerifyNone, kWithoutReadBarrier>(i); // Fix up dex cache pointers. GcRoot<mirror::String>* strings = dex_cache->GetStrings(); if (strings != nullptr) { @@ -1049,7 +1049,7 @@ static bool RelocateInPlace(ImageHeader& image_header, if (strings != new_strings) { dex_cache->SetFieldPtr64<false>(mirror::DexCache::StringsOffset(), new_strings); } - dex_cache->FixupStrings(new_strings, fixup_adapter); + dex_cache->FixupStrings<kWithoutReadBarrier>(new_strings, fixup_adapter); } GcRoot<mirror::Class>* types = dex_cache->GetResolvedTypes(); if (types != nullptr) { @@ -1057,7 +1057,7 @@ static bool RelocateInPlace(ImageHeader& image_header, if (types != new_types) { dex_cache->SetFieldPtr64<false>(mirror::DexCache::ResolvedTypesOffset(), new_types); } - dex_cache->FixupResolvedTypes(new_types, fixup_adapter); + dex_cache->FixupResolvedTypes<kWithoutReadBarrier>(new_types, fixup_adapter); } ArtMethod** methods = dex_cache->GetResolvedMethods(); if (methods != nullptr) { diff --git a/runtime/mirror/dex_cache-inl.h b/runtime/mirror/dex_cache-inl.h index 2ecc9fb1a8..2da3d8479c 100644 --- a/runtime/mirror/dex_cache-inl.h +++ b/runtime/mirror/dex_cache-inl.h @@ -142,12 +142,11 @@ inline void DexCache::VisitReferences(mirror::Class* klass, const Visitor& visit } } -template <typename Visitor> +template <ReadBarrierOption kReadBarrierOption, typename Visitor> inline void DexCache::FixupStrings(GcRoot<mirror::String>* dest, const Visitor& visitor) { GcRoot<mirror::String>* src = GetStrings(); for (size_t i = 0, count = NumStrings(); i < count; ++i) { - // TODO: Probably don't need read barrier for most callers. - mirror::String* source = src[i].Read(); + mirror::String* source = src[i].Read<kReadBarrierOption>(); mirror::String* new_source = visitor(source); if (source != new_source) { dest[i] = GcRoot<mirror::String>(new_source); @@ -155,12 +154,11 @@ inline void DexCache::FixupStrings(GcRoot<mirror::String>* dest, const Visitor& } } -template <typename Visitor> +template <ReadBarrierOption kReadBarrierOption, typename Visitor> inline void DexCache::FixupResolvedTypes(GcRoot<mirror::Class>* dest, const Visitor& visitor) { GcRoot<mirror::Class>* src = GetResolvedTypes(); for (size_t i = 0, count = NumResolvedTypes(); i < count; ++i) { - // TODO: Probably don't need read barrier for most callers. - mirror::Class* source = src[i].Read(); + mirror::Class* source = src[i].Read<kReadBarrierOption>(); mirror::Class* new_source = visitor(source); if (source != new_source) { dest[i] = GcRoot<mirror::Class>(new_source); diff --git a/runtime/mirror/dex_cache.h b/runtime/mirror/dex_cache.h index 0002076ce0..7912510f98 100644 --- a/runtime/mirror/dex_cache.h +++ b/runtime/mirror/dex_cache.h @@ -61,11 +61,11 @@ class MANAGED DexCache FINAL : public Object { void Fixup(ArtMethod* trampoline, size_t pointer_size) SHARED_REQUIRES(Locks::mutator_lock_); - template <typename Visitor> + template <ReadBarrierOption kReadBarrierOption = kWithReadBarrier, typename Visitor> void FixupStrings(GcRoot<mirror::String>* dest, const Visitor& visitor) SHARED_REQUIRES(Locks::mutator_lock_); - template <typename Visitor> + template <ReadBarrierOption kReadBarrierOption = kWithReadBarrier, typename Visitor> void FixupResolvedTypes(GcRoot<mirror::Class>* dest, const Visitor& visitor) SHARED_REQUIRES(Locks::mutator_lock_); diff --git a/runtime/read_barrier.h b/runtime/read_barrier.h index 3169a8bd54..77be6cf71e 100644 --- a/runtime/read_barrier.h +++ b/runtime/read_barrier.h @@ -80,8 +80,7 @@ class ReadBarrier { static void AssertToSpaceInvariant(GcRootSource* gc_root_source, mirror::Object* ref) SHARED_REQUIRES(Locks::mutator_lock_); - ALWAYS_INLINE static mirror::Object* Mark(mirror::Object* obj) - SHARED_REQUIRES(Locks::mutator_lock_); + static mirror::Object* Mark(mirror::Object* obj) SHARED_REQUIRES(Locks::mutator_lock_); static mirror::Object* WhitePtr() { return reinterpret_cast<mirror::Object*>(white_ptr_); diff --git a/test/566-polymorphic-inlining/polymorphic_inline.cc b/test/566-polymorphic-inlining/polymorphic_inline.cc index 5801b36740..55eac5c30a 100644 --- a/test/566-polymorphic-inlining/polymorphic_inline.cc +++ b/test/566-polymorphic-inlining/polymorphic_inline.cc @@ -29,6 +29,8 @@ static void do_checks(jclass cls, const char* method_name) { jit::Jit* jit = Runtime::Current()->GetJit(); jit::JitCodeCache* code_cache = jit->GetCodeCache(); ArtMethod* method = klass->FindDeclaredDirectMethodByName(method_name, sizeof(void*)); + jit->CompileMethod(method, soa.Self()); + OatQuickMethodHeader* header = OatQuickMethodHeader::FromEntryPoint( method->GetEntryPointFromQuickCompiledCode()); CHECK(code_cache->ContainsPc(header->GetCode())); |