[compiler-rt] r217194 - [ASan] Remove the call to GetPageSizeCached from fast path of FastPoisonShadow

Alexey Samsonov vonosmas at gmail.com
Thu Sep 4 13:47:28 PDT 2014


Author: samsonov
Date: Thu Sep  4 15:47:27 2014
New Revision: 217194

URL: http://llvm.org/viewvc/llvm-project?rev=217194&view=rev
Log:
[ASan] Remove the call to GetPageSizeCached from fast path of FastPoisonShadow

Modified:
    compiler-rt/trunk/lib/asan/asan_poisoning.h

Modified: compiler-rt/trunk/lib/asan/asan_poisoning.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_poisoning.h?rev=217194&r1=217193&r2=217194&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_poisoning.h (original)
+++ compiler-rt/trunk/lib/asan/asan_poisoning.h Thu Sep  4 15:47:27 2014
@@ -35,7 +35,6 @@ void PoisonShadowPartialRightRedzone(upt
 ALWAYS_INLINE void FastPoisonShadow(uptr aligned_beg, uptr aligned_size,
                                     u8 value) {
   DCHECK(flags()->poison_heap);
-  uptr PageSize = GetPageSizeCached();
   uptr shadow_beg = MEM_TO_SHADOW(aligned_beg);
   uptr shadow_end = MEM_TO_SHADOW(
       aligned_beg + aligned_size - SHADOW_GRANULARITY) + 1;
@@ -48,8 +47,9 @@ ALWAYS_INLINE void FastPoisonShadow(uptr
       shadow_end - shadow_beg < common_flags()->clear_shadow_mmap_threshold) {
     REAL(memset)((void*)shadow_beg, value, shadow_end - shadow_beg);
   } else {
-    uptr page_beg = RoundUpTo(shadow_beg, PageSize);
-    uptr page_end = RoundDownTo(shadow_end, PageSize);
+    uptr page_size = GetPageSizeCached();
+    uptr page_beg = RoundUpTo(shadow_beg, page_size);
+    uptr page_end = RoundDownTo(shadow_end, page_size);
 
     if (page_beg >= page_end) {
       REAL(memset)((void *)shadow_beg, 0, shadow_end - shadow_beg);





More information about the llvm-commits mailing list