From d80bbba155fd18a38075cf6f626bee382c2b492c Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Tue, 20 Dec 2022 16:25:58 +0000 Subject: Keep classes alive for stack traces with copied methods. Test: Additional test in 141-class-unload. Test: testrunner.py --host --optimizing Bug: 263254495 Change-Id: Iea925ab96fb7c8d1b825c0b100e689ab722d3159 --- runtime/jni/java_vm_ext.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'runtime/jni/java_vm_ext.cc') diff --git a/runtime/jni/java_vm_ext.cc b/runtime/jni/java_vm_ext.cc index b4e7938e91..7ae6c99fc6 100644 --- a/runtime/jni/java_vm_ext.cc +++ b/runtime/jni/java_vm_ext.cc @@ -866,6 +866,11 @@ ObjPtr JavaVMExt::DecodeWeakGlobalLocked(Thread* self, IndirectR return weak_globals_.Get(ref); } +ObjPtr JavaVMExt::DecodeWeakGlobalAsStrong(IndirectRef ref) { + // The target is known to be alive. Simple `Get()` with read barrier is enough. + return weak_globals_.Get(ref); +} + ObjPtr JavaVMExt::DecodeWeakGlobalDuringShutdown(Thread* self, IndirectRef ref) { DCHECK_EQ(IndirectReferenceTable::GetIndirectRefKind(ref), kWeakGlobal); DCHECK(Runtime::Current()->IsShuttingDown(self)); -- cgit v1.2.3-59-g8ed1b