[compiler-rt] r290453 - Revert "[XRay][AArch64] An attempt to fix test patching-unpatching.cc by flushing the instruction cache after code modification"

Renato Golin via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 23 13:58:39 PST 2016


Author: rengolin
Date: Fri Dec 23 15:58:39 2016
New Revision: 290453

URL: http://llvm.org/viewvc/llvm-project?rev=290453&view=rev
Log:
Revert "[XRay][AArch64] An attempt to fix test patching-unpatching.cc by flushing the instruction cache after code modification"

This reverts commit r290452, not quite there yet. We need to test this
offline.

Modified:
    compiler-rt/trunk/lib/xray/xray_AArch64.cc
    compiler-rt/trunk/test/xray/TestCases/Linux/patching-unpatching.cc

Modified: compiler-rt/trunk/lib/xray/xray_AArch64.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_AArch64.cc?rev=290453&r1=290452&r2=290453&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_AArch64.cc (original)
+++ compiler-rt/trunk/lib/xray/xray_AArch64.cc Fri Dec 23 15:58:39 2016
@@ -19,8 +19,6 @@
 #include <atomic>
 #include <cassert>
 
-extern void __clear_cache(void* start, void* end);
-
 namespace __xray {
 
 uint64_t cycleFrequency() XRAY_NEVER_INSTRUMENT {
@@ -77,8 +75,8 @@ inline static bool patchSled(const bool
   //   B #32
 
   uint32_t *FirstAddress = reinterpret_cast<uint32_t *>(Sled.Address);
-  uint32_t *CurAddress = FirstAddress + 1;
   if (Enable) {
+    uint32_t *CurAddress = FirstAddress + 1;
     *CurAddress = uint32_t(PatchOpcodes::PO_LdrW0_12);
     CurAddress++;
     *CurAddress = uint32_t(PatchOpcodes::PO_LdrX16_12);
@@ -90,7 +88,6 @@ inline static bool patchSled(const bool
     *reinterpret_cast<void (**)()>(CurAddress) = TracingHook;
     CurAddress += 2;
     *CurAddress = uint32_t(PatchOpcodes::PO_LdpX0X30SP_16);
-    CurAddress++;
     std::atomic_store_explicit(
         reinterpret_cast<std::atomic<uint32_t> *>(FirstAddress),
         uint32_t(PatchOpcodes::PO_StpX0X30SP_m16e), std::memory_order_release);
@@ -99,8 +96,6 @@ inline static bool patchSled(const bool
         reinterpret_cast<std::atomic<uint32_t> *>(FirstAddress),
         uint32_t(PatchOpcodes::PO_B32), std::memory_order_release);
   }
-  __clear_cache(reinterpret_cast<char*>(FirstAddress),
-      reinterpret_cast<char*>(CurAddress));
   return true;
 }
 

Modified: compiler-rt/trunk/test/xray/TestCases/Linux/patching-unpatching.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/xray/TestCases/Linux/patching-unpatching.cc?rev=290453&r1=290452&r2=290453&view=diff
==============================================================================
--- compiler-rt/trunk/test/xray/TestCases/Linux/patching-unpatching.cc (original)
+++ compiler-rt/trunk/test/xray/TestCases/Linux/patching-unpatching.cc Fri Dec 23 15:58:39 2016
@@ -3,6 +3,7 @@
 //
 // RUN: %clangxx_xray -fxray-instrument -std=c++11 %s -o %t
 // RUN: XRAY_OPTIONS="patch_premain=false" %run %t 2>&1 | FileCheck %s
+// REQUIRES: stable-runtime
 
 #include "xray/xray_interface.h"
 




More information about the llvm-commits mailing list