Closed Bug 1193428 Opened 9 years ago Closed 9 years ago

Rename the |incremental| parameter to be more meaningful

Categories

(Core :: JavaScript: GC, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla43
Tracking Status
firefox43 --- fixed

People

(Reporter: terrence, Assigned: terrence)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

The |incremental| parameter confused me greatly (and still does to some extent). We use it to make some incremental decisions, but certainly not all of them. And the decisions we make do not seem to have much in common.

What it seems to really mean, at least in gcCycle is "this SliceBudget::unlimited GC event was triggered by an API that expects !incremental behavior." Specifically, this is GCRuntime::gc -- that's the only caller that sets |incremental| to false.

In collect it controls whether we will redo the non-incremental GC for dead zones. I think this second usage would be better done by checking if the slice budget is unlimited so that it happens not just via gc(). In this case we set the incremental parameter to false to prevent us from doing this multiple times.

I think both of these uses would be much better done in GCRuntime::gc, allowing us to remove the parameter altogether, but I'm not sure how feasible this is. It is going to take some extensive experimentation. The first step though is to just make the name more coherent. I think incrementalByAPI is better than incremental.
Attachment #8646477 - Flags: review?(jcoppeard)
Comment on attachment 8646477 [details] [diff] [review]
3_rename_incremental_param-v0.diff

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

(In reply to Terrence Cole [:terrence] from comment #0)
This is fine, but I think we really want to invert the sense of it and call it nonIncrementalRequested (or nonIncrementalByAPI).

As you say, the parameter is necessary for gcCycle() to distinguish between being asked to continue an incremental GC with unlimited budget and start a new GC with unlimited budget.  So it's not sufficient to make a GC incremental by itself, whereas it is sufficient to make a GC non-incremental.

The dead zones check only needs to happen for incremental GCs so I think this should check isIncremental instead and set the slice budget to unlimited.

And yes, we should move the reset and the dead zone check up to collect().
Attachment #8646477 - Flags: review?(jcoppeard) → review+
(In reply to Jon Coppeard (:jonco) from comment #1)
> Comment on attachment 8646477 [details] [diff] [review]
> 3_rename_incremental_param-v0.diff
> 
> Review of attachment 8646477 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> (In reply to Terrence Cole [:terrence] from comment #0)
> This is fine, but I think we really want to invert the sense of it and call
> it nonIncrementalRequested (or nonIncrementalByAPI).
> 
> As you say, the parameter is necessary for gcCycle() to distinguish between
> being asked to continue an incremental GC with unlimited budget and start a
> new GC with unlimited budget.  So it's not sufficient to make a GC
> incremental by itself, whereas it is sufficient to make a GC non-incremental.

That's a great way to think about it!

> The dead zones check only needs to happen for incremental GCs so I think
> this should check isIncremental instead and set the slice budget to
> unlimited.
> 
> And yes, we should move the reset and the dead zone check up to collect().

My initial attempt to move the reset up led to JP failures, so I split both of these out to a separate bug.
https://hg.mozilla.org/mozilla-central/rev/f772e7820f5f
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
You need to log in before you can comment on or make changes to this bug.