This partially fixes https://github.com/protocolbuffers/protobuf/issues/10088. The test case from that bug significantly improves with this change. However we still have a global map that does not shrink, which can still create the appearance of leaking memory, as it will not be freed until the module is unloaded.
PiperOrigin-RevId: 563124724
Create message/internal/types.h as a new leaf header
Move map_entry.h from message/internal/ to collections/internal/ where it belongs
PiperOrigin-RevId: 562889855
These cross dependencies will be going away soon when we merge protobuf and upb
into a single Bazel repo, but I thought it would be good to update these just
in case we need to do a release before that merge happens.
PiperOrigin-RevId: 560756369
We plan to unify protobuf and upb into a single Bazel repo, but for now they
are separate repos as far as Bazel is concerned. This change will make upb's
workspace depend on the local copy of protobuf so that protobuf changes take
effect immediately for builds inside upb's workspace. This also mimicks the way
that the protobuf workspace depends on upb.
PiperOrigin-RevId: 560188433
Our automation clobbered a few more files, so let's move them
temporarily so that we can put them back in place in a way that "git
blame" continues to work.
This is the second attempt to fix our Git history. This should allow
"git blame" to work correctly in the upb/ directory even though our
automation unexpectedly blew away that directory.
This will allow us to run all the upb tests from the protobuf repo, which
already uses this flag. I just had to remove a couple glob patterns that did
not match any files.
PiperOrigin-RevId: 559434154
1. getter function to access the upb_Map corresponding to a map proto field
2. conversion function to get a Go map from a upb_Map. The conversion function uses generics, so it must be a standalone function independent of `MessageAccessor`.
Accessing map fields is not as efficient as accessing other proto field types, because of two reasons:
- we need to make a copy of map values in Go, since the memory representations are different in UPB C
- we need to call C functions from Go, because the upb_Map struct fields are not exported and we can't access the bits directly, causing performance overhead
Luckily the map fields can be quite rare, so the performance overhead should not be too significant overall.
PiperOrigin-RevId: 559191359
Remove message/message.h as a hdr from :message_internal
Lock down the visibility of :message_types to upb-only
message/types.h is not an internal header because the definitions there are part of the public surface. But the fact that it needs to exist is an implementation detail that should remain opaque, so make it a private dep.
PiperOrigin-RevId: 558960776
Remove array.h and map.h as hdrs from :collections_internal
Remove alloc.h and arena.h as hdrs from :mem_internal (and add them to :mem)
Remove common.h and decode.h and encode.h as hdrs from :wire_internal
Lock down the visibility of :wire_internal to upb-only
Merge :mini_descriptor_encode_internal into :mini_descriptor_internal
PiperOrigin-RevId: 558235138