protobuf/ruby/ext/google/protobuf_c/protobuf.c
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2014 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 #include "protobuf.h"
32 
33 #include <ruby/version.h>
34 
35 #include "defs.h"
36 #include "map.h"
37 #include "message.h"
38 #include "repeated_field.h"
39 
41 VALUE cTypeError;
42 
44  const upb_msgdef *entry = upb_fielddef_msgsubdef(field);
45  return upb_msgdef_itof(entry, 1);
46 }
47 
49  const upb_msgdef *entry = upb_fielddef_msgsubdef(field);
50  return upb_msgdef_itof(entry, 2);
51 }
52 
53 // -----------------------------------------------------------------------------
54 // StringBuilder, for inspect
55 // -----------------------------------------------------------------------------
56 
57 struct StringBuilder {
58  size_t size;
59  size_t cap;
60  char *data;
61 };
62 
64 
65 static size_t StringBuilder_SizeOf(size_t cap) {
66  return sizeof(StringBuilder) + cap;
67 }
68 
70  const size_t cap = 128;
71  StringBuilder* builder = malloc(sizeof(*builder));
72  builder->size = 0;
73  builder->cap = cap;
74  builder->data = malloc(builder->cap);
75  return builder;
76 }
77 
79  free(b->data);
80  free(b);
81 }
82 
83 void StringBuilder_Printf(StringBuilder* b, const char *fmt, ...) {
84  size_t have = b->cap - b->size;
85  size_t n;
86  va_list args;
87 
88  va_start(args, fmt);
89  n = vsnprintf(&b->data[b->size], have, fmt, args);
90  va_end(args);
91 
92  if (have <= n) {
93  while (have <= n) {
94  b->cap *= 2;
95  have = b->cap - b->size;
96  }
97  b->data = realloc(b->data, StringBuilder_SizeOf(b->cap));
98  va_start(args, fmt);
99  n = vsnprintf(&b->data[b->size], have, fmt, args);
100  va_end(args);
101  PBRUBY_ASSERT(n < have);
102  }
103 
104  b->size += n;
105 }
106 
108  VALUE ret = rb_str_new(b->data, b->size);
109  rb_enc_associate(ret, rb_utf8_encoding());
110  return ret;
111 }
112 
114  const upb_enumdef* e) {
115  const char *name = upb_enumdef_iton(e, val);
116  if (name) {
117  StringBuilder_Printf(b, ":%s", name);
118  } else {
119  StringBuilder_Printf(b, "%" PRId32, val);
120  }
121 }
122 
124  TypeInfo info) {
125  switch (info.type) {
126  case UPB_TYPE_BOOL:
127  StringBuilder_Printf(b, "%s", val.bool_val ? "true" : "false");
128  break;
129  case UPB_TYPE_FLOAT: {
130  VALUE str = rb_inspect(DBL2NUM(val.float_val));
131  StringBuilder_Printf(b, "%s", RSTRING_PTR(str));
132  break;
133  }
134  case UPB_TYPE_DOUBLE: {
135  VALUE str = rb_inspect(DBL2NUM(val.double_val));
136  StringBuilder_Printf(b, "%s", RSTRING_PTR(str));
137  break;
138  }
139  case UPB_TYPE_INT32:
140  StringBuilder_Printf(b, "%" PRId32, val.int32_val);
141  break;
142  case UPB_TYPE_UINT32:
143  StringBuilder_Printf(b, "%" PRIu32, val.uint32_val);
144  break;
145  case UPB_TYPE_INT64:
146  StringBuilder_Printf(b, "%" PRId64, val.int64_val);
147  break;
148  case UPB_TYPE_UINT64:
149  StringBuilder_Printf(b, "%" PRIu64, val.uint64_val);
150  break;
151  case UPB_TYPE_STRING:
152  StringBuilder_Printf(b, "\"%.*s\"", (int)val.str_val.size, val.str_val.data);
153  break;
154  case UPB_TYPE_BYTES:
155  StringBuilder_Printf(b, "\"%.*s\"", (int)val.str_val.size, val.str_val.data);
156  break;
157  case UPB_TYPE_ENUM:
159  break;
160  case UPB_TYPE_MESSAGE:
162  break;
163  }
164 }
165 
166 // -----------------------------------------------------------------------------
167 // Arena
168 // -----------------------------------------------------------------------------
169 
170 typedef struct {
171  upb_arena *arena;
172  VALUE pinned_objs;
173 } Arena;
174 
175 static void Arena_mark(void *data) {
176  Arena *arena = data;
177  rb_gc_mark(arena->pinned_objs);
178 }
179 
180 static void Arena_free(void *data) {
181  Arena *arena = data;
182  upb_arena_free(arena->arena);
183  xfree(arena);
184 }
185 
186 static VALUE cArena;
187 
188 const rb_data_type_t Arena_type = {
189  "Google::Protobuf::Internal::Arena",
190  { Arena_mark, Arena_free, NULL },
191  .flags = RUBY_TYPED_FREE_IMMEDIATELY,
192 };
193 
194 static VALUE Arena_alloc(VALUE klass) {
195  Arena *arena = ALLOC(Arena);
196  arena->arena = upb_arena_new();
197  arena->pinned_objs = Qnil;
198  return TypedData_Wrap_Struct(klass, &Arena_type, arena);
199 }
200 
201 upb_arena *Arena_get(VALUE _arena) {
202  Arena *arena;
203  TypedData_Get_Struct(_arena, Arena, &Arena_type, arena);
204  return arena->arena;
205 }
206 
207 void Arena_fuse(VALUE _arena, upb_arena *other) {
208  Arena *arena;
209  TypedData_Get_Struct(_arena, Arena, &Arena_type, arena);
210  if (!upb_arena_fuse(arena->arena, other)) {
211  rb_raise(rb_eRuntimeError,
212  "Unable to fuse arenas. This should never happen since Ruby does "
213  "not use initial blocks");
214  }
215 }
216 
217 VALUE Arena_new() {
218  return Arena_alloc(cArena);
219 }
220 
221 void Arena_Pin(VALUE _arena, VALUE obj) {
222  Arena *arena;
223  TypedData_Get_Struct(_arena, Arena, &Arena_type, arena);
224  if (arena->pinned_objs == Qnil) {
225  arena->pinned_objs = rb_ary_new();
226  }
227  rb_ary_push(arena->pinned_objs, obj);
228 }
229 
230 void Arena_register(VALUE module) {
231  VALUE internal = rb_define_module_under(module, "Internal");
232  VALUE klass = rb_define_class_under(internal, "Arena", rb_cObject);
233  rb_define_alloc_func(klass, Arena_alloc);
234  rb_gc_register_address(&cArena);
235  cArena = klass;
236 }
237 
238 // -----------------------------------------------------------------------------
239 // Object Cache
240 // -----------------------------------------------------------------------------
241 
242 // A pointer -> Ruby Object cache that keeps references to Ruby wrapper
243 // objects. This allows us to look up any Ruby wrapper object by the address
244 // of the object it is wrapping. That way we can avoid ever creating two
245 // different wrapper objects for the same C object, which saves memory and
246 // preserves object identity.
247 //
248 // We use WeakMap for the cache. For Ruby <2.7 we also need a secondary Hash
249 // to store WeakMap keys because Ruby <2.7 WeakMap doesn't allow non-finalizable
250 // keys.
251 //
252 // We also need the secondary Hash if sizeof(long) < sizeof(VALUE), because this
253 // means it may not be possible to fit a pointer into a Fixnum. Keys are
254 // pointers, and if they fit into a Fixnum, Ruby doesn't collect them, but if
255 // they overflow and require allocating a Bignum, they could get collected
256 // prematurely, thus removing the cache entry. This happens on 64-bit Windows,
257 // on which pointers are 64 bits but longs are 32 bits. In this case, we enable
258 // the secondary Hash to hold the keys and prevent them from being collected.
259 
260 #if RUBY_API_VERSION_CODE >= 20700 && SIZEOF_LONG >= SIZEOF_VALUE
261 #define USE_SECONDARY_MAP 0
262 #else
263 #define USE_SECONDARY_MAP 1
264 #endif
265 
266 #if USE_SECONDARY_MAP
267 
268 // Maps Numeric -> Object. The object is then used as a key into the WeakMap.
269 // This is needed for Ruby <2.7 where a number cannot be a key to WeakMap.
270 // The object is used only for its identity; it does not contain any data.
271 VALUE secondary_map = Qnil;
272 
273 // Mutations to the map are under a mutex, because SeconaryMap_MaybeGC()
274 // iterates over the map which cannot happen in parallel with insertions, or
275 // Ruby will throw:
276 // can't add a new key into hash during iteration (RuntimeError)
277 VALUE secondary_map_mutex = Qnil;
278 
279 // Lambda that will GC entries from the secondary map that are no longer present
280 // in the primary map.
283 
284 extern VALUE weak_obj_cache;
285 
286 static void SecondaryMap_Init() {
287  rb_gc_register_address(&secondary_map);
288  rb_gc_register_address(&gc_secondary_map_lambda);
289  rb_gc_register_address(&secondary_map_mutex);
290  secondary_map = rb_hash_new();
291  gc_secondary_map_lambda = rb_eval_string(
292  "->(secondary, weak) {\n"
293  " secondary.delete_if { |k, v| !weak.key?(v) }\n"
294  "}\n");
295  secondary_map_mutex = rb_mutex_new();
296  length = rb_intern("length");
297 }
298 
299 // The secondary map is a regular Hash, and will never shrink on its own.
300 // The main object cache is a WeakMap that will automatically remove entries
301 // when the target object is no longer reachable, but unless we manually
302 // remove the corresponding entries from the secondary map, it will grow
303 // without bound.
304 //
305 // To avoid this unbounded growth we periodically remove entries from the
306 // secondary map that are no longer present in the WeakMap. The logic of
307 // how often to perform this GC is an artbirary tuning parameter that
308 // represents a straightforward CPU/memory tradeoff.
309 //
310 // Requires: secondary_map_mutex is held.
311 static void SecondaryMap_MaybeGC() {
312  PBRUBY_ASSERT(rb_mutex_locked_p(secondary_map_mutex) == Qtrue);
313  size_t weak_len = NUM2ULL(rb_funcall(weak_obj_cache, length, 0));
314  size_t secondary_len = RHASH_SIZE(secondary_map);
315  if (secondary_len < weak_len) {
316  // Logically this case should not be possible: a valid entry cannot exist in
317  // the weak table unless there is a corresponding entry in the secondary
318  // table. It should *always* be the case that secondary_len >= weak_len.
319  //
320  // However ObjectSpace::WeakMap#length (and therefore weak_len) is
321  // unreliable: it overreports its true length by including non-live objects.
322  // However these non-live objects are not yielded in iteration, so we may
323  // have previously deleted them from the secondary map in a previous
324  // invocation of SecondaryMap_MaybeGC().
325  //
326  // In this case, we can't measure any waste, so we just return.
327  return;
328  }
329  size_t waste = secondary_len - weak_len;
330  // GC if we could remove at least 2000 entries or 20% of the table size
331  // (whichever is greater). Since the cost of the GC pass is O(N), we
332  // want to make sure that we condition this on overall table size, to
333  // avoid O(N^2) CPU costs.
334  size_t threshold = PBRUBY_MAX(secondary_len * 0.2, 2000);
335  if (waste > threshold) {
336  rb_funcall(gc_secondary_map_lambda, rb_intern("call"), 2,
338  }
339 }
340 
341 // Requires: secondary_map_mutex is held by this thread iff create == true.
342 static VALUE SecondaryMap_Get(VALUE key, bool create) {
343  PBRUBY_ASSERT(!create || rb_mutex_locked_p(secondary_map_mutex) == Qtrue);
344  VALUE ret = rb_hash_lookup(secondary_map, key);
345  if (ret == Qnil && create) {
347  ret = rb_class_new_instance(0, NULL, rb_cObject);
348  rb_hash_aset(secondary_map, key, ret);
349  }
350  return ret;
351 }
352 
353 #endif
354 
355 // Requires: secondary_map_mutex is held by this thread iff create == true.
356 static VALUE ObjectCache_GetKey(const void* key, bool create) {
357  VALUE key_val = (VALUE)key;
358  PBRUBY_ASSERT((key_val & 3) == 0);
359  VALUE ret = LL2NUM(key_val >> 2);
360 #if USE_SECONDARY_MAP
362 #endif
363  return ret;
364 }
365 
366 // Public ObjectCache API.
367 
368 VALUE weak_obj_cache = Qnil;
371 
372 static void ObjectCache_Init() {
373  rb_gc_register_address(&weak_obj_cache);
374  VALUE klass = rb_eval_string("ObjectSpace::WeakMap");
375  weak_obj_cache = rb_class_new_instance(0, NULL, klass);
376  item_get = rb_intern("[]");
377  item_set = rb_intern("[]=");
378 #if USE_SECONDARY_MAP
380 #endif
381 }
382 
383 void ObjectCache_Add(const void* key, VALUE val) {
385 #if USE_SECONDARY_MAP
386  rb_mutex_lock(secondary_map_mutex);
387 #endif
388  VALUE key_rb = ObjectCache_GetKey(key, true);
389  rb_funcall(weak_obj_cache, item_set, 2, key_rb, val);
390 #if USE_SECONDARY_MAP
391  rb_mutex_unlock(secondary_map_mutex);
392 #endif
394 }
395 
396 // Returns the cached object for this key, if any. Otherwise returns Qnil.
397 VALUE ObjectCache_Get(const void* key) {
398  VALUE key_rb = ObjectCache_GetKey(key, false);
399  return rb_funcall(weak_obj_cache, item_get, 1, key_rb);
400 }
401 
402 /*
403  * call-seq:
404  * Google::Protobuf.discard_unknown(msg)
405  *
406  * Discard unknown fields in the given message object and recursively discard
407  * unknown fields in submessages.
408  */
409 static VALUE Google_Protobuf_discard_unknown(VALUE self, VALUE msg_rb) {
410  const upb_msgdef *m;
411  upb_msg *msg = Message_GetMutable(msg_rb, &m);
412  if (!upb_msg_discardunknown(msg, m, 128)) {
413  rb_raise(rb_eRuntimeError, "Messages nested too deeply.");
414  }
415 
416  return Qnil;
417 }
418 
419 /*
420  * call-seq:
421  * Google::Protobuf.deep_copy(obj) => copy_of_obj
422  *
423  * Performs a deep copy of a RepeatedField instance, a Map instance, or a
424  * message object, recursively copying its members.
425  */
426 VALUE Google_Protobuf_deep_copy(VALUE self, VALUE obj) {
427  VALUE klass = CLASS_OF(obj);
428  if (klass == cRepeatedField) {
430  } else if (klass == cMap) {
431  return Map_deep_copy(obj);
432  } else {
433  VALUE new_arena_rb = Arena_new();
434  upb_arena *new_arena = Arena_get(new_arena_rb);
435  const upb_msgdef *m;
436  const upb_msg *msg = Message_Get(obj, &m);
437  upb_msg* new_msg = Message_deep_copy(msg, m, new_arena);
438  return Message_GetRubyWrapper(new_msg, m, new_arena_rb);
439  }
440 }
441 
442 // -----------------------------------------------------------------------------
443 // Initialization/entry point.
444 // -----------------------------------------------------------------------------
445 
446 // This must be named "Init_protobuf_c" because the Ruby module is named
447 // "protobuf_c" -- the VM looks for this symbol in our .so.
448 __attribute__ ((visibility ("default")))
449 void Init_protobuf_c() {
451 
452  VALUE google = rb_define_module("Google");
453  VALUE protobuf = rb_define_module_under(google, "Protobuf");
454 
460 
461  cParseError = rb_const_get(protobuf, rb_intern("ParseError"));
462  rb_gc_register_mark_object(cParseError);
463  cTypeError = rb_const_get(protobuf, rb_intern("TypeError"));
464  rb_gc_register_mark_object(cTypeError);
465 
466  rb_define_singleton_method(protobuf, "discard_unknown",
468  rb_define_singleton_method(protobuf, "deep_copy",
470 }
RepeatedField_register
void RepeatedField_register(VALUE module)
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/repeated_field.c:656
xds_interop_client.str
str
Definition: xds_interop_client.py:487
obj
OPENSSL_EXPORT const ASN1_OBJECT * obj
Definition: x509.h:1671
UPB_TYPE_UINT64
@ UPB_TYPE_UINT64
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:487
vsnprintf
int __cdecl vsnprintf(char *buffer, size_t count, const char *format, va_list argptr)
Definition: libc.cpp:135
upb_arena
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:2252
StringBuilder_Free
void StringBuilder_Free(StringBuilder *b)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:78
Arena
struct Arena Arena
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/arena.h:189
Arena_type
const rb_data_type_t Arena_type
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:188
UPB_TYPE_FLOAT
@ UPB_TYPE_FLOAT
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:476
Message_GetRubyWrapper
VALUE Message_GetRubyWrapper(upb_msg *msg, const upb_msgdef *m, VALUE arena)
Definition: protobuf/ruby/ext/google/protobuf_c/message.c:122
StringBuilder
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:57
upb_msgval::uint64_val
uint64_t uint64_val
Definition: php-upb.h:4619
SecondaryMap_MaybeGC
static void SecondaryMap_MaybeGC()
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:311
SecondaryMap_Get
static VALUE SecondaryMap_Get(VALUE key, bool create)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:342
upb_arena_free
void upb_arena_free(upb_arena *a)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:2391
Message_register
void Message_register(VALUE protobuf)
Definition: protobuf/ruby/ext/google/protobuf_c/message.c:1322
Arena
Definition: arena.c:39
Arena_free
static void Arena_free(void *data)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:180
Arena_Pin
void Arena_Pin(VALUE _arena, VALUE obj)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:221
TypeInfo
Definition: protobuf/php/ext/google/protobuf/def.h:69
PBRUBY_ASSERT
#define PBRUBY_ASSERT(expr)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.h:110
google::protobuf
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:12
UPB_TYPE_UINT32
@ UPB_TYPE_UINT32
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:478
setup.name
name
Definition: setup.py:542
PBRUBY_MAX
#define PBRUBY_MAX(x, y)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.h:113
map.h
upb_msgval::str_val
upb_strview str_val
Definition: php-upb.h:4623
upb_strview::data
const char * data
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:258
cArena
static VALUE cArena
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:186
Arena_get
upb_arena * Arena_get(VALUE _arena)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:201
upb_msg
void upb_msg
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:548
RepeatedField_deep_copy
VALUE RepeatedField_deep_copy(VALUE _self)
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/repeated_field.c:368
arena
grpc_core::ScopedArenaPtr arena
Definition: binder_transport_test.cc:237
item_set
ID item_set
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:370
upb_fielddef_msgsubdef
const upb_msgdef * upb_fielddef_msgsubdef(const upb_fielddef *f)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3476
map_field_key
const upb_fielddef * map_field_key(const upb_fielddef *field)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:43
Map_register
void Map_register(VALUE module)
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/map.c:837
UPB_TYPE_BYTES
@ UPB_TYPE_BYTES
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:482
UPB_TYPE_ENUM
@ UPB_TYPE_ENUM
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:479
profile_analyzer.builder
builder
Definition: profile_analyzer.py:159
generic_client_interceptor.create
def create(intercept_call)
Definition: generic_client_interceptor.py:55
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
secondary_map
VALUE secondary_map
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:271
upb_msg_discardunknown
bool upb_msg_discardunknown(upb_msg *msg, const upb_msgdef *m, int maxdepth)
Definition: php-upb.c:7250
protobuf.h
Message_deep_copy
VALUE Message_deep_copy(VALUE _self)
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/message.c:513
Message_PrintMessage
void Message_PrintMessage(StringBuilder *b, const upb_msg *msg, const upb_msgdef *m)
Definition: protobuf/ruby/ext/google/protobuf_c/message.c:136
__attribute__
__attribute__((visibility("default")))
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:448
Init_protobuf_c
void Init_protobuf_c()
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.c:96
TypeInfo::msgdef
const upb_msgdef * msgdef
Definition: defs.h:56
item_get
ID item_get
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:369
upb_msgval::float_val
float float_val
Definition: php-upb.h:4614
StringBuilder
struct StringBuilder StringBuilder
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:63
upb_enumdef_iton
const char * upb_enumdef_iton(const upb_enumdef *def, int32_t num)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3283
upb_msgval::double_val
double double_val
Definition: php-upb.h:4615
upb_arena_new
UPB_INLINE upb_arena * upb_arena_new(void)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:392
StringBuilder_PrintMsgval
void StringBuilder_PrintMsgval(StringBuilder *b, upb_msgval val, TypeInfo info)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:123
Message_GetMutable
upb_msg * Message_GetMutable(VALUE msg_rb, const upb_msgdef **m)
Definition: protobuf/ruby/ext/google/protobuf_c/message.c:98
secondary_map_mutex
VALUE secondary_map_mutex
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:277
data
char data[kBufferLength]
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1006
cRepeatedField
VALUE cRepeatedField
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/repeated_field.c:42
upb_fielddef
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:2934
ObjectCache_Add
void ObjectCache_Add(const void *key, VALUE val)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:383
b
uint64_t b
Definition: abseil-cpp/absl/container/internal/layout_test.cc:53
Map_deep_copy
VALUE Map_deep_copy(VALUE _self)
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/map.c:548
UPB_TYPE_INT32
@ UPB_TYPE_INT32
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:477
upb_msgdef_itof
const upb_fielddef * upb_msgdef_itof(const upb_msgdef *m, uint32_t i)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3556
n
int n
Definition: abseil-cpp/absl/container/btree_test.cc:1080
msg
std::string msg
Definition: client_interceptors_end2end_test.cc:372
StringBuilder_Printf
void StringBuilder_Printf(StringBuilder *b, const char *fmt,...)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:83
Google_Protobuf_discard_unknown
static VALUE Google_Protobuf_discard_unknown(VALUE self, VALUE msg_rb)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:409
upb_msgval::bool_val
bool bool_val
Definition: php-upb.h:4613
StringBuilder_PrintEnum
static void StringBuilder_PrintEnum(StringBuilder *b, int32_t val, const upb_enumdef *e)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:113
map_field_value
const upb_fielddef * map_field_value(const upb_fielddef *field)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:48
TypeInfo::enumdef
const upb_enumdef * enumdef
Definition: defs.h:57
Arena_alloc
static VALUE Arena_alloc(VALUE klass)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:194
Defs_register
void Defs_register(VALUE module)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:1274
testing::internal::fmt
GTEST_API_ const char * fmt
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:1808
StringBuilder::cap
size_t cap
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:59
upb_msgval
Definition: php-upb.h:4612
cParseError
VALUE cParseError
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:40
field
const FieldDescriptor * field
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/parser_unittest.cc:2692
key
const char * key
Definition: hpack_parser_table.cc:164
StringBuilder_ToRubyString
VALUE StringBuilder_ToRubyString(StringBuilder *b)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:107
length
ID length
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:282
UPB_TYPE_STRING
@ UPB_TYPE_STRING
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:481
upb_enumdef
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:2984
Message_Get
const upb_msg * Message_Get(VALUE msg_rb, const upb_msgdef **m)
Definition: protobuf/ruby/ext/google/protobuf_c/message.c:92
ALLOC
#define ALLOC(class_name)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:1486
ret
UniquePtr< SSL_SESSION > ret
Definition: ssl_x509.cc:1029
StringBuilder_New
StringBuilder * StringBuilder_New()
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:69
descriptor_database_test_wrapper.module
module
Definition: descriptor_database_test_wrapper.py:30
upb_msgval::msg_val
const upb_msg * msg_val
Definition: php-upb.h:4621
StringBuilder::data
char * data
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:60
UPB_TYPE_MESSAGE
@ UPB_TYPE_MESSAGE
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:483
ObjectCache_GetKey
static VALUE ObjectCache_GetKey(const void *key, bool create)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:356
cMap
VALUE cMap
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/map.c:140
defs.h
gc_secondary_map_lambda
VALUE gc_secondary_map_lambda
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:281
upb_arena_fuse
bool upb_arena_fuse(upb_arena *a1, upb_arena *a2)
Definition: php-upb.c:2919
StringBuilder::size
size_t size
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:58
ObjectCache_Init
static void ObjectCache_Init()
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:372
Arena::pinned_objs
VALUE pinned_objs
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:172
upb_msgval::int32_val
int32_t int32_val
Definition: php-upb.h:4616
TypeInfo::type
upb_fieldtype_t type
Definition: protobuf/php/ext/google/protobuf/def.h:70
SecondaryMap_Init
static void SecondaryMap_Init()
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:286
cTypeError
VALUE cTypeError
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:41
Arena_new
VALUE Arena_new()
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:217
repeated_field.h
StringBuilder_SizeOf
static size_t StringBuilder_SizeOf(size_t cap)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:65
regress.m
m
Definition: regress/regress.py:25
int32_t
signed int int32_t
Definition: stdint-msvc2008.h:77
Arena_fuse
void Arena_fuse(VALUE _arena, upb_arena *other)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:207
klass
zend_class_entry * klass
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:810
UPB_TYPE_DOUBLE
@ UPB_TYPE_DOUBLE
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:485
Arena_mark
static void Arena_mark(void *data)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:175
ObjectCache_Get
VALUE ObjectCache_Get(const void *key)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:397
upb_strview::size
size_t size
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:259
TypeInfo::def
union TypeInfo::@436 def
UPB_TYPE_BOOL
@ UPB_TYPE_BOOL
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:474
UPB_TYPE_INT64
@ UPB_TYPE_INT64
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:486
google
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:11
upb_msgdef
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:2962
upb_msgval::int64_val
int64_t int64_val
Definition: php-upb.h:4617
upb_msgval::uint32_val
uint32_t uint32_val
Definition: php-upb.h:4618
Arena_register
void Arena_register(VALUE module)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:230
Google_Protobuf_deep_copy
VALUE Google_Protobuf_deep_copy(VALUE self, VALUE obj)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:426
message.h
weak_obj_cache
VALUE weak_obj_cache
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:368


grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:47