-
Notifications
You must be signed in to change notification settings - Fork 123
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
[Not for review] Thunks: Implement data layout analysis and struct repacking. Add 32-bit support to Wayland and Vulkan #3135
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The set of these types is tracked in AnalysisAction, to which extensive verification logic is added to detect potential incompatibilities and to enforce use of annotatations where needed.
This adds a ComputeDataLayout function that maps a set of clang::Types to an internal representation of their data layout (size, member list, ...).
This runs the data layout analysis pass added in the previous change twice: Once for the host architecture and once for the guest architecture. This allows the new DataLayoutCompareAction to query architecture differences for each type, which can then be used to instruct code generation accordingly. Currently, type compatibility is classified into 3 categories: * Fully compatible (same size/alignment for the type itself and any members) * Repackable (incompatibility can be resolved with emission of automatable repacking code, e.g. when struct members are located at differing offsets due to padding bytes) * Incompatible
…; Add tests for void pointer parameters
Previously, two functions with the same signature would always be wrapped in the same logic. This change allows customizing one function with annotations while leaving the other one unchanged.
…back arguments This will be used later to aid automatic struct repacking.
This annotation can be used for data types that can't be repacked automatically even with custom repack annotations. With ptr_passthrough, the types are wrapped in guest_layout and passed to the host like that.
These annotations allow for a given type or parameter to be treated as "compatible" even if data layout analysis can't infer this automatically. assume_compatible_data_layout is more powerful than is_opaque, since it allows for structs containing members of a certain type to be automatically inferred as "compatible". Conversely however, is_opaque enforces that the underlying data is never accessed directly, since non-pointer uses of the type would still be detected as "incompatible".
…rs. Thunks/gen: Adapt for new metadata definitions
…nges The interface files themselves don't use FEXLoader. Only the final library does.
This can be used to allow automatically handling structures that require special behavior for one member but are automatically repackable otherwise. The feature is enabled using the new custom_repack annotation and requires additional repacking functions to be defined in the host file for each customized member.
This is superseeded by ptr_passthrough.
…ng tests; Add tests for void pointer parameters" This reverts commit ea59f314e469bc9be1c1c01c3913e131a70e1f9f.
…on-repackable types. TODO: Needs an explicit mechanism to do this anyway if all members match vaguely!
What a ride! Other than 32-bit Vulkan support itself, everything originally implemented in this PR has now been integrated into |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'll split these changes up into smaller PRs for easier review. Having the full set of changes visible may be useful to judge the design during review though.
Full list of changes:
ptr_passthrough
/is_opaque
/assume_compatible_data_layout
/custom_repack
Related PRs: