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
fd14316f38
create collections/ subdir for all array and map code
...
PiperOrigin-RevId: 486013554
2 years ago
Eric Salo
e137175092
create wire/ subdir for all wire-format code
...
PiperOrigin-RevId: 485898080
2 years ago
Joshua Haberman
30a28f3d3a
Removed kUpb_FieldRep_Pointer as a distinct FieldRep, saving a bit in the MiniTable
...
We can resolve the difference between these two reps at MiniTable build time.
PiperOrigin-RevId: 479320737
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
Eric Salo
eb66ab601f
update upb_Encode() to use arena api internally
...
PiperOrigin-RevId: 460758866
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
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
Protobuf Team Bot
65bde4e75b
upb_Encode() now returns a status value
...
PiperOrigin-RevId: 454740100
3 years ago
Joshua Haberman
05d23ea955
Fixed UBSAN errors.
3 years ago
Joshua Haberman
8ede0d552d
Tests are passing.
3 years ago
Joshua Haberman
44363393f3
Backed out a functional refactoring.
3 years ago
Joshua Haberman
532dc1f0f0
Renamed a few more constants to the new style.
...
These are not in the public API and so were not prioritized before.
No functional change here, just renames.
3 years ago
Joshua Haberman
826eca6742
Enabled ubsan tests and fixed ubsan failures.
3 years ago
Joshua Haberman
dbec5d70cd
Fixed UBSAN error: NULL + 0.
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
0c541f3305
Single encode.
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
39365f16a7
Addressed PR comments.
3 years ago
Joshua Haberman
a0374b3b08
Added required field checking into the encoder.
3 years ago
Stan Hu
4e8267e7e3
Fix big-endian encodings for fixed packed arrays
...
Previously the encoder would serialize the output buffer in one copy,
but this only works on little-endian systems. For big-endian systems, we
now iterate through the array and convert each value if necessary before
serializing it out.
Closes https://github.com/protocolbuffers/upb/issues/436
3 years ago
Joshua Haberman
8c916941b0
MSET -> MSGSET
3 years ago
Joshua Haberman
6f89034249
Implemented support for MessageSet.
3 years ago
Joshua Haberman
b1bbbdd4e7
Addressed PR comments.
3 years ago
Joshua Haberman
ce012b7b55
Added support for extensions.
3 years ago
Joshua Haberman
58e158c6fa
Changed mini-table to use a custom "mode" instead of descriptor's "label."
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
Esun Kim
38b4beed6b
Fix clang-tidy function 'upb_encode_ex' has a definition with different parameter names
4 years ago
Joshua Haberman
6c30b5fe73
Fixed upb encoder for field numbers > 2**28.
...
The encoder was improperly sign-extending the tag to 64 bits.
4 years ago
Joshua Haberman
e9551022c1
Added depth limit checking to upb_encode().
...
This can catch infinite recursion due to loops,
or just excessively deep message trees.
The depth limit is configurable, but defaults to 64.
4 years ago
Joshua Haberman
76764643ac
Added option to binary encoder to skip unknown fields.
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
358fa14d0e
Fixed headers and updated benchmark script.
4 years ago
Joshua Haberman
bc200451ce
Use a macro instead of an inline function for setjmp/longjmp.
4 years ago
Joshua Haberman
fbc0639b07
Use _setjmp on mac to avoid saving/restoring the signal mask.
4 years ago
Joshua Haberman
5741eb9ad7
Expanded benchmarking script and added one size opt to the encoder.
4 years ago
Joshua Haberman
0135399e60
Fixed bug introduced in refactoring.
4 years ago
Joshua Haberman
df3438222b
Notated impossible branch as unreachable.
4 years ago
Joshua Haberman
9b31e8fe12
Merged common encode tag paths.
4 years ago
Joshua Haberman
5d7dc718cc
Minor formatting fix.
4 years ago
Joshua Haberman
80441e4eb4
Optimized binary encoder.
4 years ago
Joshua Haberman
ada28896b9
Changed encoder to use longjmp() for error recovery.
4 years ago
Joshua Haberman
efefbffc80
Fixed binary encoding and decoding for big-endian machines.
4 years ago