Skip to content

Commit

Permalink
Cherry-pick 259548.275@safari-7615-branch (b022d8c). https://bugs.web…
Browse files Browse the repository at this point in the history
…kit.org/show_bug.cgi?id=252798

    [JSC] Restore liveness based interference analysis too
    https://bugs.webkit.org/show_bug.cgi?id=252798
    rdar://problem/105818549

    Reviewed by Ryan Haddad and Michael Saboff.

    This is partial revert of https://commits.webkit.org/259548.47@safari-7615-branch.
    While the above change fixed the global interference problem, we have a problem.

    1. We would like to check interference on all the live place since OSR exit may need to restore
       phantomized candidate nodes.
    2. If PutStack / GetStack happens in the basic block and the stack state gets incorrect in the
       middle of basic block, we cannot know.

        loc0 => @b
        PutStack loc0 @A
        ...
        OSR exit
        ...
        PutStack loc0 @b
        ...
        loc0 => @b

    So we partially revert the change in https://commits.webkit.org/259548.47@safari-7615-branch,

    1. First collect all stack modification. And record which part of stack is modified for each basic block unit.
    2. Then, for each basic block
        2.1. If this basic block does not have stack modification, then just check availability for live candidates availability
             this head. Since this basic block does not have stack modification, this basic block itself never incurs interference.
             Only thing we need to check is that now the live nodes are already clobbered in terms of availability because the
             successors modified the stack.
        2.2. If this basic block does stack modification, let's take live candidates at the tail of basic block and check whether
             the basic block is clobbering this candidate's relying stack. If so, remove it from candidate.
        2.3. For each newly killed DFG node at a node-index in this basic block, check (2.2)'s stack modification and remove it
             from candidate if its stack is modified.

    This added part is effectively the code removed in https://commits.webkit.org/259548.47@safari-7615-branch (so, existing code before).
    Compared to the old behavior, 2.1 is added newly to cover inter-block handling.

    * Source/JavaScriptCore/dfg/DFGArgumentsEliminationPhase.cpp:
    * Source/JavaScriptCore/dfg/DFGAvailabilityMap.h:
    (JSC::DFG::AvailabilityMap::forEachAvailability const):
    (JSC::DFG::AvailabilityMap::closeOverNodes const):
    (JSC::DFG::AvailabilityMap::closeStartingWithLocal const):
    (JSC::DFG::AvailabilityMap::forEachAvailability): Deleted.
    (JSC::DFG::AvailabilityMap::closeOverNodes): Deleted.
    (JSC::DFG::AvailabilityMap::closeStartingWithLocal): Deleted.

    Canonical link: https://commits.webkit.org/259548.275@safari-7615-branch
  • Loading branch information
Constellation authored and aperezdc committed Apr 3, 2023
1 parent db99b3e commit 078e71c
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 159 deletions.

0 comments on commit 078e71c

Please sign in to comment.