From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rock.gnat.com (rock.gnat.com [205.232.38.15]) by sourceware.org (Postfix) with ESMTP id DCB1A3857004 for ; Sun, 3 Jan 2021 07:02:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DCB1A3857004 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=brobecker@adacore.com Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id B6805116536; Sun, 3 Jan 2021 02:02:56 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id dLM5SJ2q82CQ; Sun, 3 Jan 2021 02:02:56 -0500 (EST) Received: from float.home (localhost.localdomain [127.0.0.1]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPS id 592AD1164DA; Sun, 3 Jan 2021 02:02:56 -0500 (EST) Received: by float.home (Postfix, from userid 1000) id F253BA1608; Sun, 3 Jan 2021 11:02:50 +0400 (+04) Date: Sun, 3 Jan 2021 11:02:50 +0400 From: Joel Brobecker To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 000/203] Refactor expressions Message-ID: <20210103070250.GC285722@adacore.com> References: <20210101214723.1784144-1-tom@tromey.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210101214723.1784144-1-tom@tromey.com> X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jan 2021 07:03:01 -0000 Hi Tom, On Fri, Jan 01, 2021 at 02:44:00PM -0700, Tom Tromey wrote: > I have long thought that struct expression is the worst data structure > in GDB. In fact, I've sometimes told people it is the worst data > structure I've encountered in my career. I've wanted to rewrite it > for many years, and this year I finally found a workable plan and the > motivation to do so. This series is the result. Thanks for the (mega) series! Because of the length of the series, I think it's going to be potentially more difficult for you to maintain it over time. I so I think it would be nice if we could put a priority on its review. I've now started with part 1: > 1. Split functions out from the evaluators. > > Each evaluator function is fairly long, and mixes knowledge about > the structure of the expression (how the exp_elements are laid out) > with knowledge of the semantics of the operation. > > This part of the series, which is about 70 patches, splits out the > semantics of most operations into their own functions. These > functions can be then be reused -- which is helpful for ensuring > that changes don't sneak in. > > In this part of the series, sometimes the newly-introduced > functions have extraneous arguments. This was done partly so that > some could be reused by generic code in part 2; but also partly > because it was just simpler to write patches by rote. Aside from the commit "what is this code for", I think this part of the series is a nice improvement on its own. independently of redesigning struct expression, I've always found the evaluator functions to be overly long and harder to navigate as a result. So I think it could go in ahead of the rest if we agree that this part is good. For me, I've gone through the patches, more or less carefully based on a random sample, and they look good. I paused a bit about the Ada ones, were you excluded the hanlding of noside == EVAL_SKIP. I'm not entirely sure why that is, perhaps because the block consists in a goto nosideret? Looking at what that nosideret does, it's just... | nosideret: | return eval_skip_value (exp); ... so we could inline this in the new functions. However, this is really a very minor detail that doesn't need to be addressed here. So, to summarize, if others agree, I'm happy for this part of the series to go in. > > 2. Introduce 'class operation' and its subclasses. > > This sub-series is around 100 patches. It introduces the new base > class for an expression operation, and then proceeds to add > operations for every necessary opcode. In some cases multiple such > operations are needed -- for example when multiple languages > implement an opcode in different ways. > > Some discussion of the design & tradeoffs appear in the "Introduce > class operation" patch. > > 3. Convert existing code to use operations. > > This is a short sub-series of around 10 patches. Each parser is > converted separately, as are DTrace and SystemTap probes > > 4. Delete obsolete code. > > The final 20 patches or so are concerned with removing all the code > that is now obsolete, and with doing some minor tidying of the > result. > > The overall approach here is to replace the current data structure -- > but only the data structure. I didn't generally try to clean up > things that seemed a bit weird. > > I also didn't try to add new features, like async evaluation. After > starting the project, I felt that trying to combine this refactoring > with another, different one would be too difficult. > > This is all on the branch t/expression-rewrite-incr in my github. > > Regression tested on x86-64 Fedora 32. I also built it on PPC Linux > to ensure that the ppc-linux-nat.c changes would build. > > Tom > -- Joel