-
Notifications
You must be signed in to change notification settings - Fork 250
fix(core): strip decorators while maintaining valid CSR structure #2524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -163,24 +163,11 @@ impl MastForest { | |
| id_remappings | ||
| } | ||
|
|
||
| /// Removes all decorators from this MAST forest. | ||
| /// Removes all decorators and error codes while keeping CSR structure valid. | ||
| /// | ||
| /// This method modifies the forest in-place, removing all decorator information | ||
| /// including operation-indexed decorators, before-enter decorators, after-exit | ||
| /// decorators, and error codes. | ||
| /// | ||
| /// # Examples | ||
| /// | ||
| /// ```rust | ||
| /// use miden_core::mast::MastForest; | ||
| /// | ||
| /// let mut forest = MastForest::new(); | ||
| /// // Add decorators and nodes to the forest | ||
| /// forest.strip_decorators(); // forest is now stripped | ||
| /// ``` | ||
| /// Useful for performance benchmarking without decorator overhead. | ||
| pub fn strip_decorators(&mut self) { | ||
| // Clear all debug info (decorators and error codes) | ||
| self.debug_info.clear(); | ||
| self.debug_info = DebugInfo::empty_for_nodes(self.nodes.len()); | ||
| } | ||
|
Comment on lines
169
to
171
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe not for this PR, but we should probably rename this into Also, I still don't fully understand why we need to preserve any info in the debug info upon clearing it. The PR description mentions some code paths that rely on this - what are these code paths? Basically, is is something we can change after #2470 is merged? I think the ideal end state would be to have |
||
|
|
||
| /// Compacts the forest by merging duplicate nodes. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we just initialize the vectors with N+1 zeros, instead of pushing them one by one.