From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23985 invoked by alias); 26 Jun 2009 10:38:42 -0000 Received: (qmail 23976 invoked by uid 22791); 26 Jun 2009 10:38:42 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from smtp.ispras.ru (HELO smtp.ispras.ru) (83.149.198.201) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 26 Jun 2009 10:38:34 +0000 Received: from ispserv.ispras.ru (ispserv.ispras.ru [83.149.198.72]) by smtp.ispras.ru (Postfix) with ESMTP id B3EF55D4269; Fri, 26 Jun 2009 14:10:24 +0400 (MSD) Received: from endeed2.ispras.ru (endeed2.ispras.ru [83.149.198.245]) by ispserv.ispras.ru (Postfix) with ESMTP id 8CEB63FC48; Fri, 26 Jun 2009 14:38:31 +0400 (MSD) Date: Fri, 26 Jun 2009 10:47:00 -0000 From: Alexander Monakov To: Jeff Law cc: Joe Buck , Richard Guenther , GCC Subject: Re: (known?) Issue with bitmap iterators In-Reply-To: <4A43C0F3.30503@redhat.com> Message-ID: References: <4A3CF81C.7050406@redhat.com> <84fc9c000906200801v28f814cj3fa5327c5f3df35e@mail.gmail.com> <4A3FBA1E.6040502@redhat.com> <20090622174623.GA6603@synopsys.com> <4A43C0F3.30503@redhat.com> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2009-06/txt/msg00594.txt.bz2 On Thu, 25 Jun 2009, Jeff Law wrote: > I wasn't suggesting we make them "safe" in the sense that one could modify > the bitmap and everything would just work. Instead I was suggesting we make > the bitmap readonly for the duration of the iterator and catch attempts to > modify the bitmap -- under the control of ENABLE_CHECKING of course. If that > turns out to still be too expensive, it could be conditional on > ENABLE_BITMAP_ITERATOR_CHECKING or whatever, which would normally be off. > > My biggest concern would be catching all the exit paths from the gazillion > iterators we use and making sure they all reset the readonly flag. Ick... Unless I'm missing something, one can avoid that by checking whether the bitmap has been modified in the iterator increment function. To be precise, what I have in mind is: 1. Add bool field `modified_p' in bitmap structure. 2. Make iterator setup functions (e.g. bmp_iter_set_init) reset it to false. 3. Make functions that modify the bitmap set it to true. 4. Make iterator increment function (e.g. bmp_iter_next) assert !modified_p. This approach would also allow to modify the bitmap on the iteration ending with break, which IMHO is fine. -- Alexander Monakov