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

Commit id: d86ea40d168ffaad42a0f88f8104faec526aeddd

deletions | additions      

       

In this section we discuss our implementation of the approach described in \ref{se:overview} in \tinyvm, a proof-of-concept virtual machine we developed as a playground to exercise our OSR techniques. TinyVM is based on LLVM's MCJIT compiler and supports interactive invocation of LLVM IR functions either generated at run-time or loaded from disk. The main design goal behind TinyVM is the creation of an interactive environment for IR manipulation and JIT-compilation of functions: for instance, it allows the user to insert OSR points in loaded functions, run optimization passes on them or display their CFGs, repeatedly invoke a function for a specified amount of times and so on. TinyVM supports dynamic library loading and linking, and comes with a helper component for MCJIT that simplifies tasks such as handling multiple IR modules, symbol resolution in presence of multiple versions of a function, and tracking native code and other machine-level generated object such as Stackmaps.  To explain how \tinyvm\ works, we consider the running toy  example of \myfigure\ref{fi:isord-example}. Function {\tt isord} checks whether an array of numbers is sorted according to some ordering given by a comparator function. A variant {\tt isordasc} is specialized for the ascending ordering.  \ifdefined\noauthorea  \begin{figure}[t] 

\end{figure}  \fi  \subsection{Resolved %\subsection{Resolved  OSR Points} \subsection{Open %\subsection{Open  OSR Points}   %\begin{verbatim}  %int fac(int n) {  % int i = 2, f = 1;  % while (i<=n) f *= i++;  % return f;  %}  %\end{verbatim}  %  %\begin{verbatim}  %int fac(int n) {  % int i = 2, f = 1;  % while (i<=n) {  % if (osr_cond) return fac_osr(n,i,f);   % f *= i++;   % } return f;  %}  %\end{verbatim}  %  %\begin{verbatim}  %int fac_osr(int n) {  % goto L;  % int i = 2, f = 1;  % while (i<=n) L: f *= i++;  % return f;  %}  %\end{verbatim}