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

Fix long-standing issue with C Abstract Structs #542

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

msprotz
Copy link
Contributor

@msprotz msprotz commented Feb 19, 2025

For the longest while we could not enable the usage of CAbstractStruct to hide internal implementation details of the state of the instances of the streaming functor. This was an implementation limitation where the dependency analysis, visibility analysis, and code generation did not know what to do.

Now, the behavior is as follows:

  • C abstract structs may be promoted to "internal" visibility, meaning that they now may appear in internal/foo.h
  • the visibility and dependency analyses are aware of this behavior, meaning other modules can depend on a C abstract struct
  • if a module needs to see the definition of an abstract struct, it will include the internal header (not the public one) to preserve the abstraction boundary -- this actually happens in HACL

This was enabled by a recent refactoring of this code that cleans this up significantly.

@msprotz
Copy link
Contributor Author

msprotz commented Feb 19, 2025

This is a first step towards option 3 as described in python/cpython#130213 (comment)

@msprotz
Copy link
Contributor Author

msprotz commented Feb 19, 2025

A test has broken because a monomorphized instance of a data type has not been marked CAbstractStruct.

I'm kind of on the fence about this: see https://github.com/hacl-star/hacl-star/pull/1025/files for the impact, which is presumably nice, but still needs more work before the usage of libintvector.h can be completely removed from public header.

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