Camil Demetrescu edited approach.tex  over 8 years ago

Commit id: c980b399540aebd4548f45da99a651d5a031dc53

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 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) {\bf resolved OSR}: \fvariant\ is known before executing \fbase, as in the deoptimization example discussed above; 2) {\bf open OSR}: \fvariant\ is generated when the OSR is fired, supporting deferred compilation strategies. In both cases, for and OSR to be fired at a certain point \textsf{L}, the base function needs to be instrumented before its execution with code that checks the OSR condition. We denote with \fosrfrom\ the OSR-instrumented version of \fbase. If the condition is satisfied, control is transferred to \fvariant\ via a function call. In the first scenario, shown in Figure~\ref{fi:overview-osr-final}, the OSR invokes an instrumented version of \fvariant, which we call \textsf{f'$_{OSRto}$}. \fosrto.  This is possible since \fvariant\ is known when \fbase\ is instrumented. %and returns the same value when it has terminated. The assumption is that the called function produces the same side-effects and return values that one would obtain by \textsf{f} if no OSR were performed.