<div dir="ltr">Hi Simon,<div><br></div><div>I have been inspecting what gcc generates and found that in all the functions I checked which used the thread status in a switch, none of them generated jump tables, rather, long chains of cmp's.</div>
<div><br></div><div>I predict this is because there are overlapping cases (or even a fall-through in one I saw, which looked accidental...).</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 22, 2014 at 5:32 AM, Simon Marlow <span dir="ltr"><<a href="mailto:marlowsd@gmail.com" target="_blank">marlowsd@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 19/07/2014 06:00, Kyle Van Berendonck wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I found these:<br>
<a href="https://github.com/ghc/ghc/blob/5f3c5384df59717ca8013c5df8d1f65692867825/includes/rts/Constants.h#L194" target="_blank">https://github.com/ghc/ghc/<u></u>blob/<u></u>5f3c5384df59717ca8013c5df8d1f6<u></u>5692867825/includes/rts/<u></u>Constants.h#L194</a><br>

<br>
They go only 0-14, so there's some long chains of branches and stuff in<br>
hot paths that could be cleaned up into single &-masked branches by<br>
changing these into a set of flags.<br>
</blockquote>
<br>
GHC will generate a table jump for a large dense case, if that's what you're worried about.<br>
<br>
Cheers,<br>
Simon<br>
</blockquote></div><br></div>