Changeset 14491


Ignore:
Timestamp:
05/05/13 12:16:07 (9 years ago)
Author:
rschlatte
Message:

Always initialize emf cache for generic functions

Eliminates a check from generic function invocation critical path.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/StandardGenericFunction.java

    r14490 r14491  
    4141{
    4242
    43   ConcurrentHashMap<CacheEntry,LispObject> cache;
     43  ConcurrentHashMap<CacheEntry,LispObject> cache
     44    = new ConcurrentHashMap<CacheEntry,LispObject>();;
    4445
    4546  public StandardGenericFunction()
     
    6768  void clearCache()
    6869  {
    69     cache = null;
     70    cache = new ConcurrentHashMap<CacheEntry,LispObject>();
    7071  }
    7172
     
    160161      CacheEntry specializations = new CacheEntry(array);
    161162      ConcurrentHashMap<CacheEntry,LispObject> ht = gf.cache;
    162       if (ht == null)
    163         ht = gf.cache = new ConcurrentHashMap<CacheEntry,LispObject>();
    164163      ht.put(specializations, third);
    165164      return third;
     
    191190      CacheEntry specializations = new CacheEntry(array);
    192191      ConcurrentHashMap<CacheEntry,LispObject> ht = gf.cache;
    193       if (ht == null)
    194         return NIL;
    195192      LispObject emf = (LispObject) ht.get(specializations);
    196193      return emf != null ? emf : NIL;
Note: See TracChangeset for help on using the changeset viewer.