Skip to content

[Profiler] Clean up CounterExpr allocation #61474

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

Merged
merged 1 commit into from
Oct 7, 2022

Conversation

hamishknight
Copy link
Contributor

Use a BumpPtrAllocator instead of a linked list, and allocate internally within the CounterExpr so we can just pass about values instead of pointers and references. This allows us to eliminate CounterExpr::Ref.

Unfortunately this means we can no longer store CounterExprs in the SourceMappingRegions for nodes, as we were previously using pointers to propagate updates the counters made after the region was popped. Instead we now have to query the CounterMap. But IMO this is a worthwhile tradeoff for code that's easier to reason about.

Use a BumpPtrAllocator instead of a linked list,
and allocate internally within the CounterExpr so
we can just pass about values instead of pointers
and references. This allows us to eliminate
`CounterExpr::Ref`.

Unfortunately this means we can no longer store
CounterExprs in the SourceMappingRegions for
nodes, as we were previously using pointers to
propagate updates the counters made after the
region was popped. Instead we now have to query
the `CounterMap`. But IMO this is a worthwhile
tradeoff for code that's easier to reason about.
@hamishknight
Copy link
Contributor Author

@swift-ci please test

@hamishknight hamishknight merged commit e51f1ff into swiftlang:main Oct 7, 2022
@hamishknight hamishknight deleted the bumper-counters branch October 7, 2022 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant