From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Gerd_M=C3=B6llmann?= Newsgroups: gmane.emacs.devel Subject: Re: MPS: native comp Date: Tue, 30 Apr 2024 07:30:05 +0200 Message-ID: References: <86le4wsj14.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19161"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , emacs-devel@gnu.org, Helmut Eller To: Andrea Corallo Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Apr 30 07:30:54 2024 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 1s1g4s-0004mP-ER for ged-emacs-devel@m.gmane-mx.org; Tue, 30 Apr 2024 07:30:54 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1g4H-00056H-U4; Tue, 30 Apr 2024 01:30:18 -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 1s1g4F-00055w-Pu for emacs-devel@gnu.org; Tue, 30 Apr 2024 01:30:16 -0400 Original-Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1g4A-0008WR-LR; Tue, 30 Apr 2024 01:30:15 -0400 Original-Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-41b79451145so30790125e9.3; Mon, 29 Apr 2024 22:30:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714455008; x=1715059808; darn=gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=mx76oP0LZADUPX8IyShE8qPRHKhZfrjkx6TeAxY+a3U=; b=YLHMsMioo8/QAnCkEjREsGaMM23cdYnBdP6ITIElTPkiNQQLYJtFt58CfDhCMmo7je di9FzlgO+GKQBDwxIUESoeR3J+VOgt0zWGlc8BCyf4x5YFYzJwCkisR8dehLAWT989WI HMxGkshB/yAttzWlyvwhBCuw0D+7hnBxusjWgDkL5AJLEGLTCatoIN1Beuem1utAaFX7 ooAqxoNI6PG0AMYDPzNCyIRTHaoyDDiQ899HWYDMBCp9cInJdq2Po3hqQFbiz+m70+7j X1wTkKRCHzHT2QheBWnbGaIkmswEc7kpa7e9r/lvPkRP1uGdFvPNiHt71t58qGejwDeu 8/ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714455008; x=1715059808; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=mx76oP0LZADUPX8IyShE8qPRHKhZfrjkx6TeAxY+a3U=; b=UUtp6NkKOo1e7XOmFBIphM1DgVqGMDJKgqhW86RjcYPdB/tOpoPJTWquOFJ7tnfCQ6 SOJ6VmMk9VZLAOO6ut+Nn953asBK6/hTb/L23jspm8zJQh6gp2wM6OSxKDYX67JZkG4D 2Y/h8GZAobAVbFk9dWuUR9w7A+z3DCN99KsQwXVFHsKmLhmT9atVU/hERsoBdJqcBSP4 6+K6SMCtEe/gd/GotaJrP0QBfxwdiZGTAasJ2P+m8M8wJgCfCu1eoWxIkqzMuwKy8ch/ OJECrV5RDKrGZPNEwx36MlaK9hR2u3S7H5gfctn5ZihWsiIi/IBCKivJCuurmAQyoV2g UY/A== X-Forwarded-Encrypted: i=1; AJvYcCVZbkPMrWbhUnI4e1kt9b+drCsKoDed8VGXgctRltdoKfBLkYyeLd3NeBpKNVYPUPZQ0zSd/glZ+nynWwucrnUKDTPT X-Gm-Message-State: AOJu0YyPIt1TwdbnN+WFjJvDgVHqFPB043hP6yyiHvZ19ejsv8UiVAD3 KyIBXnusJoNxL4Emb4zHSdfNTndacznxhNpe52VZhTdTBI4M85bt X-Google-Smtp-Source: AGHT+IERI22iSRRiIAh/d5ARLQco+r4KP4WuiQ2NPyl5HQ9oXkj0nJQSxFSDBn6BOS+OtIqd8ZXBFQ== X-Received: by 2002:a05:600c:46cf:b0:41c:5eb:4f8f with SMTP id q15-20020a05600c46cf00b0041c05eb4f8fmr5697302wmo.15.1714455007264; Mon, 29 Apr 2024 22:30:07 -0700 (PDT) Original-Received: from pro2.fritz.box (p4fe3ae18.dip0.t-ipconnect.de. [79.227.174.24]) by smtp.gmail.com with ESMTPSA id n18-20020a05600c4f9200b004169836bf9asm47455896wmq.23.2024.04.29.22.30.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 22:30:06 -0700 (PDT) In-Reply-To: ("Gerd =?utf-8?Q?M=C3=B6llman?= =?utf-8?Q?n=22's?= message of "Tue, 30 Apr 2024 06:58:49 +0200") Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=gerd.moellmann@gmail.com; helo=mail-wm1-x32e.google.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, 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:318395 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Gerd M=C3=B6llmann writes: > That promises to become fun :-/ Sometimes one needs a bit of luck. Another try landed me in an abort in set_internal, and I could see that we have another case of a symbol pointing to a tombstone. So, we have another reference in the compilation unit that we don't trace. @Andrea: Any intuition where else references could lurk, perhaps? I'm currently doing this: static mps_res_t fix_comp_unit (mps_ss_t ss, struct Lisp_Native_Comp_Unit *u) { MPS_SCAN_BEGIN (ss) { IGC_FIX_CALL_FN (ss, struct Lisp_Vector, u, fix_vectorlike); if (u->data_imp_relocs) { size_t n =3D ASIZE (u->data_impure_vec); IGC_FIX12_NOBJS (ss, u->data_imp_relocs, n); } if (u->data_relocs) { size_t n =3D ASIZE (u->data_vec); IGC_FIX12_NOBJS (ss, u->data_relocs, n); } } MPS_SCAN_END (ss); return MPS_RES_OK; } Maybe there's something wrong with that (the ASIZEs maybe?) @Eli & Helmut ainly: I'm attaching my debug log because this is one of the cases I mentioned where I needed xpostmortem to remove MPS' barriers. xpostmortem is a command that I defined for LLDB that called igc_postmortem. --=-=-= Content-Type: text/x-org; charset=utf-8 Content-Disposition: attachment; filename=20240403203517-debugging_ideas.org Content-Transfer-Encoding: quoted-printable Content-Description: debug log :PROPERTIES: :ID: 544E65F2-9EED-4D0E-812F-79205DA0040F :END: #+title: Debugging Ideas * Eager macro expansion failure, abort, ... macroexp native-compiled, rest source. Dumnping. #+begin_src sh Loading /Users/gerd/emacs/savannah/igc/lisp/indent.el (source)... Loading /Users/gerd/emacs/savannah/igc/lisp/emacs-lisp/cl-generic.el (sourc= e)... Loading /Users/gerd/emacs/savannah/igc/lisp/simple.el (source)... Error: error ("Eager macro-expansion failure: (setting-constant byte-compil= e-form-stack)") signal(error ("Eager macro-expansion failure: (setting-constant byte-comp= ile-form-stack)")) error("Eager macro-expansion failure: %S" (setting-constant byte-compile-= form-stack)) internal-macroexpand-for-load((defalias 'undo #'(lambda (&optional arg) "= Undo some previous changes.\nRepeat this command to undo more changes.\nA n= umeric ARG serves as a repeat count.\n\nIn Transient Mark mode when the mar= k is active, undo changes only within\nthe current region. Similarly, when= not in Transient Mark mode, just \\[universal-argument]\nas an argument li= mits undo to changes within the current region." (interactive "*P") (let* (= (modified (buffer-modified-p)) (base-buffer (or (buffer-base-buffer) (curre= nt-buffer))) (recent-save (with-current-buffer base-buffer (recent-auto-sav= e-p))) (inhibit-region (and (symbolp last-command) (get last-command 'undo-= inhibit-region))) message) (setq this-command 'undo-start) (unless (and (eq= last-command 'undo) (or (eq pending-undo-list t) (undo--last-change-was-un= do-p buffer-undo-list))) (setq undo-in-region (and (or (region-active-p) (a= nd arg (not (numberp arg)))) (not inhibit-region))) (if undo-in-region (und= o-start (region-beginning) (region-end)) (undo-start)) (undo-more 1)) (setq= this-command 'undo) (let ((equiv (gethash pending-undo-list undo-equiv-tab= le))) (or (eq (selected-window) (minibuffer-window)) (setq message (format = "%s%s" (if (or undo-no-redo (not equiv)) "Undo" "Redo") (if undo-in-region = " in region" "")))) (when (and (consp equiv) undo-no-redo) (while (let ((ne= xt (gethash equiv undo-equiv-table))) (if next (setq equiv next)))) (setq p= ending-undo-list (if (consp equiv) equiv t)))) (undo-more (if (numberp arg)= (prefix-numeric-value arg) 1)) (let ((list buffer-undo-list)) (while (eq (= car list) nil) (setq list (cdr list))) (puthash list (cond (undo-in-region = 'undo-in-region) ((eq list pending-undo-list) (or (gethash list undo-equiv-= table) 'empty)) (t pending-undo-list)) undo-equiv-table)) (let ((tail buffe= r-undo-list) (prev nil)) (while (car tail) (when (integerp (car tail)) (let= ((pos (car tail))) (if prev (setcdr prev (cdr tail)) (setq buffer-undo-lis= t (cdr tail))) (setq tail (cdr tail)) (while (car tail) (if (eq pos (car ta= il)) (if prev (setcdr prev (cdr tail)) (setq buffer-undo-list (cdr tail))) = (setq prev tail)) (setq tail (cdr tail))) (setq tail nil))) (setq prev tail= tail (cdr tail)))) (and modified (not (buffer-modified-p)) (with-current-b= uffer base-buffer (delete-auto-save-file-if-necessary recent-save))) (if me= ssage (message "%s" message))))) t) eval-buffer(# nil "/Users/gerd/emacs/savannah/igc/lisp/si= mple.el" nil t) (if eval-function (funcall eval-function buffer (if dump-mode file fullna= me)) (eval-buffer buffer nil (if dump-mode file fullname) nil t)) (let ((read-symbol-shorthands shorthands)) (if eval-function (funcall eva= l-function buffer (if dump-mode file fullname)) (eval-buffer buffer nil (if= dump-mode file fullname) nil t))) (let ((load-true-file-name fullname) (load-file-name fullname) (set-auto-= coding-for-load t) (inhibit-file-name-operation nil) shorthands) (with-curr= ent-buffer buffer (set-buffer-multibyte t) (let (deactivate-mark) (insert-f= ile-contents fullname)) (setq shorthands (and hack-read-symbol-shorthands-f= unction (funcall hack-read-symbol-shorthands-function))) (if (and enable-mu= ltibyte-characters (or (eq (coding-system-type last-coding-system-used) 'ra= w-text))) (set-buffer-multibyte nil)) (set-buffer-modified-p nil)) (let ((r= ead-symbol-shorthands shorthands)) (if eval-function (funcall eval-function= buffer (if dump-mode file fullname)) (eval-buffer buffer nil (if dump-mode= file fullname) nil t)))) (unwind-protect (let ((load-true-file-name fullname) (load-file-name full= name) (set-auto-coding-for-load t) (inhibit-file-name-operation nil) shorth= ands) (with-current-buffer buffer (set-buffer-multibyte t) (let (deactivate= -mark) (insert-file-contents fullname)) (setq shorthands (and hack-read-sym= bol-shorthands-function (funcall hack-read-symbol-shorthands-function))) (i= f (and enable-multibyte-characters (or (eq (coding-system-type last-coding-= system-used) 'raw-text))) (set-buffer-multibyte nil)) (set-buffer-modified-= p nil)) (let ((read-symbol-shorthands shorthands)) (if eval-function (funca= ll eval-function buffer (if dump-mode file fullname)) (eval-buffer buffer n= il (if dump-mode file fullname) nil t)))) (let (kill-buffer-hook kill-buffe= r-query-functions) (kill-buffer buffer))) (let ((buffer (generate-new-buffer " *load*")) (load-in-progress t) (sour= ce (string-suffix-p ".el" fullname))) (unless nomessage (if source (message= "Loading %s (source)..." file) (message "Loading %s..." file))) (when puri= fy-flag (push (purecopy file) preloaded-file-list)) (unwind-protect (let ((= load-true-file-name fullname) (load-file-name fullname) (set-auto-coding-fo= r-load t) (inhibit-file-name-operation nil) shorthands) (with-current-buffe= r buffer (set-buffer-multibyte t) (let (deactivate-mark) (insert-file-conte= nts fullname)) (setq shorthands (and hack-read-symbol-shorthands-function (= funcall hack-read-symbol-shorthands-function))) (if (and enable-multibyte-c= haracters (or (eq (coding-system-type last-coding-system-used) 'raw-text)))= (set-buffer-multibyte nil)) (set-buffer-modified-p nil)) (let ((read-symbo= l-shorthands shorthands)) (if eval-function (funcall eval-function buffer (= if dump-mode file fullname)) (eval-buffer buffer nil (if dump-mode file ful= lname) nil t)))) (let (kill-buffer-hook kill-buffer-query-functions) (kill-= buffer buffer))) (do-after-load-evaluation fullname) (unless (or nomessage = noninteractive) (if source (message "Loading %s (source)...done" file) (mes= sage "Loading %s...done" file))) t) (if (null (file-readable-p fullname)) (and (null noerror) (signal 'file-e= rror (list "Cannot open load file" file))) (let ((buffer (generate-new-buff= er " *load*")) (load-in-progress t) (source (string-suffix-p ".el" fullname= ))) (unless nomessage (if source (message "Loading %s (source)..." file) (m= essage "Loading %s..." file))) (when purify-flag (push (purecopy file) prel= oaded-file-list)) (unwind-protect (let ((load-true-file-name fullname) (loa= d-file-name fullname) (set-auto-coding-for-load t) (inhibit-file-name-opera= tion nil) shorthands) (with-current-buffer buffer (set-buffer-multibyte t) = (let (deactivate-mark) (insert-file-contents fullname)) (setq shorthands (a= nd hack-read-symbol-shorthands-function (funcall hack-read-symbol-shorthand= s-function))) (if (and enable-multibyte-characters (or (eq (coding-system-t= ype last-coding-system-used) 'raw-text))) (set-buffer-multibyte nil)) (set-= buffer-modified-p nil)) (let ((read-symbol-shorthands shorthands)) (if eval= -function (funcall eval-function buffer (if dump-mode file fullname)) (eval= -buffer buffer nil (if dump-mode file fullname) nil t)))) (let (kill-buffer= -hook kill-buffer-query-functions) (kill-buffer buffer))) (do-after-load-ev= aluation fullname) (unless (or nomessage noninteractive) (if source (messag= e "Loading %s (source)...done" file) (message "Loading %s...done" file))) t= )) load-with-code-conversion("/Users/gerd/emacs/savannah/igc/lisp/simple.el"= "/Users/gerd/emacs/savannah/igc/lisp/simple.el" nil nil) load("simple") load("loadup.el") Eager macro-expansion failure: (setting-constant byte-compile-form-stack) #+end_src C-h v #+begin_src sh byte-compile-form-stack is a variable defined in =E2=80=98macroexp.el=E2=80= =99. #+end_src At least suspicious that it is in macroexp which is native cpmpiled. * Abort in set_internal #+begin_src sh (lldb) p *sym (Lisp_Symbol) { u =3D { s =3D { gcmarkbit =3D false redirect =3D SYMBOL_PLAINVAL trapped_write =3D SYMBOL_NOWRITE | SYMBOL_TRAPPED_WRITE interned =3D SYMBOL_INTERNED | SYMBOL_INTERNED_IN_INITIAL_OBARRAY declared_special =3D true pinned =3D true name =3D 0x000000010f0f1614 (struct Lisp_String *) $4 =3D 0x000000010= f0f1610 val =3D { value =3D 0x0000000110623fe3 (struct Lisp_Cons *) $5 =3D 0x00000001= 10623fe0 alias =3D 0x0000000110623fe3 blv =3D 0x0000000110623fe3 fwd =3D (fwdptr =3D 0x0000000110623fe3) } function =3D NULL plist =3D 0x000000010f0f163b (struct Lisp_Cons *) $6 =3D 0x000000010f= 0f1638 next =3D 0x000000010f0f1650 } gcaligned =3D '\xf8' } } (lldb) p *$4 error: Couldn't apply expression side effects : Couldn't dematerialize a re= sult variable: couldn't read its memory (lldb) p *(struct igc_header *) client_to_base (sym) (struct igc_header) (obj_type =3D IGC_OBJ_FWD, pvec_type =3D PVEC_FREE, ha= sh =3D 1074169, nwords =3D 7) #+end_src Same procedure as last year, Miss Sophie. Symbol points to tombstone. #+begin_src sh (lldb) p *(struct igc_header *) 0x000000010f8619f8 (struct igc_header) (obj_type =3D IGC_OBJ_SYMBOL, pvec_type =3D PVEC_FREE,= hash =3D 1074169, nwords =3D 7) (lldb) p *(struct Lisp_Symbol *) base_to_client ((void *)0x000000010f8619f8) (struct Lisp_Symbol) { u =3D { s =3D { gcmarkbit =3D false redirect =3D SYMBOL_PLAINVAL trapped_write =3D SYMBOL_UNTRAPPED_WRITE interned =3D SYMBOL_INTERNED_IN_INITIAL_OBARRAY declared_special =3D true pinned =3D false name =3D 0x000000010f0f1614 (struct Lisp_String *) $9 =3D 0x000000010= f0f1610 val =3D { value =3D 0x000000010f864efb (struct Lisp_Cons *) $10 =3D 0x0000000= 10f864ef8 alias =3D 0x000000010f864efb blv =3D 0x000000010f864efb fwd =3D (fwdptr =3D 0x000000010f864efb) } function =3D NULL plist =3D 0x000000010f0f163b (struct Lisp_Cons *) $11 =3D 0x000000010= f0f1638 next =3D 0x000000010f0f1650 } gcaligned =3D '\xc0' } } (lldb) p *$9 error: Couldn't apply expression side effects : Couldn't dematerialize a re= sult variable: couldn't read its memory (lldb) p *(struct igc_header *) client_to_base ($9) error: Couldn't apply expression side effects : Couldn't dematerialize a re= sult variable: couldn't read its memory (lldb) memory read 0x000000010f0f1610 error: memory read failed for 0x10f0f1600 (lldb) xpostmortem (lldb) memory read 0x000000010f0f1610 0x10f0f1610: 17 00 00 00 00 00 00 00 17 00 00 00 00 00 00 00 .............= ... 0x10f0f1620: 00 00 00 00 00 00 00 00 08 b0 0e 0f 01 00 00 00 .............= ... (lldb) p *(struct Lisp_String *)0x000000010f0f1610 (struct Lisp_String) { u =3D { s =3D { size =3D 23 size_byte =3D 23 intervals =3D NULL data =3D 0x000000010f0eb008 "byte-compile-form-stack" } next =3D 0x0000000000000017 gcaligned =3D '\x17' } } #+end_src --=-=-=--