this is for holding javascript data
Camil Demetrescu edited osr-llvm.tex
over 8 years ago
Commit id: af578fcb0748df0d5fb2632a558d5483f70a0924
deletions | additions
diff --git a/osr-llvm.tex b/osr-llvm.tex
index a604851..b78c729 100644
--- a/osr-llvm.tex
+++ b/osr-llvm.tex
...
\paragraph{OSR Instrumentation in IR.}
To defer the compilation of the continuation function until the comparator is known at run time, we used \osrkit\ to instrument {\tt isord} with an open OSR point 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, which increments a hotness counter {\tt p.osr} and 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}).
An \osrkit\ allows the stub to receive an additional user-defined pointer
may that can be used to
provide produce the
stub with profile data collected continuation function by exploiting the execution state at the OSR point -- in
our example, the
base pointer to the comparator function
(none in this example). to be inlined. Notice that maintaining the SSA form requires \osrkit\ to adjust $\phi$-nodes. The stub (see \myfigure\ref{fig:isordstub}) calls a code generator that: 1) builds an optimized version of {\tt isord} by inlining the
comparator (which is known when the OSR is fired), comparator, and 2) uses it to create the continuation function {\tt isordto} shown in \myfigure\ref{fig:isordascto}. The stub passes to the code generator
as built-in parameters: three parameters that are hard-coded by \osrkit: 1) a pointer to the {\tt isord} IR code, a pointer to the basic block in {\tt isord} from which the OSR is fired, and 3)
a handle to the
LLVM context for code
generation. generation environment (LLVM's MCJIT in this case). The stub terminates with a tail call to {\tt isordto}. To generate the continuation function from the optimized version created by the inliner, \osrkit\
replaced replaces the function entry point,
removed removes dead code,
replaced replaces live variables with the function parameters, and
fixed fixes $\phi$-nodes accordingly. Additions resulting from the IR instrumentation are in grey, while removals are struck-through.
\ifdefined\noauthorea
\begin{figure}[t]