Make class loaders weak roots
Making the class loaders weak roots in the class linker prevents them
from keeping the classes as live. However we currently do mark them
as strong roots to make sure no accidental class unloading occurs
until the logic to free from linear alloc is complete.
Bug: 22720414
Change-Id: I57466236d9ce6fd064dda9a30ce8ab68094fb8b0
diff --git a/runtime/java_vm_ext.cc b/runtime/java_vm_ext.cc
index d6c798a..92eef39 100644
--- a/runtime/java_vm_ext.cc
+++ b/runtime/java_vm_ext.cc
@@ -592,6 +592,7 @@
// This only applies in the case where MayAccessWeakGlobals goes from false to true. In the other
// case, it may be racy, this is benign since DecodeWeakGlobalLocked does the correct behavior
// if MayAccessWeakGlobals is false.
+ DCHECK_EQ(GetIndirectRefKind(ref), kWeakGlobal);
if (LIKELY(MayAccessWeakGlobalsUnlocked(self))) {
return weak_globals_.SynchronizedGet(ref);
}