Title: [281317] trunk/Source/WTF
Revision
281317
Author
[email protected]
Date
2021-08-20 08:53:13 -0700 (Fri, 20 Aug 2021)

Log Message

Remove assertIsTagged and assertIsNullOrTagged.
https://bugs.webkit.org/show_bug.cgi?id=229329
rdar://82162851

Reviewed by Yusuke Suzuki.

These assertion utility functions rely on tagged pointers always having non-zero
PAC bits.  This is an incorrect assumption.  A tagged pointer can have PAC bits
that are completely zero.  Hence, these assert functions cannot be made to work
reliably.  We should remove them to prevent them from being used, and potentially
resulting in flaky assertion failures that will be hard to debug later.

Note: assertIsNotTagged is fine to keep.  It asserts that PAC bits of a pointer
are all 0.  As a result, this assertion can have false positives where it may think
a tagged pointer is an untagged pointer.  However, this is rare because it is not
common to have 0 PAC bits in tagged pointers.  False positives on this assertion
won't result in flaky test failures that will waste our time later.  Hence,
keeping the assertion will do more good (it will tend to help us find bugs) than
bad (it will rarely let false positives thru).  As a result, I'm opting to not
remove it.

* wtf/PtrTag.h:
(WTF::assertIsTagged): Deleted.
(WTF::assertIsNullOrTagged): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (281316 => 281317)


--- trunk/Source/WTF/ChangeLog	2021-08-20 15:30:03 UTC (rev 281316)
+++ trunk/Source/WTF/ChangeLog	2021-08-20 15:53:13 UTC (rev 281317)
@@ -1,3 +1,30 @@
+2021-08-20  Mark Lam  <[email protected]>
+
+        Remove assertIsTagged and assertIsNullOrTagged.
+        https://bugs.webkit.org/show_bug.cgi?id=229329
+        rdar://82162851
+
+        Reviewed by Yusuke Suzuki.
+
+        These assertion utility functions rely on tagged pointers always having non-zero
+        PAC bits.  This is an incorrect assumption.  A tagged pointer can have PAC bits
+        that are completely zero.  Hence, these assert functions cannot be made to work
+        reliably.  We should remove them to prevent them from being used, and potentially
+        resulting in flaky assertion failures that will be hard to debug later.
+
+        Note: assertIsNotTagged is fine to keep.  It asserts that PAC bits of a pointer
+        are all 0.  As a result, this assertion can have false positives where it may think
+        a tagged pointer is an untagged pointer.  However, this is rare because it is not
+        common to have 0 PAC bits in tagged pointers.  False positives on this assertion
+        won't result in flaky test failures that will waste our time later.  Hence,
+        keeping the assertion will do more good (it will tend to help us find bugs) than
+        bad (it will rarely let false positives thru).  As a result, I'm opting to not
+        remove it.
+
+        * wtf/PtrTag.h:
+        (WTF::assertIsTagged): Deleted.
+        (WTF::assertIsNullOrTagged): Deleted.
+
 2021-08-19  Antti Koivisto  <[email protected]>
 
         [:has() pseudo-class] Basic support

Modified: trunk/Source/WTF/wtf/PtrTag.h (281316 => 281317)


--- trunk/Source/WTF/wtf/PtrTag.h	2021-08-20 15:30:03 UTC (rev 281316)
+++ trunk/Source/WTF/wtf/PtrTag.h	2021-08-20 15:53:13 UTC (rev 281317)
@@ -318,20 +318,6 @@
     WTF_PTRTAG_ASSERT(PtrTagAction::DebugAssert, ptr, NoPtrTag, ptr == removeCodePtrTag(ptr));
 }
 
-template<typename PtrType>
-void assertIsTagged(PtrType value)
-{
-    void* ptr = bitwise_cast<void*>(value);
-    WTF_PTRTAG_ASSERT(PtrTagAction::DebugAssert, ptr, AnyPtrTag, ptr != removeCodePtrTag(ptr));
-}
-
-template<typename PtrType>
-void assertIsNullOrTagged(PtrType ptr)
-{
-    if (ptr)
-        assertIsTagged(ptr);
-}
-
 template<PtrTag tag, typename PtrType>
 bool isTaggedWith(PtrType value)
 {
@@ -578,8 +564,6 @@
 using WTF::assertIsCFunctionPtr;
 using WTF::assertIsNullOrCFunctionPtr;
 using WTF::assertIsNotTagged;
-using WTF::assertIsTagged;
-using WTF::assertIsNullOrTagged;
 using WTF::isTaggedWith;
 using WTF::assertIsTaggedWith;
 using WTF::assertIsNullOrTaggedWith;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to