Last Comment Bug 722689 - Slay nsCheapSets.h
: Slay nsCheapSets.h
Product: Core
Classification: Components
Component: XPCOM (show other bugs)
: unspecified
: All All
-- normal (vote)
: mozilla13
Assigned To: Nathan Froyd [:froydnj]
: Nathan Froyd [:froydnj]
Depends on:
Blocks: 700659
  Show dependency treegraph
Reported: 2012-01-31 06:51 PST by Nathan Froyd [:froydnj]
Modified: 2012-02-26 16:26 PST (History)
3 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

patch (12.64 KB, patch)
2012-02-10 13:06 PST, Nathan Froyd [:froydnj]
benjamin: review+
Details | Diff | Splinter Review

Description User image Nathan Froyd [:froydnj] 2012-01-31 06:51:24 PST
The pointer twiddling bits in here are just gross, and it uses ns{String,Int32}HashSet, which need to die per bug 700659.  Something like:

template<class EntryType>
class nsCheapSet
  union {
    nsTHashtable<EntryType> *table;
    EntryType::KeyType single;
  } u;
  enum {
  } state;
  /* CheapSet API here */

typedef nsCheapSet<nsStringHashKey> nsStringCheapSet;
typedef nsCheapSet<nsUint32HashKey> nsInt32CheapSet;

or somesuch.  The above is a little more expensive than pointer twiddling (in both time and space), but it is more correct.  Given that we have one user of the CheapSets interface, I'm not too worried about the minor ill effects.
Comment 1 User image Nathan Froyd [:froydnj] 2012-02-10 13:06:44 PST
Created attachment 596150 [details] [diff] [review]

Here's an initial patch.  I suppose I have to get approval elsewhere for the content bits, but let's focus on the xpcom bits for now.  WDYT about this approach?
Comment 2 User image Mozilla RelEng Bot 2012-02-23 07:46:04 PST
Autoland Patchset:
	Patches: 596150
	Branch: mozilla-central => try
Try run started, revision 8a3a88481bb7. To cancel or monitor the job, see:
Comment 3 User image Mozilla RelEng Bot 2012-02-23 13:00:19 PST
Try run for 8a3a88481bb7 is complete.
Detailed breakdown of the results available here:
Results (out of 216 total builds):
    exception: 3
    success: 173
    warnings: 25
    failure: 15
Builds (or logs if builds failed) available at:
Comment 5 User image Phil Ringnalda (:philor) 2012-02-26 16:26:52 PST

Note You need to log in before you can comment on or make changes to this bug.