Ignore:
Timestamp:
Sep 14, 2008, 6:48:21 PM (12 years ago)
Author:
gz
Message:

Implemented "nearly-lock-free" hash tables. They are created by
calling MAKE-HASH-TABLE with :LOCK-FREE t, or by setting
CCL::*LOCK-FREE-HASH-TABLE-DEFAULT* to T. There is some documentation
in a big comment in l0-hash.lisp, but basically the idea is to try to
avoid any locking in GETHASH, getting the performance equivalent to
readonly tables, at the cost of rehashing becoming more
expensive. PUTHASH should be roughly equivalent (it avoids getting a
lock, but does sync memory a few times).

So far, I've only tested them on linuxx8664, by building ccl multiple
times with *lock-free-hash-table-default* = T on, so no real
multi-threaded testing. I will now switch to the mac and try to
build and use the IDE that way.

Other changes: moved some slots from the hash table to the hash table
vector so they can all be swapped in/out all at once. Made nhash.find
return -1 when not found, also to avoid some synchronization issues.
%needs-rehashing-p now takes a hash table vector, not the hash table.
Got rid of a bunch of unused slots and constants in hash tables.

Incremented fasl version in case there are any fasdumped hash tables out there.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/x86-spentry32.s

    r10583 r10731  
    18071807        __(lock)
    18081808        __(btsl %imm0,(%temp1))
     1809        .globl C(egc_store_node_conditional_success_end)
     1810C(egc_store_node_conditional_success_end):
     18112:      __(movl $t_value,%arg_z)
     1812        __(ret)
     18133:      __(movl $nil_value,%arg_z)
     1814        __(ret)
     1815_endsubp(store_node_conditional)
     1816
     1817        /* %temp0 = offset, %temp1 = object, %arg_y = old, %arg_z = new */
     1818_spentry(set_hash_key_conditional)
     1819        .globl C(egc_set_hash_key_conditional)
     1820C(egc_set_hash_key_conditional):
     1821        __(subl $misc_data_offset*fixnumone,%temp0) /* undo pre-added offset */
     1822        __(sarl $fixnumshift,%temp0)    /* will be fixnum-tagged */
     18230:      __(cmpl %arg_y,misc_data_offset(%temp1,%temp0))
     1824        __(movl misc_data_offset(%temp1,%temp0),%imm0)
     1825        __(jne 3f)
     1826        __(lock)
     1827        __(cmpxchgl %arg_z,misc_data_offset(%temp1,%temp0))
     1828        .globl C(egc_set_hash_key_conditional_success_test)
     1829C(egc_set_hash_key_conditional_success_test):
     1830        __(jne 0b)
     1831        __(leal misc_data_offset(%temp1,%temp0),%imm0)
     1832        __(subl lisp_global(heap_start),%imm0)
     1833        __(shrl $dnode_shift,%imm0)
     1834        __(cmpl lisp_global(oldspace_dnode_count),%imm0)
     1835        __(jae 2f)
     1836        __(ref_global(refbits,%temp0))
     1837        __(xorb $31,%imm0_b)
     1838        __(lock)
     1839        __(btsl %imm0,(%temp0))
     1840        /* Now memoize the address of the hash vector */
     1841        __(movl %temp1,%imm0)
     1842        __(subl lisp_global(heap_start),%imm0)
     1843        __(shrl $dnode_shift,%imm0)
     1844        __(xorb $31,%imm0_b)
     1845        __(lock)
     1846        __(btsl %imm0,(%temp0))
    18091847        .globl C(egc_write_barrier_end)
    18101848C(egc_write_barrier_end):
     
    45974635_spentry(unused_6)
    45984636        __(int $3)
    4599 Xspentry_end:           
     4637Xspentry_end:
    46004638_endsubp(unused_6)
    46014639        .data
Note: See TracChangeset for help on using the changeset viewer.