[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
Mon May 13 11:14:55 PDT 2019


rnk added inline comments.


================
Comment at: compiler-rt/lib/asan/asan_malloc_local.h:35
+  if (UNLIKELY(EarlyMalloc()))\
+    return MemalignFromLocalPool(alignment, size);
+
----------------
dmajor wrote:
> rnk wrote:
> > 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.
> > 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.
> 
> Out of curiosity, did this end up happening?
Unfortunately, no, I didn't end up finding time to do it. Want to take a stab at it?


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