[Webkit-unassigned] [Bug 214142] [WTF] Fix PackedAlignedPtr for X86_64 canonical addresses

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jul 14 16:38:17 PDT 2020


https://bugs.webkit.org/show_bug.cgi?id=214142

--- Comment #39 from Mark Lam <mark.lam at apple.com> ---
Comment on attachment 404235
  --> https://bugs.webkit.org/attachment.cgi?id=404235
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=404235&action=review

The patch looks ready to land.  If you set the cq? flag, we can cq+ it to land it.

> Source/WTF/wtf/Packed.h:154
> +        if (value & 0x1ULL << (OS_CONSTANT(EFFECTIVE_ADDRESS_WIDTH) - 1))
> +            value |= ~((1ULL << OS_CONSTANT(EFFECTIVE_ADDRESS_WIDTH)) - 1);

FWIW, after thinking about this some more, I think you can implement a fast version of this:
    unsigned shiftBits = countOfBits<uintptr_t> - OS_CONSTANT(EFFECTIVE_ADDRESS_WIDTH);
    value = (bitwise_cast<intptr_t>(value) << shiftBits) >> shiftBits;

The CPU should be able to compute the shifts much faster than the masking + conditional branch + masking.  Plus the bytes needed to encode the shift instructions is probably less too.

Jim, if you want to apply this, you'll have to build and test it out on your Solaris machine yourself to make sure it works first.  The EWS bots will only ensure that the patch does not introduce bugs to other ports.  They won't be able to test its correctness since this code is not needed for other ports.

-- 
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/20200714/4c419ec2/attachment.htm>


More information about the webkit-unassigned mailing list