Camil Demetrescu edited osr-llvm.tex  over 8 years ago

Commit id: c3f0d06b4258f297f2d4a6ac37daa3f2178a0368

deletions | additions      

       

\paragraph{x86-64 Lowering.}  The final step to be performed before execution is native code generation. \myfigure\ref{fig:isordx86-64} shows the x86-64 code generated by LLVM for {\tt isordfrom} and {\tt isordto}. For the sake of comparison with the native code that would be generated for the original non-OSR versions, additions resulting from the IR instrumentation are in grey, while removals are struck-through. Notice that the OSR intrusiveness in {\tt isordfrom} is minimal, consisting of just two assembly instructions with register and immediate operands. As a result of induction variable canonicalization in the LLVM back-end, loop index {\tt i} and hotness counter {\tt p.osr} are fused in register {\tt\%r12}. We also note that tail call optimization is applied in the OSR-firing block, resulting in no stack growth during an OSR. The continuation function is identical to the optimized version of {\tt isord}, except that the loop index is passed as a parameter in {\tt \%rdx} and no loop pre-header is needed since OSR jumps directly in the loop body.  \subsection{Instrumentation \subsection{\osrkit\ Instrumentation  API} \label{se:instrum-api}  To support the IR instrumentation tasks of \mysection\ref{se:overview}, \osrkit\ provides a number of abstractions for VM builders. A simplified overview of the main building blocks is:  \begin{itemize}  \item {\tt {\em  StateMapper}: module that [...] \item {\tt {\em  insertResolvedOSR(f1, b1, f2, b2, cond, m)}: function that inserts a resolved OSR point in f1 function $f1$  at basic block b1 $b1$  to function b2 $b2$  at basic block b2, $b2$,  using as OSR condition a sequence of IR instructions {\tt cond}, $cond$, and  a state map {\tt m}. mapper $m$.  \item {\tt insertOpenOSR()} {\em insertOpenOSR()}: [...]  \item {\tt {\em  generateOSRDestFun()} [...]  \end{itemize}    %To place an open OSR, \tinyvm\ requires the following pieces of information: 1) a pointer to the