Closed Bug 1522061 Opened 5 years ago Closed 5 years ago

Add more information for different concepts in JS_FOR_EACH_TRACEKIND

Categories

(Core :: JavaScript: GC, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: allstars.chh, Assigned: allstars.chh)

References

Details

Attachments

(2 files)

see https://bugzilla.mozilla.org/show_bug.cgi?id=1510607#c15
https://bugzilla.mozilla.org/show_bug.cgi?id=1510607#c16

In bug 1510607 we found that we are conflating too many concepts into one category, and this caused some regression.

So I file this as a separate bug to isolate the data stored in JS_FOR_EACH_TRACEKIND into different categories

Status: NEW → ASSIGNED
Type: defect → enhancement

Hi mccr8
I'd like to ask do TraceKind::BaseShape and TraceKind::JitCode participate in CC?
CC reads this information in IsCCTraceKind (used to called AddToCCKind, as I changed the naming in bug 1478533)
but BaseShape and JitCode are not listed in this function.

And the comment in nsCycleCollector says CC will look at gray objects
https://searchfox.org/mozilla-central/source/xpcom/base/nsCycleCollector.cpp#93
and according to the table in JS_FOR_EACH_TRACEKIND, these two TraceKinds(BaseShape and JitCode) can be marked gray.
https://searchfox.org/mozilla-central/source/js/public/TraceKind.h#104
so does this mean CC will watch these two?

Thanks

Flags: needinfo?(continuation)

I'm not sure what is going on with JitCode, but for shapes, they need to be marked grey by the GC, because the CC wants to trace through them, but the CC does not represent shapes in the CC graph. Instead, the outgoing edges from a shape will be attributed to any JS objects that hold onto that shape.

Flags: needinfo?(continuation)

Oh, that's right, GC things can be in one of 3 different categories:

  1. never part of a gray cycle, so don't need to participate at all in gray marking
  2. can be part of a gray cycle, but not represented in CC graph
  3. can be part of a gray cycle, represented by a node in the CC graph

For case (2), it's as mccr8 described: if you have the GC graph A -> B1 -> B2 -> B3 -> C, and all of the B nodes fall within case 2, then the CC graph will look like CC(A) -> CC(C).

It could be represented as 2 booleans, or a 3-way enumeration.

TypeParticipatesInCC is confusing, as this function is used to tell if a
TraceKind can be marked gray.

Pushed by allstars.chh@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/c2659af33baf
Part 1: rename to TraceKindCanBeGray. r=jonco
https://hg.mozilla.org/integration/mozilla-inbound/rev/6741a996b17d
Part 2: implement isCCTraceKind with JS_FOR_EACH_TRACEKIND. r=jonco
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Duplicate of this bug: 1463343
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: