- Rename the accessors from upb_MiniTable_Foo() to upb_Message_Foo()
- delete _upb_Message_Clearext() which is now redundant
- Allow the getters and setters to accept both extension and non-extension fields
- Add a (upb_Arena*) param to setters (only needed for extensions)
- Change setters from void to bool (since extensions may require allocations)
PiperOrigin-RevId: 493760399
Addresses https://github.com/protocolbuffers/protobuf/issues/10936.
This requires updating to the newest version of rules_python to use the new py_wheel API that includes a parameter for extra distinfo files
PiperOrigin-RevId: 493060514
upbdev_ProcessStdout() does the same thing as upbdev_ProcessOutput() except
instead of returning the serialized buffer it just sends it directly to stdout.
PiperOrigin-RevId: 492511049
We were not calculating proper offsets for upb_MapEntryData in cases
where the compiler was run on a different word size than the runtime.
PiperOrigin-RevId: 492114576
Any public interface should not be marked incompatible, since the @system_python repository is specific to *this* workspace. Downstream users can name it whatever they want or use a hermetic python build, in which case this repository won't be defined.
PiperOrigin-RevId: 492103118
The current behavior will crash any Bazel command immediately, due to our declared pip dependencies in WORKSPACE, if python3 can't be found. The new behavior will mock out these workspace dependencies and allow any non-python targets to run. Python targets will be skipped by wildcard expressions if there's no system python3, and will fail when run directly, due to compatibility mismatch.
PiperOrigin-RevId: 492085254
_upb_MiniTable_Build() is now the general version of the function;
upb_MiniTable_Build() calls it and sets the platform to default/native.
PiperOrigin-RevId: 491091021
upb_MiniTable_BuildEnum() -> upb_MiniTableEnum_Build()
upb_MiniTable_BuildExtension() -> upb_MiniTableExtension_Build()
also make the status pointer argument optional for the mini table builders
PiperOrigin-RevId: 490992866
This required some work to unify map entry messages with regular messages, with respect to presence. Before map entry fields could never have presence. Now they can have presence according to normal rules. Note that this only applies to times that the user constructs a map entry directly.
PiperOrigin-RevId: 490611656
Prior to this CL, there were several different code paths for reading/writing message data. Generated code, MiniTable accessors, and reflection all performed direct manipulation of the bits and bytes in a message, but they all had distinct implementations that did not share much of any code. This divergence meant that they could easily have different behavior, bugs could creep into one but not another, and we would need three different sets of tests to get full test coverage. This also made it very difficult to change the internal representation in any way, since it would require updating many places in the code.
With this CL, the three different APIs for accessing message data now all share a common set of functions. The common functions all take a `upb_MiniTableField` as the canonical description of a field's type and layout. The lowest-level functions are very branchy, as they must test for every possible variation in the field type (field vs oneof, hasbit vs no-hasbit, different field sizes, whether a nonzero default value exists, extension vs. regular field), however these functions are declared inline and designed to be very optimizable when values are known at compile time.
In generated accessors, for example, we can declare constant `upb_MiniTableField` instances so that all values can constant-propagate, and we can get fully specialized code even though we are calling a generic function. On the other hand, when we use the generic functions from reflection, we get runtime branches since values are not known at compile time. But even the function is written to still be as efficient as possible even when used from reflection. For example, we use memcpy() calls with constant length so that the compiler can optimize these into inline loads/stores without having to make an out-of-line call to memcpy().
In this way, this CL should be a benefit to both correctness and performance. It will also make it easier to change the message representation, for example to optimize the encoder by giving hasbits to all fields.
Note that we have not completely consolidated all access in this CL:
1. Some functions outside of get/set such as clear and hazzers are not yet unified.
2. The encoder and decoder still touch the message without going through the common functions. The encoder and decoder require a bit more specialized code to get good performance when reading/writing fields en masse.
PiperOrigin-RevId: 490016095
update upb to use upb_Map_Next()
remove upb_MapIterator_SetValue(), which was declared but not actually implemented
remove upb_MapIterator_Done(), which was implemented but not actually used
PiperOrigin-RevId: 489989481
_upb_Arena_FastMalloc() has been directly inlined
Arena::allocator() has been removed
mem_block is now _upb_MemBlock
some calls to upb_Arena_Alloc() (which is going away) have been changed to use upb_Arena_Malloc() instead
PiperOrigin-RevId: 489874377