Camil Demetrescu edited overview.tex  over 8 years ago

Commit id: eed0a84e4890fc6923a86384dfb1131207b56381

deletions | additions      

       

%\subsection{Overview}  %\label{ss:overview}  Consider the generic OSR scenario shown in \myfigure\ref{fi:osr-dynamics}. A base function \fbase\ is executed and it can either terminate normally (dashed lines), or an OSR event may transfer control to a variant \fvariant. \fvariant, which acts as a continuation function.  The decision of whether an OSR should be fired at a given point \osrpoint\ of \fbase\ is based on an {\em OSR condition}. A typical example in JIT-based virtual machines is a profile counter reaching a certain hotness threshold, which indicates that \fbase\ is taking longer than expected and is worth optimizing. Another example is a guard testing whether \fbase\ has become unsafe and execution needs to fall back to a safe version \fvariant. This scenario includes deoptimization of functions generated with aggressive speculative optimizations. Classic OSR implementations adjust the stack so that execution can continue in \fvariant\ with the current frame \cite{chambers1992design}. 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~\cite{Lameed_2013,webkit14}.