summaryrefslogtreecommitdiffstats
path: root/runtime/class_linker.cc
diff options
context:
space:
mode:
authorHiroshi Yamauchi <yamauchi@google.com>2014-04-03 16:28:10 -0700
committerHiroshi Yamauchi <yamauchi@google.com>2014-04-03 16:35:50 -0700
commit4cd662e54440f76fc920cb2c67acab3bba8b33dd (patch)
treee2becdc06eded96215a1c9a501004ac3889e9107 /runtime/class_linker.cc
parent5cff3083c00dfbae7b8c5c34b0bedbc514c91df9 (diff)
downloadart-4cd662e54440f76fc920cb2c67acab3bba8b33dd.zip
art-4cd662e54440f76fc920cb2c67acab3bba8b33dd.tar.gz
art-4cd662e54440f76fc920cb2c67acab3bba8b33dd.tar.bz2
Fix Object::Clone()'s pre-fence barrier.
Pass in a pre-fence barrier object that sets in the array length instead of setting it after returning from AllocObject(). Fix another potential bug due to the wrong default pre-fence barrier parameter value. Since this appears error-prone, removed the default parameter value and make it an explicit parameter. Fix another potential moving GC bug due to a lack of a SirtRef. Bug: 13097759 Change-Id: I466aa0e50f9e1a5dbf20be5a195edee619c7514e
Diffstat (limited to 'runtime/class_linker.cc')
-rw-r--r--runtime/class_linker.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 6c5406e..78b7cc0 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -202,7 +202,7 @@ void ClassLinker::InitFromCompiler(const std::vector<const DexFile*>& boot_class
// The GC can't handle an object with a null class since we can't get the size of this object.
heap->IncrementDisableMovingGC(self);
SirtRef<mirror::Class> java_lang_Class(self, down_cast<mirror::Class*>(
- heap->AllocNonMovableObject<true>(self, nullptr, sizeof(mirror::ClassClass))));
+ heap->AllocNonMovableObject<true>(self, nullptr, sizeof(mirror::ClassClass), VoidFunctor())));
CHECK(java_lang_Class.get() != NULL);
mirror::Class::SetClassClass(java_lang_Class.get());
java_lang_Class->SetClass(java_lang_Class.get());
@@ -1180,7 +1180,8 @@ mirror::DexCache* ClassLinker::AllocDexCache(Thread* self, const DexFile& dex_fi
SirtRef<mirror::Class> dex_cache_class(self, GetClassRoot(kJavaLangDexCache));
SirtRef<mirror::DexCache> dex_cache(
self, down_cast<mirror::DexCache*>(
- heap->AllocObject<true>(self, dex_cache_class.get(), dex_cache_class->GetObjectSize())));
+ heap->AllocObject<true>(self, dex_cache_class.get(), dex_cache_class->GetObjectSize(),
+ VoidFunctor())));
if (dex_cache.get() == NULL) {
return NULL;
}