dcdelia  over 8 years ago

Commit id: 61401394a2b037af167d0f5f22e3a6d7450c087f

deletions | additions      

       

\ifdefined \fullver  As a next step, the optimizer asks the IIR compiler to process \fOptIIR\ and generate optimized LLVM IR \fOptIR, also storing the variable map between IIR and IR objects when compiling the direct call corresponding to the \feval\ instruction that triggered the OSR.  \else  As a next step, the optimizer asks the IIR compiler to lower \fOptIIR\ to \fOptIR. During the process, the compiler stores the variable map between IIR and IR objects at the direct call replacing the \feval\ instruction that triggered the OSR.  \fi  This map is essential for the next step, which is constructing a state mapping between \fIR\ to \fOptIR, as it is compared against the corresponding map stored during the lowering of \fBase\ to determine whether for each value in \fOptIR\ live at the continuation block:  \begin{itemize}[noitemsep, partopsep=0.5ex, topsep=0.5ex]  \item an {\tt llvm::Value*} from \fIR\ passed as argument at the OSR point can be used directly  \item or, compensation code is required to reconstruct its value before jumping to the block.  \end{itemize}  \else  As a next step, the optimizer asks the IIR compiler to lower \fOptIIR\ to \fOptIR. During the process, the compiler stores the variable map between IIR and IR objects at the direct call replacing the \feval\ instruction that triggered the OSR.  Using this map and the one stored during the lowering of \fbase, the optimizer constructs a state mapping between \fIR\ and \fOptIR. In particular, for each value in \fOptIR\ live at the continuation block we determine whether:  %\begin{enumerate}[label={(\alph*)}, noitemsep, partopsep=0.5ex, topsep=0.5ex]  \begin{itemize}[noitemsep, partopsep=0.5ex, topsep=0.5ex]  \item a live {\tt llvm::Value*} from \fIR\ passed at the OSR point can be used directly,  \item or a compensation code is required to set its value.  \end{itemize}  %\end{enumerate}  \fi  \noindent In fact, since the type inference engine yields more accurate results for \fOptIIR\ compared to \fIIR, the IIR compiler can in turn generate efficient specialized IR code for representing and manipulating IIR variables, and compensation code is typically required to unbox or downcast some of the live values passed at the OSR point.  \ifdefined \fullver  Compensation code might also be required to materialize an IR object for an IIR variable that were previously accessed through get/set methods from the environment. %TODO  \fi  \ifdefined \fullver  Once a state mapping object has been constructed, the optimizer calls our OSR library to generate the continuation function for the OSR transition and eventually compiles it. A pointer to the compiled function is stored in the code cache and returned to the stub, which invokes it through an indirect call passing the live state saved at the OSR point. \else  Once a state mapping has been constructed, the optimizer asks \osrkit\ to generate the continuation function for the OSR transition and eventually executes it.  \fi  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%  \paragraph{Discussion.}