REGRESSION(r245586): static assertion failed: Match result and EncodedMatchResult...
authormcatanzaro@igalia.com <mcatanzaro@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Jun 2019 16:08:27 +0000 (16:08 +0000)
committermcatanzaro@igalia.com <mcatanzaro@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Jun 2019 16:08:27 +0000 (16:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=198518

Reviewed by Keith Miller.

r245586 made some bad assumptions about the size of size_t, which we can solve using the
CPU(ADDRESS32) guard that I didn't know about.

This solution was developed by Mark Lam and Keith Miller. I'm just preparing the patch.

* runtime/MatchResult.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246792 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/MatchResult.h

index b2fef6a..fef3421 100644 (file)
@@ -1,3 +1,17 @@
+2019-06-25  Michael Catanzaro  <mcatanzaro@igalia.com>
+
+        REGRESSION(r245586): static assertion failed: Match result and EncodedMatchResult should be the same size
+        https://bugs.webkit.org/show_bug.cgi?id=198518
+
+        Reviewed by Keith Miller.
+
+        r245586 made some bad assumptions about the size of size_t, which we can solve using the
+        CPU(ADDRESS32) guard that I didn't know about.
+
+        This solution was developed by Mark Lam and Keith Miller. I'm just preparing the patch.
+
+        * runtime/MatchResult.h:
+
 2019-06-24  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r246714.
index c4aecaa..add264e 100644 (file)
 namespace JSC {
 
 struct MatchResult;
-#if CPU(ARM64) || CPU(X86_64)
-using EncodedMatchResult = MatchResult;
-#else
+#if CPU(ADDRESS32)
 using EncodedMatchResult = uint64_t;
+#else
+using EncodedMatchResult = MatchResult;
 #endif
 
 struct MatchResult {
@@ -50,7 +50,7 @@ struct MatchResult {
     {
     }
 
-#if !(CPU(ARM64) || CPU(X86_64))
+#if CPU(ADDRESS32)
     ALWAYS_INLINE MatchResult(EncodedMatchResult match)
         : start(bitwise_cast<MatchResult>(match).start)
         , end(bitwise_cast<MatchResult>(match).end)
@@ -79,6 +79,7 @@ struct MatchResult {
     size_t end;
 };
 
+static_assert(sizeof(EncodedMatchResult) == 2 * sizeof(size_t), "https://bugs.webkit.org/show_bug.cgi?id=198518#c11");
 static_assert(sizeof(MatchResult) == sizeof(EncodedMatchResult), "Match result and EncodedMatchResult should be the same size");
 
 } // namespace JSC