Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust: cut down on the amount of generated C++ code needed for maps #17296

Closed
wants to merge 1 commit into from

Conversation

copybara-service[bot]
Copy link

Rust: cut down on the amount of generated C++ code needed for maps

With the C++ kernel for Rust, we currently need to generate quite a few C++
thunks for operations on map fields. For each message we generate, we generate
these thunks for all possible map types that could have that message as a
value. These operations are for things such as insertion, removal, clearing,
iterating, etc.

The reason we do this is that templated types don't play well with FFI, so we
effectively need separate FFI endpoints for every possible combination of key
and value types used (or even potentially used) as a map field.

This CL starts chipping away at the problem by making several of the operations
work with the UntypedMapBase type, which is the base class of all map types,
allowing us to have a single implementation that works for all maps.

With the C++ kernel for Rust, we currently need to generate quite a few C++
thunks for operations on map fields. For each message we generate, we generate
these thunks for all possible map types that could have that message as a
value. These operations are for things such as insertion, removal, clearing,
iterating, etc.

The reason we do this is that templated types don't play well with FFI, so we
effectively need separate FFI endpoints for every possible combination of key
and value types used (or even potentially used) as a map field.

This CL starts chipping away at the problem by making several of the operations
work with the `UntypedMapBase` type, which is the base class of all map types,
allowing us to have a single implementation that works for all maps.

PiperOrigin-RevId: 647369316
Copy link

github-actions bot commented Jul 8, 2024

Auto-closing Copybara pull request

@github-actions github-actions bot closed this Jul 8, 2024
@github-actions github-actions bot deleted the test_647369316 branch July 8, 2024 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant