[PATCH] D47916: [asan, myriad] Use local pool for new/delete when ASan run-time is not up

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 30 13:22:03 PDT 2019


rnk added inline comments.
Herald added a project: LLVM.


================
Comment at: compiler-rt/lib/asan/asan_malloc_local.h:35
+  if (UNLIKELY(EarlyMalloc()))\
+    return MemalignFromLocalPool(alignment, size);
+
----------------
alekseyshl wrote:
> I'd prefer to have this if in operator new and let the compiler to remove the code in non-rtems case.
> 
> Maybe for the symmetry do this:
> 
> #define ALLOCATE_FROM_LOCAL_POOL UNLIKELY(EarlyMalloc())
> #define ALLOCATE_FROM_LOCAL_POOL 0
> 
> if (ALLOCATE_FROM_LOCAL_POOL)
>   return MemalignFromLocalPool(alignment, size);
> 
> You also probably want to die in !nothrow case
> 
> if (ALLOCATE_FROM_LOCAL_POOL) {
>   void *res = MemalignFromLocalPool(alignment, size);
>   if (!nothrow) CHECK(res);
>   return res;
> }
I want to undo this change to put it in the operator new body because this code fails to link in debug builds on Windows, which I happened to do today. I'll send a review.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D47916/new/

https://reviews.llvm.org/D47916





More information about the llvm-commits mailing list