From ca5ed9f281a5758814d2495da80178de56945720 Mon Sep 17 00:00:00 2001 From: Lokesh Gidra Date: Wed, 20 Apr 2022 01:39:28 +0000 Subject: Convert kUseReadBarrier to static const from constexpr This CL would compile both CC and userfaultfd GC in the art library, enabling us to choose either of the two during boot time depending on whether the device has userfaultfd kernel feature or not. The CC GC is still chosen unless we use ART_USE_READ_BARRIER=false during build time. This behavior will later be changed to choosing CC *only* if ART_USE_READ_BARRIER=true is used. In other cases, if the device has userfaultfd support then that GC will be chosen. Bug: 160737021 Bug: 230021033 Test: art/test/testrunner/testrunner.py Change-Id: I370f1a9f6b8cdff8c2ce3cf7aa936bccd7ed675f --- runtime/jni/java_vm_ext.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (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 f41b6c06fa..39d5729698 100644 --- a/runtime/jni/java_vm_ext.cc +++ b/runtime/jni/java_vm_ext.cc @@ -729,8 +729,8 @@ jweak JavaVMExt::AddWeakGlobalRef(Thread* self, ObjPtr obj) { MutexLock mu(self, *Locks::jni_weak_globals_lock_); // CMS needs this to block for concurrent reference processing because an object allocated during // the GC won't be marked and concurrent reference processing would incorrectly clear the JNI weak - // ref. But CC (kUseReadBarrier == true) doesn't because of the to-space invariant. - if (!kUseReadBarrier) { + // ref. But CC (gUseReadBarrier == true) doesn't because of the to-space invariant. + if (!gUseReadBarrier) { WaitForWeakGlobalsAccess(self); } std::string error_msg; @@ -809,7 +809,7 @@ void JavaVMExt::DumpForSigQuit(std::ostream& os) { } void JavaVMExt::DisallowNewWeakGlobals() { - CHECK(!kUseReadBarrier); + CHECK(!gUseReadBarrier); Thread* const self = Thread::Current(); MutexLock mu(self, *Locks::jni_weak_globals_lock_); // DisallowNewWeakGlobals is only called by CMS during the pause. It is required to have the @@ -820,7 +820,7 @@ void JavaVMExt::DisallowNewWeakGlobals() { } void JavaVMExt::AllowNewWeakGlobals() { - CHECK(!kUseReadBarrier); + CHECK(!gUseReadBarrier); Thread* self = Thread::Current(); MutexLock mu(self, *Locks::jni_weak_globals_lock_); allow_accessing_weak_globals_.store(true, std::memory_order_seq_cst); @@ -876,7 +876,7 @@ ObjPtr JavaVMExt::DecodeWeakGlobalDuringShutdown(Thread* self, I return DecodeWeakGlobal(self, ref); } // self can be null during a runtime shutdown. ~Runtime()->~ClassLinker()->DecodeWeakGlobal(). - if (!kUseReadBarrier) { + if (!gUseReadBarrier) { DCHECK(allow_accessing_weak_globals_.load(std::memory_order_seq_cst)); } return weak_globals_.SynchronizedGet(ref); -- cgit v1.2.3-59-g8ed1b