[Webkit-unassigned] [Bug 198518] REGRESSION(r245586): static assertion failed: Match result and EncodedMatchResult should be the same size
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Jun 24 13:13:37 PDT 2019
https://bugs.webkit.org/show_bug.cgi?id=198518
--- Comment #11 from Keith Miller <keith_miller at apple.com> ---
(In reply to Mark Lam from comment #10)
> Comment on attachment 372782 [details]
> proposed patch
>
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=372782&action=review
>
> Also missing ChangeLog.
>
> > Source/JavaScriptCore/runtime/MatchResult.h 2019-06-24 18:36:36.947345256 +0000:43
> > #if CPU(ARM64) || CPU(X86_64)
> > +#define ENCODEDMATCHRESULT_IS_MATCHRESULT 1
> > using EncodedMatchResult = MatchResult;
> > -#else
> > +#elif (defined(SIZE_WIDTH) && (SIZE_WIDTH == 32)) || (SIZE_MAX == 0xffffffff)
> > +#define ENCODEDMATCHRESULT_IS_MATCHRESULT 0
> > using EncodedMatchResult = uint64_t;
> > +#else
> > +#define ENCODEDMATCHRESULT_IS_MATCHRESULT 1
> > +using EncodedMatchResult = MatchResult;
> > #endif
>
> This fix is invalid.
>
> The issue is that MatchResult contains 2 size_t values. This means, on
> 32-bit platforms, sizeof(MatchResult) is 64-bit, but on 64-bit platforms,
> sizeof(MatchResult) is 128-bit.
>
> The proper fix is simply:
>
> #if CPU(ADDRESS32)
> using EncodedMatchResult = uint64_t;
> static_assert(sizeof(size_t) == sizeof(uint32_t), "");
> #else
> using EncodedMatchResult = MatchResult;
> #endif
I think a better assertion would be static_assert(sizeof(EncodedMatchResult) == 2 * sizeof(size_t)), which should be true on all platforms. I like the rest of your change though.
The point of the EncodedMatchResult type is to ensure that the C calling convention will return the result in the two return registers rather than on the stack.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190624/19ced73b/attachment.html>
More information about the webkit-unassigned
mailing list