Daniele Cono D'Elia edited case-study.tex  over 8 years ago

Commit id: a7107eae15e4a7b26c8372c069d37dac9ebe4fa0

deletions | additions      

       

A previous study by Lameed and Hendren~\cite{lameed2013feval} shows that the overhead of an {\tt feval} call is significantly high compared to a direct call, especially in JIT-based execution environments such as McVM and the proprietary MATLAB JIT accelerator by Mathworks. The main reason for this overhead is that the presence of an {\tt feval} instruction can disrupt the results of intra- and inter-procedural level for type and array shape inference analyses, which are a key ingredient for efficient code generation.  Lameed and Hendren thus propose and implement in McVM two dynamic techniques for optimizing feval calls: calls. The first technique is based on OSR: using the McOSR library~\cite{lameed2013modular}, {\tt feval} instructions contained in loops are instrumented with an OSR point and profiling code to cache the last-known types for the arguments of each {\tt feval} instruction. When an OSR is fired at run-time, a code generator modifies the original function by inserting a guard to choose between a fast path containing a direct call and a slow path with an {\tt feval} call. The second technique is less general and uses value-based JIT compilation: when the first argument of an {\tt feval} call is an argument of the enclosing function, the compiler replaces each call to this function in its callers with a call to a dispatcher. When the program is executed, the dispatcher will evaluate the value of the parameter for the {\tt feval} and return either a cached version or JIT-compile a method optimized for the current value of the argument of interest.