public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [committed] Improve handling of running into both low-mem and max die-limits
@ 2019-01-01  0:00 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2019-01-01  0:00 UTC (permalink / raw)
  To: dwz, jakub

Hi,

If both the low-mem die-limit as well as the max die-limit are triggered, we
find out about the low-mem die-limit during counting, and about the max
die-limit during parsing in low-mem mode:
...
$ dwz cc1 -o 1 -l1000 -L10000000 --devel-trace
Compressing 1
Counting DIEs
Hit low-mem die-limit
Compressing 1 in low-mem mode
htab: off_htab allocation
      size: 131071
dwz: cc1: Too many DIEs, not optimizing
htab: off_htab final
      size: 2097143
      elements: 427544, occupancy: 0.203870
      searches: 1985541, collisions: 0.602202
...

Fix this such that we find out about both limits during counting:
...
$ dwz cc1 -o 1 -l1000 -L10000000 --devel-trace
Compressing 1
Counting DIEs
Hit low-mem die-limit
dwz: cc1: Too many DIEs, not optimizing
...

Committed to trunk.

Thanks,
- Tom

Improve handling of running into both low-mem and max die-limits

2019-11-26  Tom de Vries  <tdevries@suse.de>

	* dwz.c (try_debug_info): Keep going after hitting low-mem die-limit,
	if we might hit the max die-limit.

---
 dwz.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/dwz.c b/dwz.c
index d5e477b..4e42062 100644
--- a/dwz.c
+++ b/dwz.c
@@ -4933,6 +4933,7 @@ try_debug_info (DSO *dso)
   unsigned int ndies;
   unsigned ret = 1;
   int kind = DEBUG_INFO;
+  bool low_mem_die_limit_hit = false;
 
   if (tracing)
     fprintf (stderr, "Counting DIEs\n");
@@ -5032,8 +5033,14 @@ try_debug_info (DSO *dso)
 	    {
 	      if (tracing)
 		fprintf (stderr, "Hit low-mem die-limit\n");
-	      ret = 2;
-	      goto fail;
+	      if (estimate_nr_dies () > max_die_limit)
+		/* Keep going, we still might hit the max die-limit.  */
+		low_mem_die_limit_hit = true;
+	      else
+		{
+		  ret = 2;
+		  goto fail;
+		}
 	    }
 	  ndies++;
 	  t = htab_find_with_hash (abbrev, &tag, tag.entry);
@@ -5047,7 +5054,10 @@ try_debug_info (DSO *dso)
 	}
     }
 
-  ret = 0;
+  if (low_mem_die_limit_hit)
+    ret = 2;
+  else
+    ret = 0;
 
  fail:
   if (abbrev)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-11-26 14:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-01  0:00 [committed] Improve handling of running into both low-mem and max die-limits Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).