Skip to content

Walk PE files' sections instead of using swift_enumerateAllMetadataSections(). #728

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 5 commits into from
Sep 24, 2024

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Sep 24, 2024

On Windows, the platform provides sufficient API for us to walk images at runtime looking for those that contain Swift metadata (similar to what we do on Darwin.) Therefore, we don't need to use the swift_enumerateAllMetadataSections() function from the Swift runtime on Windows.

This change also plumbs through an imageAddress argument to the discovery callback function. We're not currently using it, but it should be useful in the future for diagnostics (e.g. indicating that some data from a given image is malformed, or for passing to downstream testing tools that can make use of it.)

This change also also plumbs the stop argument down into the platform implementations so that we don't keep iterating images after the caller has told us to stop. In practice this has not been a correctness problem, but it does impact performance of type discovery.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

…ections()`.

On Windows, the platform provides sufficient API for us to walk images at runtime looking for those that contain Swift metadata (similar to what we do on Darwin.) Therefore, we don't need to use the `swift_enumerateAllMetadataSections()` function from the Swift runtime on Windows.

This change also plumbs through an `imageAddress` argument to the discovery callback function. We're not currently using it, but it should be useful in the future for diagnostics (e.g. indicating that some data from a given image is malformed, or for passing to downstream testing tools that can make use of it.)

This change _also_ also plumbs the `stop` argument _down_ into the platform implementations so that we don't keep iterating images after the caller has told us to stop. In practice this has not been a correctness problem, but it does impact performance of type discovery.
@grynspan grynspan added enhancement New feature or request windows 🪟 Windows support performance 🏎️ Performance issues labels Sep 24, 2024
@grynspan grynspan added this to the Swift 6.1 milestone Sep 24, 2024
@grynspan grynspan self-assigned this Sep 24, 2024
@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan grynspan requested a review from compnerd September 24, 2024 14:54
@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan grynspan merged commit baddcf0 into main Sep 24, 2024
3 checks passed
@grynspan grynspan deleted the jgrynspan/walk-PE-files branch September 24, 2024 18:14
@grynspan grynspan added the discovery 🔎 test content discovery label Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discovery 🔎 test content discovery enhancement New feature or request performance 🏎️ Performance issues windows 🪟 Windows support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants