]> git.eshelyaron.com Git - emacs.git/commitdiff
; * src/lisp.h (struct Lisp_Hash_Table): Add ASCII art.
authorMattias Engdegård <mattiase@acm.org>
Sun, 7 Jan 2024 17:52:48 +0000 (18:52 +0100)
committerMattias Engdegård <mattiase@acm.org>
Fri, 12 Jan 2024 17:03:05 +0000 (18:03 +0100)
src/lisp.h

index 0421cb68c10f8eb77e853501e213c4a282f9fc67..e80a6388657ad59e323c2565c053af44f26aebea 100644 (file)
@@ -2405,11 +2405,33 @@ struct hash_table_test
 
 struct Lisp_Hash_Table
 {
-  /* Change pdumper.c if you change the fields here.  */
-
-  /* This is for Lisp; the hash table code does not refer to it.  */
   union vectorlike_header header;
 
+  /* Hash table internal structure:
+
+     Lisp key         index                  table
+         |            vector
+         | hash fn                  hash    key   value  next
+         v             +--+       +------+-------+------+----+
+     hash value        |-1|       | C351 |  cow  | moo  | -1 |<-
+         |             +--+       +------+-------+------+----+  |
+          ------------>| -------->| 07A8 |  cat  | meow | -1 |  |
+            range      +--+       +------+-------+------+----+  |
+          reduction    |-1|     ->| 91D2 |  dog  | woof |   ----
+                       +--+    |  +------+-------+------+----+
+                       | ------   |  ?   |unbound|  ?   | -1 |<-
+                       +--+       +------+-------+------+----+  |
+                       | -------->| F6B0 | duck  |quack | -1 |  |
+                       +--+       +------+-------+------+----+  |
+                       |-1|     ->|  ?   |unbound|  ?   |   ----
+                       +--+    |  +------+-------+------+----+
+                       :  :    |  :      :       :     :    :
+                               |
+                           next_free
+
+     The table is physically split into three vectors (hash, next,
+     key_and_value) which may or may not be beneficial.  */
+
   /* Nil if table is non-weak.  Otherwise a symbol describing the
      weakness of the table.  */
   Lisp_Object weak;