Joshua Haberman
c593476ac7
Shorten our license headers into an abbreviated form that references LICENSE instead of including it in full.
...
PiperOrigin-RevId: 563888955
2 years ago
Joshua Haberman
035cd90e2f
Shorten our license headers into an abbreviated form that references LICENSE instead of including it in full.
...
PiperOrigin-RevId: 563888953
2 years ago
Joshua Haberman
f78eaa9aa2
Shorten our license headers into an abbreviated form that references LICENSE instead of including it in full.
...
PiperOrigin-RevId: 563888947
2 years ago
Joshua Haberman
1438cc8931
Shorten our license headers into an abbreviated form that references LICENSE instead of including it in full.
...
PiperOrigin-RevId: 563888943
2 years ago
Joshua Haberman
06c1b3731e
Shorten our license headers into an abbreviated form that references LICENSE instead of including it in full.
...
PiperOrigin-RevId: 563888901
2 years ago
Joshua Haberman
256e65087d
Shorten our license headers into an abbreviated form that references LICENSE instead of including it in full.
...
PiperOrigin-RevId: 563888826
2 years ago
Mike Kruskal
6f3db03eb7
Stop setting edition strings in FeatureSets.
...
PiperOrigin-RevId: 563791580
2 years ago
Protobuf Team Bot
955d4ab0d6
Add MapFieldBuilder and change codegen to generate it and the put{field}BuilderIfAbsent method.
...
PiperOrigin-RevId: 563738402
2 years ago
Protobuf Team Bot
de87585b22
protobuf: remove double ptr_ load in arena allocation
...
Currently the generated code contains 2 loads of ptr_ b/c it's an atomic:
one in HasSize and one in AllocateFromExisting.
Combine these to be a single load.
name old cpu/op new cpu/op delta
BM_ArenaAlloc/100 250ns ± 2% 229ns ± 1% -8.20% (p=0.000 n=54+47)
BM_ArenaAllocWithCleanup/100 865ns ± 1% 812ns ± 2% -6.15% (p=0.000 n=57+56)
PiperOrigin-RevId: 563698727
2 years ago
Protobuf Team Bot
04de6db34b
Auto-generate files after cl/563434532
2 years ago
Protobuf Team Bot
7893dff9cd
Remove `copy_to_from` from `ClassData`. It only ever has one useful value and
...
we can just hardcode that logic in `Message::CopyFrom`.
Also, move the implementation of `GetClassData` to the base class for zero field messages.
PiperOrigin-RevId: 563434532
2 years ago
Mike Kruskal
4019e25432
Editions: Introduce functionality to protoc for generating edition feature set defaults.
...
This can be used by non-C++ runtimes and generators to seed feature resolution. The output binary proto message will contain a mapping from edition to the default feature set, including whichever generator feature extensions are passed to protoc.
PiperOrigin-RevId: 563246376
2 years ago
Protobuf Team Bot
c0b8696ea7
Auto-generate files after cl/563236159
2 years ago
Mike Kruskal
13df571922
Editions: Expand validation in feature resolution
...
- Check that the maximum edition is always after the minimum
- Make sure that the minimum edition gets included in the default mapping when it's necessary
PiperOrigin-RevId: 563236159
2 years ago
Mike Kruskal
f083ebf21f
Editions: Migrate edition strings to enum in C++ code.
...
The edition specification in proto files will remain unchanged, but it will be immediately converted to an enum by the parser. This gives us more control over the valid set of editions and simplifies ordering (just an integer comparison now). We plan to release exactly one edition per year.
PiperOrigin-RevId: 563215992
2 years ago
Mike Kruskal
ad5ba75bf9
Add edition enum to FileDescriptorProto
...
PiperOrigin-RevId: 563175374
2 years ago
Protobuf Team Bot
5e9a9a87bc
Use the TcParseFunction enum instead of strings when generating the table
...
instructions.
This avoids the string creation in the reflection case altogether, as well
as the map lookups.
PiperOrigin-RevId: 563108247
2 years ago
Protobuf Team Bot
159306ba74
Auto-generate files after cl/563088162
2 years ago
Martijn Vels
1caa01b12a
Enable explicit constructors for internal implementation classes.
...
This changes the code to use explicit constructors instead of aggregate initialization, which allows optimizations when creating and copying messages.
PiperOrigin-RevId: 563088162
2 years ago
Adrian Sadłocha
8c08df5a84
Implement mutators for singular primitive fields without presence
...
PiperOrigin-RevId: 563043919
2 years ago
Protobuf Team Bot
d6c1170096
Auto-generate files after cl/562810187
2 years ago
Chris Kennelly
5df5d77f5b
Add restrict on unsafe swap methods.
...
These have preconditions around not self-swapping, so restrict is safe here.
Comparison of generated code for methods used by message_unittest,
vectorization improves.
PiperOrigin-RevId: 562810187
2 years ago
Protobuf Team Bot
f75a800be0
Change SkipRestOfBlock to be iterative instead of recursive to avoid stack
...
overflows on invalid input with many unbalanced `{` characters.
PiperOrigin-RevId: 562806350
2 years ago
Protobuf Team Bot
f7d6dd15b2
Delete dead Message::GetInvariantPerBuild
...
This is a protected member function and not part of the public interface.
PiperOrigin-RevId: 562774514
2 years ago
Martijn Vels
e052928c94
Add dependency on absl::layout, and explicitly include absl layout includes
...
This header was transitively included from (deprecated) absl cord includes.
PiperOrigin-RevId: 562008066
2 years ago
Mike Kruskal
d0e8969166
Editions: Introduce an Edition enum and setup migration from strings
...
PiperOrigin-RevId: 561993644
2 years ago
Cong Liu
0a7a73d757
Remove redundant option: profile_driven_inline_string.
...
PiperOrigin-RevId: 561976278
2 years ago
Hong Shin
fcebbd1442
Squelch snake case warnings for modules
...
PiperOrigin-RevId: 561697301
2 years ago
Protobuf Team Bot
0522054f3e
Workaround ICE on gcc 7.5 by not having one overload call the other one with a
...
const_cast.
Fixes https://github.com/protocolbuffers/protobuf/issues/13715
PiperOrigin-RevId: 561660761
2 years ago
Michael Diamond
a7eee92b66
Update reference to missing function JsonStringToBinary() ( #13581 )
...
Also tweaked the "simple wrapper" language since the implementation does not appear to delegate to JsonToBinaryStream() directly.
Closes #13581
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/13581 from dimo414:dimo414-patch-1 7522ae1673
PiperOrigin-RevId: 561610218
2 years ago
Protobuf Team Bot
32b20e596d
Auto-generate files after cl/561528198
2 years ago
Mike Kruskal
0cf3b66eac
Silence warnings about extra semicolon in non-TSAN builds.
...
Fixes https://github.com/protocolbuffers/protobuf/issues/13787
PiperOrigin-RevId: 561528198
2 years ago
Mike Kruskal
4d5ab7324e
Create a reflection helper for ExtensionIdentifier.
...
This will allow easy access to the FieldDescriptor of a generated extension.
PiperOrigin-RevId: 561480962
2 years ago
Mike Kruskal
e897bcf3ff
Editions: Provide an API for C++ generators to specify their features.
...
This works for both built-in generators and plugins written in C++. Any feature extensions specified by this virtual method will end up fully resolved in the descriptors.
PiperOrigin-RevId: 561446773
2 years ago
Protobuf Team Bot
403a32d0ab
Auto-generate files after cl/561422951
2 years ago
Alyssa Haroldsen
614e29f946
Implement v0.6 string fields
...
This is predominantly a wrapper around `BytesMut`, for simplicity.
Bytes and string fields are mostly the same, except for possible UTF-8 handling.
This also implements some minor parts of `ProtoStr` that were missed.
PiperOrigin-RevId: 561422951
2 years ago
Mike Kruskal
32eccf0b21
Delete obsolete code that searches the pool for "proto2.FeatureSet".
...
Feature resolution has been refactored in a way that made this dead code.
PiperOrigin-RevId: 561410946
2 years ago
Protobuf Team Bot
d052b0849f
Fix arenaz wasted space reporting
...
Currently wasted space includes ArenaBlock header (24 bytes),
and never can be 0 even if blocks are used optimally.
Report 0 wasted space if blocks are used optimally.
PiperOrigin-RevId: 561347182
2 years ago
Protobuf Team Bot
293f0a3b31
protobuf: mark unlikely branch as so
...
Don't leave things to chance. We generally mark likely/unlikely
branches on hot paths as such.
PiperOrigin-RevId: 561288632
2 years ago
Protobuf Team Bot
89e7b1c7f1
proto: remove debug logging from opt build
...
The debug logging call makes SerialArena::AllocateFromExistingWithCleanupFallback function non-leaf and significantly worsens codegen (stack frame allocation + register spills). As the result it's also not inlined into ThreadSafeArena::AllocateAlignedWithCleanup.
With this change SerialArena::AllocateFromExistingWithCleanupFallback
becomes frame-less leaf function and is inlined into ThreadSafeArena::AllocateAlignedWithCleanup.
Codegen before:
00000000007b1820 <proto2::internal::ThreadSafeArena::AllocateAlignedWithCleanup(unsigned long, unsigned long, void (*)(void*))>:
7b1820: 48 c7 c0 40 fb ff ff mov $0xfffffffffffffb40,%rax
7b1827: 64 4c 8b 40 08 mov %fs:0x8(%rax),%r8
...
7b189f: e9 5c eb ff ff jmp 7b0400 <proto2::internal::SerialArena::AllocateFromExistingWithCleanupFallback(unsigned long, unsigned long, void (*)(void*))>
00000000007b0400 <proto2::internal::SerialArena::AllocateFromExistingWithCleanupFallback(unsigned long, unsigned long, void (*)(void*))>:
7b0400: 55 push %rbp
7b0401: 48 89 e5 mov %rsp,%rbp
7b0404: 41 56 push %r14
7b0406: 53 push %rbx
7b0407: 48 83 ec 10 sub $0x10,%rsp
...
7b04c3: 48 83 c4 10 add $0x10,%rsp
7b04c7: 5b pop %rbx
7b04c8: 41 5e pop %r14
7b04ca: 5d pop %rbp
7b04cb: c3 ret
7b04cc: 48 8d 35 44 a4 a9 ff lea -0x565bbc(%rip),%rsi # 24a917 <absl::debugging_internal::IdentifierIsAnonymousNamespace(absl::debugging_internal::State*, unsigned long)::anon_prefix+0x2e19e>
7b04d3: 4c 8d 75 e0 lea -0x20(%rbp),%r14
7b04d7: 4c 89 f7 mov %r14,%rdi
7b04da: ba f3 00 00 00 mov $0xf3,%edx
7b04df: e8 9c 05 1e 00 call 990a80 <absl::log_internal::LogMessageFatal::LogMessageFatal(char const*, int)>
7b04e4: 48 8d 35 3e 43 a6 ff lea -0x59bcc2(%rip),%rsi # 214829 <absl::Symbolize(void const*, char*, int)::kEllipsis+0xba26>
7b04eb: 4c 89 f7 mov %r14,%rdi
7b04ee: e8 cd f6 d0 ff call 4bfbc0 <absl::log_internal::LogMessage& absl::log_internal::LogMessage::operator<< <24>(char const (&) [24])>
7b04f3: 48 89 c7 mov %rax,%rdi
7b04f6: 89 de mov %ebx,%esi
7b04f8: e8 c3 a0 c9 ff call 44a5c0 <absl::log_internal::LogMessage::operator<<(int)>
7b04fd: 4c 89 f7 mov %r14,%rdi
7b0500: e8 1b e9 0c 00 call 87ee20 <absl::log_internal::LogMessageFatal::~LogMessageFatal()>
Codegen after:
00000000007b1680 <proto2::internal::ThreadSafeArena::AllocateAlignedWithCleanup(unsigned long, unsigned long, void (*)(void*))>:
7b1680: 49 c7 c0 40 fb ff ff mov $0xfffffffffffffb40,%r8
7b1687: 64 49 8b 40 08 mov %fs:0x8(%r8),%rax
...
7b17a5: c3 ret
name old cpu/op new cpu/op delta
BM_ArenaAllocWithCleanup/100 957ns ± 3% 868ns ± 1% -9.27% (p=0.000 n=54+48)
PiperOrigin-RevId: 561281492
2 years ago
Protobuf Team Bot
0d0701948d
protobuf: fix data race on SerialArena::string_block_
...
SpaceUsed reads string_block_ while AllocateFromStringBlockFallback
can be changing it concurrently. Make it an atomic.
PiperOrigin-RevId: 561249277
2 years ago
Protobuf Team Bot
720c93c34e
Remove unused MaybeAllocateWithCleanup<T>
...
The function is only used for strings,
the generic version is dead code. Remove it.
PiperOrigin-RevId: 561241337
2 years ago
Jie Luo
20faf56325
fix python code generation compatibility with Cython
...
raised by https://github.com/protocolbuffers/protobuf/pull/13593
PiperOrigin-RevId: 561077681
2 years ago
Protobuf Team Bot
9c9f9b4abb
Auto-generate files after cl/561057538
2 years ago
Protobuf Team Bot
ecd106bd49
Replace GetCachedSize+SetCachedSize with a single AccessCachedSize function.
...
Removes 1 virtual function from each Message type.
We keep the codegen for GetCachedSize+SetCachedSize to allow for non-virtual dispatch for those calls, but they are not overriding a virtual function.
PiperOrigin-RevId: 561052979
2 years ago
Hong Shin
2833629319
Expunge Copy and Clone from MsgMut
...
PiperOrigin-RevId: 561045696
2 years ago
Protobuf Team Bot
1a4915e345
Fix read of uninitialized data on invalid input in the first token.
...
PiperOrigin-RevId: 561028957
2 years ago
Protobuf Team Bot
9274c2be9c
Auto-generate files after cl/560854805
2 years ago
Matt Kulukundis
028c8618f5
Add `ConditionalFunctionCall` to var to allow expansions like
...
```
p->Emit({
Sub{"weak_cast", weak ? "reinterpret_cast<Msg*>" : ""}
.ConditionalFunctionCall(),
}, R"cc(
$weak_cast$(foo)
)cc");
```
PiperOrigin-RevId: 560854805
2 years ago
Martijn Vels
0511e8c7b9
Register required arena dtor in arena enabled constructor
...
This change fixes the ctor where for types with a required arena dtor, the dtor was not register in the ctor.
PiperOrigin-RevId: 560793004
2 years ago