[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Help with the disassembly of a very short function, please.
From: |
Alan Mackenzie |
Subject: |
Help with the disassembly of a very short function, please. |
Date: |
Sat, 1 Jan 2022 19:01:03 +0000 |
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).
- Help with the disassembly of a very short function, please.,
Alan Mackenzie <=