Closed
Bug 1232672
Opened 9 years ago
Closed 8 years ago
Make hash table clients check for failure
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla46
Tracking | Status | |
---|---|---|
firefox46 | --- | fixed |
People
(Reporter: jonco, Assigned: jonco)
Details
Attachments
(4 files)
20.51 KB,
patch
|
luke
:
review+
|
Details | Diff | Splinter Review |
3.71 KB,
patch
|
billm
:
review+
|
Details | Diff | Splinter Review |
8.26 KB,
patch
|
n.nethercote
:
review+
|
Details | Diff | Splinter Review |
7.55 KB,
patch
|
sfink
:
review+
|
Details | Diff | Splinter Review |
Following on from bug 1231224 which related to Vectors, we should make clients of our hash tables check for possible OOM by adding MOZ_WARN_UNUSED_RESULT in appropriate places.
Assignee | ||
Comment 1•9 years ago
|
||
Add MOZ_WARN_UNUSED_RESULT to HashMap and HasSet methods that need to be checked for failure and fix up the rest of the codebase. This didn't catch anything too major under js/src: a couple of issues in SPSProfiler, one in the GC pre-barrier verifier and a bunch of unchecked uses in the jsapi tests. I did have to change places where we deliberately ignore the return code to assign the result to a variable and then cast that to void.
Attachment #8699018 -
Flags: review?(luke)
Assignee | ||
Comment 2•9 years ago
|
||
This found a couple of places in xpconnect that should check the return value.
Attachment #8699021 -
Flags: review?(wmccloskey)
Assignee | ||
Comment 3•9 years ago
|
||
Unfortunately I had to add MOZ_ALWAYS_TRUE() around all uses of these hash table methods here. The allocator itself is infallible so they can never return false, but we need to check the result otherwise we get an error. I still think it's worth doing this so we can force the check in the more usual situation where allocation is fallible.
Attachment #8699023 -
Flags: review?(n.nethercote)
Assignee | ||
Comment 4•9 years ago
|
||
Same thing for ordered hash tables. This catches a couple of places in GC where we don't check the return code, in particular when clearing the weak keys table which can fail and leave the table with out-of-date entries.
Attachment #8699024 -
Flags: review?(sphink)
Comment 5•9 years ago
|
||
Comment on attachment 8699018 [details] [diff] [review] warn-hashtable-return-values Review of attachment 8699018 [details] [diff] [review]: ----------------------------------------------------------------- Great!
Attachment #8699018 -
Flags: review?(luke) → review+
Comment 6•9 years ago
|
||
Comment on attachment 8699024 [details] [diff] [review] warn-ordered-hashtable-return-values Review of attachment 8699024 [details] [diff] [review]: ----------------------------------------------------------------- Thanks!
Attachment #8699024 -
Flags: review?(sphink) → review+
Comment 7•9 years ago
|
||
Comment on attachment 8699023 [details] [diff] [review] warn-hashtable-return-values-dmd Review of attachment 8699023 [details] [diff] [review]: ----------------------------------------------------------------- It's a shame these changes are necessary given that DMD uses an infallible AllocationPolicy, but I guess it's unavoidable.
Attachment #8699023 -
Flags: review?(n.nethercote) → review+
Comment 8•9 years ago
|
||
(In reply to Nicholas Nethercote [:njn] from comment #7) > It's a shame these changes are necessary given that DMD uses an infallible > AllocationPolicy, but I guess it's unavoidable. IIRC the infallible versions of nsTArray methods do something clever with templates to avoid this issue but I don't remember the specifics.
Attachment #8699021 -
Flags: review?(wmccloskey) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/c46eebf3397e https://hg.mozilla.org/integration/mozilla-inbound/rev/dd740170e039
Comment 10•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/c46eebf3397e https://hg.mozilla.org/mozilla-central/rev/dd740170e039
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox46:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
You need to log in
before you can comment on or make changes to this bug.
Description
•