[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 6af67b4 2/6: Reduce lread substitutions.
From: |
Ken Raeburn |
Subject: |
[Emacs-diffs] master 6af67b4 2/6: Reduce lread substitutions. |
Date: |
Wed, 21 Jun 2017 22:57:30 -0400 (EDT) |
branch: master
commit 6af67b4a8842fd3b949fa5bfb68811f62a521ae2
Author: Stefan Monnier <address@hidden>
Commit: Ken Raeburn <address@hidden>
Reduce lread substitutions.
* src/lread.c (read1): After reading an object using the "#n=" syntax,
if the read object is a cons cell, instead of recursively substituting
the placeholder with the new object, mutate the placeholder cons cell
itself to have the correct car and cdr values.
---
src/lread.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/lread.c b/src/lread.c
index 2636386..a6d04ec 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2990,12 +2990,21 @@ read1 (Lisp_Object readcharfun, int *pch, bool
first_in_list)
tem = read0 (readcharfun);
/* Now put it everywhere the placeholder was... */
- Fsubstitute_object_in_subtree (tem, placeholder);
+ if (CONSP (tem))
+ {
+ Fsetcar (placeholder, XCAR (tem));
+ Fsetcdr (placeholder, XCDR (tem));
+ return placeholder;
+ }
+ else
+ {
+ Fsubstitute_object_in_subtree (tem, placeholder);
- /* ...and #n# will use the real value from now on. */
- Fsetcdr (cell, tem);
+ /* ...and #n# will use the real value from now on. */
+ Fsetcdr (cell, tem);
- return tem;
+ return tem;
+ }
}
/* #n# returns a previously read object. */
- [Emacs-diffs] master updated (87a44b9 -> 85f6aa3), Ken Raeburn, 2017/06/21
- [Emacs-diffs] master 59f3c86 5/6: Create less garbage to collect while reading symbols., Ken Raeburn, 2017/06/21
- [Emacs-diffs] master 0b3a0f3 1/6: Short-circuit substitutions for some simple types., Ken Raeburn, 2017/06/21
- [Emacs-diffs] master 6af67b4 2/6: Reduce lread substitutions.,
Ken Raeburn <=
- [Emacs-diffs] master b914556 4/6: Replace read_objects assoc list with two hash tables., Ken Raeburn, 2017/06/21
- [Emacs-diffs] master efe200c 3/6: Use getc_unlocked., Ken Raeburn, 2017/06/21
- [Emacs-diffs] master 85f6aa3 6/6: Merge several Lisp reader speedups., Ken Raeburn, 2017/06/21