<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Apr 23, 2015 at 5:17 PM, Andrew Trick <span dir="ltr"><<a href="mailto:atrick@apple.com" target="_blank">atrick@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div class="h5"><span style="color:rgb(34,34,34)">The scheduler itself doesn’t move anything around labels. But any pass can perform code motion or load/store optimization. Also, any pass can insert an instruction, like a copy, between the label and the load.</span><br></div></div><div><br></div><div>I’m not really sure how EH_LABEL ends up translating into exception tables, but my guess is that it’s encoding a range that may include any arbitrary instructions as long as the call is within the range. So as long as calls aren’t reordered with labels and appears to have side effects it would work.</div><div><br></div><div>So, you could add a different kind of stack map entry that encodes ranges instead of exact addresses, then survey all passes to ensure they don’t optimize loads across labels. I would have more confidence doing this with a pseudo instruction though.</div></div></blockquote><div><br></div><div>I guess your concern is that you need an exact address to do patching.</div><div><br></div><div>If this feature is limited to simply allow handling exceptions raised from loads and stores, then I'm not worried about copies, adds, or other code being moved into the label range. We don't support catching traps from those kinds of instructions. I'm only worried about memory accesses being moved into the range. If we can address that, I think the EH_LABEL approach works, and it generalizes to other trapping instructions like division or FP exceptions.</div></div></div></div>