From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Antipov Newsgroups: gmane.emacs.devel Subject: Re: mark_stack () vs GCPROn Date: Thu, 06 Dec 2012 14:13:47 +0400 Message-ID: <50C06FDB.5020203@yandex.ru> References: <1354784459583-271770.post@n5.nabble.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1354788916 19630 80.91.229.3 (6 Dec 2012 10:15:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 6 Dec 2012 10:15:16 +0000 (UTC) Cc: Emacs-devel@gnu.org To: Sergey Mozgovoy Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 06 11:15:27 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TgYSu-0003Er-3a for ged-emacs-devel@m.gmane.org; Thu, 06 Dec 2012 11:14:00 +0100 Original-Received: from localhost ([::1]:35625 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgYSh-00011S-So for ged-emacs-devel@m.gmane.org; Thu, 06 Dec 2012 05:13:47 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:59687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgYSU-0000O0-94 for Emacs-devel@gnu.org; Thu, 06 Dec 2012 05:13:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TgYSO-0007cU-DN for Emacs-devel@gnu.org; Thu, 06 Dec 2012 05:13:34 -0500 Original-Received: from forward5h.mail.yandex.net ([84.201.186.23]:58521) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgYSN-0007bo-UG for Emacs-devel@gnu.org; Thu, 06 Dec 2012 05:13:28 -0500 Original-Received: from smtp2h.mail.yandex.net (smtp2h.mail.yandex.net [84.201.187.145]) by forward5h.mail.yandex.net (Yandex) with ESMTP id D406CD01A05; Thu, 6 Dec 2012 14:13:20 +0400 (MSK) Original-Received: from smtp2h.mail.yandex.net (localhost [127.0.0.1]) by smtp2h.mail.yandex.net (Yandex) with ESMTP id 8F02B1700363; Thu, 6 Dec 2012 14:13:20 +0400 (MSK) Original-Received: from unknown (unknown [37.139.80.10]) by smtp2h.mail.yandex.net (nwsmtp/Yandex) with ESMTP id DKkuuS43-DKki62Gs; Thu, 6 Dec 2012 14:13:20 +0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1354788800; bh=+mNYY0vZwNkwm/qMamKZK8cpep+cRbwc7aJciyuyW14=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=gyJQQzBNWtO8uatFUixHFfqGCQ6Anxc4lxBZGJASKoyQO8c62kSo+0I0h1hcJ411w 5tsPG6H8W68wOIJaJ09PSgAKL3al9/DtQk5udcaTP9ENZAUTNv8gd34FZ366mtmxvS T0o2+HdqwWTH6N+Slibog2f1MuLhbWeO91tdzNKU= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 In-Reply-To: <1354784459583-271770.post@n5.nabble.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 84.201.186.23 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:155317 Archived-At: On 12/06/2012 01:00 PM, Sergey Mozgovoy wrote: > Emacs has a `mark_stack' function in alloc.c, which looks for (potential) > Lisp_Objects located on the current C stack. Does it mean that GCPROn > mechanism is not necessary for local Lisp_Object variables now ? If stack marking is supported, then yes in general; but GCPROs are also used for debugging. This is controlled by GC_MARK_STACK in lisp.h. > It is quite clear that gcprolist is still necessary for static Lisp_Objects. IIUC you mix staticpro and GCPRO. > What are the relationships between these 2 approaches for marking objects ? In short, GCPRO is faster because you don't need to check whether the word in memory is a Lisp_Object. But stack marking is much more useful because you don't need to check whether C code calls Feval (and so potentially Fgarbage_collect) and so you don't worry about protecting local Lisp_Objects. BTW, the more important distinction is that the GCPRO-assisted collection is exact: you always know where the Lisp_Objects are, and mark them. Stack marking is conservative, e.g. treats everything which looks like the valid Lisp_Object as Lisp_Object. For example, if you have Lisp_Object at 0x12345678 and this object is not accessible from other objects, but there is an integer value 0x12345678 somewhere on C stack, the object will be marked. This way the collector doesn't reclaim some dead objects, which is impossible if GCPRO is used. Dmitry