aa
com.cliffc.aa.util.Util Class Reference

Static Public Member Functions

static boolean eq (String s0, String s1)
 
static< E > int find (E[] es, E e)
 
static int find (int[] es, int e)
 
static void hash_quality_check (ConcurrentMap map)
 
static void hash_quality_check_per (ConcurrentMap map)
 

Detailed Description

Definition at line 5 of file Util.java.

Member Function Documentation

◆ eq()

static boolean com.cliffc.aa.util.Util.eq ( String  s0,
String  s1 
)
static

Definition at line 16 of file Util.java.

16  {
17  if( s0==s1 ) return true;
18  if( s0==null || s1==null ) return false;
19  assert !s0.equals(s1) : "Not interned: "+s0;
20  return false;
21  }

Referenced by com.cliffc.aa.HM.HM4.T2._cycle_equals(), com.cliffc.aa.tvar.TV2._cycle_equals(), com.cliffc.aa.HM.HM5.T2._cycle_equals(), com.cliffc.aa.HM.HM6.T2._cycle_equals(), com.cliffc.aa.HM.HM7.T2._cycle_equals(), com.cliffc.aa.HM.HM8.T2._cycle_equals(), com.cliffc.aa.HM.HM9.T2._cycle_equals(), com.cliffc.aa.HM.HM.T2._cycle_equals(), com.cliffc.aa.tvar.TV2._eq(), com.cliffc.aa.tvar.TV2._fresh_unify(), com.cliffc.aa.HM.HM5.T2._fresh_unify(), com.cliffc.aa.HM.HM6.T2._fresh_unify(), com.cliffc.aa.HM.HM7.T2._fresh_unify(), com.cliffc.aa.HM.HM8.T2._fresh_unify(), com.cliffc.aa.HM.HM9.T2._fresh_unify(), com.cliffc.aa.HM.HM.T2._fresh_unify(), com.cliffc.aa.HM.HM4.T2._fresh_unify_impl(), com.cliffc.aa.Parse._good_prec_tok(), com.cliffc.aa.tvar.TV2._unify(), com.cliffc.aa.HM.HM4.T2._unify(), com.cliffc.aa.HM.HM5.T2._unify(), com.cliffc.aa.HM.HM6.T2._unify(), com.cliffc.aa.HM.HM7.T2._unify(), com.cliffc.aa.HM.HM8.T2._unify(), com.cliffc.aa.HM.HM9.T2._unify(), com.cliffc.aa.HM.HM.T2._unify(), com.cliffc.aa.node.UnresolvedNode.add_def_unresolved(), com.cliffc.aa.type.TypeStruct.add_fld(), com.cliffc.aa.type.TypeStruct.cmp(), com.cliffc.aa.node.IntrinsicNode.convertTypeNameStruct(), com.cliffc.aa.node.NewObjNode.create(), com.cliffc.aa.type.TypeFld.cycle_equals(), com.cliffc.aa.type.Type< TypeFlt >.cycle_equals(), com.cliffc.aa.type.TypeStr.equals(), com.cliffc.aa.type.TypeFld.equals(), com.cliffc.aa.type.TypeFunSig.equals(), com.cliffc.aa.node.ConTypeNode.equals(), com.cliffc.aa.type.Type< TypeFlt >.equals(), com.cliffc.aa.node.StoreNode.equals(), com.cliffc.aa.node.LoadNode.equals(), com.cliffc.aa.Parse.fact(), com.cliffc.aa.node.LoadNode.find_previous_store(), com.cliffc.aa.type.TypeFld.fld_find(), com.cliffc.aa.type.TypeStruct.fld_find(), com.cliffc.aa.HM.HM9.T2.fresh_base(), com.cliffc.aa.HM.HM.T2.fresh_base(), com.cliffc.aa.Parse.func(), com.cliffc.aa.HM.HM4.T2.get_fresh(), com.cliffc.aa.HM.HM4.Apply.hm(), com.cliffc.aa.HM.HM.NotNil.hm(), com.cliffc.aa.node.LoadNode.ideal_mono(), com.cliffc.aa.type.TypeFunSig.init(), com.cliffc.aa.type.TypeFld.is_display_ptr(), com.cliffc.aa.HM.HM7.Apply.is_if_nil(), com.cliffc.aa.HM.HM8.Apply.is_if_nil(), com.cliffc.aa.tvar.TV2.isa(), com.cliffc.aa.HM.HM5.T2.isa(), com.cliffc.aa.HM.HM6.T2.isa(), com.cliffc.aa.HM.HM7.T2.isa(), com.cliffc.aa.HM.HM8.T2.isa(), com.cliffc.aa.HM.HM9.T2.isa(), com.cliffc.aa.HM.HM.T2.isa(), com.cliffc.aa.HM.HM5.Lambda.lookup(), com.cliffc.aa.HM.HM5.Lambda2.lookup(), com.cliffc.aa.HM.HM5.Let.lookup(), com.cliffc.aa.HM.HM6.Lambda.lookup(), com.cliffc.aa.HM.HM6.Lambda2.lookup(), com.cliffc.aa.HM.HM7.Lambda.lookup(), com.cliffc.aa.HM.HM8.Lambda.lookup(), com.cliffc.aa.HM.HM6.Let.lookup(), com.cliffc.aa.HM.HM7.Let.lookup(), com.cliffc.aa.HM.HM8.Let.lookup(), com.cliffc.aa.type.Type< TypeFlt >.mtname(), com.cliffc.aa.node.FunNode.names(), com.cliffc.aa.HM.HM5.Lambda.prep_lookup_deps(), com.cliffc.aa.HM.HM5.Lambda2.prep_lookup_deps(), com.cliffc.aa.HM.HM5.Let.prep_lookup_deps(), com.cliffc.aa.HM.HM6.Lambda.prep_lookup_deps(), com.cliffc.aa.HM.HM6.Lambda2.prep_lookup_deps(), com.cliffc.aa.HM.HM7.Lambda.prep_lookup_deps(), com.cliffc.aa.HM.HM8.Lambda.prep_lookup_deps(), com.cliffc.aa.HM.HM6.Let.prep_lookup_deps(), com.cliffc.aa.HM.HM7.Let.prep_lookup_deps(), com.cliffc.aa.HM.HM8.Let.prep_lookup_deps(), com.cliffc.aa.HM.HM9.Lambda.prep_lookup_deps(), com.cliffc.aa.HM.HM.Lambda.prep_lookup_deps(), com.cliffc.aa.HM.HM9.Let.prep_lookup_deps(), com.cliffc.aa.HM.HM.Let.prep_lookup_deps(), com.cliffc.aa.HM.HM9.Ident.prep_tree(), com.cliffc.aa.HM.HM.Ident.prep_tree(), com.cliffc.aa.HM.HM4.Lambda.prep_tree_lookup(), com.cliffc.aa.HM.HM4.Lambda2.prep_tree_lookup(), com.cliffc.aa.HM.HM4.Let.prep_tree_lookup(), com.cliffc.aa.HM.HM4.T2.progress(), com.cliffc.aa.type.TypeFld.sdual(), com.cliffc.aa.type.TypeFld.smeet(), com.cliffc.aa.type.TypeFunSig.str(), com.cliffc.aa.type.TypeStruct.str(), com.cliffc.aa.Parse.type0(), com.cliffc.aa.HM.HM9.T2.union(), com.cliffc.aa.HM.HM.T2.union(), com.cliffc.aa.type.TypeStr.xmeet(), and com.cliffc.aa.type.Type< TypeFlt >.xmt_name().

Here is the caller graph for this function:

◆ find() [1/2]

static <E> int com.cliffc.aa.util.Util.find ( E[]  es,
e 
)
static

Definition at line 10 of file Util.java.

10  {
11  for( int i=0; i<es.length; i++ ) if( es[i]==e ) return i;
12  return -1;
13  }

◆ find() [2/2]

◆ hash_quality_check()

static void com.cliffc.aa.util.Util.hash_quality_check ( ConcurrentMap  map)
static

Definition at line 29 of file Util.java.

29  {
30  NonBlockingHashMapLong<Integer> hashs = new NonBlockingHashMapLong<>();
31  for( Object k : map.keySet() ) {
32  int hash = k.hashCode();
33  Integer ii = hashs.get(hash);
34  hashs.put(hash,ii==null ? 1 : ii+1);
35  }
36  int[] hist = new int[16];
37  int maxval=0;
38  long maxkey=-1;
39  for( long l : hashs.keySet() ) {
40  int reps = hashs.get(l);
41  if( reps > maxval ) { maxval=reps; maxkey=l; }
42  if( reps < hist.length ) hist[reps]++;
43  else System.out.println("hash "+l+" repeats "+reps);
44  }
45  for( int i=0; i<hist.length; i++ )
46  if( hist[i] > 0 )
47  System.out.println("Number of hashes with "+i+" repeats: "+hist[i]);
48  System.out.println("Max repeat key "+maxkey+" repeats: "+maxval);
49  }

References com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.get(), com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.keySet(), and com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.put().

Referenced by com.cliffc.aa.util.Util.hash_quality_check_per().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hash_quality_check_per()

static void com.cliffc.aa.util.Util.hash_quality_check_per ( ConcurrentMap  map)
static

Definition at line 24 of file Util.java.

24  {
25  if( (map.size() & ((1L<<16)-1)) == 0 ) // Reports every 2^16 == 65536 puts
26  hash_quality_check(map);
27  }

References com.cliffc.aa.util.Util.hash_quality_check().

Here is the call graph for this function:

The documentation for this class was generated from the following file:
com.cliffc.aa.util.Util.hash_quality_check
static void hash_quality_check(ConcurrentMap map)
Definition: Util.java:29