Bug 174811 - GC should be fine with trading blocks between destructor and non-destructor blocks
Summary: GC should be fine with trading blocks between destructor and non-destructor b...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Filip Pizlo
URL:
Keywords:
Depends on:
Blocks: 174727
  Show dependency treegraph
 
Reported: 2017-07-24 21:01 PDT by Filip Pizlo
Modified: 2017-07-25 18:20 PDT (History)
8 users (show)

See Also:


Attachments
might be done (16.55 KB, patch)
2017-07-24 21:09 PDT, Filip Pizlo
no flags Details | Formatted Diff | Diff
the patch (20.51 KB, patch)
2017-07-24 21:48 PDT, Filip Pizlo
mark.lam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Pizlo 2017-07-24 21:01:00 PDT
Patch forthcoming.
Comment 1 Filip Pizlo 2017-07-24 21:09:05 PDT
Created attachment 316350 [details]
might be done
Comment 2 Filip Pizlo 2017-07-24 21:48:11 PDT
Created attachment 316351 [details]
the patch
Comment 3 Build Bot 2017-07-24 21:51:37 PDT
Attachment 316351 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/heap/MarkedBlock.cpp:28:  Found other header before a header this file implements. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
Total errors found: 1 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Filip Pizlo 2017-07-24 21:53:25 PDT
Comment on attachment 316351 [details]
the patch

View in context: https://bugs.webkit.org/attachment.cgi?id=316351&action=review

> Source/JavaScriptCore/heap/MarkedBlock.cpp:46
> +
> +#include <wtf/Assertions.h>
> +
> +namespace {
> +
> +NO_RETURN_DUE_TO_CRASH NEVER_INLINE void crash()
> +{
> +    CRASH();
> +}
> +
> +#undef RELEASE_ASSERT
> +#define RELEASE_ASSERT(assertion) do { \
> +    if (!(assertion)) { \
> +        WTFReportAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, #assertion); \
> +        crash(); \
> +    } \
> +} while (0)
> +
> +} // anonymous namespace
> +

I'll remove this.
Comment 5 Mark Lam 2017-07-25 09:44:34 PDT
Comment on attachment 316351 [details]
the patch

View in context: https://bugs.webkit.org/attachment.cgi?id=316351&action=review

r=me

> Source/JavaScriptCore/heap/MarkedBlockInlines.h:330
> +                    specializedSweep<true, NotEmpty, SweepOnly, BlockHasDestructors, DontScribble, DoesNotHaveNewlyAllocated, MarksNotStale>(freeList, IsEmpty, SweepOnly, BlockHasDestructors, DontScribble, DoesNotHaveNewlyAllocated, MarksNotStale, destroyFunc);
> +                    return true;
> +                case MarksStale:
> +                    specializedSweep<true, NotEmpty, SweepOnly, BlockHasDestructors, DontScribble, DoesNotHaveNewlyAllocated, MarksStale>(freeList, IsEmpty, SweepOnly, BlockHasDestructors, DontScribble, DoesNotHaveNewlyAllocated, MarksStale, destroyFunc);
> +                    return true;
> +                }
> +            case SweepToFreeList:
> +                switch (marksMode) {
> +                case MarksNotStale:
> +                    specializedSweep<true, NotEmpty, SweepToFreeList, BlockHasDestructors, DontScribble, DoesNotHaveNewlyAllocated, MarksNotStale>(freeList, IsEmpty, SweepToFreeList, BlockHasDestructors, DontScribble, DoesNotHaveNewlyAllocated, MarksNotStale, destroyFunc);
> +                    return true;
> +                case MarksStale:
> +                    specializedSweep<true, NotEmpty, SweepToFreeList, BlockHasDestructors, DontScribble, DoesNotHaveNewlyAllocated, MarksStale>(freeList, IsEmpty, SweepToFreeList, BlockHasDestructors, DontScribble, DoesNotHaveNewlyAllocated, MarksStale, destroyFunc);

Behavior-wise, it doesn't matter that you pass "IsEmpty" for the emptyMode (2nd argument) because it will get overridden to NotEmpty in specializedSweep() because the specialize flag is true.  However, for consistency, I think we should pass NotEmpty given that we know that the block's emptyMode is NotEmpty.
Comment 6 Filip Pizlo 2017-07-25 18:15:44 PDT
(In reply to Mark Lam from comment #5)
> Comment on attachment 316351 [details]
> the patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=316351&action=review
> 
> r=me
> 
> > Source/JavaScriptCore/heap/MarkedBlockInlines.h:330
> > +                    specializedSweep<true, NotEmpty, SweepOnly, BlockHasDestructors, DontScribble, DoesNotHaveNewlyAllocated, MarksNotStale>(freeList, IsEmpty, SweepOnly, BlockHasDestructors, DontScribble, DoesNotHaveNewlyAllocated, MarksNotStale, destroyFunc);
> > +                    return true;
> > +                case MarksStale:
> > +                    specializedSweep<true, NotEmpty, SweepOnly, BlockHasDestructors, DontScribble, DoesNotHaveNewlyAllocated, MarksStale>(freeList, IsEmpty, SweepOnly, BlockHasDestructors, DontScribble, DoesNotHaveNewlyAllocated, MarksStale, destroyFunc);
> > +                    return true;
> > +                }
> > +            case SweepToFreeList:
> > +                switch (marksMode) {
> > +                case MarksNotStale:
> > +                    specializedSweep<true, NotEmpty, SweepToFreeList, BlockHasDestructors, DontScribble, DoesNotHaveNewlyAllocated, MarksNotStale>(freeList, IsEmpty, SweepToFreeList, BlockHasDestructors, DontScribble, DoesNotHaveNewlyAllocated, MarksNotStale, destroyFunc);
> > +                    return true;
> > +                case MarksStale:
> > +                    specializedSweep<true, NotEmpty, SweepToFreeList, BlockHasDestructors, DontScribble, DoesNotHaveNewlyAllocated, MarksStale>(freeList, IsEmpty, SweepToFreeList, BlockHasDestructors, DontScribble, DoesNotHaveNewlyAllocated, MarksStale, destroyFunc);
> 
> Behavior-wise, it doesn't matter that you pass "IsEmpty" for the emptyMode
> (2nd argument) because it will get overridden to NotEmpty in
> specializedSweep() because the specialize flag is true.  However, for
> consistency, I think we should pass NotEmpty given that we know that the
> block's emptyMode is NotEmpty.

Fixed!
Comment 7 Filip Pizlo 2017-07-25 18:20:47 PDT
Landed in https://trac.webkit.org/changeset/219897/webkit