-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Improve array decode #7342
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
Merged
Improve array decode #7342
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
CodSpeed Performance ReportMerging #7342 will not alter performanceComparing Summary
|
ee3de5a
to
1c69c63
Compare
66a53f2
to
ae74d8e
Compare
44a6090
to
9acff6e
Compare
7c46cf4
to
d317025
Compare
tritao
reviewed
Sep 1, 2025
tritao
previously approved these changes
Sep 1, 2025
22691eb
to
cc152b5
Compare
tritao
approved these changes
Sep 2, 2025
IGI-111
approved these changes
Sep 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.
Description
Continuation of #6860.
This PR implements multiple small features focusing on improving
AbiDecode
for arrays.1 - Before this PR, the implementation of
AbiDecode
for arrays was decoding the first element and creating a "repeat array" with it. Depending on the array length, the initialisation would be fivestore
s or a loop copying the first item over all slots.Now we create a "repeat array" of zeros of the required size. This will be initialised with just one
MCLI
/MCL
. And then we transmute this into the desired array type.The final
ASM
is still far from ideal. But will improve with future optimizations.2 - Array lengths can now be specified using
const
variables.One limitation is that these lengths must be limited to simple
const
variables, local or global, but associatedconsts
are still not working.Another limitation is that we can't unify arrays lengths that use variables and literals. For example:
let _: [u64; 1] = [0u64; A]
;3 -
const
declarations can now useconst generics
in their expressions.4 -
__transmute
can now transmute references.5 - Snapshot tests now support a "filter-fn" command, which will parse the compiler output and focus on the specified fns. This will help by eliminating clutter from the snapshots.
Its first argument is the project that we want to filter, and the second is a comma-separated list of all function names we want.
In the example below,
{name}
is the name of the project where thesnapshot.toml
lives.convert_resolved_type_info
One of the biggest changes was that
convert_resolved_type_info
needs access to the "context" that is being compiled, as types can include expressions. At the moment, onlyconst variables
andconst generics variables
. But soon enough, we will be able to write more complex expressions, and we will need full access to available symbols.Checklist
Breaking*
orNew Feature
labels where relevant.