- Each def type has its own .c file and its own .h file
- Functions that require a builder context are declared in def_builder.h
- The mini descriptor encoders have also been pulled into upb/reflection/
- upb/def.h, upb/def.hpp, upb/reflection.h, and upb/reflection.hpp are now deprecated stubs that point to the new headers
PiperOrigin-RevId: 474459500
Ref: https://github.com/protocolbuffers/protobuf/pull/10291
Ruby types defined though native extensions should register
a function that report their memory footprint in bytes.
This feature is used by various memory profiling tools.
Optimizes `upb_MiniTable_Enum` for enums with many values (>64) but with relatively dense packing in numeric space.
This CL optimizes both the size and speed of such enums:
- size: 30x code size reduction
- speed: moved from linear search to a constant-time bit test
Negative enum values are still expensive, as they are never put into the bitfield.
PiperOrigin-RevId: 473259819
Instead of bounds-testing a double value to guess whether it will overflow,
just convert it to a float and check whether the result is +/- infinity.
PiperOrigin-RevId: 472811865
The functions declared in reflection.h use neither arrays nor maps, so (a) stop including the array and map definitions, and (b) update the handful of other source files which were relying on that transitivity.
PiperOrigin-RevId: 472627278
This is a naming change only, with no functional change. We did replace one inline function that had only one caller, but the net effect should be a no-op.
I did remove several `return` statements for calls to certain `noreturn` functions. These had no effect but were intended to improve readability. However the unused "return" caused ClangTidy to throw warnings, so these have been removed.
PiperOrigin-RevId: 472619191
- opt_default is now kUpbDefOptDefault
- upb_AddDefCtx is now upb_DefBuilder
- shortdefname() is now _upb_DefBuilder_FullToShort()
- pack_def() is now _upb_DefBuilder_Pack()
- unpack_def() is now _upb_DefBuilder_Unpack()
- UPB_ASSERT() checks on def struct size moved up in the call chain
- remove/expand CHK_OOM
PiperOrigin-RevId: 471862679
(Because it is a better name and we can't properly bikeshed it without changing
it a few times first.)
Also removed it as an arg from a function that doesn't actually need it.
PiperOrigin-RevId: 470978322
- check_ident() is now _upb_AddDefCtx_CheckIdent()
- makefullname() is now _upb_AddDefCtx_MakeFullName()
- symtab_add() is now _upb_AddDefCtx_Add()
- symtab_alloc() is now _upb_AddDefCtx_Alloc()
- symtab_errf() is now _upb_AddDefCtx_Errf()
- symtab_oomerr() is now _upb_AddDefCtx_OomErr()
PiperOrigin-RevId: 470806376
- renamed symtab_addctx as upb_AddDefCtx
- simplified _upb_DefPool_AddFile() slightly
- replaced upb_Status_setoom() with kOutOfMemory
- deleted all references to UPB_DEFTYPE_LAYOUT and UPB_DEFTYPE_FILE
PiperOrigin-RevId: 470592649
Previously GitHub Actions would fail if they did not have access to
repository secrets. The code attempted to have graceful fallback, but
the graceful fallback was not working properly.
This PR fixes the graceful fallback:
- Bazel tests will use read-only caching instead of read-write.
- We unfortunately need to skip the Python wheel tests, as they require
our private Docker image to run.
This function was introduced in https://github.com/protocolbuffers/upb/pull/426 but it appears it was never used. I am not sure what the purpose was, but in any case it is not needed.
With this function removed, we no longer need to tag pointers for the DefPool "files" table.
PiperOrigin-RevId: 470567000
There are many places within def.c where a function which implements a method
for struct A ends up directly accessing fields within struct B even though
accessor functions for these fields are defined. So, this is a first pass at
trying to clean that up a bit. Yes, we are adding function calls to a lot of
code paths by doing this but in the unlikely event that this adds unacceptable
overhead we can deal with it then.
PiperOrigin-RevId: 470321129
Give the def types their own array allocators and also implement some simple array constructors for the enum and enum value defs.
PiperOrigin-RevId: 470042521
upb_String is a hack which exists because the original C++ tokenizer got to
assume the existence of C++ strings, so at least for now the C tokenizer needs
a rough equivalent. But this should be a purely internal implementation detail,
not part of the visible surface.
PiperOrigin-RevId: 469814074
This pattern does not glob anything because inside the upbc folder there is a BUILD file.
Removing this allows to build upb with the flag incompatible_disallow_empty_glob
- Disallow multiline strings.
- Disallow a letter immediately following a number without intervening whitespace.
- Replace distinct bool option flags with a single options int.
PiperOrigin-RevId: 467829817