From f233136f2ca25316643b7f409df7af55a762f98a Mon Sep 17 00:00:00 2001 From: Orion Hodson Date: Wed, 11 Jul 2018 15:14:10 +0100 Subject: ART: Add FlushInstructionPipeline() Use membarrier(MEMBARRIER_CMD_PRIVATE_EXPEDITED), where available, to flush CPU instruction pipelines after JIT code cache updates. This is needed on architectures where TLB updates do not require a TLB shootdown. Bug: 65312375 Bug: 66095511 Bug: 111199492 Test: manual (requires kernel >= 4.16). Change-Id: I96811c611133ba765a546a09432c0c951ad39e10 --- libartbase/base/utils.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'libartbase/base/utils.h') diff --git a/libartbase/base/utils.h b/libartbase/base/utils.h index ba61e1b0a3..44499415f8 100644 --- a/libartbase/base/utils.h +++ b/libartbase/base/utils.h @@ -179,16 +179,19 @@ static T GetRandomNumber(T min, T max) { // Sleep forever and never come back. NO_RETURN void SleepForever(); -inline void FlushInstructionCache(char* begin, char* end) { - __builtin___clear_cache(begin, end); -} - inline void FlushDataCache(char* begin, char* end) { // Same as FlushInstructionCache for lack of other builtin. __builtin___clear_cache // flushes both caches. __builtin___clear_cache(begin, end); } +inline void FlushInstructionCache(char* begin, char* end) { + __builtin___clear_cache(begin, end); +} + +// Flush instruction pipeline. Returns true on success, false if feature is unsupported. +bool FlushInstructionPipeline(); + template constexpr PointerSize ConvertToPointerSize(T any) { if (any == 4 || any == 8) { -- cgit v1.2.3-59-g8ed1b