Auto-generate files after cl/584380544

pull/14698/head
Protobuf Team Bot 1 year ago
parent a49f6b8ea0
commit c80260904f
  1. 6
      php/ext/google/protobuf/php-upb.c
  2. 149
      php/ext/google/protobuf/php-upb.h
  3. 6
      ruby/ext/google/protobuf_c/ruby-upb.c
  4. 149
      ruby/ext/google/protobuf_c/ruby-upb.h

@ -6044,7 +6044,7 @@ upb_Array* upb_Array_DeepClone(const upb_Array* array, upb_CType value_type,
const upb_MiniTable* sub, upb_Arena* arena) {
size_t size = array->size;
upb_Array* cloned_array =
_upb_Array_New(arena, size, upb_SizeLog2_CType(value_type));
_upb_Array_New(arena, size, upb_CType_SizeLg2(value_type));
if (!cloned_array) {
return NULL;
}
@ -6218,7 +6218,7 @@ upb_Message* upb_Message_DeepClone(const upb_Message* message,
// Must be last.
upb_Array* upb_Array_New(upb_Arena* a, upb_CType type) {
return _upb_Array_New(a, 4, upb_SizeLog2_CType(type));
return _upb_Array_New(a, 4, upb_CType_SizeLg2(type));
}
const void* upb_Array_DataPtr(const upb_Array* arr) {
@ -12992,7 +12992,7 @@ static const char* _upb_Decoder_DecodeEnumPacked(
upb_Array* _upb_Decoder_CreateArray(upb_Decoder* d,
const upb_MiniTableField* field) {
const upb_FieldType field_type = field->UPB_PRIVATE(descriptortype);
const size_t lg2 = upb_SizeLog2_FieldType(field_type);
const size_t lg2 = upb_FieldType_SizeLg2(field_type);
upb_Array* ret = _upb_Array_New(&d->arena, 4, lg2);
if (!ret) _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory);
return ret;

@ -1001,9 +1001,77 @@ UPB_INLINE bool upb_MiniTableEnum_CheckValue(const upb_MiniTableEnum* e,
#ifndef UPB_MINI_TABLE_INTERNAL_FIELD_H_
#define UPB_MINI_TABLE_INTERNAL_FIELD_H_
#include <stddef.h>
#include <stdint.h>
#ifndef UPB_MINI_TABLE_INTERNAL_SIZE_LOG2_H_
#define UPB_MINI_TABLE_INTERNAL_SIZE_LOG2_H_
#include <stddef.h>
#include <stdint.h>
// Must be last.
#ifdef __cplusplus
extern "C" {
#endif
// Return the log2 of the storage size in bytes for a upb_CType
UPB_INLINE int upb_CType_SizeLg2(upb_CType c_type) {
static const int8_t size[] = {
0, // kUpb_CType_Bool
2, // kUpb_CType_Float
2, // kUpb_CType_Int32
2, // kUpb_CType_UInt32
2, // kUpb_CType_Enum
UPB_SIZE(2, 3), // kUpb_CType_Message
3, // kUpb_CType_Double
3, // kUpb_CType_Int64
3, // kUpb_CType_UInt64
UPB_SIZE(3, 4), // kUpb_CType_String
UPB_SIZE(3, 4), // kUpb_CType_Bytes
};
// -1 here because the enum is one-based but the table is zero-based.
return size[c_type - 1];
}
// Return the log2 of the storage size in bytes for a upb_FieldType
UPB_INLINE int upb_FieldType_SizeLg2(upb_FieldType field_type) {
static const int8_t size[] = {
3, // kUpb_FieldType_Double
2, // kUpb_FieldType_Float
3, // kUpb_FieldType_Int64
3, // kUpb_FieldType_UInt64
2, // kUpb_FieldType_Int32
3, // kUpb_FieldType_Fixed64
2, // kUpb_FieldType_Fixed32
0, // kUpb_FieldType_Bool
UPB_SIZE(3, 4), // kUpb_FieldType_String
UPB_SIZE(2, 3), // kUpb_FieldType_Group
UPB_SIZE(2, 3), // kUpb_FieldType_Message
UPB_SIZE(3, 4), // kUpb_FieldType_Bytes
2, // kUpb_FieldType_UInt32
2, // kUpb_FieldType_Enum
2, // kUpb_FieldType_SFixed32
3, // kUpb_FieldType_SFixed64
2, // kUpb_FieldType_SInt32
3, // kUpb_FieldType_SInt64
};
// -1 here because the enum is one-based but the table is zero-based.
return size[field_type - 1];
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* UPB_MINI_TABLE_INTERNAL_SIZE_LOG2_H_ */
// Must be last.
struct upb_MiniTableField {
@ -1086,6 +1154,12 @@ UPB_INLINE void _upb_MiniTableField_CheckIsMap(
UPB_ASSUME(field->presence == 0);
}
UPB_INLINE size_t
_upb_MiniTableField_ElemSizeLg2(const struct upb_MiniTableField* field) {
return upb_FieldType_SizeLg2(
(upb_FieldType)field->UPB_PRIVATE(descriptortype));
}
#ifdef __cplusplus
} /* extern "C" */
#endif
@ -2153,73 +2227,6 @@ bool _upb_Message_AddUnknown(upb_Message* msg, const char* data, size_t len,
#endif /* UPB_MESSAGE_INTERNAL_H_ */
#ifndef UPB_MESSAGE_INTERNAL_SIZE_LOG2_H_
#define UPB_MESSAGE_INTERNAL_SIZE_LOG2_H_
#include <stddef.h>
#include <stdint.h>
// Must be last.
#ifdef __cplusplus
extern "C" {
#endif
// Return the log2 of the storage size in bytes for a upb_CType
UPB_INLINE int upb_SizeLog2_CType(upb_CType c_type) {
static const int8_t size[] = {
0, // kUpb_CType_Bool
2, // kUpb_CType_Float
2, // kUpb_CType_Int32
2, // kUpb_CType_UInt32
2, // kUpb_CType_Enum
UPB_SIZE(2, 3), // kUpb_CType_Message
3, // kUpb_CType_Double
3, // kUpb_CType_Int64
3, // kUpb_CType_UInt64
UPB_SIZE(3, 4), // kUpb_CType_String
UPB_SIZE(3, 4), // kUpb_CType_Bytes
};
// -1 here because the enum is one-based but the table is zero-based.
return size[c_type - 1];
}
// Return the log2 of the storage size in bytes for a upb_FieldType
UPB_INLINE int upb_SizeLog2_FieldType(upb_FieldType field_type) {
static const int8_t size[] = {
3, // kUpb_FieldType_Double
2, // kUpb_FieldType_Float
3, // kUpb_FieldType_Int64
3, // kUpb_FieldType_UInt64
2, // kUpb_FieldType_Int32
3, // kUpb_FieldType_Fixed64
2, // kUpb_FieldType_Fixed32
0, // kUpb_FieldType_Bool
UPB_SIZE(3, 4), // kUpb_FieldType_String
UPB_SIZE(2, 3), // kUpb_FieldType_Group
UPB_SIZE(2, 3), // kUpb_FieldType_Message
UPB_SIZE(3, 4), // kUpb_FieldType_Bytes
2, // kUpb_FieldType_UInt32
2, // kUpb_FieldType_Enum
2, // kUpb_FieldType_SFixed32
3, // kUpb_FieldType_SFixed64
2, // kUpb_FieldType_SInt32
3, // kUpb_FieldType_SInt64
};
// -1 here because the enum is one-based but the table is zero-based.
return size[field_type - 1];
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* UPB_MESSAGE_INTERNAL_SIZE_LOG2_H_ */
// Must be last.
#if defined(__GNUC__) && !defined(__clang__)
@ -2376,12 +2383,6 @@ UPB_INLINE void _upb_MiniTable_CopyFieldData(void* to, const void* from,
UPB_UNREACHABLE();
}
UPB_INLINE size_t
_upb_MiniTable_ElementSizeLg2(const upb_MiniTableField* field) {
return upb_SizeLog2_FieldType(
(upb_FieldType)field->UPB_PRIVATE(descriptortype));
}
// Here we define universal getter/setter functions for message fields.
// These look very branchy and inefficient, but as long as the MiniTableField
// values are known at compile time, all the branches are optimized away and
@ -3032,7 +3033,7 @@ UPB_API_INLINE upb_Array* upb_Message_GetOrCreateMutableArray(
_upb_MiniTableField_CheckIsArray(field);
upb_Array* array = upb_Message_GetMutableArray(msg, field);
if (!array) {
array = _upb_Array_New(arena, 4, _upb_MiniTable_ElementSizeLg2(field));
array = _upb_Array_New(arena, 4, _upb_MiniTableField_ElemSizeLg2(field));
// Check again due to: https://godbolt.org/z/7WfaoKG1r
_upb_MiniTableField_CheckIsArray(field);
upb_MessageValue val;

@ -5559,7 +5559,7 @@ upb_Array* upb_Array_DeepClone(const upb_Array* array, upb_CType value_type,
const upb_MiniTable* sub, upb_Arena* arena) {
size_t size = array->size;
upb_Array* cloned_array =
_upb_Array_New(arena, size, upb_SizeLog2_CType(value_type));
_upb_Array_New(arena, size, upb_CType_SizeLg2(value_type));
if (!cloned_array) {
return NULL;
}
@ -5733,7 +5733,7 @@ upb_Message* upb_Message_DeepClone(const upb_Message* message,
// Must be last.
upb_Array* upb_Array_New(upb_Arena* a, upb_CType type) {
return _upb_Array_New(a, 4, upb_SizeLog2_CType(type));
return _upb_Array_New(a, 4, upb_CType_SizeLg2(type));
}
const void* upb_Array_DataPtr(const upb_Array* arr) {
@ -12507,7 +12507,7 @@ static const char* _upb_Decoder_DecodeEnumPacked(
upb_Array* _upb_Decoder_CreateArray(upb_Decoder* d,
const upb_MiniTableField* field) {
const upb_FieldType field_type = field->UPB_PRIVATE(descriptortype);
const size_t lg2 = upb_SizeLog2_FieldType(field_type);
const size_t lg2 = upb_FieldType_SizeLg2(field_type);
upb_Array* ret = _upb_Array_New(&d->arena, 4, lg2);
if (!ret) _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory);
return ret;

@ -1003,9 +1003,77 @@ UPB_INLINE bool upb_MiniTableEnum_CheckValue(const upb_MiniTableEnum* e,
#ifndef UPB_MINI_TABLE_INTERNAL_FIELD_H_
#define UPB_MINI_TABLE_INTERNAL_FIELD_H_
#include <stddef.h>
#include <stdint.h>
#ifndef UPB_MINI_TABLE_INTERNAL_SIZE_LOG2_H_
#define UPB_MINI_TABLE_INTERNAL_SIZE_LOG2_H_
#include <stddef.h>
#include <stdint.h>
// Must be last.
#ifdef __cplusplus
extern "C" {
#endif
// Return the log2 of the storage size in bytes for a upb_CType
UPB_INLINE int upb_CType_SizeLg2(upb_CType c_type) {
static const int8_t size[] = {
0, // kUpb_CType_Bool
2, // kUpb_CType_Float
2, // kUpb_CType_Int32
2, // kUpb_CType_UInt32
2, // kUpb_CType_Enum
UPB_SIZE(2, 3), // kUpb_CType_Message
3, // kUpb_CType_Double
3, // kUpb_CType_Int64
3, // kUpb_CType_UInt64
UPB_SIZE(3, 4), // kUpb_CType_String
UPB_SIZE(3, 4), // kUpb_CType_Bytes
};
// -1 here because the enum is one-based but the table is zero-based.
return size[c_type - 1];
}
// Return the log2 of the storage size in bytes for a upb_FieldType
UPB_INLINE int upb_FieldType_SizeLg2(upb_FieldType field_type) {
static const int8_t size[] = {
3, // kUpb_FieldType_Double
2, // kUpb_FieldType_Float
3, // kUpb_FieldType_Int64
3, // kUpb_FieldType_UInt64
2, // kUpb_FieldType_Int32
3, // kUpb_FieldType_Fixed64
2, // kUpb_FieldType_Fixed32
0, // kUpb_FieldType_Bool
UPB_SIZE(3, 4), // kUpb_FieldType_String
UPB_SIZE(2, 3), // kUpb_FieldType_Group
UPB_SIZE(2, 3), // kUpb_FieldType_Message
UPB_SIZE(3, 4), // kUpb_FieldType_Bytes
2, // kUpb_FieldType_UInt32
2, // kUpb_FieldType_Enum
2, // kUpb_FieldType_SFixed32
3, // kUpb_FieldType_SFixed64
2, // kUpb_FieldType_SInt32
3, // kUpb_FieldType_SInt64
};
// -1 here because the enum is one-based but the table is zero-based.
return size[field_type - 1];
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* UPB_MINI_TABLE_INTERNAL_SIZE_LOG2_H_ */
// Must be last.
struct upb_MiniTableField {
@ -1088,6 +1156,12 @@ UPB_INLINE void _upb_MiniTableField_CheckIsMap(
UPB_ASSUME(field->presence == 0);
}
UPB_INLINE size_t
_upb_MiniTableField_ElemSizeLg2(const struct upb_MiniTableField* field) {
return upb_FieldType_SizeLg2(
(upb_FieldType)field->UPB_PRIVATE(descriptortype));
}
#ifdef __cplusplus
} /* extern "C" */
#endif
@ -2155,73 +2229,6 @@ bool _upb_Message_AddUnknown(upb_Message* msg, const char* data, size_t len,
#endif /* UPB_MESSAGE_INTERNAL_H_ */
#ifndef UPB_MESSAGE_INTERNAL_SIZE_LOG2_H_
#define UPB_MESSAGE_INTERNAL_SIZE_LOG2_H_
#include <stddef.h>
#include <stdint.h>
// Must be last.
#ifdef __cplusplus
extern "C" {
#endif
// Return the log2 of the storage size in bytes for a upb_CType
UPB_INLINE int upb_SizeLog2_CType(upb_CType c_type) {
static const int8_t size[] = {
0, // kUpb_CType_Bool
2, // kUpb_CType_Float
2, // kUpb_CType_Int32
2, // kUpb_CType_UInt32
2, // kUpb_CType_Enum
UPB_SIZE(2, 3), // kUpb_CType_Message
3, // kUpb_CType_Double
3, // kUpb_CType_Int64
3, // kUpb_CType_UInt64
UPB_SIZE(3, 4), // kUpb_CType_String
UPB_SIZE(3, 4), // kUpb_CType_Bytes
};
// -1 here because the enum is one-based but the table is zero-based.
return size[c_type - 1];
}
// Return the log2 of the storage size in bytes for a upb_FieldType
UPB_INLINE int upb_SizeLog2_FieldType(upb_FieldType field_type) {
static const int8_t size[] = {
3, // kUpb_FieldType_Double
2, // kUpb_FieldType_Float
3, // kUpb_FieldType_Int64
3, // kUpb_FieldType_UInt64
2, // kUpb_FieldType_Int32
3, // kUpb_FieldType_Fixed64
2, // kUpb_FieldType_Fixed32
0, // kUpb_FieldType_Bool
UPB_SIZE(3, 4), // kUpb_FieldType_String
UPB_SIZE(2, 3), // kUpb_FieldType_Group
UPB_SIZE(2, 3), // kUpb_FieldType_Message
UPB_SIZE(3, 4), // kUpb_FieldType_Bytes
2, // kUpb_FieldType_UInt32
2, // kUpb_FieldType_Enum
2, // kUpb_FieldType_SFixed32
3, // kUpb_FieldType_SFixed64
2, // kUpb_FieldType_SInt32
3, // kUpb_FieldType_SInt64
};
// -1 here because the enum is one-based but the table is zero-based.
return size[field_type - 1];
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* UPB_MESSAGE_INTERNAL_SIZE_LOG2_H_ */
// Must be last.
#if defined(__GNUC__) && !defined(__clang__)
@ -2378,12 +2385,6 @@ UPB_INLINE void _upb_MiniTable_CopyFieldData(void* to, const void* from,
UPB_UNREACHABLE();
}
UPB_INLINE size_t
_upb_MiniTable_ElementSizeLg2(const upb_MiniTableField* field) {
return upb_SizeLog2_FieldType(
(upb_FieldType)field->UPB_PRIVATE(descriptortype));
}
// Here we define universal getter/setter functions for message fields.
// These look very branchy and inefficient, but as long as the MiniTableField
// values are known at compile time, all the branches are optimized away and
@ -3034,7 +3035,7 @@ UPB_API_INLINE upb_Array* upb_Message_GetOrCreateMutableArray(
_upb_MiniTableField_CheckIsArray(field);
upb_Array* array = upb_Message_GetMutableArray(msg, field);
if (!array) {
array = _upb_Array_New(arena, 4, _upb_MiniTable_ElementSizeLg2(field));
array = _upb_Array_New(arena, 4, _upb_MiniTableField_ElemSizeLg2(field));
// Check again due to: https://godbolt.org/z/7WfaoKG1r
_upb_MiniTableField_CheckIsArray(field);
upb_MessageValue val;

Loading…
Cancel
Save