[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] trunk r117464: Shrink Lisp_Sub_Char_Table by preferrin
From: |
Stefan Monnier |
Subject: |
Re: [Emacs-diffs] trunk r117464: Shrink Lisp_Sub_Char_Table by preferring C integers to Lisp_Objects. |
Date: |
Thu, 03 Jul 2014 12:49:44 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
>> But I don't see why that necessarily implies casting
>> Lisp_Sub_Char_Table to a Lisp_Vector (I ask this question without
>> having spent much time looking for the answer in the source, maybe the
>> answer is obvious, but I think if you can tell me why it's a better use
>> of my time than trying to figure it out myself).
> Hm... look at mark_char_table in alloc.c - this function implies that
> both Lisp_Char_Table and Lisp_Sub_Char_Table pointers can be treated
> as a pointer to their base type Lisp_Vector. Having both mark_char_table
> and mark_sub_char_table looks a bit overengineered for me. This also
> applies to Lisp_Char_Table/Lisp_Sub_Char_Table printing code in
> print_object, etc.
Could you try to use something like the patch below to eliminate this
alignment assumption?
Stefan
=== 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;
eassert (!VECTOR_MARKED_P (ptr));
VECTOR_MARK (ptr);
- for (i = idx; i < size; i++)
+ for (i = 0; i < size; i++)
{
- Lisp_Object val = ptr->contents[i];
+ Lisp_Object val = contents[i];
if (INTEGERP (val) || (SYMBOLP (val) && XSYMBOL (val)->gcmarkbit))
continue;
- Re: [Emacs-diffs] trunk r117464: Shrink Lisp_Sub_Char_Table by preferring C integers to Lisp_Objects., (continued)
- Re: [Emacs-diffs] trunk r117464: Shrink Lisp_Sub_Char_Table by preferring C integers to Lisp_Objects., Stefan Monnier, 2014/07/02
- Re: [Emacs-diffs] trunk r117464: Shrink Lisp_Sub_Char_Table by preferring C integers to Lisp_Objects., Dmitry Antipov, 2014/07/02
- Re: [Emacs-diffs] trunk r117464: Shrink Lisp_Sub_Char_Table by preferring C integers to Lisp_Objects., Stefan Monnier, 2014/07/02
- Re: [Emacs-diffs] trunk r117464: Shrink Lisp_Sub_Char_Table by preferring C integers to Lisp_Objects., Dmitry Antipov, 2014/07/03
- Re: [Emacs-diffs] trunk r117464: Shrink Lisp_Sub_Char_Table by preferring C integers to Lisp_Objects., Stephen J. Turnbull, 2014/07/03
- Re: [Emacs-diffs] trunk r117464: Shrink Lisp_Sub_Char_Table by preferring C integers to Lisp_Objects., Eli Zaretskii, 2014/07/03
- Re: [Emacs-diffs] trunk r117464: Shrink Lisp_Sub_Char_Table by preferring C integers to Lisp_Objects., Dmitry Antipov, 2014/07/03
- Re: Nano-improvements C integers to Lisp_Objects., Eli Zaretskii, 2014/07/03
- Re: [Emacs-diffs] trunk r117464: Shrink Lisp_Sub_Char_Table by preferring C integers to Lisp_Objects., Stefan Monnier, 2014/07/03
- Re: [Emacs-diffs] trunk r117464: Shrink Lisp_Sub_Char_Table by preferring C integers to Lisp_Objects., Dmitry Antipov, 2014/07/03
- Re: [Emacs-diffs] trunk r117464: Shrink Lisp_Sub_Char_Table by preferring C integers to Lisp_Objects.,
Stefan Monnier <=
- Re: [Emacs-diffs] trunk r117464: Shrink Lisp_Sub_Char_Table by preferring C integers to Lisp_Objects., Dmitry Antipov, 2014/07/03
- Re: [Emacs-diffs] trunk r117464: Shrink Lisp_Sub_Char_Table by preferring C integers to Lisp_Objects., Stefan Monnier, 2014/07/03
- Re: Nano-improvements (was: [Emacs-diffs] trunk r117464: Shrink Lisp_Sub_Char_Table by preferring C integers to Lisp_Objects.), Eli Zaretskii, 2014/07/03
- Re: Nano-improvements, Dmitry Antipov, 2014/07/03
- Re: Nano-improvements, Eli Zaretskii, 2014/07/03