Debian Codegraph @

vendor/Heap-Layers/heaps/combining/hybridheap.h

raw symbols SCIP
1 // -*- C++ -*-cxx . . $ `<file>/vendor/Heap-Layers/heaps/combining/hybridheap.h`/
2
3 /*
4
5 Heap Layers: An Extensible Memory Allocation Infrastructure
6
7 Copyright (C) 2000-2020 by Emery Berger
8 http://www.emeryberger.com
9 [email protected]
10
11 Heap Layers is distributed under the terms of the Apache 2.0 license.
12
13 You may obtain a copy of the License at
14 http://www.apache.org/licenses/LICENSE-2.0
15
16 */
17
18 #ifndef HL_HYBRIDHEAP_H
19 #define HL_HYBRIDHEAP_Hcxx . . $ `vendor/Heap-Layers/heaps/combining/hybridheap.h:19:9`!
20
21 #include <assert.h>
22
23 #include "heaplayers.h"cxx . . $ `<file>/vendor/Heap-Layers/heaplayers.h`/
24
25 /**
26 * @class HybridHeap
27 * Objects no bigger than BigSize are allocated and freed to SmallHeap.
28 * Bigger objects are passed on to the super heap.
29 */
30
31 namespace HLcxx . . $ HL/ {
32
33 template <int BigSize, class SmallHeap, class BigHeap>
34 class HybridHeapcxx . . $ HL/HybridHeap# : public SmallHeap {
35 public:
36
37 HybridHeapcxx . . $ HL/HybridHeap#`HybridHeap<BigSize, SmallHeap, BigHeap>`(49f6e7a06ebc5aa8). (void)
38 {
39 static_assert(BigSize > 0, "Large object size must be positive.");
40 }
41
42 enumcxx . . $ HL/HybridHeap#$anonymous_type_0# { Alignmentcxx . . $ HL/HybridHeap#Alignment. = gcdcxx . . $ HL/gcd#<(int) SmallHeap::Alignment, (int) BigHeap::Alignment>::value };
43
44 MALLOC_FUNCTIONcxx . . $ `vendor/Heap-Layers/heaplayers.h:68:9`! INLINEcxx . . $ `vendor/Heap-Layers/heaplayers.h:67:9`! void * malloccxx . . $ HL/HybridHeap#malloc(bfcfa4d6b7f7ef64). (size_t sz) {
45 void * ptr;
46 if (sz <= BigSize) {
47 ptr = SmallHeap::malloc (sz);
48 } else {
49 ptr = slowPathcxx . . $ HL/HybridHeap#slowPath(bfcfa4d6b7f7ef64). (sz);
50 }
51 if (SmallHeap::getSize(ptr) <cxx . . $ std/`operator<`(39b98f4fe21ae589). sz) {
52 assertcxx . . $ `/usr/include/assert.h:50:10`!(bm.getSize(ptr) >= sz);
53 }
54 assertcxx . . $ `/usr/include/assert.h:50:10`! (SmallHeap::getSize(ptr) >= sz);
55 assertcxx . . $ `/usr/include/assert.h:50:10`! ((size_t) ptr % Alignment == 0);
56 return ptr;
57 }
58
59 inline void freecxx . . $ HL/HybridHeap#free(5d22bdacc48458e8). (void * ptr) {
60 if (SmallHeap::getSize(ptr) <=cxx . . $ std/`operator<=`(39b98f4fe21ae589). BigSize) {
61 SmallHeap::free (ptr);
62 } else {
63 bmcxx . . $ HL/HybridHeap#bm..free (ptr);
64 }
65 }
66
67 inline void clearcxx . . $ HL/HybridHeap#clear(49f6e7a06ebc5aa8). (void) {
68 bmcxx . . $ HL/HybridHeap#bm..clear();
69 SmallHeap::clear();
70 }
71
72
73 private:
74
75 MALLOC_FUNCTIONcxx . . $ `vendor/Heap-Layers/heaplayers.h:68:9`! NO_INLINEcxx . . $ `vendor/Heap-Layers/heaplayers.h:66:9`!
76 void * slowPathcxx . . $ HL/HybridHeap#slowPath(bfcfa4d6b7f7ef64). (size_t sz) {
77 return bmcxx . . $ HL/HybridHeap#bm..malloc (sz);
78 }
79
80
81 BigHeap bmcxx . . $ HL/HybridHeap#bm.;
82 };
83
84 }
85
86 #endif