grpc 1.58.3 → 1.59.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (548) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +48 -33
  3. data/include/grpc/event_engine/event_engine.h +6 -10
  4. data/include/grpc/impl/channel_arg_names.h +4 -0
  5. data/include/grpc/support/port_platform.h +74 -1
  6. data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +22 -9
  7. data/src/core/ext/filters/client_channel/client_channel.cc +422 -56
  8. data/src/core/ext/filters/client_channel/client_channel.h +52 -8
  9. data/src/core/ext/filters/client_channel/client_channel_plugin.cc +15 -1
  10. data/src/core/ext/filters/client_channel/dynamic_filters.h +2 -0
  11. data/src/core/ext/filters/client_channel/{http_proxy.cc → http_proxy_mapper.cc} +1 -1
  12. data/src/core/ext/filters/client_channel/{http_proxy.h → http_proxy_mapper.h} +3 -3
  13. data/src/core/ext/filters/client_channel/lb_policy/endpoint_list.cc +188 -0
  14. data/src/core/ext/filters/client_channel/lb_policy/endpoint_list.h +214 -0
  15. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +17 -4
  16. data/src/core/ext/filters/client_channel/lb_policy/health_check_client.cc +41 -6
  17. data/src/core/ext/filters/client_channel/lb_policy/health_check_client_internal.h +5 -3
  18. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +32 -103
  19. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +0 -7
  20. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +416 -139
  21. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.h +16 -0
  22. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +434 -459
  23. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +410 -26
  24. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +14 -46
  25. data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +851 -57
  26. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +16 -10
  27. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +47 -32
  28. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.cc +55 -3
  29. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +105 -175
  30. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +14 -7
  31. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +24 -6
  32. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +36 -2
  33. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +54 -44
  34. data/src/core/ext/filters/client_channel/subchannel.cc +33 -0
  35. data/src/core/ext/filters/client_channel/subchannel.h +9 -0
  36. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +1 -1
  37. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +11 -6
  38. data/src/core/ext/transport/chttp2/transport/flow_control.cc +28 -22
  39. data/src/core/ext/transport/chttp2/transport/flow_control.h +27 -4
  40. data/src/core/ext/transport/chttp2/transport/frame_data.h +1 -1
  41. data/src/core/ext/transport/chttp2/transport/frame_goaway.h +1 -1
  42. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +9 -0
  43. data/src/core/ext/transport/chttp2/transport/frame_ping.h +1 -1
  44. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +1 -1
  45. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +1 -1
  46. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +1 -1
  47. data/src/core/ext/transport/chttp2/transport/frame_settings.h +1 -1
  48. data/src/core/ext/transport/chttp2/transport/frame_window_update.h +1 -1
  49. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +1 -1
  50. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +34 -36
  51. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +3 -3
  52. data/src/core/ext/transport/chttp2/transport/internal.h +66 -47
  53. data/src/core/ext/transport/chttp2/transport/{frame.h → legacy_frame.h} +3 -3
  54. data/src/core/ext/transport/chttp2/transport/parsing.cc +4 -2
  55. data/src/core/ext/transport/chttp2/transport/ping_abuse_policy.cc +10 -0
  56. data/src/core/ext/transport/chttp2/transport/ping_abuse_policy.h +4 -0
  57. data/src/core/ext/transport/chttp2/transport/stream_lists.cc +1 -1
  58. data/src/core/ext/transport/chttp2/transport/writing.cc +2 -1
  59. data/src/core/ext/transport/inproc/inproc_transport.cc +9 -0
  60. data/src/core/ext/upb-generated/envoy/admin/v3/certs.upb.c +16 -18
  61. data/src/core/ext/upb-generated/envoy/admin/v3/certs.upb.h +75 -83
  62. data/src/core/ext/upb-generated/envoy/admin/v3/clusters.upb.c +27 -29
  63. data/src/core/ext/upb-generated/envoy/admin/v3/clusters.upb.h +102 -110
  64. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.c +16 -18
  65. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.h +73 -81
  66. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump_shared.upb.c +65 -67
  67. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump_shared.upb.h +294 -302
  68. data/src/core/ext/upb-generated/envoy/admin/v3/init_dump.upb.c +4 -6
  69. data/src/core/ext/upb-generated/envoy/admin/v3/init_dump.upb.h +20 -28
  70. data/src/core/ext/upb-generated/envoy/admin/v3/listeners.upb.c +5 -7
  71. data/src/core/ext/upb-generated/envoy/admin/v3/listeners.upb.h +24 -32
  72. data/src/core/ext/upb-generated/envoy/admin/v3/memory.upb.c +7 -9
  73. data/src/core/ext/upb-generated/envoy/admin/v3/memory.upb.h +19 -27
  74. data/src/core/ext/upb-generated/envoy/admin/v3/metrics.upb.c +4 -6
  75. data/src/core/ext/upb-generated/envoy/admin/v3/metrics.upb.h +10 -18
  76. data/src/core/ext/upb-generated/envoy/admin/v3/mutex_stats.upb.c +4 -6
  77. data/src/core/ext/upb-generated/envoy/admin/v3/mutex_stats.upb.h +10 -18
  78. data/src/core/ext/upb-generated/envoy/admin/v3/server_info.upb.c +42 -44
  79. data/src/core/ext/upb-generated/envoy/admin/v3/server_info.upb.h +141 -149
  80. data/src/core/ext/upb-generated/envoy/admin/v3/tap.upb.c +3 -5
  81. data/src/core/ext/upb-generated/envoy/admin/v3/tap.upb.h +8 -16
  82. data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.c +5 -7
  83. data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +1 -9
  84. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.c +3 -5
  85. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +4 -12
  86. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +36 -38
  87. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +157 -165
  88. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.c +87 -89
  89. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.h +372 -380
  90. data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.c +13 -15
  91. data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.h +55 -63
  92. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +111 -113
  93. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +441 -449
  94. data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.c +3 -5
  95. data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.h +8 -16
  96. data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.c +23 -25
  97. data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.h +88 -96
  98. data/src/core/ext/upb-generated/envoy/config/common/matcher/v3/matcher.upb.c +40 -42
  99. data/src/core/ext/upb-generated/envoy/config/common/matcher/v3/matcher.upb.h +180 -188
  100. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +26 -28
  101. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +108 -116
  102. data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.c +3 -5
  103. data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.h +9 -17
  104. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +65 -67
  105. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +245 -253
  106. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +27 -29
  107. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +119 -127
  108. data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.c +2 -4
  109. data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.h +6 -14
  110. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.c +3 -5
  111. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.h +8 -16
  112. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_method_list.upb.c +4 -6
  113. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_method_list.upb.h +20 -28
  114. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +49 -51
  115. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +184 -192
  116. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +49 -51
  117. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +225 -233
  118. data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.c +4 -6
  119. data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.h +13 -21
  120. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +63 -65
  121. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +246 -254
  122. data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.c +5 -7
  123. data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.h +19 -27
  124. data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.c +5 -7
  125. data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.h +19 -27
  126. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.c +8 -10
  127. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.h +30 -38
  128. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.c +7 -9
  129. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.h +28 -36
  130. data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.c +3 -5
  131. data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.h +9 -17
  132. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.c +12 -14
  133. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.h +48 -56
  134. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +23 -25
  135. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.h +92 -100
  136. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.c +27 -29
  137. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.h +108 -116
  138. data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.c +2 -4
  139. data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.h +5 -13
  140. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +38 -40
  141. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +167 -175
  142. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +34 -36
  143. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +162 -170
  144. data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.c +10 -12
  145. data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.h +37 -45
  146. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +4 -6
  147. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.h +13 -21
  148. data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.c +6 -8
  149. data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.h +18 -26
  150. data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.c +22 -24
  151. data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.h +97 -105
  152. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.c +24 -26
  153. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.h +111 -119
  154. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +43 -45
  155. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +183 -191
  156. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +20 -22
  157. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +102 -110
  158. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +253 -255
  159. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +1108 -1116
  160. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.c +8 -10
  161. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.h +31 -39
  162. data/src/core/ext/upb-generated/envoy/config/tap/v3/common.upb.c +35 -37
  163. data/src/core/ext/upb-generated/envoy/config/tap/v3/common.upb.h +150 -158
  164. data/src/core/ext/upb-generated/envoy/config/trace/v3/datadog.upb.c +4 -6
  165. data/src/core/ext/upb-generated/envoy/config/trace/v3/datadog.upb.h +10 -18
  166. data/src/core/ext/upb-generated/envoy/config/trace/v3/dynamic_ot.upb.c +3 -5
  167. data/src/core/ext/upb-generated/envoy/config/trace/v3/dynamic_ot.upb.h +8 -16
  168. data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.c +4 -6
  169. data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.h +13 -21
  170. data/src/core/ext/upb-generated/envoy/config/trace/v3/lightstep.upb.c +5 -7
  171. data/src/core/ext/upb-generated/envoy/config/trace/v3/lightstep.upb.h +19 -27
  172. data/src/core/ext/upb-generated/envoy/config/trace/v3/opencensus.upb.c +14 -16
  173. data/src/core/ext/upb-generated/envoy/config/trace/v3/opencensus.upb.h +53 -61
  174. data/src/core/ext/upb-generated/envoy/config/trace/v3/opentelemetry.upb.c +3 -5
  175. data/src/core/ext/upb-generated/envoy/config/trace/v3/opentelemetry.upb.h +8 -16
  176. data/src/core/ext/upb-generated/envoy/config/trace/v3/service.upb.c +2 -4
  177. data/src/core/ext/upb-generated/envoy/config/trace/v3/service.upb.h +5 -13
  178. data/src/core/ext/upb-generated/envoy/config/trace/v3/skywalking.upb.c +7 -9
  179. data/src/core/ext/upb-generated/envoy/config/trace/v3/skywalking.upb.h +24 -32
  180. data/src/core/ext/upb-generated/envoy/config/trace/v3/trace.upb.c +1 -3
  181. data/src/core/ext/upb-generated/envoy/config/trace/v3/trace.upb.h +1 -9
  182. data/src/core/ext/upb-generated/envoy/config/trace/v3/xray.upb.c +7 -9
  183. data/src/core/ext/upb-generated/envoy/config/trace/v3/xray.upb.h +23 -31
  184. data/src/core/ext/upb-generated/envoy/config/trace/v3/zipkin.upb.c +8 -10
  185. data/src/core/ext/upb-generated/envoy/config/trace/v3/zipkin.upb.h +23 -31
  186. data/src/core/ext/upb-generated/envoy/data/accesslog/v3/accesslog.upb.c +114 -116
  187. data/src/core/ext/upb-generated/envoy/data/accesslog/v3/accesslog.upb.h +372 -380
  188. data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.c +2 -4
  189. data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.h +9 -17
  190. data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.c +8 -10
  191. data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.h +30 -38
  192. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +21 -23
  193. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +81 -89
  194. data/src/core/ext/upb-generated/envoy/extensions/filters/http/rbac/v3/rbac.upb.c +7 -9
  195. data/src/core/ext/upb-generated/envoy/extensions/filters/http/rbac/v3/rbac.upb.h +24 -32
  196. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +12 -14
  197. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +52 -60
  198. data/src/core/ext/upb-generated/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb.c +4 -6
  199. data/src/core/ext/upb-generated/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb.h +14 -22
  200. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +114 -116
  201. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +468 -476
  202. data/src/core/ext/upb-generated/envoy/extensions/http/stateful_session/cookie/v3/cookie.upb.c +2 -4
  203. data/src/core/ext/upb-generated/envoy/extensions/http/stateful_session/cookie/v3/cookie.upb.h +5 -13
  204. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.c +7 -9
  205. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.h +25 -33
  206. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/common/v3/common.upb.c +11 -13
  207. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/common/v3/common.upb.h +40 -48
  208. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.c +2 -4
  209. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.h +4 -12
  210. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb.c +8 -10
  211. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb.h +27 -35
  212. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.upb.c +2 -4
  213. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.upb.h +5 -13
  214. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.c +1 -3
  215. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.h +1 -9
  216. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +35 -37
  217. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +165 -173
  218. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +9 -11
  219. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +32 -40
  220. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +39 -41
  221. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +169 -177
  222. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb.c +4 -6
  223. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb.h +16 -24
  224. data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.c +1 -3
  225. data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.h +1 -9
  226. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +55 -57
  227. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +241 -249
  228. data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.c +7 -9
  229. data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.h +31 -39
  230. data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.c +23 -25
  231. data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.h +98 -106
  232. data/src/core/ext/upb-generated/envoy/type/http/v3/cookie.upb.c +4 -6
  233. data/src/core/ext/upb-generated/envoy/type/http/v3/cookie.upb.h +11 -19
  234. data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.c +4 -6
  235. data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.h +18 -26
  236. data/src/core/ext/upb-generated/envoy/type/matcher/v3/filter_state.upb.c +3 -5
  237. data/src/core/ext/upb-generated/envoy/type/matcher/v3/filter_state.upb.h +9 -17
  238. data/src/core/ext/upb-generated/envoy/type/matcher/v3/http_inputs.upb.c +6 -8
  239. data/src/core/ext/upb-generated/envoy/type/matcher/v3/http_inputs.upb.h +16 -24
  240. data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.c +6 -8
  241. data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.h +24 -32
  242. data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.c +3 -5
  243. data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.h +13 -21
  244. data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.c +3 -5
  245. data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.h +10 -18
  246. data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.c +2 -4
  247. data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.h +6 -14
  248. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.c +6 -8
  249. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.h +20 -28
  250. data/src/core/ext/upb-generated/envoy/type/matcher/v3/status_code_input.upb.c +1 -3
  251. data/src/core/ext/upb-generated/envoy/type/matcher/v3/status_code_input.upb.h +1 -9
  252. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.c +8 -10
  253. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.h +33 -41
  254. data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.c +4 -6
  255. data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.h +18 -26
  256. data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.c +8 -10
  257. data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.h +31 -39
  258. data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.c +8 -10
  259. data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.h +34 -42
  260. data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.c +14 -16
  261. data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.h +47 -55
  262. data/src/core/ext/upb-generated/envoy/type/v3/hash_policy.upb.c +4 -6
  263. data/src/core/ext/upb-generated/envoy/type/v3/hash_policy.upb.h +13 -21
  264. data/src/core/ext/upb-generated/envoy/type/v3/http.upb.c +1 -3
  265. data/src/core/ext/upb-generated/envoy/type/v3/http.upb.h +1 -9
  266. data/src/core/ext/upb-generated/envoy/type/v3/http_status.upb.c +2 -4
  267. data/src/core/ext/upb-generated/envoy/type/v3/http_status.upb.h +4 -12
  268. data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.c +4 -6
  269. data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.h +10 -18
  270. data/src/core/ext/upb-generated/envoy/type/v3/range.upb.c +7 -9
  271. data/src/core/ext/upb-generated/envoy/type/v3/range.upb.h +19 -27
  272. data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_strategy.upb.c +6 -8
  273. data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_strategy.upb.h +20 -28
  274. data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_unit.upb.c +1 -3
  275. data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_unit.upb.h +1 -9
  276. data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.c +4 -6
  277. data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.h +10 -18
  278. data/src/core/ext/upb-generated/envoy/type/v3/token_bucket.upb.c +4 -6
  279. data/src/core/ext/upb-generated/envoy/type/v3/token_bucket.upb.h +12 -20
  280. data/src/core/ext/upb-generated/google/api/annotations.upb.c +2 -4
  281. data/src/core/ext/upb-generated/google/api/annotations.upb.h +1 -9
  282. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.c +45 -47
  283. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.h +190 -198
  284. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.c +54 -56
  285. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.h +210 -218
  286. data/src/core/ext/upb-generated/google/api/http.upb.c +15 -17
  287. data/src/core/ext/upb-generated/google/api/http.upb.h +60 -68
  288. data/src/core/ext/upb-generated/google/api/httpbody.upb.c +4 -6
  289. data/src/core/ext/upb-generated/google/api/httpbody.upb.h +15 -23
  290. data/src/core/ext/upb-generated/google/protobuf/any.upb.c +3 -5
  291. data/src/core/ext/upb-generated/google/protobuf/any.upb.h +7 -15
  292. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +359 -204
  293. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +1340 -760
  294. data/src/core/ext/upb-generated/google/protobuf/duration.upb.c +3 -5
  295. data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +7 -15
  296. data/src/core/ext/upb-generated/google/protobuf/empty.upb.c +1 -3
  297. data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +1 -9
  298. data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +11 -13
  299. data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +43 -51
  300. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.c +3 -5
  301. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +7 -15
  302. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.c +10 -12
  303. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +28 -36
  304. data/src/core/ext/upb-generated/google/rpc/status.upb.c +4 -6
  305. data/src/core/ext/upb-generated/google/rpc/status.upb.h +15 -23
  306. data/src/core/ext/upb-generated/opencensus/proto/trace/v1/trace_config.upb.c +11 -13
  307. data/src/core/ext/upb-generated/opencensus/proto/trace/v1/trace_config.upb.h +35 -43
  308. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +10 -12
  309. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +28 -36
  310. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +48 -50
  311. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +190 -198
  312. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c +5 -7
  313. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +15 -23
  314. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c +3 -5
  315. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +7 -15
  316. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c +21 -23
  317. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +80 -88
  318. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c +9 -11
  319. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.h +29 -37
  320. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls_config.upb.c +32 -34
  321. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls_config.upb.h +147 -155
  322. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.c +10 -12
  323. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +13 -21
  324. data/src/core/ext/upb-generated/udpa/annotations/security.upb.c +4 -6
  325. data/src/core/ext/upb-generated/udpa/annotations/security.upb.h +7 -15
  326. data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.c +2 -4
  327. data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +1 -9
  328. data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +4 -6
  329. data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +7 -15
  330. data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.c +3 -5
  331. data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.h +4 -12
  332. data/src/core/ext/upb-generated/validate/validate.upb.c +201 -203
  333. data/src/core/ext/upb-generated/validate/validate.upb.h +924 -932
  334. data/src/core/ext/upb-generated/xds/annotations/v3/migrate.upb.c +10 -12
  335. data/src/core/ext/upb-generated/xds/annotations/v3/migrate.upb.h +13 -21
  336. data/src/core/ext/upb-generated/xds/annotations/v3/security.upb.c +4 -6
  337. data/src/core/ext/upb-generated/xds/annotations/v3/security.upb.h +7 -15
  338. data/src/core/ext/upb-generated/xds/annotations/v3/sensitive.upb.c +2 -4
  339. data/src/core/ext/upb-generated/xds/annotations/v3/sensitive.upb.h +1 -9
  340. data/src/core/ext/upb-generated/xds/annotations/v3/status.upb.c +9 -11
  341. data/src/core/ext/upb-generated/xds/annotations/v3/status.upb.h +16 -24
  342. data/src/core/ext/upb-generated/xds/annotations/v3/versioning.upb.c +3 -5
  343. data/src/core/ext/upb-generated/xds/annotations/v3/versioning.upb.h +4 -12
  344. data/src/core/ext/upb-generated/xds/core/v3/authority.upb.c +2 -4
  345. data/src/core/ext/upb-generated/xds/core/v3/authority.upb.h +4 -12
  346. data/src/core/ext/upb-generated/xds/core/v3/cidr.upb.c +3 -5
  347. data/src/core/ext/upb-generated/xds/core/v3/cidr.upb.h +8 -16
  348. data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.c +6 -8
  349. data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.h +20 -28
  350. data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.c +4 -6
  351. data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.h +9 -17
  352. data/src/core/ext/upb-generated/xds/core/v3/extension.upb.c +3 -5
  353. data/src/core/ext/upb-generated/xds/core/v3/extension.upb.h +8 -16
  354. data/src/core/ext/upb-generated/xds/core/v3/resource.upb.c +4 -6
  355. data/src/core/ext/upb-generated/xds/core/v3/resource.upb.h +12 -20
  356. data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.c +9 -11
  357. data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.h +35 -43
  358. data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.c +5 -7
  359. data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.h +14 -22
  360. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.c +16 -18
  361. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.h +43 -51
  362. data/src/core/ext/upb-generated/xds/service/orca/v3/orca.upb.c +3 -5
  363. data/src/core/ext/upb-generated/xds/service/orca/v3/orca.upb.h +13 -21
  364. data/src/core/ext/upb-generated/xds/type/matcher/v3/cel.upb.c +2 -4
  365. data/src/core/ext/upb-generated/xds/type/matcher/v3/cel.upb.h +5 -13
  366. data/src/core/ext/upb-generated/xds/type/matcher/v3/domain.upb.c +4 -6
  367. data/src/core/ext/upb-generated/xds/type/matcher/v3/domain.upb.h +21 -29
  368. data/src/core/ext/upb-generated/xds/type/matcher/v3/http_inputs.upb.c +1 -3
  369. data/src/core/ext/upb-generated/xds/type/matcher/v3/http_inputs.upb.h +1 -9
  370. data/src/core/ext/upb-generated/xds/type/matcher/v3/ip.upb.c +5 -7
  371. data/src/core/ext/upb-generated/xds/type/matcher/v3/ip.upb.h +24 -32
  372. data/src/core/ext/upb-generated/xds/type/matcher/v3/matcher.upb.c +24 -26
  373. data/src/core/ext/upb-generated/xds/type/matcher/v3/matcher.upb.h +103 -111
  374. data/src/core/ext/upb-generated/xds/type/matcher/v3/range.upb.c +10 -12
  375. data/src/core/ext/upb-generated/xds/type/matcher/v3/range.upb.h +61 -69
  376. data/src/core/ext/upb-generated/xds/type/matcher/v3/regex.upb.c +3 -5
  377. data/src/core/ext/upb-generated/xds/type/matcher/v3/regex.upb.h +9 -17
  378. data/src/core/ext/upb-generated/xds/type/matcher/v3/string.upb.c +8 -10
  379. data/src/core/ext/upb-generated/xds/type/matcher/v3/string.upb.h +33 -41
  380. data/src/core/ext/upb-generated/xds/type/v3/cel.upb.c +5 -7
  381. data/src/core/ext/upb-generated/xds/type/v3/cel.upb.h +18 -26
  382. data/src/core/ext/upb-generated/xds/type/v3/range.upb.c +7 -9
  383. data/src/core/ext/upb-generated/xds/type/v3/range.upb.h +19 -27
  384. data/src/core/ext/upb-generated/xds/type/v3/typed_struct.upb.c +3 -5
  385. data/src/core/ext/upb-generated/xds/type/v3/typed_struct.upb.h +8 -16
  386. data/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.c +367 -290
  387. data/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.h +10 -0
  388. data/src/core/ext/xds/xds_client.cc +6 -9
  389. data/src/core/ext/xds/xds_client.h +2 -2
  390. data/src/core/ext/xds/xds_cluster.cc +30 -42
  391. data/src/core/ext/xds/xds_cluster.h +0 -4
  392. data/src/core/ext/xds/xds_endpoint.cc +12 -19
  393. data/src/core/ext/xds/xds_endpoint.h +0 -1
  394. data/src/core/ext/xds/xds_http_filters.cc +1 -4
  395. data/src/core/ext/xds/xds_listener.cc +14 -14
  396. data/src/core/ext/xds/xds_listener.h +13 -3
  397. data/src/core/ext/xds/xds_resource_type.h +1 -7
  398. data/src/core/ext/xds/xds_resource_type_impl.h +9 -11
  399. data/src/core/ext/xds/xds_route_config.cc +10 -11
  400. data/src/core/ext/xds/xds_route_config.h +1 -1
  401. data/src/core/ext/xds/xds_server_config_fetcher.cc +53 -28
  402. data/src/core/ext/xds/xds_transport_grpc.cc +11 -1
  403. data/src/core/lib/backoff/random_early_detection.cc +4 -2
  404. data/src/core/lib/backoff/random_early_detection.h +2 -4
  405. data/src/core/lib/channel/call_tracer.cc +7 -1
  406. data/src/core/lib/channel/call_tracer.h +4 -1
  407. data/src/core/lib/channel/channelz_registry.h +4 -2
  408. data/src/core/lib/channel/connected_channel.cc +1 -1
  409. data/src/core/lib/config/config_vars.h +1 -1
  410. data/src/core/lib/config/core_configuration.cc +2 -1
  411. data/src/core/lib/config/core_configuration.h +5 -4
  412. data/src/core/lib/debug/stats_data.cc +146 -51
  413. data/src/core/lib/debug/stats_data.h +81 -20
  414. data/src/core/lib/event_engine/cf_engine/cf_engine.cc +3 -0
  415. data/src/core/lib/event_engine/cf_engine/cf_engine.h +3 -0
  416. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +3 -0
  417. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.h +3 -0
  418. data/src/core/lib/event_engine/cf_engine/cftype_unique_ref.h +3 -0
  419. data/src/core/lib/event_engine/cf_engine/dns_service_resolver.cc +15 -3
  420. data/src/core/lib/event_engine/cf_engine/dns_service_resolver.h +3 -0
  421. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +1 -1
  422. data/src/core/lib/event_engine/thread_pool/thread_count.h +15 -0
  423. data/src/core/lib/event_engine/thread_pool/thread_pool_factory.cc +3 -15
  424. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +10 -4
  425. data/src/core/lib/experiments/config.cc +9 -1
  426. data/src/core/lib/experiments/experiments.cc +144 -60
  427. data/src/core/lib/experiments/experiments.h +146 -41
  428. data/src/core/lib/gprpp/fork.h +1 -1
  429. data/src/core/lib/gprpp/manual_constructor.h +1 -2
  430. data/src/core/lib/gprpp/no_destruct.h +1 -1
  431. data/src/core/lib/gprpp/per_cpu.cc +2 -0
  432. data/src/core/lib/gprpp/per_cpu.h +36 -7
  433. data/src/core/lib/gprpp/ref_counted_ptr.h +63 -0
  434. data/src/core/lib/gprpp/work_serializer.cc +297 -25
  435. data/src/core/lib/gprpp/work_serializer.h +25 -9
  436. data/src/core/lib/iomgr/combiner.cc +54 -15
  437. data/src/core/lib/iomgr/combiner.h +8 -3
  438. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +2 -4
  439. data/src/core/lib/iomgr/exec_ctx.cc +12 -0
  440. data/src/core/lib/iomgr/exec_ctx.h +55 -19
  441. data/src/core/lib/iomgr/polling_entity.cc +10 -0
  442. data/src/core/lib/iomgr/polling_entity.h +2 -0
  443. data/src/core/lib/iomgr/port.h +14 -0
  444. data/src/core/lib/iomgr/tcp_posix.cc +17 -14
  445. data/src/core/lib/load_balancing/lb_policy.h +10 -9
  446. data/src/core/lib/promise/arena_promise.h +5 -1
  447. data/src/core/lib/promise/detail/seq_state.h +418 -0
  448. data/src/core/lib/promise/latch.h +1 -0
  449. data/src/core/lib/promise/loop.h +8 -5
  450. data/src/core/lib/promise/pipe.h +24 -24
  451. data/src/core/lib/promise/poll.h +4 -6
  452. data/src/core/lib/resolver/server_address.h +1 -0
  453. data/src/core/lib/resource_quota/memory_quota.cc +58 -2
  454. data/src/core/lib/resource_quota/memory_quota.h +4 -1
  455. data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +115 -9
  456. data/src/core/lib/security/credentials/ssl/ssl_credentials.h +14 -0
  457. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_match.cc +86 -0
  458. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +0 -59
  459. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.h +2 -0
  460. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +7 -57
  461. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +1 -1
  462. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +2 -14
  463. data/src/core/lib/slice/slice.h +6 -0
  464. data/src/core/lib/slice/slice_buffer.cc +15 -0
  465. data/src/core/lib/slice/slice_buffer.h +16 -4
  466. data/src/core/lib/slice/slice_refcount.h +1 -1
  467. data/src/core/lib/surface/call.cc +92 -34
  468. data/src/core/lib/surface/call.h +4 -0
  469. data/src/core/lib/surface/channel.cc +7 -4
  470. data/src/core/lib/surface/channel_init.h +3 -2
  471. data/src/core/lib/surface/server.cc +45 -5
  472. data/src/core/lib/surface/server.h +18 -6
  473. data/src/core/lib/surface/version.cc +2 -2
  474. data/src/core/lib/transport/batch_builder.cc +3 -5
  475. data/src/core/lib/transport/metadata_batch.cc +6 -0
  476. data/src/core/lib/transport/metadata_batch.h +20 -1
  477. data/src/core/lib/transport/parsed_metadata.h +2 -4
  478. data/src/core/lib/transport/simple_slice_based_metadata.h +1 -2
  479. data/src/core/lib/transport/transport.h +21 -11
  480. data/src/core/tsi/ssl_transport_security.cc +7 -0
  481. data/src/core/tsi/ssl_transport_security.h +4 -0
  482. data/src/ruby/ext/grpc/extconf.rb +1 -1
  483. data/src/ruby/ext/grpc/rb_channel_args.c +6 -4
  484. data/src/ruby/lib/grpc/version.rb +1 -1
  485. data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +4 -1
  486. data/third_party/abseil-cpp/absl/random/bit_gen_ref.h +185 -0
  487. data/third_party/upb/upb/collections/array.c +6 -0
  488. data/third_party/upb/upb/collections/array.h +6 -0
  489. data/third_party/upb/upb/collections/map.c +7 -0
  490. data/third_party/upb/upb/collections/map.h +5 -0
  491. data/third_party/upb/upb/collections/map_sorter_internal.h +1 -1
  492. data/third_party/upb/upb/collections/message_value.h +8 -1
  493. data/third_party/upb/upb/generated_code_support.h +54 -0
  494. data/third_party/upb/upb/hash/common.c +5 -0
  495. data/third_party/upb/upb/hash/common.h +1 -0
  496. data/third_party/upb/upb/hash/str_table.h +1 -0
  497. data/third_party/upb/upb/message/accessors.c +25 -1
  498. data/third_party/upb/upb/message/accessors.h +46 -25
  499. data/third_party/upb/upb/message/accessors_internal.h +69 -3
  500. data/third_party/upb/upb/message/extension_internal.h +1 -1
  501. data/third_party/upb/upb/message/internal/map_entry.h +64 -0
  502. data/third_party/upb/upb/message/internal.h +2 -6
  503. data/third_party/upb/upb/message/message.c +0 -6
  504. data/third_party/upb/upb/message/message.h +1 -1
  505. data/third_party/upb/upb/message/tagged_ptr.h +89 -0
  506. data/third_party/upb/upb/mini_descriptor/build_enum.c +150 -0
  507. data/third_party/upb/upb/mini_descriptor/build_enum.h +63 -0
  508. data/third_party/upb/upb/{mini_table → mini_descriptor}/decode.c +122 -374
  509. data/third_party/upb/upb/{mini_table → mini_descriptor}/decode.h +11 -50
  510. data/third_party/upb/upb/mini_descriptor/internal/base92.c +46 -0
  511. data/third_party/upb/upb/mini_descriptor/internal/base92.h +81 -0
  512. data/third_party/upb/upb/mini_descriptor/internal/decoder.h +73 -0
  513. data/third_party/upb/upb/{mini_table → mini_descriptor/internal}/encode.c +58 -32
  514. data/third_party/upb/upb/{mini_table/encode_internal.h → mini_descriptor/internal/encode.h} +3 -4
  515. data/third_party/upb/upb/{mini_table/encode_internal.hpp → mini_descriptor/internal/encode.hpp} +1 -1
  516. data/third_party/upb/upb/mini_descriptor/internal/modifiers.h +50 -0
  517. data/third_party/upb/upb/{mini_table/common_internal.h → mini_descriptor/internal/wire_constants.h} +3 -23
  518. data/third_party/upb/upb/mini_descriptor/link.c +142 -0
  519. data/third_party/upb/upb/mini_descriptor/link.h +104 -0
  520. data/third_party/upb/upb/mini_table/{types.h → enum.h} +19 -9
  521. data/third_party/upb/upb/mini_table/extension.h +40 -0
  522. data/third_party/upb/upb/mini_table/extension_registry.c +1 -1
  523. data/third_party/upb/upb/mini_table/extension_registry.h +2 -1
  524. data/third_party/upb/upb/mini_table/field.h +118 -0
  525. data/third_party/upb/upb/{json_decode.h → mini_table/file.h} +5 -6
  526. data/third_party/upb/upb/mini_table/{enum_internal.h → internal/enum.h} +7 -19
  527. data/third_party/upb/upb/mini_table/{extension_internal.h → internal/extension.h} +8 -8
  528. data/third_party/upb/upb/mini_table/{field_internal.h → internal/field.h} +10 -66
  529. data/third_party/upb/upb/mini_table/{file_internal.h → internal/file.h} +6 -4
  530. data/third_party/upb/upb/mini_table/internal/message.c +39 -0
  531. data/third_party/upb/upb/mini_table/{message_internal.h → internal/message.h} +14 -37
  532. data/third_party/upb/upb/mini_table/{sub_internal.h → internal/sub.h} +7 -6
  533. data/third_party/upb/upb/mini_table/{common.c → message.c} +2 -33
  534. data/third_party/upb/upb/mini_table/{common.h → message.h} +12 -77
  535. data/third_party/upb/upb/{json_encode.h → mini_table/sub.h} +5 -6
  536. data/third_party/upb/upb/reflection/def.hpp +16 -4
  537. data/third_party/upb/upb/reflection/def_pool_internal.h +1 -1
  538. data/third_party/upb/upb/reflection/desc_state_internal.h +1 -1
  539. data/third_party/upb/upb/reflection/enum_def.c +1 -1
  540. data/third_party/upb/upb/reflection/field_def.c +2 -1
  541. data/third_party/upb/upb/reflection/message.c +2 -2
  542. data/third_party/upb/upb/reflection/message_def.c +3 -1
  543. data/third_party/upb/upb/wire/decode.c +68 -29
  544. data/third_party/upb/upb/wire/decode.h +40 -0
  545. data/third_party/upb/upb/wire/encode.c +23 -13
  546. metadata +43 -27
  547. data/src/core/lib/event_engine/thread_pool/original_thread_pool.cc +0 -256
  548. data/src/core/lib/event_engine/thread_pool/original_thread_pool.h +0 -137
@@ -25,18 +25,17 @@
25
25
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
26
  */
27
27
 
28
- #include "upb/mini_table/decode.h"
28
+ #include "upb/mini_descriptor/decode.h"
29
29
 
30
30
  #include <inttypes.h>
31
31
  #include <stdlib.h>
32
32
 
33
- #include "upb/base/log2.h"
34
33
  #include "upb/base/string_view.h"
35
34
  #include "upb/mem/arena.h"
36
- #include "upb/mini_table/common.h"
37
- #include "upb/mini_table/common_internal.h"
38
- #include "upb/mini_table/enum_internal.h"
39
- #include "upb/mini_table/extension_internal.h"
35
+ #include "upb/mini_descriptor/internal/base92.h"
36
+ #include "upb/mini_descriptor/internal/decoder.h"
37
+ #include "upb/mini_descriptor/internal/modifiers.h"
38
+ #include "upb/mini_descriptor/internal/wire_constants.h"
40
39
 
41
40
  // Must be last.
42
41
  #include "upb/port/def.inc"
@@ -68,40 +67,14 @@ typedef struct {
68
67
  } upb_LayoutItemVector;
69
68
 
70
69
  typedef struct {
71
- const char* end;
70
+ upb_MdDecoder base;
72
71
  upb_MiniTable* table;
73
72
  upb_MiniTableField* fields;
74
73
  upb_MiniTablePlatform platform;
75
74
  upb_LayoutItemVector vec;
76
75
  upb_Arena* arena;
77
- upb_Status* status;
78
-
79
- // When building enums.
80
- upb_MiniTableEnum* enum_table;
81
- uint32_t enum_value_count;
82
- uint32_t enum_data_count;
83
- uint32_t enum_data_capacity;
84
-
85
- jmp_buf err;
86
76
  } upb_MtDecoder;
87
77
 
88
- UPB_PRINTF(2, 3)
89
- UPB_NORETURN static void upb_MtDecoder_ErrorFormat(upb_MtDecoder* d,
90
- const char* fmt, ...) {
91
- if (d->status) {
92
- va_list argp;
93
- upb_Status_SetErrorMessage(d->status, "Error building mini table: ");
94
- va_start(argp, fmt);
95
- upb_Status_VAppendErrorFormat(d->status, fmt, argp);
96
- va_end(argp);
97
- }
98
- UPB_LONGJMP(d->err, 1);
99
- }
100
-
101
- static void upb_MtDecoder_CheckOutOfMemory(upb_MtDecoder* d, const void* ptr) {
102
- if (!ptr) upb_MtDecoder_ErrorFormat(d, "Out of memory");
103
- }
104
-
105
78
  // In each field's offset, we temporarily store a presence classifier:
106
79
  enum PresenceClass {
107
80
  kNoPresence = 0,
@@ -113,74 +86,47 @@ enum PresenceClass {
113
86
  // the next field in this oneof's linked list.
114
87
  };
115
88
 
116
- static const char* upb_MiniTable_DecodeBase92Varint(upb_MtDecoder* d,
117
- const char* ptr,
118
- char first_ch, uint8_t min,
119
- uint8_t max,
120
- uint32_t* out_val) {
121
- uint32_t val = 0;
122
- uint32_t shift = 0;
123
- const int bits_per_char =
124
- upb_Log2Ceiling(_upb_FromBase92(max) - _upb_FromBase92(min));
125
- char ch = first_ch;
126
- while (1) {
127
- uint32_t bits = _upb_FromBase92(ch) - _upb_FromBase92(min);
128
- val |= bits << shift;
129
- if (ptr == d->end || *ptr < min || max < *ptr) {
130
- *out_val = val;
131
- return ptr;
132
- }
133
- ch = *ptr++;
134
- shift += bits_per_char;
135
- if (shift >= 32) upb_MtDecoder_ErrorFormat(d, "Overlong varint");
136
- }
137
- }
138
-
139
- static bool upb_MiniTable_HasSub(upb_MiniTableField* field,
140
- uint64_t msg_modifiers) {
141
- switch (field->UPB_PRIVATE(descriptortype)) {
142
- case kUpb_FieldType_Message:
143
- case kUpb_FieldType_Group:
144
- case kUpb_FieldType_Enum:
145
- return true;
146
- case kUpb_FieldType_String:
147
- if (!(msg_modifiers & kUpb_MessageModifier_ValidateUtf8)) {
148
- field->UPB_PRIVATE(descriptortype) = kUpb_FieldType_Bytes;
149
- field->mode |= kUpb_LabelFlags_IsAlternate;
150
- }
151
- return false;
152
- default:
153
- return false;
154
- }
155
- }
156
-
157
89
  static bool upb_MtDecoder_FieldIsPackable(upb_MiniTableField* field) {
158
90
  return (field->mode & kUpb_FieldMode_Array) &&
159
91
  upb_FieldType_IsPackable(field->UPB_PRIVATE(descriptortype));
160
92
  }
161
93
 
94
+ typedef struct {
95
+ uint16_t submsg_count;
96
+ uint16_t subenum_count;
97
+ } upb_SubCounts;
98
+
162
99
  static void upb_MiniTable_SetTypeAndSub(upb_MiniTableField* field,
163
- upb_FieldType type, uint32_t* sub_count,
100
+ upb_FieldType type,
101
+ upb_SubCounts* sub_counts,
164
102
  uint64_t msg_modifiers,
165
103
  bool is_proto3_enum) {
166
- field->UPB_PRIVATE(descriptortype) = type;
167
-
168
104
  if (is_proto3_enum) {
169
- UPB_ASSERT(field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Enum);
170
- field->UPB_PRIVATE(descriptortype) = kUpb_FieldType_Int32;
105
+ UPB_ASSERT(type == kUpb_FieldType_Enum);
106
+ type = kUpb_FieldType_Int32;
107
+ field->mode |= kUpb_LabelFlags_IsAlternate;
108
+ } else if (type == kUpb_FieldType_String &&
109
+ !(msg_modifiers & kUpb_MessageModifier_ValidateUtf8)) {
110
+ type = kUpb_FieldType_Bytes;
171
111
  field->mode |= kUpb_LabelFlags_IsAlternate;
172
112
  }
173
113
 
174
- if (upb_MiniTable_HasSub(field, msg_modifiers)) {
175
- field->UPB_PRIVATE(submsg_index) = sub_count ? (*sub_count)++ : 0;
176
- } else {
177
- field->UPB_PRIVATE(submsg_index) = kUpb_NoSub;
178
- }
114
+ field->UPB_PRIVATE(descriptortype) = type;
179
115
 
180
116
  if (upb_MtDecoder_FieldIsPackable(field) &&
181
117
  (msg_modifiers & kUpb_MessageModifier_DefaultIsPacked)) {
182
118
  field->mode |= kUpb_LabelFlags_IsPacked;
183
119
  }
120
+
121
+ if (type == kUpb_FieldType_Message || type == kUpb_FieldType_Group) {
122
+ field->UPB_PRIVATE(submsg_index) = sub_counts->submsg_count++;
123
+ } else if (type == kUpb_FieldType_Enum) {
124
+ // We will need to update this later once we know the total number of
125
+ // submsg fields.
126
+ field->UPB_PRIVATE(submsg_index) = sub_counts->subenum_count++;
127
+ } else {
128
+ field->UPB_PRIVATE(submsg_index) = kUpb_NoSub;
129
+ }
184
130
  }
185
131
 
186
132
  static const char kUpb_EncodedToType[] = {
@@ -208,7 +154,7 @@ static const char kUpb_EncodedToType[] = {
208
154
  static void upb_MiniTable_SetField(upb_MtDecoder* d, uint8_t ch,
209
155
  upb_MiniTableField* field,
210
156
  uint64_t msg_modifiers,
211
- uint32_t* sub_count) {
157
+ upb_SubCounts* sub_counts) {
212
158
  static const char kUpb_EncodedToFieldRep[] = {
213
159
  [kUpb_EncodedType_Double] = kUpb_FieldRep_8Byte,
214
160
  [kUpb_EncodedType_Float] = kUpb_FieldRep_4Byte,
@@ -245,17 +191,15 @@ static void upb_MiniTable_SetField(upb_MtDecoder* d, uint8_t ch,
245
191
  if (type == kUpb_EncodedType_Group || type == kUpb_EncodedType_Message) {
246
192
  field->mode |= pointer_rep << kUpb_FieldRep_Shift;
247
193
  } else if ((unsigned long)type >= sizeof(kUpb_EncodedToFieldRep)) {
248
- upb_MtDecoder_ErrorFormat(d, "Invalid field type: %d", (int)type);
249
- UPB_UNREACHABLE();
194
+ upb_MdDecoder_ErrorJmp(&d->base, "Invalid field type: %d", (int)type);
250
195
  } else {
251
196
  field->mode |= kUpb_EncodedToFieldRep[type] << kUpb_FieldRep_Shift;
252
197
  }
253
198
  }
254
199
  if ((unsigned long)type >= sizeof(kUpb_EncodedToType)) {
255
- upb_MtDecoder_ErrorFormat(d, "Invalid field type: %d", (int)type);
256
- UPB_UNREACHABLE();
200
+ upb_MdDecoder_ErrorJmp(&d->base, "Invalid field type: %d", (int)type);
257
201
  }
258
- upb_MiniTable_SetTypeAndSub(field, kUpb_EncodedToType[type], sub_count,
202
+ upb_MiniTable_SetTypeAndSub(field, kUpb_EncodedToType[type], sub_counts,
259
203
  msg_modifiers, type == kUpb_EncodedType_OpenEnum);
260
204
  }
261
205
 
@@ -265,9 +209,9 @@ static void upb_MtDecoder_ModifyField(upb_MtDecoder* d,
265
209
  upb_MiniTableField* field) {
266
210
  if (field_modifiers & kUpb_EncodedFieldModifier_FlipPacked) {
267
211
  if (!upb_MtDecoder_FieldIsPackable(field)) {
268
- upb_MtDecoder_ErrorFormat(
269
- d, "Cannot flip packed on unpackable field %" PRIu32, field->number);
270
- UPB_UNREACHABLE();
212
+ upb_MdDecoder_ErrorJmp(&d->base,
213
+ "Cannot flip packed on unpackable field %" PRIu32,
214
+ field->number);
271
215
  }
272
216
  field->mode ^= kUpb_LabelFlags_IsPacked;
273
217
  }
@@ -277,15 +221,14 @@ static void upb_MtDecoder_ModifyField(upb_MtDecoder* d,
277
221
 
278
222
  // Validate.
279
223
  if ((singular || required) && field->offset != kHasbitPresence) {
280
- upb_MtDecoder_ErrorFormat(
281
- d, "Invalid modifier(s) for repeated field %" PRIu32, field->number);
282
- UPB_UNREACHABLE();
224
+ upb_MdDecoder_ErrorJmp(&d->base,
225
+ "Invalid modifier(s) for repeated field %" PRIu32,
226
+ field->number);
283
227
  }
284
228
  if (singular && required) {
285
- upb_MtDecoder_ErrorFormat(
286
- d, "Field %" PRIu32 " cannot be both singular and required",
229
+ upb_MdDecoder_ErrorJmp(
230
+ &d->base, "Field %" PRIu32 " cannot be both singular and required",
287
231
  field->number);
288
- UPB_UNREACHABLE();
289
232
  }
290
233
 
291
234
  if (singular) field->offset = kNoPresence;
@@ -298,7 +241,7 @@ static void upb_MtDecoder_PushItem(upb_MtDecoder* d, upb_LayoutItem item) {
298
241
  if (d->vec.size == d->vec.capacity) {
299
242
  size_t new_cap = UPB_MAX(8, d->vec.size * 2);
300
243
  d->vec.data = realloc(d->vec.data, new_cap * sizeof(*d->vec.data));
301
- upb_MtDecoder_CheckOutOfMemory(d, d->vec.data);
244
+ upb_MdDecoder_CheckOutOfMemory(&d->base, d->vec.data);
302
245
  d->vec.capacity = new_cap;
303
246
  }
304
247
  d->vec.data[d->vec.size++] = item;
@@ -306,8 +249,7 @@ static void upb_MtDecoder_PushItem(upb_MtDecoder* d, upb_LayoutItem item) {
306
249
 
307
250
  static void upb_MtDecoder_PushOneof(upb_MtDecoder* d, upb_LayoutItem item) {
308
251
  if (item.field_index == kUpb_LayoutItem_IndexSentinel) {
309
- upb_MtDecoder_ErrorFormat(d, "Empty oneof");
310
- UPB_UNREACHABLE();
252
+ upb_MdDecoder_ErrorJmp(&d->base, "Empty oneof");
311
253
  }
312
254
  item.field_index -= kOneofBase;
313
255
 
@@ -366,26 +308,24 @@ static const char* upb_MtDecoder_DecodeOneofField(upb_MtDecoder* d,
366
308
  char first_ch,
367
309
  upb_LayoutItem* item) {
368
310
  uint32_t field_num;
369
- ptr = upb_MiniTable_DecodeBase92Varint(
370
- d, ptr, first_ch, kUpb_EncodedValue_MinOneofField,
311
+ ptr = upb_MdDecoder_DecodeBase92Varint(
312
+ &d->base, ptr, first_ch, kUpb_EncodedValue_MinOneofField,
371
313
  kUpb_EncodedValue_MaxOneofField, &field_num);
372
314
  upb_MiniTableField* f =
373
315
  (void*)upb_MiniTable_FindFieldByNumber(d->table, field_num);
374
316
 
375
317
  if (!f) {
376
- upb_MtDecoder_ErrorFormat(d,
377
- "Couldn't add field number %" PRIu32
378
- " to oneof, no such field number.",
379
- field_num);
380
- UPB_UNREACHABLE();
318
+ upb_MdDecoder_ErrorJmp(&d->base,
319
+ "Couldn't add field number %" PRIu32
320
+ " to oneof, no such field number.",
321
+ field_num);
381
322
  }
382
323
  if (f->offset != kHasbitPresence) {
383
- upb_MtDecoder_ErrorFormat(
384
- d,
324
+ upb_MdDecoder_ErrorJmp(
325
+ &d->base,
385
326
  "Cannot add repeated, required, or singular field %" PRIu32
386
327
  " to oneof.",
387
328
  field_num);
388
- UPB_UNREACHABLE();
389
329
  }
390
330
 
391
331
  // Oneof storage must be large enough to accommodate the largest member.
@@ -404,7 +344,7 @@ static const char* upb_MtDecoder_DecodeOneofs(upb_MtDecoder* d,
404
344
  const char* ptr) {
405
345
  upb_LayoutItem item = {.rep = 0,
406
346
  .field_index = kUpb_LayoutItem_IndexSentinel};
407
- while (ptr < d->end) {
347
+ while (ptr < d->base.end) {
408
348
  char ch = *ptr++;
409
349
  if (ch == kUpb_EncodedValue_FieldSeparator) {
410
350
  // Field separator, no action needed.
@@ -427,15 +367,15 @@ static const char* upb_MtDecoder_ParseModifier(upb_MtDecoder* d,
427
367
  upb_MiniTableField* last_field,
428
368
  uint64_t* msg_modifiers) {
429
369
  uint32_t mod;
430
- ptr = upb_MiniTable_DecodeBase92Varint(d, ptr, first_ch,
370
+ ptr = upb_MdDecoder_DecodeBase92Varint(&d->base, ptr, first_ch,
431
371
  kUpb_EncodedValue_MinModifier,
432
372
  kUpb_EncodedValue_MaxModifier, &mod);
433
373
  if (last_field) {
434
374
  upb_MtDecoder_ModifyField(d, *msg_modifiers, mod, last_field);
435
375
  } else {
436
376
  if (!d->table) {
437
- upb_MtDecoder_ErrorFormat(d, "Extensions cannot have message modifiers");
438
- UPB_UNREACHABLE();
377
+ upb_MdDecoder_ErrorJmp(&d->base,
378
+ "Extensions cannot have message modifiers");
439
379
  }
440
380
  *msg_modifiers = mod;
441
381
  }
@@ -443,26 +383,43 @@ static const char* upb_MtDecoder_ParseModifier(upb_MtDecoder* d,
443
383
  return ptr;
444
384
  }
445
385
 
446
- static void upb_MtDecoder_AllocateSubs(upb_MtDecoder* d, uint32_t sub_count) {
447
- size_t subs_bytes = sizeof(*d->table->subs) * sub_count;
448
- void* subs = upb_Arena_Malloc(d->arena, subs_bytes);
449
- memset(subs, 0, subs_bytes);
386
+ static void upb_MtDecoder_AllocateSubs(upb_MtDecoder* d,
387
+ upb_SubCounts sub_counts) {
388
+ uint32_t total_count = sub_counts.submsg_count + sub_counts.subenum_count;
389
+ size_t subs_bytes = sizeof(*d->table->subs) * total_count;
390
+ upb_MiniTableSub* subs = upb_Arena_Malloc(d->arena, subs_bytes);
391
+ upb_MdDecoder_CheckOutOfMemory(&d->base, subs);
392
+ uint32_t i = 0;
393
+ for (; i < sub_counts.submsg_count; i++) {
394
+ subs[i].submsg = &_kUpb_MiniTable_Empty;
395
+ }
396
+ if (sub_counts.subenum_count) {
397
+ upb_MiniTableField* f = d->fields;
398
+ upb_MiniTableField* end_f = f + d->table->field_count;
399
+ for (; f < end_f; f++) {
400
+ if (f->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Enum) {
401
+ f->UPB_PRIVATE(submsg_index) += sub_counts.submsg_count;
402
+ }
403
+ }
404
+ for (; i < sub_counts.submsg_count + sub_counts.subenum_count; i++) {
405
+ subs[i].subenum = NULL;
406
+ }
407
+ }
450
408
  d->table->subs = subs;
451
- upb_MtDecoder_CheckOutOfMemory(d, d->table->subs);
452
409
  }
453
410
 
454
411
  static const char* upb_MtDecoder_Parse(upb_MtDecoder* d, const char* ptr,
455
412
  size_t len, void* fields,
456
413
  size_t field_size, uint16_t* field_count,
457
- uint32_t* sub_count) {
414
+ upb_SubCounts* sub_counts) {
458
415
  uint64_t msg_modifiers = 0;
459
416
  uint32_t last_field_number = 0;
460
417
  upb_MiniTableField* last_field = NULL;
461
418
  bool need_dense_below = d->table != NULL;
462
419
 
463
- d->end = UPB_PTRADD(ptr, len);
420
+ d->base.end = UPB_PTRADD(ptr, len);
464
421
 
465
- while (ptr < d->end) {
422
+ while (ptr < d->base.end) {
466
423
  char ch = *ptr++;
467
424
  if (ch <= kUpb_EncodedValue_MaxField) {
468
425
  if (!d->table && last_field) {
@@ -474,7 +431,7 @@ static const char* upb_MtDecoder_Parse(upb_MtDecoder* d, const char* ptr,
474
431
  fields = (char*)fields + field_size;
475
432
  field->number = ++last_field_number;
476
433
  last_field = field;
477
- upb_MiniTable_SetField(d, ch, field, msg_modifiers, sub_count);
434
+ upb_MiniTable_SetField(d, ch, field, msg_modifiers, sub_counts);
478
435
  } else if (kUpb_EncodedValue_MinModifier <= ch &&
479
436
  ch <= kUpb_EncodedValue_MaxModifier) {
480
437
  ptr = upb_MtDecoder_ParseModifier(d, ptr, ch, last_field, &msg_modifiers);
@@ -483,8 +440,7 @@ static const char* upb_MtDecoder_Parse(upb_MtDecoder* d, const char* ptr,
483
440
  }
484
441
  } else if (ch == kUpb_EncodedValue_End) {
485
442
  if (!d->table) {
486
- upb_MtDecoder_ErrorFormat(d, "Extensions cannot have oneofs.");
487
- UPB_UNREACHABLE();
443
+ upb_MdDecoder_ErrorJmp(&d->base, "Extensions cannot have oneofs.");
488
444
  }
489
445
  ptr = upb_MtDecoder_DecodeOneofs(d, ptr);
490
446
  } else if (kUpb_EncodedValue_MinSkip <= ch &&
@@ -494,14 +450,13 @@ static const char* upb_MtDecoder_Parse(upb_MtDecoder* d, const char* ptr,
494
450
  need_dense_below = false;
495
451
  }
496
452
  uint32_t skip;
497
- ptr = upb_MiniTable_DecodeBase92Varint(d, ptr, ch,
453
+ ptr = upb_MdDecoder_DecodeBase92Varint(&d->base, ptr, ch,
498
454
  kUpb_EncodedValue_MinSkip,
499
455
  kUpb_EncodedValue_MaxSkip, &skip);
500
456
  last_field_number += skip;
501
457
  last_field_number--; // Next field seen will increment.
502
458
  } else {
503
- upb_MtDecoder_ErrorFormat(d, "Invalid char: %c", ch);
504
- UPB_UNREACHABLE();
459
+ upb_MdDecoder_ErrorJmp(&d->base, "Invalid char: %c", ch);
505
460
  }
506
461
  }
507
462
 
@@ -517,18 +472,18 @@ static void upb_MtDecoder_ParseMessage(upb_MtDecoder* d, const char* data,
517
472
  // Buffer length is an upper bound on the number of fields. We will return
518
473
  // what we don't use.
519
474
  d->fields = upb_Arena_Malloc(d->arena, sizeof(*d->fields) * len);
520
- upb_MtDecoder_CheckOutOfMemory(d, d->fields);
475
+ upb_MdDecoder_CheckOutOfMemory(&d->base, d->fields);
521
476
 
522
- uint32_t sub_count = 0;
477
+ upb_SubCounts sub_counts = {0, 0};
523
478
  d->table->field_count = 0;
524
479
  d->table->fields = d->fields;
525
480
  upb_MtDecoder_Parse(d, data, len, d->fields, sizeof(*d->fields),
526
- &d->table->field_count, &sub_count);
481
+ &d->table->field_count, &sub_counts);
527
482
 
528
483
  upb_Arena_ShrinkLast(d->arena, d->fields, sizeof(*d->fields) * len,
529
484
  sizeof(*d->fields) * d->table->field_count);
530
485
  d->table->fields = d->fields;
531
- upb_MtDecoder_AllocateSubs(d, sub_count);
486
+ upb_MtDecoder_AllocateSubs(d, sub_counts);
532
487
  }
533
488
 
534
489
  int upb_MtDecoder_CompareFields(const void* _a, const void* _b) {
@@ -576,7 +531,8 @@ static size_t upb_MiniTable_DivideRoundUp(size_t n, size_t d) {
576
531
  return (n + d - 1) / d;
577
532
  }
578
533
 
579
- static void upb_MtDecoder_AssignHasbits(upb_MiniTable* ret) {
534
+ static void upb_MtDecoder_AssignHasbits(upb_MtDecoder* d) {
535
+ upb_MiniTable* ret = d->table;
580
536
  int n = ret->field_count;
581
537
  int last_hasbit = 0; // 0 cannot be used.
582
538
 
@@ -591,6 +547,10 @@ static void upb_MtDecoder_AssignHasbits(upb_MiniTable* ret) {
591
547
  }
592
548
  ret->required_count = last_hasbit;
593
549
 
550
+ if (ret->required_count > 63) {
551
+ upb_MdDecoder_ErrorJmp(&d->base, "Too many required fields");
552
+ }
553
+
594
554
  // Next assign non-required hasbit fields.
595
555
  for (int i = 0; i < n; i++) {
596
556
  upb_MiniTableField* field = (upb_MiniTableField*)&ret->fields[i];
@@ -609,8 +569,8 @@ size_t upb_MtDecoder_Place(upb_MtDecoder* d, upb_FieldRep rep) {
609
569
  static const size_t max = UINT16_MAX;
610
570
  size_t new_size = ret + size;
611
571
  if (new_size > max) {
612
- upb_MtDecoder_ErrorFormat(
613
- d, "Message size exceeded maximum size of %zu bytes", max);
572
+ upb_MdDecoder_ErrorJmp(
573
+ &d->base, "Message size exceeded maximum size of %zu bytes", max);
614
574
  }
615
575
  d->table->size = new_size;
616
576
  return ret;
@@ -670,14 +630,14 @@ static void upb_MtDecoder_ValidateEntryField(upb_MtDecoder* d,
670
630
  uint32_t expected_num) {
671
631
  const char* name = expected_num == 1 ? "key" : "val";
672
632
  if (f->number != expected_num) {
673
- upb_MtDecoder_ErrorFormat(d,
674
- "map %s did not have expected number (%d vs %d)",
675
- name, expected_num, (int)f->number);
633
+ upb_MdDecoder_ErrorJmp(&d->base,
634
+ "map %s did not have expected number (%d vs %d)",
635
+ name, expected_num, (int)f->number);
676
636
  }
677
637
 
678
638
  if (upb_IsRepeatedOrMap(f)) {
679
- upb_MtDecoder_ErrorFormat(
680
- d, "map %s cannot be repeated or map, or be in oneof", name);
639
+ upb_MdDecoder_ErrorJmp(
640
+ &d->base, "map %s cannot be repeated or map, or be in oneof", name);
681
641
  }
682
642
 
683
643
  uint32_t not_ok_types;
@@ -690,25 +650,26 @@ static void upb_MtDecoder_ValidateEntryField(upb_MtDecoder* d,
690
650
  }
691
651
 
692
652
  if ((1 << upb_MiniTableField_Type(f)) & not_ok_types) {
693
- upb_MtDecoder_ErrorFormat(d, "map %s cannot have type %d", name,
694
- (int)f->UPB_PRIVATE(descriptortype));
653
+ upb_MdDecoder_ErrorJmp(&d->base, "map %s cannot have type %d", name,
654
+ (int)f->UPB_PRIVATE(descriptortype));
695
655
  }
696
656
  }
697
657
 
698
658
  static void upb_MtDecoder_ParseMap(upb_MtDecoder* d, const char* data,
699
659
  size_t len) {
700
660
  upb_MtDecoder_ParseMessage(d, data, len);
701
- upb_MtDecoder_AssignHasbits(d->table);
661
+ upb_MtDecoder_AssignHasbits(d);
702
662
 
703
663
  if (UPB_UNLIKELY(d->table->field_count != 2)) {
704
- upb_MtDecoder_ErrorFormat(d, "%hu fields in map", d->table->field_count);
664
+ upb_MdDecoder_ErrorJmp(&d->base, "%hu fields in map",
665
+ d->table->field_count);
705
666
  UPB_UNREACHABLE();
706
667
  }
707
668
 
708
669
  upb_LayoutItem* end = UPB_PTRADD(d->vec.data, d->vec.size);
709
670
  for (upb_LayoutItem* item = d->vec.data; item < end; item++) {
710
671
  if (item->type == kUpb_LayoutItemType_OneofCase) {
711
- upb_MtDecoder_ErrorFormat(d, "Map entry cannot have oneof");
672
+ upb_MdDecoder_ErrorJmp(&d->base, "Map entry cannot have oneof");
712
673
  }
713
674
  }
714
675
 
@@ -731,8 +692,8 @@ static void upb_MtDecoder_ParseMap(upb_MtDecoder* d, const char* data,
731
692
  static void upb_MtDecoder_ParseMessageSet(upb_MtDecoder* d, const char* data,
732
693
  size_t len) {
733
694
  if (len > 0) {
734
- upb_MtDecoder_ErrorFormat(d, "Invalid message set encode length: %zu", len);
735
- UPB_UNREACHABLE();
695
+ upb_MdDecoder_ErrorJmp(&d->base, "Invalid message set encode length: %zu",
696
+ len);
736
697
  }
737
698
 
738
699
  upb_MiniTable* ret = d->table;
@@ -747,7 +708,7 @@ static void upb_MtDecoder_ParseMessageSet(upb_MtDecoder* d, const char* data,
747
708
  static upb_MiniTable* upb_MtDecoder_DoBuildMiniTableWithBuf(
748
709
  upb_MtDecoder* decoder, const char* data, size_t len, void** buf,
749
710
  size_t* buf_size) {
750
- upb_MtDecoder_CheckOutOfMemory(decoder, decoder->table);
711
+ upb_MdDecoder_CheckOutOfMemory(&decoder->base, decoder->table);
751
712
 
752
713
  decoder->table->size = 0;
753
714
  decoder->table->field_count = 0;
@@ -767,7 +728,7 @@ static upb_MiniTable* upb_MtDecoder_DoBuildMiniTableWithBuf(
767
728
 
768
729
  case kUpb_EncodedVersion_MessageV1:
769
730
  upb_MtDecoder_ParseMessage(decoder, data, len);
770
- upb_MtDecoder_AssignHasbits(decoder->table);
731
+ upb_MtDecoder_AssignHasbits(decoder);
771
732
  upb_MtDecoder_SortLayoutItems(decoder);
772
733
  upb_MtDecoder_AssignOffsets(decoder);
773
734
  break;
@@ -777,8 +738,8 @@ static upb_MiniTable* upb_MtDecoder_DoBuildMiniTableWithBuf(
777
738
  break;
778
739
 
779
740
  default:
780
- upb_MtDecoder_ErrorFormat(decoder, "Invalid message version: %c", vers);
781
- UPB_UNREACHABLE();
741
+ upb_MdDecoder_ErrorJmp(&decoder->base, "Invalid message version: %c",
742
+ vers);
782
743
  }
783
744
 
784
745
  done:
@@ -790,7 +751,7 @@ done:
790
751
  static upb_MiniTable* upb_MtDecoder_BuildMiniTableWithBuf(
791
752
  upb_MtDecoder* const decoder, const char* const data, const size_t len,
792
753
  void** const buf, size_t* const buf_size) {
793
- if (UPB_SETJMP(decoder->err) != 0) {
754
+ if (UPB_SETJMP(decoder->base.err) != 0) {
794
755
  *buf = decoder->vec.data;
795
756
  *buf_size = decoder->vec.capacity * sizeof(*decoder->vec.data);
796
757
  return NULL;
@@ -806,6 +767,7 @@ upb_MiniTable* upb_MiniTable_BuildWithBuf(const char* data, size_t len,
806
767
  size_t* buf_size,
807
768
  upb_Status* status) {
808
769
  upb_MtDecoder decoder = {
770
+ .base = {.status = status},
809
771
  .platform = platform,
810
772
  .vec =
811
773
  {
@@ -814,7 +776,6 @@ upb_MiniTable* upb_MiniTable_BuildWithBuf(const char* data, size_t len,
814
776
  .size = 0,
815
777
  },
816
778
  .arena = arena,
817
- .status = status,
818
779
  .table = upb_Arena_Malloc(arena, sizeof(*decoder.table)),
819
780
  };
820
781
 
@@ -822,111 +783,6 @@ upb_MiniTable* upb_MiniTable_BuildWithBuf(const char* data, size_t len,
822
783
  buf_size);
823
784
  }
824
785
 
825
- static size_t upb_MiniTableEnum_Size(size_t count) {
826
- return sizeof(upb_MiniTableEnum) + count * sizeof(uint32_t);
827
- }
828
-
829
- static upb_MiniTableEnum* _upb_MiniTable_AddEnumDataMember(upb_MtDecoder* d,
830
- uint32_t val) {
831
- if (d->enum_data_count == d->enum_data_capacity) {
832
- size_t old_sz = upb_MiniTableEnum_Size(d->enum_data_capacity);
833
- d->enum_data_capacity = UPB_MAX(2, d->enum_data_capacity * 2);
834
- size_t new_sz = upb_MiniTableEnum_Size(d->enum_data_capacity);
835
- d->enum_table = upb_Arena_Realloc(d->arena, d->enum_table, old_sz, new_sz);
836
- upb_MtDecoder_CheckOutOfMemory(d, d->enum_table);
837
- }
838
- d->enum_table->data[d->enum_data_count++] = val;
839
- return d->enum_table;
840
- }
841
-
842
- static void upb_MiniTableEnum_BuildValue(upb_MtDecoder* d, uint32_t val) {
843
- upb_MiniTableEnum* table = d->enum_table;
844
- d->enum_value_count++;
845
- if (table->value_count || (val > 512 && d->enum_value_count < val / 32)) {
846
- if (table->value_count == 0) {
847
- assert(d->enum_data_count == table->mask_limit / 32);
848
- }
849
- table = _upb_MiniTable_AddEnumDataMember(d, val);
850
- table->value_count++;
851
- } else {
852
- uint32_t new_mask_limit = ((val / 32) + 1) * 32;
853
- while (table->mask_limit < new_mask_limit) {
854
- table = _upb_MiniTable_AddEnumDataMember(d, 0);
855
- table->mask_limit += 32;
856
- }
857
- table->data[val / 32] |= 1ULL << (val % 32);
858
- }
859
- }
860
-
861
- static upb_MiniTableEnum* upb_MtDecoder_DoBuildMiniTableEnum(
862
- upb_MtDecoder* decoder, const char* data, size_t len) {
863
- // If the string is non-empty then it must begin with a version tag.
864
- if (len) {
865
- if (*data != kUpb_EncodedVersion_EnumV1) {
866
- upb_MtDecoder_ErrorFormat(decoder, "Invalid enum version: %c", *data);
867
- UPB_UNREACHABLE();
868
- }
869
- data++;
870
- len--;
871
- }
872
-
873
- upb_MtDecoder_CheckOutOfMemory(decoder, decoder->enum_table);
874
-
875
- // Guarantee at least 64 bits of mask without checking mask size.
876
- decoder->enum_table->mask_limit = 64;
877
- decoder->enum_table = _upb_MiniTable_AddEnumDataMember(decoder, 0);
878
- decoder->enum_table = _upb_MiniTable_AddEnumDataMember(decoder, 0);
879
-
880
- decoder->enum_table->value_count = 0;
881
-
882
- const char* ptr = data;
883
- uint32_t base = 0;
884
-
885
- while (ptr < decoder->end) {
886
- char ch = *ptr++;
887
- if (ch <= kUpb_EncodedValue_MaxEnumMask) {
888
- uint32_t mask = _upb_FromBase92(ch);
889
- for (int i = 0; i < 5; i++, base++, mask >>= 1) {
890
- if (mask & 1) upb_MiniTableEnum_BuildValue(decoder, base);
891
- }
892
- } else if (kUpb_EncodedValue_MinSkip <= ch &&
893
- ch <= kUpb_EncodedValue_MaxSkip) {
894
- uint32_t skip;
895
- ptr = upb_MiniTable_DecodeBase92Varint(decoder, ptr, ch,
896
- kUpb_EncodedValue_MinSkip,
897
- kUpb_EncodedValue_MaxSkip, &skip);
898
- base += skip;
899
- } else {
900
- upb_MtDecoder_ErrorFormat(decoder, "Unexpected character: %c", ch);
901
- return NULL;
902
- }
903
- }
904
-
905
- return decoder->enum_table;
906
- }
907
-
908
- static upb_MiniTableEnum* upb_MtDecoder_BuildMiniTableEnum(
909
- upb_MtDecoder* const decoder, const char* const data, size_t const len) {
910
- if (UPB_SETJMP(decoder->err) != 0) return NULL;
911
- return upb_MtDecoder_DoBuildMiniTableEnum(decoder, data, len);
912
- }
913
-
914
- upb_MiniTableEnum* upb_MiniTableEnum_Build(const char* data, size_t len,
915
- upb_Arena* arena,
916
- upb_Status* status) {
917
- upb_MtDecoder decoder = {
918
- .enum_table = upb_Arena_Malloc(arena, upb_MiniTableEnum_Size(2)),
919
- .enum_value_count = 0,
920
- .enum_data_count = 0,
921
- .enum_data_capacity = 1,
922
- .status = status,
923
- .end = UPB_PTRADD(data, len),
924
- .arena = arena,
925
- };
926
-
927
- return upb_MtDecoder_BuildMiniTableEnum(&decoder, data, len);
928
- }
929
-
930
786
  static const char* upb_MtDecoder_DoBuildMiniTableExtension(
931
787
  upb_MtDecoder* decoder, const char* data, size_t len,
932
788
  upb_MiniTableExtension* ext, const upb_MiniTable* extendee,
@@ -934,16 +790,16 @@ static const char* upb_MtDecoder_DoBuildMiniTableExtension(
934
790
  // If the string is non-empty then it must begin with a version tag.
935
791
  if (len) {
936
792
  if (*data != kUpb_EncodedVersion_ExtensionV1) {
937
- upb_MtDecoder_ErrorFormat(decoder, "Invalid ext version: %c", *data);
938
- UPB_UNREACHABLE();
793
+ upb_MdDecoder_ErrorJmp(&decoder->base, "Invalid ext version: %c", *data);
939
794
  }
940
795
  data++;
941
796
  len--;
942
797
  }
943
798
 
944
799
  uint16_t count = 0;
945
- const char* ret =
946
- upb_MtDecoder_Parse(decoder, data, len, ext, sizeof(*ext), &count, NULL);
800
+ upb_SubCounts sub_counts = {0, 0};
801
+ const char* ret = upb_MtDecoder_Parse(decoder, data, len, ext, sizeof(*ext),
802
+ &count, &sub_counts);
947
803
  if (!ret || count != 1) return NULL;
948
804
 
949
805
  upb_MiniTableField* f = &ext->field;
@@ -970,7 +826,7 @@ static const char* upb_MtDecoder_BuildMiniTableExtension(
970
826
  upb_MtDecoder* const decoder, const char* const data, const size_t len,
971
827
  upb_MiniTableExtension* const ext, const upb_MiniTable* const extendee,
972
828
  const upb_MiniTableSub sub) {
973
- if (UPB_SETJMP(decoder->err) != 0) return NULL;
829
+ if (UPB_SETJMP(decoder->base.err) != 0) return NULL;
974
830
  return upb_MtDecoder_DoBuildMiniTableExtension(decoder, data, len, ext,
975
831
  extendee, sub);
976
832
  }
@@ -982,8 +838,8 @@ const char* _upb_MiniTableExtension_Init(const char* data, size_t len,
982
838
  upb_MiniTablePlatform platform,
983
839
  upb_Status* status) {
984
840
  upb_MtDecoder decoder = {
841
+ .base = {.status = status},
985
842
  .arena = NULL,
986
- .status = status,
987
843
  .table = NULL,
988
844
  .platform = platform,
989
845
  };
@@ -1017,111 +873,3 @@ upb_MiniTable* _upb_MiniTable_Build(const char* data, size_t len,
1017
873
  free(buf);
1018
874
  return ret;
1019
875
  }
1020
-
1021
- bool upb_MiniTable_SetSubMessage(upb_MiniTable* table,
1022
- upb_MiniTableField* field,
1023
- const upb_MiniTable* sub) {
1024
- UPB_ASSERT((uintptr_t)table->fields <= (uintptr_t)field &&
1025
- (uintptr_t)field <
1026
- (uintptr_t)(table->fields + table->field_count));
1027
- UPB_ASSERT(sub);
1028
-
1029
- const bool sub_is_map = sub->ext & kUpb_ExtMode_IsMapEntry;
1030
-
1031
- switch (field->UPB_PRIVATE(descriptortype)) {
1032
- case kUpb_FieldType_Message:
1033
- if (sub_is_map) {
1034
- const bool table_is_map = table->ext & kUpb_ExtMode_IsMapEntry;
1035
- if (UPB_UNLIKELY(table_is_map)) return false;
1036
-
1037
- field->mode = (field->mode & ~kUpb_FieldMode_Mask) | kUpb_FieldMode_Map;
1038
- }
1039
- break;
1040
-
1041
- case kUpb_FieldType_Group:
1042
- if (UPB_UNLIKELY(sub_is_map)) return false;
1043
- break;
1044
-
1045
- default:
1046
- return false;
1047
- }
1048
-
1049
- upb_MiniTableSub* table_sub =
1050
- (void*)&table->subs[field->UPB_PRIVATE(submsg_index)];
1051
- table_sub->submsg = sub;
1052
- return true;
1053
- }
1054
-
1055
- bool upb_MiniTable_SetSubEnum(upb_MiniTable* table, upb_MiniTableField* field,
1056
- const upb_MiniTableEnum* sub) {
1057
- UPB_ASSERT((uintptr_t)table->fields <= (uintptr_t)field &&
1058
- (uintptr_t)field <
1059
- (uintptr_t)(table->fields + table->field_count));
1060
- UPB_ASSERT(sub);
1061
-
1062
- upb_MiniTableSub* table_sub =
1063
- (void*)&table->subs[field->UPB_PRIVATE(submsg_index)];
1064
- table_sub->subenum = sub;
1065
- return true;
1066
- }
1067
-
1068
- uint32_t upb_MiniTable_GetSubList(const upb_MiniTable* mt,
1069
- const upb_MiniTableField** subs) {
1070
- uint32_t msg_count = 0;
1071
- uint32_t enum_count = 0;
1072
-
1073
- for (int i = 0; i < mt->field_count; i++) {
1074
- const upb_MiniTableField* f = &mt->fields[i];
1075
- if (upb_MiniTableField_CType(f) == kUpb_CType_Message) {
1076
- *subs = f;
1077
- ++subs;
1078
- msg_count++;
1079
- }
1080
- }
1081
-
1082
- for (int i = 0; i < mt->field_count; i++) {
1083
- const upb_MiniTableField* f = &mt->fields[i];
1084
- if (upb_MiniTableField_CType(f) == kUpb_CType_Enum) {
1085
- *subs = f;
1086
- ++subs;
1087
- enum_count++;
1088
- }
1089
- }
1090
-
1091
- return (msg_count << 16) | enum_count;
1092
- }
1093
-
1094
- // The list of sub_tables and sub_enums must exactly match the number and order
1095
- // of sub-message fields and sub-enum fields given by upb_MiniTable_GetSubList()
1096
- // above.
1097
- bool upb_MiniTable_Link(upb_MiniTable* mt, const upb_MiniTable** sub_tables,
1098
- size_t sub_table_count,
1099
- const upb_MiniTableEnum** sub_enums,
1100
- size_t sub_enum_count) {
1101
- uint32_t msg_count = 0;
1102
- uint32_t enum_count = 0;
1103
-
1104
- for (int i = 0; i < mt->field_count; i++) {
1105
- upb_MiniTableField* f = (upb_MiniTableField*)&mt->fields[i];
1106
- if (upb_MiniTableField_CType(f) == kUpb_CType_Message) {
1107
- const upb_MiniTable* sub = sub_tables[msg_count++];
1108
- if (msg_count > sub_table_count) return false;
1109
- if (sub != NULL) {
1110
- if (!upb_MiniTable_SetSubMessage(mt, f, sub)) return false;
1111
- }
1112
- }
1113
- }
1114
-
1115
- for (int i = 0; i < mt->field_count; i++) {
1116
- upb_MiniTableField* f = (upb_MiniTableField*)&mt->fields[i];
1117
- if (upb_MiniTableField_CType(f) == kUpb_CType_Enum) {
1118
- const upb_MiniTableEnum* sub = sub_enums[enum_count++];
1119
- if (enum_count > sub_enum_count) return false;
1120
- if (sub != NULL) {
1121
- if (!upb_MiniTable_SetSubEnum(mt, f, sub)) return false;
1122
- }
1123
- }
1124
- }
1125
-
1126
- return true;
1127
- }