Bug 206460 - [bmalloc] Make use of LockHolder strict in some methods of Scavenger
Summary: [bmalloc] Make use of LockHolder strict in some methods of Scavenger
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: bmalloc (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Basuke Suzuki
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-01-17 16:45 PST by Basuke Suzuki
Modified: 2020-01-21 12:34 PST (History)
6 users (show)

See Also:


Attachments
PATCH (4.09 KB, patch)
2020-01-17 17:05 PST, Basuke Suzuki
darin: review+
Details | Formatted Diff | Diff
PATCH (3.74 KB, patch)
2020-01-21 10:34 PST, Basuke Suzuki
no flags Details | Formatted Diff | Diff
PATCH (3.74 KB, patch)
2020-01-21 11:27 PST, Basuke Suzuki
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Basuke Suzuki 2020-01-17 16:45:07 PST
void Scavenger::runHoldingLock() assume the caller has lock. This rule can be strict by passing LockHolder as other code do.
Comment 1 Basuke Suzuki 2020-01-17 17:05:47 PST
Created attachment 388119 [details]
PATCH
Comment 2 Darin Adler 2020-01-20 11:55:29 PST
Comment on attachment 388119 [details]
PATCH

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

Saying review+, but there is something wrong here.

> Source/bmalloc/bmalloc/Scavenger.h:57
> -    void run();
> +    BINLINE void run();

It’s *not* OK to have a public function marked inline that is not defined in the header. This is code that won’t compile in some scenarios, where the code is not part of the appropriate translation unit. Not sure what the situation is. Could be one of these:

a) This member function already gets inlined for callers inside Scavenger.cpp even if we don’t mark it with BINLINE. So we don’t need "always inline" nor do we need to mark this function as inline at all, and we should not make this change.

b) This member function is never called outside the Scavenger class so it can be made private. But it does need to be marked "always inline", so we should keep this BINLINE but also move it from public to private.

c) This member function is called outside the Scavenger class but only inside Scavenger.cpp, so the patch is OK as-is, but we’ll have a problem waiting for us if Ian the future anyone adds any new calls to the function outside Scavenger.cpp.

d ...) Some more complicated situation. Perhaps one with no obvious solution?

I’m guessing it’s (a) and no change should be made here, but I’m not sure.

> Source/bmalloc/bmalloc/Scavenger.h:60
> -    void runSoon();
> +    BINLINE void runSoon();

Ditto.
Comment 3 Basuke Suzuki 2020-01-21 10:30:57 PST
Comment on attachment 388119 [details]
PATCH

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

>> Source/bmalloc/bmalloc/Scavenger.h:57
>> +    BINLINE void run();
> 
> It’s *not* OK to have a public function marked inline that is not defined in the header. This is code that won’t compile in some scenarios, where the code is not part of the appropriate translation unit. Not sure what the situation is. Could be one of these:
> 
> a) This member function already gets inlined for callers inside Scavenger.cpp even if we don’t mark it with BINLINE. So we don’t need "always inline" nor do we need to mark this function as inline at all, and we should not make this change.
> 
> b) This member function is never called outside the Scavenger class so it can be made private. But it does need to be marked "always inline", so we should keep this BINLINE but also move it from public to private.
> 
> c) This member function is called outside the Scavenger class but only inside Scavenger.cpp, so the patch is OK as-is, but we’ll have a problem waiting for us if Ian the future anyone adds any new calls to the function outside Scavenger.cpp.
> 
> d ...) Some more complicated situation. Perhaps one with no obvious solution?
> 
> I’m guessing it’s (a) and no change should be made here, but I’m not sure.

Ah. Good point. Thanks. As original code doesn't have BINLINE, we should leave this as is, no BINLINE and hope compiler do well for us.
Comment 4 Basuke Suzuki 2020-01-21 10:34:16 PST
Created attachment 388318 [details]
PATCH
Comment 5 Basuke Suzuki 2020-01-21 11:27:34 PST
Created attachment 388326 [details]
PATCH
Comment 6 WebKit Commit Bot 2020-01-21 12:33:13 PST
The commit-queue encountered the following flaky tests while processing attachment 388326 [details]:

imported/w3c/web-platform-tests/IndexedDB/fire-error-event-exception.html bug 201481 (authors: shvaikalesh@gmail.com and youennf@gmail.com)
The commit-queue is continuing to process your patch.
Comment 7 WebKit Commit Bot 2020-01-21 12:33:46 PST
Comment on attachment 388326 [details]
PATCH

Clearing flags on attachment: 388326

Committed r254871: <https://trac.webkit.org/changeset/254871>
Comment 8 WebKit Commit Bot 2020-01-21 12:33:47 PST
All reviewed patches have been landed.  Closing bug.
Comment 9 Radar WebKit Bug Importer 2020-01-21 12:34:19 PST
<rdar://problem/58769352>