-
Notifications
You must be signed in to change notification settings - Fork 68
feat: Parse struct name in complex field + ECC init macros as string #1945
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
Merged
Conversation
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
This comment has been minimized.
This comment has been minimized.
CodSpeed WallTime Performance ReportMerging #1945 will not alter performanceComparing
|
0027d96
to
6342abf
Compare
Commit: 6342abf |
jonathanpwang
added a commit
that referenced
this pull request
Aug 7, 2025
…1945) Cherry-picked from #1891 without the twisted Edwards macros. The `complex_init!` and `sw_init!` macros are updated so that instead of parsing a `Path`, it parses a `LitStr`. This makes it so that the `_init!` macros do not require any path imports in the file where it is called, which greatly improves the developer experience. The main files changed aside from test files and auto-generates `openvm_init.rs` files are: - extensions/algebra/complex-macros/src/lib.rs - extensions/ecc/sw-macros/src/lib.rs In both macros, the change essentially boils down to changing: (before) ```rust let items = input.parse_terminated(<Expr as Parse>::parse, Token![,])?; ``` to (after) ```rust let items = input.parse_terminated(<LitStr as Parse>::parse, Token![,])?; ``` and then associated type changes (mostly simplifications) in converting tokens to strings. There is one additional change needed only for the `sw_init!` macro case. Previously the linked function ```rust extern "C" fn #setup_extern_func() ``` defined by the `sw_init!` macro did use the path of the struct within the function implementation. After this PR, we avoid this import by moving that part of the logic into the `fn set_up_once()` function defined for the struct itself. This changed the function signature of the extern function to: ```rust extern "C" fn #setup_extern_func(uninit: *mut core::ffi::c_void, p1: *const u8, p2: *const u8) ``` [Here](https://www.diffchecker.com/0ncTMwe2/) is the diff of the code that was moved from the `#setup_extern_func()` into the `set_up_once()` function. --------- Co-authored-by: Avaneesh Kulkarni <[email protected]>
This was referenced Aug 8, 2025
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.
Cherry-picked from #1891 without the twisted Edwards macros.
The
complex_init!
andsw_init!
macros are updated so that instead of parsing aPath
, it parses aLitStr
. This makes it so that the_init!
macros do not require any path imports in the file where it is called, which greatly improves the developer experience.The main files changed aside from test files and auto-generates
openvm_init.rs
files are:In both macros, the change essentially boils down to changing:
(before)
to (after)
and then associated type changes (mostly simplifications) in converting tokens to strings.
There is one additional change needed only for the
sw_init!
macro case. Previously the linked functiondefined by the
sw_init!
macro did use the path of the struct within the function implementation. After this PR, we avoid this import by moving that part of the logic into thefn set_up_once()
function defined for the struct itself. This changed the function signature of the extern function to:Here is the diff of the code that was moved from the
#setup_extern_func()
into theset_up_once()
function.