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 --- libartbase/base/utils.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libartbase/base/utils.h') diff --git a/libartbase/base/utils.h b/libartbase/base/utils.h index 0e8231a92c..90eb2daa4d 100644 --- a/libartbase/base/utils.h +++ b/libartbase/base/utils.h @@ -31,6 +31,10 @@ #include "globals.h" #include "macros.h" +#if defined(__linux__) +#include +#endif + namespace art { static inline uint32_t PointerToLowMemUInt32(const void* p) { @@ -125,6 +129,10 @@ NO_RETURN void SleepForever(); // Flush CPU caches. Returns true on success, false if flush failed. WARN_UNUSED bool FlushCpuCaches(void* begin, void* end); +#if defined(__linux__) +bool IsKernelVersionAtLeast(int reqd_major, int reqd_minor); +#endif + // On some old kernels, a cache operation may segfault. WARN_UNUSED bool CacheOperationsMaySegFault(); -- cgit v1.2.3-59-g8ed1b