From: Alan Mackenzie <acm@muc.de>
To: emacs-devel@gnu.org
Subject: Help with the disassembly of a very short function, please.
Date: Sat, 1 Jan 2022 19:01:03 +0000 [thread overview]
Message-ID: <YdCk7+5cdzICXIp/@ACM> (raw)
Hello, Emacs.
The following function comes from .../test/src/comp-tests.el, more or
less:
;; -*- lexical-binding: t -*-
(defun comp-test-55 (x)
(unless (integerp x)
x))
I byte compile it with C-x C-e then dump out its byte code with M-x
disassemble. I get this:
byte code for comp-test-55:
doc: ...
args: (arg1)
0 dup
1 integerp
2 not
3 goto-if-nil-else-pop 1
6 dup
7:1 return
.. In the case where x is not an integer, it seems that the dup at 6
will leave two many copies of x on the stack for the return.
In the case where x is an integer, it seems that the
goto-if-nil-else-pop will leave a nil on the stack over the original
x, returning the nil but leaving a superfluous copy of the integer x
on the stack.
So, either way, there is an unwanted copy of x left on the stack at the
end of the function.
I can't work this out. What am I missing?
--
Alan Mackenzie (Nuremberg, Germany).
next reply other threads:[~2022-01-01 19:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-01 19:01 Alan Mackenzie [this message]
2022-01-01 19:43 ` Help with the disassembly of a very short function, please Andreas Schwab
2022-01-01 22:07 ` Alan Mackenzie
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=YdCk7+5cdzICXIp/@ACM \
--to=acm@muc.de \
--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.