Camil Demetrescu edited approach.tex  over 8 years ago

Commit id: a8db7b1b3ee1919aca368ee8874cb0ef2568a24a

deletions | additions      

       

Classical OSR implementations adjust the stack so that execution can continue in \fvariant\ with the current frame \mynote{add citations}. This requires manipulating the program state at machine code level and is highly ABI- and compiler-dependent. A simpler approach, which we follow in this article, consists of creating a new frame every time an OSR is fired, essentially regarding an OSR transition as a function call \mynote{cite WebKit and McVM}.   Our implementation targets two general scenarios: 1) {\em resolved OSR}: \fvariant\ is known before executing \fbase\ as in the deoptimization example discussed above; 2) {\em open OSR}: \fvariant\ is generated when the OSR is fired, supporting deferred compilation strategies. In both cases, \fbase\ is instrumented before its execution to incorporate the OSR machinery. We call such OSR-instrumented version \fosrfrom.Instrumentation consists of adding a check of the OSR condition and, if the condition is satisfied, a function call that fires the OSR, followed by a return statement. The assumption is that the called function produces the same side-effects and return values that one would obtain by \fbase\ if no OSR were performed.  In the resolved OSR scenario (see Figure~\ref{fi:overview-osr-final}), instrumentation consists of adding a check of  the OSR invokes condition and, if the condition is satisfied, a function call that fires the OSR. The invoked function is  an instrumented version of \fvariant\ called \fosrto, passing to it {\em all variables \fvariant, which we call \fosrto. The assumption is  that are live at \fosrto\ produces  the same side-effects and return value that one would obtain by \fbase\ if no OSR were performed. Indeed, if an  OSR point}. Notice that, differently is fired then \fosrfrom\ returns the return value of \fosrto. Differently  from \fvariant, \fosrto\ takes as input the all  live variables of \fbase\ at \textsf{L}.%and returns the same value when it has terminated.  %\ref{fi:overview-osr-final}