Closed Bug 744192 Opened 13 years ago Closed 13 years ago

GC: ensure there are no implicit post barriers in a Vector

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla14

People

(Reporter: terrence, Assigned: terrence)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch v0 (obsolete) — Splinter Review
If we store an implicitly post barriered type in a vector, we will fall over when the vector relocates our storage. This patch simply asserts that we do not have any. We still compile with this and grepping for "Vector<Heap" did not turn up any results, so I think we are in the clear with these. This assertion will ensure that we stay in the clear going forward.
Attachment #613773 - Flags: review?(luke)
Comment on attachment 613773 [details] [diff] [review] v0 Review of attachment 613773 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/public/Vector.h @@ +284,5 @@ > Vector &operator=(const Vector &) MOZ_DELETE; > > + void checkStaticInvarients() { > + JS_STATIC_ASSERT(!tl::IsPostBarrieredType<T>::result); > + } I usually make these things 'static' @@ +534,5 @@ > #ifdef DEBUG > , mReserved(0), entered(false) > #endif > +{ > + checkStaticInvarients(); I don't think you need to call it to get the static checks.
Attachment #613773 - Flags: review?(luke) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/a43eb4a2d2fd With review comments _not_ applied, as per our IRC conversation.
Assignee: general → terrence
Status: NEW → ASSIGNED
And backed out in: https://hg.mozilla.org/integration/mozilla-inbound/rev/4e05bd6470c8 Old and busted gcc says: "error: default template arguments may not be used in function templates".
Actually gcc's right about that. You have to have a pointless <> when calling a templatized function where all the template arguments are defaulted, in C++98. (C++11 allows you to omit the <> when calling a function using entirely default template arguments.) Clang should be warning/erroring on the same thing, not sure why it wouldn't be here. Oh, and it's "invariants", not "invarients".
Er, wait, that first paragraph of comment 4 is not actually correct, or at least I'm not sure it is as regards the situation here -- ignore it.
Using tl::StaticAssert works much better, and is cleaner to boot.
Attachment #613773 - Attachment is obsolete: true
Attachment #614230 - Flags: review+
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla14
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: