summaryrefslogtreecommitdiff
path: root/runtime/class_linker.cc
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2018-09-10 17:41:02 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2018-09-10 17:41:02 +0000
commit5f784bfdd0a10588249554ce89c0b084e11e0dcb (patch)
tree24b128cf7723616dbe3b1cd197ed6eb30174d9a3 /runtime/class_linker.cc
parente04da79cfca846efa5c5fe3f1a5fff94787c7ca8 (diff)
parentd7a7f2f0bf62d6ff564dd34aa41a19f016583a78 (diff)
Merge "Remove read barriers in Class::IsClassClass and Object::IsClass"
Diffstat (limited to 'runtime/class_linker.cc')
-rw-r--r--runtime/class_linker.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index b014e5262f..f355f5bada 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -431,6 +431,8 @@ bool ClassLinker::InitWithoutImage(std::vector<std::unique_ptr<const DexFile>> b
heap->IncrementDisableMovingGC(self);
StackHandleScope<64> hs(self); // 64 is picked arbitrarily.
auto class_class_size = mirror::Class::ClassClassSize(image_pointer_size_);
+ // Allocate the object as non-movable so that there are no cases where Object::IsClass returns
+ // the incorrect result when comparing to-space vs from-space.
Handle<mirror::Class> java_lang_Class(hs.NewHandle(ObjPtr<mirror::Class>::DownCast(MakeObjPtr(
heap->AllocNonMovableObject<true>(self, nullptr, class_class_size, VoidFunctor())))));
CHECK(java_lang_Class != nullptr);