Restructure building the C API#7341
Merged
alexcrichton merged 1 commit intobytecodealliance:mainfrom Oct 24, 2023
Merged
Conversation
pchickey
approved these changes
Oct 23, 2023
Contributor
pchickey
left a comment
There was a problem hiding this comment.
Looks good to me, my only question is the naming - would it make more sense to rename the current wasmtime-c-api crate something like wasmtime-c-api-impl so that users of wasmtime-c-api, which becomes this new trivial facade, don't need to make any changes in order to benefit from this?
Subscribe to Label Actioncc @peterhuene DetailsThis issue or pull request has been labeled: "wasmtime:c-api"Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
This commit introduces a wrapper crate which is now the new "real" C API. The purpose of this change is to enable using LTO when building the C API. Currently LTO is disabled because one of the crate types of the C API is an "rlib" which means that it can't have LTO performed due to rustc limitations. The solution here is to remove the "cdylib" and "staticlib" crate types from the "wasmtime-c-api" crate, rename that crate to "wasmtime-c-api-impl", and reintroduce 'wasmtime-c-api' as a new crate which wraps the previous crate and reexports it. This way LTO can be enabled when just building the artifacts and the use case from bytecodealliance#6765 is still satisfied by having a crate that can be linked to from Rust. Locally this reduces the size of the C API artifact for me by nearly 1M.
5a2d5bb to
eb4ce05
Compare
Member
Author
|
Good idea! I've switched to that naming scheme instead |
1 task
44 tasks
This file contains hidden or 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
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.
This commit introduces a wrapper crate which is now the new "real" C API. The purpose of this change is to enable using LTO when building the C API. Currently LTO is disabled because one of the crate types of the C API is an "rlib" which means that it can't have LTO performed due to rustc limitations. The solution here is to remove the "cdylib" and "staticlib" crate types from the "wasmtime-c-api" crate and introduce a new crate 'wasmtime-c-api-artfact' which wraps the previous crate and reexports it.
This way LTO can be enabled when just building the artifacts and the use case from #6765 is still satisfied by having a crate that can be linked to from Rust. Locally this reduces the size of the C API artifact for me by nearly 1M.