* Leaking bitmap data in ree.c? @ 2016-03-18 19:18 Jeff Law 2016-03-21 3:22 ` Trevor Saunders 0 siblings, 1 reply; 10+ messages in thread From: Jeff Law @ 2016-03-18 19:18 UTC (permalink / raw) To: gcc Is it just me, or does find_removable_extensions leak bitmap data for INIT, KILL, GEN and TMP? It calls bitmap_initialize on all of them, but never clears the bitmaps... Am I missing something? jeff ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Leaking bitmap data in ree.c? 2016-03-18 19:18 Leaking bitmap data in ree.c? Jeff Law @ 2016-03-21 3:22 ` Trevor Saunders 2016-03-21 16:42 ` Jeff Law 0 siblings, 1 reply; 10+ messages in thread From: Trevor Saunders @ 2016-03-21 3:22 UTC (permalink / raw) To: Jeff Law; +Cc: gcc On Fri, Mar 18, 2016 at 01:18:16PM -0600, Jeff Law wrote: > > Is it just me, or does find_removable_extensions leak bitmap data for INIT, > KILL, GEN and TMP? > > It calls bitmap_initialize on all of them, but never clears the bitmaps... > > Am I missing something? See this lovely comment for bitmap_initialize_stat () which is macroed to bitmap_initialize () /* Initialize a bitmap header. OBSTACK indicates the bitmap obstack to allocate from, NULL for GC'd bitmap. */ So I think the elements for those bitmaps are just getting allocated on the gc heap, and everything is correct though of course it would be nice to stop using the gc there. Trev > > jeff ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Leaking bitmap data in ree.c? 2016-03-21 3:22 ` Trevor Saunders @ 2016-03-21 16:42 ` Jeff Law 2016-03-21 17:10 ` Trevor Saunders 0 siblings, 1 reply; 10+ messages in thread From: Jeff Law @ 2016-03-21 16:42 UTC (permalink / raw) To: Trevor Saunders; +Cc: gcc On 03/20/2016 09:24 PM, Trevor Saunders wrote: > On Fri, Mar 18, 2016 at 01:18:16PM -0600, Jeff Law wrote: >> >> Is it just me, or does find_removable_extensions leak bitmap data for INIT, >> KILL, GEN and TMP? >> >> It calls bitmap_initialize on all of them, but never clears the bitmaps... >> >> Am I missing something? > > See this lovely comment for bitmap_initialize_stat () which is macroed > to bitmap_initialize () > > /* Initialize a bitmap header. OBSTACK indicates the bitmap obstack > to allocate from, NULL for GC'd bitmap. */ > > So I think the elements for those bitmaps are just getting allocated on > the gc heap, and everything is correct though of course it would be nice > to stop using the gc there. Yea, but it's kindof silly to force the ggc system to handle this. At the least a bitmap_clear would return the bitmap elements to the bitmap element cache (which should also be more efficient for the ggc system) I'll resist the urge for now to apply RAII principles in this code, but that'd probably a much cleaner way to think about the problem in general. jeff ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Leaking bitmap data in ree.c? 2016-03-21 16:42 ` Jeff Law @ 2016-03-21 17:10 ` Trevor Saunders 2016-03-21 17:13 ` Jeff Law 0 siblings, 1 reply; 10+ messages in thread From: Trevor Saunders @ 2016-03-21 17:10 UTC (permalink / raw) To: Jeff Law; +Cc: gcc On Mon, Mar 21, 2016 at 10:42:18AM -0600, Jeff Law wrote: > On 03/20/2016 09:24 PM, Trevor Saunders wrote: > >On Fri, Mar 18, 2016 at 01:18:16PM -0600, Jeff Law wrote: > >> > >>Is it just me, or does find_removable_extensions leak bitmap data for INIT, > >>KILL, GEN and TMP? > >> > >>It calls bitmap_initialize on all of them, but never clears the bitmaps... > >> > >>Am I missing something? > > > >See this lovely comment for bitmap_initialize_stat () which is macroed > >to bitmap_initialize () > > > >/* Initialize a bitmap header. OBSTACK indicates the bitmap obstack > > to allocate from, NULL for GC'd bitmap. */ > > > >So I think the elements for those bitmaps are just getting allocated on > >the gc heap, and everything is correct though of course it would be nice > >to stop using the gc there. > Yea, but it's kindof silly to force the ggc system to handle this. At the > least a bitmap_clear would return the bitmap elements to the bitmap element > cache (which should also be more efficient for the ggc system) yeah > I'll resist the urge for now to apply RAII principles in this code, but > that'd probably a much cleaner way to think about the problem in general. I worked on a couple attempts to c++ify bitmaps a while back, but never finished any of them, but I could probably publish what I did in case someone wants to pick that up for gcc 7. Trev > > jeff ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Leaking bitmap data in ree.c? 2016-03-21 17:10 ` Trevor Saunders @ 2016-03-21 17:13 ` Jeff Law 2016-03-21 17:17 ` David Malcolm 2016-04-03 0:45 ` Trevor Saunders 0 siblings, 2 replies; 10+ messages in thread From: Jeff Law @ 2016-03-21 17:13 UTC (permalink / raw) To: Trevor Saunders; +Cc: gcc On 03/21/2016 11:15 AM, Trevor Saunders wrote: > >> I'll resist the urge for now to apply RAII principles in this code, but >> that'd probably a much cleaner way to think about the problem in general. > > I worked on a couple attempts to c++ify bitmaps a while back, but never > finished any of them, but I could probably publish what I did in case > someone wants to pick that up for gcc 7. Can't hurt. FWIW, bitmaps are low level and independent of trees, rtl, etc that we ought to (in theory) be able to class-ify them and build a real unit testing framework for them. jeff ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Leaking bitmap data in ree.c? 2016-03-21 17:13 ` Jeff Law @ 2016-03-21 17:17 ` David Malcolm 2016-03-21 17:20 ` Jeff Law 2016-04-03 0:45 ` Trevor Saunders 1 sibling, 1 reply; 10+ messages in thread From: David Malcolm @ 2016-03-21 17:17 UTC (permalink / raw) To: Jeff Law, Trevor Saunders; +Cc: gcc On Mon, 2016-03-21 at 11:13 -0600, Jeff Law wrote: > On 03/21/2016 11:15 AM, Trevor Saunders wrote: > > > > > I'll resist the urge for now to apply RAII principles in this > > > code, but > > > that'd probably a much cleaner way to think about the problem in > > > general. > > > > I worked on a couple attempts to c++ify bitmaps a while back, but > > never > > finished any of them, but I could probably publish what I did in > > case > > someone wants to pick that up for gcc 7. > Can't hurt. > > FWIW, bitmaps are low level and independent of trees, rtl, etc that > we > ought to (in theory) be able to class-ify them and build a real unit > testing framework for them. Something like: https://gcc.gnu.org/ml/gcc-patches/2015-11/msg02371.html ? ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Leaking bitmap data in ree.c? 2016-03-21 17:17 ` David Malcolm @ 2016-03-21 17:20 ` Jeff Law 2016-03-22 9:29 ` Richard Biener 0 siblings, 1 reply; 10+ messages in thread From: Jeff Law @ 2016-03-21 17:20 UTC (permalink / raw) To: David Malcolm, Trevor Saunders; +Cc: gcc On 03/21/2016 11:16 AM, David Malcolm wrote: > On Mon, 2016-03-21 at 11:13 -0600, Jeff Law wrote: >> On 03/21/2016 11:15 AM, Trevor Saunders wrote: >>> >>>> I'll resist the urge for now to apply RAII principles in this >>>> code, but >>>> that'd probably a much cleaner way to think about the problem in >>>> general. >>> >>> I worked on a couple attempts to c++ify bitmaps a while back, but >>> never >>> finished any of them, but I could probably publish what I did in >>> case >>> someone wants to pick that up for gcc 7. >> Can't hurt. >> >> FWIW, bitmaps are low level and independent of trees, rtl, etc that >> we >> ought to (in theory) be able to class-ify them and build a real unit >> testing framework for them. > > Something like: > https://gcc.gnu.org/ml/gcc-patches/2015-11/msg02371.html Like that, or complete instantiation outside GCC. jeff ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Leaking bitmap data in ree.c? 2016-03-21 17:20 ` Jeff Law @ 2016-03-22 9:29 ` Richard Biener 0 siblings, 0 replies; 10+ messages in thread From: Richard Biener @ 2016-03-22 9:29 UTC (permalink / raw) To: Jeff Law; +Cc: David Malcolm, Trevor Saunders, gcc On Mon, Mar 21, 2016 at 6:19 PM, Jeff Law <law@redhat.com> wrote: > On 03/21/2016 11:16 AM, David Malcolm wrote: >> >> On Mon, 2016-03-21 at 11:13 -0600, Jeff Law wrote: >>> >>> On 03/21/2016 11:15 AM, Trevor Saunders wrote: >>>> >>>> >>>>> I'll resist the urge for now to apply RAII principles in this >>>>> code, but >>>>> that'd probably a much cleaner way to think about the problem in >>>>> general. >>>> >>>> >>>> I worked on a couple attempts to c++ify bitmaps a while back, but >>>> never >>>> finished any of them, but I could probably publish what I did in >>>> case >>>> someone wants to pick that up for gcc 7. >>> >>> Can't hurt. >>> >>> FWIW, bitmaps are low level and independent of trees, rtl, etc that >>> we >>> ought to (in theory) be able to class-ify them and build a real unit >>> testing framework for them. >> >> >> Something like: >> https://gcc.gnu.org/ml/gcc-patches/2015-11/msg02371.html > > Like that, or complete instantiation outside GCC. I don't like more C++-ification just for the sake of it. Like the alloc-pool C++ification caused more issues than it fixed. I'd happily approve sth like an auto_bitmap class though (bah, we can't have auto <X> as auto is already taken!). Notice that using bitmap_initialize is a micro-optimization to avoid one indirection. I doubt it matters for REE. Also keep in mind bitmap statistics - leaving bitmaps to GC only like REE seems to do will mess them up. Bitmaps that have used bitmap_initialize and allocating from GC need to call bitmap_clear on them. In fact REE should simply use &bitmap_default_obstack, I think that it uses GC is an oversight... Richard. > jeff ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Leaking bitmap data in ree.c? 2016-03-21 17:13 ` Jeff Law 2016-03-21 17:17 ` David Malcolm @ 2016-04-03 0:45 ` Trevor Saunders 2016-04-03 0:53 ` Trevor Saunders 1 sibling, 1 reply; 10+ messages in thread From: Trevor Saunders @ 2016-04-03 0:45 UTC (permalink / raw) To: Jeff Law; +Cc: gcc On Mon, Mar 21, 2016 at 11:13:07AM -0600, Jeff Law wrote: > On 03/21/2016 11:15 AM, Trevor Saunders wrote: > > > >>I'll resist the urge for now to apply RAII principles in this code, but > >>that'd probably a much cleaner way to think about the problem in general. > > > >I worked on a couple attempts to c++ify bitmaps a while back, but never > >finished any of them, but I could probably publish what I did in case > >someone wants to pick that up for gcc 7. > Can't hurt. ok, finally got around to that. The git mirror now has branches tbsaunde/bitmap tbsaunde/bitmap2 and tbsaunde/bitvec. I think the first two actually aren't very valuable, trying add a ctor / dtor to bitmap_head itself seems like a poor idea bound to run into some strange use of bitmaps. It seems a lot safer to add a auto_bitmap and move things over to it. On the other hand the bitvec branch is trying to build something sbitmap like, but trying to use vec to manage the storage instead of doing it manually. I'm not sure why I didn't finish that idea. Trev > > FWIW, bitmaps are low level and independent of trees, rtl, etc that we ought > to (in theory) be able to class-ify them and build a real unit testing > framework for them. > > jeff ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Leaking bitmap data in ree.c? 2016-04-03 0:45 ` Trevor Saunders @ 2016-04-03 0:53 ` Trevor Saunders 0 siblings, 0 replies; 10+ messages in thread From: Trevor Saunders @ 2016-04-03 0:53 UTC (permalink / raw) To: Jeff Law; +Cc: gcc On Sat, Apr 02, 2016 at 08:49:57PM -0400, Trevor Saunders wrote: > On Mon, Mar 21, 2016 at 11:13:07AM -0600, Jeff Law wrote: > > On 03/21/2016 11:15 AM, Trevor Saunders wrote: > > > > > >>I'll resist the urge for now to apply RAII principles in this code, but > > >>that'd probably a much cleaner way to think about the problem in general. > > > > > >I worked on a couple attempts to c++ify bitmaps a while back, but never > > >finished any of them, but I could probably publish what I did in case > > >someone wants to pick that up for gcc 7. > > Can't hurt. > > ok, finally got around to that. The git mirror now has branches > tbsaunde/bitmap tbsaunde/bitmap2 and tbsaunde/bitvec. I think the first > two actually aren't very valuable, trying add a ctor / dtor to > bitmap_head itself seems like a poor idea bound to run into some strange > use of bitmaps. It seems a lot safer to add a auto_bitmap and move > things over to it. On the other hand the bitvec branch is trying to > build something sbitmap like, but trying to use vec to manage the > storage instead of doing it manually. I'm not sure why I didn't finish that > idea. oh, and now I do remember why, it looks like it depends on making vec call destructors when objects in the vector are removed which makes sense, but it makes implementing pop () tricky. Trev > > Trev > > > > > FWIW, bitmaps are low level and independent of trees, rtl, etc that we ought > > to (in theory) be able to class-ify them and build a real unit testing > > framework for them. > > > > jeff ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-04-03 0:53 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-03-18 19:18 Leaking bitmap data in ree.c? Jeff Law 2016-03-21 3:22 ` Trevor Saunders 2016-03-21 16:42 ` Jeff Law 2016-03-21 17:10 ` Trevor Saunders 2016-03-21 17:13 ` Jeff Law 2016-03-21 17:17 ` David Malcolm 2016-03-21 17:20 ` Jeff Law 2016-03-22 9:29 ` Richard Biener 2016-04-03 0:45 ` Trevor Saunders 2016-04-03 0:53 ` Trevor Saunders
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).