diff options
| author | Mattias EngdegÄrd | 2023-09-10 13:13:17 +0200 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2023-09-10 13:59:45 +0200 |
| commit | 2f8204f5c392b65ec2aeef9057ba79808d08cc21 (patch) | |
| tree | 1019b632faf7baf4878a30b4e0ae1bb87848b370 /src | |
| parent | af1e860570191014d94484d6944348b1766ba59f (diff) | |
| download | emacs-2f8204f5c392b65ec2aeef9057ba79808d08cc21.tar.gz emacs-2f8204f5c392b65ec2aeef9057ba79808d08cc21.zip | |
; Spruce up union vectorlike_header description
* src/lisp.h (union vectorlike_header): Rewrite the description of the
header word layout, with some useful added precision and the customary
ASCII art for bit fields.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lisp.h | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/src/lisp.h b/src/lisp.h index 2f26e5eddce..153fb5c0dbc 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -994,25 +994,35 @@ typedef EMACS_UINT Lisp_Word_tag; | |||
| 994 | number of members has been reduced to one. */ | 994 | number of members has been reduced to one. */ |
| 995 | union vectorlike_header | 995 | union vectorlike_header |
| 996 | { | 996 | { |
| 997 | /* The main member contains various pieces of information: | 997 | /* The `size' header word, W bits wide, has one of two forms |
| 998 | - The MSB (ARRAY_MARK_FLAG) holds the gcmarkbit. | 998 | discriminated by the second-highest bit (PSEUDOVECTOR_FLAG): |
| 999 | - The next bit (PSEUDOVECTOR_FLAG) indicates whether this is a plain | 999 | |
| 1000 | vector (0) or a pseudovector (1). | 1000 | 1 1 W-2 |
| 1001 | - If PSEUDOVECTOR_FLAG is 0, the rest holds the size (number | 1001 | +---+---+-------------------------------------+ |
| 1002 | of slots) of the vector. | 1002 | | M | 0 | SIZE | vector |
| 1003 | - If PSEUDOVECTOR_FLAG is 1, the rest is subdivided into three fields: | 1003 | +---+---+-------------------------------------+ |
| 1004 | - a) pseudovector subtype held in PVEC_TYPE_MASK field; | 1004 | |
| 1005 | - b) number of Lisp_Objects slots at the beginning of the object | 1005 | 1 1 W-32 6 12 12 |
| 1006 | held in PSEUDOVECTOR_SIZE_MASK field. These objects are always | 1006 | +---+---+--------+------+----------+----------+ |
| 1007 | traced by the GC; | 1007 | | M | 1 | unused | TYPE | RESTSIZE | LISPSIZE | pseudovector |
| 1008 | - c) size of the rest fields held in PSEUDOVECTOR_REST_MASK and | 1008 | +---+---+--------+------+----------+----------+ |
| 1009 | measured in word_size units. Rest fields may also include | 1009 | |
| 1010 | Lisp_Objects, but these objects usually needs some special treatment | 1010 | M (ARRAY_MARK_FLAG) holds the GC mark bit. |
| 1011 | during GC. | 1011 | |
| 1012 | There are some exceptions. For PVEC_FREE, b) is always zero. For | 1012 | SIZE is the length (number of slots) of a regular Lisp vector, |
| 1013 | PVEC_BOOL_VECTOR and PVEC_SUBR, both b) and c) are always zero. | 1013 | and the object layout is struct Lisp_Vector. |
| 1014 | Current layout limits the pseudovectors to 63 PVEC_xxx subtypes, | 1014 | |
| 1015 | 4095 Lisp_Objects in GC-ed area and 4095 word-sized other slots. */ | 1015 | TYPE is the pseudovector subtype (enum pvec_type). |
| 1016 | |||
| 1017 | LISPSIZE is the number of Lisp_Object fields at the beginning of the | ||
| 1018 | object (after the header). These are always traced by the GC. | ||
| 1019 | |||
| 1020 | RESTSIZE is the number of fields (in word_size units) following. | ||
| 1021 | These are not automatically traced by the GC. | ||
| 1022 | For PVEC_BOOL and statically allocated PVEC_SUBR, RESTSIZE is 0. | ||
| 1023 | (The block size for PVEC_BOOL is computed from its own size | ||
| 1024 | field, to avoid being restricted by the 12-bit RESTSIZE field.) | ||
| 1025 | */ | ||
| 1016 | ptrdiff_t size; | 1026 | ptrdiff_t size; |
| 1017 | }; | 1027 | }; |
| 1018 | 1028 | ||