all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Gerd Möllmann" <gerd.moellmann@gmail.com>
To: Andrea Corallo <acorallo@gnu.org>
Cc: Eli Zaretskii <eliz@gnu.org>,
	 emacs-devel@gnu.org, Helmut Eller <eller.helmut@gmail.com>
Subject: Re: MPS: native comp
Date: Tue, 30 Apr 2024 07:30:05 +0200	[thread overview]
Message-ID: <m2r0en5sf6.fsf@pro2.fritz.box> (raw)
In-Reply-To: <m2v83z5tva.fsf@pro2.fritz.box> ("Gerd Möllmann"'s message of "Tue, 30 Apr 2024 06:58:49 +0200")

[-- Attachment #1: Type: text/plain, Size: 1209 bytes --]

Gerd Möllmann <gerd.moellmann@gmail.com> 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 = ASIZE (u->data_impure_vec);
	IGC_FIX12_NOBJS (ss, u->data_imp_relocs, n);
      }
    if (u->data_relocs)
      {
	size_t n = 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.


[-- Attachment #2: debug log --]
[-- Type: text/x-org, Size: 11070 bytes --]

: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 (source)...
Loading /Users/gerd/emacs/savannah/igc/lisp/simple.el (source)...

Error: error ("Eager macro-expansion failure: (setting-constant byte-compile-form-stack)")
  signal(error ("Eager macro-expansion failure: (setting-constant byte-compile-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 numeric ARG serves as a repeat count.\n\nIn Transient Mark mode when the mark is active, undo changes only within\nthe current region.  Similarly, when not in Transient Mark mode, just \\[universal-argument]\nas an argument limits undo to changes within the current region." (interactive "*P") (let* ((modified (buffer-modified-p)) (base-buffer (or (buffer-base-buffer) (current-buffer))) (recent-save (with-current-buffer base-buffer (recent-auto-save-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-undo-p buffer-undo-list))) (setq undo-in-region (and (or (region-active-p) (and arg (not (numberp arg)))) (not inhibit-region))) (if undo-in-region (undo-start (region-beginning) (region-end)) (undo-start)) (undo-more 1)) (setq this-command 'undo) (let ((equiv (gethash pending-undo-list undo-equiv-table))) (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 ((next (gethash equiv undo-equiv-table))) (if next (setq equiv next)))) (setq pending-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 buffer-undo-list) (prev nil)) (while (car tail) (when (integerp (car tail)) (let ((pos (car tail))) (if prev (setcdr prev (cdr tail)) (setq buffer-undo-list (cdr tail))) (setq tail (cdr tail)) (while (car tail) (if (eq pos (car tail)) (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-buffer base-buffer (delete-auto-save-file-if-necessary recent-save))) (if message (message "%s" message))))) t)
  eval-buffer(#<buffer  *load*> nil "/Users/gerd/emacs/savannah/igc/lisp/simple.el" nil t)
  (if eval-function (funcall eval-function buffer (if dump-mode file fullname)) (eval-buffer buffer nil (if dump-mode file fullname) nil t))
  (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 ((load-true-file-name fullname) (load-file-name fullname) (set-auto-coding-for-load t) (inhibit-file-name-operation nil) shorthands) (with-current-buffer buffer (set-buffer-multibyte t) (let (deactivate-mark) (insert-file-contents fullname)) (setq shorthands (and hack-read-symbol-shorthands-function (funcall hack-read-symbol-shorthands-function))) (if (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 (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 fullname) (set-auto-coding-for-load t) (inhibit-file-name-operation nil) shorthands) (with-current-buffer buffer (set-buffer-multibyte t) (let (deactivate-mark) (insert-file-contents fullname)) (setq shorthands (and hack-read-symbol-shorthands-function (funcall hack-read-symbol-shorthands-function))) (if (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 (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)))
  (let ((buffer (generate-new-buffer " *load*")) (load-in-progress t) (source (string-suffix-p ".el" fullname))) (unless nomessage (if source (message "Loading %s (source)..." file) (message "Loading %s..." file))) (when purify-flag (push (purecopy file) preloaded-file-list)) (unwind-protect (let ((load-true-file-name fullname) (load-file-name fullname) (set-auto-coding-for-load t) (inhibit-file-name-operation nil) shorthands) (with-current-buffer buffer (set-buffer-multibyte t) (let (deactivate-mark) (insert-file-contents fullname)) (setq shorthands (and hack-read-symbol-shorthands-function (funcall hack-read-symbol-shorthands-function))) (if (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 (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-evaluation fullname) (unless (or nomessage noninteractive) (if source (message "Loading %s (source)...done" file) (message "Loading %s...done" file))) t)
  (if (null (file-readable-p fullname)) (and (null noerror) (signal 'file-error (list "Cannot open load file" file))) (let ((buffer (generate-new-buffer " *load*")) (load-in-progress t) (source (string-suffix-p ".el" fullname))) (unless nomessage (if source (message "Loading %s (source)..." file) (message "Loading %s..." file))) (when purify-flag (push (purecopy file) preloaded-file-list)) (unwind-protect (let ((load-true-file-name fullname) (load-file-name fullname) (set-auto-coding-for-load t) (inhibit-file-name-operation nil) shorthands) (with-current-buffer buffer (set-buffer-multibyte t) (let (deactivate-mark) (insert-file-contents fullname)) (setq shorthands (and hack-read-symbol-shorthands-function (funcall hack-read-symbol-shorthands-function))) (if (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 (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-evaluation fullname) (unless (or nomessage noninteractive) (if source (message "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 ‘macroexp.el’.
#+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 = {
    s = {
      gcmarkbit = false
      redirect = SYMBOL_PLAINVAL
      trapped_write = SYMBOL_NOWRITE | SYMBOL_TRAPPED_WRITE
      interned = SYMBOL_INTERNED | SYMBOL_INTERNED_IN_INITIAL_OBARRAY
      declared_special = true
      pinned = true
      name = 0x000000010f0f1614 (struct Lisp_String *) $4 = 0x000000010f0f1610
      val = {
        value = 0x0000000110623fe3 (struct Lisp_Cons *) $5 = 0x0000000110623fe0
        alias = 0x0000000110623fe3
        blv = 0x0000000110623fe3
        fwd = (fwdptr = 0x0000000110623fe3)
      }
      function = NULL
      plist = 0x000000010f0f163b (struct Lisp_Cons *) $6 = 0x000000010f0f1638
      next = 0x000000010f0f1650
    }
    gcaligned = '\xf8'
  }
}
(lldb) p *$4
error: Couldn't apply expression side effects : Couldn't dematerialize a result variable: couldn't read its memory
(lldb) p *(struct igc_header *) client_to_base (sym)
(struct igc_header)  (obj_type = IGC_OBJ_FWD, pvec_type = PVEC_FREE, hash = 1074169, nwords = 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 = IGC_OBJ_SYMBOL, pvec_type = PVEC_FREE, hash = 1074169, nwords = 7)
(lldb) p *(struct Lisp_Symbol *) base_to_client ((void *)0x000000010f8619f8)
(struct Lisp_Symbol) {
  u = {
    s = {
      gcmarkbit = false
      redirect = SYMBOL_PLAINVAL
      trapped_write = SYMBOL_UNTRAPPED_WRITE
      interned = SYMBOL_INTERNED_IN_INITIAL_OBARRAY
      declared_special = true
      pinned = false
      name = 0x000000010f0f1614 (struct Lisp_String *) $9 = 0x000000010f0f1610
      val = {
        value = 0x000000010f864efb (struct Lisp_Cons *) $10 = 0x000000010f864ef8
        alias = 0x000000010f864efb
        blv = 0x000000010f864efb
        fwd = (fwdptr = 0x000000010f864efb)
      }
      function = NULL
      plist = 0x000000010f0f163b (struct Lisp_Cons *) $11 = 0x000000010f0f1638
      next = 0x000000010f0f1650
    }
    gcaligned = '\xc0'
  }
}
(lldb) p *$9
error: Couldn't apply expression side effects : Couldn't dematerialize a result 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 result 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 = {
    s = {
      size = 23
      size_byte = 23
      intervals = NULL
      data = 0x000000010f0eb008 "byte-compile-form-stack"
    }
    next = 0x0000000000000017
    gcaligned = '\x17'
  }
}
#+end_src

  reply	other threads:[~2024-04-30  5:30 UTC|newest]

Thread overview: 92+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-29  5:35 MPS: native comp Gerd Möllmann
2024-04-29  7:29 ` Andrea Corallo
2024-04-29  8:02   ` Gerd Möllmann
2024-04-29  7:52 ` Eli Zaretskii
2024-04-29  8:12   ` Gerd Möllmann
2024-04-29  8:31     ` Gerd Möllmann
2024-04-29  8:40       ` Gerd Möllmann
2024-04-29  8:59         ` Andrea Corallo
2024-04-29  9:09           ` Gerd Möllmann
2024-04-29  9:16             ` Gerd Möllmann
2024-04-29  9:24             ` Andrea Corallo
2024-04-29  9:36               ` Gerd Möllmann
2024-04-29  9:45                 ` Andrea Corallo
2024-04-29  9:53                   ` Gerd Möllmann
2024-04-29 10:08                     ` Andrea Corallo
2024-04-29 10:29                       ` Gerd Möllmann
2024-04-29 11:03                         ` Andrea Corallo
2024-04-29 11:15                           ` Gerd Möllmann
2024-04-30  4:39                             ` Gerd Möllmann
2024-04-30  4:58                               ` Gerd Möllmann
2024-04-30  5:30                                 ` Gerd Möllmann [this message]
2024-04-30  7:40                                   ` Andrea Corallo
2024-04-30  8:08                                     ` Gerd Möllmann
2024-04-30  8:34                                       ` Gerd Möllmann
2024-04-30  8:57                                         ` Andrea Corallo
2024-04-30  8:54                                       ` Andrea Corallo
2024-04-30  9:05                                         ` Andrea Corallo
2024-04-30  9:18                                         ` Gerd Möllmann
2024-04-30  9:40                                           ` Andrea Corallo
2024-04-30 10:27                                             ` Gerd Möllmann
2024-04-30 10:52                                               ` Andrea Corallo
2024-04-30 11:54                                                 ` Gerd Möllmann
2024-04-30 12:44                                                   ` Eli Zaretskii
2024-04-30 13:05                                                     ` Andrea Corallo
2024-04-30 13:11                                                       ` Gerd Möllmann
2024-04-30 13:26                                                         ` MPS compilation (was Re: MPS: native comp) Andrea Corallo
2024-04-30 13:35                                                           ` Gerd Möllmann
2024-04-30 14:18                                                             ` Andrea Corallo
2024-04-30 13:26                                                       ` MPS: native comp Eli Zaretskii
2024-04-30 13:45                                                         ` Visuwesh
2024-04-30 14:31                                                         ` Helmut Eller
2024-04-30 12:59                                                   ` Andrea Corallo
2024-04-30 13:06                                                     ` Gerd Möllmann
2024-04-30 14:29                                                 ` Peter Hull
2024-04-30 14:51                                                   ` Gerd Möllmann
2024-04-30 14:02                                             ` Gerd Möllmann
2024-04-30 17:35                                               ` Gerd Möllmann
2024-05-01  5:05                                                 ` Gerd Möllmann
2024-05-02  6:39                                                   ` Gerd Möllmann
2024-05-02  8:56                                                     ` Gerd Möllmann
2024-05-02 14:08                                                       ` Gerd Möllmann
2024-05-02 15:04                                                         ` Eli Zaretskii
2024-05-02 15:56                                                           ` Gerd Möllmann
2024-05-02 16:46                                                             ` Eli Zaretskii
2024-05-02 15:14                                                       ` Helmut Eller
2024-05-02 15:58                                                         ` Gerd Möllmann
2024-05-02 16:37                                                           ` Helmut Eller
2024-05-02 19:49                                                             ` Gerd Möllmann
2024-05-03  5:56                                                               ` Helmut Eller
2024-05-03  6:29                                                                 ` Gerd Möllmann
2024-05-03 13:38                                                                 ` Andrea Corallo
2024-05-03 13:52                                                                   ` Helmut Eller
2024-05-03 16:12                                                                     ` Andrea Corallo
2024-05-02 10:29                                                     ` Andrea Corallo
2024-05-02 10:51                                                       ` Gerd Möllmann
2024-05-02 10:24                                                 ` Andrea Corallo
2024-05-02 10:49                                                   ` Gerd Möllmann
2024-05-02 21:04                                                     ` Andrea Corallo
2024-05-03  5:35                                                       ` Gerd Möllmann
2024-05-03 13:35                                                         ` Andrea Corallo
2024-05-03 14:19                                                           ` Gerd Möllmann
2024-05-07  8:40                                                             ` Gerd Möllmann
2024-05-07 10:00                                                               ` Andrea Corallo
2024-05-07 12:29                                                                 ` Gerd Möllmann
2024-05-08  8:47                                                                   ` Gerd Möllmann
2024-05-08  9:12                                                                     ` Gerd Möllmann
2024-05-08 15:39                                                                       ` Andrea Corallo
2024-05-08 16:11                                                                         ` Gerd Möllmann
2024-05-09  6:15                                                                           ` Gerd Möllmann
2024-05-09  9:12                                                                             ` Gerd Möllmann
2024-05-10  6:37                                                                           ` Andrea Corallo
2024-05-10  6:41                                                                             ` Gerd Möllmann
2024-04-30  7:36                               ` Andrea Corallo
2024-04-30  7:56                                 ` Gerd Möllmann
  -- strict thread matches above, loose matches on Subject: below --
2024-06-27 14:25 Gerd Möllmann
2024-06-27 14:34 ` Andrea Corallo
2024-06-27 14:36   ` Gerd Möllmann
2024-06-27 15:05     ` Andrea Corallo
2024-06-27 16:39       ` Gerd Möllmann
2024-06-27 16:53         ` Gerd Möllmann
2024-06-27 19:01         ` Andrea Corallo
2024-06-27 19:18           ` Gerd Möllmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2r0en5sf6.fsf@pro2.fritz.box \
    --to=gerd.moellmann@gmail.com \
    --cc=acorallo@gnu.org \
    --cc=eliz@gnu.org \
    --cc=eller.helmut@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.