[webkit-changes] [WebKit/WebKit] 6fb73d: Clean up TaggedPtr

Keith Miller noreply at github.com
Tue Feb 4 10:39:12 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6fb73d00567745370a0757483e620a9e11976cab
      https://github.com/WebKit/WebKit/commit/6fb73d00567745370a0757483e620a9e11976cab
  Author: Keith Miller <keith_miller at apple.com>
  Date:   2025-02-04 (Tue, 04 Feb 2025)

  Changed paths:
    M Source/WTF/wtf/TaggedPtr.h

  Log Message:
  -----------
  Clean up TaggedPtr
https://bugs.webkit.org/show_bug.cgi?id=287018
rdar://144160928

Reviewed by Yusuke Suzuki.

Relying on ARM64's top byte ignore and leaking those bits is problematic since people might try to do
pointer equality comparisions on the pointer returned by TaggedPtr or more perniciously by doing
`taggedPtr->foo()` and `foo` doing pointer comparisons. I think LLVM should be able to notice when
it can use TBI to skip stripping the tag (rdar://144164498).

I also added a concept to document the API for TaggedPtr's TaggingTraits and renamed things to
better match RefPtr's PtrTraits.

* Source/WTF/wtf/TaggedPtr.h:
(WTF::requires):
(WTF::TaggedPtr::TaggedPtr):
(WTF::TaggedPtr::tag const):
(WTF::TaggedPtr::ptr const):
(WTF::TaggedPtr::ptr):
(WTF::TaggedPtr::set):
(WTF::TaggedPtr::setTag):
(WTF::TaggedPtr::operator=):
(WTF::TaggedPtr::operator-> const):
(WTF::TaggedPtr::operator->):
(WTF::static_cast<Enum>):
(WTF::NoTaggingTraits::wrap):
(WTF::NoTaggingTraits::unwrapPtr):
(WTF::NoTaggingTraits::unwrapTag):
(WTF::NoTaggingTraits::encode): Deleted.
(WTF::NoTaggingTraits::extractPtr): Deleted.
(WTF::NoTaggingTraits::extractTag): Deleted.

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list