Closed
Bug 744192
Opened 12 years ago
Closed 12 years ago
GC: ensure there are no implicit post barriers in a Vector
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla14
People
(Reporter: terrence, Assigned: terrence)
References
Details
Attachments
(1 file, 1 obsolete file)
3.68 KB,
patch
|
terrence
:
review+
|
Details | Diff | 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 1•12 years ago
|
||
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+
Assignee | ||
Comment 2•12 years ago
|
||
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
Assignee | ||
Comment 3•12 years ago
|
||
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".
Comment 4•12 years ago
|
||
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".
Comment 5•12 years ago
|
||
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.
Assignee | ||
Comment 6•12 years ago
|
||
Using tl::StaticAssert works much better, and is cleaner to boot.
Attachment #613773 -
Attachment is obsolete: true
Attachment #614230 -
Flags: review+
Assignee | ||
Comment 7•12 years ago
|
||
https://tbpl.mozilla.org/?tree=Mozilla-Inbound&rev=380e6f8bd681
Comment 8•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/380e6f8bd681
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla14
You need to log in
before you can comment on or make changes to this bug.
Description
•