dcdelia  over 8 years ago

Commit id: 3c84e9ca2510eb27889c8058a5fd739d91576c87

deletions | additions      

       

\noindent A $\phi$-node {\tt \%i.01} is used to represent the index of the C {\tt for} loop, and is set to {\tt \%10} when reached from the loop header (basic block {\tt \%2}) {\em after} a loop iteration. In fact, as a result of {\small \tt -O1} optimizations, with {\tt n>1} execution jumps from the function entrypoint {\tt \%0} directly into the loop body, initializing the $\phi$-node with {\tt 1}. Comparator {\tt c} is invoked with a tail call, storing its return value into virtual register {\tt \%8}.  OSR points can be inserted with the {\tt INSERT\_OSR} command, which allows several combinations of features (see {\tt HELP} for details). In this session we will modify {\tt isord} so that when the loop body is entered for the first time, an OSR is promptly fired:  \begin{small}  \begin{verbatim}  TinyVM> INSERT_OSR 100 ALWAYS OPEN UPDATE IN isord  AT %4 DYN_INLINE %c  \end{verbatim}  \end{small}  \noindent \tinyvm\ will {\tt UPDATE} the function in the following way: an {\tt ALWAYS}-true OSR condition is verified before executing instruction {\tt \%4}, firing an {\tt OPEN} OSR transition in the {\tt DYN\_INLINE} code generator that will inline any indirect function call to the function pointer {\tt \%c}. We choose {\tt \%4} as location for the OSR as its the first non-$\phi$ instruction in the loop body, and we hint the LLVM backend that the OSR firing is {\tt 100}\%-likely.  %In a usage scenario in which input arrays are large, we might want to perform dynamic inlining as early as possible. We can thus insert