From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Robert Cochran Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] src/process.c: remove unnecessary setters Date: Wed, 03 Jan 2018 20:39:37 -0800 Message-ID: <87y3lei6eu.fsf@cochranmail.com> References: <87shjnmeag.fsf@SoraLaptop> <87tw43t94q.fsf@SoraLaptop> <39094a23-3884-68b6-5633-25a6231460f5@cs.ucla.edu> <83wp8yev6w.fsf@gnu.org> <87po6q78ut.fsf@cochranmail.com> <62ac068b-2ec2-af36-78f2-c7fb67ad2ee8@cs.ucla.edu> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1515040721 7702 195.159.176.226 (4 Jan 2018 04:38:41 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 4 Jan 2018 04:38:41 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Eli Zaretskii , dmantipov@yandex.ru, Robert Cochran , emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 04 05:38:37 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eWxIT-0001Gg-VW for ged-emacs-devel@m.gmane.org; Thu, 04 Jan 2018 05:38:30 +0100 Original-Received: from localhost ([::1]:47265 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eWxKT-00076W-0C for ged-emacs-devel@m.gmane.org; Wed, 03 Jan 2018 23:40:33 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37774) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eWxJt-000762-8H for emacs-devel@gnu.org; Wed, 03 Jan 2018 23:39:58 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eWxJq-0000Ct-5t for emacs-devel@gnu.org; Wed, 03 Jan 2018 23:39:57 -0500 Original-Received: from vps28183.inmotionhosting.com ([23.235.221.66]:64369) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eWxJp-0000C6-Uw; Wed, 03 Jan 2018 23:39:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=cochranmail.com; s=default; h=Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=qZWc3lO+UgLaMrS0av6MK0E0U4wRQ+IDD60Wc2gf1tg=; b=qDLAJMPLqru67h72FMHvkbsQ+ LRgTlTDNav3/VfqzfhboexFwRrdGFCnWxNtvFDbnmi3C+lemxKQXnUloqw6Y5UMVO6TWjf4539kpR +WbRyZI1lAzWU2UY6TIpqSM+dR/VsW39WWV5aJf063RFo+JgECJPIfOfXvzYhtC08lQkUEKcVOaQo +ftwPwBqexWxvVaAWzmv/Iyj6E0RiOIIxOh8FZOMXbV7liyHqwd1dInKSm3WFlt1wEuIU09+C+q56 NV0RNwgF/M0eAQktUfKvxwwLNnkkU+MKKCw3UM6lfYyN59ybog0txAo7VJl1Olpb5xNtNJVotBemm 03wNwjHsA==; Original-Received: from 131-191-86-130.as.clicknet.org ([131.191.86.130]:45702 helo=SoraLaptop) by vps28183.inmotionhosting.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1eWxJo-0004oU-2w; Wed, 03 Jan 2018 20:39:52 -0800 In-Reply-To: <62ac068b-2ec2-af36-78f2-c7fb67ad2ee8@cs.ucla.edu> (Paul Eggert's message of "Wed, 3 Jan 2018 16:44:24 -0800") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vps28183.inmotionhosting.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - cochranmail.com X-Get-Message-Sender-Via: vps28183.inmotionhosting.com: authenticated_id: robert@cochranmail.com X-Authenticated-Sender: vps28183.inmotionhosting.com: robert@cochranmail.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 23.235.221.66 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:221578 Archived-At: Here is the link to the head of this thread in the emacs-devel archive: https://lists.gnu.org/archive/html/emacs-devel/2017-05/msg00857.html src/process.c contains a few functions that are essentially just setters that take a struct Lisp_Process and a Lisp_Object and sets a particular structure member to the Lisp_Object. An example of one that I removed: #+BEGIN_SRC C static void pset_command (struct Lisp_Process *p, Lisp_Object val) { p->command = val; } #+END_SRC IMO, there's not much of a point in wrapping something so simple in a funcall. I understand that a good compiler will optimize that away, but that doesn't really fix the code any. Whatever reason for leaving these has apparently faded into history, if my past self is to be believed: >Paul Eggert writes: > >> As I recall those setters and getters were put in for a reason. Have you >> consulted the development history and emacs-devel logs to see why, and/or >> contacted whoever added that code? > > Not anymore, based on what I see. > > With some git-blame history digging, here's what I found: > > Dmitry Antipov added the ancestor PVAR macro in 3193acd2 "Use > INTERNAL_FIELD for processes." on 08/01/2012, and made the struct fields > use the INTERNAL_FIELD macro in the same commit. > > This was split into two macros PGET and PSET in 21238f11 "Separate read > and write access to Lisp_Object slots of Lisp_Process." on 08/06/2012. > > On 08/07/2012, he entirely drops PGET and removes the use of > INTERNAL_FIELD in 4d2b044c "Drop PGET and revert read access to > Lisp_Objects slots of Lisp_Process". > > Then it was you that removed PSET in favor of individual setters in > 6a09a33b "* process.h (PSET): Remove.", where the code has sat mostly > untouched since 08/18/2012 aside from being de-inlined by you in > b0ab8123d "Prefer plain 'static' to 'static inline'." on 09/30/2012. > > Especially given that in 2015, INTERNAL_FIELD was removed (according to > ChangeLog.2 at any rate), it looks like the reason for the functions > removed to be abstracted away has long since become irrelevant. Thanks, -- ~Robert Cochran GPG Fingerprint - BD0C 5F8B 381C 64F0 F3CE E7B9 EC9A 872C 41B2 77C2