Bug 174811

Summary: GC should be fine with trading blocks between destructor and non-destructor blocks
Product: WebKit Reporter: Filip Pizlo <fpizlo>
Component: JavaScriptCoreAssignee: Filip Pizlo <fpizlo>
Status: RESOLVED FIXED    
Severity: Normal CC: buildbot, ggaren, jfbastien, keith_miller, mark.lam, msaboff, saam, ysuzuki
Priority: P2    
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 174727    
Attachments:
Description Flags
might be done
none
the patch mark.lam: review+

Filip Pizlo
Reported 2017-07-24 21:01:00 PDT
Patch forthcoming.
Attachments
might be done (16.55 KB, patch)
2017-07-24 21:09 PDT, Filip Pizlo
no flags
the patch (20.51 KB, patch)
2017-07-24 21:48 PDT, Filip Pizlo
mark.lam: review+
Filip Pizlo
Comment 1 2017-07-24 21:09:05 PDT
Created attachment 316350 [details] might be done
Filip Pizlo
Comment 2 2017-07-24 21:48:11 PDT
Created attachment 316351 [details] the patch
Build Bot
Comment 3 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.
Filip Pizlo
Comment 4 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.
Mark Lam
Comment 5 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.
Filip Pizlo
Comment 6 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!
Filip Pizlo
Comment 7 2017-07-25 18:20:47 PDT
Note You need to log in before you can comment on or make changes to this bug.