From 324302696c0a93511fef1310d309a54ebfb25a46 Mon Sep 17 00:00:00 2001 From: Roland Levillain Date: Mon, 1 Feb 2016 15:23:20 +0000 Subject: 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 --- compiler/common_compiler_test.cc | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'compiler/common_compiler_test.cc') diff --git a/compiler/common_compiler_test.cc b/compiler/common_compiler_test.cc index afc8463878..e4bfac9ee7 100644 --- a/compiler/common_compiler_test.cc +++ b/compiler/common_compiler_test.cc @@ -122,16 +122,7 @@ void CommonCompilerTest::MakeExecutable(const void* code_start, size_t code_leng int result = mprotect(reinterpret_cast(base), len, PROT_READ | PROT_WRITE | PROT_EXEC); CHECK_EQ(result, 0); - // Flush instruction cache - // Only uses __builtin___clear_cache if GCC >= 4.3.3 -#if GCC_VERSION >= 40303 - __builtin___clear_cache(reinterpret_cast(base), reinterpret_cast(base + len)); -#else - // Only warn if not Intel as Intel doesn't have cache flush instructions. -#if !defined(__i386__) && !defined(__x86_64__) - UNIMPLEMENTED(WARNING) << "cache flush"; -#endif -#endif + FlushInstructionCache(reinterpret_cast(base), reinterpret_cast(base + len)); } void CommonCompilerTest::MakeExecutable(mirror::ClassLoader* class_loader, const char* class_name) { -- cgit v1.2.3-59-g8ed1b