|
|
|
@ -425,7 +425,6 @@ inline PROTOBUF_ALWAYS_INLINE const char* TcParser::SingularParseMessageAuxImpl( |
|
|
|
|
if (aux_is_table) { |
|
|
|
|
const auto* inner_table = table->field_aux(data.aux_idx())->table; |
|
|
|
|
if (field == nullptr) { |
|
|
|
|
ABSL_DCHECK(CanUseDefaultInstanceForNew()); |
|
|
|
|
field = inner_table->default_instance->New(msg->GetArenaForAllocation()); |
|
|
|
|
} |
|
|
|
|
if (group_coding) { |
|
|
|
@ -435,8 +434,9 @@ inline PROTOBUF_ALWAYS_INLINE const char* TcParser::SingularParseMessageAuxImpl( |
|
|
|
|
return ctx->ParseMessage<TcParser>(field, ptr, inner_table); |
|
|
|
|
} else { |
|
|
|
|
if (field == nullptr) { |
|
|
|
|
field = NewMessage(msg->GetArenaForAllocation(), |
|
|
|
|
*table->field_aux(data.aux_idx())); |
|
|
|
|
const MessageLite* default_instance = |
|
|
|
|
table->field_aux(data.aux_idx())->message_default(); |
|
|
|
|
field = default_instance->New(msg->GetArenaForAllocation()); |
|
|
|
|
} |
|
|
|
|
if (group_coding) { |
|
|
|
|
return ctx->ParseGroup(field, ptr, FastDecodeTag(saved_tag)); |
|
|
|
@ -510,10 +510,9 @@ inline PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedParseMessageAuxImpl( |
|
|
|
|
auto& field = RefAt<RepeatedPtrFieldBase>(msg, data.offset()); |
|
|
|
|
do { |
|
|
|
|
ptr += sizeof(TagType); |
|
|
|
|
MessageLite* submsg = field.Add<GenericTypeHandler<MessageLite>>( |
|
|
|
|
aux_is_table ? aux.table->default_instance : aux.message_default()); |
|
|
|
|
if (aux_is_table) { |
|
|
|
|
ABSL_DCHECK(CanUseDefaultInstanceForNew()); |
|
|
|
|
MessageLite* submsg = field.Add<GenericTypeHandler<MessageLite>>( |
|
|
|
|
aux.table->default_instance); |
|
|
|
|
if (group_coding) { |
|
|
|
|
ptr = ctx->ParseGroup<TcParser>(submsg, ptr, |
|
|
|
|
FastDecodeTag(expected_tag), aux.table); |
|
|
|
@ -521,7 +520,6 @@ inline PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedParseMessageAuxImpl( |
|
|
|
|
ptr = ctx->ParseMessage<TcParser>(submsg, ptr, aux.table); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
MessageLite* submsg = AddMessage(field, aux); |
|
|
|
|
if (group_coding) { |
|
|
|
|
ptr = ctx->ParseGroup(submsg, ptr, FastDecodeTag(expected_tag)); |
|
|
|
|
} else { |
|
|
|
@ -1743,7 +1741,6 @@ void* TcParser::MaybeGetSplitBase(MessageLite* msg, const bool is_split, |
|
|
|
|
void* out = msg; |
|
|
|
|
if (is_split) { |
|
|
|
|
const uint32_t split_offset = GetSplitOffset(table); |
|
|
|
|
ABSL_DCHECK(CanUseDefaultInstanceForNew()); |
|
|
|
|
void* default_split = |
|
|
|
|
TcParser::RefAt<void*>(table->default_instance, split_offset); |
|
|
|
|
void*& split = TcParser::RefAt<void*>(msg, split_offset); |
|
|
|
@ -2113,27 +2110,6 @@ bool TcParser::MpVerifyUtf8(const absl::Cord& wire_bytes, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
PROTOBUF_ALWAYS_INLINE MessageLite* TcParser::AddMessage( |
|
|
|
|
RepeatedPtrFieldBase& field, TcParseTableBase::FieldAux aux) { |
|
|
|
|
if (CanUseDefaultInstanceForNew()) { |
|
|
|
|
return field.Add<GenericTypeHandler<MessageLite>>(aux.message_default()); |
|
|
|
|
} else { |
|
|
|
|
MessageLite* value = |
|
|
|
|
field.AddFromCleared<GenericTypeHandler<MessageLite>>(); |
|
|
|
|
if (value == nullptr) { |
|
|
|
|
value = aux.creator(field.GetArena()); |
|
|
|
|
field.AddAllocated<GenericTypeHandler<MessageLite>>(value); |
|
|
|
|
} |
|
|
|
|
return value; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
PROTOBUF_ALWAYS_INLINE MessageLite* TcParser::NewMessage( |
|
|
|
|
Arena* arena, TcParseTableBase::FieldAux aux) { |
|
|
|
|
return CanUseDefaultInstanceForNew() ? aux.message_default()->New(arena) |
|
|
|
|
: aux.creator(arena); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <bool is_split> |
|
|
|
|
PROTOBUF_NOINLINE const char* TcParser::MpString(PROTOBUF_TC_PARAM_DECL) { |
|
|
|
|
const auto& entry = RefAt<FieldEntry>(table, data.entry_offset()); |
|
|
|
@ -2334,7 +2310,6 @@ PROTOBUF_NOINLINE const char* TcParser::MpMessage(PROTOBUF_TC_PARAM_DECL) { |
|
|
|
|
if ((type_card & field_layout::kTvMask) == field_layout::kTvTable) { |
|
|
|
|
auto* inner_table = table->field_aux(&entry)->table; |
|
|
|
|
if (need_init || field == nullptr) { |
|
|
|
|
ABSL_DCHECK(CanUseDefaultInstanceForNew()); |
|
|
|
|
field = inner_table->default_instance->New(msg->GetArenaForAllocation()); |
|
|
|
|
} |
|
|
|
|
if (is_group) { |
|
|
|
@ -2343,15 +2318,15 @@ PROTOBUF_NOINLINE const char* TcParser::MpMessage(PROTOBUF_TC_PARAM_DECL) { |
|
|
|
|
return ctx->ParseMessage<TcParser>(field, ptr, inner_table); |
|
|
|
|
} else { |
|
|
|
|
if (need_init || field == nullptr) { |
|
|
|
|
const MessageLite* def; |
|
|
|
|
if ((type_card & field_layout::kTvMask) == field_layout::kTvDefault) { |
|
|
|
|
field = |
|
|
|
|
NewMessage(msg->GetArenaForAllocation(), *table->field_aux(&entry)); |
|
|
|
|
def = table->field_aux(&entry)->message_default(); |
|
|
|
|
} else { |
|
|
|
|
ABSL_DCHECK_EQ(type_card & field_layout::kTvMask, |
|
|
|
|
+field_layout::kTvWeakPtr); |
|
|
|
|
field = table->field_aux(&entry)->message_default_weak()->New( |
|
|
|
|
msg->GetArenaForAllocation()); |
|
|
|
|
def = table->field_aux(&entry)->message_default_weak(); |
|
|
|
|
} |
|
|
|
|
field = def->New(msg->GetArenaForAllocation()); |
|
|
|
|
} |
|
|
|
|
if (is_group) { |
|
|
|
|
return ctx->ParseGroup(field, ptr, decoded_tag); |
|
|
|
@ -2400,15 +2375,15 @@ const char* TcParser::MpRepeatedMessage(PROTOBUF_TC_PARAM_DECL) { |
|
|
|
|
} |
|
|
|
|
return ctx->ParseMessage<TcParser>(value, ptr, inner_table); |
|
|
|
|
} else { |
|
|
|
|
MessageLite* value; |
|
|
|
|
const MessageLite* def; |
|
|
|
|
if ((type_card & field_layout::kTvMask) == field_layout::kTvDefault) { |
|
|
|
|
value = AddMessage(field, aux); |
|
|
|
|
def = aux.message_default(); |
|
|
|
|
} else { |
|
|
|
|
ABSL_DCHECK_EQ(type_card & field_layout::kTvMask, |
|
|
|
|
+field_layout::kTvWeakPtr); |
|
|
|
|
value = field.Add<GenericTypeHandler<MessageLite>>( |
|
|
|
|
aux.message_default_weak()); |
|
|
|
|
def = aux.message_default_weak(); |
|
|
|
|
} |
|
|
|
|
MessageLite* value = field.Add<GenericTypeHandler<MessageLite>>(def); |
|
|
|
|
if (is_group) { |
|
|
|
|
return ctx->ParseGroup(value, ptr, decoded_tag); |
|
|
|
|
} |
|
|
|
|