[all-commits] [llvm/llvm-project] 2dc9ec: [scudo] Refactor allocator config to support optio...

ChiaHungDuan via All-commits all-commits at lists.llvm.org
Wed Mar 13 16:05:45 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2dc9ec47fb16a01c8f7cbb76fba4ad00ac4cb81b
      https://github.com/llvm/llvm-project/commit/2dc9ec47fb16a01c8f7cbb76fba4ad00ac4cb81b
  Author: ChiaHungDuan <chiahungduan at google.com>
  Date:   2024-03-13 (Wed, 13 Mar 2024)

  Changed paths:
    M compiler-rt/lib/scudo/standalone/CMakeLists.txt
    A compiler-rt/lib/scudo/standalone/allocator_config.def
    M compiler-rt/lib/scudo/standalone/allocator_config.h
    A compiler-rt/lib/scudo/standalone/allocator_config_wrapper.h
    M compiler-rt/lib/scudo/standalone/combined.h
    M compiler-rt/lib/scudo/standalone/condition_variable.h
    M compiler-rt/lib/scudo/standalone/memtag.h
    M compiler-rt/lib/scudo/standalone/primary32.h
    M compiler-rt/lib/scudo/standalone/primary64.h
    M compiler-rt/lib/scudo/standalone/secondary.h
    M compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
    A compiler-rt/lib/scudo/standalone/tests/allocator_config_test.cpp
    M compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
    M compiler-rt/lib/scudo/standalone/tests/primary_test.cpp
    M compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp

  Log Message:
  -----------
  [scudo] Refactor allocator config to support optional flags (#81805)

Instead of explicitly disabling a feature by declaring the variable and
set it to false, this change supports the optional flags. I.e., you can
skip certain flags if you are not using it.

This optional feature supports both forms,
  1. Value: A parameter for a feature. E.g., EnableRandomOffset
  2. Type: A C++ type implementing a feature. E.g., ConditionVariableT

On the other hand, to access the flags will be through one of the
wrappers, BaseConfig/PrimaryConfig/SecondaryConfig/CacheConfig
(CacheConfig is embedded in SecondaryConfig). These wrappers have the
getters to access the value and the type. When adding a new feature, we
need to add it to `allocator_config.def` and mark the new variable with
either *_REQUIRED_* or *_OPTIONAL_* macro so that the accessor will be
generated properly.

In addition, also remove the need of `UseConditionVariable` to flip
on/off of condition variable. Now we only need to define the type of
condition variable.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list