From df68c0a6f0d36728fa728049e5bcec20de2d0d5e Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Tue, 3 Jan 2023 14:01:00 +0000 Subject: Write classes in runtime-generated app image. Test: 845-data-image Bug: 260557058 Change-Id: I640b78942984ac3d3f8d24abda619d78154acd86 --- runtime/class_linker.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'runtime/class_linker.cc') diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index a2f451347a..b829f5916c 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -2180,9 +2180,11 @@ bool ClassLinker::AddImageSpace( ObjPtr klass(root.Read()); // Do not update class loader for boot image classes where the app image // class loader is only the initiating loader but not the defining loader. - // Avoid read barrier since we are comparing against null. - if (klass->GetClassLoader() != nullptr) { + if (space->HasAddress(klass.Ptr())) { klass->SetClassLoader(loader); + } else { + DCHECK(klass->IsBootStrapClassLoaded()); + DCHECK(Runtime::Current()->GetHeap()->ObjectIsInBootImageSpace(klass.Ptr())); } } } -- cgit v1.2.3-59-g8ed1b