Closed Bug 1364051 Opened 7 years ago Closed 7 years ago

Barriered pointer wrappers currently get a copy constructor by default

Categories

(Core :: JavaScript: GC, enhancement)

55 Branch
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: jonco, Assigned: jonco)

Details

Attachments

(1 file)

These wrapper classes may need to add barriers to this operation so we don't want a compiler generated copy constructor from the superclass being used if they forget to add an their copy constructor.  

For example, HeapSlot currently gains a copy constructor this way.  This is not a problem but it was surprising to me.

This patch forces subclasses to opt-in if they want a copy constructor.
Attachment #8866743 - Flags: review?(sphink)
Comment on attachment 8866743 [details] [diff] [review]
barrier-copy-constructors

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

::: js/src/gc/Barrier.h
@@ +326,5 @@
>      explicit BarrieredBase(const T& v) : value(v) {}
>  
> +    // BarrieredBase subclasses cannot be copy constructed by default.
> +    BarrieredBase(const BarrieredBase<T>& other) = default;
> +

How does this work? I was expecting to see = delete. Is this some dark magic?
(In reply to Steve Fink [:sfink] [:s:] from comment #1)
This gives BarrieredBase the default copy constructor but makes it protected.
Comment on attachment 8866743 [details] [diff] [review]
barrier-copy-constructors

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

Ah, ok. Thanks.
Attachment #8866743 - Flags: review?(sphink) → review+
Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/a64e7f9efef2
Make WriteBarrieredBase copy constructor protected r=sfink
https://hg.mozilla.org/mozilla-central/rev/a64e7f9efef2
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: