From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#60237: 30.0.50; tree sitter core dumps when I edebug view a node Date: Sun, 26 Feb 2023 16:34:49 -0800 Message-ID: References: <9FCDA5B7-D216-45B1-8051-35B05633BEFB@gmail.com> <83sfeukwsb.fsf@gnu.org> <574817C4-3FD8-43EA-B53C-B2BCB60A6D0A@gmail.com> <87a610wyod.fsf@masteringemacs.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3246"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Po Lu , Eli Zaretskii , 60237@debbugs.gnu.org To: Mickey Petersen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 27 01:36:20 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1pWRV4-0000dI-Pn for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 27 Feb 2023 01:36:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWRUq-00048J-LL; Sun, 26 Feb 2023 19:36:04 -0500 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 1pWRUo-00047v-Ku for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2023 19:36:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pWRUo-0004dO-As for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2023 19:36:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pWRUn-00065j-T8 for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2023 19:36:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Feb 2023 00:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60237 X-GNU-PR-Package: emacs Original-Received: via spool by 60237-submit@debbugs.gnu.org id=B60237.167745811223354 (code B ref 60237); Mon, 27 Feb 2023 00:36:01 +0000 Original-Received: (at 60237) by debbugs.gnu.org; 27 Feb 2023 00:35:12 +0000 Original-Received: from localhost ([127.0.0.1]:45343 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWRTz-00064b-NR for submit@debbugs.gnu.org; Sun, 26 Feb 2023 19:35:11 -0500 Original-Received: from mail-pj1-f47.google.com ([209.85.216.47]:52903) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWRTx-00064J-6D for 60237@debbugs.gnu.org; Sun, 26 Feb 2023 19:35:09 -0500 Original-Received: by mail-pj1-f47.google.com with SMTP id l1so4418514pjt.2 for <60237@debbugs.gnu.org>; Sun, 26 Feb 2023 16:35:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=YNZ7NiU2j3LzbZF+wRyPLEfIaxQh8hTpW1dZJI29V/o=; b=RCFxjkoyNMwR3GP3sXgFsZJhYUp8s6RnDkXWKY7JGic7yUFSltyGcEvPLm1fs2wZLa XswfZsX1srfqAN5yQyRKlJYI1PBSGvoFOyzguDe1gm/ajG3MBRPHOld+Bd4ONrAx1apm /p8ye8z9J8HIOha+pWaM+NhGYSy0KAttSUvH29ka3JewPo8ihdUIlFEGGq+L/CBptm8R GzvxJ/tk/2sz47a0helblK+uDKbOUbmrRJpqXuRCWBf/9BLicJxpHRl5NtGfYZxybJTr YAtIy/dbyhUWcqW7GCVyVaOmezeSyuIeJoxV1PpYPanAGkCUv+QoZIZi/lnL0dT8xBq/ kjMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YNZ7NiU2j3LzbZF+wRyPLEfIaxQh8hTpW1dZJI29V/o=; b=tgv/HuJ+jyfcR2Xyo4JZBmseCfX3hkAyR/kRkmzVKA4gsVgncXKiyZGRNCSu8pszPq 3dGbLVFUkDY702Zazb3MLyHYaCg7FqOdZVkcBkwFUIlM59cRx7Pt16Nu7AUa1dKIlxL9 Lt8WAb0MwPPEMGVpFA0eEOwT9FhusTLy8W5z8kHXFdOsezkIBP11p3NWLKVzaTsvfOKZ iytvv0ijeXRFgYuUf4sgc390lQR0Vh+Mt0H9Dmv6cygobgWUl+Ci6g2FyVhwZNR9mpWs 0jUdEBV1Wdv+nv3MLfxGmtPpw6QTFS6NKPHRqSpKBFdv64s8nfmXx+NJo4YEOGhuexJ0 CL+g== X-Gm-Message-State: AO0yUKVUOXtkgkShYBy1exY/a/zjyoFDb+P9HrMPvM9kDx6ydegHiraK zAqfGU5Jj4bcPW+2Wb3TV2k= X-Google-Smtp-Source: AK7set97y17dsaAavvCpLREKSZkMksMxErNPdQQmUVAbd5DmomrOBXuqMfvanh+C67BWO0vSRYU3BA== X-Received: by 2002:a17:90a:e7ca:b0:233:eb8c:d7e9 with SMTP id kb10-20020a17090ae7ca00b00233eb8cd7e9mr26260856pjb.41.1677458102736; Sun, 26 Feb 2023 16:35:02 -0800 (PST) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id t12-20020a17090ae50c00b002376d85844dsm3019402pjy.51.2023.02.26.16.35.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Feb 2023 16:35:02 -0800 (PST) In-Reply-To: <87a610wyod.fsf@masteringemacs.org> X-Mailer: Apple Mail (2.3731.400.51.1.1) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:256839 Archived-At: > On Feb 26, 2023, at 1:41 AM, Mickey Petersen = wrote: >=20 >=20 > Yuan Fu writes: >=20 >>> GC has historically never called xmalloc, so the profiler will >>> likely >>> crash upon growing the mark stack as well. I guess another >>> important >>> question is why ts_delete_parser is calling xmalloc. >>>=20 >>=20 >>> As you see, when we call ts_tree_delete, it calls >>> ts_subtree_release, >>> which in turn calls malloc (redirected into our xmalloc). Is this >>> expected? Can you look in the tree-sitter sources and verify that >>> this is OK? >>=20 >> I had a look, and it seems legit. In tree-sitter, a TSTree (or more >> precisely, a Subtree) is just some inlined data plus a refcounted >> pointer to the complete data. This way multiple trees share common >> subtrees/nodes. Eg, when incrementally parsing, you pass in an old >> tree and get a new tree, these two trees will share the unchanged = part >> of the tree. >=20 > Would that mean we could possibly preserve node instances -- either = the real TS ones, or an Emacs-created facsimile -- between incremental = parsing? That would be useful for refactoring. What kind of exact interface (function) do you want? The = treesit-node-outdated error is solely Emacs=E2=80=99s product, = tree-sitter itself doesn=E2=80=99t mark a node outdated. It is possible = for Emacs to not delete the old tree and give it to you, or allow you to = access information of an outdated node. Yuan=