<br><br><div class="gmail_quote">On Thu, Mar 31, 2011 at 11:07 PM, Eric Christopher <span dir="ltr"><<a href="mailto:echristo@apple.com">echristo@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 class="im">><br>
><br>
> No we will always have control over where the parent calls the functions that we are recompiling. As explained in the example below<br>
><br>
> Original Code<br>
><br>
> Binary for A:         Binary for B:<br>
><br>
> ...                         ...<br>
> ...                         ...<br>
> br B                      ...<br>
> ...                         ...<br>
> ...<br>
><br>
> After B is recompiled, we patch the entry of B with br helper<br>
><br>
> Binary for A:         Binary for B:        Binary for Recompiled B<br>
> ...                        br helper              ...<br>
> ...                        ...                        ...<br>
> br B                     ...                        ...<br>
> ...<br>
> ...<br>
><br>
><br>
> now when the parent A calls B, B branches to the helper, we will get the address of br B from the return address pushed onto the<br>
> stack or saved in the link register. The helper then patches the callsite in A<br>
><br>
> After Patching<br>
><br>
> Binary for A:               Binary for B:        Binary for Recompiled B<br>
> ...                               br helper             ...<br>
> ...                               ...                       ...<br>
> br Recompiled B          ...                       ...<br>
> ...<br>
> ...<br>
><br>
<br>
</div>Your helper is what I'm calling a stub (and what they're called in the jit at the moment).<br>
<font color="#888888"><br>
-eric<br></font></blockquote><div><br></div><div>Then we would always have the location of the br B instruction in A, as it is pushed onto the stack or saved in link register when A calls B.  </div></div><br><br clear="all">
<br>-- <br>Kind Regards <br><br>Xin Tong <br>