Camil Demetrescu edited approach.tex  over 8 years ago

Commit id: abc020a9fb6c9287906407c8097516534cc9515c

deletions | additions      

       

Classical OSR implementations adjust the stack so that execution can continue in \textsf{f'} 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}: \textsf{f'} is known before executing \textsf{f}, as in the deoptimization example discussed above; 2) {\bf open OSR}: \textsf{f'} 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 \textsf{f$_{OSRfrom}$} \textsf{f$_{\textst{OSRfrom}}$}  the OSR-instrumented version of \textsf{f}. If the condition is satisfied, control is transferred to \textsf{f'} via a function call. In the first scenario, shown in Figure~\ref{fi:overview-osr-final}, the OSR invokes an instrumented version of \textsf{f'}, which we call \textsf{f'$_{OSRto}$}. This is possible since \textsf{f'} is known when \textsf{f} 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.