[Webkit-unassigned] [Bug 176601] New: Turn recursive tail calls into loops

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Sep 8 08:16:35 PDT 2017


https://bugs.webkit.org/show_bug.cgi?id=176601

            Bug ID: 176601
           Summary: Turn recursive tail calls into loops
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Enhancement
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: rmorisset at apple.com

As indicated in the title, we would like to turn recursive tail calls into simple loop, preferably before optimizations like LICM for optimal performance.
We expect this to be a big win on the (admittedly contrived) benchmark in https://bugs.webkit.org/show_bug.cgi?id=175754.

There are several difficulties. The main one is the interaction with inlining.
Consider the following example: A() calls B() that calls C() that tail calls B ().
If the inliner inlines C into B into A, then we want to insert a jump from the end of C to the beginning of B, in A.
But currently the beginning of B might be in the middle of a basic block, so we must change the inliner to split the basic block.

More surprisingly, the transformation itself must also happen at the same time and not in a later phase (for example after Fixup).
Otherwise the intervening passes would not see the control flow edge, and might hoist parts of B() above the entry point of B (into the original code of A).

So I will do the basic block splitting in DFGBytecodeParser::inlineCall and the actual transformation in DFGBytecodeParser::handleInlining.


In the first time, we will only do the optimization for monomorphic non-varargs calls for simplicity. It should be straightforward (or at least possible) to extend it to the other cases later on.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170908/e95911bd/attachment.html>


More information about the webkit-unassigned mailing list