Repository navigation
Conversation
|
@ctiller would you be up for resolving CI and rebasing here too? |
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
c4521b1 to
f552cfa
Compare
|
@ctiller it looks like this is yet again a merge conflict as one of your other PRs merged first -- could you resolve again? (In the future if submitting a cluster of PRs that will mutually conflict, we're happy to take a slightly larger single PR with everything pre-merged, if that's easier -- it certainly reduces this kind of churn for us!) |
|
Thanks @ctiller for your contribution to this repository, but Bytecode Alliance projects have been overwhelmed with AI-generated AI usage must abide by the Bytecode Alliance's AI Tool Use If you believe this PR was caught by this bot erroneously, reach |
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