Ensure instruction cache is flushed in compiler tests with Clang.
Invoke __builtin___clear_cache with Clang in
art::CommonCompilerTest::MakeExecutable. This fixes
"Illegal instruction" failures in codegen_test on angler.
Factor this logic in a function and use it in
art::jit::JitCodeCache::CommitCodeInternal too.
Bug: 26786447
Change-Id: I81fa056c8d7c6bf2168c9340deeab82231cb1084
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc
index b0e5fde..f325949 100644
--- a/runtime/jit/jit_code_cache.cc
+++ b/runtime/jit/jit_code_cache.cc
@@ -321,8 +321,8 @@
code_size);
}
- __builtin___clear_cache(reinterpret_cast<char*>(code_ptr),
- reinterpret_cast<char*>(code_ptr + code_size));
+ FlushInstructionCache(reinterpret_cast<char*>(code_ptr),
+ reinterpret_cast<char*>(code_ptr + code_size));
number_of_compilations_++;
}
// We need to update the entry point in the runnable state for the instrumentation.