1 //===-- allocator_config.h --------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef SCUDO_ALLOCATOR_CONFIG_H_
10 #define SCUDO_ALLOCATOR_CONFIG_H_
15 #include "primary32.h"
16 #include "primary64.h"
17 #include "size_class_map.h"
18 #include "tsd_exclusive.h"
19 #include "tsd_shared.h"
23 // Default configurations for various platforms.
25 struct DefaultConfig {
26 using SizeClassMap = DefaultSizeClassMap;
27 #if SCUDO_CAN_USE_PRIMARY64
29 typedef SizeClassAllocator64<SizeClassMap, 30U> Primary;
32 typedef SizeClassAllocator32<SizeClassMap, 19U> Primary;
34 template <class A> using TSDRegistryT = TSDRegistryExT<A>; // Exclusive
37 struct AndroidConfig {
38 using SizeClassMap = AndroidSizeClassMap;
39 #if SCUDO_CAN_USE_PRIMARY64
41 typedef SizeClassAllocator64<SizeClassMap, 30U> Primary;
44 typedef SizeClassAllocator32<SizeClassMap, 19U> Primary;
47 using TSDRegistryT = TSDRegistrySharedT<A, 2U>; // Shared, max 2 TSDs.
50 struct AndroidSvelteConfig {
51 using SizeClassMap = SvelteSizeClassMap;
52 #if SCUDO_CAN_USE_PRIMARY64
54 typedef SizeClassAllocator64<SizeClassMap, 29U> Primary;
57 typedef SizeClassAllocator32<SizeClassMap, 18U> Primary;
60 using TSDRegistryT = TSDRegistrySharedT<A, 1U>; // Shared, only 1 TSD.
63 struct FuchsiaConfig {
65 typedef SizeClassAllocator64<DefaultSizeClassMap, 30U> Primary;
67 using TSDRegistryT = TSDRegistrySharedT<A, 8U>; // Shared, max 8 TSDs.
71 typedef AndroidConfig Config;
73 typedef FuchsiaConfig Config;
75 typedef DefaultConfig Config;
80 #endif // SCUDO_ALLOCATOR_CONFIG_H_