[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r110854: Tweak last vectorlike_header
From: |
Dmitry Antipov |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r110854: Tweak last vectorlike_header change. |
Date: |
Fri, 09 Nov 2012 15:38:31 +0400 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 110854
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Fri 2012-11-09 15:38:31 +0400
message:
Tweak last vectorlike_header change.
* alloc.c (struct Lisp_Vectorlike_Free): Special type to represent
vectorlike object on the free list. This is introduced to avoid
some (but not all) pointer casting and aliasing problems, see
http://lists.gnu.org/archive/html/emacs-devel/2012-11/msg00105.html.
* .gdbinit (pvectype, pvecsize): New commands to examine vectorlike
objects.
(xvectype, xvecsize): Use them to examine Lisp_Object values.
modified:
src/.gdbinit
src/ChangeLog
src/alloc.c
=== modified file 'src/.gdbinit'
--- a/src/.gdbinit 2012-11-08 14:10:28 +0000
+++ b/src/.gdbinit 2012-11-09 11:38:31 +0000
@@ -650,9 +650,8 @@
a second line gives the more precise type.
end
-define xvectype
- xgetptr $
- set $size = ((struct Lisp_Vector *) $ptr)->header.size
+define pvectype
+ set $size = ((struct Lisp_Vector *) $arg0)->header.size
if ($size & PSEUDOVECTOR_FLAG)
output (enum pvec_type) (($size & PVEC_TYPE_MASK) >>
PSEUDOVECTOR_AREA_BITS)
else
@@ -660,14 +659,22 @@
end
echo \n
end
+document pvectype
+Print the subtype of vectorlike object.
+Takes one argument, a pointer to an object.
+end
+
+define xvectype
+ xgetptr $
+ pvectype $ptr
+end
document xvectype
-Print the type or vector subtype of $.
-This command assumes that $ is a vector or pseudovector.
+Print the subtype of vectorlike object.
+This command assumes that $ is a Lisp_Object.
end
-define xvecsize
- xgetptr $
- set $size = ((struct Lisp_Vector *) $ptr)->header.size
+define pvecsize
+ set $size = ((struct Lisp_Vector *) $arg0)->header.size
if ($size & PSEUDOVECTOR_FLAG)
output ($size & PSEUDOVECTOR_SIZE_MASK)
echo \n
@@ -677,9 +684,18 @@
end
echo \n
end
+document pvecsize
+Print the size of vectorlike object.
+Takes one argument, a pointer to an object.
+end
+
+define xvecsize
+ xgetptr $
+ pvecsize $ptr
+end
document xvecsize
-Print the size or vector subtype of $.
-This command assumes that $ is a vector or pseudovector.
+Print the size of $
+This command assumes that $ is a Lisp_Object.
end
define xmisctype
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-11-09 06:36:51 +0000
+++ b/src/ChangeLog 2012-11-09 11:38:31 +0000
@@ -1,3 +1,14 @@
+2012-11-09 Dmitry Antipov <address@hidden>
+
+ Tweak last vectorlike_header change.
+ * alloc.c (struct Lisp_Vectorlike_Free): Special type to represent
+ vectorlike object on the free list. This is introduced to avoid
+ some (but not all) pointer casting and aliasing problems, see
+ http://lists.gnu.org/archive/html/emacs-devel/2012-11/msg00105.html.
+ * .gdbinit (pvectype, pvecsize): New commands to examine vectorlike
+ objects.
+ (xvectype, xvecsize): Use them to examine Lisp_Object values.
+
2012-11-09 Jan Djärv <address@hidden>
* nsfont.m (ns_descriptor_to_entity): Qcondesed and Qexpanded has
=== modified file 'src/alloc.c'
--- a/src/alloc.c 2012-11-08 19:12:23 +0000
+++ b/src/alloc.c 2012-11-09 11:38:31 +0000
@@ -2611,16 +2611,18 @@
#define VINDEX(nbytes) (((nbytes) - VBLOCK_BYTES_MIN) / roundup_size)
-/* When V is on the free list, first word after header is used as a pointer
- to next vector on the free list. It might be done in a better way with:
-
- (*(struct Lisp_Vector **)&(v->contents[0]))
-
- but this breaks GCC's strict-aliasing rules (which looks more relaxed
- for char and void pointers). */
-
-#define NEXT_IN_FREE_LIST(v) \
- (*(struct Lisp_Vector **)((char *) v + header_size))
+/* This special type is used to represent any block-allocated vectorlike
+ object on the free list. */
+
+struct Lisp_Vectorlike_Free
+{
+ struct vectorlike_header header;
+ struct Lisp_Vector *next;
+};
+
+/* When V is on the free list, it's always treated as Lisp_Vectorlike_Free. */
+
+#define NEXT_IN_FREE_LIST(v) ((struct Lisp_Vectorlike_Free *) v)->next
/* Common shortcut to setup vector on a free list. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r110854: Tweak last vectorlike_header change.,
Dmitry Antipov <=