From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id E16573858D37 for ; Wed, 2 Mar 2022 18:37:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E16573858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 239141F37E; Wed, 2 Mar 2022 18:37:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1646246232; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=t79yVbzymAZcA6U9Fe9eHMf6l26GHG2PrXBVXLgpYVA=; b=yEq8DuWTziia5JprYW9FI9Iyk0qSaABbeURQOJdjhgeJp7z/PEe08HMcVx7xKoEbf9YCnb 8q8SOoB1frF8iTy743VlpnpsXpU8exOROOui2ISVz/Jcl0f0tgywsRQyE9tIQHhmOaIj+O FffELEq+cMcwXPsayzAk/dp3uFt79jg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1646246232; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=t79yVbzymAZcA6U9Fe9eHMf6l26GHG2PrXBVXLgpYVA=; b=dmI33J7tLWniIP+9SGSoqcoWf9EzJssBldU0l7+/UcXjvv1XaxoTm9drOVlNgvQTjMaAgx HWvdHsFGGXxftXCw== Received: from suse.cz (virgil.suse.cz [10.100.13.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 04F2BA3B85; Wed, 2 Mar 2022 18:37:11 +0000 (UTC) From: Martin Jambor To: Juan Scerri Cc: gcc@gcc.gnu.org Subject: Re: GSoC (Make cp-demangle non-recursive) In-Reply-To: References: User-Agent: Notmuch/0.34.1 (https://notmuchmail.org) Emacs/27.2 (x86_64-suse-linux-gnu) Date: Wed, 02 Mar 2022 19:37:11 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Mar 2022 18:37:15 -0000 Hello Juan, we are delighted you found contributing to GCC interesting. On Sat, Feb 26 2022, Juan Scerri wrote: > To whom this may concern, > > Firstly, I will introduce myself. I am Juan Scerri and I am a student at > the University of Malta studying Computer Science and Mathematics for my > undergraduate degree. > I am currently in my first year of studies, which is technically my first > formal introduction to GNU/Linux. However, I have been using GNU/Linux for > over a year. I am > mostly interested in programming which involves compilers, operating > systems and things of a similar sort. > > I have looked at the selected project ideas by the GCC team and one of the > problems which has caught my attention is making cp-demangle non-recursive. > I am interested in this particular problem because as stated in the "Before > you apply" section it is one of the selected problems which do not require > extensive > knowledge of the compiler theory (which I will be doing in my 3rd year of > studies). However, I do understand the aim of the project. Great. The other skill necessary for the project is reading and writing C code (not C++). The bulk of the demangler is in libiberty which is shared between gcc and binutils projects. It is actually easier to hack on it in the binutils repo, because there you get a utility to try it (c++filt) and there are tests in the testsuite to check that code (still) works. So I suggest you check out the binutils repo from git clone git://sourceware.org/git/binutils-gdb.git and build it as described in README (you do not need to run make install - you can run the configure and make in a different working directory if you wish to keep things clean). The source code of interest to you is almost entirely in libiberty/cp-demangle.c and libiberty/cp-demangle.h. You will need to wade through some preprocessor cruft, it is there for historical reasons and because the demangler can be used in utilities as well as in libraries and some interface functions have different names in those situations. Some of that might need to be changed/adjusted, do not be afraid of changing stuff. Those are the files you need to study, identify the various recursion cycles and think how to remove them and especially what would the data structures to do so look like. Ideally one by one, so that intermediate results still can be checked. I will have to refresh my own knowledge of the file so I will not go into any more detail now, but if you have any questions about the source code and would like to discuss approaches, priorities, anything, feel free to ask again here on the mailing list. When you build binutils, the simple utility to demangle stuff is called binutils/cxxfilt (it is installed under the name of c++filt which is what you'll find on Linux machines). There is a testsuite, you need package dejagnu for it, and you can run it by issuing make -C libiberty check in the binutils build directory. As I wrote above, if you have any further questions, feel free to ask here on the list. Good luck, Martin