private final Object[] help_copy( Object[] helper ) { // Read the top-level KVS only once. We'll try to help this copy along, // even if it gets promoted out from under us (i.e., the copy completes // and another KVS becomes the top-level copy). Object[] topkvs = _kvs; CHM topchm = chm(topkvs); if( topchm._newkvs == null ) return helper; // No copy in-progress topchm.help_copy_impl(this,topkvs,false); return helper; }
/** Returns the number of key-value mappings in this map. * @return the number of key-value mappings in this map */ @Override public int size ( ) { return chm(_kvs).size(); } /** Returns <tt>size() == 0</tt>.
private final void print( Object[] kvs ) { for( int i=0; i<len(kvs); i++ ) { Object K = key(kvs,i); if( K != null ) { String KS = (K == TOMBSTONE) ? "XXX" : K.toString(); Object V = val(kvs,i); Object U = Prime.unbox(V); String p = (V==U) ? "" : "prime_"; String US = (U == TOMBSTONE) ? "tombstone" : U.toString(); System.out.println(""+i+" ("+KS+","+p+US+")"); } } Object[] newkvs = chm(kvs)._newkvs; // New table, if any if( newkvs != null ) { System.out.println("----"); print(newkvs); } } // print only the live values, broken down by the table they are in
private final void print2( Object[] kvs) { for( int i=0; i<len(kvs); i++ ) { Object key = key(kvs,i); Object val = val(kvs,i); Object U = Prime.unbox(val); if( key != null && key != TOMBSTONE && // key is sane val != null && U != TOMBSTONE ) { // val is sane String p = (val==U) ? "" : "prime_"; System.out.println(""+i+" ("+key+","+p+val+")"); } } Object[] newkvs = chm(kvs)._newkvs; // New table, if any if( newkvs != null ) { System.out.println("----"); print2(newkvs); } }
private static final Object get_impl( final NonBlockingIdentityHashMap topmap, final Object[] kvs, final Object key ) { final int fullhash= hash (key); // throws NullPointerException if key is null final int len = len (kvs); // Count of key/value pairs, reads kvs.length final CHM chm = chm (kvs); // The CHM, for a volatile read below; reads slot 0 of kvs
final int fullhash = hash (key); // throws NullPointerException if key null final int len = len (kvs); // Count of key/value pairs, reads kvs.length final CHM chm = chm (kvs); // Reads kvs[0] int idx = fullhash & (len-1);
private final Object[] help_copy( Object[] helper ) { // Read the top-level KVS only once. We'll try to help this copy along, // even if it gets promoted out from under us (i.e., the copy completes // and another KVS becomes the top-level copy). Object[] topkvs = _kvs; CHM topchm = chm(topkvs); if( topchm._newkvs == null ) return helper; // No copy in-progress topchm.help_copy_impl(this,topkvs,false); return helper; }
/** Returns the number of key-value mappings in this map. * @return the number of key-value mappings in this map */ @Override public int size ( ) { return chm(_kvs).size(); } /** Returns <tt>size() == 0</tt>.
private final void print( Object[] kvs ) { for( int i=0; i<len(kvs); i++ ) { Object K = key(kvs,i); if( K != null ) { String KS = (K == TOMBSTONE) ? "XXX" : K.toString(); Object V = val(kvs,i); Object U = Prime.unbox(V); String p = (V==U) ? "" : "prime_"; String US = (U == TOMBSTONE) ? "tombstone" : U.toString(); System.out.println(""+i+" ("+KS+","+p+US+")"); } } Object[] newkvs = chm(kvs)._newkvs; // New table, if any if( newkvs != null ) { System.out.println("----"); print(newkvs); } } // print only the live values, broken down by the table they are in
private final void print2( Object[] kvs) { for( int i=0; i<len(kvs); i++ ) { Object key = key(kvs,i); Object val = val(kvs,i); Object U = Prime.unbox(val); if( key != null && key != TOMBSTONE && // key is sane val != null && U != TOMBSTONE ) { // val is sane String p = (val==U) ? "" : "prime_"; System.out.println(""+i+" ("+key+","+p+val+")"); } } Object[] newkvs = chm(kvs)._newkvs; // New table, if any if( newkvs != null ) { System.out.println("----"); print2(newkvs); } }
private static final Object get_impl( final NonBlockingIdentityHashMap topmap, final Object[] kvs, final Object key ) { final int fullhash= hash (key); // throws NullPointerException if key is null final int len = len (kvs); // Count of key/value pairs, reads kvs.length final CHM chm = chm (kvs); // The CHM, for a volatile read below; reads slot 0 of kvs
final int fullhash = hash (key); // throws NullPointerException if key null final int len = len (kvs); // Count of key/value pairs, reads kvs.length final CHM chm = chm (kvs); // Reads kvs[0] int idx = fullhash & (len-1);