Joshua Haberman
f5d2d55007
Deleted the legacy "Handlers" APIs. upb can finally be deserving of its name.
...
This is possible now that all users have been migrated to the new
upb_msg APIs.
4 years ago
Joshua Haberman
0f40d59258
Merge pull request #362 from haberman/rb-warnings
...
Fixed a bunch of Clang warnings.
4 years ago
Joshua Haberman
c7787cbaa1
Fixed a bunch of Clang warnings.
...
Unfortunately a few of the Clang warnings did not have easy fixes:
../../../../ext/google/protobuf_c/ruby-upb.c: In function ‘fastdecode_err’:
../../../../ext/google/protobuf_c/ruby-upb.c:353:13: warning: function might be candidate for attribute ‘noreturn’ [-Wsuggest-attribute=noreturn]
353 | const char *fastdecode_err(upb_decstate *d) {
| ^~~~~~~~~~~~~~
../../../../ext/google/protobuf_c/ruby-upb.c: In function ‘_upb_decode’:
../../../../ext/google/protobuf_c/ruby-upb.c:867:30: warning: argument ‘buf’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]
867 | bool _upb_decode(const char *buf, size_t size, void *msg,
I even tried to suppress the first error, but it still shows up.
4 years ago
Joshua Haberman
5e53b5bb3d
Merge pull request #360 from haberman/default-msgval
...
Added API for getting fielddef default as a upb_msgval
4 years ago
Joshua Haberman
7a6e647be1
Merge branch 'master' into default-msgval
4 years ago
Joshua Haberman
edb0a9a2d9
Merge pull request #361 from haberman/arena-bugfix
...
Bugfix for arena cleanup list when passing to upb_decode().
4 years ago
Joshua Haberman
9175989431
Bugfix for arena cleanup list when passing to upb_decode().
4 years ago
Joshua Haberman
5e550e88f8
Added API for getting fielddef default as a upb_msgval.
4 years ago
Joshua Haberman
de76b31f9c
Merge pull request #359 from veblush/fix-upbdefs
...
Fixed upbdefs error
4 years ago
Esun Kim
3cab8a38fc
Fixed upbdefs error
4 years ago
Esun Kim
48bb3e5662
Merge pull request #357 from veblush/string-opt
...
Optimize calls to std::string::find() and friends for a single char.
4 years ago
Esun Kim
4c67b2086b
Merge pull request #358 from veblush/clang-tidy-fix
...
Fix clang-tidy function 'upb_encode_ex'
4 years ago
Esun Kim
38b4beed6b
Fix clang-tidy function 'upb_encode_ex' has a definition with different parameter names
4 years ago
Esun Kim
9b020d8f65
Optimize calls to std::string::find() and friends for a single char.
4 years ago
Joshua Haberman
60607da72e
Merge pull request #356 from haberman/codegen-uniquefiles
...
Split the code generators for .upb and .upbdefs.
4 years ago
Joshua Haberman
7a54a5f3d6
Split the code generators for .upb and .upbdefs.
...
Before there was a single code generator that generated both
.upb and .upbdefs, even though they are generated by different
rules. This worked fine as long as the codegen steps were
sandboxed, but if not it led to build errors.
Fixes https://github.com/protocolbuffers/upb/issues/354 .
4 years ago
Joshua Haberman
3c9ae7837a
The fasttable parser works on ARM64!
4 years ago
Joshua Haberman
b10b02f66f
Merge pull request #353 from haberman/small-fixes
...
A couple minor fixes. These are exercised by Ruby.
4 years ago
Joshua Haberman
cd7c2d2701
Merge pull request #352 from haberman/large-field-number
...
Fixed upb encoder for field numbers > 2**28.
4 years ago
Joshua Haberman
10b355a6e0
A couple minor fixes. These are exercised by Ruby.
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
31b3528424
Merge pull request #350 from haberman/encode-depthlimit
...
Added depth limit checking to upb_encode().
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
f389384c5a
Merge pull request #349 from lidizheng/json-public
...
Make Bazel rule ":json" publicly visible
4 years ago
Lidi Zheng
f72c26cbc4
Make :json publically visible
4 years ago
Joshua Haberman
5797d95172
Merge pull request #348 from haberman/json-emit-defaults
...
Fixes for JSON encoder when emitting default values.
4 years ago
Joshua Haberman
7a17493269
Removed print debugging.
4 years ago
Joshua Haberman
695b7f4617
Added code to test UPB_JSONENC_EMITDEFAULTS.
4 years ago
Joshua Haberman
6b357607bd
Fixed bugs in JSON encoding with UPB_JSONENC_EMITDEFAULTS.
...
Previously the code would crash on certain empty fields.
4 years ago
Joshua Haberman
1b08391979
Merge pull request #347 from haberman/filedef-symtab
...
Added an accessor to get the symtab from a filedef.
4 years ago
Joshua Haberman
ee49a8d7df
Added an accessor to get the symtab from a filedef.
...
This matches an API already present in proto2
(const DescriptorPool* FileDescriptor::pool()).
However there is a slightly subtle implication here.
In proto2, the relationship between Descriptor and
MessageFactory is 1:many. You can create as many
DynamicMessageFactory instances as you want, and
each one will have its own independent DynamicMessage
prototype and computed layout for the same underlying
Descriptor. In practice the layouts will all be the same,
but one thing that could be distinct is that each can
have its own extension pool, which is a DescriptorPool
that will be searched for extensions when parsing.
In contrast, upb does not have a separate "message
factory" abstraction. That means that each upb_msgdef
has a single distinct layout, in other words a 1:1
correspondence between descriptor and layout. This means
that there is no way to create multiple message types
for the same descriptor that have distinct extension
pools. If you want a different set of extensions, you
must create a separate upb_symtab with a distinct set
of descriptors.
This change further entrenches that upb_filedef:upb_symtab
is a 1:1 relationship. A single upb_filedef cannot be a
member of multiple symbol tables. In practice this was
already true (there is no way to add a single filedef to
multiple symbol tables) but this change codifies this
1:1 relationship.
4 years ago
Joshua Haberman
a81b47025a
Merge pull request #345 from haberman/encode-skipunknown
...
Added option to binary encoder to skip unknown fields.
4 years ago
Joshua Haberman
6535cbe380
Merge pull request #346 from timgates42/bugfix_typo_position
...
docs: fix simple typo, posisiton -> position
4 years ago
Tim Gates
7225108720
docs: fix simple typo, posisiton -> position
...
There is a small typo in upb/table.c.
Should read `position` rather than `posisiton`.
4 years ago
Joshua Haberman
871ff96252
Test SKIPUNKNOWN on regular fields.
4 years ago
Joshua Haberman
0569c22a1e
Removed debug print.
4 years ago
Joshua Haberman
76764643ac
Added option to binary encoder to skip unknown fields.
4 years ago
Joshua Haberman
794ce6d061
Merge pull request #344 from haberman/deterministic-serialize
...
Added map sorting to binary and text encoders.
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
3e071ea91a
Merge pull request #343 from haberman/msvc
...
MSVC apparently doesn't support the standard C/C++ defines.
4 years ago
Joshua Haberman
e70e488e09
MSVC apparently doesn't support the standard C/C++ defines.
...
Our requirement then is C99, C++11, or MSVC >= 2015.
4 years ago
Joshua Haberman
963e501aa6
Merge pull request #342 from haberman/fuzz
...
Clamp 32-bit varints to 5 bytes to fix a fuzz failure.
4 years ago
Joshua Haberman
8d670d8aea
Renamed decode_varint32() to decode_tag().
4 years ago
Joshua Haberman
9abf8e043f
Clamp 32-bit varints to 5 bytes to fix a fuzz failure.
4 years ago
Joshua Haberman
50a543de7f
Merge pull request #341 from haberman/code-size
...
Added size benchmark for CODE_SIZE.
4 years ago
Joshua Haberman
9c87f1168f
Added size benchmark for CODE_SIZE.
4 years ago
Joshua Haberman
6f82028236
Merge pull request #340 from haberman/darwin-setjmp
...
Use _setjmp() instead of setjmp() on Apple platforms
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
ca279f8afa
Merge branch 'master' into darwin-setjmp
4 years ago