aa
com.cliffc.aa.type.Types Class Reference
Collaboration diagram for com.cliffc.aa.type.Types:
[legend]

Classes

class  Key
 

Static Public Member Functions

static Type[] clone (Type[] ts)
 
static Type[] copyOf (Type[] ts, int len)
 
static boolean eq (Type[] ts0, Type[] ts1)
 
static void free (Type[] ts)
 
static Type[] get (int len)
 
static Type[] hash_cons (Type[] ts)
 
static Type[] ts (Type t0)
 
static Type[] ts (Type t0, Type t1)
 
static Type[] ts (Type t0, Type t1, Type t2)
 
static Type[] ts (Type t0, Type t1, Type t2, Type t3)
 
static Type[] ts (Type t0, Type t1, Type t2, Type t3, Type t4)
 
static Type[] ts (Type t0, Type t1, Type t2, Type t3, Type t4, Type t5)
 

Private Member Functions

 Types (int len)
 
Types check ()
 
boolean check_ ()
 
boolean check_ (Type[] ts)
 
Type[] get ()
 
Type[] hash_cons_ (Type[] ts)
 

Static Private Member Functions

static Types tary (int len)
 

Private Attributes

final Ary< Type[]> _free = new Ary<>(new Type[1][],0)
 
final IHashMap _intern = new IHashMap()
 
final int _len
 

Static Private Attributes

static final Key K = new Key(null,0)
 
static final Ary< TypesTYPEARY = new Ary<>(new Types[1],0)
 

Detailed Description

Definition at line 9 of file Types.java.

Constructor & Destructor Documentation

◆ Types()

com.cliffc.aa.type.Types.Types ( int  len)
private

Definition at line 49 of file Types.java.

49 { _len=len; }

References com.cliffc.aa.type.Types._len.

Referenced by com.cliffc.aa.type.Types.tary().

Here is the caller graph for this function:

Member Function Documentation

◆ check()

Types com.cliffc.aa.type.Types.check ( )
private

Definition at line 51 of file Types.java.

51 { assert check_(); return this; }

References com.cliffc.aa.type.Types.check_().

Referenced by com.cliffc.aa.type.Types.clone(), com.cliffc.aa.type.Types.copyOf(), com.cliffc.aa.type.Types.get(), com.cliffc.aa.type.Types.hash_cons(), and com.cliffc.aa.type.Types.ts().

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

◆ check_() [1/2]

boolean com.cliffc.aa.type.Types.check_ ( )
private

Definition at line 52 of file Types.java.

52  {
53  //for( Object k : _intern.keySet() )
54  // assert Key.hash(((Key)k)._ts)==((Key)k)._hash; // Basically asserting array not hacked
55  return true;
56  }

Referenced by com.cliffc.aa.type.Types.check().

Here is the caller graph for this function:

◆ check_() [2/2]

boolean com.cliffc.aa.type.Types.check_ ( Type[]  ts)
private

Definition at line 57 of file Types.java.

57  {
58  K._ts=ts;
59  K._hash = Key.hash(ts);
60  Key k2 = _intern.get(K);
61  return k2._ts==ts;
62  }

References com.cliffc.aa.type.Types.Key._hash, com.cliffc.aa.type.Types._intern, com.cliffc.aa.type.Types.Key._ts, com.cliffc.aa.util.IHashMap.get(), com.cliffc.aa.type.Types.Key.hash(), com.cliffc.aa.type.Types.K, and com.cliffc.aa.type.Types.ts().

Here is the call graph for this function:

◆ clone()

static Type [] com.cliffc.aa.type.Types.clone ( Type[]  ts)
static

Definition at line 144 of file Types.java.

144  {
145  Type[] ts2 = tary(ts.length).check().get();
146  System.arraycopy(ts,0,ts2,0,ts.length);
147  return ts2;
148  }

References com.cliffc.aa.type.Types.check(), com.cliffc.aa.type.Types.get(), com.cliffc.aa.type.Types.tary(), and com.cliffc.aa.type.Types.ts().

Referenced by com.cliffc.aa.type.TypeTuple.make_from_arg(), com.cliffc.aa.type.TypeTuple.set(), com.cliffc.aa.type.TypeTuple.sharptr(), and com.cliffc.aa.type.TypeTuple.simple_ptr().

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

◆ copyOf()

static Type [] com.cliffc.aa.type.Types.copyOf ( Type[]  ts,
int  len 
)
static

Definition at line 151 of file Types.java.

151  {
152  Type[] ts2 = tary(len).check().get();
153  int minlen = Math.min(len,ts.length);
154  System.arraycopy(ts,0,ts2,0,minlen);
155  Arrays.fill(ts2,minlen,len,null);
156  return ts2;
157  }

References com.cliffc.aa.type.Types.check(), com.cliffc.aa.type.Types.get(), com.cliffc.aa.type.Types.tary(), and com.cliffc.aa.type.Types.ts().

Here is the call graph for this function:

◆ eq()

static boolean com.cliffc.aa.type.Types.eq ( Type[]  ts0,
Type[]  ts1 
)
static

Definition at line 158 of file Types.java.

158  {
159  if( ts0==ts1 ) return true;
160  if( ts0==null || ts1==null ) return false;
161  //assert tary(ts0.length).check().check_(ts0);
162  //assert ts0.length == ts1.length || tary(ts1.length).check().check_(ts1);
163  return false; // No need for deep check, since interned
164  }

Referenced by com.cliffc.aa.type.TypeTuple.equals().

Here is the caller graph for this function:

◆ free()

static void com.cliffc.aa.type.Types.free ( Type[]  ts)
static

Definition at line 85 of file Types.java.

85 { tary(ts.length)._free.push(ts); }

References com.cliffc.aa.type.Types._free, com.cliffc.aa.type.Types.tary(), and com.cliffc.aa.type.Types.ts().

Here is the call graph for this function:

◆ get() [1/2]

Type [] com.cliffc.aa.type.Types.get ( )
private

◆ get() [2/2]

static Type [] com.cliffc.aa.type.Types.get ( int  len)
static

Definition at line 84 of file Types.java.

84 { return tary(len).check().get(); }

References com.cliffc.aa.type.Types.check(), com.cliffc.aa.type.Types.get(), and com.cliffc.aa.type.Types.tary().

Here is the call graph for this function:

◆ hash_cons()

static Type [] com.cliffc.aa.type.Types.hash_cons ( Type[]  ts)
static

Definition at line 86 of file Types.java.

86 { return tary(ts.length).check().hash_cons_(ts); }

References com.cliffc.aa.type.Types.check(), com.cliffc.aa.type.Types.hash_cons_(), com.cliffc.aa.type.Types.tary(), and com.cliffc.aa.type.Types.ts().

Referenced by com.cliffc.aa.type.TypeTuple.make0(), and com.cliffc.aa.type.TypeTuple.xdual().

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

◆ hash_cons_()

Type [] com.cliffc.aa.type.Types.hash_cons_ ( Type[]  ts)
private

Definition at line 72 of file Types.java.

72  {
73  K._ts=ts;
74  K._hash = Key.hash(ts);
75  Key k2 = _intern.get(K);
76  if( k2 != null ) {
77  if( k2._ts!=ts ) _free.push(ts);
78  return k2._ts;
79  }
80  _intern.put(new Key(ts,K._hash));
81  return ts;
82  }

References com.cliffc.aa.type.Types._free, com.cliffc.aa.type.Types.Key._hash, com.cliffc.aa.type.Types._intern, com.cliffc.aa.type.Types.Key._ts, com.cliffc.aa.util.IHashMap.get(), com.cliffc.aa.type.Types.Key.hash(), com.cliffc.aa.type.Types.K, com.cliffc.aa.util.IHashMap.put(), and com.cliffc.aa.type.Types.ts().

Referenced by com.cliffc.aa.type.Types.hash_cons().

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

◆ tary()

static Types com.cliffc.aa.type.Types.tary ( int  len)
staticprivate

Definition at line 14 of file Types.java.

14  {
15  Types tary = TYPEARY.atX(len);
16  return tary==null ? TYPEARY.setX(len,new Types(len)) : tary;
17  }

References com.cliffc.aa.type.Types.TYPEARY, and com.cliffc.aa.type.Types.Types().

Referenced by com.cliffc.aa.type.Types.clone(), com.cliffc.aa.type.Types.copyOf(), com.cliffc.aa.type.Types.free(), com.cliffc.aa.type.Types.get(), com.cliffc.aa.type.Types.hash_cons(), and com.cliffc.aa.type.Types.ts().

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

◆ ts() [1/6]

static Type [] com.cliffc.aa.type.Types.ts ( Type  t0)
static

Definition at line 90 of file Types.java.

90  {
91  Types t1 = tary(1).check();
92  Type[] ts = t1.get();
93  ts[0] = t0;
94  return ts;
95  }

References com.cliffc.aa.type.Types.check(), com.cliffc.aa.type.Types.get(), and com.cliffc.aa.type.Types.tary().

Referenced by com.cliffc.aa.type.Types.check_(), com.cliffc.aa.type.Types.clone(), com.cliffc.aa.type.Types.copyOf(), com.cliffc.aa.type.Types.Key.equals(), com.cliffc.aa.type.Types.free(), com.cliffc.aa.type.Types.Key.hash(), com.cliffc.aa.type.Types.hash_cons(), com.cliffc.aa.type.Types.hash_cons_(), com.cliffc.aa.type.Types.Key.Key(), com.cliffc.aa.type.TypeFunSig.make(), com.cliffc.aa.type.TypeTuple.make(), com.cliffc.aa.node.TestNodeSmall.testRecursiveDisplay(), com.cliffc.aa.type.TestType.testStructTuple(), and com.cliffc.aa.type.Types.ts().

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

◆ ts() [2/6]

static Type [] com.cliffc.aa.type.Types.ts ( Type  t0,
Type  t1 
)
static

Definition at line 96 of file Types.java.

96  {
97  Types t2 = tary(2).check();
98  Type[] ts = t2.get();
99  ts[0] = t0;
100  ts[1] = t1;
101  return ts;
102  }

References com.cliffc.aa.type.Types.check(), com.cliffc.aa.type.Types.get(), com.cliffc.aa.type.Types.tary(), and com.cliffc.aa.type.Types.ts().

Here is the call graph for this function:

◆ ts() [3/6]

static Type [] com.cliffc.aa.type.Types.ts ( Type  t0,
Type  t1,
Type  t2 
)
static

Definition at line 103 of file Types.java.

103  {
104  Types t3 = tary(3).check();
105  Type[] ts = t3.get();
106  ts[0] = t0;
107  ts[1] = t1;
108  ts[2] = t2;
109  return ts;
110  }

References com.cliffc.aa.type.Types.check(), com.cliffc.aa.type.Types.get(), com.cliffc.aa.type.Types.tary(), and com.cliffc.aa.type.Types.ts().

Here is the call graph for this function:

◆ ts() [4/6]

static Type [] com.cliffc.aa.type.Types.ts ( Type  t0,
Type  t1,
Type  t2,
Type  t3 
)
static

Definition at line 111 of file Types.java.

111  {
112  Types t4 = tary(4).check();
113  Type[] ts = t4.get();
114  ts[0] = t0;
115  ts[1] = t1;
116  ts[2] = t2;
117  ts[3] = t3;
118  return ts;
119  }

References com.cliffc.aa.type.Types.check(), com.cliffc.aa.type.Types.get(), com.cliffc.aa.type.Types.tary(), and com.cliffc.aa.type.Types.ts().

Here is the call graph for this function:

◆ ts() [5/6]

static Type [] com.cliffc.aa.type.Types.ts ( Type  t0,
Type  t1,
Type  t2,
Type  t3,
Type  t4 
)
static

Definition at line 120 of file Types.java.

120  {
121  Types t5 = tary(5).check();
122  Type[] ts = t5.get();
123  ts[0] = t0;
124  ts[1] = t1;
125  ts[2] = t2;
126  ts[3] = t3;
127  ts[4] = t4;
128  return ts;
129  }

References com.cliffc.aa.type.Types.check(), com.cliffc.aa.type.Types.get(), com.cliffc.aa.type.Types.tary(), and com.cliffc.aa.type.Types.ts().

Here is the call graph for this function:

◆ ts() [6/6]

static Type [] com.cliffc.aa.type.Types.ts ( Type  t0,
Type  t1,
Type  t2,
Type  t3,
Type  t4,
Type  t5 
)
static

Definition at line 130 of file Types.java.

130  {
131  Types t6 = tary(6).check();
132  Type[] ts = t6.get();
133  ts[0] = t0;
134  ts[1] = t1;
135  ts[2] = t2;
136  ts[3] = t3;
137  ts[4] = t4;
138  ts[5] = t5;
139  return ts;
140  }

References com.cliffc.aa.type.Types.check(), com.cliffc.aa.type.Types.get(), com.cliffc.aa.type.Types.tary(), and com.cliffc.aa.type.Types.ts().

Here is the call graph for this function:

Member Data Documentation

◆ _free

final Ary<Type[]> com.cliffc.aa.type.Types._free = new Ary<>(new Type[1][],0)
private

◆ _intern

final IHashMap com.cliffc.aa.type.Types._intern = new IHashMap()
private

◆ _len

final int com.cliffc.aa.type.Types._len
private

Definition at line 46 of file Types.java.

Referenced by com.cliffc.aa.type.Types.get(), and com.cliffc.aa.type.Types.Types().

◆ K

final Key com.cliffc.aa.type.Types.K = new Key(null,0)
staticprivate

◆ TYPEARY

final Ary<Types> com.cliffc.aa.type.Types.TYPEARY = new Ary<>(new Types[1],0)
staticprivate

Definition at line 11 of file Types.java.

Referenced by com.cliffc.aa.type.Types.tary().


The documentation for this class was generated from the following file:
com.cliffc.aa.util.IHashMap.get
public< T > T get(T key)
Definition: IHashMap.java:11
com.cliffc.aa.type.Types.Key._ts
Type[] _ts
Definition: Types.java:23
com.cliffc.aa.type.Types.check
Types check()
Definition: Types.java:51
com.cliffc.aa.type.Types._len
final int _len
Definition: Types.java:46
com.cliffc.aa.type.Types.ts
static Type[] ts(Type t0)
Definition: Types.java:90
com.cliffc.aa.type.Types.Key._hash
int _hash
Definition: Types.java:24
com.cliffc.aa.type.Types._intern
final IHashMap _intern
Definition: Types.java:47
com.cliffc.aa.type.Types.tary
static Types tary(int len)
Definition: Types.java:14
com.cliffc.aa.type.Types._free
final Ary< Type[]> _free
Definition: Types.java:48
com.cliffc.aa.type.Types.get
Type[] get()
Definition: Types.java:66
com.cliffc.aa.type.Types.K
static final Key K
Definition: Types.java:19
com.cliffc.aa.type.Types.Types
Types(int len)
Definition: Types.java:49
com.cliffc.aa.type.Types.hash_cons_
Type[] hash_cons_(Type[] ts)
Definition: Types.java:72
com.cliffc.aa.type.Types.check_
boolean check_()
Definition: Types.java:52
com.cliffc.aa.type.Types.TYPEARY
static final Ary< Types > TYPEARY
Definition: Types.java:11
com.cliffc.aa.util.IHashMap.put
public< T > T put(T kv)
Definition: IHashMap.java:9