Changeset 8605


Ignore:
Timestamp:
Feb 26, 2008, 6:02:58 PM (12 years ago)
Author:
gb
Message:

Don't allow thread-private hash tables to be made readonly (They already
avoid locking overhead.)

In GETHASH, it's safe to update the cache slots if the hash-table's
thread-private.

In PUTHASH, check for and complain about attempts to use (CCL:%UNBOUND-MARKER)
as a key. (Not sure if anything's still doing that, but doing so can have
very bad effects.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/working-0711/ccl/level-0/l0-hash.lisp

    r7943 r8605  
    725725               (cond ((setq foundp (and (not (eq vector-key free-hash-key-marker))
    726726                                        (not (eq vector-key deleted-hash-key-marker))))
    727                       #+no
    728                       (setf (nhash.vector.cache-key vector) vector-key
    729                             (nhash.vector.cache-value vector) value
    730                             (nhash.vector.cache-idx vector) (vector-index->index
    731                                                              vector-index))
     727                      (when (nhash.owner hash)
     728                        (setf (nhash.vector.cache-key vector) vector-key
     729                              (nhash.vector.cache-value vector) value
     730                              (nhash.vector.cache-idx vector) (vector-index->index
     731                                                               vector-index)))
    732732                      (return))
    733733                     ((%needs-rehashing-p hash)
     
    810810  (unless (hash-table-p hash)
    811811    (report-bad-arg hash 'hash-table))
     812  (if (eq key (%unbound-marker))
     813    (error "Can't use ~s as a hash-table key" (%unbound-marker)))
    812814  (with-lock-context
    813815    (without-interrupts
     
    16891691    (report-bad-arg hash 'hash-table))
    16901692  (or (nhash.read-only hash)
     1693      (when (nhash.owner hash)
     1694        (error "Hash~table ~s is thread-private and can't be made read-only for that reason" hash))
    16911695      (with-lock-context
    16921696        (without-interrupts
Note: See TracChangeset for help on using the changeset viewer.