bytecodealliance/wasmtime

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

已關閉

#7,588 建立於 2023年11月27日

 (2 則留言) (0 個反應) (0 位負責人)Rust (1,531 個分叉)batch import
good first issue

倉庫指標

星標
 (17,002 顆星)
PR 合併指標
 (平均合併 23小時 31分鐘) (30 天內合併 212 個 PR)

描述

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

貢獻者指南