unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* How does nativecomp compile circular lists?
@ 2021-07-27  7:21 Jimmy Yuen Ho Wong
  2021-07-27  9:28 ` Andrea Corallo via Emacs development discussions.
  2021-07-28  1:15 ` Michael Heerdegen
  0 siblings, 2 replies; 12+ messages in thread
From: Jimmy Yuen Ho Wong @ 2021-07-27  7:21 UTC (permalink / raw)
  To: Emacs-Devel devel

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

I'm not exactly sure how to even ask this question, as I've seen various
packages fail to natively compile circular lists
<https://github.com/milkypostman/powerline/pull/189> or optimize it wrongly
<https://github.com/jrblevin/markdown-mode/pull/624>. So I've come up with
a simple test case for me to be able to disassemble the bytecode and the
native code, and see if I could spot the problem, but disassembling
natively compiled code doesn't seem to work.

Test case:

(defun test-circular-list ()
  (let ((l (list 1 2 3)))
    (setcdr (last l) l)
    l))

(print (test-circular-list))

(provide 'test-circular-list)

M-x emacs-lisp-byte-compile-and-load
M-x disassemble RET test-circular-list (works)

M-x emacs-lisp-native-compile-and-load
M-x disassemble RET test-circular-list (doesn't work)

Debugger entered--Lisp error: (search-failed
"^.*<F746573742d63697263756c61722d6c697374_test_cir...")
  re-search-forward("^.*<F746573742d63697263756c61722d6c697374_test_cir...")
  disassemble-internal(test-circular-list 0 nil)
  disassemble(test-circular-list nil 0 t)
  funcall-interactively(disassemble test-circular-list nil 0 t)
  command-execute(disassemble record)
  execute-extended-command(nil "disassemble" nil)
  funcall-interactively(execute-extended-command nil "disassemble" nil)
  command-execute(execute-extended-command)

Furthermore, this test case, though superficially similar, doesn't seem to
be able to reproduce the same failure to natively compile issue as seen in
powerline.

There seems to be more than one thing wrong with this journey into my deep
dive into how native compiling circular lists work.

Jimmy Yuen Ho Wong

[-- Attachment #2: Type: text/html, Size: 1931 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-08-03  8:28 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-27  7:21 How does nativecomp compile circular lists? Jimmy Yuen Ho Wong
2021-07-27  9:28 ` Andrea Corallo via Emacs development discussions.
2021-07-28  2:09   ` Jimmy Yuen Ho Wong
     [not found]     ` <6247f78b-282f-27e7-e0cf-6bc3b1cdee26@gmail.com>
2021-07-28  7:20       ` Andrea Corallo via Emacs development discussions.
2021-07-28 13:49         ` Jimmy Yuen Ho Wong
2021-07-28 15:11           ` Andrea Corallo via Emacs development discussions.
2021-07-29 10:43             ` Jimmy Yuen Ho Wong
2021-07-30  8:20               ` Andrea Corallo via Emacs development discussions.
2021-08-03  7:23                 ` Jimmy Yuen Ho Wong
2021-08-03  8:28                   ` Andrea Corallo via Emacs development discussions.
2021-07-28  1:15 ` Michael Heerdegen
2021-07-28  2:18   ` Jimmy Yuen Ho Wong

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).