From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: Emacs design and architecture. How about copy-on-write? Date: Thu, 21 Sep 2023 19:49:32 +0800 Message-ID: <87zg1fpwz7.fsf@yahoo.com> References: <87bkdzeas1.fsf@localhost> <83cyyfe5l8.fsf@gnu.org> <8734zbyu6o.fsf@dataswamp.org> <835y46e8o9.fsf@gnu.org> <87zg1ixvnc.fsf@dataswamp.org> <87il86nxts.fsf@localhost> <87o7hyx8h2.fsf@dataswamp.org> <87o7hx88ry.fsf@localhost> <87a5thta90.fsf@yahoo.com> <87led1865h.fsf@localhost> <875y45t7yo.fsf@yahoo.com> <874jjprmq2.fsf@yahoo.com> <83a5tgc03s.fsf@gnu.org> <87zg1gqr8q.fsf@yahoo.com> <83msxg9eb9.fsf@gnu.org> <87msxgq8rn.fsf@yahoo.com> <83jzsk9c5l.fsf@gnu.org> <87msxf2abp.fsf@localhost> <83h6nnalu5.fsf@gnu.org> <87y1gzzvec.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29872"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Ihor Radchenko Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Sep 21 15:02:57 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qjJKb-0007Vr-7q for ged-emacs-devel@m.gmane-mx.org; Thu, 21 Sep 2023 15:02:57 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qjJK5-00039q-Rd; Thu, 21 Sep 2023 09:02:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qjJDO-0002r8-8B for emacs-devel@gnu.org; Thu, 21 Sep 2023 08:55:39 -0400 Original-Received: from sonic308-56.consmr.mail.ne1.yahoo.com ([66.163.187.31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qjJDG-0000qf-3B for emacs-devel@gnu.org; Thu, 21 Sep 2023 08:55:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1695300916; bh=u8uNX/fasNV9ZUDBf3rdwvGTu81bYKR5I1k5yApBtEk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=fjRaOHFJtueWsfFUe1b8gLkzO8AkvVNImkvUdorGhnzSlE5iUquykbFoPVNCq8yjT/kD3qKn7bvhyOQ+DtTMKfcoE4+BsUU62LxAMo+fJP9AYvur41NTM+SR1frrvv1gjjq8r3m0Az2UqbXy3g0NvLzsN1FMqS5VB6osGoVy8szS2zbreC0R735w0bRWAUtEz81aA2qzAearLwLZxS8H18gJomXlucz5k873Uq3xEKqJtLcT7JWkiIj2cfhseY4qozcHcAaRPwW+DlNYjcaNU0W6i5IQvK1nBbwa6SiEENN7o9gAC2MNtsmy3jQoWJbAS3p2kj3vphI9LBViIk/hZQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1695300916; bh=dD7GaSWDB6hU2y683EuyRwNdk9WUK8THydwRK/iU2+m=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=Fa1GKEHH5+6r8yZ/lQZ3DMJO+85JBZKRNGKwYVJkHuXSY+YH0Sr/fYolCqpND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ZxjhYJNEHAJ7o7rl43twRGHgxEkBWMSj l9lv3XpxosfjvhLCe7EdmwOcOQYhXs_MOkNsaDGv3A X-Sonic-MF: X-Sonic-ID: d284cd55-b7b8-49c5-ae31-54515c77e3ac Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic308.consmr.mail.ne1.yahoo.com with HTTP; Thu, 21 Sep 2023 12:55:16 +0000 Original-Received: by hermes--production-sg3-55c667b499-6hbf4 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 7b506ffb67fc12d700c803c55519602d; Thu, 21 Sep 2023 11:49:39 +0000 (UTC) In-Reply-To: <87y1gzzvec.fsf@localhost> (Ihor Radchenko's message of "Thu, 21 Sep 2023 10:13:31 +0000") X-Mailer: WebService/1.1.21797 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.187.31; envelope-from=luangruo@yahoo.com; helo=sonic308-56.consmr.mail.ne1.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:310892 Archived-At: Ihor Radchenko writes: > As I understand his previous explanations, global variable values are > stored per-thread, if they were changed by that thread at some point. > For C-defined globals, the Vname instances are re-defined to > point to thread-local "globals" struct. > > I do not recall Po Lu providing the details on how the thread-local > variables are stored. Non-forwarded thread-local bindings are saved within a separate association list in Lisp_Symbol, where each element ties a thread to its local binding. do_specbind and do_one_specbind manage this association list by introducing new associations. set_internal and find_symbol_value search within this association list for a pair matching the current thread, and set or return its cdr respectively if it is present. Within lispfwds, the pointer to the field itself is replaced with an offset to a field within struct thread_state which is set to a pointer to the matching field in `globals' or one of its local bindings. Whenever a forwarded variable is specbound for the first time in a given thread, the designated field within that thread's state is set to a pointer into thread local storage, and once unbound, restored to its initial value within globals.