Closed Bug 1119550 Opened 9 years ago Closed 8 years ago

Stop using volatile for synchronization

Categories

(Core :: JavaScript: GC, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: terrence, Assigned: terrence)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Or rather, *trying* to use volatile for synchronization: I doubt it's actually doing anything at all.
Assignee: nobody → terrence
Status: NEW → ASSIGNED
Attachment #8546294 - Flags: review?(sphink)
Attachment #8546294 - Flags: review?(sphink) → review+
Well, the world didn't end, so let's do the next one.

For majorGCRequested, we need to have a valid majorGCRequestReason in both threads, so we'd nominally need at least ReleaseAcquire semantics (e.g. to transfer ownership of the reason). However, there's not really any good reason to use two variables when we can just signal not-requested with NO_REASON. If we reduce the information we need to reliably transfer to a single word, we can use Relaxed ordering and be certain that we're not regressing performance.

The attached does this for majorGCRequested and the same for minorGCRequested to maintain the nice symmetry.

https://treeherder.mozilla.org/#/jobs?repo=try&revision=67969d5e2e56
Attachment #8550761 - Flags: review?(jcoppeard)
Comment on attachment 8550761 [details] [diff] [review]
eliminate_volatile_on_majorGCRequested-v0.diff

Review of attachment 8550761 [details] [diff] [review]:
-----------------------------------------------------------------

Using a single field for these is much nicer!

I'm a little cautious about using relaxed atomics, but I think it is ok here.  We're not trying to synchronise, and we don't care if the main thread sees the change immediately.
Attachment #8550761 - Flags: review?(jcoppeard) → review+
The "one-more" is the volatile on the mark bitmap. That's not something we can replace with atomics sanely, so I'm going to go ahead and close this bug.
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Removing leave-open keyword from resolved bugs, per :sylvestre.
Keywords: leave-open
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: