Cranelift: update ValueDataPacked to support full Value range.#12613
Open
cfallin wants to merge 1 commit intobytecodealliance:mainfrom
Open
Cranelift: update ValueDataPacked to support full Value range.#12613cfallin wants to merge 1 commit intobytecodealliance:mainfrom
cfallin wants to merge 1 commit intobytecodealliance:mainfrom
Conversation
This updates the `ValueDataPacked` scheme from the old
```
(enum tag) (CLIF type) (value 1) (value 2)
/// | tag:2 | type:14 | x:24 | y:24
```
encoding in a `u64` to a new
```
/// | tag:2 | type:14 | x:32 | y:32
```
encoding, with a `packed` tag attribute to ensure the struct fits in
10 bytes. This permits the full range of `Value` (a `u32` entity
index) to be encoded, removing the remaining major limit on function
body size after the work in bytecodealliance#12611 to address bytecodealliance#12229.
Curiously, this appears to be a *speedup* in compile time of 3-5% on
bz2 and 3% on spidermonkey-json (Sightglass, 50 data points each). My
best guess as to why is that putting the value fields in their own
`u32`s allows for quick access without shifts/masks, which is actually
better than the unaligned accesses (caused by 10-byte size) -- which
have no penalty on modern mainstream CPUs -- and 25% size inflation of
the value-definitions array.
a5e172f to
dde5ddd
Compare
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 updates the
ValueDataPackedscheme from the oldencoding in a
u64to a newencoding, with a
packedtag attribute to ensure the struct fits in 10 bytes. This permits the full range ofValue(au32entity index) to be encoded, removing the remaining major limit on function body size after the work in #12611 to address #12229.Curiously, this appears to be a speedup in compile time of 3-5% on bz2 and 3% on spidermonkey-json (Sightglass, 50 data points each). My best guess as to why is that putting the value fields in their own
u32s allows for quick access without shifts/masks, which is actually better than the unaligned accesses (caused by 10-byte size) -- which have no penalty on modern mainstream CPUs -- and 25% size inflation of the value-definitions array.