Last Comment Bug 722689 - Slay nsCheapSets.h
: Slay nsCheapSets.h
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: XPCOM (show other bugs)
: unspecified
: All All
: -- normal (vote)
: mozilla13
Assigned To: Nathan Froyd [:froydnj]
:
:
Mentors:
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:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


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

Description 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
{
private:
  union {
    nsTHashtable<EntryType> *table;
    EntryType::KeyType single;
  } u;
  enum {
    ZERO,
    ONE,
    MANY
  } state;
public:
  /* 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 Nathan Froyd [:froydnj] 2012-02-10 13:06:44 PST
Created attachment 596150 [details] [diff] [review]
patch

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 Mozilla RelEng Bot 2012-02-23 07:46:04 PST
Autoland Patchset:
	Patches: 596150
	Branch: mozilla-central => try
	Destination: http://hg.mozilla.org/try/pushloghtml?changeset=8a3a88481bb7
Try run started, revision 8a3a88481bb7. To cancel or monitor the job, see: https://tbpl.mozilla.org/?tree=Try&rev=8a3a88481bb7
Comment 3 Mozilla RelEng Bot 2012-02-23 13:00:19 PST
Try run for 8a3a88481bb7 is complete.
Detailed breakdown of the results available here:
    https://tbpl.mozilla.org/?tree=Try&rev=8a3a88481bb7
Results (out of 216 total builds):
    exception: 3
    success: 173
    warnings: 25
    failure: 15
Builds (or logs if builds failed) available at:
http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/autolanduser@mozilla.com-8a3a88481bb7
Comment 5 Phil Ringnalda (:philor) 2012-02-26 16:26:52 PST
https://hg.mozilla.org/mozilla-central/rev/34e48e4d676f

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