jni: Add read barrier fast path to jni compiler
Static method dispatch via JNI requires a read barrier
for the ArtMethod::GetDeclaringClass() load before adding it to the
JNI StackHandleScope.
We used to call ReadBarrierJni unconditionally but add a branch
to skip calling it if the GC is not currently in the marking phase.
Test: ART_USE_READ_BARRIER=true make test-art-host test-art-target
Bug: 30437917
Change-Id: I4f505ebde17c0a67209c7bb51b3f39e37a06373a
diff --git a/runtime/thread.h b/runtime/thread.h
index 376a69c..6f5913e 100644
--- a/runtime/thread.h
+++ b/runtime/thread.h
@@ -570,6 +570,10 @@
OFFSETOF_MEMBER(tls_32bit_sized_values, is_gc_marking));
}
+ static constexpr size_t IsGcMarkingSize() {
+ return sizeof(tls32_.is_gc_marking);
+ }
+
// Deoptimize the Java stack.
void DeoptimizeWithDeoptimizationException(JValue* result) REQUIRES_SHARED(Locks::mutator_lock_);