diff options
| author | Dmitry Antipov | 2014-07-02 07:26:19 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2014-07-02 07:26:19 +0400 |
| commit | 477daa5b533af8f62c9b6893e2d522b93d9c2853 (patch) | |
| tree | 1dc2bb83f76ecfecbce218a9af3a2bf845f5e3b6 /src/lisp.h | |
| parent | 1dc6f7e738e3ffe130626814f721c83c448fe9a8 (diff) | |
| download | emacs-477daa5b533af8f62c9b6893e2d522b93d9c2853.tar.gz emacs-477daa5b533af8f62c9b6893e2d522b93d9c2853.zip | |
Shrink Lisp_Sub_Char_Table by preferring C integers to Lisp_Objects.
* lisp.h (struct Lisp_Sub_Char_Table): Use C integers for depth and
min_char slots. Adjust comment.
(enum char_table_specials): Rename from CHAR_TABLE_STANDARD_SLOTS.
Add SUB_CHAR_TABLE_OFFSET member.
(make_uninit_sub_char_table): New function.
* alloc.c (mark_char_table): Add extra argument to denote char table
subtype. Adjust to match new layout of sub char-table.
(mark_object): Always mark sub char-tables with mark_char_table.
* chartab.c (make_sub_char_table, copy_sub_char_table)
(sub_char_table_ref, sub_char_table_ref_and_range, sub_char_table_set)
(sub_char_table_set_range, optimize_sub_char_table, map_sub_char_table)
(map_sub_char_table_for_charset, uniprop_table_uncompress):
All related users changed.
* lread.c (read1): Adjust to match new layout of sub char-table.
Diffstat (limited to 'src/lisp.h')
| -rw-r--r-- | src/lisp.h | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/src/lisp.h b/src/lisp.h index fb832b80940..3c4845ec79b 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -1407,10 +1407,11 @@ gc_aset (Lisp_Object array, ptrdiff_t idx, Lisp_Object val) | |||
| 1407 | sense to handle a char-table with type struct Lisp_Vector. An | 1407 | sense to handle a char-table with type struct Lisp_Vector. An |
| 1408 | element of a char table can be any Lisp objects, but if it is a sub | 1408 | element of a char table can be any Lisp objects, but if it is a sub |
| 1409 | char-table, we treat it a table that contains information of a | 1409 | char-table, we treat it a table that contains information of a |
| 1410 | specific range of characters. A sub char-table has the same | 1410 | specific range of characters. A sub char-table is like a vector but |
| 1411 | structure as a vector. A sub char table appears only in an element | 1411 | with two integer fields between the header and Lisp data, which means |
| 1412 | of a char-table, and there's no way to access it directly from | 1412 | that it has to be marked with some precautions (see mark_char_table |
| 1413 | Emacs Lisp program. */ | 1413 | in alloc.c). A sub char-table appears only in an element of a char-table, |
| 1414 | and there's no way to access it directly from Emacs Lisp program. */ | ||
| 1414 | 1415 | ||
| 1415 | enum CHARTAB_SIZE_BITS | 1416 | enum CHARTAB_SIZE_BITS |
| 1416 | { | 1417 | { |
| @@ -1465,10 +1466,10 @@ struct Lisp_Sub_Char_Table | |||
| 1465 | contains 32 elements, and each element covers 128 characters. A | 1466 | contains 32 elements, and each element covers 128 characters. A |
| 1466 | sub char-table of depth 3 contains 128 elements, and each element | 1467 | sub char-table of depth 3 contains 128 elements, and each element |
| 1467 | is for one character. */ | 1468 | is for one character. */ |
| 1468 | Lisp_Object depth; | 1469 | int depth; |
| 1469 | 1470 | ||
| 1470 | /* Minimum character covered by the sub char-table. */ | 1471 | /* Minimum character covered by the sub char-table. */ |
| 1471 | Lisp_Object min_char; | 1472 | int min_char; |
| 1472 | 1473 | ||
| 1473 | /* Use set_sub_char_table_contents to set this. */ | 1474 | /* Use set_sub_char_table_contents to set this. */ |
| 1474 | Lisp_Object contents[FLEXIBLE_ARRAY_MEMBER]; | 1475 | Lisp_Object contents[FLEXIBLE_ARRAY_MEMBER]; |
| @@ -1539,12 +1540,16 @@ struct Lisp_Subr | |||
| 1539 | const char *doc; | 1540 | const char *doc; |
| 1540 | }; | 1541 | }; |
| 1541 | 1542 | ||
| 1542 | /* This is the number of slots that every char table must have. This | 1543 | enum char_table_specials |
| 1543 | counts the ordinary slots and the top, defalt, parent, and purpose | ||
| 1544 | slots. */ | ||
| 1545 | enum CHAR_TABLE_STANDARD_SLOTS | ||
| 1546 | { | 1544 | { |
| 1547 | CHAR_TABLE_STANDARD_SLOTS = PSEUDOVECSIZE (struct Lisp_Char_Table, extras) | 1545 | /* This is the number of slots that every char table must have. This |
| 1546 | counts the ordinary slots and the top, defalt, parent, and purpose | ||
| 1547 | slots. */ | ||
| 1548 | CHAR_TABLE_STANDARD_SLOTS = PSEUDOVECSIZE (struct Lisp_Char_Table, extras), | ||
| 1549 | |||
| 1550 | /* This is an index of first Lisp_Object field in Lisp_Sub_Char_Table | ||
| 1551 | when the latter is treated as an ordinary Lisp_Vector. */ | ||
| 1552 | SUB_CHAR_TABLE_OFFSET = PSEUDOVECSIZE (struct Lisp_Sub_Char_Table, contents) | ||
| 1548 | }; | 1553 | }; |
| 1549 | 1554 | ||
| 1550 | /* Return the number of "extra" slots in the char table CT. */ | 1555 | /* Return the number of "extra" slots in the char table CT. */ |
| @@ -3723,6 +3728,20 @@ make_uninit_vector (ptrdiff_t size) | |||
| 3723 | return v; | 3728 | return v; |
| 3724 | } | 3729 | } |
| 3725 | 3730 | ||
| 3731 | /* Like above, but special for sub char-tables. */ | ||
| 3732 | |||
| 3733 | INLINE Lisp_Object | ||
| 3734 | make_uninit_sub_char_table (int depth, int min_char) | ||
| 3735 | { | ||
| 3736 | int slots = SUB_CHAR_TABLE_OFFSET + chartab_size[depth]; | ||
| 3737 | Lisp_Object v = make_uninit_vector (slots); | ||
| 3738 | |||
| 3739 | XSETPVECTYPE (XVECTOR (v), PVEC_SUB_CHAR_TABLE); | ||
| 3740 | XSUB_CHAR_TABLE (v)->depth = depth; | ||
| 3741 | XSUB_CHAR_TABLE (v)->min_char = min_char; | ||
| 3742 | return v; | ||
| 3743 | } | ||
| 3744 | |||
| 3726 | extern struct Lisp_Vector *allocate_pseudovector (int, int, enum pvec_type); | 3745 | extern struct Lisp_Vector *allocate_pseudovector (int, int, enum pvec_type); |
| 3727 | #define ALLOCATE_PSEUDOVECTOR(typ,field,tag) \ | 3746 | #define ALLOCATE_PSEUDOVECTOR(typ,field,tag) \ |
| 3728 | ((typ*) \ | 3747 | ((typ*) \ |