bytecodealliance/wasmtime

Eagerly cast pointers in aarch64 relocation code to `usize` to avoid `unsafe` blocks in cranelift-jit

クローズ

#7,588 opened on 2023/11/27

 (2 件のコメント) (0 件のリアクション) (0 人の担当者)Rust (1,531 件のフォーク)batch import
good first issue

Repository metrics

Stars
 (17,002 個のスター)
PR merge metrics
 (平均マージ 23h 31m) (30d で 212 merged PRs)

説明

When performing relocations in cranelift-jit, there are many introductions of a variable what that's defined as an unsafe pointer offset. These variables are almost always cast to usize or isize before they're used, so perhaps we should instead turn the base pointer into its target numeric type eagerly, to avoid needing the unsafe blocks for calling the offset method on the pointers.

https://github.com/bytecodealliance/wasmtime/blob/cd97c9f14713d81de5453fb9861319e78a761432/cranelift/jit/src/compiled_blob.rs#L55-L57

コントリビューターガイド