Open Bug 1715511 Opened 5 years ago Updated 1 year ago

Misleading comment about constant and pre-barriers in WarpGCPtr?

Categories

(Core :: JavaScript Engine: JIT, defect, P3)

defect

Tracking

()

People

(Reporter: anba, Unassigned)

References

(Blocks 1 open bug)

Details

WarpGCPtr has this comment:

// Note: no pre-barrier is needed because this is a constant. No post-barrier
// is needed because the value is always tenured.
const T ptr_;

But const T for a pointer type T means a "constant pointer" and not a "pointer to a constant object", i.e. as currently written it's not possible to reassign ptr_, but it's still possible to change the object ptr_ points to.

Am I misunderstanding the comment or is this a bug?

Flags: needinfo?(jcoppeard)

(In reply to André Bargull [:anba] from comment #0)
This part is actually what's intended. You need a pre-barrier if you change the pointer to point to a different object because it changes the GC graph, but you don't need one (here) if you change the object.

However, we might need a pre-barrier when we destroy the WarpGCPtr, as this counts as a change to the graph too. If the original edge this WarpGCPtr was created for is guaranteed to still exist then it's not necessary. I don't understand the lifecycle of these enough to say whether that's true or not.

Flags: needinfo?(jcoppeard)
Severity: -- → N/A
Priority: -- → P3
Severity: N/A → S4
Blocks: SMDOC
Severity: S4 → N/A

Since this is a defect it needs a severity, making it S4.

Severity: N/A → S4
You need to log in before you can comment on or make changes to this bug.