Repository navigation
Conversation
During `FuncTranslator::translate_module_startup`, fuel costs from earlier startup instructions (such as `global.init` constant expressions) are buffered in `self.fuel_consumed` until flushed into the SSA `self.fuel_var`. In `FuncEnvironment::translate_static_memory_init`, the copy-on-write check branches directly to `end_block` (`brif(is_null, end_block, init_block)`), while `self.fuel_consumed` was only flushed inside `init_block` via `fuel_consume_for_bulk_op`. When the CoW fast path was taken (`is_null != 0`), `init_block` was skipped and the buffered compile-time startup fuel was lost. Call `self.fuel_increment_var(builder)` before `brif(is_null, end_block, init_block)` when `consume_fuel` is enabled so both arms of the branch see the prior startup fuel. Assisted-by: Gemini
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 10, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
During
FuncTranslator::translate_module_startup, fuel costs from earlier startup instructions (such asglobal.initconstant expressions) are buffered inself.fuel_consumeduntil flushed into the SSAself.fuel_var.In
FuncEnvironment::translate_static_memory_init, the copy-on-write check branches directly toend_block(brif(is_null, end_block, init_block)), whileself.fuel_consumedwas only flushed insideinit_blockviafuel_consume_for_bulk_op. When the CoW fast path was taken (is_null != 0),init_blockwas skipped and the buffered compile-time startup fuel was lost.Call
self.fuel_increment_var(builder)beforebrif(is_null, end_block, init_block)whenconsume_fuelis enabled so both arms of the branch see the prior startup fuel.Assisted-by: Gemini