Commit graph

5 commits

Author SHA1 Message Date
Joshua Haberman
af91d2a2fc Rolling forward after fixing the weak symbol linking for optimized iOS builds.
The previous CL's approach of using `__attribute__((weakref()))` was not actually behaving as expected, and the unit tests were not sufficient to catch this.

We now use inline assembly to achieve the functionality that we thought we were getting with `__attribute__((weakref()))`.  From assembly, we can create a weak symbol whose value is the same as another "stub" symbol in the same file.

Unfortunately we cannot have all of our weak symbols reference a single placeholder "empty" message, due to a bug I discovered in the LLVM linker and reported in https://github.com/llvm/llvm-project/issues/167262

If and when that bug is fixed, we should be able to get optimal tree shaking behavior, even on iOS.

PiperOrigin-RevId: 831396179
2025-11-12 08:21:20 -08:00
Joshua Haberman
f79742a2dc Automated jj rollback of changelist 829022414
*** Reason for rollback ***

Breaking tests.

PiperOrigin-RevId: 829158111
2025-11-06 16:46:00 -08:00
Joshua Haberman
1a54fdb2c3 Removed indirection for sub-messages.
To do this, we use `__attribute__((weakref()))` to weakly reference a placeholder definition for tree shaken sub-messages.  This provides the same tree shaking behavior we had before, but without needing an extra indirection.  If we had discovered this technique before, we would have had no reason to add the indirection in cl/640369522.

This will reduce the code size and memory overhead of any MiniTables with sub-messages in them, because we no longer need an extra `void*` per sub-message field to store the extra indirect pointer.

It also should improve efficiency a bit since there is one fewer indirection when recursing into a sub-message field.

PiperOrigin-RevId: 829022414
2025-11-06 10:55:15 -08:00
Protobuf Team Bot
0bdcf98f16 Emit extensions in debug string in wire order
PiperOrigin-RevId: 699254023
2024-11-22 12:33:32 -08:00
Protobuf Team Bot
f9dd9ce66e UPB text encoder without using reflection for Rust (used for a message's Debug trait) that will print out field number to value entries instead of field name to value entries of a message like how it's expected for the usual text format using reflection.
General test for it is done in Rust, and then extensions are tested in UPB as they're not currently supported in Rust-upb.

PiperOrigin-RevId: 651113583
2024-07-10 12:38:59 -07:00