/home/andy/git/oilshell/oil/mycpp/gc_heap.h
Line | Count | Source (jump to first uncovered line) |
1 | | #ifndef GC_HEAP_H |
2 | | #define GC_HEAP_H |
3 | | |
4 | | #include "cheney_heap.h" |
5 | | #include "marksweep_heap.h" |
6 | | |
7 | | // for Tag::FixedSize |
8 | | class LayoutFixed : public Obj { |
9 | | public: |
10 | | Obj* children_[16]; // only the entries denoted in field_mask will be valid |
11 | | }; |
12 | | |
13 | | #if MARK_SWEEP |
14 | 4 | #define PRINT_GC_MODE_STRING() printf(" -- GC_MODE :: marksweep\n") |
15 | | extern MarkSweepHeap gHeap; |
16 | | #else |
17 | | #define PRINT_GC_MODE_STRING() printf(" -- GC_MODE :: cheney\n") |
18 | | extern CheneyHeap gHeap; |
19 | | #endif |
20 | | |
21 | | // Variadic templates: |
22 | | // https://eli.thegreenplace.net/2014/variadic-templates-in-c/ |
23 | | template <typename T, typename... Args> |
24 | 892 | T* Alloc(Args&&... args) { |
25 | 892 | assert(gHeap.is_initialized_); |
26 | 0 | void* place = gHeap.Allocate(sizeof(T)); |
27 | 892 | assert(place != nullptr); |
28 | | // placement new |
29 | 0 | return new (place) T(std::forward<Args>(args)...); |
30 | 892 | } _Z5AllocI4ListIP3StrEJEEPT_DpOT0_ Line | Count | Source | 24 | 102 | T* Alloc(Args&&... args) { | 25 | 102 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 102 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 102 | } |
_Z5AllocI4ListIiEJEEPT_DpOT0_ Line | Count | Source | 24 | 330 | T* Alloc(Args&&... args) { | 25 | 330 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 330 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 330 | } |
_Z5AllocI4ListIbEJEEPT_DpOT0_ Line | Count | Source | 24 | 3 | T* Alloc(Args&&... args) { | 25 | 3 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 3 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 3 | } |
_Z5AllocI4ListIdEJEEPT_DpOT0_ Line | Count | Source | 24 | 2 | T* Alloc(Args&&... args) { | 25 | 2 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 2 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 2 | } |
_Z5AllocI4DictIiP3StrEJEEPT_DpOT0_ Line | Count | Source | 24 | 3 | T* Alloc(Args&&... args) { | 25 | 3 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 3 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 3 | } |
Unexecuted instantiation: _Z5AllocI8KeyErrorJEEPT_DpOT0_ _Z5AllocI4DictIP3StriEJEEPT_DpOT0_ Line | Count | Source | 24 | 10 | T* Alloc(Args&&... args) { | 25 | 10 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 10 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 10 | } |
_Z5AllocI4DictIP3StrS2_EJEEPT_DpOT0_ Line | Count | Source | 24 | 2 | T* Alloc(Args&&... args) { | 25 | 2 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 2 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 2 | } |
_Z5AllocIN5mylib15CFileLineReaderEJRP8_IO_FILEEEPT_DpOT0_ Line | Count | Source | 24 | 4 | T* Alloc(Args&&... args) { | 25 | 4 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 4 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 4 | } |
_Z5AllocI10ValueErrorJEEPT_DpOT0_ Line | Count | Source | 24 | 2 | T* Alloc(Args&&... args) { | 25 | 2 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 2 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 2 | } |
Unexecuted instantiation: _Z5AllocI7IOErrorJRiEEPT_DpOT0_ _Z5AllocI4DictIiiEJEEPT_DpOT0_ Line | Count | Source | 24 | 1 | T* Alloc(Args&&... args) { | 25 | 1 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 1 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 1 | } |
_Z5AllocI5PointJiiEEPT_DpOT0_ Line | Count | Source | 24 | 2 | T* Alloc(Args&&... args) { | 25 | 2 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 2 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 2 | } |
_Z5AllocI4LineJEEPT_DpOT0_ Line | Count | Source | 24 | 1 | T* Alloc(Args&&... args) { | 25 | 1 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 1 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 1 | } |
_Z5AllocI10DerivedObjJEEPT_DpOT0_ Line | Count | Source | 24 | 1 | T* Alloc(Args&&... args) { | 25 | 1 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 1 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 1 | } |
_Z5AllocIN5mylib13BufLineReaderEJRP3StrEEPT_DpOT0_ Line | Count | Source | 24 | 1 | T* Alloc(Args&&... args) { | 25 | 1 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 1 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 1 | } |
_Z5AllocIN5mylib11CFileWriterEJRP8_IO_FILEEEPT_DpOT0_ Line | Count | Source | 24 | 4 | T* Alloc(Args&&... args) { | 25 | 4 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 4 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 4 | } |
_Z5AllocI6Tuple2IiiEJiiEEPT_DpOT0_ Line | Count | Source | 24 | 4 | T* Alloc(Args&&... args) { | 25 | 4 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 4 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 4 | } |
_Z5AllocI6Tuple2IiP3StrEJiS2_EEPT_DpOT0_ Line | Count | Source | 24 | 1 | T* Alloc(Args&&... args) { | 25 | 1 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 1 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 1 | } |
_Z5AllocI6Tuple3IiP3StrS2_EJiS2_S2_EEPT_DpOT0_ Line | Count | Source | 24 | 1 | T* Alloc(Args&&... args) { | 25 | 1 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 1 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 1 | } |
_Z5AllocI6Tuple4IiP3StrS2_iEJiS2_S2_iEEPT_DpOT0_ Line | Count | Source | 24 | 1 | T* Alloc(Args&&... args) { | 25 | 1 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 1 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 1 | } |
_Z5AllocIN14asdl_generated17arith_expr__ConstEJiEEPT_DpOT0_ Line | Count | Source | 24 | 1 | T* Alloc(Args&&... args) { | 25 | 1 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 1 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 1 | } |
Unexecuted instantiation: _Z5AllocIN14asdl_generated17arith_expr__ConstEJRiEEPT_DpOT0_ _Z5AllocIN7classes10TextOutputEJRPN5mylib6WriterEEEPT_DpOT0_ Line | Count | Source | 24 | 1 | T* Alloc(Args&&... args) { | 25 | 1 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 1 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 1 | } |
_Z5AllocIN7classes7DerivedEJEEPT_DpOT0_ Line | Count | Source | 24 | 1 | T* Alloc(Args&&... args) { | 25 | 1 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 1 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 1 | } |
_Z5AllocIN5mylib9BufWriterEJEEPT_DpOT0_ Line | Count | Source | 24 | 33 | T* Alloc(Args&&... args) { | 25 | 33 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 33 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 33 | } |
Unexecuted instantiation: _Z5AllocIN7classes10TextOutputEJRPN5mylib9BufWriterEEEPT_DpOT0_ _Z5AllocI6Tuple2IiP3StrEJiRS2_EEPT_DpOT0_ Line | Count | Source | 24 | 5 | T* Alloc(Args&&... args) { | 25 | 5 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 5 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 5 | } |
_Z5AllocIN10containers5PointEJiiEEPT_DpOT0_ Line | Count | Source | 24 | 1 | T* Alloc(Args&&... args) { | 25 | 1 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 1 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 1 | } |
_Z5AllocIN12control_flow10ParseErrorEJRP3StrEEPT_DpOT0_ Line | Count | Source | 24 | 1 | T* Alloc(Args&&... args) { | 25 | 1 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 1 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 1 | } |
_Z5AllocI6Tuple2IP3StriEJRS2_iEEPT_DpOT0_ Line | Count | Source | 24 | 3 | T* Alloc(Args&&... args) { | 25 | 3 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 3 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 3 | } |
_Z5AllocI4ListIP6Tuple2IP3StriEEJEEPT_DpOT0_ Line | Count | Source | 24 | 1 | T* Alloc(Args&&... args) { | 25 | 1 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 1 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 1 | } |
_Z5AllocI4ListIP6Tuple2IiP3StrEEJEEPT_DpOT0_ Line | Count | Source | 24 | 2 | T* Alloc(Args&&... args) { | 25 | 2 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 2 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 2 | } |
Unexecuted instantiation: _Z5AllocI19NotImplementedErrorJEEPT_DpOT0_ _Z5AllocIN7modules3DogEJRP3StrEEPT_DpOT0_ Line | Count | Source | 24 | 1 | T* Alloc(Args&&... args) { | 25 | 1 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 1 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 1 | } |
_Z5AllocIN7module13CatEJEEPT_DpOT0_ Line | Count | Source | 24 | 1 | T* Alloc(Args&&... args) { | 25 | 1 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 1 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 1 | } |
_Z5AllocIN7modules6SphinxEJRP3StrEEPT_DpOT0_ Line | Count | Source | 24 | 1 | T* Alloc(Args&&... args) { | 25 | 1 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 1 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 1 | } |
_Z5AllocI4ListIPN10hnode_asdl5fieldEEJEEPT_DpOT0_ Line | Count | Source | 24 | 34 | T* Alloc(Args&&... args) { | 25 | 34 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 34 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 34 | } |
_Z5AllocI4ListIPN10hnode_asdl7hnode_tEEJEEPT_DpOT0_ Line | Count | Source | 24 | 34 | T* Alloc(Args&&... args) { | 25 | 34 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 34 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 34 | } |
_Z5AllocIN10hnode_asdl13hnode__RecordEJRP3StrP4ListIPNS0_5fieldEEbS4_S4_PS5_IPNS0_7hnode_tEEEEPT_DpOT0_ Line | Count | Source | 24 | 34 | T* Alloc(Args&&... args) { | 25 | 34 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 34 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 34 | } |
Unexecuted instantiation: _Z5AllocIN10hnode_asdl11hnode__LeafEJRP3StrNS0_7color_eEEEPT_DpOT0_ _Z5AllocIN10hnode_asdl11hnode__LeafEJRP3StrRNS0_7color_eEEEPT_DpOT0_ Line | Count | Source | 24 | 20 | T* Alloc(Args&&... args) { | 25 | 20 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 20 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 20 | } |
Unexecuted instantiation: _Z5AllocIN6format10AnsiOutputEJRPN5mylib6WriterEEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocIN6format10TextOutputEJRPN5mylib6WriterEEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocIN6format10TextOutputEJPN5mylib9BufWriterEEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocIN6format10HtmlOutputEJPN5mylib9BufWriterEEEPT_DpOT0_ _Z5AllocIN6format10AnsiOutputEJPN5mylib9BufWriterEEEPT_DpOT0_ Line | Count | Source | 24 | 31 | T* Alloc(Args&&... args) { | 25 | 31 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 31 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 31 | } |
_Z5AllocI6Tuple2IP3StriEJRS2_RiEEPT_DpOT0_ Line | Count | Source | 24 | 22 | T* Alloc(Args&&... args) { | 25 | 22 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 22 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 22 | } |
_Z5AllocIN6format14_PrettyPrinterEJiEEPT_DpOT0_ Line | Count | Source | 24 | 8 | T* Alloc(Args&&... args) { | 25 | 8 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 8 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 8 | } |
_Z5AllocIN5parse10ParseErrorEJP3StrEEPT_DpOT0_ Line | Count | Source | 24 | 5 | T* Alloc(Args&&... args) { | 25 | 5 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 5 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 5 | } |
_Z5AllocIN9expr_asdl9expr__VarEJRP3StrEEPT_DpOT0_ Line | Count | Source | 24 | 9 | T* Alloc(Args&&... args) { | 25 | 9 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 9 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 9 | } |
_Z5AllocIN9expr_asdl11expr__ConstEJiEEPT_DpOT0_ Line | Count | Source | 24 | 14 | T* Alloc(Args&&... args) { | 25 | 14 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 14 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 14 | } |
_Z5AllocIN9expr_asdl12expr__BinaryEJRP3StrRPNS0_6expr_tES7_EEPT_DpOT0_ Line | Count | Source | 24 | 14 | T* Alloc(Args&&... args) { | 25 | 14 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 14 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 14 | } |
_Z5AllocIN5parse5LexerEJRP3StrEEPT_DpOT0_ Line | Count | Source | 24 | 14 | T* Alloc(Args&&... args) { | 25 | 14 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 14 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 14 | } |
_Z5AllocIN5parse6ParserEJRPNS0_5LexerEEEPT_DpOT0_ Line | Count | Source | 24 | 13 | T* Alloc(Args&&... args) { | 25 | 13 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 13 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 13 | } |
_Z5AllocIN6format10AnsiOutputEJPN5mylib6WriterEEEPT_DpOT0_ Line | Count | Source | 24 | 8 | T* Alloc(Args&&... args) { | 25 | 8 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 8 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 8 | } |
_Z5AllocIN10hnode_asdl11hnode__LeafEJP3StrNS0_7color_eEEEPT_DpOT0_ Line | Count | Source | 24 | 14 | T* Alloc(Args&&... args) { | 25 | 14 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 14 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 14 | } |
_Z5AllocIN10hnode_asdl5fieldEJP3StrRPNS0_7hnode_tEEEPT_DpOT0_ Line | Count | Source | 24 | 60 | T* Alloc(Args&&... args) { | 25 | 60 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 60 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 60 | } |
_Z5AllocIN15scoped_resource7MyErrorEJEEPT_DpOT0_ Line | Count | Source | 24 | 1 | T* Alloc(Args&&... args) { | 25 | 1 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 1 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 1 | } |
_Z5AllocIN15scoped_resource8DirStackEJEEPT_DpOT0_ Line | Count | Source | 24 | 1 | T* Alloc(Args&&... args) { | 25 | 1 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 1 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 1 | } |
_Z5AllocIN7strings3FooEJEEPT_DpOT0_ Line | Count | Source | 24 | 1 | T* Alloc(Args&&... args) { | 25 | 1 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 1 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 1 | } |
_Z5AllocIN9test_cast11ColorOutputEJRPN5mylib9BufWriterEEEPT_DpOT0_ Line | Count | Source | 24 | 1 | T* Alloc(Args&&... args) { | 25 | 1 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 1 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 1 | } |
Unexecuted instantiation: _Z5AllocI12RuntimeErrorJP3StrEEPT_DpOT0_ _Z5AllocIN5error6StrictEJRP3StrEEPT_DpOT0_ Line | Count | Source | 24 | 1 | T* Alloc(Args&&... args) { | 25 | 1 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 1 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 1 | } |
Unexecuted instantiation: _Z5AllocI4ListIPN12runtime_asdl10assign_argEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN12runtime_asdl12part_value_tEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN12runtime_asdl7value_tEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4DictIP3StrPN12runtime_asdl8hay_nodeEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl13compound_wordEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl11word_part_tEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl9command_tEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl6word_tEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl5redirEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl8env_pairEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl11assign_pairEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl6if_armEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl8case_armEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl9name_typeEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl12place_expr_tEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl5paramEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl11type_expr_tEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl7variantEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl12class_item_tEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl11import_nameEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl12UntypedParamEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl10TypedParamEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl5TokenEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl5speckEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl6expr_tEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl13comprehensionEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl20class_literal_term_tEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl17char_class_term_tEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl4re_tEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl9named_argEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocI4ListIPN11syntax_asdl11string_lineEEJEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocIN5error5ParseEJRP3StrRiEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocIN5error5ParseEJRP3StrRPN11syntax_asdl5TokenEEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocIN5error5ParseEJRP3StrRPN11syntax_asdl11word_part_tEEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocIN5error5ParseEJRP3StrRPN11syntax_asdl6word_tEEEPT_DpOT0_ _Z5AllocIN5error12FatalRuntimeEJRP3StrEEPT_DpOT0_ Line | Count | Source | 24 | 1 | T* Alloc(Args&&... args) { | 25 | 1 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 1 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 1 | } |
Unexecuted instantiation: _Z5AllocIN5error12FatalRuntimeEJRiRP3StrEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocIN5error5UsageEJRP3StriEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocIN5error5UsageEJRP3StrRiEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocIN6pyutil15_ResourceLoaderEJEEPT_DpOT0_ _Z5AllocIN5match11SimpleLexerEJPFvPKhiiPiS4_ERP3StrEEPT_DpOT0_ Line | Count | Source | 24 | 2 | T* Alloc(Args&&... args) { | 25 | 2 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 2 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 2 | } |
Unexecuted instantiation: _Z5AllocI7OSErrorJRiEEPT_DpOT0_ _Z5AllocIN9flag_spec16_FlagSpecAndMoreEJEEPT_DpOT0_ Line | Count | Source | 24 | 1 | T* Alloc(Args&&... args) { | 25 | 1 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 1 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 1 | } |
_Z5AllocIN9flag_spec9_FlagSpecEJEEPT_DpOT0_ Line | Count | Source | 24 | 3 | T* Alloc(Args&&... args) { | 25 | 3 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 3 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 3 | } |
_Z5AllocIN12runtime_asdl11value__BoolEJRbEEPT_DpOT0_ Line | Count | Source | 24 | 10 | T* Alloc(Args&&... args) { | 25 | 10 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 10 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 10 | } |
Unexecuted instantiation: _Z5AllocIN12runtime_asdl10value__IntEJRiEEPT_DpOT0_ Unexecuted instantiation: _Z5AllocIN12runtime_asdl12value__FloatEJRfEEPT_DpOT0_ _Z5AllocIN12runtime_asdl12value__UndefEJEEPT_DpOT0_ Line | Count | Source | 24 | 3 | T* Alloc(Args&&... args) { | 25 | 3 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 3 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 3 | } |
Unexecuted instantiation: _Z5AllocIN12runtime_asdl10value__StrEJP3StrEEPT_DpOT0_ _Z5AllocI4DictIP3StrPN4args7_ActionEEJEEPT_DpOT0_ Line | Count | Source | 24 | 4 | T* Alloc(Args&&... args) { | 25 | 4 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 4 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 4 | } |
_Z5AllocI4DictIP3StrPN12runtime_asdl7value_tEEJEEPT_DpOT0_ Line | Count | Source | 24 | 2 | T* Alloc(Args&&... args) { | 25 | 2 | assert(gHeap.is_initialized_); | 26 | 0 | void* place = gHeap.Allocate(sizeof(T)); | 27 | 2 | assert(place != nullptr); | 28 | | // placement new | 29 | 0 | return new (place) T(std::forward<Args>(args)...); | 30 | 2 | } |
|
31 | | |
32 | | class StackRoots { |
33 | | public: |
34 | 8.94k | StackRoots(std::initializer_list<void*> roots) { |
35 | 8.94k | n_ = roots.size(); |
36 | 11.4k | for (auto root : roots) { // can't use roots[i] |
37 | 11.4k | gHeap.PushRoot(reinterpret_cast<Obj**>(root)); |
38 | 11.4k | } |
39 | 8.94k | } |
40 | | |
41 | 8.94k | ~StackRoots() { |
42 | | // TODO: optimize this |
43 | 20.4k | for (int i = 0; i < n_; ++i) { |
44 | 11.4k | gHeap.PopRoot(); |
45 | 11.4k | } |
46 | 8.94k | } |
47 | | |
48 | | private: |
49 | | int n_; |
50 | | }; |
51 | | |
52 | | #endif // GC_HEAP_H |