Ignore:
Timestamp:
Sep 14, 2008, 6:48:21 PM (11 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-exceptions.c

    r10717 r10731  
    20572057
    20582058extern opcode egc_write_barrier_start, egc_write_barrier_end,
     2059  egc_set_hash_key_conditional, egc_set_hash_key_conditional_success_test,
     2060  egc_store_node_conditional_success_end,
    20592061  egc_store_node_conditional_success_test,egc_store_node_conditional,
    20602062  egc_set_hash_key, egc_gvset, egc_rplacd;
     
    22792281    Boolean need_store = true, need_check_memo = true, need_memoize_root = false;
    22802282
    2281     if (program_counter >= &egc_store_node_conditional) {
     2283    if (program_counter >= &egc_set_hash_key_conditional) {
     2284      if ((program_counter < &egc_set_hash_key_conditional_success_test) ||
     2285          ((program_counter == &egc_set_hash_key_conditional_success_test) &&
     2286           !(eflags_register(xp) & (1 << X86_ZERO_FLAG_BIT)))) {
     2287        /* Back up the PC, try again */
     2288        xpPC(xp) = (LispObj) &egc_set_hash_key_conditional;
     2289        return;
     2290      }
     2291      /* The conditional store succeeded.  Set the refbit, return to ra0 */
     2292      val = xpGPR(xp,Iarg_z);
     2293#ifdef X8664
     2294      root = xpGPR(xp,Iarg_x);
     2295      ea = (LispObj*)(root + (unbox_fixnum((signed_natural) xpGPR(xp,Itemp0))));
     2296#else
     2297      root = xpGPR(xp,Itemp1);
     2298      ea = (LispObj *)(root + misc_data_offset + xpGPR(xp,Itemp0));
     2299#endif
     2300      need_memoize_root = true;
     2301      need_store = false;
     2302      xpGPR(xp,Iarg_z) = t_value;
     2303    } else if (program_counter >= &egc_store_node_conditional) {
    22822304      if ((program_counter < &egc_store_node_conditional_success_test) ||
    22832305          ((program_counter == &egc_store_node_conditional_success_test) &&
     
    22872309        return;
    22882310      }
     2311      if (program_counter >= &egc_store_node_conditional_success_end) {
     2312        return;
     2313      }
     2314
    22892315      /* The conditional store succeeded.  Set the refbit, return to ra0 */
    22902316      val = xpGPR(xp,Iarg_z);
Note: See TracChangeset for help on using the changeset viewer.