This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Use refcounted shared hash tables to decrease var-tracking memory usage and speed it up


Jakub Jelinek wrote:
On Fri, Jun 19, 2009 at 11:28:26AM -0700, Richard Henderson wrote:
Seems like this sequence ought to be split out to a function.
Indeed, it wouldn't bother me at all if the NO_INSERT case were
split out as well -- the repetition of shared_hash_htab and
VARIABLE_HASH_VAL are moderately bulky.

Like this? First interdiff from the last patch, then the new version of the patch.

Nearly. In variable_was_changed,


+	  slot = shared_hash_find_slot_noinsert (set->vars, var->decl);
 	  if (slot)
-	    htab_clear_slot (htab, slot);
+	    {
+	      if (shared_hash_shared (set->vars))
+		{
+		  set->vars = shared_hash_unshare (set->vars);
+		  slot = shared_hash_find_slot_noinsert (set->vars, var->decl);
+		}
+	      htab_clear_slot (shared_hash_htab (set->vars), slot);
+	    }

this second lookup is why i'd suggested that shared_hash_find_slot_unshare take an insert argument.

Ok with that change.



r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]