1///-*-C++-*-//////////////////////////////////////////////////////////////////
2//
3// Hoard: A Fast, Scalable, and Memory-Efficient Allocator
4//        for Shared-Memory Multiprocessors
5// Contact author: Emery Berger, http://www.cs.utexas.edu/users/emery
6//
7// Copyright (c) 1998-2000, The University of Texas at Austin.
8//
9// This library is free software; you can redistribute it and/or modify
10// it under the terms of the GNU Library General Public License as
11// published by the Free Software Foundation, http://www.fsf.org.
12//
13// This library is distributed in the hope that it will be useful, but
14// WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16// Library General Public License for more details.
17//
18//////////////////////////////////////////////////////////////////////////////
19#ifndef _CONFIG_H_
20#define _CONFIG_H_
21
22#ifndef _REENTRANT
23#	define _REENTRANT		// If defined, generate a multithreaded-capable version.
24#endif
25
26#ifndef USER_LOCKS
27#	define USER_LOCKS 1		// Use our own user-level locks if they're available for the current architecture.
28#endif
29
30#define HEAP_LOG 0		// If non-zero, keep a log of heap accesses.
31
32
33///// You should not change anything below here. /////
34
35
36// The base of the exponential used for size classes.
37// An object is in size class i if
38//        base^(b+i-1) * ALIGNMENT < size <= base^(b+i) * ALIGNMENT,
39// where b = log_base(ALIGNMENT).
40// Note that this puts an upper-limit on internal fragmentation:
41//   if SIZE_CLASS_BASE is 1.2, then we will never see more than
42//   20% internal fragmentation (for aligned requests).
43
44#define SIZE_CLASS_BASE 1.2
45#define MAX_INTERNAL_FRAGMENTATION 2
46
47// The number of groups of superblocks we maintain based on what
48// fraction of the superblock is empty. NB: This number must be at
49// least 2, and is 1 greater than the EMPTY_FRACTION in heap.h.
50
51enum { SUPERBLOCK_FULLNESS_GROUP = 9 };
52
53
54// DO NOT CHANGE THESE.  They require running of maketable to replace
55// the values in heap.cpp for the _numBlocks array.
56
57#define HEAP_DEBUG 0		// If non-zero, keeps extra info for sanity checking.
58#define HEAP_STATS 0		// If non-zero, maintain blowup statistics.
59#define HEAP_FRAG_STATS 0	// If non-zero, maintain fragmentation statistics.
60
61// A simple (and slow) leak checker
62#define HEAP_LEAK_CHECK 0
63#define HEAP_CALL_STACK_SIZE 8
64
65// A simple wall checker
66#define HEAP_WALL 0
67#define HEAP_WALL_SIZE 32
68
69// CACHE_LINE = The number of bytes in a cache line.
70
71#if defined(i386) || defined(WIN32)
72#	define CACHE_LINE 32
73#endif
74
75#ifdef sparc
76#	define CACHE_LINE 64
77#endif
78
79#ifdef __sgi
80#	define CACHE_LINE 128
81#endif
82
83#ifndef CACHE_LINE
84// We don't know what the architecture is,
85// so go for the gusto.
86#define CACHE_LINE 64
87#endif
88
89#ifdef __GNUG__
90// Use the max operator, an extension to C++ found in GNU C++.
91#	define MAX(a,b) ((a) >? (b))
92#else
93#	define MAX(a,b) (((a) > (b)) ? (a) : (b))
94#endif
95
96#ifdef __HAIKU__
97#if __cplusplus >= 201103L
98#	define HAIKU_MEMORY_ALIGNMENT alignof(max_align_t)
99#else
100#	define HAIKU_MEMORY_ALIGNMENT 8
101#endif
102#endif
103
104#endif // _CONFIG_H_
105