[compiler-rt] r291510 - Bypass quarantine when quarantine size is set ot zero.
Kostya Serebryany via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 10 16:41:58 PST 2017
is a test possible here?
On Mon, Jan 9, 2017 at 3:49 PM, Alex Shlyapnikov via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: alekseyshl
> Date: Mon Jan 9 17:49:15 2017
> New Revision: 291510
>
> URL: http://llvm.org/viewvc/llvm-project?rev=291510&view=rev
> Log:
> Bypass quarantine when quarantine size is set ot zero.
>
> Modified:
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_quarantine.h
>
> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_quarantine.h
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/
> sanitizer_common/sanitizer_quarantine.h?rev=291510&r1=
> 291509&r2=291510&view=diff
> ============================================================
> ==================
> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_quarantine.h
> (original)
> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_quarantine.h Mon
> Jan 9 17:49:15 2017
> @@ -49,6 +49,10 @@ class Quarantine {
> }
>
> void Init(uptr size, uptr cache_size) {
> + // Thread local quarantine size can be zero only when global
> quarantine size
> + // is zero (it allows us to perform just one atomic read per Put()
> call).
> + CHECK((size == 0 && cache_size == 0) || cache_size != 0);
> +
> atomic_store(&max_size_, size, memory_order_relaxed);
> atomic_store(&min_size_, size / 10 * 9,
> memory_order_relaxed); // 90% of max size.
> @@ -61,8 +65,15 @@ class Quarantine {
> }
>
> void Put(Cache *c, Callback cb, Node *ptr, uptr size) {
> - c->Enqueue(cb, ptr, size);
> - if (c->Size() > GetCacheSize())
> + uptr cache_size = GetCacheSize();
> + if (cache_size) {
> + c->Enqueue(cb, ptr, size);
> + } else {
> + // cache_size == 0 only when size == 0 (see Init).
> + cb.Recycle(ptr);
> + }
> + // Check cache size anyway to accommodate for runtime cache_size
> change.
> + if (c->Size() > cache_size)
> Drain(c, cb);
> }
>
> @@ -207,6 +218,7 @@ class QuarantineCache {
> return b;
> }
> };
> +
> } // namespace __sanitizer
>
> #endif // SANITIZER_QUARANTINE_H
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170110/66a57afe/attachment.html>
More information about the llvm-commits
mailing list