[PATCH] [ASan] Use less shadow on Win 32-bit

Alexey Samsonov samsonov at google.com
Tue Jul 16 01:41:31 PDT 2013



================
Comment at: lib/asan/asan_rtl.cc:334
@@ +333,3 @@
+  kHighMemEnd = kHighMemEnd | (GetPageSizeCached() - 1);
+  while (kHighMemBeg % GetPageSizeCached())
+    kHighMemEnd += GetPageSizeCached();
----------------
Timur Iskhodzhanov wrote:
> Timur Iskhodzhanov wrote:
> > Alexey Samsonov wrote:
> > > I don't understand this loop.
> > That's covered by the above "make sure everything is fine" comment.
> > 
> >   Not only we want the kHighMemEnd to be page-aligned,
> >   we also want kHighMemBeg to be page-aligned in order to map shadow.
> > 
> > Should I add this answer to the comment?
> Ah, I see the confusion.
> 
> kHighMemBeg is defined as (drum roll please!) 
> 
>   #define kHighMemBeg     (MEM_TO_SHADOW(kHighMemEnd) + 1)
> 
> so....
> 
> Thoughts?
> How to explain that better?
I suggest to either:
(a) rename kHighMemBeg so that it's clear it is a macro (better way)
(b) clarify that kHighMemBeg depends on kHighMemEnd in a comment here.


http://llvm-reviews.chandlerc.com/D1139



More information about the llvm-commits mailing list