source: branches/working-0711/ccl/xdump/hashenv.lisp @ 7959

Last change on this file since 7959 was 7959, checked in by gb, 13 years ago

new hash-table iteration scheme.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 KB
Line 
1;;;-*- Mode: Lisp; Package: CCL -*-
2;;;
3;;;   Copyright (C) 1994-2001 Digitool, Inc
4;;;   This file is part of OpenMCL. 
5;;;
6;;;   OpenMCL is licensed under the terms of the Lisp Lesser GNU Public
7;;;   License , known as the LLGPL and distributed with OpenMCL as the
8;;;   file "LICENSE".  The LLGPL consists of a preamble and the LGPL,
9;;;   which is distributed with OpenMCL as the file "LGPL".  Where these
10;;;   conflict, the preamble takes precedence. 
11;;;
12;;;   OpenMCL is referenced in the preamble as the "LIBRARY."
13;;;
14;;;   The LLGPL is also available online at
15;;;   http://opensource.franz.com/preamble.html
16
17(in-package "CCL")
18
19(eval-when (:compile-toplevel :execute)
20
21;;; It's wired in to the code that the length of this vector is 8 and
22;;; that its largest element is < 30
23(defconstant secondary-keys #(3 5 7 11 13 17 19 23))
24(defconstant secondary-keys-*-2 #(6 10 14 22 26 34 38 46))
25
26
27;;; undistinguished values of nhash.lock
28(defconstant $nhash.lock-while-growing #x10000)
29(defconstant $nhash.lock-while-rehashing #x20000)
30(defconstant $nhash.lock-grow-or-rehash #x30000)
31(defconstant $nhash.lock-map-count-mask #xffff)
32(defconstant $nhash.lock-not-while-rehashing #x-20001)
33
34; The hash.vector cell contains a vector with 8 longwords of overhead
35; followed by alternating keys and values.
36; A key of $undefined denotes an empty or deleted value
37; The value will be $undefined for empty values, or NIL for deleted values.
38(def-accessors () %svref
39  nhash.vector.link                     ; GC link for weak vectors
40  nhash.vector.flags                    ; a fixnum of flags
41  nhash.vector.free-alist               ; empty alist entries for finalization
42  nhash.vector.finalization-alist       ; deleted out key/value pairs put here
43  nhash.vector.weak-deletions-count     ; incremented when the GC deletes an element
44  nhash.vector.hash                     ; back-pointer
45  nhash.vector.deleted-count            ; number of deleted entries
46  nhash.vector.cache-idx                ; index of last cached key/value pair
47  nhash.vector.cache-key                ; cached key
48  nhash.vector.cache-value              ; cached value
49  )
50
51; number of longwords of overhead in nhash.vector.
52; Must be a multiple of 2 or INDEX parameters in LAP code will not be tagged as fixnums.
53(defconstant $nhash.vector_overhead 10)
54
55(defconstant $nhash_weak_bit 12)        ; weak hash table
56(defconstant $nhash_weak_value_bit 11)  ; weak on value vice key if this bit set
57(defconstant $nhash_finalizeable_bit 10)
58(defconstant $nhash_weak_flags_mask
59  (bitset $nhash_weak_bit (bitset $nhash_weak_value_bit (bitset $nhash_finalizeable_bit 0))))
60
61(defconstant $nhash_track_keys_bit 28)  ; request GC to track relocation of keys.
62(defconstant $nhash_key_moved_bit 27)   ; set by GC if a key moved.
63(defconstant $nhash_ephemeral_bit 26)   ; set if a hash code was computed using an address
64                                        ; in ephemeral space
65(defconstant $nhash_component_address_bit 25) ; a hash code was computed from a key's component
66
67
68(defconstant $nhash-growing-bit 16)
69(defconstant $nhash-rehashing-bit 17)
70
71)
72
73(declare-arch-specific-macro immediate-p-macro)
74
75(declare-arch-specific-macro hashed-by-identity)
76         
77         
78;; state is #(hash-table index key-vector count) 
79(def-accessors %svref
80  nhti.hash-table
81  nhti.index
82  nhti.keys
83  nhti.values
84  nhti.nkeys)
85
86(defconstant +nil-hash+ (mixup-hash-code (%pname-hash "NIL" 3)))
87
88
89
90
91
92
93
Note: See TracBrowser for help on using the repository browser.