Closed Bug 1466171 Opened 6 years ago Closed 6 years ago

Remove the restriction about not collecting atoms while the main thread is parsing

Categories

(Core :: JavaScript: GC, enhancement)

61 Branch
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla62
Tracking Status
firefox62 --- fixed

People

(Reporter: jonco, Assigned: jonco)

References

Details

Attachments

(1 file)

Currently we have this restriction that you can't collect the atoms zone while the main thread is parsing because we don't have exact rooting information about the atoms in use by the parser.  We use AutoKeepAtoms to signal the situation.

I'd like to remove this restriction.  The zone keeps a cache of all the atoms that have been looked up since the last GC, and that should include all the atoms that the parser is using (we will have to make sure we don't clear it while parsing).
Move the keepAtoms counter to the zone and remove the restriction on collecting atoms while AutoKeepAtoms is present.  Add a flag to prevent clearing the zone's atoms cache while we're parsing and clear it at the end of GC if needed.

Try is green so far: https://treeherder.mozilla.org/#/jobs?repo=try&revision=bebada7c0f2198d7f4f8fd09dbf8ebf46c4a22ed
Attachment #8982579 - Flags: review?(sphink)
Comment on attachment 8982579 [details] [diff] [review]
bug1466171-keep-atoms

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

Nicely done. The scary part is what else we might have been covering up under the AutoKeepAtoms safety blanket.

::: js/src/gc/RootMarking.cpp
@@ +334,5 @@
>  void
> +js::gc::GCRuntime::traceKeptAtoms(JSTracer* trc)
> +{
> +    // We don't have exact rooting information for atoms while parsing. When
> +    // this is happeninng we set a flag on the zone and trace all atoms in the

*happening

::: js/src/gc/Zone.h
@@ +509,5 @@
> +    // collecting the atoms zone when exclusive threads are running.
> +    js::ZoneOrGCTaskData<unsigned> keepAtomsCount;
> +
> +    // Whether purging atoms was deferred due to keepAtoms being set. If this
> +    // happen then the cache will be purged when keepAtoms drops to zero.

*happens
Attachment #8982579 - Flags: review?(sphink) → review+
Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/6d741e95201a
Allow collection of atoms while the main thread is parsing r=sfink
https://hg.mozilla.org/mozilla-central/rev/6d741e95201a
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
Depends on: 1468792
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: