Changeset 240449 in webkit


Ignore:
Timestamp:
Jan 24, 2019 2:37:01 PM (5 years ago)
Author:
ysuzuki@apple.com
Message:

stress/const-semantics.js fails a dfg-eager / ftl-eager run with an ASAN release build.
https://bugs.webkit.org/show_bug.cgi?id=190693

Reviewed by Michael Saboff.

JSTests:

  • stress/regress-190693.js: Added.

(truth):
(assert):
(shouldThrowInvalidConstAssignment):
(taz):

Source/JavaScriptCore:

JITStubRoutine's fields are marked only when JITStubRoutine::m_mayBeExecuting is true.
This becomes true when we find the executable address in our conservative roots, which
means that we could be executing it right now. This means that object liveness in
JITStubRoutine depends on the information gathered in ConservativeRoots. However, our
constraints are separated, "Conservative Scan" and "JIT Stub Routines". They can even
be executed concurrently, so that "JIT Stub Routines" may miss to mark the actually
executing JITStubRoutine because "Conservative Scan" finds it later.
When finalizing the GC, we delete the dead JITStubRoutines. At that time, since
"Conservative Scan" already finishes, we do not delete some JITStubRoutines which do not
mark the depending objects. Then, in the next cycle, we find JITStubRoutines still live,
attempt to mark the depending objects, and encounter the dead objects which are collected
in the previous cycles.

This patch removes "JIT Stub Routines" and merge it to "Conservative Scan". Since
"Conservative Scan" and "JIT Stub Routines" need to be executed only when the execution
happens (ensured by GreyedByExecution and CollectionPhase check), this change is OK for
GC stop time.

  • heap/ConservativeRoots.h:

(JSC::ConservativeRoots::roots const):
(JSC::ConservativeRoots::roots): Deleted.

  • heap/Heap.cpp:

(JSC::Heap::addCoreConstraints):

  • heap/SlotVisitor.cpp:

(JSC::SlotVisitor::append):

  • heap/SlotVisitor.h:
  • jit/GCAwareJITStubRoutine.cpp:

(JSC::GCAwareJITStubRoutine::GCAwareJITStubRoutine):

  • jit/GCAwareJITStubRoutine.h:
Location:
trunk
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r240447 r240449  
     12019-01-24  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        stress/const-semantics.js fails a dfg-eager / ftl-eager run with an ASAN release build.
     4        https://bugs.webkit.org/show_bug.cgi?id=190693
     5
     6        Reviewed by Michael Saboff.
     7
     8        * stress/regress-190693.js: Added.
     9        (truth):
     10        (assert):
     11        (shouldThrowInvalidConstAssignment):
     12        (taz):
     13
    1142019-01-24  Saam Barati  <sbarati@apple.com>
    215
  • trunk/Source/JavaScriptCore/ChangeLog

    r240448 r240449  
     12019-01-24  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        stress/const-semantics.js fails a dfg-eager / ftl-eager run with an ASAN release build.
     4        https://bugs.webkit.org/show_bug.cgi?id=190693
     5
     6        Reviewed by Michael Saboff.
     7
     8        JITStubRoutine's fields are marked only when JITStubRoutine::m_mayBeExecuting is true.
     9        This becomes true when we find the executable address in our conservative roots, which
     10        means that we could be executing it right now. This means that object liveness in
     11        JITStubRoutine depends on the information gathered in ConservativeRoots. However, our
     12        constraints are separated, "Conservative Scan" and "JIT Stub Routines". They can even
     13        be executed concurrently, so that "JIT Stub Routines" may miss to mark the actually
     14        executing JITStubRoutine because "Conservative Scan" finds it later.
     15        When finalizing the GC, we delete the dead JITStubRoutines. At that time, since
     16        "Conservative Scan" already finishes, we do not delete some JITStubRoutines which do not
     17        mark the depending objects. Then, in the next cycle, we find JITStubRoutines still live,
     18        attempt to mark the depending objects, and encounter the dead objects which are collected
     19        in the previous cycles.
     20
     21        This patch removes "JIT Stub Routines" and merge it to "Conservative Scan". Since
     22        "Conservative Scan" and "JIT Stub Routines" need to be executed only when the execution
     23        happens (ensured by GreyedByExecution and CollectionPhase check), this change is OK for
     24        GC stop time.
     25
     26        * heap/ConservativeRoots.h:
     27        (JSC::ConservativeRoots::roots const):
     28        (JSC::ConservativeRoots::roots): Deleted.
     29        * heap/Heap.cpp:
     30        (JSC::Heap::addCoreConstraints):
     31        * heap/SlotVisitor.cpp:
     32        (JSC::SlotVisitor::append):
     33        * heap/SlotVisitor.h:
     34        * jit/GCAwareJITStubRoutine.cpp:
     35        (JSC::GCAwareJITStubRoutine::GCAwareJITStubRoutine):
     36        * jit/GCAwareJITStubRoutine.h:
     37
    1382019-01-24  Saam Barati  <sbarati@apple.com>
    239
  • trunk/Source/JavaScriptCore/heap/ConservativeRoots.h

    r235271 r240449  
    4343   
    4444    size_t size() const;
    45     HeapCell** roots();
     45    HeapCell** roots() const;
    4646
    4747private:
     
    6969}
    7070
    71 inline HeapCell** ConservativeRoots::roots()
     71inline HeapCell** ConservativeRoots::roots() const
    7272{
    7373    return m_roots;
  • trunk/Source/JavaScriptCore/heap/Heap.cpp

    r240216 r240449  
    26222622            m_objectSpace.prepareForConservativeScan();
    26232623
    2624             ConservativeRoots conservativeRoots(*this);
    2625             SuperSamplerScope superSamplerScope(false);
    2626 
    2627             gatherStackRoots(conservativeRoots);
    2628             gatherJSStackRoots(conservativeRoots);
    2629             gatherScratchBufferRoots(conservativeRoots);
    2630 
    2631             SetRootMarkReasonScope rootScope(slotVisitor, SlotVisitor::RootMarkReason::ConservativeScan);
    2632             slotVisitor.append(conservativeRoots);
     2624            {
     2625                ConservativeRoots conservativeRoots(*this);
     2626                SuperSamplerScope superSamplerScope(false);
     2627
     2628                gatherStackRoots(conservativeRoots);
     2629                gatherJSStackRoots(conservativeRoots);
     2630                gatherScratchBufferRoots(conservativeRoots);
     2631
     2632                SetRootMarkReasonScope rootScope(slotVisitor, SlotVisitor::RootMarkReason::ConservativeScan);
     2633                slotVisitor.append(conservativeRoots);
     2634            }
     2635            {
     2636                // JITStubRoutines must be visited after scanning ConservativeRoots since JITStubRoutines depend on the hook executed during gathering ConservativeRoots.
     2637                SetRootMarkReasonScope rootScope(slotVisitor, SlotVisitor::RootMarkReason::JITStubRoutines);
     2638                m_jitStubRoutines->traceMarkedStubRoutines(slotVisitor);
     2639            }
    26332640           
    26342641            lastVersion = m_phaseVersion;
     
    26942701           
    26952702            m_vm->shadowChicken().visitChildren(slotVisitor);
    2696         },
    2697         ConstraintVolatility::GreyedByExecution);
    2698    
    2699     m_constraintSet->add(
    2700         "Jsr", "JIT Stub Routines",
    2701         [this] (SlotVisitor& slotVisitor) {
    2702             SetRootMarkReasonScope rootScope(slotVisitor, SlotVisitor::RootMarkReason::JITStubRoutines);
    2703             m_jitStubRoutines->traceMarkedStubRoutines(slotVisitor);
    27042703        },
    27052704        ConstraintVolatility::GreyedByExecution);
  • trunk/Source/JavaScriptCore/heap/SlotVisitor.cpp

    r236296 r240449  
    135135}
    136136
    137 void SlotVisitor::append(ConservativeRoots& conservativeRoots)
     137void SlotVisitor::append(const ConservativeRoots& conservativeRoots)
    138138{
    139139    HeapCell** roots = conservativeRoots.roots();
  • trunk/Source/JavaScriptCore/heap/SlotVisitor.h

    r236296 r240449  
    8787    Heap* heap() const;
    8888
    89     void append(ConservativeRoots&);
     89    void append(const ConservativeRoots&);
    9090   
    9191    template<typename T, typename Traits> void append(const WriteBarrierBase<T, Traits>&);
  • trunk/Source/JavaScriptCore/jit/GCAwareJITStubRoutine.cpp

    r230748 r240449  
    4444    const MacroAssemblerCodeRef<JITStubRoutinePtrTag>& code, VM& vm)
    4545    : JITStubRoutine(code)
    46     , m_mayBeExecuting(false)
    47     , m_isJettisoned(false)
    4846{
    4947    vm.heap.m_jitStubRoutines->add(this);
  • trunk/Source/JavaScriptCore/jit/GCAwareJITStubRoutine.h

    r230748 r240449  
    6868    friend class JITStubRoutineSet;
    6969
    70     bool m_mayBeExecuting;
    71     bool m_isJettisoned;
     70    bool m_mayBeExecuting { false };
     71    bool m_isJettisoned { false };
    7272};
    7373
Note: See TracChangeset for help on using the changeset viewer.