Add a workaround for Safari 9 ARM iOS right shift by non-immediate zero JIT bug - #231
Conversation
|
Odd bug... I'm not sure this is completely enough, though, as we may emit |
|
On the other hand, that would be slower to run, and this does seem fairly simple. lgtm. |
|
I did go through all shifts I could find in JSBackend, and looked for non-immediate shifts that could be zero, this was the only place I found. If you know of places off the top of your head, let me know. Apart from that, iPhone 4s with iOS 9.3.5 is so old target that may not be worth spending time to look too deep into this, unless someone runs into a real problem that needs debugging further. |
I do not unfortunately have a small test case, since it somehow interacts with JIT, and simple
emscripten_request_animation_frame()based attempts to build a repro that'd get fed to a JIT after some warm-up runs ended up empty.The original issue occurs on stb_image codebase in function
https://github.com/nothings/stb/blob/e6afb9cbae4064da8c3e69af3ff5c4629579c1d2/deprecated/stb_image.c#L1999-L2005
on the right shift on the last return line, when loading up a png image; where it is observed that
v==16222142, a non-zero non-negative i32 number, andbits==16, yielding a shift right by 0, but the expression would compute16222142 >> 0 == 0and return 0.Verified this patch to fix the above
stb_imageloading code. The odd thing is that the patch was supposed to have landed on Feb 15th 2016, but iOS 9.3.5 was released only much later on August 25th, but the observed symptoms fit the description of the issue in https://bugs.webkit.org/show_bug.cgi?id=151514 perfectly, so very probable that was the cause.