/home/uke/oil/mycpp/gc_list.h
Line | Count | Source (jump to first uncovered line) |
1 | | #ifndef MYCPP_GC_LIST_H |
2 | | #define MYCPP_GC_LIST_H |
3 | | |
4 | | #include <string.h> // memcpy |
5 | | |
6 | | #include <algorithm> // sort() is templated |
7 | | |
8 | | #include "mycpp/common.h" // DCHECK |
9 | | #include "mycpp/comparators.h" |
10 | | #include "mycpp/gc_alloc.h" // Alloc |
11 | | #include "mycpp/gc_builtins.h" // ValueError |
12 | | #include "mycpp/gc_mops.h" // BigInt |
13 | | #include "mycpp/gc_slab.h" |
14 | | |
15 | | // GlobalList is layout-compatible with List (unit tests assert this), and it |
16 | | // can be a true C global (incurs zero startup time) |
17 | | |
18 | | template <typename T, int N> |
19 | | class GlobalList { |
20 | | public: |
21 | | int len_; |
22 | | int capacity_; |
23 | | GlobalSlab<T, N>* slab_; |
24 | | }; |
25 | | |
26 | | #define GLOBAL_LIST(name, T, N, array) \ |
27 | | GcGlobal<GlobalSlab<T, N>> _slab_##name = {ObjHeader::Global(TypeTag::Slab), \ |
28 | | {.items_ = array}}; \ |
29 | | GcGlobal<GlobalList<T, N>> _list_##name = { \ |
30 | | ObjHeader::Global(TypeTag::List), \ |
31 | | {.len_ = N, .capacity_ = N, .slab_ = &_slab_##name.obj}}; \ |
32 | | List<T>* name = reinterpret_cast<List<T>*>(&_list_##name.obj); |
33 | | |
34 | | template <typename T> |
35 | | class List { |
36 | | public: |
37 | 1.55k | List() : len_(0), capacity_(0), slab_(nullptr) { |
38 | 1.55k | } Line | Count | Source | 37 | 701 | List() : len_(0), capacity_(0), slab_(nullptr) { | 38 | 701 | } |
Line | Count | Source | 37 | 149 | List() : len_(0), capacity_(0), slab_(nullptr) { | 38 | 149 | } |
_ZN4ListIP6Tuple2IP6BigStriEEC2Ev Line | Count | Source | 37 | 1 | List() : len_(0), capacity_(0), slab_(nullptr) { | 38 | 1 | } |
_ZN4ListIP6Tuple2IiP6BigStrEEC2Ev Line | Count | Source | 37 | 9 | List() : len_(0), capacity_(0), slab_(nullptr) { | 38 | 9 | } |
_ZN4ListIPN11pretty_asdl11MeasuredDocEEC2Ev Line | Count | Source | 37 | 609 | List() : len_(0), capacity_(0), slab_(nullptr) { | 38 | 609 | } |
_ZN4ListIPN10hnode_asdl5FieldEEC2Ev Line | Count | Source | 37 | 57 | List() : len_(0), capacity_(0), slab_(nullptr) { | 38 | 57 | } |
_ZN4ListIPN11pretty_asdl11DocFragmentEEC2Ev Line | Count | Source | 37 | 19 | List() : len_(0), capacity_(0), slab_(nullptr) { | 38 | 19 | } |
Unexecuted instantiation: _ZN4ListIPN10hnode_asdl7hnode_tEEC2Ev Line | Count | Source | 37 | 3 | List() : len_(0), capacity_(0), slab_(nullptr) { | 38 | 3 | } |
Unexecuted instantiation: _ZN4ListIPN15test_classes_gc10OpaqueBaseEEC2Ev Unexecuted instantiation: _ZN4ListIPN15test_classes_gc12PointersBaseEEC2Ev Unexecuted instantiation: _ZN4ListIPN15test_classes_gc14BaseWithMethodEEC2Ev Line | Count | Source | 37 | 2 | List() : len_(0), capacity_(0), slab_(nullptr) { | 38 | 2 | } |
_ZN4ListIP6Tuple2IiiEEC2Ev Line | Count | Source | 37 | 4 | List() : len_(0), capacity_(0), slab_(nullptr) { | 38 | 4 | } |
Line | Count | Source | 37 | 2 | List() : len_(0), capacity_(0), slab_(nullptr) { | 38 | 2 | } |
_ZN4ListIPN4pyos11PasswdEntryEEC2Ev Line | Count | Source | 37 | 1 | List() : len_(0), capacity_(0), slab_(nullptr) { | 38 | 1 | } |
Unexecuted instantiation: _ZN4ListIPS_IP6Tuple2IiiEEEC2Ev Unexecuted instantiation: _ZN4ListIP6Tuple2IP6BigStrbEEC2Ev Unexecuted instantiation: _ZN4ListIPN11syntax_asdl12CompoundWordEEC2Ev |
39 | | |
40 | | protected: |
41 | | // Used for ASDL subtypes with <. NOT even a shallow copy - it ALIASES thes |
42 | | // slab. |
43 | | explicit List(List* other) |
44 | 1 | : len_(other->len_), capacity_(other->capacity_), slab_(other->slab_) { |
45 | 1 | } |
46 | | |
47 | | public: |
48 | | // Implements L[i] |
49 | | T at(int i); |
50 | | |
51 | | // returns index of the element |
52 | | int index(T element); |
53 | | |
54 | | // Implements L[i] = item |
55 | | void set(int i, T item); |
56 | | |
57 | | // L[begin:] |
58 | | List* slice(int begin); |
59 | | |
60 | | // L[begin:end] |
61 | | List* slice(int begin, int end); |
62 | | |
63 | | // Should we have a separate API that doesn't return it? |
64 | | // https://stackoverflow.com/questions/12600330/pop-back-return-value |
65 | | T pop(); |
66 | | |
67 | | // Used in osh/word_parse.py to remove from front |
68 | | T pop(int i); |
69 | | |
70 | | // Remove the first occurence of x from the list. |
71 | | void remove(T x); |
72 | | |
73 | | void clear(); |
74 | | |
75 | | // Used in osh/string_ops.py |
76 | | void reverse(); |
77 | | |
78 | | // Templated function |
79 | | void sort(); |
80 | | |
81 | | // Ensure that there's space for at LEAST this many items |
82 | | void reserve(int num_desired); |
83 | | |
84 | | // Append a single element to this list. |
85 | | void append(T item); |
86 | | |
87 | | // Extend this list with multiple elements. |
88 | | void extend(List<T>* other); |
89 | | |
90 | 1.26k | static constexpr ObjHeader obj_header() { |
91 | 1.26k | return ObjHeader::ClassFixed(field_mask(), sizeof(List<T>)); |
92 | 1.26k | } _ZN4ListIiE10obj_headerEv Line | Count | Source | 90 | 690 | static constexpr ObjHeader obj_header() { | 91 | 690 | return ObjHeader::ClassFixed(field_mask(), sizeof(List<T>)); | 92 | 690 | } |
_ZN4ListIP6BigStrE10obj_headerEv Line | Count | Source | 90 | 148 | static constexpr ObjHeader obj_header() { | 91 | 148 | return ObjHeader::ClassFixed(field_mask(), sizeof(List<T>)); | 92 | 148 | } |
_ZN4ListIP6Tuple2IP6BigStriEE10obj_headerEv Line | Count | Source | 90 | 1 | static constexpr ObjHeader obj_header() { | 91 | 1 | return ObjHeader::ClassFixed(field_mask(), sizeof(List<T>)); | 92 | 1 | } |
_ZN4ListIP6Tuple2IiP6BigStrEE10obj_headerEv Line | Count | Source | 90 | 5 | static constexpr ObjHeader obj_header() { | 91 | 5 | return ObjHeader::ClassFixed(field_mask(), sizeof(List<T>)); | 92 | 5 | } |
_ZN4ListIPN10hnode_asdl5FieldEE10obj_headerEv Line | Count | Source | 90 | 57 | static constexpr ObjHeader obj_header() { | 91 | 57 | return ObjHeader::ClassFixed(field_mask(), sizeof(List<T>)); | 92 | 57 | } |
_ZN4ListIPN11pretty_asdl11MeasuredDocEE10obj_headerEv Line | Count | Source | 90 | 333 | static constexpr ObjHeader obj_header() { | 91 | 333 | return ObjHeader::ClassFixed(field_mask(), sizeof(List<T>)); | 92 | 333 | } |
_ZN4ListIPN11pretty_asdl11DocFragmentEE10obj_headerEv Line | Count | Source | 90 | 19 | static constexpr ObjHeader obj_header() { | 91 | 19 | return ObjHeader::ClassFixed(field_mask(), sizeof(List<T>)); | 92 | 19 | } |
Unexecuted instantiation: _ZN4ListIPN10hnode_asdl7hnode_tEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN10value_asdl7value_tEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl5TokenEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN10value_asdl16InitializerValueEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl10SourceLineEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl12CompoundWordEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN12runtime_asdl9AssignArgEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN12runtime_asdl12part_value_tEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl17InitializerWord_tEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl11word_part_tEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl6word_tEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl6expr_tEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl5RedirEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl7EnvPairEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl10AssignPairEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl9command_tEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl5IfArmEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl7CaseArmEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl10place_op_tEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl8NameTypeEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl13ComprehensionEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl20class_literal_term_tEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl17char_class_term_tEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl4re_tEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl8NamedArgEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl9EggexFlagEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl5ParamEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl7y_lhs_tEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl8TypeExprEE10obj_headerEv _ZN4ListIbE10obj_headerEv Line | Count | Source | 90 | 3 | static constexpr ObjHeader obj_header() { | 91 | 3 | return ObjHeader::ClassFixed(field_mask(), sizeof(List<T>)); | 92 | 3 | } |
Unexecuted instantiation: _ZN4ListIPN15test_classes_gc10OpaqueBaseEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN15test_classes_gc12PointersBaseEE10obj_headerEv Unexecuted instantiation: _ZN4ListIPN15test_classes_gc14BaseWithMethodEE10obj_headerEv _ZN4ListIlE10obj_headerEv Line | Count | Source | 90 | 2 | static constexpr ObjHeader obj_header() { | 91 | 2 | return ObjHeader::ClassFixed(field_mask(), sizeof(List<T>)); | 92 | 2 | } |
_ZN4ListIP6Tuple2IiiEE10obj_headerEv Line | Count | Source | 90 | 4 | static constexpr ObjHeader obj_header() { | 91 | 4 | return ObjHeader::ClassFixed(field_mask(), sizeof(List<T>)); | 92 | 4 | } |
_ZN4ListIPiE10obj_headerEv Line | Count | Source | 90 | 2 | static constexpr ObjHeader obj_header() { | 91 | 2 | return ObjHeader::ClassFixed(field_mask(), sizeof(List<T>)); | 92 | 2 | } |
_ZN4ListIPN4pyos11PasswdEntryEE10obj_headerEv Line | Count | Source | 90 | 1 | static constexpr ObjHeader obj_header() { | 91 | 1 | return ObjHeader::ClassFixed(field_mask(), sizeof(List<T>)); | 92 | 1 | } |
Unexecuted instantiation: _ZN4ListIPS_IP6Tuple2IiiEEE10obj_headerEv Unexecuted instantiation: _ZN4ListIP6Tuple2IP6BigStrbEE10obj_headerEv |
93 | | |
94 | | // Used by ASDL |
95 | | void SetTaken(); |
96 | | |
97 | | int len_; // number of entries |
98 | | int capacity_; // max entries before resizing |
99 | | |
100 | | // The container may be resized, so this field isn't in-line. |
101 | | Slab<T>* slab_; |
102 | | |
103 | | // A list has one Slab pointer which we need to follow. |
104 | 1.54k | static constexpr uint32_t field_mask() { |
105 | 1.54k | return maskbit(offsetof(List, slab_)); |
106 | 1.54k | } _ZN4ListIiE10field_maskEv Line | Count | Source | 104 | 692 | static constexpr uint32_t field_mask() { | 105 | 692 | return maskbit(offsetof(List, slab_)); | 106 | 692 | } |
_ZN4ListIP6BigStrE10field_maskEv Line | Count | Source | 104 | 150 | static constexpr uint32_t field_mask() { | 105 | 150 | return maskbit(offsetof(List, slab_)); | 106 | 150 | } |
_ZN4ListIP6Tuple2IP6BigStriEE10field_maskEv Line | Count | Source | 104 | 1 | static constexpr uint32_t field_mask() { | 105 | 1 | return maskbit(offsetof(List, slab_)); | 106 | 1 | } |
_ZN4ListIP6Tuple2IiP6BigStrEE10field_maskEv Line | Count | Source | 104 | 5 | static constexpr uint32_t field_mask() { | 105 | 5 | return maskbit(offsetof(List, slab_)); | 106 | 5 | } |
_ZN4ListIPN11pretty_asdl11MeasuredDocEE10field_maskEv Line | Count | Source | 104 | 609 | static constexpr uint32_t field_mask() { | 105 | 609 | return maskbit(offsetof(List, slab_)); | 106 | 609 | } |
_ZN4ListIPN10hnode_asdl5FieldEE10field_maskEv Line | Count | Source | 104 | 57 | static constexpr uint32_t field_mask() { | 105 | 57 | return maskbit(offsetof(List, slab_)); | 106 | 57 | } |
_ZN4ListIPN11pretty_asdl11DocFragmentEE10field_maskEv Line | Count | Source | 104 | 19 | static constexpr uint32_t field_mask() { | 105 | 19 | return maskbit(offsetof(List, slab_)); | 106 | 19 | } |
Unexecuted instantiation: _ZN4ListIPN10hnode_asdl7hnode_tEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN10value_asdl7value_tEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl5TokenEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN10value_asdl16InitializerValueEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl10SourceLineEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl9command_tEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl12CompoundWordEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN12runtime_asdl9AssignArgEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN12runtime_asdl12part_value_tEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl17InitializerWord_tEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl11word_part_tEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl6word_tEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl6expr_tEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl5RedirEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl7EnvPairEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl10AssignPairEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl5IfArmEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl7CaseArmEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl10place_op_tEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl8NameTypeEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl13ComprehensionEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl20class_literal_term_tEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl17char_class_term_tEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl4re_tEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl8NamedArgEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl9EggexFlagEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl5ParamEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl7y_lhs_tEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl8TypeExprEE10field_maskEv _ZN4ListIbE10field_maskEv Line | Count | Source | 104 | 3 | static constexpr uint32_t field_mask() { | 105 | 3 | return maskbit(offsetof(List, slab_)); | 106 | 3 | } |
Unexecuted instantiation: _ZN4ListIPN15test_classes_gc10OpaqueBaseEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN15test_classes_gc12PointersBaseEE10field_maskEv Unexecuted instantiation: _ZN4ListIPN15test_classes_gc14BaseWithMethodEE10field_maskEv _ZN4ListIlE10field_maskEv Line | Count | Source | 104 | 2 | static constexpr uint32_t field_mask() { | 105 | 2 | return maskbit(offsetof(List, slab_)); | 106 | 2 | } |
_ZN4ListIP6Tuple2IiiEE10field_maskEv Line | Count | Source | 104 | 4 | static constexpr uint32_t field_mask() { | 105 | 4 | return maskbit(offsetof(List, slab_)); | 106 | 4 | } |
_ZN4ListIPiE10field_maskEv Line | Count | Source | 104 | 2 | static constexpr uint32_t field_mask() { | 105 | 2 | return maskbit(offsetof(List, slab_)); | 106 | 2 | } |
_ZN4ListIPN4pyos11PasswdEntryEE10field_maskEv Line | Count | Source | 104 | 1 | static constexpr uint32_t field_mask() { | 105 | 1 | return maskbit(offsetof(List, slab_)); | 106 | 1 | } |
Unexecuted instantiation: _ZN4ListIPS_IP6Tuple2IiiEEE10field_maskEv Unexecuted instantiation: _ZN4ListIP6Tuple2IP6BigStrbEE10field_maskEv |
107 | | |
108 | | DISALLOW_COPY_AND_ASSIGN(List) |
109 | | |
110 | | static_assert(sizeof(ObjHeader) % sizeof(T) == 0, |
111 | | "ObjHeader size should be multiple of item size"); |
112 | | static constexpr int kHeaderFudge = sizeof(ObjHeader) / sizeof(T); |
113 | | |
114 | | #if 0 |
115 | | // 24-byte pool comes from very common List header, and Token |
116 | | static constexpr int kPoolBytes1 = 24 - sizeof(ObjHeader); |
117 | | static_assert(kPoolBytes1 % sizeof(T) == 0, |
118 | | "An integral number of items should fit in first pool"); |
119 | | static constexpr int kNumItems1 = kPoolBytes1 / sizeof(T); |
120 | | #endif |
121 | | |
122 | | // Matches mark_sweep_heap.h |
123 | | static constexpr int kPoolBytes2 = 48 - sizeof(ObjHeader); |
124 | | static_assert(kPoolBytes2 % sizeof(T) == 0, |
125 | | "An integral number of items should fit in second pool"); |
126 | | static constexpr int kNumItems2 = kPoolBytes2 / sizeof(T); |
127 | | |
128 | | #if 0 |
129 | | static constexpr int kMinBytes2 = 128 - sizeof(ObjHeader); |
130 | | static_assert(kMinBytes2 % sizeof(T) == 0, |
131 | | "An integral number of items should fit"); |
132 | | static constexpr int kMinItems2 = kMinBytes2 / sizeof(T); |
133 | | #endif |
134 | | |
135 | | // Given the number of items desired, return the number items we should |
136 | | // reserve room for, according to our growth policy. |
137 | 1.75k | int HowManyItems(int num_desired) { |
138 | | // Using the 24-byte pool leads to too much GC of tiny slab objects! So |
139 | | // just use the larger 48 byte pool. |
140 | | #if 0 |
141 | | if (num_desired <= kNumItems1) { // use full cell in pool 1 |
142 | | return kNumItems1; |
143 | | } |
144 | | #endif |
145 | 1.75k | if (num_desired <= kNumItems2) { // use full cell in pool 2 |
146 | 1.51k | return kNumItems2; |
147 | 1.51k | } |
148 | | #if 0 |
149 | | if (num_desired <= kMinItems2) { // 48 -> 128, not 48 -> 64 |
150 | | return kMinItems2; |
151 | | } |
152 | | #endif |
153 | | |
154 | | // Make sure the total allocation is a power of 2. TODO: consider using |
155 | | // slightly less than power of 2, to account for malloc() headers, and |
156 | | // reduce fragmentation. |
157 | | // Example: |
158 | | // - ask for 11 integers |
159 | | // - round up 11+2 == 13 up to 16 items |
160 | | // - return 14 items |
161 | | // - 14 integers is 56 bytes, plus 8 byte GC header => 64 byte alloc. |
162 | 233 | return RoundUp(num_desired + kHeaderFudge) - kHeaderFudge; |
163 | 1.75k | } _ZN4ListIiE12HowManyItemsEi Line | Count | Source | 137 | 726 | int HowManyItems(int num_desired) { | 138 | | // Using the 24-byte pool leads to too much GC of tiny slab objects! So | 139 | | // just use the larger 48 byte pool. | 140 | | #if 0 | 141 | | if (num_desired <= kNumItems1) { // use full cell in pool 1 | 142 | | return kNumItems1; | 143 | | } | 144 | | #endif | 145 | 726 | if (num_desired <= kNumItems2) { // use full cell in pool 2 | 146 | 682 | return kNumItems2; | 147 | 682 | } | 148 | | #if 0 | 149 | | if (num_desired <= kMinItems2) { // 48 -> 128, not 48 -> 64 | 150 | | return kMinItems2; | 151 | | } | 152 | | #endif | 153 | | | 154 | | // Make sure the total allocation is a power of 2. TODO: consider using | 155 | | // slightly less than power of 2, to account for malloc() headers, and | 156 | | // reduce fragmentation. | 157 | | // Example: | 158 | | // - ask for 11 integers | 159 | | // - round up 11+2 == 13 up to 16 items | 160 | | // - return 14 items | 161 | | // - 14 integers is 56 bytes, plus 8 byte GC header => 64 byte alloc. | 162 | 44 | return RoundUp(num_desired + kHeaderFudge) - kHeaderFudge; | 163 | 726 | } |
_ZN4ListIP6BigStrE12HowManyItemsEi Line | Count | Source | 137 | 170 | int HowManyItems(int num_desired) { | 138 | | // Using the 24-byte pool leads to too much GC of tiny slab objects! So | 139 | | // just use the larger 48 byte pool. | 140 | | #if 0 | 141 | | if (num_desired <= kNumItems1) { // use full cell in pool 1 | 142 | | return kNumItems1; | 143 | | } | 144 | | #endif | 145 | 170 | if (num_desired <= kNumItems2) { // use full cell in pool 2 | 146 | 132 | return kNumItems2; | 147 | 132 | } | 148 | | #if 0 | 149 | | if (num_desired <= kMinItems2) { // 48 -> 128, not 48 -> 64 | 150 | | return kMinItems2; | 151 | | } | 152 | | #endif | 153 | | | 154 | | // Make sure the total allocation is a power of 2. TODO: consider using | 155 | | // slightly less than power of 2, to account for malloc() headers, and | 156 | | // reduce fragmentation. | 157 | | // Example: | 158 | | // - ask for 11 integers | 159 | | // - round up 11+2 == 13 up to 16 items | 160 | | // - return 14 items | 161 | | // - 14 integers is 56 bytes, plus 8 byte GC header => 64 byte alloc. | 162 | 38 | return RoundUp(num_desired + kHeaderFudge) - kHeaderFudge; | 163 | 170 | } |
_ZN4ListIP6Tuple2IP6BigStriEE12HowManyItemsEi Line | Count | Source | 137 | 1 | int HowManyItems(int num_desired) { | 138 | | // Using the 24-byte pool leads to too much GC of tiny slab objects! So | 139 | | // just use the larger 48 byte pool. | 140 | | #if 0 | 141 | | if (num_desired <= kNumItems1) { // use full cell in pool 1 | 142 | | return kNumItems1; | 143 | | } | 144 | | #endif | 145 | 1 | if (num_desired <= kNumItems2) { // use full cell in pool 2 | 146 | 1 | return kNumItems2; | 147 | 1 | } | 148 | | #if 0 | 149 | | if (num_desired <= kMinItems2) { // 48 -> 128, not 48 -> 64 | 150 | | return kMinItems2; | 151 | | } | 152 | | #endif | 153 | | | 154 | | // Make sure the total allocation is a power of 2. TODO: consider using | 155 | | // slightly less than power of 2, to account for malloc() headers, and | 156 | | // reduce fragmentation. | 157 | | // Example: | 158 | | // - ask for 11 integers | 159 | | // - round up 11+2 == 13 up to 16 items | 160 | | // - return 14 items | 161 | | // - 14 integers is 56 bytes, plus 8 byte GC header => 64 byte alloc. | 162 | 0 | return RoundUp(num_desired + kHeaderFudge) - kHeaderFudge; | 163 | 1 | } |
_ZN4ListIP6Tuple2IiP6BigStrEE12HowManyItemsEi Line | Count | Source | 137 | 7 | int HowManyItems(int num_desired) { | 138 | | // Using the 24-byte pool leads to too much GC of tiny slab objects! So | 139 | | // just use the larger 48 byte pool. | 140 | | #if 0 | 141 | | if (num_desired <= kNumItems1) { // use full cell in pool 1 | 142 | | return kNumItems1; | 143 | | } | 144 | | #endif | 145 | 7 | if (num_desired <= kNumItems2) { // use full cell in pool 2 | 146 | 7 | return kNumItems2; | 147 | 7 | } | 148 | | #if 0 | 149 | | if (num_desired <= kMinItems2) { // 48 -> 128, not 48 -> 64 | 150 | | return kMinItems2; | 151 | | } | 152 | | #endif | 153 | | | 154 | | // Make sure the total allocation is a power of 2. TODO: consider using | 155 | | // slightly less than power of 2, to account for malloc() headers, and | 156 | | // reduce fragmentation. | 157 | | // Example: | 158 | | // - ask for 11 integers | 159 | | // - round up 11+2 == 13 up to 16 items | 160 | | // - return 14 items | 161 | | // - 14 integers is 56 bytes, plus 8 byte GC header => 64 byte alloc. | 162 | 0 | return RoundUp(num_desired + kHeaderFudge) - kHeaderFudge; | 163 | 7 | } |
_ZN4ListIPN11pretty_asdl11MeasuredDocEE12HowManyItemsEi Line | Count | Source | 137 | 719 | int HowManyItems(int num_desired) { | 138 | | // Using the 24-byte pool leads to too much GC of tiny slab objects! So | 139 | | // just use the larger 48 byte pool. | 140 | | #if 0 | 141 | | if (num_desired <= kNumItems1) { // use full cell in pool 1 | 142 | | return kNumItems1; | 143 | | } | 144 | | #endif | 145 | 719 | if (num_desired <= kNumItems2) { // use full cell in pool 2 | 146 | 609 | return kNumItems2; | 147 | 609 | } | 148 | | #if 0 | 149 | | if (num_desired <= kMinItems2) { // 48 -> 128, not 48 -> 64 | 150 | | return kMinItems2; | 151 | | } | 152 | | #endif | 153 | | | 154 | | // Make sure the total allocation is a power of 2. TODO: consider using | 155 | | // slightly less than power of 2, to account for malloc() headers, and | 156 | | // reduce fragmentation. | 157 | | // Example: | 158 | | // - ask for 11 integers | 159 | | // - round up 11+2 == 13 up to 16 items | 160 | | // - return 14 items | 161 | | // - 14 integers is 56 bytes, plus 8 byte GC header => 64 byte alloc. | 162 | 110 | return RoundUp(num_desired + kHeaderFudge) - kHeaderFudge; | 163 | 719 | } |
_ZN4ListIPN11pretty_asdl11DocFragmentEE12HowManyItemsEi Line | Count | Source | 137 | 57 | int HowManyItems(int num_desired) { | 138 | | // Using the 24-byte pool leads to too much GC of tiny slab objects! So | 139 | | // just use the larger 48 byte pool. | 140 | | #if 0 | 141 | | if (num_desired <= kNumItems1) { // use full cell in pool 1 | 142 | | return kNumItems1; | 143 | | } | 144 | | #endif | 145 | 57 | if (num_desired <= kNumItems2) { // use full cell in pool 2 | 146 | 19 | return kNumItems2; | 147 | 19 | } | 148 | | #if 0 | 149 | | if (num_desired <= kMinItems2) { // 48 -> 128, not 48 -> 64 | 150 | | return kMinItems2; | 151 | | } | 152 | | #endif | 153 | | | 154 | | // Make sure the total allocation is a power of 2. TODO: consider using | 155 | | // slightly less than power of 2, to account for malloc() headers, and | 156 | | // reduce fragmentation. | 157 | | // Example: | 158 | | // - ask for 11 integers | 159 | | // - round up 11+2 == 13 up to 16 items | 160 | | // - return 14 items | 161 | | // - 14 integers is 56 bytes, plus 8 byte GC header => 64 byte alloc. | 162 | 38 | return RoundUp(num_desired + kHeaderFudge) - kHeaderFudge; | 163 | 57 | } |
_ZN4ListIPN10hnode_asdl5FieldEE12HowManyItemsEi Line | Count | Source | 137 | 57 | int HowManyItems(int num_desired) { | 138 | | // Using the 24-byte pool leads to too much GC of tiny slab objects! So | 139 | | // just use the larger 48 byte pool. | 140 | | #if 0 | 141 | | if (num_desired <= kNumItems1) { // use full cell in pool 1 | 142 | | return kNumItems1; | 143 | | } | 144 | | #endif | 145 | 57 | if (num_desired <= kNumItems2) { // use full cell in pool 2 | 146 | 57 | return kNumItems2; | 147 | 57 | } | 148 | | #if 0 | 149 | | if (num_desired <= kMinItems2) { // 48 -> 128, not 48 -> 64 | 150 | | return kMinItems2; | 151 | | } | 152 | | #endif | 153 | | | 154 | | // Make sure the total allocation is a power of 2. TODO: consider using | 155 | | // slightly less than power of 2, to account for malloc() headers, and | 156 | | // reduce fragmentation. | 157 | | // Example: | 158 | | // - ask for 11 integers | 159 | | // - round up 11+2 == 13 up to 16 items | 160 | | // - return 14 items | 161 | | // - 14 integers is 56 bytes, plus 8 byte GC header => 64 byte alloc. | 162 | 0 | return RoundUp(num_desired + kHeaderFudge) - kHeaderFudge; | 163 | 57 | } |
Unexecuted instantiation: _ZN4ListIPN10hnode_asdl7hnode_tEE12HowManyItemsEi _ZN4ListIbE12HowManyItemsEi Line | Count | Source | 137 | 3 | int HowManyItems(int num_desired) { | 138 | | // Using the 24-byte pool leads to too much GC of tiny slab objects! So | 139 | | // just use the larger 48 byte pool. | 140 | | #if 0 | 141 | | if (num_desired <= kNumItems1) { // use full cell in pool 1 | 142 | | return kNumItems1; | 143 | | } | 144 | | #endif | 145 | 3 | if (num_desired <= kNumItems2) { // use full cell in pool 2 | 146 | 3 | return kNumItems2; | 147 | 3 | } | 148 | | #if 0 | 149 | | if (num_desired <= kMinItems2) { // 48 -> 128, not 48 -> 64 | 150 | | return kMinItems2; | 151 | | } | 152 | | #endif | 153 | | | 154 | | // Make sure the total allocation is a power of 2. TODO: consider using | 155 | | // slightly less than power of 2, to account for malloc() headers, and | 156 | | // reduce fragmentation. | 157 | | // Example: | 158 | | // - ask for 11 integers | 159 | | // - round up 11+2 == 13 up to 16 items | 160 | | // - return 14 items | 161 | | // - 14 integers is 56 bytes, plus 8 byte GC header => 64 byte alloc. | 162 | 0 | return RoundUp(num_desired + kHeaderFudge) - kHeaderFudge; | 163 | 3 | } |
Unexecuted instantiation: _ZN4ListIPN15test_classes_gc10OpaqueBaseEE12HowManyItemsEi Unexecuted instantiation: _ZN4ListIPN15test_classes_gc12PointersBaseEE12HowManyItemsEi Unexecuted instantiation: _ZN4ListIPN15test_classes_gc14BaseWithMethodEE12HowManyItemsEi _ZN4ListIlE12HowManyItemsEi Line | Count | Source | 137 | 2 | int HowManyItems(int num_desired) { | 138 | | // Using the 24-byte pool leads to too much GC of tiny slab objects! So | 139 | | // just use the larger 48 byte pool. | 140 | | #if 0 | 141 | | if (num_desired <= kNumItems1) { // use full cell in pool 1 | 142 | | return kNumItems1; | 143 | | } | 144 | | #endif | 145 | 2 | if (num_desired <= kNumItems2) { // use full cell in pool 2 | 146 | 2 | return kNumItems2; | 147 | 2 | } | 148 | | #if 0 | 149 | | if (num_desired <= kMinItems2) { // 48 -> 128, not 48 -> 64 | 150 | | return kMinItems2; | 151 | | } | 152 | | #endif | 153 | | | 154 | | // Make sure the total allocation is a power of 2. TODO: consider using | 155 | | // slightly less than power of 2, to account for malloc() headers, and | 156 | | // reduce fragmentation. | 157 | | // Example: | 158 | | // - ask for 11 integers | 159 | | // - round up 11+2 == 13 up to 16 items | 160 | | // - return 14 items | 161 | | // - 14 integers is 56 bytes, plus 8 byte GC header => 64 byte alloc. | 162 | 0 | return RoundUp(num_desired + kHeaderFudge) - kHeaderFudge; | 163 | 2 | } |
_ZN4ListIP6Tuple2IiiEE12HowManyItemsEi Line | Count | Source | 137 | 4 | int HowManyItems(int num_desired) { | 138 | | // Using the 24-byte pool leads to too much GC of tiny slab objects! So | 139 | | // just use the larger 48 byte pool. | 140 | | #if 0 | 141 | | if (num_desired <= kNumItems1) { // use full cell in pool 1 | 142 | | return kNumItems1; | 143 | | } | 144 | | #endif | 145 | 4 | if (num_desired <= kNumItems2) { // use full cell in pool 2 | 146 | 4 | return kNumItems2; | 147 | 4 | } | 148 | | #if 0 | 149 | | if (num_desired <= kMinItems2) { // 48 -> 128, not 48 -> 64 | 150 | | return kMinItems2; | 151 | | } | 152 | | #endif | 153 | | | 154 | | // Make sure the total allocation is a power of 2. TODO: consider using | 155 | | // slightly less than power of 2, to account for malloc() headers, and | 156 | | // reduce fragmentation. | 157 | | // Example: | 158 | | // - ask for 11 integers | 159 | | // - round up 11+2 == 13 up to 16 items | 160 | | // - return 14 items | 161 | | // - 14 integers is 56 bytes, plus 8 byte GC header => 64 byte alloc. | 162 | 0 | return RoundUp(num_desired + kHeaderFudge) - kHeaderFudge; | 163 | 4 | } |
_ZN4ListIPN4pyos11PasswdEntryEE12HowManyItemsEi Line | Count | Source | 137 | 4 | int HowManyItems(int num_desired) { | 138 | | // Using the 24-byte pool leads to too much GC of tiny slab objects! So | 139 | | // just use the larger 48 byte pool. | 140 | | #if 0 | 141 | | if (num_desired <= kNumItems1) { // use full cell in pool 1 | 142 | | return kNumItems1; | 143 | | } | 144 | | #endif | 145 | 4 | if (num_desired <= kNumItems2) { // use full cell in pool 2 | 146 | 1 | return kNumItems2; | 147 | 1 | } | 148 | | #if 0 | 149 | | if (num_desired <= kMinItems2) { // 48 -> 128, not 48 -> 64 | 150 | | return kMinItems2; | 151 | | } | 152 | | #endif | 153 | | | 154 | | // Make sure the total allocation is a power of 2. TODO: consider using | 155 | | // slightly less than power of 2, to account for malloc() headers, and | 156 | | // reduce fragmentation. | 157 | | // Example: | 158 | | // - ask for 11 integers | 159 | | // - round up 11+2 == 13 up to 16 items | 160 | | // - return 14 items | 161 | | // - 14 integers is 56 bytes, plus 8 byte GC header => 64 byte alloc. | 162 | 3 | return RoundUp(num_desired + kHeaderFudge) - kHeaderFudge; | 163 | 4 | } |
Unexecuted instantiation: _ZN4ListIPS_IP6Tuple2IiiEEE12HowManyItemsEi Unexecuted instantiation: _ZN4ListIPN11syntax_asdl12CompoundWordEE12HowManyItemsEi Unexecuted instantiation: _ZN4ListIP6Tuple2IP6BigStrbEE12HowManyItemsEi |
164 | | }; |
165 | | |
166 | | // "Constructors" as free functions since we can't allocate within a |
167 | | // constructor. Allocation may cause garbage collection, which interferes with |
168 | | // placement new. |
169 | | |
170 | | // This is not really necessary, only syntactic sugar. |
171 | | template <typename T> |
172 | 669 | List<T>* NewList() { |
173 | 669 | return Alloc<List<T>>(); |
174 | 669 | } Line | Count | Source | 172 | 635 | List<T>* NewList() { | 173 | 635 | return Alloc<List<T>>(); | 174 | 635 | } |
_Z7NewListIP6BigStrEP4ListIT_Ev Line | Count | Source | 172 | 28 | List<T>* NewList() { | 173 | 28 | return Alloc<List<T>>(); | 174 | 28 | } |
Unexecuted instantiation: _Z7NewListIPN10hnode_asdl7hnode_tEEP4ListIT_Ev Unexecuted instantiation: _Z7NewListIPN10hnode_asdl5FieldEEP4ListIT_Ev _Z7NewListIPiEP4ListIT_Ev Line | Count | Source | 172 | 2 | List<T>* NewList() { | 173 | 2 | return Alloc<List<T>>(); | 174 | 2 | } |
_Z7NewListIPN4pyos11PasswdEntryEEP4ListIT_Ev Line | Count | Source | 172 | 1 | List<T>* NewList() { | 173 | 1 | return Alloc<List<T>>(); | 174 | 1 | } |
Unexecuted instantiation: _Z7NewListIPN11syntax_asdl12CompoundWordEEP4ListIT_Ev _Z7NewListIP6Tuple2IiP6BigStrEEP4ListIT_Ev Line | Count | Source | 172 | 3 | List<T>* NewList() { | 173 | 3 | return Alloc<List<T>>(); | 174 | 3 | } |
|
175 | | |
176 | | // Literal ['foo', 'bar'] |
177 | | // This seems to allow better template argument type deduction than a |
178 | | // constructor. |
179 | | template <typename T> |
180 | 345 | List<T>* NewList(std::initializer_list<T> init) { |
181 | 345 | auto self = Alloc<List<T>>(); |
182 | | |
183 | 345 | int n = init.size(); |
184 | 345 | self->reserve(n); |
185 | | |
186 | 345 | int i = 0; |
187 | 855 | for (auto item : init) { |
188 | 855 | self->slab_->items_[i] = item; |
189 | 855 | ++i; |
190 | 855 | } |
191 | 345 | self->len_ = n; |
192 | 345 | return self; |
193 | 345 | } _Z7NewListIP6BigStrEP4ListIT_ESt16initializer_listIS3_E Line | Count | Source | 180 | 71 | List<T>* NewList(std::initializer_list<T> init) { | 181 | 71 | auto self = Alloc<List<T>>(); | 182 | | | 183 | 71 | int n = init.size(); | 184 | 71 | self->reserve(n); | 185 | | | 186 | 71 | int i = 0; | 187 | 93 | for (auto item : init) { | 188 | 93 | self->slab_->items_[i] = item; | 189 | 93 | ++i; | 190 | 93 | } | 191 | 71 | self->len_ = n; | 192 | 71 | return self; | 193 | 71 | } |
_Z7NewListIiEP4ListIT_ESt16initializer_listIS1_E Line | Count | Source | 180 | 33 | List<T>* NewList(std::initializer_list<T> init) { | 181 | 33 | auto self = Alloc<List<T>>(); | 182 | | | 183 | 33 | int n = init.size(); | 184 | 33 | self->reserve(n); | 185 | | | 186 | 33 | int i = 0; | 187 | 128 | for (auto item : init) { | 188 | 128 | self->slab_->items_[i] = item; | 189 | 128 | ++i; | 190 | 128 | } | 191 | 33 | self->len_ = n; | 192 | 33 | return self; | 193 | 33 | } |
_Z7NewListIP6Tuple2IP6BigStriEEP4ListIT_ESt16initializer_listIS6_E Line | Count | Source | 180 | 1 | List<T>* NewList(std::initializer_list<T> init) { | 181 | 1 | auto self = Alloc<List<T>>(); | 182 | | | 183 | 1 | int n = init.size(); | 184 | 1 | self->reserve(n); | 185 | | | 186 | 1 | int i = 0; | 187 | 2 | for (auto item : init) { | 188 | 2 | self->slab_->items_[i] = item; | 189 | 2 | ++i; | 190 | 2 | } | 191 | 1 | self->len_ = n; | 192 | 1 | return self; | 193 | 1 | } |
_Z7NewListIP6Tuple2IiP6BigStrEEP4ListIT_ESt16initializer_listIS6_E Line | Count | Source | 180 | 1 | List<T>* NewList(std::initializer_list<T> init) { | 181 | 1 | auto self = Alloc<List<T>>(); | 182 | | | 183 | 1 | int n = init.size(); | 184 | 1 | self->reserve(n); | 185 | | | 186 | 1 | int i = 0; | 187 | 2 | for (auto item : init) { | 188 | 2 | self->slab_->items_[i] = item; | 189 | 2 | ++i; | 190 | 2 | } | 191 | 1 | self->len_ = n; | 192 | 1 | return self; | 193 | 1 | } |
_Z7NewListIPN11pretty_asdl11MeasuredDocEEP4ListIT_ESt16initializer_listIS4_E Line | Count | Source | 180 | 219 | List<T>* NewList(std::initializer_list<T> init) { | 181 | 219 | auto self = Alloc<List<T>>(); | 182 | | | 183 | 219 | int n = init.size(); | 184 | 219 | self->reserve(n); | 185 | | | 186 | 219 | int i = 0; | 187 | 609 | for (auto item : init) { | 188 | 609 | self->slab_->items_[i] = item; | 189 | 609 | ++i; | 190 | 609 | } | 191 | 219 | self->len_ = n; | 192 | 219 | return self; | 193 | 219 | } |
_Z7NewListIPN11pretty_asdl11DocFragmentEEP4ListIT_ESt16initializer_listIS4_E Line | Count | Source | 180 | 19 | List<T>* NewList(std::initializer_list<T> init) { | 181 | 19 | auto self = Alloc<List<T>>(); | 182 | | | 183 | 19 | int n = init.size(); | 184 | 19 | self->reserve(n); | 185 | | | 186 | 19 | int i = 0; | 187 | 19 | for (auto item : init) { | 188 | 19 | self->slab_->items_[i] = item; | 189 | 19 | ++i; | 190 | 19 | } | 191 | 19 | self->len_ = n; | 192 | 19 | return self; | 193 | 19 | } |
_Z7NewListIbEP4ListIT_ESt16initializer_listIS1_E Line | Count | Source | 180 | 1 | List<T>* NewList(std::initializer_list<T> init) { | 181 | 1 | auto self = Alloc<List<T>>(); | 182 | | | 183 | 1 | int n = init.size(); | 184 | 1 | self->reserve(n); | 185 | | | 186 | 1 | int i = 0; | 187 | 2 | for (auto item : init) { | 188 | 2 | self->slab_->items_[i] = item; | 189 | 2 | ++i; | 190 | 2 | } | 191 | 1 | self->len_ = n; | 192 | 1 | return self; | 193 | 1 | } |
Unexecuted instantiation: _Z7NewListIP6Tuple2IiiEEP4ListIT_ESt16initializer_listIS4_E |
194 | | |
195 | | // ['foo'] * 3 |
196 | | template <typename T> |
197 | 9 | List<T>* NewList(T item, int times) { |
198 | 9 | auto self = Alloc<List<T>>(); |
199 | | |
200 | 9 | self->reserve(times); |
201 | 9 | self->len_ = times; |
202 | 36 | for (int i = 0; i < times; ++i) { |
203 | 27 | self->set(i, item); |
204 | 27 | } |
205 | 9 | return self; |
206 | 9 | } _Z7NewListIP6BigStrEP4ListIT_ES3_i Line | Count | Source | 197 | 3 | List<T>* NewList(T item, int times) { | 198 | 3 | auto self = Alloc<List<T>>(); | 199 | | | 200 | 3 | self->reserve(times); | 201 | 3 | self->len_ = times; | 202 | 12 | for (int i = 0; i < times; ++i) { | 203 | 9 | self->set(i, item); | 204 | 9 | } | 205 | 3 | return self; | 206 | 3 | } |
_Z7NewListIbEP4ListIT_ES1_i Line | Count | Source | 197 | 2 | List<T>* NewList(T item, int times) { | 198 | 2 | auto self = Alloc<List<T>>(); | 199 | | | 200 | 2 | self->reserve(times); | 201 | 2 | self->len_ = times; | 202 | 8 | for (int i = 0; i < times; ++i) { | 203 | 6 | self->set(i, item); | 204 | 6 | } | 205 | 2 | return self; | 206 | 2 | } |
_Z7NewListIiEP4ListIT_ES1_i Line | Count | Source | 197 | 4 | List<T>* NewList(T item, int times) { | 198 | 4 | auto self = Alloc<List<T>>(); | 199 | | | 200 | 4 | self->reserve(times); | 201 | 4 | self->len_ = times; | 202 | 16 | for (int i = 0; i < times; ++i) { | 203 | 12 | self->set(i, item); | 204 | 12 | } | 205 | 4 | return self; | 206 | 4 | } |
|
207 | | |
208 | | template <typename T> |
209 | 8.16k | void List<T>::append(T item) { |
210 | 8.16k | reserve(len_ + 1); |
211 | 8.16k | slab_->items_[len_] = item; |
212 | 8.16k | ++len_; |
213 | 8.16k | } Line | Count | Source | 209 | 5.13k | void List<T>::append(T item) { | 210 | 5.13k | reserve(len_ + 1); | 211 | 5.13k | slab_->items_[len_] = item; | 212 | 5.13k | ++len_; | 213 | 5.13k | } |
_ZN4ListIP6BigStrE6appendES1_ Line | Count | Source | 209 | 623 | void List<T>::append(T item) { | 210 | 623 | reserve(len_ + 1); | 211 | 623 | slab_->items_[len_] = item; | 212 | 623 | ++len_; | 213 | 623 | } |
_ZN4ListIPN11pretty_asdl11MeasuredDocEE6appendES2_ Line | Count | Source | 209 | 1.47k | void List<T>::append(T item) { | 210 | 1.47k | reserve(len_ + 1); | 211 | 1.47k | slab_->items_[len_] = item; | 212 | 1.47k | ++len_; | 213 | 1.47k | } |
_ZN4ListIPN11pretty_asdl11DocFragmentEE6appendES2_ Line | Count | Source | 209 | 781 | void List<T>::append(T item) { | 210 | 781 | reserve(len_ + 1); | 211 | 781 | slab_->items_[len_] = item; | 212 | 781 | ++len_; | 213 | 781 | } |
_ZN4ListIPN10hnode_asdl5FieldEE6appendES2_ Line | Count | Source | 209 | 105 | void List<T>::append(T item) { | 210 | 105 | reserve(len_ + 1); | 211 | 105 | slab_->items_[len_] = item; | 212 | 105 | ++len_; | 213 | 105 | } |
Unexecuted instantiation: _ZN4ListIPN10hnode_asdl7hnode_tEE6appendES2_ Unexecuted instantiation: _ZN4ListIPN15test_classes_gc10OpaqueBaseEE6appendES2_ Unexecuted instantiation: _ZN4ListIPN15test_classes_gc12PointersBaseEE6appendES2_ Unexecuted instantiation: _ZN4ListIPN15test_classes_gc14BaseWithMethodEE6appendES2_ _ZN4ListIP6Tuple2IiP6BigStrEE6appendES4_ Line | Count | Source | 209 | 20 | void List<T>::append(T item) { | 210 | 20 | reserve(len_ + 1); | 211 | 20 | slab_->items_[len_] = item; | 212 | 20 | ++len_; | 213 | 20 | } |
Line | Count | Source | 209 | 4 | void List<T>::append(T item) { | 210 | 4 | reserve(len_ + 1); | 211 | 4 | slab_->items_[len_] = item; | 212 | 4 | ++len_; | 213 | 4 | } |
_ZN4ListIP6Tuple2IiiEE6appendES2_ Line | Count | Source | 209 | 8 | void List<T>::append(T item) { | 210 | 8 | reserve(len_ + 1); | 211 | 8 | slab_->items_[len_] = item; | 212 | 8 | ++len_; | 213 | 8 | } |
_ZN4ListIPN4pyos11PasswdEntryEE6appendES2_ Line | Count | Source | 209 | 20 | void List<T>::append(T item) { | 210 | 20 | reserve(len_ + 1); | 211 | 20 | slab_->items_[len_] = item; | 212 | 20 | ++len_; | 213 | 20 | } |
Unexecuted instantiation: _ZN4ListIPS_IP6Tuple2IiiEEE6appendES4_ Unexecuted instantiation: _ZN4ListIP6Tuple2IP6BigStrbEE6appendES4_ |
214 | | |
215 | | template <typename T> |
216 | 5.90k | int len(const List<T>* L) { |
217 | 5.90k | return L->len_; |
218 | 5.90k | } Line | Count | Source | 216 | 3.98k | int len(const List<T>* L) { | 217 | 3.98k | return L->len_; | 218 | 3.98k | } |
_Z3lenIP6BigStrEiPK4ListIT_E Line | Count | Source | 216 | 206 | int len(const List<T>* L) { | 217 | 206 | return L->len_; | 218 | 206 | } |
Unexecuted instantiation: _Z3lenIPN11pretty_asdl11MeasuredDocEEiPK4ListIT_E Unexecuted instantiation: _Z3lenIPN10hnode_asdl7hnode_tEEiPK4ListIT_E _Z3lenIPN10hnode_asdl5FieldEEiPK4ListIT_E Line | Count | Source | 216 | 57 | int len(const List<T>* L) { | 217 | 57 | return L->len_; | 218 | 57 | } |
_Z3lenIPN11pretty_asdl11DocFragmentEEiPK4ListIT_E Line | Count | Source | 216 | 1.63k | int len(const List<T>* L) { | 217 | 1.63k | return L->len_; | 218 | 1.63k | } |
Unexecuted instantiation: _Z3lenIPN15test_classes_gc10OpaqueBaseEEiPK4ListIT_E Unexecuted instantiation: _Z3lenIPN15test_classes_gc12PointersBaseEEiPK4ListIT_E Unexecuted instantiation: _Z3lenIPN15test_classes_gc14BaseWithMethodEEiPK4ListIT_E _Z3lenIP6Tuple2IiP6BigStrEEiPK4ListIT_E Line | Count | Source | 216 | 7 | int len(const List<T>* L) { | 217 | 7 | return L->len_; | 218 | 7 | } |
Line | Count | Source | 216 | 2 | int len(const List<T>* L) { | 217 | 2 | return L->len_; | 218 | 2 | } |
_Z3lenIP6Tuple2IiiEEiPK4ListIT_E Line | Count | Source | 216 | 4 | int len(const List<T>* L) { | 217 | 4 | return L->len_; | 218 | 4 | } |
Line | Count | Source | 216 | 2 | int len(const List<T>* L) { | 217 | 2 | return L->len_; | 218 | 2 | } |
_Z3lenIPN4pyos11PasswdEntryEEiPK4ListIT_E Line | Count | Source | 216 | 1 | int len(const List<T>* L) { | 217 | 1 | return L->len_; | 218 | 1 | } |
|
219 | | |
220 | | template <typename T> |
221 | | List<T>* list_repeat(T item, int times); |
222 | | |
223 | | template <typename T> |
224 | | inline bool list_contains(List<T>* haystack, T needle); |
225 | | |
226 | | template <typename K, typename V> |
227 | | class Dict; // forward decl |
228 | | |
229 | | template <typename V> |
230 | | List<BigStr*>* sorted(Dict<BigStr*, V>* d); |
231 | | |
232 | | template <typename T> |
233 | | List<T>* sorted(List<T>* l); |
234 | | |
235 | | // L[begin:] |
236 | | template <typename T> |
237 | 606 | List<T>* List<T>::slice(int begin) { |
238 | 606 | return slice(begin, len_); |
239 | 606 | } _ZN4ListIP6BigStrE5sliceEi Line | Count | Source | 237 | 3 | List<T>* List<T>::slice(int begin) { | 238 | 3 | return slice(begin, len_); | 239 | 3 | } |
Line | Count | Source | 237 | 603 | List<T>* List<T>::slice(int begin) { | 238 | 603 | return slice(begin, len_); | 239 | 603 | } |
Unexecuted instantiation: _ZN4ListIPN11syntax_asdl12CompoundWordEE5sliceEi |
240 | | |
241 | | // L[begin:end] |
242 | | template <typename T> |
243 | 611 | List<T>* List<T>::slice(int begin, int end) { |
244 | 611 | SLICE_ADJUST(begin, end, len_); |
245 | | |
246 | 611 | DCHECK(0 <= begin && begin <= len_); |
247 | 611 | DCHECK(0 <= end && end <= len_); |
248 | | |
249 | 0 | int new_len = end - begin; |
250 | 611 | DCHECK(0 <= new_len && new_len <= len_); |
251 | | |
252 | 0 | List<T>* result = NewList<T>(); |
253 | 611 | result->reserve(new_len); |
254 | | |
255 | | // Faster than append() in a loop |
256 | 611 | memcpy(result->slab_->items_, slab_->items_ + begin, new_len * sizeof(T)); |
257 | 611 | result->len_ = new_len; |
258 | | |
259 | 611 | return result; |
260 | 611 | } _ZN4ListIP6BigStrE5sliceEii Line | Count | Source | 243 | 3 | List<T>* List<T>::slice(int begin, int end) { | 244 | 3 | SLICE_ADJUST(begin, end, len_); | 245 | | | 246 | 3 | DCHECK(0 <= begin && begin <= len_); | 247 | 3 | DCHECK(0 <= end && end <= len_); | 248 | | | 249 | 0 | int new_len = end - begin; | 250 | 3 | DCHECK(0 <= new_len && new_len <= len_); | 251 | | | 252 | 0 | List<T>* result = NewList<T>(); | 253 | 3 | result->reserve(new_len); | 254 | | | 255 | | // Faster than append() in a loop | 256 | 3 | memcpy(result->slab_->items_, slab_->items_ + begin, new_len * sizeof(T)); | 257 | 3 | result->len_ = new_len; | 258 | | | 259 | 3 | return result; | 260 | 3 | } |
Line | Count | Source | 243 | 608 | List<T>* List<T>::slice(int begin, int end) { | 244 | 608 | SLICE_ADJUST(begin, end, len_); | 245 | | | 246 | 608 | DCHECK(0 <= begin && begin <= len_); | 247 | 608 | DCHECK(0 <= end && end <= len_); | 248 | | | 249 | 0 | int new_len = end - begin; | 250 | 608 | DCHECK(0 <= new_len && new_len <= len_); | 251 | | | 252 | 0 | List<T>* result = NewList<T>(); | 253 | 608 | result->reserve(new_len); | 254 | | | 255 | | // Faster than append() in a loop | 256 | 608 | memcpy(result->slab_->items_, slab_->items_ + begin, new_len * sizeof(T)); | 257 | 608 | result->len_ = new_len; | 258 | | | 259 | 608 | return result; | 260 | 608 | } |
Unexecuted instantiation: _ZN4ListIPN11syntax_asdl12CompoundWordEE5sliceEii |
261 | | |
262 | | // Ensure that there's space for a number of items |
263 | | template <typename T> |
264 | 9.17k | void List<T>::reserve(int num_desired) { |
265 | | // log("reserve capacity = %d, n = %d", capacity_, n); |
266 | | |
267 | | // Don't do anything if there's already enough space. |
268 | 9.17k | if (capacity_ >= num_desired) { |
269 | 7.42k | return; |
270 | 7.42k | } |
271 | | |
272 | | // Slabs should be a total of 2^N bytes. kCapacityAdjust is the number of |
273 | | // items that the 8 byte header takes up: 1 for List<T*>, and 2 for |
274 | | // List<int>. |
275 | | // |
276 | | // Example: the user reserves space for 3 integers. The minimum number of |
277 | | // items would be 5, which is rounded up to 8. Subtract 2 again, giving 6, |
278 | | // which leads to 8 + 6*4 = 32 byte Slab. |
279 | | |
280 | 1.75k | capacity_ = HowManyItems(num_desired); |
281 | 1.75k | auto new_slab = NewSlab<T>(capacity_); |
282 | | |
283 | 1.75k | if (len_ > 0) { |
284 | | // log("Copying %d bytes", len_ * sizeof(T)); |
285 | 216 | memcpy(new_slab->items_, slab_->items_, len_ * sizeof(T)); |
286 | 216 | } |
287 | 1.75k | slab_ = new_slab; |
288 | 1.75k | } Line | Count | Source | 264 | 5.80k | void List<T>::reserve(int num_desired) { | 265 | | // log("reserve capacity = %d, n = %d", capacity_, n); | 266 | | | 267 | | // Don't do anything if there's already enough space. | 268 | 5.80k | if (capacity_ >= num_desired) { | 269 | 5.08k | return; | 270 | 5.08k | } | 271 | | | 272 | | // Slabs should be a total of 2^N bytes. kCapacityAdjust is the number of | 273 | | // items that the 8 byte header takes up: 1 for List<T*>, and 2 for | 274 | | // List<int>. | 275 | | // | 276 | | // Example: the user reserves space for 3 integers. The minimum number of | 277 | | // items would be 5, which is rounded up to 8. Subtract 2 again, giving 6, | 278 | | // which leads to 8 + 6*4 = 32 byte Slab. | 279 | | | 280 | 726 | capacity_ = HowManyItems(num_desired); | 281 | 726 | auto new_slab = NewSlab<T>(capacity_); | 282 | | | 283 | 726 | if (len_ > 0) { | 284 | | // log("Copying %d bytes", len_ * sizeof(T)); | 285 | 30 | memcpy(new_slab->items_, slab_->items_, len_ * sizeof(T)); | 286 | 30 | } | 287 | 726 | slab_ = new_slab; | 288 | 726 | } |
_ZN4ListIP6BigStrE7reserveEi Line | Count | Source | 264 | 714 | void List<T>::reserve(int num_desired) { | 265 | | // log("reserve capacity = %d, n = %d", capacity_, n); | 266 | | | 267 | | // Don't do anything if there's already enough space. | 268 | 714 | if (capacity_ >= num_desired) { | 269 | 544 | return; | 270 | 544 | } | 271 | | | 272 | | // Slabs should be a total of 2^N bytes. kCapacityAdjust is the number of | 273 | | // items that the 8 byte header takes up: 1 for List<T*>, and 2 for | 274 | | // List<int>. | 275 | | // | 276 | | // Example: the user reserves space for 3 integers. The minimum number of | 277 | | // items would be 5, which is rounded up to 8. Subtract 2 again, giving 6, | 278 | | // which leads to 8 + 6*4 = 32 byte Slab. | 279 | | | 280 | 170 | capacity_ = HowManyItems(num_desired); | 281 | 170 | auto new_slab = NewSlab<T>(capacity_); | 282 | | | 283 | 170 | if (len_ > 0) { | 284 | | // log("Copying %d bytes", len_ * sizeof(T)); | 285 | 35 | memcpy(new_slab->items_, slab_->items_, len_ * sizeof(T)); | 286 | 35 | } | 287 | 170 | slab_ = new_slab; | 288 | 170 | } |
_ZN4ListIP6Tuple2IP6BigStriEE7reserveEi Line | Count | Source | 264 | 1 | void List<T>::reserve(int num_desired) { | 265 | | // log("reserve capacity = %d, n = %d", capacity_, n); | 266 | | | 267 | | // Don't do anything if there's already enough space. | 268 | 1 | if (capacity_ >= num_desired) { | 269 | 0 | return; | 270 | 0 | } | 271 | | | 272 | | // Slabs should be a total of 2^N bytes. kCapacityAdjust is the number of | 273 | | // items that the 8 byte header takes up: 1 for List<T*>, and 2 for | 274 | | // List<int>. | 275 | | // | 276 | | // Example: the user reserves space for 3 integers. The minimum number of | 277 | | // items would be 5, which is rounded up to 8. Subtract 2 again, giving 6, | 278 | | // which leads to 8 + 6*4 = 32 byte Slab. | 279 | | | 280 | 1 | capacity_ = HowManyItems(num_desired); | 281 | 1 | auto new_slab = NewSlab<T>(capacity_); | 282 | | | 283 | 1 | if (len_ > 0) { | 284 | | // log("Copying %d bytes", len_ * sizeof(T)); | 285 | 0 | memcpy(new_slab->items_, slab_->items_, len_ * sizeof(T)); | 286 | 0 | } | 287 | 1 | slab_ = new_slab; | 288 | 1 | } |
_ZN4ListIP6Tuple2IiP6BigStrEE7reserveEi Line | Count | Source | 264 | 21 | void List<T>::reserve(int num_desired) { | 265 | | // log("reserve capacity = %d, n = %d", capacity_, n); | 266 | | | 267 | | // Don't do anything if there's already enough space. | 268 | 21 | if (capacity_ >= num_desired) { | 269 | 14 | return; | 270 | 14 | } | 271 | | | 272 | | // Slabs should be a total of 2^N bytes. kCapacityAdjust is the number of | 273 | | // items that the 8 byte header takes up: 1 for List<T*>, and 2 for | 274 | | // List<int>. | 275 | | // | 276 | | // Example: the user reserves space for 3 integers. The minimum number of | 277 | | // items would be 5, which is rounded up to 8. Subtract 2 again, giving 6, | 278 | | // which leads to 8 + 6*4 = 32 byte Slab. | 279 | | | 280 | 7 | capacity_ = HowManyItems(num_desired); | 281 | 7 | auto new_slab = NewSlab<T>(capacity_); | 282 | | | 283 | 7 | if (len_ > 0) { | 284 | | // log("Copying %d bytes", len_ * sizeof(T)); | 285 | 0 | memcpy(new_slab->items_, slab_->items_, len_ * sizeof(T)); | 286 | 0 | } | 287 | 7 | slab_ = new_slab; | 288 | 7 | } |
_ZN4ListIPN11pretty_asdl11MeasuredDocEE7reserveEi Line | Count | Source | 264 | 1.68k | void List<T>::reserve(int num_desired) { | 265 | | // log("reserve capacity = %d, n = %d", capacity_, n); | 266 | | | 267 | | // Don't do anything if there's already enough space. | 268 | 1.68k | if (capacity_ >= num_desired) { | 269 | 970 | return; | 270 | 970 | } | 271 | | | 272 | | // Slabs should be a total of 2^N bytes. kCapacityAdjust is the number of | 273 | | // items that the 8 byte header takes up: 1 for List<T*>, and 2 for | 274 | | // List<int>. | 275 | | // | 276 | | // Example: the user reserves space for 3 integers. The minimum number of | 277 | | // items would be 5, which is rounded up to 8. Subtract 2 again, giving 6, | 278 | | // which leads to 8 + 6*4 = 32 byte Slab. | 279 | | | 280 | 719 | capacity_ = HowManyItems(num_desired); | 281 | 719 | auto new_slab = NewSlab<T>(capacity_); | 282 | | | 283 | 719 | if (len_ > 0) { | 284 | | // log("Copying %d bytes", len_ * sizeof(T)); | 285 | 110 | memcpy(new_slab->items_, slab_->items_, len_ * sizeof(T)); | 286 | 110 | } | 287 | 719 | slab_ = new_slab; | 288 | 719 | } |
_ZN4ListIPN11pretty_asdl11DocFragmentEE7reserveEi Line | Count | Source | 264 | 800 | void List<T>::reserve(int num_desired) { | 265 | | // log("reserve capacity = %d, n = %d", capacity_, n); | 266 | | | 267 | | // Don't do anything if there's already enough space. | 268 | 800 | if (capacity_ >= num_desired) { | 269 | 743 | return; | 270 | 743 | } | 271 | | | 272 | | // Slabs should be a total of 2^N bytes. kCapacityAdjust is the number of | 273 | | // items that the 8 byte header takes up: 1 for List<T*>, and 2 for | 274 | | // List<int>. | 275 | | // | 276 | | // Example: the user reserves space for 3 integers. The minimum number of | 277 | | // items would be 5, which is rounded up to 8. Subtract 2 again, giving 6, | 278 | | // which leads to 8 + 6*4 = 32 byte Slab. | 279 | | | 280 | 57 | capacity_ = HowManyItems(num_desired); | 281 | 57 | auto new_slab = NewSlab<T>(capacity_); | 282 | | | 283 | 57 | if (len_ > 0) { | 284 | | // log("Copying %d bytes", len_ * sizeof(T)); | 285 | 38 | memcpy(new_slab->items_, slab_->items_, len_ * sizeof(T)); | 286 | 38 | } | 287 | 57 | slab_ = new_slab; | 288 | 57 | } |
_ZN4ListIPN10hnode_asdl5FieldEE7reserveEi Line | Count | Source | 264 | 105 | void List<T>::reserve(int num_desired) { | 265 | | // log("reserve capacity = %d, n = %d", capacity_, n); | 266 | | | 267 | | // Don't do anything if there's already enough space. | 268 | 105 | if (capacity_ >= num_desired) { | 269 | 48 | return; | 270 | 48 | } | 271 | | | 272 | | // Slabs should be a total of 2^N bytes. kCapacityAdjust is the number of | 273 | | // items that the 8 byte header takes up: 1 for List<T*>, and 2 for | 274 | | // List<int>. | 275 | | // | 276 | | // Example: the user reserves space for 3 integers. The minimum number of | 277 | | // items would be 5, which is rounded up to 8. Subtract 2 again, giving 6, | 278 | | // which leads to 8 + 6*4 = 32 byte Slab. | 279 | | | 280 | 57 | capacity_ = HowManyItems(num_desired); | 281 | 57 | auto new_slab = NewSlab<T>(capacity_); | 282 | | | 283 | 57 | if (len_ > 0) { | 284 | | // log("Copying %d bytes", len_ * sizeof(T)); | 285 | 0 | memcpy(new_slab->items_, slab_->items_, len_ * sizeof(T)); | 286 | 0 | } | 287 | 57 | slab_ = new_slab; | 288 | 57 | } |
Unexecuted instantiation: _ZN4ListIPN10hnode_asdl7hnode_tEE7reserveEi Line | Count | Source | 264 | 3 | void List<T>::reserve(int num_desired) { | 265 | | // log("reserve capacity = %d, n = %d", capacity_, n); | 266 | | | 267 | | // Don't do anything if there's already enough space. | 268 | 3 | if (capacity_ >= num_desired) { | 269 | 0 | return; | 270 | 0 | } | 271 | | | 272 | | // Slabs should be a total of 2^N bytes. kCapacityAdjust is the number of | 273 | | // items that the 8 byte header takes up: 1 for List<T*>, and 2 for | 274 | | // List<int>. | 275 | | // | 276 | | // Example: the user reserves space for 3 integers. The minimum number of | 277 | | // items would be 5, which is rounded up to 8. Subtract 2 again, giving 6, | 278 | | // which leads to 8 + 6*4 = 32 byte Slab. | 279 | | | 280 | 3 | capacity_ = HowManyItems(num_desired); | 281 | 3 | auto new_slab = NewSlab<T>(capacity_); | 282 | | | 283 | 3 | if (len_ > 0) { | 284 | | // log("Copying %d bytes", len_ * sizeof(T)); | 285 | 0 | memcpy(new_slab->items_, slab_->items_, len_ * sizeof(T)); | 286 | 0 | } | 287 | 3 | slab_ = new_slab; | 288 | 3 | } |
Unexecuted instantiation: _ZN4ListIPN15test_classes_gc10OpaqueBaseEE7reserveEi Unexecuted instantiation: _ZN4ListIPN15test_classes_gc12PointersBaseEE7reserveEi Unexecuted instantiation: _ZN4ListIPN15test_classes_gc14BaseWithMethodEE7reserveEi Line | Count | Source | 264 | 4 | void List<T>::reserve(int num_desired) { | 265 | | // log("reserve capacity = %d, n = %d", capacity_, n); | 266 | | | 267 | | // Don't do anything if there's already enough space. | 268 | 4 | if (capacity_ >= num_desired) { | 269 | 2 | return; | 270 | 2 | } | 271 | | | 272 | | // Slabs should be a total of 2^N bytes. kCapacityAdjust is the number of | 273 | | // items that the 8 byte header takes up: 1 for List<T*>, and 2 for | 274 | | // List<int>. | 275 | | // | 276 | | // Example: the user reserves space for 3 integers. The minimum number of | 277 | | // items would be 5, which is rounded up to 8. Subtract 2 again, giving 6, | 278 | | // which leads to 8 + 6*4 = 32 byte Slab. | 279 | | | 280 | 2 | capacity_ = HowManyItems(num_desired); | 281 | 2 | auto new_slab = NewSlab<T>(capacity_); | 282 | | | 283 | 2 | if (len_ > 0) { | 284 | | // log("Copying %d bytes", len_ * sizeof(T)); | 285 | 0 | memcpy(new_slab->items_, slab_->items_, len_ * sizeof(T)); | 286 | 0 | } | 287 | 2 | slab_ = new_slab; | 288 | 2 | } |
_ZN4ListIP6Tuple2IiiEE7reserveEi Line | Count | Source | 264 | 8 | void List<T>::reserve(int num_desired) { | 265 | | // log("reserve capacity = %d, n = %d", capacity_, n); | 266 | | | 267 | | // Don't do anything if there's already enough space. | 268 | 8 | if (capacity_ >= num_desired) { | 269 | 4 | return; | 270 | 4 | } | 271 | | | 272 | | // Slabs should be a total of 2^N bytes. kCapacityAdjust is the number of | 273 | | // items that the 8 byte header takes up: 1 for List<T*>, and 2 for | 274 | | // List<int>. | 275 | | // | 276 | | // Example: the user reserves space for 3 integers. The minimum number of | 277 | | // items would be 5, which is rounded up to 8. Subtract 2 again, giving 6, | 278 | | // which leads to 8 + 6*4 = 32 byte Slab. | 279 | | | 280 | 4 | capacity_ = HowManyItems(num_desired); | 281 | 4 | auto new_slab = NewSlab<T>(capacity_); | 282 | | | 283 | 4 | if (len_ > 0) { | 284 | | // log("Copying %d bytes", len_ * sizeof(T)); | 285 | 0 | memcpy(new_slab->items_, slab_->items_, len_ * sizeof(T)); | 286 | 0 | } | 287 | 4 | slab_ = new_slab; | 288 | 4 | } |
_ZN4ListIPN4pyos11PasswdEntryEE7reserveEi Line | Count | Source | 264 | 20 | void List<T>::reserve(int num_desired) { | 265 | | // log("reserve capacity = %d, n = %d", capacity_, n); | 266 | | | 267 | | // Don't do anything if there's already enough space. | 268 | 20 | if (capacity_ >= num_desired) { | 269 | 16 | return; | 270 | 16 | } | 271 | | | 272 | | // Slabs should be a total of 2^N bytes. kCapacityAdjust is the number of | 273 | | // items that the 8 byte header takes up: 1 for List<T*>, and 2 for | 274 | | // List<int>. | 275 | | // | 276 | | // Example: the user reserves space for 3 integers. The minimum number of | 277 | | // items would be 5, which is rounded up to 8. Subtract 2 again, giving 6, | 278 | | // which leads to 8 + 6*4 = 32 byte Slab. | 279 | | | 280 | 4 | capacity_ = HowManyItems(num_desired); | 281 | 4 | auto new_slab = NewSlab<T>(capacity_); | 282 | | | 283 | 4 | if (len_ > 0) { | 284 | | // log("Copying %d bytes", len_ * sizeof(T)); | 285 | 3 | memcpy(new_slab->items_, slab_->items_, len_ * sizeof(T)); | 286 | 3 | } | 287 | 4 | slab_ = new_slab; | 288 | 4 | } |
Unexecuted instantiation: _ZN4ListIPS_IP6Tuple2IiiEEE7reserveEi Unexecuted instantiation: _ZN4ListIPN11syntax_asdl12CompoundWordEE7reserveEi Unexecuted instantiation: _ZN4ListIP6Tuple2IP6BigStrbEE7reserveEi |
289 | | |
290 | | // Implements L[i] = item |
291 | | template <typename T> |
292 | 47 | void List<T>::set(int i, T item) { |
293 | 47 | if (i < 0) { |
294 | 4 | i = len_ + i; |
295 | 4 | } |
296 | | |
297 | 47 | if (0 > i || i >= len_) { |
298 | 4 | throw Alloc<IndexError>(); |
299 | 4 | } |
300 | | |
301 | 43 | slab_->items_[i] = item; |
302 | 43 | } Line | Count | Source | 292 | 25 | void List<T>::set(int i, T item) { | 293 | 25 | if (i < 0) { | 294 | 4 | i = len_ + i; | 295 | 4 | } | 296 | | | 297 | 25 | if (0 > i || i >= len_) { | 298 | 4 | throw Alloc<IndexError>(); | 299 | 4 | } | 300 | | | 301 | 21 | slab_->items_[i] = item; | 302 | 21 | } |
_ZN4ListIP6BigStrE3setEiS1_ Line | Count | Source | 292 | 16 | void List<T>::set(int i, T item) { | 293 | 16 | if (i < 0) { | 294 | 0 | i = len_ + i; | 295 | 0 | } | 296 | | | 297 | 16 | if (0 > i || i >= len_) { | 298 | 0 | throw Alloc<IndexError>(); | 299 | 0 | } | 300 | | | 301 | 16 | slab_->items_[i] = item; | 302 | 16 | } |
Line | Count | Source | 292 | 6 | void List<T>::set(int i, T item) { | 293 | 6 | if (i < 0) { | 294 | 0 | i = len_ + i; | 295 | 0 | } | 296 | | | 297 | 6 | if (0 > i || i >= len_) { | 298 | 0 | throw Alloc<IndexError>(); | 299 | 0 | } | 300 | | | 301 | 6 | slab_->items_[i] = item; | 302 | 6 | } |
|
303 | | |
304 | | // Implements L[i] |
305 | | template <typename T> |
306 | 1.72k | T List<T>::at(int i) { |
307 | 1.72k | if (i < 0) { |
308 | 10 | i = len_ + i; |
309 | 10 | } |
310 | | |
311 | 1.72k | if (0 > i || i >= len_) { |
312 | 4 | throw Alloc<IndexError>(); |
313 | 4 | } |
314 | 1.72k | return slab_->items_[i]; |
315 | 1.72k | } Line | Count | Source | 306 | 578 | T List<T>::at(int i) { | 307 | 578 | if (i < 0) { | 308 | 7 | i = len_ + i; | 309 | 7 | } | 310 | | | 311 | 578 | if (0 > i || i >= len_) { | 312 | 4 | throw Alloc<IndexError>(); | 313 | 4 | } | 314 | 574 | return slab_->items_[i]; | 315 | 578 | } |
Line | Count | Source | 306 | 1.13k | T List<T>::at(int i) { | 307 | 1.13k | if (i < 0) { | 308 | 3 | i = len_ + i; | 309 | 3 | } | 310 | | | 311 | 1.13k | if (0 > i || i >= len_) { | 312 | 0 | throw Alloc<IndexError>(); | 313 | 0 | } | 314 | 1.13k | return slab_->items_[i]; | 315 | 1.13k | } |
Line | Count | Source | 306 | 4 | T List<T>::at(int i) { | 307 | 4 | if (i < 0) { | 308 | 0 | i = len_ + i; | 309 | 0 | } | 310 | | | 311 | 4 | if (0 > i || i >= len_) { | 312 | 0 | throw Alloc<IndexError>(); | 313 | 0 | } | 314 | 4 | return slab_->items_[i]; | 315 | 4 | } |
Line | Count | Source | 306 | 4 | T List<T>::at(int i) { | 307 | 4 | if (i < 0) { | 308 | 0 | i = len_ + i; | 309 | 0 | } | 310 | | | 311 | 4 | if (0 > i || i >= len_) { | 312 | 0 | throw Alloc<IndexError>(); | 313 | 0 | } | 314 | 4 | return slab_->items_[i]; | 315 | 4 | } |
Unexecuted instantiation: _ZN4ListIPN11syntax_asdl12CompoundWordEE2atEi _ZN4ListIP6Tuple2IiP6BigStrEE2atEi Line | Count | Source | 306 | 5 | T List<T>::at(int i) { | 307 | 5 | if (i < 0) { | 308 | 0 | i = len_ + i; | 309 | 0 | } | 310 | | | 311 | 5 | if (0 > i || i >= len_) { | 312 | 0 | throw Alloc<IndexError>(); | 313 | 0 | } | 314 | 5 | return slab_->items_[i]; | 315 | 5 | } |
|
316 | | |
317 | | // L.index(i) -- Python method |
318 | | template <typename T> |
319 | 8 | int List<T>::index(T value) { |
320 | 8 | int element_count = len(this); |
321 | 18 | for (int i = 0; i < element_count; i++) { |
322 | 16 | if (items_equal(slab_->items_[i], value)) { |
323 | 6 | return i; |
324 | 6 | } |
325 | 16 | } |
326 | 2 | throw Alloc<ValueError>(); |
327 | 8 | } |
328 | | |
329 | | // Should we have a separate API that doesn't return it? |
330 | | // https://stackoverflow.com/questions/12600330/pop-back-return-value |
331 | | template <typename T> |
332 | 809 | T List<T>::pop() { |
333 | 809 | if (len_ == 0) { |
334 | 0 | throw Alloc<IndexError>(); |
335 | 0 | } |
336 | 809 | len_--; |
337 | 809 | T result = slab_->items_[len_]; |
338 | 809 | slab_->items_[len_] = 0; // zero for GC scan |
339 | 809 | return result; |
340 | 809 | } Line | Count | Source | 332 | 7 | T List<T>::pop() { | 333 | 7 | if (len_ == 0) { | 334 | 0 | throw Alloc<IndexError>(); | 335 | 0 | } | 336 | 7 | len_--; | 337 | 7 | T result = slab_->items_[len_]; | 338 | 7 | slab_->items_[len_] = 0; // zero for GC scan | 339 | 7 | return result; | 340 | 7 | } |
_ZN4ListIPN11pretty_asdl11DocFragmentEE3popEv Line | Count | Source | 332 | 800 | T List<T>::pop() { | 333 | 800 | if (len_ == 0) { | 334 | 0 | throw Alloc<IndexError>(); | 335 | 0 | } | 336 | 800 | len_--; | 337 | 800 | T result = slab_->items_[len_]; | 338 | 800 | slab_->items_[len_] = 0; // zero for GC scan | 339 | 800 | return result; | 340 | 800 | } |
Line | Count | Source | 332 | 2 | T List<T>::pop() { | 333 | 2 | if (len_ == 0) { | 334 | 0 | throw Alloc<IndexError>(); | 335 | 0 | } | 336 | 2 | len_--; | 337 | 2 | T result = slab_->items_[len_]; | 338 | 2 | slab_->items_[len_] = 0; // zero for GC scan | 339 | 2 | return result; | 340 | 2 | } |
|
341 | | |
342 | | // Used in osh/word_parse.py to remove from front |
343 | | template <typename T> |
344 | 12 | T List<T>::pop(int i) { |
345 | 12 | if (len_ < i) { |
346 | 0 | throw Alloc<IndexError>(); |
347 | 0 | } |
348 | | |
349 | 12 | T result = at(i); |
350 | 12 | len_--; |
351 | | |
352 | | // Shift everything by one |
353 | 12 | memmove(slab_->items_ + i, slab_->items_ + (i + 1), (len_ - i) * sizeof(T)); |
354 | | |
355 | | /* |
356 | | for (int j = 0; j < len_; j++) { |
357 | | slab_->items_[j] = slab_->items_[j+1]; |
358 | | } |
359 | | */ |
360 | | |
361 | 12 | slab_->items_[len_] = 0; // zero for GC scan |
362 | 12 | return result; |
363 | 12 | } |
364 | | |
365 | | template <typename T> |
366 | 6 | void List<T>::remove(T x) { |
367 | 6 | int idx = this->index(x); |
368 | 6 | this->pop(idx); // unused |
369 | 6 | } |
370 | | |
371 | | template <typename T> |
372 | 8 | void List<T>::clear() { |
373 | 8 | if (slab_) { |
374 | 5 | memset(slab_->items_, 0, len_ * sizeof(T)); // zero for GC scan |
375 | 5 | } |
376 | 8 | len_ = 0; |
377 | 8 | } Line | Count | Source | 372 | 5 | void List<T>::clear() { | 373 | 5 | if (slab_) { | 374 | 5 | memset(slab_->items_, 0, len_ * sizeof(T)); // zero for GC scan | 375 | 5 | } | 376 | 5 | len_ = 0; | 377 | 5 | } |
_ZN4ListIP6BigStrE5clearEv Line | Count | Source | 372 | 1 | void List<T>::clear() { | 373 | 1 | if (slab_) { | 374 | 0 | memset(slab_->items_, 0, len_ * sizeof(T)); // zero for GC scan | 375 | 0 | } | 376 | 1 | len_ = 0; | 377 | 1 | } |
Line | Count | Source | 372 | 2 | void List<T>::clear() { | 373 | 2 | if (slab_) { | 374 | 0 | memset(slab_->items_, 0, len_ * sizeof(T)); // zero for GC scan | 375 | 0 | } | 376 | 2 | len_ = 0; | 377 | 2 | } |
|
378 | | |
379 | | // used by ASDL |
380 | | template <typename T> |
381 | 1 | void List<T>::SetTaken() { |
382 | 1 | slab_ = nullptr; |
383 | 1 | len_ = 0; |
384 | 1 | capacity_ = 0; |
385 | 1 | } _ZN4ListIP6BigStrE8SetTakenEv Line | Count | Source | 381 | 1 | void List<T>::SetTaken() { | 382 | 1 | slab_ = nullptr; | 383 | 1 | len_ = 0; | 384 | 1 | capacity_ = 0; | 385 | 1 | } |
Unexecuted instantiation: _ZN4ListIPN11pretty_asdl11MeasuredDocEE8SetTakenEv Unexecuted instantiation: _ZN4ListIPN11syntax_asdl9command_tEE8SetTakenEv |
386 | | |
387 | | // Used in osh/string_ops.py |
388 | | template <typename T> |
389 | 8 | void List<T>::reverse() { |
390 | 16 | for (int i = 0; i < len_ / 2; ++i) { |
391 | | // log("swapping %d and %d", i, n-i); |
392 | 8 | T tmp = slab_->items_[i]; |
393 | 8 | int j = len_ - 1 - i; |
394 | 8 | slab_->items_[i] = slab_->items_[j]; |
395 | 8 | slab_->items_[j] = tmp; |
396 | 8 | } |
397 | 8 | } Unexecuted instantiation: _ZN4ListIP6BigStrE7reverseEv Line | Count | Source | 389 | 8 | void List<T>::reverse() { | 390 | 16 | for (int i = 0; i < len_ / 2; ++i) { | 391 | | // log("swapping %d and %d", i, n-i); | 392 | 8 | T tmp = slab_->items_[i]; | 393 | 8 | int j = len_ - 1 - i; | 394 | 8 | slab_->items_[i] = slab_->items_[j]; | 395 | 8 | slab_->items_[j] = tmp; | 396 | 8 | } | 397 | 8 | } |
|
398 | | |
399 | | // Extend this list with multiple elements. |
400 | | template <typename T> |
401 | 13 | void List<T>::extend(List<T>* other) { |
402 | 13 | int n = other->len_; |
403 | 13 | int new_len = len_ + n; |
404 | 13 | reserve(new_len); |
405 | | |
406 | 54 | for (int i = 0; i < n; ++i) { |
407 | 41 | slab_->items_[len_ + i] = other->slab_->items_[i]; |
408 | 41 | } |
409 | 13 | len_ = new_len; |
410 | 13 | } _ZN4ListIP6BigStrE6extendEPS2_ Line | Count | Source | 401 | 2 | void List<T>::extend(List<T>* other) { | 402 | 2 | int n = other->len_; | 403 | 2 | int new_len = len_ + n; | 404 | 2 | reserve(new_len); | 405 | | | 406 | 8 | for (int i = 0; i < n; ++i) { | 407 | 6 | slab_->items_[len_ + i] = other->slab_->items_[i]; | 408 | 6 | } | 409 | 2 | len_ = new_len; | 410 | 2 | } |
Line | Count | Source | 401 | 11 | void List<T>::extend(List<T>* other) { | 402 | 11 | int n = other->len_; | 403 | 11 | int new_len = len_ + n; | 404 | 11 | reserve(new_len); | 405 | | | 406 | 46 | for (int i = 0; i < n; ++i) { | 407 | 35 | slab_->items_[len_ + i] = other->slab_->items_[i]; | 408 | 35 | } | 409 | 11 | len_ = new_len; | 410 | 11 | } |
|
411 | | |
412 | 34 | inline bool CompareBigStr(BigStr* a, BigStr* b) { |
413 | 34 | return mylib::str_cmp(a, b) < 0; |
414 | 34 | } |
415 | | |
416 | | template <> |
417 | 8 | inline void List<BigStr*>::sort() { |
418 | 8 | std::sort(slab_->items_, slab_->items_ + len_, CompareBigStr); |
419 | 8 | } |
420 | | |
421 | 0 | inline bool CompareBigInt(mops::BigInt a, mops::BigInt b) { |
422 | 0 | return a < b; |
423 | 0 | } |
424 | | |
425 | | template <> |
426 | 0 | inline void List<mops::BigInt>::sort() { |
427 | 0 | std::sort(slab_->items_, slab_->items_ + len_, CompareBigInt); |
428 | 0 | } |
429 | | |
430 | | // TODO: mycpp can just generate the constructor instead? |
431 | | // e.g. [None] * 3 |
432 | | template <typename T> |
433 | 5 | List<T>* list_repeat(T item, int times) { |
434 | 5 | return NewList<T>(item, times); |
435 | 5 | } _Z11list_repeatIP6BigStrEP4ListIT_ES3_i Line | Count | Source | 433 | 3 | List<T>* list_repeat(T item, int times) { | 434 | 3 | return NewList<T>(item, times); | 435 | 3 | } |
_Z11list_repeatIbEP4ListIT_ES1_i Line | Count | Source | 433 | 2 | List<T>* list_repeat(T item, int times) { | 434 | 2 | return NewList<T>(item, times); | 435 | 2 | } |
|
436 | | |
437 | | // e.g. 'a' in ['a', 'b', 'c'] |
438 | | template <typename T> |
439 | 24 | inline bool list_contains(List<T>* haystack, T needle) { |
440 | 24 | int n = len(haystack); |
441 | 59 | for (int i = 0; i < n; ++i) { |
442 | 47 | if (items_equal(haystack->at(i), needle)) { |
443 | 12 | return true; |
444 | 12 | } |
445 | 47 | } |
446 | 12 | return false; |
447 | 24 | } _Z13list_containsIiEbP4ListIT_ES1_ Line | Count | Source | 439 | 10 | inline bool list_contains(List<T>* haystack, T needle) { | 440 | 10 | int n = len(haystack); | 441 | 25 | for (int i = 0; i < n; ++i) { | 442 | 20 | if (items_equal(haystack->at(i), needle)) { | 443 | 5 | return true; | 444 | 5 | } | 445 | 20 | } | 446 | 5 | return false; | 447 | 10 | } |
_Z13list_containsIP6BigStrEbP4ListIT_ES3_ Line | Count | Source | 439 | 12 | inline bool list_contains(List<T>* haystack, T needle) { | 440 | 12 | int n = len(haystack); | 441 | 28 | for (int i = 0; i < n; ++i) { | 442 | 23 | if (items_equal(haystack->at(i), needle)) { | 443 | 7 | return true; | 444 | 7 | } | 445 | 23 | } | 446 | 5 | return false; | 447 | 12 | } |
_Z13list_containsIlEbP4ListIT_ES1_ Line | Count | Source | 439 | 2 | inline bool list_contains(List<T>* haystack, T needle) { | 440 | 2 | int n = len(haystack); | 441 | 6 | for (int i = 0; i < n; ++i) { | 442 | 4 | if (items_equal(haystack->at(i), needle)) { | 443 | 0 | return true; | 444 | 0 | } | 445 | 4 | } | 446 | 2 | return false; | 447 | 2 | } |
|
448 | | |
449 | | template <typename V> |
450 | 2 | List<BigStr*>* sorted(Dict<BigStr*, V>* d) { |
451 | 2 | auto keys = d->keys(); |
452 | 2 | keys->sort(); |
453 | 2 | return keys; |
454 | 2 | } |
455 | | |
456 | | template <typename T> |
457 | 2 | List<T>* sorted(List<T>* l) { |
458 | 2 | auto ret = list(l); |
459 | 2 | ret->sort(); |
460 | 2 | return ret; |
461 | 2 | } |
462 | | |
463 | | // list(L) copies the list |
464 | | template <typename T> |
465 | 7 | List<T>* list(List<T>* other) { |
466 | 7 | auto result = NewList<T>(); |
467 | 7 | result->extend(other); |
468 | 7 | return result; |
469 | 7 | } Line | Count | Source | 465 | 5 | List<T>* list(List<T>* other) { | 466 | 5 | auto result = NewList<T>(); | 467 | 5 | result->extend(other); | 468 | 5 | return result; | 469 | 5 | } |
_Z4listIP6BigStrEP4ListIT_ES5_ Line | Count | Source | 465 | 2 | List<T>* list(List<T>* other) { | 466 | 2 | auto result = NewList<T>(); | 467 | 2 | result->extend(other); | 468 | 2 | return result; | 469 | 2 | } |
|
470 | | |
471 | | template <class T> |
472 | | class ListIter { |
473 | | public: |
474 | 639 | explicit ListIter(List<T>* L) : L_(L), i_(0) { |
475 | | // Cheney only: L_ could be moved during iteration. |
476 | | // gHeap.PushRoot(reinterpret_cast<RawObject**>(&L_)); |
477 | 639 | } _ZN8ListIterIP6BigStrEC2EP4ListIS1_E Line | Count | Source | 474 | 52 | explicit ListIter(List<T>* L) : L_(L), i_(0) { | 475 | | // Cheney only: L_ could be moved during iteration. | 476 | | // gHeap.PushRoot(reinterpret_cast<RawObject**>(&L_)); | 477 | 52 | } |
_ZN8ListIterIiEC2EP4ListIiE Line | Count | Source | 474 | 22 | explicit ListIter(List<T>* L) : L_(L), i_(0) { | 475 | | // Cheney only: L_ could be moved during iteration. | 476 | | // gHeap.PushRoot(reinterpret_cast<RawObject**>(&L_)); | 477 | 22 | } |
_ZN8ListIterIP6Tuple2IP6BigStriEEC2EP4ListIS4_E Line | Count | Source | 474 | 1 | explicit ListIter(List<T>* L) : L_(L), i_(0) { | 475 | | // Cheney only: L_ could be moved during iteration. | 476 | | // gHeap.PushRoot(reinterpret_cast<RawObject**>(&L_)); | 477 | 1 | } |
_ZN8ListIterIP6Tuple2IiP6BigStrEEC2EP4ListIS4_E Line | Count | Source | 474 | 6 | explicit ListIter(List<T>* L) : L_(L), i_(0) { | 475 | | // Cheney only: L_ could be moved during iteration. | 476 | | // gHeap.PushRoot(reinterpret_cast<RawObject**>(&L_)); | 477 | 6 | } |
Unexecuted instantiation: _ZN8ListIterIPN10hnode_asdl7hnode_tEEC2EP4ListIS2_E _ZN8ListIterIPN10hnode_asdl5FieldEEC2EP4ListIS2_E Line | Count | Source | 474 | 57 | explicit ListIter(List<T>* L) : L_(L), i_(0) { | 475 | | // Cheney only: L_ could be moved during iteration. | 476 | | // gHeap.PushRoot(reinterpret_cast<RawObject**>(&L_)); | 477 | 57 | } |
_ZN8ListIterIPN11pretty_asdl11MeasuredDocEEC2EP4ListIS2_E Line | Count | Source | 474 | 495 | explicit ListIter(List<T>* L) : L_(L), i_(0) { | 475 | | // Cheney only: L_ could be moved during iteration. | 476 | | // gHeap.PushRoot(reinterpret_cast<RawObject**>(&L_)); | 477 | 495 | } |
Unexecuted instantiation: _ZN8ListIterIPN10value_asdl7value_tEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl12CompoundWordEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN12runtime_asdl9AssignArgEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN12runtime_asdl12part_value_tEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl5loc_tEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl5TokenEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl10SourceLineEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN10value_asdl16InitializerValueEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl11word_part_tEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl6word_tEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl6expr_tEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl8NamedArgEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl17InitializerWord_tEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl9command_tEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl9EggexFlagEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl5ParamEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl8NameTypeEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl7y_lhs_tEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl5RedirEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl7EnvPairEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl10AssignPairEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl5IfArmEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl7CaseArmEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl8TypeExprEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl10place_op_tEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl13ComprehensionEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl20class_literal_term_tEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl17char_class_term_tEEC2EP4ListIS2_E Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl4re_tEEC2EP4ListIS2_E _ZN8ListIterIbEC2EP4ListIbE Line | Count | Source | 474 | 1 | explicit ListIter(List<T>* L) : L_(L), i_(0) { | 475 | | // Cheney only: L_ could be moved during iteration. | 476 | | // gHeap.PushRoot(reinterpret_cast<RawObject**>(&L_)); | 477 | 1 | } |
_ZN8ListIterIP6Tuple2IiiEEC2EP4ListIS2_E Line | Count | Source | 474 | 4 | explicit ListIter(List<T>* L) : L_(L), i_(0) { | 475 | | // Cheney only: L_ could be moved during iteration. | 476 | | // gHeap.PushRoot(reinterpret_cast<RawObject**>(&L_)); | 477 | 4 | } |
_ZN8ListIterIPN4pyos11PasswdEntryEEC2EP4ListIS2_E Line | Count | Source | 474 | 1 | explicit ListIter(List<T>* L) : L_(L), i_(0) { | 475 | | // Cheney only: L_ could be moved during iteration. | 476 | | // gHeap.PushRoot(reinterpret_cast<RawObject**>(&L_)); | 477 | 1 | } |
|
478 | | |
479 | 642 | ~ListIter() { |
480 | | // gHeap.PopRoot(); |
481 | 642 | } _ZN8ListIterIP6BigStrED2Ev Line | Count | Source | 479 | 52 | ~ListIter() { | 480 | | // gHeap.PopRoot(); | 481 | 52 | } |
Line | Count | Source | 479 | 25 | ~ListIter() { | 480 | | // gHeap.PopRoot(); | 481 | 25 | } |
_ZN8ListIterIP6Tuple2IP6BigStriEED2Ev Line | Count | Source | 479 | 1 | ~ListIter() { | 480 | | // gHeap.PopRoot(); | 481 | 1 | } |
_ZN8ListIterIP6Tuple2IiP6BigStrEED2Ev Line | Count | Source | 479 | 6 | ~ListIter() { | 480 | | // gHeap.PopRoot(); | 481 | 6 | } |
Unexecuted instantiation: _ZN8ListIterIPN10hnode_asdl7hnode_tEED2Ev _ZN8ListIterIPN10hnode_asdl5FieldEED2Ev Line | Count | Source | 479 | 57 | ~ListIter() { | 480 | | // gHeap.PopRoot(); | 481 | 57 | } |
_ZN8ListIterIPN11pretty_asdl11MeasuredDocEED2Ev Line | Count | Source | 479 | 495 | ~ListIter() { | 480 | | // gHeap.PopRoot(); | 481 | 495 | } |
Unexecuted instantiation: _ZN8ListIterIPN10value_asdl7value_tEED2Ev Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl12CompoundWordEED2Ev Unexecuted instantiation: _ZN8ListIterIPN12runtime_asdl9AssignArgEED2Ev Unexecuted instantiation: _ZN8ListIterIPN12runtime_asdl12part_value_tEED2Ev Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl5loc_tEED2Ev Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl5TokenEED2Ev Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl10SourceLineEED2Ev Unexecuted instantiation: _ZN8ListIterIPN10value_asdl16InitializerValueEED2Ev Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl11word_part_tEED2Ev Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl6word_tEED2Ev Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl6expr_tEED2Ev Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl8NamedArgEED2Ev Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl17InitializerWord_tEED2Ev Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl9command_tEED2Ev Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl9EggexFlagEED2Ev Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl5ParamEED2Ev Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl8NameTypeEED2Ev Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl7y_lhs_tEED2Ev Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl5RedirEED2Ev Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl7EnvPairEED2Ev Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl10AssignPairEED2Ev Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl5IfArmEED2Ev Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl7CaseArmEED2Ev Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl8TypeExprEED2Ev Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl10place_op_tEED2Ev Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl13ComprehensionEED2Ev Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl20class_literal_term_tEED2Ev Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl17char_class_term_tEED2Ev Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl4re_tEED2Ev Line | Count | Source | 479 | 1 | ~ListIter() { | 480 | | // gHeap.PopRoot(); | 481 | 1 | } |
_ZN8ListIterIP6Tuple2IiiEED2Ev Line | Count | Source | 479 | 4 | ~ListIter() { | 480 | | // gHeap.PopRoot(); | 481 | 4 | } |
_ZN8ListIterIPN4pyos11PasswdEntryEED2Ev Line | Count | Source | 479 | 1 | ~ListIter() { | 480 | | // gHeap.PopRoot(); | 481 | 1 | } |
|
482 | 1.84k | void Next() { |
483 | 1.84k | i_++; |
484 | 1.84k | } _ZN8ListIterIP6BigStrE4NextEv Line | Count | Source | 482 | 179 | void Next() { | 483 | 179 | i_++; | 484 | 179 | } |
Line | Count | Source | 482 | 85 | void Next() { | 483 | 85 | i_++; | 484 | 85 | } |
_ZN8ListIterIP6Tuple2IP6BigStriEE4NextEv Line | Count | Source | 482 | 2 | void Next() { | 483 | 2 | i_++; | 484 | 2 | } |
_ZN8ListIterIP6Tuple2IiP6BigStrEE4NextEv Line | Count | Source | 482 | 18 | void Next() { | 483 | 18 | i_++; | 484 | 18 | } |
Unexecuted instantiation: _ZN8ListIterIPN10hnode_asdl7hnode_tEE4NextEv _ZN8ListIterIPN10hnode_asdl5FieldEE4NextEv Line | Count | Source | 482 | 105 | void Next() { | 483 | 105 | i_++; | 484 | 105 | } |
_ZN8ListIterIPN11pretty_asdl11MeasuredDocEE4NextEv Line | Count | Source | 482 | 1.43k | void Next() { | 483 | 1.43k | i_++; | 484 | 1.43k | } |
Unexecuted instantiation: _ZN8ListIterIPN10value_asdl7value_tEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl12CompoundWordEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN12runtime_asdl9AssignArgEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN12runtime_asdl12part_value_tEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl5loc_tEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl5TokenEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl10SourceLineEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN10value_asdl16InitializerValueEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl11word_part_tEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl6word_tEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl6expr_tEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl8NamedArgEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl17InitializerWord_tEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl9command_tEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl9EggexFlagEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl5ParamEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl8NameTypeEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl7y_lhs_tEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl5RedirEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl7EnvPairEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl10AssignPairEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl5IfArmEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl7CaseArmEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl8TypeExprEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl10place_op_tEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl13ComprehensionEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl20class_literal_term_tEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl17char_class_term_tEE4NextEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl4re_tEE4NextEv Line | Count | Source | 482 | 2 | void Next() { | 483 | 2 | i_++; | 484 | 2 | } |
_ZN8ListIterIP6Tuple2IiiEE4NextEv Line | Count | Source | 482 | 8 | void Next() { | 483 | 8 | i_++; | 484 | 8 | } |
_ZN8ListIterIPN4pyos11PasswdEntryEE4NextEv Line | Count | Source | 482 | 19 | void Next() { | 483 | 19 | i_++; | 484 | 19 | } |
|
485 | 2.48k | bool Done() { |
486 | | // "unsigned size_t was a mistake" |
487 | 2.48k | return i_ >= static_cast<int>(L_->len_); |
488 | 2.48k | } _ZN8ListIterIP6BigStrE4DoneEv Line | Count | Source | 485 | 231 | bool Done() { | 486 | | // "unsigned size_t was a mistake" | 487 | 231 | return i_ >= static_cast<int>(L_->len_); | 488 | 231 | } |
Line | Count | Source | 485 | 104 | bool Done() { | 486 | | // "unsigned size_t was a mistake" | 487 | 104 | return i_ >= static_cast<int>(L_->len_); | 488 | 104 | } |
_ZN8ListIterIP6Tuple2IP6BigStriEE4DoneEv Line | Count | Source | 485 | 3 | bool Done() { | 486 | | // "unsigned size_t was a mistake" | 487 | 3 | return i_ >= static_cast<int>(L_->len_); | 488 | 3 | } |
_ZN8ListIterIP6Tuple2IiP6BigStrEE4DoneEv Line | Count | Source | 485 | 24 | bool Done() { | 486 | | // "unsigned size_t was a mistake" | 487 | 24 | return i_ >= static_cast<int>(L_->len_); | 488 | 24 | } |
Unexecuted instantiation: _ZN8ListIterIPN10hnode_asdl7hnode_tEE4DoneEv _ZN8ListIterIPN10hnode_asdl5FieldEE4DoneEv Line | Count | Source | 485 | 162 | bool Done() { | 486 | | // "unsigned size_t was a mistake" | 487 | 162 | return i_ >= static_cast<int>(L_->len_); | 488 | 162 | } |
_ZN8ListIterIPN11pretty_asdl11MeasuredDocEE4DoneEv Line | Count | Source | 485 | 1.92k | bool Done() { | 486 | | // "unsigned size_t was a mistake" | 487 | 1.92k | return i_ >= static_cast<int>(L_->len_); | 488 | 1.92k | } |
Unexecuted instantiation: _ZN8ListIterIPN10value_asdl7value_tEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl12CompoundWordEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN12runtime_asdl9AssignArgEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN12runtime_asdl12part_value_tEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl5loc_tEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl5TokenEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl10SourceLineEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN10value_asdl16InitializerValueEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl11word_part_tEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl6word_tEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl6expr_tEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl8NamedArgEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl17InitializerWord_tEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl9command_tEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl9EggexFlagEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl5ParamEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl8NameTypeEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl7y_lhs_tEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl5RedirEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl7EnvPairEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl10AssignPairEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl5IfArmEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl7CaseArmEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl8TypeExprEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl10place_op_tEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl13ComprehensionEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl20class_literal_term_tEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl17char_class_term_tEE4DoneEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl4re_tEE4DoneEv Line | Count | Source | 485 | 3 | bool Done() { | 486 | | // "unsigned size_t was a mistake" | 487 | 3 | return i_ >= static_cast<int>(L_->len_); | 488 | 3 | } |
_ZN8ListIterIP6Tuple2IiiEE4DoneEv Line | Count | Source | 485 | 12 | bool Done() { | 486 | | // "unsigned size_t was a mistake" | 487 | 12 | return i_ >= static_cast<int>(L_->len_); | 488 | 12 | } |
_ZN8ListIterIPN4pyos11PasswdEntryEE4DoneEv Line | Count | Source | 485 | 20 | bool Done() { | 486 | | // "unsigned size_t was a mistake" | 487 | 20 | return i_ >= static_cast<int>(L_->len_); | 488 | 20 | } |
|
489 | 1.84k | T Value() { |
490 | 1.84k | return L_->slab_->items_[i_]; |
491 | 1.84k | } _ZN8ListIterIP6BigStrE5ValueEv Line | Count | Source | 489 | 180 | T Value() { | 490 | 180 | return L_->slab_->items_[i_]; | 491 | 180 | } |
Line | Count | Source | 489 | 80 | T Value() { | 490 | 80 | return L_->slab_->items_[i_]; | 491 | 80 | } |
_ZN8ListIterIP6Tuple2IP6BigStriEE5ValueEv Line | Count | Source | 489 | 2 | T Value() { | 490 | 2 | return L_->slab_->items_[i_]; | 491 | 2 | } |
_ZN8ListIterIP6Tuple2IiP6BigStrEE5ValueEv Line | Count | Source | 489 | 10 | T Value() { | 490 | 10 | return L_->slab_->items_[i_]; | 491 | 10 | } |
Unexecuted instantiation: _ZN8ListIterIPN10hnode_asdl7hnode_tEE5ValueEv _ZN8ListIterIPN10hnode_asdl5FieldEE5ValueEv Line | Count | Source | 489 | 105 | T Value() { | 490 | 105 | return L_->slab_->items_[i_]; | 491 | 105 | } |
_ZN8ListIterIPN11pretty_asdl11MeasuredDocEE5ValueEv Line | Count | Source | 489 | 1.43k | T Value() { | 490 | 1.43k | return L_->slab_->items_[i_]; | 491 | 1.43k | } |
Unexecuted instantiation: _ZN8ListIterIPN10value_asdl7value_tEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl12CompoundWordEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN12runtime_asdl9AssignArgEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN12runtime_asdl12part_value_tEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl5loc_tEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl5TokenEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl10SourceLineEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN10value_asdl16InitializerValueEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl11word_part_tEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl6word_tEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl6expr_tEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl8NamedArgEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl17InitializerWord_tEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl9command_tEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl9EggexFlagEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl5ParamEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl8NameTypeEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl7y_lhs_tEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl5RedirEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl7EnvPairEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl10AssignPairEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl5IfArmEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl7CaseArmEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl8TypeExprEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl10place_op_tEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl13ComprehensionEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl20class_literal_term_tEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl17char_class_term_tEE5ValueEv Unexecuted instantiation: _ZN8ListIterIPN11syntax_asdl4re_tEE5ValueEv Line | Count | Source | 489 | 2 | T Value() { | 490 | 2 | return L_->slab_->items_[i_]; | 491 | 2 | } |
_ZN8ListIterIP6Tuple2IiiEE5ValueEv Line | Count | Source | 489 | 16 | T Value() { | 490 | 16 | return L_->slab_->items_[i_]; | 491 | 16 | } |
_ZN8ListIterIPN4pyos11PasswdEntryEE5ValueEv Line | Count | Source | 489 | 20 | T Value() { | 490 | 20 | return L_->slab_->items_[i_]; | 491 | 20 | } |
|
492 | 16 | T iterNext() { |
493 | 16 | if (Done()) { |
494 | 3 | throw Alloc<StopIteration>(); |
495 | 3 | } |
496 | 13 | T ret = L_->slab_->items_[i_]; |
497 | 13 | Next(); |
498 | 13 | return ret; |
499 | 16 | } _ZN8ListIterIP6Tuple2IiP6BigStrEE8iterNextEv Line | Count | Source | 492 | 10 | T iterNext() { | 493 | 10 | if (Done()) { | 494 | 2 | throw Alloc<StopIteration>(); | 495 | 2 | } | 496 | 8 | T ret = L_->slab_->items_[i_]; | 497 | 8 | Next(); | 498 | 8 | return ret; | 499 | 10 | } |
_ZN8ListIterIiE8iterNextEv Line | Count | Source | 492 | 6 | T iterNext() { | 493 | 6 | if (Done()) { | 494 | 1 | throw Alloc<StopIteration>(); | 495 | 1 | } | 496 | 5 | T ret = L_->slab_->items_[i_]; | 497 | 5 | Next(); | 498 | 5 | return ret; | 499 | 6 | } |
|
500 | | |
501 | | // only for use with generators |
502 | 3 | List<T>* GetList() { |
503 | 3 | return L_; |
504 | 3 | } |
505 | | |
506 | | private: |
507 | | List<T>* L_; |
508 | | int i_; |
509 | | }; |
510 | | |
511 | | // list(it) returns the iterator's backing list |
512 | | template <typename T> |
513 | 3 | List<T>* list(ListIter<T> it) { |
514 | 3 | return list(it.GetList()); |
515 | 3 | } |
516 | | |
517 | | // TODO: Does using pointers rather than indices make this more efficient? |
518 | | template <class T> |
519 | | class ReverseListIter { |
520 | | public: |
521 | 118 | explicit ReverseListIter(List<T>* L) : L_(L), i_(L_->len_ - 1) { |
522 | 118 | } _ZN15ReverseListIterIP6BigStrEC2EP4ListIS1_E Line | Count | Source | 521 | 1 | explicit ReverseListIter(List<T>* L) : L_(L), i_(L_->len_ - 1) { | 522 | 1 | } |
_ZN15ReverseListIterIP6Tuple2IiP6BigStrEEC2EP4ListIS4_E Line | Count | Source | 521 | 1 | explicit ReverseListIter(List<T>* L) : L_(L), i_(L_->len_ - 1) { | 522 | 1 | } |
_ZN15ReverseListIterIPN11pretty_asdl11MeasuredDocEEC2EP4ListIS2_E Line | Count | Source | 521 | 114 | explicit ReverseListIter(List<T>* L) : L_(L), i_(L_->len_ - 1) { | 522 | 114 | } |
_ZN15ReverseListIterIiEC2EP4ListIiE Line | Count | Source | 521 | 2 | explicit ReverseListIter(List<T>* L) : L_(L), i_(L_->len_ - 1) { | 522 | 2 | } |
|
523 | 658 | void Next() { |
524 | 658 | i_--; |
525 | 658 | } _ZN15ReverseListIterIP6BigStrE4NextEv Line | Count | Source | 523 | 2 | void Next() { | 524 | 2 | i_--; | 525 | 2 | } |
_ZN15ReverseListIterIP6Tuple2IiP6BigStrEE4NextEv Line | Count | Source | 523 | 2 | void Next() { | 524 | 2 | i_--; | 525 | 2 | } |
_ZN15ReverseListIterIPN11pretty_asdl11MeasuredDocEE4NextEv Line | Count | Source | 523 | 648 | void Next() { | 524 | 648 | i_--; | 525 | 648 | } |
_ZN15ReverseListIterIiE4NextEv Line | Count | Source | 523 | 6 | void Next() { | 524 | 6 | i_--; | 525 | 6 | } |
|
526 | 776 | bool Done() { |
527 | 776 | return i_ < 0; |
528 | 776 | } _ZN15ReverseListIterIP6BigStrE4DoneEv Line | Count | Source | 526 | 3 | bool Done() { | 527 | 3 | return i_ < 0; | 528 | 3 | } |
_ZN15ReverseListIterIP6Tuple2IiP6BigStrEE4DoneEv Line | Count | Source | 526 | 3 | bool Done() { | 527 | 3 | return i_ < 0; | 528 | 3 | } |
_ZN15ReverseListIterIPN11pretty_asdl11MeasuredDocEE4DoneEv Line | Count | Source | 526 | 762 | bool Done() { | 527 | 762 | return i_ < 0; | 528 | 762 | } |
_ZN15ReverseListIterIiE4DoneEv Line | Count | Source | 526 | 8 | bool Done() { | 527 | 8 | return i_ < 0; | 528 | 8 | } |
|
529 | 658 | T Value() { |
530 | 658 | return L_->slab_->items_[i_]; |
531 | 658 | } _ZN15ReverseListIterIP6BigStrE5ValueEv Line | Count | Source | 529 | 2 | T Value() { | 530 | 2 | return L_->slab_->items_[i_]; | 531 | 2 | } |
_ZN15ReverseListIterIP6Tuple2IiP6BigStrEE5ValueEv Line | Count | Source | 529 | 2 | T Value() { | 530 | 2 | return L_->slab_->items_[i_]; | 531 | 2 | } |
_ZN15ReverseListIterIPN11pretty_asdl11MeasuredDocEE5ValueEv Line | Count | Source | 529 | 648 | T Value() { | 530 | 648 | return L_->slab_->items_[i_]; | 531 | 648 | } |
_ZN15ReverseListIterIiE5ValueEv Line | Count | Source | 529 | 6 | T Value() { | 530 | 6 | return L_->slab_->items_[i_]; | 531 | 6 | } |
|
532 | | |
533 | | private: |
534 | | List<T>* L_; |
535 | | int i_; |
536 | | }; |
537 | | |
538 | | int max(List<int>* elems); |
539 | | |
540 | | #endif // MYCPP_GC_LIST_H |