Debian Codegraph @

vendor/Heap-Layers/heaps/objectrep/sizeownerheap.h

raw symbols SCIP
1 /* -*- C++ -*- */cxx . . $ `<file>/vendor/Heap-Layers/heaps/objectrep/sizeownerheap.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_SIZEOWNERHEAP_H_
19 #define HL_SIZEOWNERHEAP_H_cxx . . $ `vendor/Heap-Layers/heaps/objectrep/sizeownerheap.h:19:9`!
20
21 #include <assert.h>
22
23 #include "addheap.h"cxx . . $ `<file>/vendor/Heap-Layers/heaps/objectrep/addheap.h`/
24
25 /**
26 * @class SizeOwnerHeap
27 * @brief Adds object size and owner heap information.
28 */
29
30 namespace HLcxx . . $ HL/ {
31
32 template <class Heap>
33 class SizeOwnercxx . . $ HL/SizeOwner# {
34 public:
35 union tagcxx . . $ HL/SizeOwner#tag# {
36 structcxx . . $ HL/SizeOwner#tag#$anonymous_type_0# {
37 size_t sizecxx . . $ HL/SizeOwner#tag#$anonymous_type_0#size.;
38 Heap * ownercxx . . $ HL/SizeOwner#tag#$anonymous_type_0#owner.;
39 } scxx . . $ HL/SizeOwner#tag#s.;
40 double dummycxx . . $ HL/SizeOwner#tag#dummy.;
41 };
42 };
43
44 template <class Super>
45 class SizeOwnerHeapcxx . . $ HL/SizeOwnerHeap# : public AddHeapcxx . . $ HL/AddHeap#<SizeOwnercxx . . $ HL/SizeOwner#<Super>, Super> {
46 private:
47
48 typedef AddHeapcxx . . $ HL/AddHeap#<SizeOwnercxx . . $ HL/SizeOwner#<Super>, Super> SuperHeapcxx . . $ HL/SizeOwnerHeap#SuperHeap#;
49
50 public:
51
52 inline void * malloccxx . . $ HL/SizeOwnerHeap#malloc(bfcfa4d6b7f7ef64). (size_t sz) {
53 void * ptr = SuperHeapcxx . . $ HL/SizeOwnerHeap#SuperHeap#::malloc (sz);
54 // Store the requested size.
55 SizeOwnercxx . . $ HL/SizeOwner#<Super> * so = (SizeOwnercxx . . $ HL/SizeOwner#<Super> *) ptr;
56 so->s.size = sz;
57 so->s.owner = this;
58 // Store the owner.
59 return (void *) (so +cxx . . $ std/operator+(933aeee3a62e2e30). 1);
60 }
61
62 inline void freecxx . . $ HL/SizeOwnerHeap#free(5d22bdacc48458e8). (void * ptr) {
63 void * origPtr = (void *) ((SizeOwnercxx . . $ HL/SizeOwner#<Super> *) ptr -cxx . . $ std/operator-(a6e85813984128c7). 1);
64 SuperHeapcxx . . $ HL/SizeOwnerHeap#SuperHeap#::free (origPtr);
65 }
66
67 static inline Super * ownercxx . . $ HL/SizeOwnerHeap#owner(3f34b03ede0967ef). (void * ptr) {
68 SizeOwnercxx . . $ HL/SizeOwner#<Super> * so = (SizeOwnercxx . . $ HL/SizeOwner#<Super> *) ptr -cxx . . $ std/operator-(a6e85813984128c7). 1;
69 return so->s.owner;
70 }
71
72 static inline size_t sizecxx . . $ HL/SizeOwnerHeap#size(751e5d26f8574c32). (void * ptr) {
73 SizeOwnercxx . . $ HL/SizeOwner#<Super> * so = (SizeOwnercxx . . $ HL/SizeOwner#<Super> *) ptr -cxx . . $ std/operator-(a6e85813984128c7). 1;
74 return so->s.size;
75 }
76 };
77
78 }
79
80 #endif