Support system server ART-profiling
We don't have to map the code cache as executable if we only want to save
profiles. This enables system server profiling without disabling SElinux
to bypass the jit code cache exec-mapping.
Test: m test-art-host
boot a device with system server profiling enabled.
Bug: 73313191
Change-Id: I7f25a905e0b23456183e39e58ad8f4b829ddf0c5
diff --git a/runtime/jit/jit_code_cache.h b/runtime/jit/jit_code_cache.h
index f1c99fb..b10f57e 100644
--- a/runtime/jit/jit_code_cache.h
+++ b/runtime/jit/jit_code_cache.h
@@ -68,6 +68,7 @@
namespace jit {
class JitInstrumentationCache;
+class ScopedCodeCacheWrite;
// Alignment in bits that will suit all architectures.
static constexpr int kJitCodeAlignment = 16;
@@ -88,6 +89,7 @@
static JitCodeCache* Create(size_t initial_capacity,
size_t max_capacity,
bool generate_debug_info,
+ bool used_only_for_profile_data,
std::string* error_msg);
~JitCodeCache();
@@ -270,7 +272,8 @@
size_t initial_code_capacity,
size_t initial_data_capacity,
size_t max_capacity,
- bool garbage_collect_code);
+ bool garbage_collect_code,
+ int memmap_flags_prot_code);
// Internal version of 'CommitCode' that will not retry if the
// allocation fails. Return null if the allocation fails.
@@ -442,7 +445,12 @@
// Condition to wait on for accessing inline caches.
ConditionVariable inline_cache_cond_ GUARDED_BY(lock_);
+ // Mapping flags for the code section.
+ const int memmap_flags_prot_code_;
+
friend class art::JitJniStubTestHelper;
+ friend class ScopedCodeCacheWrite;
+
DISALLOW_IMPLICIT_CONSTRUCTORS(JitCodeCache);
};