/src/LPM/external.protobuf/include/google/protobuf/arena.h
Line | Count | Source (jump to first uncovered line) |
1 | | // Protocol Buffers - Google's data interchange format |
2 | | // Copyright 2008 Google Inc. All rights reserved. |
3 | | // https://developers.google.com/protocol-buffers/ |
4 | | // |
5 | | // Redistribution and use in source and binary forms, with or without |
6 | | // modification, are permitted provided that the following conditions are |
7 | | // met: |
8 | | // |
9 | | // * Redistributions of source code must retain the above copyright |
10 | | // notice, this list of conditions and the following disclaimer. |
11 | | // * Redistributions in binary form must reproduce the above |
12 | | // copyright notice, this list of conditions and the following disclaimer |
13 | | // in the documentation and/or other materials provided with the |
14 | | // distribution. |
15 | | // * Neither the name of Google Inc. nor the names of its |
16 | | // contributors may be used to endorse or promote products derived from |
17 | | // this software without specific prior written permission. |
18 | | // |
19 | | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
20 | | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
21 | | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
22 | | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
23 | | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
24 | | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
25 | | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
26 | | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
27 | | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 | | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 | | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 | | |
31 | | // This file defines an Arena allocator for better allocation performance. |
32 | | |
33 | | #ifndef GOOGLE_PROTOBUF_ARENA_H__ |
34 | | #define GOOGLE_PROTOBUF_ARENA_H__ |
35 | | |
36 | | #include <limits> |
37 | | #include <type_traits> |
38 | | #include <utility> |
39 | | #if defined(_MSC_VER) && !defined(_LIBCPP_STD_VER) && !_HAS_EXCEPTIONS |
40 | | // Work around bugs in MSVC <typeinfo> header when _HAS_EXCEPTIONS=0. |
41 | | #include <exception> |
42 | | #include <typeinfo> |
43 | | namespace std { |
44 | | using type_info = ::type_info; |
45 | | } |
46 | | #else |
47 | | #include <typeinfo> |
48 | | #endif |
49 | | |
50 | | #include "absl/meta/type_traits.h" |
51 | | #include "google/protobuf/arena_align.h" |
52 | | #include "google/protobuf/arena_config.h" |
53 | | #include "google/protobuf/port.h" |
54 | | #include "google/protobuf/serial_arena.h" |
55 | | #include "google/protobuf/thread_safe_arena.h" |
56 | | |
57 | | // Must be included last. |
58 | | #include "google/protobuf/port_def.inc" |
59 | | |
60 | | #ifdef SWIG |
61 | | #error "You cannot SWIG proto headers" |
62 | | #endif |
63 | | |
64 | | namespace google { |
65 | | namespace protobuf { |
66 | | |
67 | | struct ArenaOptions; // defined below |
68 | | class Arena; // defined below |
69 | | class Message; // defined in message.h |
70 | | class MessageLite; |
71 | | template <typename Key, typename T> |
72 | | class Map; |
73 | | |
74 | | namespace arena_metrics { |
75 | | |
76 | | void EnableArenaMetrics(ArenaOptions* options); |
77 | | |
78 | | } // namespace arena_metrics |
79 | | |
80 | | namespace TestUtil { |
81 | | class ReflectionTester; // defined in test_util.h |
82 | | } // namespace TestUtil |
83 | | |
84 | | namespace internal { |
85 | | |
86 | | struct ArenaTestPeer; // defined in arena_test_util.h |
87 | | class InternalMetadata; // defined in metadata_lite.h |
88 | | class LazyField; // defined in lazy_field.h |
89 | | class EpsCopyInputStream; // defined in parse_context.h |
90 | | class RepeatedPtrFieldBase; // defined in repeated_ptr_field.h |
91 | | class TcParser; // defined in generated_message_tctable_impl.h |
92 | | |
93 | | template <typename Type> |
94 | | class GenericTypeHandler; // defined in repeated_field.h |
95 | | |
96 | | template <bool destructor_skippable, typename T> |
97 | | struct ObjectDestructor { |
98 | | constexpr static void (*destructor)(void*) = |
99 | | &internal::cleanup::arena_destruct_object<T>; |
100 | | }; |
101 | | |
102 | | template <typename T> |
103 | | struct ObjectDestructor<true, T> { |
104 | | constexpr static void (*destructor)(void*) = nullptr; |
105 | | }; |
106 | | |
107 | | template <typename T> |
108 | 0 | void arena_delete_object(void* object) { |
109 | 0 | delete reinterpret_cast<T*>(object); |
110 | 0 | } |
111 | | } // namespace internal |
112 | | |
113 | | // ArenaOptions provides optional additional parameters to arena construction |
114 | | // that control its block-allocation behavior. |
115 | | struct ArenaOptions { |
116 | | // This defines the size of the first block requested from the system malloc. |
117 | | // Subsequent block sizes will increase in a geometric series up to a maximum. |
118 | | size_t start_block_size = internal::AllocationPolicy::kDefaultStartBlockSize; |
119 | | |
120 | | // This defines the maximum block size requested from system malloc (unless an |
121 | | // individual arena allocation request occurs with a size larger than this |
122 | | // maximum). Requested block sizes increase up to this value, then remain |
123 | | // here. |
124 | | size_t max_block_size = internal::GetDefaultArenaMaxBlockSize(); |
125 | | |
126 | | // An initial block of memory for the arena to use, or nullptr for none. If |
127 | | // provided, the block must live at least as long as the arena itself. The |
128 | | // creator of the Arena retains ownership of the block after the Arena is |
129 | | // destroyed. |
130 | | char* initial_block = nullptr; |
131 | | |
132 | | // The size of the initial block, if provided. |
133 | | size_t initial_block_size = 0; |
134 | | |
135 | | // A function pointer to an alloc method that returns memory blocks of size |
136 | | // requested. By default, it contains a ptr to the malloc function. |
137 | | // |
138 | | // NOTE: block_alloc and dealloc functions are expected to behave like |
139 | | // malloc and free, including Asan poisoning. |
140 | | void* (*block_alloc)(size_t) = nullptr; |
141 | | // A function pointer to a dealloc method that takes ownership of the blocks |
142 | | // from the arena. By default, it contains a ptr to a wrapper function that |
143 | | // calls free. |
144 | | void (*block_dealloc)(void*, size_t) = nullptr; |
145 | | |
146 | | private: |
147 | 0 | internal::AllocationPolicy AllocationPolicy() const { |
148 | 0 | internal::AllocationPolicy res; |
149 | 0 | res.start_block_size = start_block_size; |
150 | 0 | res.max_block_size = max_block_size; |
151 | 0 | res.block_alloc = block_alloc; |
152 | 0 | res.block_dealloc = block_dealloc; |
153 | 0 | return res; |
154 | 0 | } |
155 | | |
156 | | friend class Arena; |
157 | | friend class ArenaOptionsTestFriend; |
158 | | }; |
159 | | |
160 | | // Arena allocator. Arena allocation replaces ordinary (heap-based) allocation |
161 | | // with new/delete, and improves performance by aggregating allocations into |
162 | | // larger blocks and freeing allocations all at once. Protocol messages are |
163 | | // allocated on an arena by using Arena::CreateMessage<T>(Arena*), below, and |
164 | | // are automatically freed when the arena is destroyed. |
165 | | // |
166 | | // This is a thread-safe implementation: multiple threads may allocate from the |
167 | | // arena concurrently. Destruction is not thread-safe and the destructing |
168 | | // thread must synchronize with users of the arena first. |
169 | | // |
170 | | // An arena provides two allocation interfaces: CreateMessage<T>, which works |
171 | | // for arena-enabled proto2 message types as well as other types that satisfy |
172 | | // the appropriate protocol (described below), and Create<T>, which works for |
173 | | // any arbitrary type T. CreateMessage<T> is better when the type T supports it, |
174 | | // because this interface (i) passes the arena pointer to the created object so |
175 | | // that its sub-objects and internal allocations can use the arena too, and (ii) |
176 | | // elides the object's destructor call when possible. Create<T> does not place |
177 | | // any special requirements on the type T, and will invoke the object's |
178 | | // destructor when the arena is destroyed. |
179 | | // |
180 | | // The arena message allocation protocol, required by |
181 | | // CreateMessage<T>(Arena* arena, Args&&... args), is as follows: |
182 | | // |
183 | | // - The type T must have (at least) two constructors: a constructor callable |
184 | | // with `args` (without `arena`), called when a T is allocated on the heap; |
185 | | // and a constructor callable with `Arena* arena, Args&&... args`, called when |
186 | | // a T is allocated on an arena. If the second constructor is called with a |
187 | | // null arena pointer, it must be equivalent to invoking the first |
188 | | // (`args`-only) constructor. |
189 | | // |
190 | | // - The type T must have a particular type trait: a nested type |
191 | | // |InternalArenaConstructable_|. This is usually a typedef to |void|. If no |
192 | | // such type trait exists, then the instantiation CreateMessage<T> will fail |
193 | | // to compile. |
194 | | // |
195 | | // - The type T *may* have the type trait |DestructorSkippable_|. If this type |
196 | | // trait is present in the type, then its destructor will not be called if and |
197 | | // only if it was passed a non-null arena pointer. If this type trait is not |
198 | | // present on the type, then its destructor is always called when the |
199 | | // containing arena is destroyed. |
200 | | // |
201 | | // This protocol is implemented by all arena-enabled proto2 message classes as |
202 | | // well as protobuf container types like RepeatedPtrField and Map. The protocol |
203 | | // is internal to protobuf and is not guaranteed to be stable. Non-proto types |
204 | | // should not rely on this protocol. |
205 | | class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { |
206 | | public: |
207 | | // Default constructor with sensible default options, tuned for average |
208 | | // use-cases. |
209 | 0 | inline Arena() : impl_() {} |
210 | | |
211 | | // Construct an arena with default options, except for the supplied |
212 | | // initial block. It is more efficient to use this constructor |
213 | | // instead of passing ArenaOptions if the only configuration needed |
214 | | // by the caller is supplying an initial block. |
215 | | inline Arena(char* initial_block, size_t initial_block_size) |
216 | 0 | : impl_(initial_block, initial_block_size) {} |
217 | | |
218 | | // Arena constructor taking custom options. See ArenaOptions above for |
219 | | // descriptions of the options available. |
220 | | explicit Arena(const ArenaOptions& options) |
221 | | : impl_(options.initial_block, options.initial_block_size, |
222 | 0 | options.AllocationPolicy()) {} |
223 | | |
224 | | // Block overhead. Use this as a guide for how much to over-allocate the |
225 | | // initial block if you want an allocation of size N to fit inside it. |
226 | | // |
227 | | // WARNING: if you allocate multiple objects, it is difficult to guarantee |
228 | | // that a series of allocations will fit in the initial block, especially if |
229 | | // Arena changes its alignment guarantees in the future! |
230 | | static const size_t kBlockOverhead = |
231 | | internal::ThreadSafeArena::kBlockHeaderSize + |
232 | | internal::ThreadSafeArena::kSerialArenaSize; |
233 | | |
234 | 0 | inline ~Arena() {} |
235 | | |
236 | | // API to create proto2 message objects on the arena. If the arena passed in |
237 | | // is nullptr, then a heap allocated object is returned. Type T must be a |
238 | | // message defined in a .proto file with cc_enable_arenas set to true, |
239 | | // otherwise a compilation error will occur. |
240 | | // |
241 | | // RepeatedField and RepeatedPtrField may also be instantiated directly on an |
242 | | // arena with this method. |
243 | | // |
244 | | // This function also accepts any type T that satisfies the arena message |
245 | | // allocation protocol, documented above. |
246 | | template <typename T, typename... Args> |
247 | 0 | PROTOBUF_ALWAYS_INLINE static T* CreateMessage(Arena* arena, Args&&... args) { |
248 | 0 | static_assert( |
249 | 0 | InternalHelper<T>::is_arena_constructable::value, |
250 | 0 | "CreateMessage can only construct types that are ArenaConstructable"); |
251 | 0 | // We must delegate to CreateMaybeMessage() and NOT CreateMessageInternal() |
252 | 0 | // because protobuf generated classes specialize CreateMaybeMessage() and we |
253 | 0 | // need to use that specialization for code size reasons. |
254 | 0 | return Arena::CreateMaybeMessage<T>(arena, static_cast<Args&&>(args)...); |
255 | 0 | } |
256 | | |
257 | | // API to create any objects on the arena. Note that only the object will |
258 | | // be created on the arena; the underlying ptrs (in case of a proto2 message) |
259 | | // will be still heap allocated. Proto messages should usually be allocated |
260 | | // with CreateMessage<T>() instead. |
261 | | // |
262 | | // Note that even if T satisfies the arena message construction protocol |
263 | | // (InternalArenaConstructable_ trait and optional DestructorSkippable_ |
264 | | // trait), as described above, this function does not follow the protocol; |
265 | | // instead, it treats T as a black-box type, just as if it did not have these |
266 | | // traits. Specifically, T's constructor arguments will always be only those |
267 | | // passed to Create<T>() -- no additional arena pointer is implicitly added. |
268 | | // Furthermore, the destructor will always be called at arena destruction time |
269 | | // (unless the destructor is trivial). Hence, from T's point of view, it is as |
270 | | // if the object were allocated on the heap (except that the underlying memory |
271 | | // is obtained from the arena). |
272 | | template <typename T, typename... Args> |
273 | 0 | PROTOBUF_NDEBUG_INLINE static T* Create(Arena* arena, Args&&... args) { |
274 | 0 | if (PROTOBUF_PREDICT_FALSE(arena == nullptr)) { |
275 | 0 | return new T(std::forward<Args>(args)...); |
276 | 0 | } |
277 | 0 | return new (arena->AllocateInternal<T>()) T(std::forward<Args>(args)...); |
278 | 0 | } Unexecuted instantiation: google::protobuf::internal::InternalMetadata::Container<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >* google::protobuf::Arena::Create<google::protobuf::internal::InternalMetadata::Container<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >>(google::protobuf::Arena*) Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >* google::protobuf::Arena::Create<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >>(google::protobuf::Arena*) Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >* google::protobuf::Arena::Create<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(google::protobuf::Arena*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&) Unexecuted instantiation: google::protobuf::internal::InternalMetadata::Container<google::protobuf::UnknownFieldSet>* google::protobuf::Arena::Create<google::protobuf::internal::InternalMetadata::Container<google::protobuf::UnknownFieldSet>>(google::protobuf::Arena*) |
279 | | |
280 | | // API to delete any objects not on an arena. This can be used to safely |
281 | | // clean up messages or repeated fields without knowing whether or not they're |
282 | | // owned by an arena. The pointer passed to this function should not be used |
283 | | // again. |
284 | | template <typename T> |
285 | | PROTOBUF_ALWAYS_INLINE static void Destroy(T* obj) { |
286 | | if (InternalGetOwningArena(obj) == nullptr) delete obj; |
287 | | } |
288 | | |
289 | | // Allocates memory with the specific size and alignment. |
290 | 0 | void* AllocateAligned(size_t size, size_t align = 8) { |
291 | 0 | if (align <= internal::ArenaAlignDefault::align) { |
292 | 0 | return Allocate(internal::ArenaAlignDefault::Ceil(size)); |
293 | 0 | } else { |
294 | | // We are wasting space by over allocating align - 8 bytes. Compared |
295 | | // to a dedicated function that takes current alignment in consideration. |
296 | | // Such a scheme would only waste (align - 8)/2 bytes on average, but |
297 | | // requires a dedicated function in the outline arena allocation |
298 | | // functions. Possibly re-evaluate tradeoffs later. |
299 | 0 | auto align_as = internal::ArenaAlignAs(align); |
300 | 0 | return align_as.Ceil(Allocate(align_as.Padded(size))); |
301 | 0 | } |
302 | 0 | } |
303 | | |
304 | | // Create an array of object type T on the arena *without* invoking the |
305 | | // constructor of T. If `arena` is null, then the return value should be freed |
306 | | // with `delete[] x;` (or `::operator delete[](x);`). |
307 | | // To ensure safe uses, this function checks at compile time |
308 | | // (when compiled as C++11) that T is trivially default-constructible and |
309 | | // trivially destructible. |
310 | | template <typename T> |
311 | | PROTOBUF_NDEBUG_INLINE static T* CreateArray(Arena* arena, |
312 | 0 | size_t num_elements) { |
313 | 0 | static_assert(std::is_trivial<T>::value, |
314 | 0 | "CreateArray requires a trivially constructible type"); |
315 | 0 | static_assert(std::is_trivially_destructible<T>::value, |
316 | 0 | "CreateArray requires a trivially destructible type"); |
317 | 0 | ABSL_CHECK_LE(num_elements, std::numeric_limits<size_t>::max() / sizeof(T)) |
318 | 0 | << "Requested size is too large to fit into size_t."; |
319 | 0 | if (PROTOBUF_PREDICT_FALSE(arena == nullptr)) { |
320 | 0 | return static_cast<T*>(::operator new[](num_elements * sizeof(T))); |
321 | 0 | } else { |
322 | 0 | // We count on compiler to realize that if sizeof(T) is a multiple of |
323 | 0 | // 8 AlignUpTo can be elided. |
324 | 0 | return static_cast<T*>( |
325 | 0 | arena->AllocateAlignedForArray(sizeof(T) * num_elements, alignof(T))); |
326 | 0 | } |
327 | 0 | } Unexecuted instantiation: char* google::protobuf::Arena::CreateArray<char>(google::protobuf::Arena*, unsigned long) Unexecuted instantiation: unsigned char* google::protobuf::Arena::CreateArray<unsigned char>(google::protobuf::Arena*, unsigned long) |
328 | | |
329 | | // The following are routines are for monitoring. They will approximate the |
330 | | // total sum allocated and used memory, but the exact value is an |
331 | | // implementation deal. For instance allocated space depends on growth |
332 | | // policies. Do not use these in unit tests. |
333 | | // Returns the total space allocated by the arena, which is the sum of the |
334 | | // sizes of the underlying blocks. |
335 | 0 | uint64_t SpaceAllocated() const { return impl_.SpaceAllocated(); } |
336 | | // Returns the total space used by the arena. Similar to SpaceAllocated but |
337 | | // does not include free space and block overhead. This is a best-effort |
338 | | // estimate and may inaccurately calculate space used by other threads |
339 | | // executing concurrently with the call to this method. These inaccuracies |
340 | | // are due to race conditions, and are bounded but unpredictable. Stale data |
341 | | // can lead to underestimates of the space used, and race conditions can lead |
342 | | // to overestimates (up to the current block size). |
343 | 0 | uint64_t SpaceUsed() const { return impl_.SpaceUsed(); } |
344 | | |
345 | | // Frees all storage allocated by this arena after calling destructors |
346 | | // registered with OwnDestructor() and freeing objects registered with Own(). |
347 | | // Any objects allocated on this arena are unusable after this call. It also |
348 | | // returns the total space used by the arena which is the sums of the sizes |
349 | | // of the allocated blocks. This method is not thread-safe. |
350 | 0 | uint64_t Reset() { return impl_.Reset(); } |
351 | | |
352 | | // Adds |object| to a list of heap-allocated objects to be freed with |delete| |
353 | | // when the arena is destroyed or reset. |
354 | | template <typename T> |
355 | 0 | PROTOBUF_ALWAYS_INLINE void Own(T* object) { |
356 | 0 | // Collapsing all template instantiations to one for generic Message reduces |
357 | 0 | // code size, using the virtual destructor instead. |
358 | 0 | using TypeToUse = |
359 | 0 | std::conditional_t<std::is_convertible<T*, MessageLite*>::value, |
360 | 0 | MessageLite, T>; |
361 | 0 | if (object != nullptr) { |
362 | 0 | impl_.AddCleanup(static_cast<TypeToUse*>(object), |
363 | 0 | &internal::arena_delete_object<TypeToUse>); |
364 | 0 | } |
365 | 0 | } |
366 | | |
367 | | // Adds |object| to a list of objects whose destructors will be manually |
368 | | // called when the arena is destroyed or reset. This differs from Own() in |
369 | | // that it does not free the underlying memory with |delete|; hence, it is |
370 | | // normally only used for objects that are placement-newed into |
371 | | // arena-allocated memory. |
372 | | template <typename T> |
373 | | PROTOBUF_ALWAYS_INLINE void OwnDestructor(T* object) { |
374 | | if (object != nullptr) { |
375 | | impl_.AddCleanup(object, &internal::cleanup::arena_destruct_object<T>); |
376 | | } |
377 | | } |
378 | | |
379 | | // Adds a custom member function on an object to the list of destructors that |
380 | | // will be manually called when the arena is destroyed or reset. This differs |
381 | | // from OwnDestructor() in that any member function may be specified, not only |
382 | | // the class destructor. |
383 | | PROTOBUF_ALWAYS_INLINE void OwnCustomDestructor(void* object, |
384 | 0 | void (*destruct)(void*)) { |
385 | 0 | impl_.AddCleanup(object, destruct); |
386 | 0 | } |
387 | | |
388 | | // Retrieves the arena associated with |value| if |value| is an arena-capable |
389 | | // message, or nullptr otherwise. If possible, the call resolves at compile |
390 | | // time. Note that we can often devirtualize calls to `value->GetArena()` so |
391 | | // usually calling this method is unnecessary. |
392 | | template <typename T> |
393 | | PROTOBUF_ALWAYS_INLINE static Arena* GetArena(T* value) { |
394 | | return GetArenaInternal(value); |
395 | | } |
396 | | |
397 | | template <typename T> |
398 | | class InternalHelper { |
399 | | private: |
400 | | // A SFINAE friendly trait that probes for `U` but always evalues to |
401 | | // `Arena*`. |
402 | | template <typename U> |
403 | | using EnableIfArena = |
404 | | typename std::enable_if<std::is_same<Arena*, U>::value, Arena*>::type; |
405 | | |
406 | | // Rather than use SFINAE that must fully cover the space of options in a |
407 | | // mutually exclusive fashion, we use implicit conversions to base classes |
408 | | // to force an explicit ranking for our preferences. The lowest ranked |
409 | | // version that compiles will be accepted. |
410 | | struct Rank2 {}; |
411 | | struct Rank1 : Rank2 {}; |
412 | | struct Rank0 : Rank1 {}; |
413 | | |
414 | 0 | static Arena* GetOwningArena(const T* p) { |
415 | 0 | return GetOwningArena(Rank0{}, p); |
416 | 0 | } Unexecuted instantiation: google::protobuf::Arena::InternalHelper<google::protobuf::FileOptions>::GetOwningArena(google::protobuf::FileOptions const*) Unexecuted instantiation: google::protobuf::Arena::InternalHelper<google::protobuf::SourceCodeInfo>::GetOwningArena(google::protobuf::SourceCodeInfo const*) Unexecuted instantiation: google::protobuf::Arena::InternalHelper<google::protobuf::ExtensionRangeOptions>::GetOwningArena(google::protobuf::ExtensionRangeOptions const*) Unexecuted instantiation: google::protobuf::Arena::InternalHelper<google::protobuf::MessageOptions>::GetOwningArena(google::protobuf::MessageOptions const*) Unexecuted instantiation: google::protobuf::Arena::InternalHelper<google::protobuf::FieldOptions>::GetOwningArena(google::protobuf::FieldOptions const*) Unexecuted instantiation: google::protobuf::Arena::InternalHelper<google::protobuf::OneofOptions>::GetOwningArena(google::protobuf::OneofOptions const*) Unexecuted instantiation: google::protobuf::Arena::InternalHelper<google::protobuf::EnumOptions>::GetOwningArena(google::protobuf::EnumOptions const*) Unexecuted instantiation: google::protobuf::Arena::InternalHelper<google::protobuf::EnumValueOptions>::GetOwningArena(google::protobuf::EnumValueOptions const*) Unexecuted instantiation: google::protobuf::Arena::InternalHelper<google::protobuf::ServiceOptions>::GetOwningArena(google::protobuf::ServiceOptions const*) Unexecuted instantiation: google::protobuf::Arena::InternalHelper<google::protobuf::MethodOptions>::GetOwningArena(google::protobuf::MethodOptions const*) Unexecuted instantiation: google::protobuf::Arena::InternalHelper<ruby_fuzzer::Rvalue>::GetOwningArena(ruby_fuzzer::Rvalue const*) Unexecuted instantiation: google::protobuf::Arena::InternalHelper<ruby_fuzzer::StatementSeq>::GetOwningArena(ruby_fuzzer::StatementSeq const*) Unexecuted instantiation: google::protobuf::Arena::InternalHelper<ruby_fuzzer::HashType>::GetOwningArena(ruby_fuzzer::HashType const*) Unexecuted instantiation: google::protobuf::Arena::InternalHelper<ruby_fuzzer::ArrType>::GetOwningArena(ruby_fuzzer::ArrType const*) Unexecuted instantiation: google::protobuf::Arena::InternalHelper<ruby_fuzzer::MathType>::GetOwningArena(ruby_fuzzer::MathType const*) Unexecuted instantiation: google::protobuf::Arena::InternalHelper<ruby_fuzzer::VarRef>::GetOwningArena(ruby_fuzzer::VarRef const*) Unexecuted instantiation: google::protobuf::Arena::InternalHelper<ruby_fuzzer::Const>::GetOwningArena(ruby_fuzzer::Const const*) Unexecuted instantiation: google::protobuf::Arena::InternalHelper<ruby_fuzzer::BinaryOp>::GetOwningArena(ruby_fuzzer::BinaryOp const*) Unexecuted instantiation: google::protobuf::Arena::InternalHelper<ruby_fuzzer::MathConst>::GetOwningArena(ruby_fuzzer::MathConst const*) Unexecuted instantiation: google::protobuf::Arena::InternalHelper<ruby_fuzzer::ObjectSpace>::GetOwningArena(ruby_fuzzer::ObjectSpace const*) Unexecuted instantiation: google::protobuf::Arena::InternalHelper<ruby_fuzzer::Time>::GetOwningArena(ruby_fuzzer::Time const*) Unexecuted instantiation: google::protobuf::Arena::InternalHelper<ruby_fuzzer::Array>::GetOwningArena(ruby_fuzzer::Array const*) Unexecuted instantiation: google::protobuf::Arena::InternalHelper<ruby_fuzzer::MathOps>::GetOwningArena(ruby_fuzzer::MathOps const*) Unexecuted instantiation: google::protobuf::Arena::InternalHelper<ruby_fuzzer::AssignmentStatement>::GetOwningArena(ruby_fuzzer::AssignmentStatement const*) Unexecuted instantiation: google::protobuf::Arena::InternalHelper<ruby_fuzzer::IfElse>::GetOwningArena(ruby_fuzzer::IfElse const*) Unexecuted instantiation: google::protobuf::Arena::InternalHelper<ruby_fuzzer::Ternary>::GetOwningArena(ruby_fuzzer::Ternary const*) Unexecuted instantiation: google::protobuf::Arena::InternalHelper<ruby_fuzzer::BuiltinFuncs>::GetOwningArena(ruby_fuzzer::BuiltinFuncs const*) |
417 | | |
418 | | template <typename U> |
419 | | static auto GetOwningArena(Rank0, const U* p) |
420 | 0 | -> EnableIfArena<decltype(p->GetOwningArena())> { |
421 | 0 | return p->GetOwningArena(); |
422 | 0 | } Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperINS0_11FileOptionsEE14GetOwningArenaIS3_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES8_E4typeENS4_5Rank0EPKT_ Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperINS0_14SourceCodeInfoEE14GetOwningArenaIS3_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES8_E4typeENS4_5Rank0EPKT_ Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperINS0_21ExtensionRangeOptionsEE14GetOwningArenaIS3_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES8_E4typeENS4_5Rank0EPKT_ Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperINS0_14MessageOptionsEE14GetOwningArenaIS3_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES8_E4typeENS4_5Rank0EPKT_ Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperINS0_12FieldOptionsEE14GetOwningArenaIS3_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES8_E4typeENS4_5Rank0EPKT_ Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperINS0_12OneofOptionsEE14GetOwningArenaIS3_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES8_E4typeENS4_5Rank0EPKT_ Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperINS0_11EnumOptionsEE14GetOwningArenaIS3_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES8_E4typeENS4_5Rank0EPKT_ Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperINS0_16EnumValueOptionsEE14GetOwningArenaIS3_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES8_E4typeENS4_5Rank0EPKT_ Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperINS0_14ServiceOptionsEE14GetOwningArenaIS3_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES8_E4typeENS4_5Rank0EPKT_ Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperINS0_13MethodOptionsEE14GetOwningArenaIS3_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES8_E4typeENS4_5Rank0EPKT_ Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperIN11ruby_fuzzer6RvalueEE14GetOwningArenaIS4_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES9_E4typeENS5_5Rank0EPKT_ Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperIN11ruby_fuzzer12StatementSeqEE14GetOwningArenaIS4_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES9_E4typeENS5_5Rank0EPKT_ Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperIN11ruby_fuzzer8HashTypeEE14GetOwningArenaIS4_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES9_E4typeENS5_5Rank0EPKT_ Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperIN11ruby_fuzzer7ArrTypeEE14GetOwningArenaIS4_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES9_E4typeENS5_5Rank0EPKT_ Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperIN11ruby_fuzzer8MathTypeEE14GetOwningArenaIS4_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES9_E4typeENS5_5Rank0EPKT_ Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperIN11ruby_fuzzer6VarRefEE14GetOwningArenaIS4_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES9_E4typeENS5_5Rank0EPKT_ Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperIN11ruby_fuzzer5ConstEE14GetOwningArenaIS4_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES9_E4typeENS5_5Rank0EPKT_ Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperIN11ruby_fuzzer8BinaryOpEE14GetOwningArenaIS4_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES9_E4typeENS5_5Rank0EPKT_ Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperIN11ruby_fuzzer9MathConstEE14GetOwningArenaIS4_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES9_E4typeENS5_5Rank0EPKT_ Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperIN11ruby_fuzzer11ObjectSpaceEE14GetOwningArenaIS4_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES9_E4typeENS5_5Rank0EPKT_ Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperIN11ruby_fuzzer4TimeEE14GetOwningArenaIS4_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES9_E4typeENS5_5Rank0EPKT_ Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperIN11ruby_fuzzer5ArrayEE14GetOwningArenaIS4_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES9_E4typeENS5_5Rank0EPKT_ Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperIN11ruby_fuzzer7MathOpsEE14GetOwningArenaIS4_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES9_E4typeENS5_5Rank0EPKT_ Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperIN11ruby_fuzzer19AssignmentStatementEE14GetOwningArenaIS4_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES9_E4typeENS5_5Rank0EPKT_ Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperIN11ruby_fuzzer6IfElseEE14GetOwningArenaIS4_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES9_E4typeENS5_5Rank0EPKT_ Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperIN11ruby_fuzzer7TernaryEE14GetOwningArenaIS4_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES9_E4typeENS5_5Rank0EPKT_ Unexecuted instantiation: _ZN6google8protobuf5Arena14InternalHelperIN11ruby_fuzzer12BuiltinFuncsEE14GetOwningArenaIS4_EENSt3__19enable_ifIXsr3std7is_sameIPS1_DTclptfp0_14GetOwningArenaEEEE5valueES9_E4typeENS5_5Rank0EPKT_ |
423 | | |
424 | | template <typename U> |
425 | | static Arena* GetOwningArena(Rank1, const U*) { |
426 | | return nullptr; |
427 | | } |
428 | | |
429 | | static void InternalSwap(T* a, T* b) { a->InternalSwap(b); } |
430 | | |
431 | | static Arena* GetArenaForAllocation(T* p) { |
432 | | return GetArenaForAllocation(Rank0{}, p); |
433 | | } |
434 | | |
435 | | static Arena* GetArena(T* p) { |
436 | | // Rather than replicate probing for `GetArena` with fallback to nullptr, |
437 | | // we borrow the implementation of `GetArenaForAllocation` but skip |
438 | | // `Rank0` which probes for `GetArenaForAllocation`. |
439 | | return GetArenaForAllocation(Rank1{}, p); |
440 | | } |
441 | | |
442 | | template <typename U> |
443 | | static auto GetArenaForAllocation(Rank0, U* p) |
444 | | -> EnableIfArena<decltype(p->GetArenaForAllocation())> { |
445 | | return p->GetArenaForAllocation(); |
446 | | } |
447 | | |
448 | | template <typename U> |
449 | | static auto GetArenaForAllocation(Rank1, U* p) |
450 | | -> EnableIfArena<decltype(p->GetArena())> { |
451 | | return p->GetArena(); |
452 | | } |
453 | | |
454 | | template <typename U> |
455 | | static Arena* GetArenaForAllocation(Rank2, U*) { |
456 | | return nullptr; |
457 | | } |
458 | | |
459 | | template <typename U> |
460 | | static char DestructorSkippable(const typename U::DestructorSkippable_*); |
461 | | template <typename U> |
462 | | static double DestructorSkippable(...); |
463 | | |
464 | | typedef std::integral_constant< |
465 | | bool, sizeof(DestructorSkippable<T>(static_cast<const T*>(0))) == |
466 | | sizeof(char) || |
467 | | std::is_trivially_destructible<T>::value> |
468 | | is_destructor_skippable; |
469 | | |
470 | | template <typename U> |
471 | | static char ArenaConstructable( |
472 | | const typename U::InternalArenaConstructable_*); |
473 | | template <typename U> |
474 | | static double ArenaConstructable(...); |
475 | | |
476 | | typedef std::integral_constant<bool, sizeof(ArenaConstructable<T>( |
477 | | static_cast<const T*>(0))) == |
478 | | sizeof(char)> |
479 | | is_arena_constructable; |
480 | | |
481 | | |
482 | | template <typename... Args> |
483 | 0 | static T* Construct(void* ptr, Args&&... args) { |
484 | 0 | return new (ptr) T(static_cast<Args&&>(args)...); |
485 | 0 | } Unexecuted instantiation: google::protobuf::internal::ImplicitWeakMessage* google::protobuf::Arena::InternalHelper<google::protobuf::internal::ImplicitWeakMessage>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&) Unexecuted instantiation: ruby_fuzzer::VarRef* google::protobuf::Arena::InternalHelper<ruby_fuzzer::VarRef>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&) Unexecuted instantiation: ruby_fuzzer::ArrType* google::protobuf::Arena::InternalHelper<ruby_fuzzer::ArrType>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&) Unexecuted instantiation: ruby_fuzzer::KVPair* google::protobuf::Arena::InternalHelper<ruby_fuzzer::KVPair>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&) Unexecuted instantiation: ruby_fuzzer::HashType* google::protobuf::Arena::InternalHelper<ruby_fuzzer::HashType>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&) Unexecuted instantiation: ruby_fuzzer::StringExtNoArg* google::protobuf::Arena::InternalHelper<ruby_fuzzer::StringExtNoArg>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&) Unexecuted instantiation: ruby_fuzzer::MathConst* google::protobuf::Arena::InternalHelper<ruby_fuzzer::MathConst>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&) Unexecuted instantiation: ruby_fuzzer::Const* google::protobuf::Arena::InternalHelper<ruby_fuzzer::Const>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&) Unexecuted instantiation: ruby_fuzzer::BinaryOp* google::protobuf::Arena::InternalHelper<ruby_fuzzer::BinaryOp>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&) Unexecuted instantiation: ruby_fuzzer::Rvalue* google::protobuf::Arena::InternalHelper<ruby_fuzzer::Rvalue>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&) Unexecuted instantiation: ruby_fuzzer::AssignmentStatement* google::protobuf::Arena::InternalHelper<ruby_fuzzer::AssignmentStatement>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&) Unexecuted instantiation: ruby_fuzzer::IfElse* google::protobuf::Arena::InternalHelper<ruby_fuzzer::IfElse>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&) Unexecuted instantiation: ruby_fuzzer::Ternary* google::protobuf::Arena::InternalHelper<ruby_fuzzer::Ternary>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&) Unexecuted instantiation: ruby_fuzzer::ObjectSpace* google::protobuf::Arena::InternalHelper<ruby_fuzzer::ObjectSpace>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&) Unexecuted instantiation: ruby_fuzzer::Time* google::protobuf::Arena::InternalHelper<ruby_fuzzer::Time>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&) Unexecuted instantiation: ruby_fuzzer::Array* google::protobuf::Arena::InternalHelper<ruby_fuzzer::Array>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&) Unexecuted instantiation: ruby_fuzzer::MathType* google::protobuf::Arena::InternalHelper<ruby_fuzzer::MathType>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&) Unexecuted instantiation: ruby_fuzzer::MathOps* google::protobuf::Arena::InternalHelper<ruby_fuzzer::MathOps>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&) Unexecuted instantiation: ruby_fuzzer::BuiltinFuncs* google::protobuf::Arena::InternalHelper<ruby_fuzzer::BuiltinFuncs>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&) Unexecuted instantiation: ruby_fuzzer::Statement* google::protobuf::Arena::InternalHelper<ruby_fuzzer::Statement>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&) Unexecuted instantiation: ruby_fuzzer::StatementSeq* google::protobuf::Arena::InternalHelper<ruby_fuzzer::StatementSeq>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&) Unexecuted instantiation: ruby_fuzzer::Function* google::protobuf::Arena::InternalHelper<ruby_fuzzer::Function>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&) |
486 | | |
487 | 2.37M | static inline PROTOBUF_ALWAYS_INLINE T* New() { |
488 | 2.37M | return new T(nullptr); |
489 | 2.37M | } Unexecuted instantiation: google::protobuf::Arena::InternalHelper<google::protobuf::internal::ImplicitWeakMessage>::New() google::protobuf::Arena::InternalHelper<ruby_fuzzer::VarRef>::New() Line | Count | Source | 487 | 73.2k | static inline PROTOBUF_ALWAYS_INLINE T* New() { | 488 | 73.2k | return new T(nullptr); | 489 | 73.2k | } |
google::protobuf::Arena::InternalHelper<ruby_fuzzer::ArrType>::New() Line | Count | Source | 487 | 58.5k | static inline PROTOBUF_ALWAYS_INLINE T* New() { | 488 | 58.5k | return new T(nullptr); | 489 | 58.5k | } |
google::protobuf::Arena::InternalHelper<ruby_fuzzer::KVPair>::New() Line | Count | Source | 487 | 129k | static inline PROTOBUF_ALWAYS_INLINE T* New() { | 488 | 129k | return new T(nullptr); | 489 | 129k | } |
google::protobuf::Arena::InternalHelper<ruby_fuzzer::HashType>::New() Line | Count | Source | 487 | 20.6k | static inline PROTOBUF_ALWAYS_INLINE T* New() { | 488 | 20.6k | return new T(nullptr); | 489 | 20.6k | } |
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<ruby_fuzzer::StringExtNoArg>::New() google::protobuf::Arena::InternalHelper<ruby_fuzzer::MathConst>::New() Line | Count | Source | 487 | 3.09k | static inline PROTOBUF_ALWAYS_INLINE T* New() { | 488 | 3.09k | return new T(nullptr); | 489 | 3.09k | } |
google::protobuf::Arena::InternalHelper<ruby_fuzzer::Const>::New() Line | Count | Source | 487 | 291k | static inline PROTOBUF_ALWAYS_INLINE T* New() { | 488 | 291k | return new T(nullptr); | 489 | 291k | } |
google::protobuf::Arena::InternalHelper<ruby_fuzzer::BinaryOp>::New() Line | Count | Source | 487 | 131k | static inline PROTOBUF_ALWAYS_INLINE T* New() { | 488 | 131k | return new T(nullptr); | 489 | 131k | } |
google::protobuf::Arena::InternalHelper<ruby_fuzzer::Rvalue>::New() Line | Count | Source | 487 | 580k | static inline PROTOBUF_ALWAYS_INLINE T* New() { | 488 | 580k | return new T(nullptr); | 489 | 580k | } |
google::protobuf::Arena::InternalHelper<ruby_fuzzer::AssignmentStatement>::New() Line | Count | Source | 487 | 215k | static inline PROTOBUF_ALWAYS_INLINE T* New() { | 488 | 215k | return new T(nullptr); | 489 | 215k | } |
google::protobuf::Arena::InternalHelper<ruby_fuzzer::IfElse>::New() Line | Count | Source | 487 | 17.5k | static inline PROTOBUF_ALWAYS_INLINE T* New() { | 488 | 17.5k | return new T(nullptr); | 489 | 17.5k | } |
google::protobuf::Arena::InternalHelper<ruby_fuzzer::Ternary>::New() Line | Count | Source | 487 | 8.65k | static inline PROTOBUF_ALWAYS_INLINE T* New() { | 488 | 8.65k | return new T(nullptr); | 489 | 8.65k | } |
google::protobuf::Arena::InternalHelper<ruby_fuzzer::ObjectSpace>::New() Line | Count | Source | 487 | 20.6k | static inline PROTOBUF_ALWAYS_INLINE T* New() { | 488 | 20.6k | return new T(nullptr); | 489 | 20.6k | } |
google::protobuf::Arena::InternalHelper<ruby_fuzzer::Time>::New() Line | Count | Source | 487 | 10.2k | static inline PROTOBUF_ALWAYS_INLINE T* New() { | 488 | 10.2k | return new T(nullptr); | 489 | 10.2k | } |
google::protobuf::Arena::InternalHelper<ruby_fuzzer::Array>::New() Line | Count | Source | 487 | 56.1k | static inline PROTOBUF_ALWAYS_INLINE T* New() { | 488 | 56.1k | return new T(nullptr); | 489 | 56.1k | } |
google::protobuf::Arena::InternalHelper<ruby_fuzzer::MathType>::New() Line | Count | Source | 487 | 9.45k | static inline PROTOBUF_ALWAYS_INLINE T* New() { | 488 | 9.45k | return new T(nullptr); | 489 | 9.45k | } |
google::protobuf::Arena::InternalHelper<ruby_fuzzer::MathOps>::New() Line | Count | Source | 487 | 9.47k | static inline PROTOBUF_ALWAYS_INLINE T* New() { | 488 | 9.47k | return new T(nullptr); | 489 | 9.47k | } |
google::protobuf::Arena::InternalHelper<ruby_fuzzer::BuiltinFuncs>::New() Line | Count | Source | 487 | 119k | static inline PROTOBUF_ALWAYS_INLINE T* New() { | 488 | 119k | return new T(nullptr); | 489 | 119k | } |
google::protobuf::Arena::InternalHelper<ruby_fuzzer::Statement>::New() Line | Count | Source | 487 | 554k | static inline PROTOBUF_ALWAYS_INLINE T* New() { | 488 | 554k | return new T(nullptr); | 489 | 554k | } |
google::protobuf::Arena::InternalHelper<ruby_fuzzer::StatementSeq>::New() Line | Count | Source | 487 | 70.0k | static inline PROTOBUF_ALWAYS_INLINE T* New() { | 488 | 70.0k | return new T(nullptr); | 489 | 70.0k | } |
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<ruby_fuzzer::Function>::New() |
490 | | |
491 | | friend class Arena; |
492 | | friend class TestUtil::ReflectionTester; |
493 | | }; |
494 | | |
495 | | // Provides access to protected GetOwningArena to generated messages. For |
496 | | // internal use only. |
497 | | template <typename T> |
498 | 0 | static Arena* InternalGetOwningArena(const T* p) { |
499 | 0 | return InternalHelper<T>::GetOwningArena(p); |
500 | 0 | } Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<google::protobuf::FileOptions>(google::protobuf::FileOptions const*) Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<google::protobuf::SourceCodeInfo>(google::protobuf::SourceCodeInfo const*) Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<google::protobuf::ExtensionRangeOptions>(google::protobuf::ExtensionRangeOptions const*) Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<google::protobuf::MessageOptions>(google::protobuf::MessageOptions const*) Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<google::protobuf::FieldOptions>(google::protobuf::FieldOptions const*) Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<google::protobuf::OneofOptions>(google::protobuf::OneofOptions const*) Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<google::protobuf::EnumOptions>(google::protobuf::EnumOptions const*) Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<google::protobuf::EnumValueOptions>(google::protobuf::EnumValueOptions const*) Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<google::protobuf::ServiceOptions>(google::protobuf::ServiceOptions const*) Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<google::protobuf::MethodOptions>(google::protobuf::MethodOptions const*) Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<ruby_fuzzer::Rvalue>(ruby_fuzzer::Rvalue const*) Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<ruby_fuzzer::StatementSeq>(ruby_fuzzer::StatementSeq const*) Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<ruby_fuzzer::HashType>(ruby_fuzzer::HashType const*) Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<ruby_fuzzer::ArrType>(ruby_fuzzer::ArrType const*) Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<ruby_fuzzer::MathType>(ruby_fuzzer::MathType const*) Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<ruby_fuzzer::VarRef>(ruby_fuzzer::VarRef const*) Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<ruby_fuzzer::Const>(ruby_fuzzer::Const const*) Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<ruby_fuzzer::BinaryOp>(ruby_fuzzer::BinaryOp const*) Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<ruby_fuzzer::MathConst>(ruby_fuzzer::MathConst const*) Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<ruby_fuzzer::ObjectSpace>(ruby_fuzzer::ObjectSpace const*) Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<ruby_fuzzer::Time>(ruby_fuzzer::Time const*) Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<ruby_fuzzer::Array>(ruby_fuzzer::Array const*) Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<ruby_fuzzer::MathOps>(ruby_fuzzer::MathOps const*) Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<ruby_fuzzer::AssignmentStatement>(ruby_fuzzer::AssignmentStatement const*) Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<ruby_fuzzer::IfElse>(ruby_fuzzer::IfElse const*) Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<ruby_fuzzer::Ternary>(ruby_fuzzer::Ternary const*) Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<ruby_fuzzer::BuiltinFuncs>(ruby_fuzzer::BuiltinFuncs const*) |
501 | | |
502 | | // Provides access to protected GetArenaForAllocation to generated messages. |
503 | | // For internal use only. |
504 | | template <typename T> |
505 | | static Arena* InternalGetArenaForAllocation(T* p) { |
506 | | return InternalHelper<T>::GetArenaForAllocation(p); |
507 | | } |
508 | | |
509 | | // Helper typetraits that indicates support for arenas in a type T at compile |
510 | | // time. This is public only to allow construction of higher-level templated |
511 | | // utilities. |
512 | | // |
513 | | // is_arena_constructable<T>::value is true if the message type T has arena |
514 | | // support enabled, and false otherwise. |
515 | | // |
516 | | // is_destructor_skippable<T>::value is true if the message type T has told |
517 | | // the arena that it is safe to skip the destructor, and false otherwise. |
518 | | // |
519 | | // This is inside Arena because only Arena has the friend relationships |
520 | | // necessary to see the underlying generated code traits. |
521 | | template <typename T> |
522 | | struct is_arena_constructable : InternalHelper<T>::is_arena_constructable {}; |
523 | | template <typename T> |
524 | | struct is_destructor_skippable : InternalHelper<T>::is_destructor_skippable { |
525 | | }; |
526 | | |
527 | | private: |
528 | | internal::ThreadSafeArena impl_; |
529 | | |
530 | 0 | void ReturnArrayMemory(void* p, size_t size) { |
531 | 0 | impl_.ReturnArrayMemory(p, size); |
532 | 0 | } |
533 | | |
534 | | template <typename T, typename... Args> |
535 | | PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena, |
536 | | Args&&... args) { |
537 | | static_assert( |
538 | | InternalHelper<T>::is_arena_constructable::value, |
539 | | "CreateMessage can only construct types that are ArenaConstructable"); |
540 | | if (PROTOBUF_PREDICT_FALSE(arena == nullptr)) { |
541 | | return new T(nullptr, static_cast<Args&&>(args)...); |
542 | | } else { |
543 | | return arena->DoCreateMessage<T>(static_cast<Args&&>(args)...); |
544 | | } |
545 | | } |
546 | | |
547 | | // This specialization for no arguments is necessary, because its behavior is |
548 | | // slightly different. When the arena pointer is nullptr, it calls T() |
549 | | // instead of T(nullptr). |
550 | | template <typename T> |
551 | 2.37M | PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) { |
552 | 2.37M | static_assert( |
553 | 2.37M | InternalHelper<T>::is_arena_constructable::value, |
554 | 2.37M | "CreateMessage can only construct types that are ArenaConstructable"); |
555 | 2.37M | if (arena == nullptr) { |
556 | | // Generated arena constructor T(Arena*) is protected. Call via |
557 | | // InternalHelper. |
558 | 2.37M | return InternalHelper<T>::New(); |
559 | 2.37M | } else { |
560 | 0 | return arena->DoCreateMessage<T>(); |
561 | 0 | } |
562 | 2.37M | } Unexecuted instantiation: google::protobuf::internal::ImplicitWeakMessage* google::protobuf::Arena::CreateMessageInternal<google::protobuf::internal::ImplicitWeakMessage>(google::protobuf::Arena*) ruby_fuzzer::VarRef* google::protobuf::Arena::CreateMessageInternal<ruby_fuzzer::VarRef>(google::protobuf::Arena*) Line | Count | Source | 551 | 73.2k | PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) { | 552 | 73.2k | static_assert( | 553 | 73.2k | InternalHelper<T>::is_arena_constructable::value, | 554 | 73.2k | "CreateMessage can only construct types that are ArenaConstructable"); | 555 | 73.2k | if (arena == nullptr) { | 556 | | // Generated arena constructor T(Arena*) is protected. Call via | 557 | | // InternalHelper. | 558 | 73.2k | return InternalHelper<T>::New(); | 559 | 73.2k | } else { | 560 | 0 | return arena->DoCreateMessage<T>(); | 561 | 0 | } | 562 | 73.2k | } |
ruby_fuzzer::ArrType* google::protobuf::Arena::CreateMessageInternal<ruby_fuzzer::ArrType>(google::protobuf::Arena*) Line | Count | Source | 551 | 58.5k | PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) { | 552 | 58.5k | static_assert( | 553 | 58.5k | InternalHelper<T>::is_arena_constructable::value, | 554 | 58.5k | "CreateMessage can only construct types that are ArenaConstructable"); | 555 | 58.5k | if (arena == nullptr) { | 556 | | // Generated arena constructor T(Arena*) is protected. Call via | 557 | | // InternalHelper. | 558 | 58.5k | return InternalHelper<T>::New(); | 559 | 58.5k | } else { | 560 | 0 | return arena->DoCreateMessage<T>(); | 561 | 0 | } | 562 | 58.5k | } |
ruby_fuzzer::KVPair* google::protobuf::Arena::CreateMessageInternal<ruby_fuzzer::KVPair>(google::protobuf::Arena*) Line | Count | Source | 551 | 129k | PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) { | 552 | 129k | static_assert( | 553 | 129k | InternalHelper<T>::is_arena_constructable::value, | 554 | 129k | "CreateMessage can only construct types that are ArenaConstructable"); | 555 | 129k | if (arena == nullptr) { | 556 | | // Generated arena constructor T(Arena*) is protected. Call via | 557 | | // InternalHelper. | 558 | 129k | return InternalHelper<T>::New(); | 559 | 129k | } else { | 560 | 0 | return arena->DoCreateMessage<T>(); | 561 | 0 | } | 562 | 129k | } |
ruby_fuzzer::HashType* google::protobuf::Arena::CreateMessageInternal<ruby_fuzzer::HashType>(google::protobuf::Arena*) Line | Count | Source | 551 | 20.6k | PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) { | 552 | 20.6k | static_assert( | 553 | 20.6k | InternalHelper<T>::is_arena_constructable::value, | 554 | 20.6k | "CreateMessage can only construct types that are ArenaConstructable"); | 555 | 20.6k | if (arena == nullptr) { | 556 | | // Generated arena constructor T(Arena*) is protected. Call via | 557 | | // InternalHelper. | 558 | 20.6k | return InternalHelper<T>::New(); | 559 | 20.6k | } else { | 560 | 0 | return arena->DoCreateMessage<T>(); | 561 | 0 | } | 562 | 20.6k | } |
Unexecuted instantiation: ruby_fuzzer::StringExtNoArg* google::protobuf::Arena::CreateMessageInternal<ruby_fuzzer::StringExtNoArg>(google::protobuf::Arena*) ruby_fuzzer::MathConst* google::protobuf::Arena::CreateMessageInternal<ruby_fuzzer::MathConst>(google::protobuf::Arena*) Line | Count | Source | 551 | 3.09k | PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) { | 552 | 3.09k | static_assert( | 553 | 3.09k | InternalHelper<T>::is_arena_constructable::value, | 554 | 3.09k | "CreateMessage can only construct types that are ArenaConstructable"); | 555 | 3.09k | if (arena == nullptr) { | 556 | | // Generated arena constructor T(Arena*) is protected. Call via | 557 | | // InternalHelper. | 558 | 3.09k | return InternalHelper<T>::New(); | 559 | 3.09k | } else { | 560 | 0 | return arena->DoCreateMessage<T>(); | 561 | 0 | } | 562 | 3.09k | } |
ruby_fuzzer::Const* google::protobuf::Arena::CreateMessageInternal<ruby_fuzzer::Const>(google::protobuf::Arena*) Line | Count | Source | 551 | 291k | PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) { | 552 | 291k | static_assert( | 553 | 291k | InternalHelper<T>::is_arena_constructable::value, | 554 | 291k | "CreateMessage can only construct types that are ArenaConstructable"); | 555 | 291k | if (arena == nullptr) { | 556 | | // Generated arena constructor T(Arena*) is protected. Call via | 557 | | // InternalHelper. | 558 | 291k | return InternalHelper<T>::New(); | 559 | 291k | } else { | 560 | 0 | return arena->DoCreateMessage<T>(); | 561 | 0 | } | 562 | 291k | } |
ruby_fuzzer::BinaryOp* google::protobuf::Arena::CreateMessageInternal<ruby_fuzzer::BinaryOp>(google::protobuf::Arena*) Line | Count | Source | 551 | 131k | PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) { | 552 | 131k | static_assert( | 553 | 131k | InternalHelper<T>::is_arena_constructable::value, | 554 | 131k | "CreateMessage can only construct types that are ArenaConstructable"); | 555 | 131k | if (arena == nullptr) { | 556 | | // Generated arena constructor T(Arena*) is protected. Call via | 557 | | // InternalHelper. | 558 | 131k | return InternalHelper<T>::New(); | 559 | 131k | } else { | 560 | 0 | return arena->DoCreateMessage<T>(); | 561 | 0 | } | 562 | 131k | } |
ruby_fuzzer::Rvalue* google::protobuf::Arena::CreateMessageInternal<ruby_fuzzer::Rvalue>(google::protobuf::Arena*) Line | Count | Source | 551 | 580k | PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) { | 552 | 580k | static_assert( | 553 | 580k | InternalHelper<T>::is_arena_constructable::value, | 554 | 580k | "CreateMessage can only construct types that are ArenaConstructable"); | 555 | 580k | if (arena == nullptr) { | 556 | | // Generated arena constructor T(Arena*) is protected. Call via | 557 | | // InternalHelper. | 558 | 580k | return InternalHelper<T>::New(); | 559 | 580k | } else { | 560 | 0 | return arena->DoCreateMessage<T>(); | 561 | 0 | } | 562 | 580k | } |
ruby_fuzzer::AssignmentStatement* google::protobuf::Arena::CreateMessageInternal<ruby_fuzzer::AssignmentStatement>(google::protobuf::Arena*) Line | Count | Source | 551 | 215k | PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) { | 552 | 215k | static_assert( | 553 | 215k | InternalHelper<T>::is_arena_constructable::value, | 554 | 215k | "CreateMessage can only construct types that are ArenaConstructable"); | 555 | 215k | if (arena == nullptr) { | 556 | | // Generated arena constructor T(Arena*) is protected. Call via | 557 | | // InternalHelper. | 558 | 215k | return InternalHelper<T>::New(); | 559 | 215k | } else { | 560 | 0 | return arena->DoCreateMessage<T>(); | 561 | 0 | } | 562 | 215k | } |
ruby_fuzzer::IfElse* google::protobuf::Arena::CreateMessageInternal<ruby_fuzzer::IfElse>(google::protobuf::Arena*) Line | Count | Source | 551 | 17.5k | PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) { | 552 | 17.5k | static_assert( | 553 | 17.5k | InternalHelper<T>::is_arena_constructable::value, | 554 | 17.5k | "CreateMessage can only construct types that are ArenaConstructable"); | 555 | 17.5k | if (arena == nullptr) { | 556 | | // Generated arena constructor T(Arena*) is protected. Call via | 557 | | // InternalHelper. | 558 | 17.5k | return InternalHelper<T>::New(); | 559 | 17.5k | } else { | 560 | 0 | return arena->DoCreateMessage<T>(); | 561 | 0 | } | 562 | 17.5k | } |
ruby_fuzzer::Ternary* google::protobuf::Arena::CreateMessageInternal<ruby_fuzzer::Ternary>(google::protobuf::Arena*) Line | Count | Source | 551 | 8.65k | PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) { | 552 | 8.65k | static_assert( | 553 | 8.65k | InternalHelper<T>::is_arena_constructable::value, | 554 | 8.65k | "CreateMessage can only construct types that are ArenaConstructable"); | 555 | 8.65k | if (arena == nullptr) { | 556 | | // Generated arena constructor T(Arena*) is protected. Call via | 557 | | // InternalHelper. | 558 | 8.65k | return InternalHelper<T>::New(); | 559 | 8.65k | } else { | 560 | 0 | return arena->DoCreateMessage<T>(); | 561 | 0 | } | 562 | 8.65k | } |
ruby_fuzzer::ObjectSpace* google::protobuf::Arena::CreateMessageInternal<ruby_fuzzer::ObjectSpace>(google::protobuf::Arena*) Line | Count | Source | 551 | 20.6k | PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) { | 552 | 20.6k | static_assert( | 553 | 20.6k | InternalHelper<T>::is_arena_constructable::value, | 554 | 20.6k | "CreateMessage can only construct types that are ArenaConstructable"); | 555 | 20.6k | if (arena == nullptr) { | 556 | | // Generated arena constructor T(Arena*) is protected. Call via | 557 | | // InternalHelper. | 558 | 20.6k | return InternalHelper<T>::New(); | 559 | 20.6k | } else { | 560 | 0 | return arena->DoCreateMessage<T>(); | 561 | 0 | } | 562 | 20.6k | } |
ruby_fuzzer::Time* google::protobuf::Arena::CreateMessageInternal<ruby_fuzzer::Time>(google::protobuf::Arena*) Line | Count | Source | 551 | 10.2k | PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) { | 552 | 10.2k | static_assert( | 553 | 10.2k | InternalHelper<T>::is_arena_constructable::value, | 554 | 10.2k | "CreateMessage can only construct types that are ArenaConstructable"); | 555 | 10.2k | if (arena == nullptr) { | 556 | | // Generated arena constructor T(Arena*) is protected. Call via | 557 | | // InternalHelper. | 558 | 10.2k | return InternalHelper<T>::New(); | 559 | 10.2k | } else { | 560 | 0 | return arena->DoCreateMessage<T>(); | 561 | 0 | } | 562 | 10.2k | } |
ruby_fuzzer::Array* google::protobuf::Arena::CreateMessageInternal<ruby_fuzzer::Array>(google::protobuf::Arena*) Line | Count | Source | 551 | 56.1k | PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) { | 552 | 56.1k | static_assert( | 553 | 56.1k | InternalHelper<T>::is_arena_constructable::value, | 554 | 56.1k | "CreateMessage can only construct types that are ArenaConstructable"); | 555 | 56.1k | if (arena == nullptr) { | 556 | | // Generated arena constructor T(Arena*) is protected. Call via | 557 | | // InternalHelper. | 558 | 56.1k | return InternalHelper<T>::New(); | 559 | 56.1k | } else { | 560 | 0 | return arena->DoCreateMessage<T>(); | 561 | 0 | } | 562 | 56.1k | } |
ruby_fuzzer::MathType* google::protobuf::Arena::CreateMessageInternal<ruby_fuzzer::MathType>(google::protobuf::Arena*) Line | Count | Source | 551 | 9.45k | PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) { | 552 | 9.45k | static_assert( | 553 | 9.45k | InternalHelper<T>::is_arena_constructable::value, | 554 | 9.45k | "CreateMessage can only construct types that are ArenaConstructable"); | 555 | 9.45k | if (arena == nullptr) { | 556 | | // Generated arena constructor T(Arena*) is protected. Call via | 557 | | // InternalHelper. | 558 | 9.45k | return InternalHelper<T>::New(); | 559 | 9.45k | } else { | 560 | 0 | return arena->DoCreateMessage<T>(); | 561 | 0 | } | 562 | 9.45k | } |
ruby_fuzzer::MathOps* google::protobuf::Arena::CreateMessageInternal<ruby_fuzzer::MathOps>(google::protobuf::Arena*) Line | Count | Source | 551 | 9.47k | PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) { | 552 | 9.47k | static_assert( | 553 | 9.47k | InternalHelper<T>::is_arena_constructable::value, | 554 | 9.47k | "CreateMessage can only construct types that are ArenaConstructable"); | 555 | 9.47k | if (arena == nullptr) { | 556 | | // Generated arena constructor T(Arena*) is protected. Call via | 557 | | // InternalHelper. | 558 | 9.47k | return InternalHelper<T>::New(); | 559 | 9.47k | } else { | 560 | 0 | return arena->DoCreateMessage<T>(); | 561 | 0 | } | 562 | 9.47k | } |
ruby_fuzzer::BuiltinFuncs* google::protobuf::Arena::CreateMessageInternal<ruby_fuzzer::BuiltinFuncs>(google::protobuf::Arena*) Line | Count | Source | 551 | 119k | PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) { | 552 | 119k | static_assert( | 553 | 119k | InternalHelper<T>::is_arena_constructable::value, | 554 | 119k | "CreateMessage can only construct types that are ArenaConstructable"); | 555 | 119k | if (arena == nullptr) { | 556 | | // Generated arena constructor T(Arena*) is protected. Call via | 557 | | // InternalHelper. | 558 | 119k | return InternalHelper<T>::New(); | 559 | 119k | } else { | 560 | 0 | return arena->DoCreateMessage<T>(); | 561 | 0 | } | 562 | 119k | } |
ruby_fuzzer::Statement* google::protobuf::Arena::CreateMessageInternal<ruby_fuzzer::Statement>(google::protobuf::Arena*) Line | Count | Source | 551 | 554k | PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) { | 552 | 554k | static_assert( | 553 | 554k | InternalHelper<T>::is_arena_constructable::value, | 554 | 554k | "CreateMessage can only construct types that are ArenaConstructable"); | 555 | 554k | if (arena == nullptr) { | 556 | | // Generated arena constructor T(Arena*) is protected. Call via | 557 | | // InternalHelper. | 558 | 554k | return InternalHelper<T>::New(); | 559 | 554k | } else { | 560 | 0 | return arena->DoCreateMessage<T>(); | 561 | 0 | } | 562 | 554k | } |
ruby_fuzzer::StatementSeq* google::protobuf::Arena::CreateMessageInternal<ruby_fuzzer::StatementSeq>(google::protobuf::Arena*) Line | Count | Source | 551 | 70.0k | PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) { | 552 | 70.0k | static_assert( | 553 | 70.0k | InternalHelper<T>::is_arena_constructable::value, | 554 | 70.0k | "CreateMessage can only construct types that are ArenaConstructable"); | 555 | 70.0k | if (arena == nullptr) { | 556 | | // Generated arena constructor T(Arena*) is protected. Call via | 557 | | // InternalHelper. | 558 | 70.0k | return InternalHelper<T>::New(); | 559 | 70.0k | } else { | 560 | 0 | return arena->DoCreateMessage<T>(); | 561 | 0 | } | 562 | 70.0k | } |
Unexecuted instantiation: ruby_fuzzer::Function* google::protobuf::Arena::CreateMessageInternal<ruby_fuzzer::Function>(google::protobuf::Arena*) |
563 | | |
564 | | template <typename T, bool trivial = std::is_trivially_destructible<T>::value> |
565 | 0 | PROTOBUF_NDEBUG_INLINE void* AllocateInternal() { |
566 | 0 | if (trivial) { |
567 | 0 | return AllocateAligned(sizeof(T), alignof(T)); |
568 | 0 | } else { |
569 | 0 | constexpr auto dtor = &internal::cleanup::arena_destruct_object<T>; |
570 | 0 | return AllocateAlignedWithCleanup(sizeof(T), alignof(T), dtor); |
571 | 0 | } |
572 | 0 | } Unexecuted instantiation: void* google::protobuf::Arena::AllocateInternal<google::protobuf::internal::InternalMetadata::Container<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, false>() Unexecuted instantiation: void* google::protobuf::Arena::AllocateInternal<google::protobuf::internal::ImplicitWeakMessage, false>() Unexecuted instantiation: void* google::protobuf::Arena::AllocateInternal<google::protobuf::internal::InternalMetadata::Container<google::protobuf::UnknownFieldSet>, false>() Unexecuted instantiation: void* google::protobuf::Arena::AllocateInternal<ruby_fuzzer::VarRef, true>() Unexecuted instantiation: void* google::protobuf::Arena::AllocateInternal<ruby_fuzzer::ArrType, true>() Unexecuted instantiation: void* google::protobuf::Arena::AllocateInternal<ruby_fuzzer::KVPair, true>() Unexecuted instantiation: void* google::protobuf::Arena::AllocateInternal<ruby_fuzzer::HashType, true>() Unexecuted instantiation: void* google::protobuf::Arena::AllocateInternal<ruby_fuzzer::StringExtNoArg, true>() Unexecuted instantiation: void* google::protobuf::Arena::AllocateInternal<ruby_fuzzer::MathConst, true>() Unexecuted instantiation: void* google::protobuf::Arena::AllocateInternal<ruby_fuzzer::Const, true>() Unexecuted instantiation: void* google::protobuf::Arena::AllocateInternal<ruby_fuzzer::BinaryOp, true>() Unexecuted instantiation: void* google::protobuf::Arena::AllocateInternal<ruby_fuzzer::Rvalue, true>() Unexecuted instantiation: void* google::protobuf::Arena::AllocateInternal<ruby_fuzzer::AssignmentStatement, true>() Unexecuted instantiation: void* google::protobuf::Arena::AllocateInternal<ruby_fuzzer::IfElse, true>() Unexecuted instantiation: void* google::protobuf::Arena::AllocateInternal<ruby_fuzzer::Ternary, true>() Unexecuted instantiation: void* google::protobuf::Arena::AllocateInternal<ruby_fuzzer::ObjectSpace, true>() Unexecuted instantiation: void* google::protobuf::Arena::AllocateInternal<ruby_fuzzer::Time, true>() Unexecuted instantiation: void* google::protobuf::Arena::AllocateInternal<ruby_fuzzer::Array, true>() Unexecuted instantiation: void* google::protobuf::Arena::AllocateInternal<ruby_fuzzer::MathType, true>() Unexecuted instantiation: void* google::protobuf::Arena::AllocateInternal<ruby_fuzzer::MathOps, true>() Unexecuted instantiation: void* google::protobuf::Arena::AllocateInternal<ruby_fuzzer::BuiltinFuncs, true>() Unexecuted instantiation: void* google::protobuf::Arena::AllocateInternal<ruby_fuzzer::Statement, true>() Unexecuted instantiation: void* google::protobuf::Arena::AllocateInternal<ruby_fuzzer::StatementSeq, true>() Unexecuted instantiation: void* google::protobuf::Arena::AllocateInternal<ruby_fuzzer::Function, true>() |
573 | | |
574 | | // CreateMessage<T> requires that T supports arenas, but this private method |
575 | | // works whether or not T supports arenas. These are not exposed to user code |
576 | | // as it can cause confusing API usages, and end up having double free in |
577 | | // user code. These are used only internally from LazyField and Repeated |
578 | | // fields, since they are designed to work in all mode combinations. |
579 | | template <typename Msg, typename... Args> |
580 | | PROTOBUF_ALWAYS_INLINE static Msg* DoCreateMaybeMessage(Arena* arena, |
581 | | std::true_type, |
582 | 0 | Args&&... args) { |
583 | 0 | return CreateMessageInternal<Msg>(arena, std::forward<Args>(args)...); |
584 | 0 | } |
585 | | |
586 | | template <typename T, typename... Args> |
587 | | PROTOBUF_ALWAYS_INLINE static T* DoCreateMaybeMessage(Arena* arena, |
588 | | std::false_type, |
589 | | Args&&... args) { |
590 | | return Create<T>(arena, std::forward<Args>(args)...); |
591 | | } |
592 | | |
593 | | template <typename T, typename... Args> |
594 | | PROTOBUF_ALWAYS_INLINE static T* CreateMaybeMessage(Arena* arena, |
595 | 0 | Args&&... args) { |
596 | 0 | return DoCreateMaybeMessage<T>(arena, is_arena_constructable<T>(), |
597 | 0 | std::forward<Args>(args)...); |
598 | 0 | } |
599 | | |
600 | | template <typename T, typename... Args> |
601 | 0 | PROTOBUF_NDEBUG_INLINE T* DoCreateMessage(Args&&... args) { |
602 | 0 | return InternalHelper<T>::Construct( |
603 | 0 | AllocateInternal<T, is_destructor_skippable<T>::value>(), this, |
604 | 0 | std::forward<Args>(args)...); |
605 | 0 | } Unexecuted instantiation: google::protobuf::internal::ImplicitWeakMessage* google::protobuf::Arena::DoCreateMessage<google::protobuf::internal::ImplicitWeakMessage>() Unexecuted instantiation: ruby_fuzzer::VarRef* google::protobuf::Arena::DoCreateMessage<ruby_fuzzer::VarRef>() Unexecuted instantiation: ruby_fuzzer::ArrType* google::protobuf::Arena::DoCreateMessage<ruby_fuzzer::ArrType>() Unexecuted instantiation: ruby_fuzzer::KVPair* google::protobuf::Arena::DoCreateMessage<ruby_fuzzer::KVPair>() Unexecuted instantiation: ruby_fuzzer::HashType* google::protobuf::Arena::DoCreateMessage<ruby_fuzzer::HashType>() Unexecuted instantiation: ruby_fuzzer::StringExtNoArg* google::protobuf::Arena::DoCreateMessage<ruby_fuzzer::StringExtNoArg>() Unexecuted instantiation: ruby_fuzzer::MathConst* google::protobuf::Arena::DoCreateMessage<ruby_fuzzer::MathConst>() Unexecuted instantiation: ruby_fuzzer::Const* google::protobuf::Arena::DoCreateMessage<ruby_fuzzer::Const>() Unexecuted instantiation: ruby_fuzzer::BinaryOp* google::protobuf::Arena::DoCreateMessage<ruby_fuzzer::BinaryOp>() Unexecuted instantiation: ruby_fuzzer::Rvalue* google::protobuf::Arena::DoCreateMessage<ruby_fuzzer::Rvalue>() Unexecuted instantiation: ruby_fuzzer::AssignmentStatement* google::protobuf::Arena::DoCreateMessage<ruby_fuzzer::AssignmentStatement>() Unexecuted instantiation: ruby_fuzzer::IfElse* google::protobuf::Arena::DoCreateMessage<ruby_fuzzer::IfElse>() Unexecuted instantiation: ruby_fuzzer::Ternary* google::protobuf::Arena::DoCreateMessage<ruby_fuzzer::Ternary>() Unexecuted instantiation: ruby_fuzzer::ObjectSpace* google::protobuf::Arena::DoCreateMessage<ruby_fuzzer::ObjectSpace>() Unexecuted instantiation: ruby_fuzzer::Time* google::protobuf::Arena::DoCreateMessage<ruby_fuzzer::Time>() Unexecuted instantiation: ruby_fuzzer::Array* google::protobuf::Arena::DoCreateMessage<ruby_fuzzer::Array>() Unexecuted instantiation: ruby_fuzzer::MathType* google::protobuf::Arena::DoCreateMessage<ruby_fuzzer::MathType>() Unexecuted instantiation: ruby_fuzzer::MathOps* google::protobuf::Arena::DoCreateMessage<ruby_fuzzer::MathOps>() Unexecuted instantiation: ruby_fuzzer::BuiltinFuncs* google::protobuf::Arena::DoCreateMessage<ruby_fuzzer::BuiltinFuncs>() Unexecuted instantiation: ruby_fuzzer::Statement* google::protobuf::Arena::DoCreateMessage<ruby_fuzzer::Statement>() Unexecuted instantiation: ruby_fuzzer::StatementSeq* google::protobuf::Arena::DoCreateMessage<ruby_fuzzer::StatementSeq>() Unexecuted instantiation: ruby_fuzzer::Function* google::protobuf::Arena::DoCreateMessage<ruby_fuzzer::Function>() |
606 | | |
607 | | // CreateInArenaStorage is used to implement map field. Without it, |
608 | | // Map need to call generated message's protected arena constructor, |
609 | | // which needs to declare Map as friend of generated message. |
610 | | template <typename T, typename... Args> |
611 | | static void CreateInArenaStorage(T* ptr, Arena* arena, Args&&... args) { |
612 | | CreateInArenaStorageInternal(ptr, arena, |
613 | | typename is_arena_constructable<T>::type(), |
614 | | std::forward<Args>(args)...); |
615 | | if (PROTOBUF_PREDICT_TRUE(arena != nullptr)) { |
616 | | RegisterDestructorInternal( |
617 | | ptr, arena, |
618 | | typename InternalHelper<T>::is_destructor_skippable::type()); |
619 | | } |
620 | | } |
621 | | |
622 | | template <typename T, typename... Args> |
623 | | static void CreateInArenaStorageInternal(T* ptr, Arena* arena, |
624 | | std::true_type, Args&&... args) { |
625 | | InternalHelper<T>::Construct(ptr, arena, std::forward<Args>(args)...); |
626 | | } |
627 | | template <typename T, typename... Args> |
628 | | static void CreateInArenaStorageInternal(T* ptr, Arena* /* arena */, |
629 | | std::false_type, Args&&... args) { |
630 | | new (ptr) T(std::forward<Args>(args)...); |
631 | | } |
632 | | |
633 | | template <typename T> |
634 | | static void RegisterDestructorInternal(T* /* ptr */, Arena* /* arena */, |
635 | | std::true_type) {} |
636 | | template <typename T> |
637 | | static void RegisterDestructorInternal(T* ptr, Arena* arena, |
638 | | std::false_type) { |
639 | | arena->OwnDestructor(ptr); |
640 | | } |
641 | | |
642 | | // Implementation for GetArena(). Only message objects with |
643 | | // InternalArenaConstructable_ tags can be associated with an arena, and such |
644 | | // objects must implement a GetArena() method. |
645 | | template <typename T> |
646 | | PROTOBUF_ALWAYS_INLINE static Arena* GetArenaInternal(T* value) { |
647 | | return InternalHelper<T>::GetArena(value); |
648 | | } |
649 | | |
650 | 0 | void* AllocateAlignedForArray(size_t n, size_t align) { |
651 | 0 | if (align <= internal::ArenaAlignDefault::align) { |
652 | 0 | return AllocateForArray(internal::ArenaAlignDefault::Ceil(n)); |
653 | 0 | } else { |
654 | 0 | // We are wasting space by over allocating align - 8 bytes. Compared |
655 | 0 | // to a dedicated function that takes current alignment in consideration. |
656 | 0 | // Such a scheme would only waste (align - 8)/2 bytes on average, but |
657 | 0 | // requires a dedicated function in the outline arena allocation |
658 | 0 | // functions. Possibly re-evaluate tradeoffs later. |
659 | 0 | auto align_as = internal::ArenaAlignAs(align); |
660 | 0 | return align_as.Ceil(AllocateForArray(align_as.Padded(n))); |
661 | 0 | } |
662 | 0 | } |
663 | | |
664 | | void* Allocate(size_t n); |
665 | | void* AllocateForArray(size_t n); |
666 | | void* AllocateAlignedWithCleanup(size_t n, size_t align, |
667 | | void (*destructor)(void*)); |
668 | | |
669 | | template <typename Type> |
670 | | friend class internal::GenericTypeHandler; |
671 | | friend class internal::InternalMetadata; // For user_arena(). |
672 | | friend class internal::LazyField; // For CreateMaybeMessage. |
673 | | friend class internal::EpsCopyInputStream; // For parser performance |
674 | | friend class internal::TcParser; // For parser performance |
675 | | friend class MessageLite; |
676 | | template <typename Key, typename T> |
677 | | friend class Map; |
678 | | template <typename> |
679 | | friend class RepeatedField; // For ReturnArrayMemory |
680 | | friend class internal::RepeatedPtrFieldBase; // For ReturnArrayMemory |
681 | | friend struct internal::ArenaTestPeer; |
682 | | }; |
683 | | |
684 | | template <> |
685 | 0 | inline void* Arena::AllocateInternal<std::string, false>() { |
686 | 0 | return impl_.AllocateFromStringBlock(); |
687 | 0 | } |
688 | | |
689 | | } // namespace protobuf |
690 | | } // namespace google |
691 | | |
692 | | #include "google/protobuf/port_undef.inc" |
693 | | |
694 | | #endif // GOOGLE_PROTOBUF_ARENA_H__ |