Protobuf Team Bot
d3ec4b63c9
Add Parse/Serialize templates to support shared_ptr/unique_ptr.
...
Fix UBSAN in _upb_Message_Clear due to unsigned UPB_PTR_AT
PiperOrigin-RevId: 489007182
2 years ago
Eric Salo
ff8e1b40ba
create base/ subdir and expand :status build target to :base
...
upb.h is now just a temporary stub
PiperOrigin-RevId: 488255988
2 years ago
Eric Salo
75907f7af9
rename the upb_MiniTable subtypes to follow the upb style guide:
...
upb_MiniTable_Enum -> upb_MiniTableEnum
upb_MiniTable_Extension -> upb_MiniTableExtension
upb_MiniTable_Field -> upb_MiniTableField
upb_MiniTable_File -> upb_MiniTableFile
upb_MiniTable_Sub -> upb_MiniTableSub
PiperOrigin-RevId: 486712960
2 years ago
Eric Salo
f6307877d3
move portability stuff into upb/port/
...
Also delete redundant system #includes that are already pulled in by port/def.inc
PiperOrigin-RevId: 486398989
2 years ago
Eric Salo
fd040a8bff
create collections/map_internal.h and collections/map_gencode_util.h
...
Move the map-related functions from msg_internal.h that are only used in generated code into map_gencode_util.h. Then move the rest of the map-related functions from msg_internal.h into map_internal.h.
PiperOrigin-RevId: 486299140
2 years ago
Eric Salo
41335a03be
normalize upb_Message_New()
...
We had _upb_Message_New(), which created a message from a mini table and was
being used outside of upb even though it is an internal-only function.
We also had upb_Message_New(), which created a message from a message def.
Now there is a single public function, upb_Message_New(), which creates a
message from a mini table and covers all use cases. (The internal version has the same definition and is used for inlining.)
PiperOrigin-RevId: 480169804
2 years ago
Protobuf Team Bot
aabb2b62ae
Add upb_Message_DeleteUnknown API.
...
Add test proto.
PiperOrigin-RevId: 479178356
2 years ago
Eric Salo
259183b1f0
split out the mapsorter functions into their own .c & .h
...
also refactor _upb_mapsorter_push() to use a static table instead of a switch()
PiperOrigin-RevId: 478408815
2 years ago
Protobuf Team Bot
ce32d9d68f
Fix code generation for infinity default value on float/double fields.
...
PiperOrigin-RevId: 469843901
2 years ago
Protobuf Team Bot
8c44f04697
create and lock down upb/internal/array.h
...
Internal array functions are now implemented in upb/internal/array.c and declared in
upb/internal/array.h, which only has local visibility.
PiperOrigin-RevId: 458260144
2 years ago
Protobuf Team Bot
1695cb2788
rename the upb_Array 'len' field as 'size'
...
Now that 'size' has been renamed as 'capacity' we are free to rename 'len' as
'size', so upb_Array_Size() is actually returning the 'size' field.
PiperOrigin-RevId: 456865972
2 years ago
Protobuf Team Bot
83f4988561
rename the upb_Array 'size' field as 'capacity'
...
The current field/function names for upb_Array are quite confusing.
We will fix them in two steps, this being the first step.
PiperOrigin-RevId: 456687224
2 years ago
Protobuf Team Bot
e4635f223e
match file names to type names
...
Lots of changes but it's all just moving things around.
Backward-compatible stub #include's have been provided for now.
upb_Arena/upb_Status have been split out from upb/upb.?
upb_Array/upb_Map/upb_MessageValue have been split out from upb/collections.?
upb_ExtensionRegistry has been split out from upb/msg.?
upb/decode_internal.h is now upb/internal/decode.h
upb/mini_table_accessors_internal.h is now upb/internal/mini_table_accessors.h
upb/table_internal.h is now upb/internal/table.h
upb/upb_internal.h is now upb/internal/upb.h
PiperOrigin-RevId: 456297617
2 years ago
Joshua Haberman
76c7ca9327
Updated API for accessing extensions.
...
PiperOrigin-RevId: 442947856
3 years ago
Protobuf Team
e1e7435e70
Internal change
...
PiperOrigin-RevId: 440796832
3 years ago
Joshua Haberman
9cc02bb60d
Rewrote the MessageSet parsing code in the upb decoder to properly handle several edge cases.
...
PiperOrigin-RevId: 440788402
3 years ago
Joshua Haberman
7c4d12e856
Addressed PR comments.
3 years ago
Joshua Haberman
5dfbc684dd
WIP.
3 years ago
Joshua Haberman
606308c639
Added back missing underscore.
3 years ago
Joshua Haberman
75b6291e40
Renamed upb_FieldType_* -> kUpb_FieldType_*
3 years ago
Joshua Haberman
499c2cc8b1
upb_extreg, upb_msg
3 years ago
Joshua Haberman
1c955f37ce
Mass API rename and clang-reformat ( #485 )
...
* Wave 1: upb_fielddef.
* upb_fielddef itself.
* upb_oneofdef.
* upb_msgdef.
* ExtensionRange.
* upb_enumdef
* upb_enumvaldef
* upb_filedef
* upb_methoddef
* upb_servicedef
* upb_symtab
* upb_defpool_init
* upb_wellknown and upb_syntax_t
* Some constants.
* upb_status
* upb_strview
* upb_arena
* upb.h constants
* reflection
* encode
* JSON decode.
* json encode.
* msg_internal.
* Formatted with clang-format.
* Some naming fixups and comment reformatting.
* More refinements.
* A few more stragglers.
* Fixed PyObject_HEAD with semicolon. Removed TODO entries.
3 years ago
Joshua Haberman
de2d7e345b
Addressed PR comments.
3 years ago
Joshua Haberman
5b3447ebd3
Addressed PR comments.
3 years ago
Joshua Haberman
1437245d41
Fixed or accounted for nearly all errors in message_test.
3 years ago
Joshua Haberman
627c44be1f
Initial commit of ExtensionDict.
3 years ago
Joshua Haberman
1c46e72eee
Addressed PR comments.
3 years ago
Joshua Haberman
bf74b3e7fd
Added map support.
3 years ago
Joshua Haberman
7576a3bfc1
Avoid NULL + 0 when adding a list of 0 extensions.
3 years ago
Joshua Haberman
3d437bbcab
Some pre-PR fixes.
3 years ago
Joshua Haberman
b1bbbdd4e7
Addressed PR comments.
3 years ago
Joshua Haberman
ce012b7b55
Added support for extensions.
3 years ago
Joshua Haberman
897bd2500a
Fixed compile error.
4 years ago
Joshua Haberman
6e53de4a03
Addressed PR comments.
4 years ago
Joshua Haberman
cdd6434a31
Introduced upb_extreg and plumbed it into decoder.
4 years ago
Joshua Haberman
3f8aa6ef20
Define the extension representation in messages and mini-tables.
...
Nothing reads or writes this data yet, but we do implement the
memory management that allows both unknown field data and extensions
to grow within the same pseudo-arena in a message. By making both
arrays grow towards each other, we avoid the need to reallocate them
separately.
4 years ago
Joshua Haberman
3881393907
Renamed .int.h to _internal.h, for greater clarity.
4 years ago
Joshua Haberman
823eb09694
Update all 2011 dates to 2021.
4 years ago
Joshua Haberman
e59d2c8fa7
Added license headers to all files.
4 years ago
Joshua Haberman
1674f28dd7
Put public message interface into msg.h and moved internal functions to msg.int.h.
4 years ago
Joshua Haberman
c358829c76
Now that handlers are gone, cleaned up table to use arenas exclusively.
...
Also cleaned up some cruft from table.
4 years ago
Joshua Haberman
a04627abc8
Added map sorting to binary and text encoders.
...
For the binary encoder, sorting is off by default.
For the text encoder, sorting is on by default.
Both defaults can be explicitly overridden.
This grows code size a bit. I think we could potentially
shave this (and other map-related code size) by having
the generated code inject a function pointer to the map-related
parsing/serialization code if maps are present.
FILE SIZE VM SIZE
-------------- --------------
+86% +1.07Ki +71% +768 upb/msg.c
[NEW] +391 [NEW] +344 _upb_mapsorter_pushmap
[NEW] +158 [NEW] +112 _upb_mapsorter_cmpstr
[NEW] +111 [NEW] +64 _upb_mapsorter_cmpbool
[NEW] +110 [NEW] +64 _upb_mapsorter_cmpi32
[NEW] +110 [NEW] +64 _upb_mapsorter_cmpi64
[NEW] +110 [NEW] +64 _upb_mapsorter_cmpu32
[NEW] +110 [NEW] +64 _upb_mapsorter_cmpu64
-3.6% -8 -4.3% -8 _upb_map_new
+9.5% +464 +9.2% +424 upb/text_encode.c
[NEW] +656 [NEW] +616 txtenc_mapentry
+15% +32 +20% +32 upb_text_encode
-20.1% -224 -20.7% -224 txtenc_msg
+5.7% +342 +5.3% +296 upb/encode.c
[NEW] +344 [NEW] +304 encode_mapentry
[NEW] +246 [NEW] +208 upb_encode_ex
[NEW] +41 [NEW] +16 upb_encode_ex.ch
+0.7% +8 +0.7% +8 encode_scalar
-1.0% -32 -1.0% -32 encode_message
[DEL] -38 [DEL] -16 upb_encode.ch
[DEL] -227 [DEL] -192 upb_encode
+2.0% +152 +2.2% +152 upb/decode.c
+44% +128 +44% +128 [section .rodata]
+3.4% +24 +3.4% +24 _GLOBAL_OFFSET_TABLE_
+0.6% +107 +0.3% +48 upb/def.c
[NEW] +100 [NEW] +48 upb_fielddef_descriptortype
+7.1% +7 [ = ] 0 upb_fielddef_defaultint32
+2.9% +24 +2.9% +24 [section .dynsym]
+1.2% +24 [ = ] 0 [section .symtab]
+3.2% +16 +3.2% +16 [section .plt]
[NEW] +16 [NEW] +16 memcmp@plt
+0.5% +16 +0.6% +16 tests/conformance_upb.c
+1.5% +16 +1.6% +16 DoTestIo
+0.1% +16 +0.1% +16 upb/json_decode.c
+0.4% +16 +0.4% +16 jsondec_wellknown
+3.0% +8 +3.0% +8 [section .got.plt]
+3.0% +8 +3.0% +8 _GLOBAL_OFFSET_TABLE_
+1.6% +7 +1.6% +7 [section .dynstr]
+1.8% +4 +1.8% +4 [section .hash]
+0.5% +3 +0.5% +3 [LOAD #2 [RX]]
+2.8% +2 +2.8% +2 [section .gnu.version]
-60.0% -1.74Ki [ = ] 0 [Unmapped]
+0.3% +496 +1.4% +1.74Ki TOTAL
4 years ago
Joshua Haberman
5b1f0d86a1
For Kokoro, only build/test -m32 on Linux.
...
Also fixed a bunch of bugs found by gcc's -fanalyzer.
4 years ago
Joshua Haberman
0497f8deed
Fixed a critical bug on 32-bit builds, and added much more Kokoro testing.
...
There was a bug in our arena code where we assumed that
sizeof(upb_array) would be a multiple of 8. On i386 it was
not, and this was causing memory corruption on 32-bit builds.
4 years ago
Joshua Haberman
6f59f1256e
Optimizations to descriptor loading.
4 years ago
Joshua Haberman
d5096f9ee8
Fixed bug in addunknown and added ASAN poisoning.
4 years ago
Joshua Haberman
71749b7caf
Implemented inline array allocation, and moved type->lg2 map to reflection.
4 years ago
Joshua Haberman
9557b97acc
Implemented inline array allocation, and moved type->lg2 map to reflection.
4 years ago
Joshua Haberman
b58d2a0ee6
Shrink overhead of message representation.
4 years ago
Joshua Haberman
0bf063a2ca
Shrink overhead of message representation.
4 years ago