Skip to content
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

Introduce the cranelift-bitset crate; use it for stack maps in both Cranelift and Wasmtime #8826

Merged
merged 11 commits into from
Jun 18, 2024

Conversation

fitzgen
Copy link
Member

@fitzgen fitzgen commented Jun 17, 2024

No description provided.

The eventual goal is to deduplicate bitset types between Cranelift and Wasmtime,
especially their use in stack maps.
Mostly for stack maps, also for a variety of other random things where
`cranelift_codegen::bitset::BitSet` was previously used.
@fitzgen fitzgen requested review from a team as code owners June 17, 2024 20:31
@fitzgen fitzgen requested review from abrown and elliottt and removed request for a team June 17, 2024 20:31
/// ```
#[inline]
pub fn contains(&self, i: u8) -> bool {
assert!(i < Self::capacity());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the perf-sensitive nature of bitsets should this be debug_assert!?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking that originally, but figured we might as well do the more-correct thing by default and add unchecked versions later if profiling shows that these asserts actually matter.

I kind of expect LLVM to clean them all up, at least when they are called via CompoundBitSet methods, since it should be able to determine the ranges of values flowing into these methods based on the modulo operation in CompoundBitSet::word_and_bit.

cranelift/bitset/src/compound.rs Outdated Show resolved Hide resolved
cranelift/bitset/src/compound.rs Outdated Show resolved Hide resolved
cranelift/bitset/src/compound.rs Outdated Show resolved Hide resolved
cranelift/bitset/src/compound.rs Outdated Show resolved Hide resolved
cranelift/bitset/src/compound.rs Outdated Show resolved Hide resolved
cranelift/bitset/src/compound.rs Outdated Show resolved Hide resolved
@fitzgen
Copy link
Member Author

fitzgen commented Jun 17, 2024

@alexcrichton this should be ready for a second round of review now.

@github-actions github-actions bot added cranelift Issues related to the Cranelift code generator cranelift:area:machinst Issues related to instruction selection and the new MachInst backend. cranelift:meta Everything related to the meta-language. labels Jun 17, 2024
cranelift/bitset/src/compound.rs Outdated Show resolved Hide resolved
@fitzgen fitzgen enabled auto-merge June 18, 2024 15:36
@fitzgen fitzgen added this pull request to the merge queue Jun 18, 2024
Merged via the queue into bytecodealliance:main with commit b3636ff Jun 18, 2024
36 checks passed
@fitzgen fitzgen deleted the cranelift-bitset branch June 18, 2024 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cranelift:area:machinst Issues related to instruction selection and the new MachInst backend. cranelift:meta Everything related to the meta-language. cranelift Issues related to the Cranelift code generator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants