|
From: | Dmitry Antipov |
Subject: | Re: [Emacs-diffs] trunk r117464: Shrink Lisp_Sub_Char_Table by preferring C integers to Lisp_Objects. |
Date: | Thu, 03 Jul 2014 21:01:59 +0400 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
On 07/03/2014 08:49 PM, Stefan Monnier wrote:
Could you try to use something like the patch below to eliminate this alignment assumption? === modified file 'src/alloc.c' --- src/alloc.c 2014-07-02 03:26:19 +0000 +++ src/alloc.c 2014-07-03 16:47:25 +0000 @@ -5962,13 +5962,18 @@ { int size = ptr->header.size & PSEUDOVECTOR_SIZE_MASK; /* Consult the Lisp_Sub_Char_Table layout before changing this. */ - int i, idx = (pvectype == PVEC_SUB_CHAR_TABLE ? SUB_CHAR_TABLE_OFFSET : 0); + int i; + Lisp_Object *contents + = pvectype == PVEC_SUB_CHAR_TABLE + ? (size -= SUB_CHAR_TABLE_OFFSET, + ((struct Lisp_Sub_Char_Table *)ptr)->contents) + : ((struct Lisp_Char_Table *)ptr)->contents;
This is obviously wrong because Lisp_Object slots of Lisp_Char_Table between 'header' and 'contents' are never marked. This code should looks like: Lisp_Object *contents = pvectype == PVEC_SUB_CHAR_TABLE ? (size -= SUB_CHAR_TABLE_OFFSET, ((struct Lisp_Sub_Char_Table *)ptr)->contents) : ptr->contents; And, IIUC, 'size -= SUB_CHAR_TABLE_OFFSET' still assumes that SUB_CHAR_TABLE_OFFSET is a multiple of sizeof (Lisp_Object) (otherwise subtracting it from size, which is a number of Lisp_Object slots, makes no sense). Dmitry
[Prev in Thread] | Current Thread | [Next in Thread] |