Stream: git-wasmtime

Topic: wasmtime / PR #14646 cranelift: charge Else and End opera...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 09 2026 at 23:46):

ctiller opened PR #14646 from ctiller:fix/else-end-operator-fuel to bytecodealliance:main:

FuncEnvironment::fuel_before_op previously added the operator cost for every instruction other than Nop and Drop before translate_operator ran, guarded by state.reachable at instruction entry. For Operator::Else and Operator::End, this caused two bugs when custom OperatorCost values were configured:

  1. At entry to Operator::Else, builder is still positioned at the end of the then block before translate_operator emits the jump to exit_block and switches builder to the else block. Charging Else in fuel_before_op therefore charged Else when the then branch was taken and failed to charge Else when the else branch was taken.
  2. When the then block (or the body preceding End) ended with an unconditional control transfer (return, br, etc.), state.reachable was false entering Else or End, so before_translate_operator skipped fuel_before_op even when the else block or merged End block was reachable via another incoming edge.

Defer Operator::Else and Operator::End fuel charging from fuel_before_op to fuel_after_op, after translate_operator has switched builder to the target block and updated state.reachable.

Assisted-by: Gemini

view this post on Zulip Wasmtime GitHub notifications bot (Oct 09 2026 at 23:46):

ctiller requested pchickey for a review on PR #14646.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 09 2026 at 23:46):

ctiller requested wasmtime-core-reviewers for a review on PR #14646.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 10 2026 at 00:06):

ctiller requested alexcrichton for a review on PR #14646.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 10 2026 at 00:06):

ctiller requested wasmtime-compiler-reviewers for a review on PR #14646.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 10 2026 at 00:06):

ctiller updated PR #14646.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 10 2026 at 00:27):

:thumbs_up: cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 10 2026 at 00:27):

cfallin added PR #14646 cranelift: charge Else and End operator fuel in target blocks to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 10 2026 at 04:12):

github-merge-queue[bot] removed PR #14646 cranelift: charge Else and End operator fuel in target blocks from the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 10 2026 at 18:08):

alexcrichton added PR #14646 cranelift: charge Else and End operator fuel in target blocks to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 10 2026 at 18:32):

:check: alexcrichton merged PR #14646.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 10 2026 at 18:32):

alexcrichton removed PR #14646 cranelift: charge Else and End operator fuel in target blocks from the merge queue.


Last updated: Oct 11 2026 at 04:10 UTC