[move][tracing] Update tracing to support not generating unneeded values internally for sparse traces#25900
Open
[move][tracing] Update tracing to support not generating unneeded values internally for sparse traces#25900
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
cgswords
reviewed
Mar 19, 2026
| // Macro: resolve stack values as Push effects, or skip if !wants_effects. | ||
| // - push_effect!() — resolve the top-of-stack (index 0) as a single Push effect. | ||
| // - push_effect!(n) — resolve n stack values as Push effects (in reverse order). | ||
| macro_rules! push_effect { |
Contributor
There was a problem hiding this comment.
Please write a macro emit_effects! that takes a body and reuse it everywhere.
Also, this macro is weird to see littered in the code below. I think preserving the intent of that code by using some emit_effects! { ... } will help a lot.
Contributor
Author
There was a problem hiding this comment.
Updated. Much nicer!
cgswords
reviewed
Mar 19, 2026
| } | ||
|
|
||
| /// Skip building effects: clear any captured pre-effects and return empty. | ||
| fn skip_effects(&mut self) -> Vec<EF> { |
Contributor
There was a problem hiding this comment.
Why do we clear them here? I appreciate we are trying to save some work, but generating the pre-effects is work too. We should never run afoul of this in the limit.
Contributor
Author
There was a problem hiding this comment.
Was able to remove without much issue so good call.
…ues internally for sparse traces
1b3dbdf to
c201871
Compare
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.
Description
This adds
wants_effects()to theTracertrait so the VM tracer can skip expensive value resolution when the tracer will discard effect events and those values are not needed.When
InstructionOnlyTracerorFunctionOnlyTraceris used, the VM tracer was eagerly converting every runtime value into aSerializableMoveValueviainto_annotated_move_valuewhich incurred a recursive tree traversal with StructTag/Identifier cloning) for Push/Pop/Read/Write effects — only for those effects to be immediately filtered out bypush_event. This is the dominant per-instruction cost in the tracer.Changes:
Tracer::wants_effects() -> boolto the trait, and this is set to false byInstructionOnlyTracerandFunctionOnlyTracerwants_effects: boolin VMTracer at construction.start_instruction_impl: early-return path that skips all value resolution exceptStLocside effects (store_global/insert_local) and index capture forVecImmBorrow/VecMutBorrow.end_instruction_impl: usepush_effect!/emit!macros to gate value resolution behindwants_effects, while always performing type-stack management. Write-effect arms (StLoc,WriteRef,VecPushBack,VecSwap) use inline conditionals since their resolution logic is treated in a more special manner.The instruction-only trace baselines shrink (no effect events emitted), and full trace baselines see minor changes from the
FunctionOnlyTracer's notify fix (which was incorrectly keepingInstructionevents). The changes in the instruction only traces is because the trace IDs used for the frame IDs change (because the trace is smaller).Test plan
Existing tracing tests. This reduces generation of sparse traces
Release notes
Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.
For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.