Stream: cranelift

Topic: more questions about hash functions


view this post on Zulip Kirp (Apr 26 2024 at 16:03):

In cranelift, a duplicate of the rustc FxHash is used in some places

1: as the rustc implementation is now on crates.io (rustc-hash) would it make sense to use that (or would it not be possible due to vetting)

2: otherwise would it be possible to separate out the current hash fn from the codegen crate so it could also be used elsewhere (eg in Isle compilation)

view this post on Zulip fitzgen (he/him) (Apr 26 2024 at 16:24):

I've used the fxhash crate before, which seems to be the same thing. Unclear to me the differences here, if any. All else being equal, I'd prefer to depend on the version that is owned by the rust-lang team.

vetting, as you mention, would be required but that doesn't mean this is impossible, just that a core maintainer would have to find the time to do the vet

view this post on Zulip fitzgen (he/him) (Apr 26 2024 at 16:24):

in general, I'd prefer option (1) over (2)

view this post on Zulip Kirp (Apr 26 2024 at 19:20):

Yh definitely understand preferring 1 over 2: could open a PR turning the current vendored version into the rustc one?

view this post on Zulip fitzgen (he/him) (Apr 26 2024 at 23:59):

yeah, I can commit to doing an audit of the crate if you make that PR

view this post on Zulip Kirp (Apr 27 2024 at 19:22):

PR is now open (tried pinging on GitHub but not sure if that worked) https://github.com/bytecodealliance/wasmtime/pull/8498

This removes the internal code for fxhash and instead uses the fxhash crate and subsequently migrates use of the fxhash crate (https://crates.io/crates/fxhash) to the rustc-hash crate (https://cra...

Last updated: Dec 23 2024 at 13:07 UTC