@ -73,7 +73,7 @@ const char* TcParser::GenericFallbackLite(PROTOBUF_TC_PARAM_DECL) {
// Core fast parsing implementation:
// Core fast parsing implementation:
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
PROTOBUF_NO INLINE const char * TcParser : : ParseLoop (
inline PROTOBUF_ALWAYS_ INLINE const char * TcParser : : ParseLoopInlined (
MessageLite * msg , const char * ptr , ParseContext * ctx ,
MessageLite * msg , const char * ptr , ParseContext * ctx ,
const TcParseTableBase * table ) {
const TcParseTableBase * table ) {
// Note: TagDispatch uses a dispatch table at "&table->fast_entries".
// Note: TagDispatch uses a dispatch table at "&table->fast_entries".
@ -98,6 +98,12 @@ PROTOBUF_NOINLINE const char* TcParser::ParseLoop(
return ptr ;
return ptr ;
}
}
PROTOBUF_NOINLINE const char * TcParser : : ParseLoop (
MessageLite * msg , const char * ptr , ParseContext * ctx ,
const TcParseTableBase * table ) {
return ParseLoopInlined ( msg , ptr , ctx , table ) ;
}
// On the fast path, a (matching) 1-byte tag already has the decoded value.
// On the fast path, a (matching) 1-byte tag already has the decoded value.
static uint32_t FastDecodeTag ( uint8_t coded_tag ) {
static uint32_t FastDecodeTag ( uint8_t coded_tag ) {
return coded_tag ;
return coded_tag ;
@ -387,11 +393,12 @@ inline PROTOBUF_ALWAYS_INLINE const char* TcParser::SingularParseMessageAuxImpl(
if ( field = = nullptr ) {
if ( field = = nullptr ) {
field = inner_table - > default_instance - > New ( msg - > GetArena ( ) ) ;
field = inner_table - > default_instance - > New ( msg - > GetArena ( ) ) ;
}
}
if ( group_coding ) {
const auto inner_loop = [ & ] ( const char * ptr ) {
return ctx - > ParseGroup < TcParser > ( field , ptr , FastDecodeTag ( saved_tag ) ,
return ParseLoopInlined ( field , ptr , ctx , inner_table ) ;
inner_table ) ;
} ;
}
return group_coding ? ctx - > ParseGroupInlined ( ptr , FastDecodeTag ( saved_tag ) ,
return ctx - > ParseMessage < TcParser > ( field , ptr , inner_table ) ;
inner_loop )
: ctx - > ParseLengthDelimitedInlined ( ptr , inner_loop ) ;
} else {
} else {
if ( field = = nullptr ) {
if ( field = = nullptr ) {
const MessageLite * default_instance =
const MessageLite * default_instance =
@ -474,12 +481,12 @@ inline PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedParseMessageAuxImpl(
ptr + = sizeof ( TagType ) ;
ptr + = sizeof ( TagType ) ;
MessageLite * submsg = field . AddMessage ( default_instance ) ;
MessageLite * submsg = field . AddMessage ( default_instance ) ;
if ( aux_is_table ) {
if ( aux_is_table ) {
if ( group_coding ) {
const auto inner_loop = [ & ] ( const char * ptr ) {
ptr = ctx - > ParseGroup < TcParser > ( submsg , ptr ,
return ParseLoopInlined ( submsg , ptr , ctx , aux . table ) ;
FastDecodeTag ( expected_tag ) , aux . table ) ;
} ;
} else {
ptr = group_coding ? ctx - > ParseGroupInlined (
ptr = ctx - > ParseMessage < TcParser > ( submsg , ptr , aux . table ) ;
ptr , FastDecodeTag ( expected_tag ) , inner_loop )
}
: ctx - > ParseLengthDelimitedInlined ( ptr , inner_loop ) ;
} else {
} else {
if ( group_coding ) {
if ( group_coding ) {
ptr = ctx - > ParseGroup ( submsg , ptr , FastDecodeTag ( expected_tag ) ) ;
ptr = ctx - > ParseGroup ( submsg , ptr , FastDecodeTag ( expected_tag ) ) ;
@ -2369,10 +2376,11 @@ PROTOBUF_NOINLINE const char* TcParser::MpMessage(PROTOBUF_TC_PARAM_DECL) {
if ( need_init | | field = = nullptr ) {
if ( need_init | | field = = nullptr ) {
field = inner_table - > default_instance - > New ( msg - > GetArena ( ) ) ;
field = inner_table - > default_instance - > New ( msg - > GetArena ( ) ) ;
}
}
if ( is_group ) {
const auto inner_loop = [ & ] ( const char * ptr ) {
return ctx - > ParseGroup < TcParser > ( field , ptr , decoded_tag , inner_table ) ;
return ParseLoop ( field , ptr , ctx , inner_table ) ;
}
} ;
return ctx - > ParseMessage < TcParser > ( field , ptr , inner_table ) ;
return is_group ? ctx - > ParseGroupInlined ( ptr , decoded_tag , inner_loop )
: ctx - > ParseLengthDelimitedInlined ( ptr , inner_loop ) ;
} else {
} else {
if ( need_init | | field = = nullptr ) {
if ( need_init | | field = = nullptr ) {
const MessageLite * def ;
const MessageLite * def ;
@ -2428,9 +2436,11 @@ const char* TcParser::MpRepeatedMessageOrGroup(PROTOBUF_TC_PARAM_DECL) {
uint32_t next_tag ;
uint32_t next_tag ;
do {
do {
MessageLite * value = field . AddMessage ( default_instance ) ;
MessageLite * value = field . AddMessage ( default_instance ) ;
ptr = is_group ? ctx - > ParseGroup < TcParser > ( value , ptr2 , decoded_tag ,
const auto inner_loop = [ & ] ( const char * ptr ) {
inner_table )
return ParseLoop ( value , ptr , ctx , inner_table ) ;
: ctx - > ParseMessage < TcParser > ( value , ptr2 , inner_table ) ;
} ;
ptr = is_group ? ctx - > ParseGroupInlined ( ptr2 , decoded_tag , inner_loop )
: ctx - > ParseLengthDelimitedInlined ( ptr2 , inner_loop ) ;
if ( PROTOBUF_PREDICT_FALSE ( ptr = = nullptr ) ) goto error ;
if ( PROTOBUF_PREDICT_FALSE ( ptr = = nullptr ) ) goto error ;
if ( PROTOBUF_PREDICT_FALSE ( ! ctx - > DataAvailable ( ptr ) ) ) goto parse_loop ;
if ( PROTOBUF_PREDICT_FALSE ( ! ctx - > DataAvailable ( ptr ) ) ) goto parse_loop ;
ptr2 = ReadTag ( ptr , & next_tag ) ;
ptr2 = ReadTag ( ptr , & next_tag ) ;