Stream: git-wasmtime

Topic: wasmtime / PR #8231 cranelift: New InstructionData::map_v...


view this post on Zulip Wasmtime GitHub notifications bot (Mar 25 2024 at 00:25):

jameysharp opened PR #8231 from jameysharp:map-values to bytecodealliance:main:

This is like the DataFlowGraph::map_inst_values method, but that method mutably borrows self, so it goes to a fair bit of trouble to drop its borrows around callbacks so the mutable borrow can be used in the callback too.

This new helper only actually needs to borrow two public fields from the DFG: value_lists and jump_tables. Therefore it's possible to use other fields in the callback as long as the compiler can see all the fields being used in the same scope. That's good enough for everywhere we were using this pattern, so we can simplify this way.

The case which motivated this change isn't shown here: It isn't possible to call dfg.map_inst_values on every instruction in dfg.insts, because the borrow on dfg.insts prevents taking a mutable borrow on dfg. But we can call this new helper in that case.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 25 2024 at 00:25):

jameysharp requested elliottt for a review on PR #8231.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 25 2024 at 00:25):

jameysharp requested wasmtime-compiler-reviewers for a review on PR #8231.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 25 2024 at 22:32):

elliottt submitted PR review:

Awesome!

view this post on Zulip Wasmtime GitHub notifications bot (Mar 25 2024 at 22:59):

jameysharp merged PR #8231.


Last updated: Nov 22 2024 at 17:03 UTC