Skip to content

Add binding anchors; make profile-all use srcspan from anchors#7730

Open
SeungheonOh wants to merge 1 commit intomasterfrom
sho/proileSrcspan
Open

Add binding anchors; make profile-all use srcspan from anchors#7730
SeungheonOh wants to merge 1 commit intomasterfrom
sho/proileSrcspan

Conversation

@SeungheonOh
Copy link
Copy Markdown
Collaborator

closes #7722

Added anchors to bindings; added anchors can be used in profile-all which is used for profiling and call tracing to mark function entrance/exit source span.

Previously, function entrance and exit source span was extracted from GHC.Var which only gave source span when the module was freshly compiled. When module was not compiled and cache was used from previous compilation, GHC.Var will not provide any source span. New anchor based source span fixes this and provide correct source span even when module compilation is cached.

@SeungheonOh SeungheonOh self-assigned this Apr 21, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Execution Budget Golden Diff

1b9ee7c (master) vs 9748b98

output

plutus-tx-plugin/test/CallTrace/9.6/successfullEvaluationYieldsNoTraceLog.golden.eval

Metric Old New Δ%
CPU 1_653_088 2_579_080 +56.02%
Memory 8_392 12_820 +52.76%
Flat Size 451 489 +8.43%

This comment will get updated when changes are made.

@SeungheonOh SeungheonOh added the No Changelog Required Add this to skip the Changelog Check label Apr 21, 2026
anchor for every hoisted binding, so profile-trace output identifies which
function was entered (the span points to the binder, not an arbitrary
sub-expression). See issue #7722. -}
anchorBinding
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are using same anchor function that's being used for anchoring expressions. It's working okay at the moment, but maybe in the future we want to separate binding anchors with some other anchor function like bindingAnchor so that it can be distinguished more easily


{-| Find the first @anchor@-carried 'RealSrcSpan' anywhere inside a 'CoreExpr',
descending through applications, lambdas, lets, cases, casts, and ticks.
Useful when the immediate head of the expression is not an anchor call
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have an example where the immediate head of the expression is not an anchor call, because it was hoisted?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking back, I don't think this is the case anymore after adding binding anchor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

No Changelog Required Add this to skip the Changelog Check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make profiling output include better source span

2 participants