Skip to content

[Reflection] Add API for inspecting async task allocation slabs. #40071

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
Nov 17, 2021

Conversation

mikeash
Copy link
Contributor

@mikeash mikeash commented Nov 5, 2021

We remove the existing swift_reflection_iterateAsyncTaskAllocations API that attempts to provide all necessary information about a tasks's allocations starting from the task. Instead, we split it into two pieces: swift_reflection_asyncTaskSlabPointer to get the first slab for a task, and +swift_reflection_asyncTaskSlabAllocations to get the allocations in a slab, and a pointer to the next slab.

We also add a dummy metadata pointer to the beginning of each slab. This allows tools to identify slab allocations on the heap without needing to locate every single async task object. They can then use swift_reflection_asyncTaskSlabAllocations on such allocations to find out about the contents.

rdar://82549631

@mikeash mikeash requested review from al45tair and eeckstein November 9, 2021 18:29
@mikeash
Copy link
Contributor Author

mikeash commented Nov 9, 2021

@swift-ci please test

Copy link
Contributor

@eeckstein eeckstein left a comment

Choose a reason for hiding this comment

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

lgtm!

template <size_t SlabCapacity>
///
/// SlabMetadataPtr specifies a fake metadata pointer to place at the beginning
/// of slaba llocations, so analysis tools can identify them.
Copy link
Contributor

Choose a reason for hiding this comment

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

... slab allocations ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, good catch.

@mikeash mikeash force-pushed the remote-mirror-async-slab-inspection branch from 831c1b6 to 7133a59 Compare November 10, 2021 18:21
@mikeash
Copy link
Contributor Author

mikeash commented Nov 10, 2021

@swift-ci please test

We remove the existing `swift_reflection_iterateAsyncTaskAllocations` API that attempts to provide all necessary information about a tasks's allocations starting from the task. Instead, we split it into two pieces: `swift_reflection_asyncTaskSlabPointer` to get the first slab for a task, and `+swift_reflection_asyncTaskSlabAllocations` to get the allocations in a slab, and a pointer to the next slab.

We also add a dummy metadata pointer to the beginning of each slab. This allows tools to identify slab allocations on the heap without needing to locate every single async task object. They can then use `swift_reflection_asyncTaskSlabAllocations` on such allocations to find out about the contents.

rdar://82549631
@mikeash mikeash force-pushed the remote-mirror-async-slab-inspection branch from 7133a59 to 7c7dc5d Compare November 11, 2021 21:58
@mikeash
Copy link
Contributor Author

mikeash commented Nov 16, 2021

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 7c7dc5d

@mikeash
Copy link
Contributor Author

mikeash commented Nov 17, 2021

@swift-ci please test

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.

3 participants