bytecodealliance / bytecodealliance/wasmtime

Support specifying stack slot alignments

Open
#6,716 3 comments 3 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 18h
Merged PRs (30d)
126

Description

#### Feature

See title.

#### Benefit

Correct alignment are necessary to avoid crashes on some architectures and code may depend on correct alignment. In addition rustc checks that the right alignment is used when dereferencing a raw pointer in debug mode. This breaks rayon which allocates a stack value with cacheline alignment and then takes a raw pointer which it later dereferences. See https://github.com/bjorn3/rustc_codegen_cranelift/issues/1381.

#### Implementation

Sort stackslots by alignment for better packing and then add padding as necessary and if the alignment of a stack slot exceeds the ABI stack alignment realign the stack at runtime.

#### Alternatives

Doing dynamic alignment at runtime in the cranelift ir producer. This is slower and has higher stack usage overhead.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.