Encapsulate GC begin and end notification callbacks in an RAII guard

RESOLVED FIXED in Firefox 45

Status

()

RESOLVED FIXED
4 years ago
3 years ago

People

(Reporter: terrence, Assigned: terrence)

Tracking

(Blocks: 1 bug)

Trunk
mozilla45
Points:
---

Firefox Tracking Flags

(firefox43 affected, firefox45 fixed)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

4 years ago
Created attachment 8658450 [details] [diff] [review]
55_move_all_state_into_gcCycle-v0.diff

It has always seemed exceedingly weird to me that multiple gcCycles can get explicitly aggregated into a single stats entry. I don't think anything other than EnqueuePendingParseTasksAfterGC needs to actually run here and not in gcCycle, so let's see if try agrees:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=2c3f2860c735
Attachment #8658450 - Flags: review?(jcoppeard)
Comment on attachment 8658450 [details] [diff] [review]
55_move_all_state_into_gcCycle-v0.diff

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

::: js/src/jsgc.cpp
@@ +1638,1 @@
>      }

Nit: can get rid of braces here too.

@@ +1665,1 @@
>      }

Ditto braces.

@@ +6099,5 @@
>  GCRuntime::gcCycle(SliceBudget& budget, JS::gcreason::Reason reason)
>  {
> +    AutoTraceLog logGC(TraceLoggerForMainThread(rt), TraceLogger_GC);
> +    AutoStopVerifyingBarriers av(rt, IsShutdownGC(reason));
> +    AutoScheduleZonesForGC asz(rt);

I'm not sure about moving AutoScheduleZonesForGC here.   Don't we want to just do this once?
Attachment #8658450 - Flags: review?(jcoppeard) → review+
(Assignee)

Comment 2

3 years ago
Created attachment 8680320 [details] [diff] [review]
55_move_all_state_into_gcCycle-v1.diff

Sorry it took me so long to get back to this!

(In reply to Jon Coppeard (:jonco) from comment #1)
> Comment on attachment 8658450 [details] [diff] [review]
> 55_move_all_state_into_gcCycle-v0.diff
> 
> Review of attachment 8658450 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: js/src/jsgc.cpp
> @@ +1638,1 @@
> >      }
> 
> Nit: can get rid of braces here too.
> 
> @@ +1665,1 @@
> >      }
> 
> Ditto braces.

This is the MSVC 2013 ranged-for braces bug. Not much we can do in the short term.

> @@ +6099,5 @@
> >  GCRuntime::gcCycle(SliceBudget& budget, JS::gcreason::Reason reason)
> >  {
> > +    AutoTraceLog logGC(TraceLoggerForMainThread(rt), TraceLogger_GC);
> > +    AutoStopVerifyingBarriers av(rt, IsShutdownGC(reason));
> > +    AutoScheduleZonesForGC asz(rt);
> 
> I'm not sure about moving AutoScheduleZonesForGC here.   Don't we want to
> just do this once?

I certainly *hope* that deciding what zones to GC would be idempotent if we do not run the mutator! But I don't know for sure and you are right to urge caution. I overreached a bit here. I've split this patch up so that it only includes the AutoNotify changes and will file separate bugs for moving the dangerous-looking stuff individually.

Carrying the r+ as this is a pure subset.
Attachment #8658450 - Attachment is obsolete: true
Attachment #8680320 - Flags: review+
(Assignee)

Updated

3 years ago
Summary: Move all GC state below the reset loop → Encapsulate GC begin and end notification callbacks in an RAII guard
(Assignee)

Comment 4

3 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/b526e349c77fd781319ba2fe95f78233b5670767
Bug 1202923 - Encapsulate GC begin and end notification callbacks in an RAII guard; r=jonco

Comment 5

3 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/b526e349c77f
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
status-firefox45: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
removing the b2g 2.5 flag since this commit has been reverted due to an incorrect merge, sorry for the confusion
status-b2g-v2.5: fixed → ---
You need to log in before you can comment on or make changes to this bug.