Use preserve_none calling convention for protocol buffer parsing functions.

PiperOrigin-RevId: 645136265
pull/17184/head
Protobuf Team Bot 5 months ago committed by Copybara-Service
parent 594a71f485
commit dcde39e12f
  1. 10
      src/google/protobuf/generated_message_tctable_decl.h
  2. 470
      src/google/protobuf/generated_message_tctable_impl.h
  3. 10
      src/google/protobuf/generated_message_tctable_lite.cc
  4. 4
      src/google/protobuf/implicit_weak_message.h
  5. 5
      src/google/protobuf/port_def.inc
  6. 1
      src/google/protobuf/port_undef.inc

@ -127,7 +127,7 @@ struct TcFieldData {
struct TcParseTableBase;
// TailCallParseFunc is the function pointer type used in the tailcall table.
typedef const char* (*TailCallParseFunc)(PROTOBUF_TC_PARAM_DECL);
typedef PROTOBUF_CC const char* (*TailCallParseFunc)(PROTOBUF_TC_PARAM_DECL);
namespace field_layout {
struct Offset {
@ -542,12 +542,14 @@ static_assert(offsetof(TcParseTable<1>, fast_entries) ==
sizeof(TcParseTableBase),
"Table entries must be laid out after TcParseTableBase.");
template <typename T, const char* (*func)(T*, const char*, ParseContext*)>
const char* StubParseImpl(PROTOBUF_TC_PARAM_DECL) {
template <typename T,
PROTOBUF_CC const char* (*func)(T*, const char*, ParseContext*)>
PROTOBUF_CC const char* StubParseImpl(PROTOBUF_TC_PARAM_DECL) {
return func(static_cast<T*>(msg), ptr, ctx);
}
template <typename T, const char* (*func)(T*, const char*, ParseContext*)>
template <typename T,
PROTOBUF_CC const char* (*func)(T*, const char*, ParseContext*)>
constexpr TcParseTable<0> CreateStubTcParseTable(
const MessageLite* default_instance,
TcParseTableBase::PostLoopHandler post_loop_handler = nullptr) {

@ -411,26 +411,30 @@ class PROTOBUF_EXPORT TcParser final {
// the function is used as a way to get a UnknownFieldOps vtable, returned
// via the `const char*` return type. See `GetUnknownFieldOps()`
static const char* GenericFallback(PROTOBUF_TC_PARAM_DECL);
static const char* GenericFallbackLite(PROTOBUF_TC_PARAM_DECL);
static const char* ReflectionFallback(PROTOBUF_TC_PARAM_DECL);
static const char* ReflectionParseLoop(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static const char* GenericFallback(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static const char* GenericFallbackLite(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static const char* ReflectionFallback(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static const char* ReflectionParseLoop(PROTOBUF_TC_PARAM_DECL);
// This fallback will discard any field that reaches there.
// Note that fields parsed via fast/MiniParse are not going to be discarded
// even when this is enabled.
static const char* DiscardEverythingFallback(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static const char* DiscardEverythingFallback(
PROTOBUF_TC_PARAM_DECL);
// These follow the "fast" function ABI but implement the whole loop for
// message_set_wire_format types.
static const char* MessageSetWireFormatParseLoop(
PROTOBUF_CC static const char* MessageSetWireFormatParseLoop(
PROTOBUF_TC_PARAM_NO_DATA_DECL);
static const char* MessageSetWireFormatParseLoopLite(
PROTOBUF_CC static const char* MessageSetWireFormatParseLoopLite(
PROTOBUF_TC_PARAM_NO_DATA_DECL);
static const char* ParseLoop(MessageLite* msg, const char* ptr,
ParseContext* ctx,
const TcParseTableBase* table);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* ParseLoopPreserveNone(
MessageLite* msg, const char* ptr, ParseContext* ctx,
const TcParseTableBase* table);
// Functions referenced by generated fast tables (numeric types):
// F: fixed V: varint Z: zigzag
@ -439,52 +443,94 @@ class PROTOBUF_EXPORT TcParser final {
// 1/2: tag length (bytes)
// Fixed:
PROTOBUF_NOINLINE static const char* FastF32S1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastF32S2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastF32R1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastF32R2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastF32P1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastF32P2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastF64S1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastF64S2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastF64R1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastF64R2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastF64P1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastF64P2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastF32S1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastF32S2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastF32R1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastF32R2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastF32P1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastF32P2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastF64S1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastF64S2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastF64R1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastF64R2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastF64P1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastF64P2(
PROTOBUF_TC_PARAM_DECL);
// Varint:
PROTOBUF_NOINLINE static const char* FastV8S1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastV8S2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastV8R1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastV8R2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastV8P1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastV8P2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastV32S1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastV32S2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastV32R1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastV32R2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastV32P1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastV32P2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastV64S1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastV64S2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastV64R1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastV64R2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastV64P1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastV64P2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastV8S1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastV8S2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastV8R1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastV8R2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastV8P1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastV8P2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastV32S1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastV32S2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastV32R1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastV32R2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastV32P1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastV32P2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastV64S1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastV64S2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastV64R1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastV64R2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastV64P1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastV64P2(
PROTOBUF_TC_PARAM_DECL);
// Varint (with zigzag):
PROTOBUF_NOINLINE static const char* FastZ32S1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastZ32S2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastZ32R1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastZ32R2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastZ32P1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastZ32P2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastZ64S1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastZ64S2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastZ64R1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastZ64R2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastZ64P1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastZ64P2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastZ32S1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastZ32S2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastZ32R1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastZ32R2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastZ32P1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastZ32P2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastZ64S1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastZ64S2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastZ64R1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastZ64R2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastZ64P1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastZ64P2(
PROTOBUF_TC_PARAM_DECL);
template <typename FieldType, int unused_data_offset, int unused_hasbit_idx>
static constexpr TailCallParseFunc SingularVarintNoZag1() {
@ -508,89 +554,155 @@ class PROTOBUF_EXPORT TcParser final {
// r: enum range v: enum validator (ValidateEnum function)
// S: singular R: repeated P: packed
// 1/2: tag length (bytes)
PROTOBUF_NOINLINE static const char* FastErS1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastErS2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastErR1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastErR2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastErP1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastErP2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastEvS1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastEvS2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastEvR1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastEvR2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastEvP1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastEvP2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastEr0S1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastEr0S2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastEr0R1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastEr0R2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastEr0P1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastEr0P2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastEr1S1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastEr1S2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastEr1R1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastEr1R2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastEr1P1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastEr1P2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastErS1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastErS2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastErR1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastErR2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastErP1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastErP2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastEvS1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastEvS2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastEvR1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastEvR2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastEvP1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastEvP2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastEr0S1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastEr0S2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastEr0R1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastEr0R2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastEr0P1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastEr0P2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastEr1S1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastEr1S2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastEr1R1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastEr1R2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastEr1P1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastEr1P2(
PROTOBUF_TC_PARAM_DECL);
// Functions referenced by generated fast tables (string types):
// B: bytes S: string U: UTF-8 string
// (empty): ArenaStringPtr i: InlinedString
// S: singular R: repeated
// 1/2: tag length (bytes)
PROTOBUF_NOINLINE static const char* FastBS1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastBS2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastBR1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastBR2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastSS1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastSS2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastSR1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastSR2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastUS1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastUS2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastUR1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastUR2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastBiS1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastBiS2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastSiS1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastSiS2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastUiS1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastUiS2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastBcS1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastBcS2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastScS1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastScS2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastUcS1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastUcS2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastBS1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastBS2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastBR1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastBR2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastSS1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastSS2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastSR1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastSR2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastUS1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastUS2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastUR1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastUR2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastBiS1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastBiS2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastSiS1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastSiS2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastUiS1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastUiS2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastBcS1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastBcS2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastScS1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastScS2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastUcS1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastUcS2(
PROTOBUF_TC_PARAM_DECL);
// Functions referenced by generated fast tables (message types):
// M: message G: group
// d: default* t: TcParseTable* (the contents of aux) l: lazy
// S: singular R: repeated
// 1/2: tag length (bytes)
PROTOBUF_NOINLINE static const char* FastMdS1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastMdS2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastGdS1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastGdS2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastMtS1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastMtS2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastGtS1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastGtS2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastMdR1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastMdR2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastGdR1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastGdR2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastMtR1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastMtR2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastGtR1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastGtR2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastMlS1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastMlS2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastMdS1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastMdS2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastGdS1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastGdS2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastMtS1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastMtS2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastGtS1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastGtS2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastMdR1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastMdR2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastGdR1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastGdR2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastMtR1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastMtR2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastGtR1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastGtR2(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastMlS1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastMlS2(
PROTOBUF_TC_PARAM_DECL);
// NOTE: Do not dedup RefAt by having one call the other with a const_cast. It
// causes ICEs of gcc 7.5.
@ -670,11 +782,13 @@ class PROTOBUF_EXPORT TcParser final {
// NOTE: Currently, this function only calls the table-level fallback
// function, so it should only be called as the fallback from fast table
// parsing.
PROTOBUF_NOINLINE
static const char* MiniParse(PROTOBUF_TC_PARAM_NO_DATA_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* MiniParse(
PROTOBUF_TC_PARAM_NO_DATA_DECL);
PROTOBUF_NOINLINE static const char* FastEndG1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* FastEndG2(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastEndG1(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastEndG2(
PROTOBUF_TC_PARAM_DECL);
// For `map` mini parsing generate a type card for the key/value.
template <typename MapField>
@ -707,7 +821,7 @@ class PROTOBUF_EXPORT TcParser final {
private:
// Optimized small tag varint parser for int32/int64
template <typename FieldType>
static const char* FastVarintS1(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static const char* FastVarintS1(PROTOBUF_TC_PARAM_DECL);
friend class GeneratedTcTableLiteTest;
static void* MaybeGetSplitBase(MessageLite* msg, bool is_split,
@ -724,17 +838,19 @@ class PROTOBUF_EXPORT TcParser final {
PROTOBUF_NOINLINE
static TestMiniParseResult TestMiniParse(PROTOBUF_TC_PARAM_DECL);
template <bool export_called_function>
static const char* MiniParse(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static const char* MiniParse(PROTOBUF_TC_PARAM_DECL);
template <typename TagType, bool group_coding, bool aux_is_table>
static inline const char* SingularParseMessageAuxImpl(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static inline const char* SingularParseMessageAuxImpl(
PROTOBUF_TC_PARAM_DECL);
template <typename TagType, bool group_coding, bool aux_is_table>
static inline const char* RepeatedParseMessageAuxImpl(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static inline const char* RepeatedParseMessageAuxImpl(
PROTOBUF_TC_PARAM_DECL);
template <typename TagType>
static inline const char* LazyMessage(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static inline const char* LazyMessage(PROTOBUF_TC_PARAM_DECL);
template <typename TagType>
static const char* FastEndGroupImpl(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static const char* FastEndGroupImpl(PROTOBUF_TC_PARAM_DECL);
static inline PROTOBUF_ALWAYS_INLINE void SyncHasbits(
MessageLite* msg, uint64_t hasbits, const TcParseTableBase* table) {
@ -746,15 +862,16 @@ class PROTOBUF_EXPORT TcParser final {
}
}
static const char* TagDispatch(PROTOBUF_TC_PARAM_NO_DATA_DECL);
static const char* ToTagDispatch(PROTOBUF_TC_PARAM_NO_DATA_DECL);
static const char* ToParseLoop(PROTOBUF_TC_PARAM_NO_DATA_DECL);
PROTOBUF_NOINLINE static const char* Error(PROTOBUF_TC_PARAM_NO_DATA_DECL);
PROTOBUF_CC static const char* TagDispatch(PROTOBUF_TC_PARAM_NO_DATA_DECL);
PROTOBUF_CC static const char* ToTagDispatch(PROTOBUF_TC_PARAM_NO_DATA_DECL);
PROTOBUF_CC static const char* ToParseLoop(PROTOBUF_TC_PARAM_NO_DATA_DECL);
PROTOBUF_NOINLINE
static const char* FastUnknownEnumFallback(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static const char* Error(PROTOBUF_TC_PARAM_NO_DATA_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* FastUnknownEnumFallback(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE
static const char* MpUnknownEnumFallback(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static const char* MpUnknownEnumFallback(PROTOBUF_TC_PARAM_DECL);
class ScopedArenaSwap;
@ -782,7 +899,7 @@ class PROTOBUF_EXPORT TcParser final {
}
template <class MessageBaseT, class UnknownFieldsT>
static const char* GenericFallbackImpl(PROTOBUF_TC_PARAM_DECL) {
PROTOBUF_CC static const char* GenericFallbackImpl(PROTOBUF_TC_PARAM_DECL) {
if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) {
// This is the ABI used by GetUnknownFieldOps(). Return the vtable.
static constexpr UnknownFieldOps kOps = {
@ -816,7 +933,7 @@ class PROTOBUF_EXPORT TcParser final {
}
template <class MessageBaseT>
static const char* MessageSetWireFormatParseLoopImpl(
PROTOBUF_CC static const char* MessageSetWireFormatParseLoopImpl(
PROTOBUF_TC_PARAM_NO_DATA_DECL) {
return RefAt<ExtensionSet>(msg, table->extension_offset)
.ParseMessageSet(
@ -829,45 +946,48 @@ class PROTOBUF_EXPORT TcParser final {
// Implementations for fast fixed field parsing functions:
template <typename LayoutType, typename TagType>
static inline const char* SingularFixed(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static inline const char* SingularFixed(PROTOBUF_TC_PARAM_DECL);
template <typename LayoutType, typename TagType>
static inline const char* RepeatedFixed(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static inline const char* RepeatedFixed(PROTOBUF_TC_PARAM_DECL);
template <typename LayoutType, typename TagType>
static inline const char* PackedFixed(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static inline const char* PackedFixed(PROTOBUF_TC_PARAM_DECL);
// Implementations for fast varint field parsing functions:
template <typename FieldType, typename TagType, bool zigzag = false>
static inline const char* SingularVarint(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static inline const char* SingularVarint(PROTOBUF_TC_PARAM_DECL);
template <typename FieldType, typename TagType, bool zigzag = false>
static inline const char* RepeatedVarint(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static inline const char* RepeatedVarint(PROTOBUF_TC_PARAM_DECL);
template <typename FieldType, typename TagType, bool zigzag = false>
static inline const char* PackedVarint(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static inline const char* PackedVarint(PROTOBUF_TC_PARAM_DECL);
// Helper for ints > 127:
template <typename FieldType, typename TagType, bool zigzag = false>
PROTOBUF_NOINLINE static const char* SingularVarBigint(
PROTOBUF_NOINLINE PROTOBUF_CC static const char* SingularVarBigint(
PROTOBUF_TC_PARAM_DECL);
// Implementations for fast enum field parsing functions:
template <typename TagType, uint16_t xform_val>
static inline const char* SingularEnum(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static inline const char* SingularEnum(PROTOBUF_TC_PARAM_DECL);
template <typename TagType, uint8_t min>
static inline const char* SingularEnumSmallRange(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static inline const char* SingularEnumSmallRange(
PROTOBUF_TC_PARAM_DECL);
template <typename TagType, uint16_t xform_val>
static inline const char* RepeatedEnum(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static inline const char* RepeatedEnum(PROTOBUF_TC_PARAM_DECL);
template <typename TagType, uint16_t xform_val>
static inline const char* PackedEnum(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static inline const char* PackedEnum(PROTOBUF_TC_PARAM_DECL);
template <typename TagType, uint8_t min>
static inline const char* RepeatedEnumSmallRange(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static inline const char* RepeatedEnumSmallRange(
PROTOBUF_TC_PARAM_DECL);
template <typename TagType, uint8_t min>
static inline const char* PackedEnumSmallRange(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static inline const char* PackedEnumSmallRange(
PROTOBUF_TC_PARAM_DECL);
// Implementations for fast string field parsing functions:
enum Utf8Type { kNoUtf8 = 0, kUtf8 = 1, kUtf8ValidateOnly = 2 };
template <typename TagType, typename FieldType, Utf8Type utf8>
static inline const char* SingularString(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static inline const char* SingularString(PROTOBUF_TC_PARAM_DECL);
template <typename TagType, typename FieldType, Utf8Type utf8>
static inline const char* RepeatedString(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static inline const char* RepeatedString(PROTOBUF_TC_PARAM_DECL);
static inline const char* ParseRepeatedStringOnce(
const char* ptr, SerialArena* serial_arena, ParseContext* ctx,
@ -927,33 +1047,45 @@ class PROTOBUF_EXPORT TcParser final {
// Mini parsing:
template <bool is_split>
PROTOBUF_NOINLINE static const char* MpVarint(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* MpVarint(
PROTOBUF_TC_PARAM_DECL);
template <bool is_split>
PROTOBUF_NOINLINE static const char* MpRepeatedVarint(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* MpRepeatedVarint(
PROTOBUF_TC_PARAM_DECL);
template <bool is_split, typename FieldType, uint16_t xform_val>
static const char* MpRepeatedVarintT(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static const char* MpRepeatedVarintT(PROTOBUF_TC_PARAM_DECL);
template <bool is_split>
PROTOBUF_NOINLINE static const char* MpPackedVarint(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* MpPackedVarint(
PROTOBUF_TC_PARAM_DECL);
template <bool is_split, typename FieldType, uint16_t xform_val>
static const char* MpPackedVarintT(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static const char* MpPackedVarintT(PROTOBUF_TC_PARAM_DECL);
template <bool is_split>
PROTOBUF_NOINLINE static const char* MpFixed(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* MpFixed(
PROTOBUF_TC_PARAM_DECL);
template <bool is_split>
PROTOBUF_NOINLINE static const char* MpRepeatedFixed(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* MpRepeatedFixed(
PROTOBUF_TC_PARAM_DECL);
template <bool is_split>
PROTOBUF_NOINLINE static const char* MpPackedFixed(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* MpPackedFixed(
PROTOBUF_TC_PARAM_DECL);
template <bool is_split>
PROTOBUF_NOINLINE static const char* MpString(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* MpString(
PROTOBUF_TC_PARAM_DECL);
template <bool is_split>
PROTOBUF_NOINLINE static const char* MpRepeatedString(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* MpRepeatedString(
PROTOBUF_TC_PARAM_DECL);
template <bool is_split>
PROTOBUF_NOINLINE static const char* MpMessage(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* MpMessage(
PROTOBUF_TC_PARAM_DECL);
template <bool is_split, bool is_group>
static const char* MpRepeatedMessageOrGroup(PROTOBUF_TC_PARAM_DECL);
static const char* MpLazyMessage(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE static const char* MpFallback(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static const char* MpRepeatedMessageOrGroup(
PROTOBUF_TC_PARAM_DECL);
PROTOBUF_CC static const char* MpLazyMessage(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE
PROTOBUF_CC static const char* MpFallback(PROTOBUF_TC_PARAM_DECL);
template <bool is_split>
PROTOBUF_NOINLINE static const char* MpMap(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_NOINLINE PROTOBUF_CC static const char* MpMap(
PROTOBUF_TC_PARAM_DECL);
};
// Dispatch to the designated parse function

@ -73,6 +73,12 @@ const char* TcParser::GenericFallbackLite(PROTOBUF_TC_PARAM_DECL) {
// Core fast parsing implementation:
//////////////////////////////////////////////////////////////////////////////
PROTOBUF_NOINLINE const char* TcParser::ParseLoopPreserveNone(
MessageLite* msg, const char* ptr, ParseContext* ctx,
const TcParseTableBase* table) {
return ParseLoop(msg, ptr, ctx, table);
}
// On the fast path, a (matching) 1-byte tag already has the decoded value.
static uint32_t FastDecodeTag(uint8_t coded_tag) {
return coded_tag;
@ -2346,7 +2352,7 @@ PROTOBUF_NOINLINE const char* TcParser::MpMessage(PROTOBUF_TC_PARAM_DECL) {
field = inner_table->default_instance->New(msg->GetArena());
}
const auto inner_loop = [&](const char* ptr) {
return ParseLoop(field, ptr, ctx, inner_table);
return ParseLoopPreserveNone(field, ptr, ctx, inner_table);
};
return is_group ? ctx->ParseGroupInlined(ptr, decoded_tag, inner_loop)
: ctx->ParseLengthDelimitedInlined(ptr, inner_loop);
@ -2406,7 +2412,7 @@ const char* TcParser::MpRepeatedMessageOrGroup(PROTOBUF_TC_PARAM_DECL) {
do {
MessageLite* value = field.AddMessage(default_instance);
const auto inner_loop = [&](const char* ptr) {
return ParseLoop(value, ptr, ctx, inner_table);
return ParseLoopPreserveNone(value, ptr, ctx, inner_table);
};
ptr = is_group ? ctx->ParseGroupInlined(ptr2, decoded_tag, inner_loop)
: ctx->ParseLengthDelimitedInlined(ptr2, inner_loop);

@ -81,8 +81,8 @@ class PROTOBUF_EXPORT ImplicitWeakMessage final : public MessageLite {
typedef void InternalArenaConstructable_;
static const char* ParseImpl(ImplicitWeakMessage* msg, const char* ptr,
ParseContext* ctx);
static PROTOBUF_CC const char* ParseImpl(ImplicitWeakMessage* msg,
const char* ptr, ParseContext* ctx);
private:
static const ClassDataLite<1> class_data_;

@ -235,6 +235,11 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3),
#define PROTOBUF_TAILCALL false
#endif
#ifdef PROTOBUF_CC
#error PROTOBUF_CC was previously defined
#endif
#define PROTOBUF_CC
#if defined(__clang__)
#define PROTOBUF_IGNORE_DEPRECATION_START \
_Pragma("clang diagnostic push") \

@ -27,6 +27,7 @@
#undef PROTOBUF_NDEBUG_INLINE
#undef PROTOBUF_MUSTTAIL
#undef PROTOBUF_TAILCALL
#undef PROTOBUF_CC
#undef PROTOBUF_NOINLINE
#undef PROTOBUF_IGNORE_DEPRECATION_START
#undef PROTOBUF_IGNORE_DEPRECATION_STOP

Loading…
Cancel
Save