Skip to content

Conversation

@ddkilzer
Copy link
Contributor

@ddkilzer ddkilzer commented Sep 20, 2024

9359aad

Optimize WTF::spanReinterpretCast
<https://bugs.webkit.org/show_bug.cgi?id=280032>
<rdar://136330115>

Reviewed by Alex Christensen.

* Source/WTF/wtf/StdLibExtras.h:
(WTF::spanReinterpretCast):
- Fix Extent in return type when std::dynamic_extent is not used.
- Prevent change of size in bytes when passing through
  spanReinterpretCast():
  - Limit RELEASE_ASSERT() to cases where std::dynamic_extent is used,
    and one of the following criteria:
    - The source type is smaller than the destination type, or
    - The source type is not an integral multiple of the destination
      type.
  - Use static_assert() when not using std::dynamic_extent.
- Fix name of function in message for static_assert() const-ness check.

* Tools/TestWebKitAPI/Tests/WTF/StdLibExtrasTests.cpp:
(TestWebKitAPI::TEST(WTF_StdLibExtras, SpanReinterpretCast_DynamicExtent)): Add.
(TestWebKitAPI::TEST(WTF_StdLibExtras, SpanReinterpretCast_DynamicExtent_ManualRuntimeErrors)): Add.
(TestWebKitAPI::TEST(WTF_StdLibExtras, SpanReinterpretCast_NonDynamicExtent)): Add.
(TestWebKitAPI::TEST(WTF_StdLibExtras, SpanReinterpretCast_NonDynamicExtent_CompileTimeErros)): Add.
- Add tests.

Canonical link: https://commits.webkit.org/284316@main

1031833

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ✅ 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🛠 wpe-cairo
✅ 🛠 🧪 jsc ✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
✅ 🛠 🧪 jsc-arm64 ✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🧪 api-gtk
✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2 ✅ 🛠 jsc-armv7
✅ 🛠 🧪 unsafe-merge ✅ 🛠 tv ❌ 🧪 jsc-armv7-tests
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@ddkilzer ddkilzer self-assigned this Sep 20, 2024
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Sep 20, 2024
@ddkilzer ddkilzer removed the merging-blocked Applied to prevent a change from being merged label Sep 20, 2024
@ddkilzer ddkilzer force-pushed the eng/Optimize-WTFspanReinterpretCast branch from 3c61a1f to d060871 Compare September 20, 2024 03:44
@ddkilzer ddkilzer force-pushed the eng/Optimize-WTFspanReinterpretCast branch from d060871 to 98a7c56 Compare September 20, 2024 18:03
@ddkilzer ddkilzer force-pushed the eng/Optimize-WTFspanReinterpretCast branch from 98a7c56 to 0803c62 Compare September 20, 2024 21:12
@ddkilzer ddkilzer force-pushed the eng/Optimize-WTFspanReinterpretCast branch from 0803c62 to 19f5ebe Compare September 21, 2024 01:46
@ddkilzer ddkilzer force-pushed the eng/Optimize-WTFspanReinterpretCast branch from 19f5ebe to 1f8fa0f Compare September 21, 2024 02:38
@ddkilzer ddkilzer force-pushed the eng/Optimize-WTFspanReinterpretCast branch from 1f8fa0f to 9d9253b Compare September 21, 2024 02:50
@ddkilzer ddkilzer force-pushed the eng/Optimize-WTFspanReinterpretCast branch from 9d9253b to 39a7e5f Compare September 21, 2024 03:05
Copy link
Contributor

@achristensen07 achristensen07 left a comment

Choose a reason for hiding this comment

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

lgtm still.

@ddkilzer ddkilzer force-pushed the eng/Optimize-WTFspanReinterpretCast branch from 39a7e5f to 13fc31d Compare September 26, 2024 03:17
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Sep 26, 2024
@ddkilzer ddkilzer removed the merging-blocked Applied to prevent a change from being merged label Sep 26, 2024
@ddkilzer ddkilzer force-pushed the eng/Optimize-WTFspanReinterpretCast branch from 13fc31d to 1031833 Compare September 26, 2024 16:27
@ddkilzer ddkilzer added the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Sep 26, 2024
<https://bugs.webkit.org/show_bug.cgi?id=280032>
<rdar://136330115>

Reviewed by Alex Christensen.

* Source/WTF/wtf/StdLibExtras.h:
(WTF::spanReinterpretCast):
- Fix Extent in return type when std::dynamic_extent is not used.
- Prevent change of size in bytes when passing through
  spanReinterpretCast():
  - Limit RELEASE_ASSERT() to cases where std::dynamic_extent is used,
    and one of the following criteria:
    - The source type is smaller than the destination type, or
    - The source type is not an integral multiple of the destination
      type.
  - Use static_assert() when not using std::dynamic_extent.
- Fix name of function in message for static_assert() const-ness check.

* Tools/TestWebKitAPI/Tests/WTF/StdLibExtrasTests.cpp:
(TestWebKitAPI::TEST(WTF_StdLibExtras, SpanReinterpretCast_DynamicExtent)): Add.
(TestWebKitAPI::TEST(WTF_StdLibExtras, SpanReinterpretCast_DynamicExtent_ManualRuntimeErrors)): Add.
(TestWebKitAPI::TEST(WTF_StdLibExtras, SpanReinterpretCast_NonDynamicExtent)): Add.
(TestWebKitAPI::TEST(WTF_StdLibExtras, SpanReinterpretCast_NonDynamicExtent_CompileTimeErros)): Add.
- Add tests.

Canonical link: https://commits.webkit.org/284316@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/Optimize-WTFspanReinterpretCast branch from 1031833 to 9359aad Compare September 26, 2024 21:46
@webkit-commit-queue
Copy link
Collaborator

Committed 284316@main (9359aad): https://commits.webkit.org/284316@main

Reviewed commits have been landed. Closing PR #33954 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 9359aad into WebKit:main Sep 26, 2024
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Sep 26, 2024
@ddkilzer ddkilzer deleted the eng/Optimize-WTFspanReinterpretCast branch September 26, 2024 21:57
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.

5 participants