-
Notifications
You must be signed in to change notification settings - Fork 56
/
heaplayers.h
120 lines (89 loc) · 2.52 KB
/
heaplayers.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// -*- C++ -*-
/*
Heap Layers: An Extensible Memory Allocation Infrastructure
Copyright (C) 2000-2020 by Emery Berger
http://www.emeryberger.com
Heap Layers is distributed under the terms of the Apache 2.0 license.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
*/
/**
* @file heaplayers.h
* @brief The master Heap Layers include file.
*
* Heap Layers is an extensible memory allocator infrastructure. For
* more information, read the PLDI 2001 paper "Composing
* High-Performance Memory Allocators", by Emery D. Berger, Benjamin
* G. Zorn, and Kathryn S. McKinley.
* (http://citeseer.ist.psu.edu/berger01composing.html)
*/
#ifndef HL_HEAPLAYERS_H
#define HL_HEAPLAYERS_H
#include <assert.h>
namespace HL {}
// Define HL_EXECUTABLE_HEAP as 1 if you want that (i.e., you're doing
// dynamic code generation).
// #define HL_EXECUTABLE_HEAP 1
#if !defined(HL_EXECUTABLE_HEAP)
#define HL_EXECUTABLE_HEAP 0
#endif
// Define HL_NAMED_HEAP as 1 to id an address range (on Linux)
// #define HL_NAMED_HEAP 1
#if !defined(HL_HEAP_NAME)
#define HL_HEAP_NAME "Heap Layers"
#endif
#if defined(_MSC_VER)
// Microsoft Visual Studio
#pragma inline_depth(255)
#define INLINE __forceinline
//#define inline __forceinline
#define NO_INLINE __declspec(noinline)
#pragma warning(disable: 4530)
#define MALLOC_FUNCTION
#define RESTRICT
#elif defined(__GNUC__)
// GNU C
#define NO_INLINE __attribute__ ((noinline))
#define INLINE inline
#define MALLOC_FUNCTION __attribute__((malloc))
#define RESTRICT __restrict__
#else
// All others
#define NO_INLINE
#define INLINE inline
#define MALLOC_FUNCTION
#define RESTRICT
#endif
/**
* @def ALLOCATION_STATS
*
* Defining ALLOCATION_STATS below as 1 enables tracking of allocation
* statistics in a variety of layers. You then must link in
* definitions of the extern variables used therein; stats.cpp
* contains these definitions.
*
* This should be undefined for all but experimental use.
*
*/
#ifndef ALLOCATION_STATS
#define ALLOCATION_STATS 0
#endif
#ifdef _MSC_VER
// 4786: Disable warnings about long (> 255 chars) identifiers.
// 4512: Disable warnings about assignment operators.
#pragma warning( push )
#pragma warning( disable:4786 4512 )
#endif
#if !defined(HL_USE_XXREALLOC)
#define HL_USE_XXREALLOC 0
#endif
#include "utility/all.h"
#include "heaps/all.h"
#include "locks/all.h"
#include "threads/all.h"
#include "wrappers/all.h"
#ifdef _MSC_VER
#pragma warning( pop )
#endif
#endif // _HEAPLAYERS_H_