Skip to content

[NFC] Add some span unit tests for bounds check optimizations #79129

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
Feb 7, 2025

Conversation

meg-gupta
Copy link
Contributor

@meg-gupta meg-gupta commented Feb 4, 2025

Add swift unit tests for testing bounds check optimizations for Span.

@meg-gupta meg-gupta changed the title Add some span unit tests for bounds check optimizations [NFC] Add some span unit tests for bounds check optimizations Feb 4, 2025
@meg-gupta meg-gupta force-pushed the boundstests branch 3 times, most recently from c8827c0 to 9c3329f Compare February 5, 2025 23:38
@meg-gupta meg-gupta marked this pull request as ready for review February 5, 2025 23:46
@meg-gupta meg-gupta requested a review from eeckstein as a code owner February 5, 2025 23:46
@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta
Copy link
Contributor Author

@swift-ci smoke test

@meg-gupta meg-gupta enabled auto-merge February 6, 2025 01:14
Copy link
Contributor

@atrick atrick left a comment

Choose a reason for hiding this comment

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

@glessard may want to review the SpanExtras.

I briefly scanned the test cases. Looks good. It makes sense to start with BitwiseCopyable. But should we eventually have non-trivial or even generic elements types?

@_unsafeNonescapableResult
@inlinable @inline(__always)
@lifetime(borrow source)
public func _overrideLifetime<
Copy link
Contributor

@atrick atrick Feb 6, 2025

Choose a reason for hiding this comment

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

It would be helpful to use the same syntax for _overrideLifetime everywhere. We should copy the standard library's implementation. I always spend a lot of time adapting code from @glessard because he hasn't updated his repos yet.

_overrideLifetime(_:borrowing)
_overrideLifetime(_:copying)
_overrideLifetime(_:mutating)

@meg-gupta
Copy link
Contributor Author

I copied the MutableSpan/OutputpSpan verbatim from @glessard's repo.
@atrick I'll add more tests for generic, non-trivial and ~Copyable types as a follow up.

@meg-gupta
Copy link
Contributor Author

@swift-ci smoke test

@meg-gupta
Copy link
Contributor Author

@swift-ci smoke test

1 similar comment
@meg-gupta
Copy link
Contributor Author

@swift-ci smoke test

@meg-gupta
Copy link
Contributor Author

@swift-ci smoke test

@meg-gupta
Copy link
Contributor Author

@swift-ci smoke test windows platform

@atrick
Copy link
Contributor

atrick commented Feb 7, 2025

I copied the MutableSpan/OutputpSpan verbatim from @glessard's repo.
@atrick I'll add more tests for generic, non-trivial and ~Copyable types as a follow up.

I know. And that means I'll need to go into all these tests and rewrite them all!

@meg-gupta
Copy link
Contributor Author

@atrick I am update _overrideLifetime usages here - 292f313

@meg-gupta meg-gupta merged commit 64ae2a9 into swiftlang:main Feb 7, 2025
3 checks passed
@atrick
Copy link
Contributor

atrick commented Feb 8, 2025

I'm not sure why the PR test passed here. Attempting to fix it:
#79239

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.

2 participants