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
andjump_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 indfg.insts
, because the borrow ondfg.insts
prevents taking a mutable borrow ondfg
. But we can call this new helper in that case.
jameysharp requested elliottt for a review on PR #8231.
jameysharp requested wasmtime-compiler-reviewers for a review on PR #8231.
elliottt submitted PR review:
Awesome!
jameysharp merged PR #8231.
Last updated: Nov 22 2024 at 17:03 UTC