this is for holding javascript data
Camil Demetrescu edited osr-llvm.tex
over 8 years ago
Commit id: c49a387f4c71e80afad1852fa8a59becc72ed428
deletions | additions
diff --git a/osr-llvm.tex b/osr-llvm.tex
index 3300d53..68abdb4 100644
--- a/osr-llvm.tex
+++ b/osr-llvm.tex
...
\paragraph{OSR Instrumentation.}
We use deferred compilation by instrumenting {\tt isord} in \tinyvm\ with an open OSR at the beginning of the loop body, as shown in \myfigure\ref{fig:isordfrom}. Portions added to the original code by OSR istrumentation are highlighted in grey.
%The figure illustrates how the original {\tt isord} code is instrumented by \tinyvm, highlighting in grey the added portions.
A new basic block is placed at the beginning of the loop body,
incrementing the which increments a hotness counter {\tt p.osr} and
jumping jumps to an OSR-firing block if the counter reaches the threshold (1000 iterations in this example). The OSR block contains a tail call to the target generation stub, which receives as parameters the four live variables at the OSR point ({\tt v}, {\tt n}, {\tt i}, {\tt c}). Notice that maintaining the SSA form requires adjusting phi nodes. The stub (see \myfigure[...]) calls a code generator that: 1) builds an optimized version of {\tt isord} by inlining the comparator, and 2) uses it to create the continuation function {\tt isordto} shown in \myfigure\ref{fig:isordascto}. The stub terminates with a tail call to {\tt isordto}.
Notice that OSR instrumentation To generate the continuation function from the optimized version created by the inliner, \tinyvm\ replaces the function entry point, removes dead code, replaces live variables with the function parameters, and fixes phi nodes accordingly. Additions resulting from the IR instrumentation are in grey, while removals are struck-through.
\ifdefined\noauthorea
\begin{figure}[t]
...
\fi
\paragraph{x86-64 Lowering.}
[...] The final step performed by \tinyvm\ before execution is native code generation for {\tt isordfrom}, {\tt isordstub}, and {\tt isordto}. In \myfigure\ref{fig:isordx86-64}.
\subsection{Instrumentation API.}
To support the IR instrumentation tasks of \mysection\section{}, \tinyvm\ provides a number of abstractions for VM builders: