[all-commits] [llvm/llvm-project] 46240c: [scudo][standalone] Minor optimization & improvements

Kostya Kortchinsky via All-commits all-commits at lists.llvm.org
Thu Nov 21 10:05:52 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 46240c38721fe9919f9c63277bec7bbf3e62073b
      https://github.com/llvm/llvm-project/commit/46240c38721fe9919f9c63277bec7bbf3e62073b
  Author: Kostya Kortchinsky <kostyak at google.com>
  Date:   2019-11-21 (Thu, 21 Nov 2019)

  Changed paths:
    M compiler-rt/lib/scudo/standalone/combined.h
    M compiler-rt/lib/scudo/standalone/primary32.h
    M compiler-rt/lib/scudo/standalone/primary64.h

  Log Message:
  -----------
  [scudo][standalone] Minor optimization & improvements

Summary:
A few small improvements and optimizations:
- when refilling the free list, push back the last batch and return
  the front one: this allows to keep the allocations towards the front
  of the region;
- instead of using 48 entries in the shuffle array, use a multiple of
  `MaxNumCached`;
- make the maximum number of batches to create on refil a constant;
  ultimately it should be configurable, but that's for later;
- `initCache` doesn't need to zero out the cache, it's already done.
- it turns out that when using `||` or `&&`, the compiler is adamant
  on adding a short circuit for every part of the expression. Which
  ends up making somewhat annoying asm with lots of test and
  conditional jump. I am changing that to bitwise `|` or `&` in two
  place so that the generated code looks better. Added comments since
  it might feel weird to people.

This yields to some small performance gains overall, nothing drastic
though.

Reviewers: hctim, morehouse, cferris, eugenis

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D70452




More information about the All-commits mailing list