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

Public Member Functions

int abit ()
 
boolean above_center ()
 
BitsAlias ALL ()
 
BitsAlias ANY ()
 
int bitCount ()
 
IBitSet bitset ()
 
clear (int bit)
 
dual ()
 
BitsAlias EMPTY ()
 
boolean equals (Object o)
 
int getbit ()
 
int hashCode ()
 
boolean is_con ()
 
boolean is_empty ()
 
boolean is_nil ()
 
boolean isa (B bs)
 
Iterator< Integer > iterator ()
 
Bits< B > join (Bits< B > bs)
 
final B make (int... bits)
 
int max ()
 
meet (final B bs)
 
meet_nil ()
 
TypeObj oob (TypeObj t)
 
BitsAlias or (int bit)
 
boolean overlaps (Bits< B > bs)
 
set (int bit)
 
SB str (SB sb)
 
strip_nil ()
 
Bits< B > subtract (Bits< B > bs)
 
boolean test (int i)
 
boolean test_recur (int i)
 
String toString ()
 
Tree< BitsAliastree ()
 

Static Public Member Functions

static int[] get_kids (int par)
 
static void init0 ()
 
static boolean is_parent (int idx)
 
static boolean is_parent (int par, int kid)
 
static BitsAlias make0 (int bit)
 
static int new_alias (int par)
 
static int next_kid (int alias, int kid)
 
static int parent (int kid)
 
static void reset_to_init0 ()
 
static int type_alias (int par)
 

Static Public Attributes

static final int ALL
 
static BitsAlias FULL
 
static BitsAlias RECORD_BITS
 

Package Functions

void init (int con, long[] bits)
 
final B make (int bit)
 
BitsAlias make_impl (int con, long[] bits)
 
boolean may_nil ()
 
not_nil ()
 

Static Package Functions

 [static initializer]
 

Package Attributes

long[] _bits
 
int _con
 
int _hash
 

Static Package Attributes

static final int AARY
 
static final int ABC
 
static BitsAlias ANY
 
static final int ARY
 
static BitsAlias ARYBITS
 
static BitsAlias ARYBITS0
 
static BitsAlias EMPTY
 
static BitsAlias NIL
 
static BitsAlias NZERO
 
static final int REC
 
static BitsAlias RECORD_BITS0
 
static final int STR
 
static BitsAlias STRBITS
 
static BitsAlias STRBITS0
 
static final Bits.Tree< BitsAliasTREE = new Bits.Tree<>()
 
static BitsAlias XNIL
 

Private Member Functions

boolean check ()
 
make (boolean any, long[] bits)
 

Static Private Member Functions

static void and (long[] bits, long con)
 
static long[] bits (int b)
 
static boolean check_multi_bits (long[] bits)
 
static int idx (long i)
 
static void join (Tree tree, long[] bits0, long[] bits1, long[] bits2)
 
static long mask (long i)
 
static int set_alias (int par)
 
static boolean test (long[] bits, int i)
 

Static Private Attributes

static BitsAlias FREE =null
 
static final HashMap< BitsAlias, BitsAliasINTERN = new HashMap<>()
 

Detailed Description

Definition at line 8 of file BitsAlias.java.

Member Function Documentation

◆ [static initializer]()

com.cliffc.aa.type.BitsAlias.[static initializer]
staticpackage

◆ abit()

int com.cliffc.aa.type.Bits< B extends Bits< B >.abit
inherited

Definition at line 203 of file Bits.java.

203 { return _bits==null&&_con!=0 ? _con : -1; }

◆ above_center()

boolean com.cliffc.aa.type.Bits< B extends Bits< B >.above_center
inherited

Definition at line 204 of file Bits.java.

204 { return _con<0; }

◆ ALL()

BitsAlias com.cliffc.aa.type.BitsAlias.ALL ( )

Definition at line 68 of file BitsAlias.java.

68 { return FULL; }

References com.cliffc.aa.type.BitsAlias.FULL.

◆ and()

static void com.cliffc.aa.type.Bits< B extends Bits< B >.and ( long[]  bits,
long  con 
)
staticprivateinherited

Definition at line 282 of file Bits.java.

282 { bits[idx(con)] &= ~mask(con); }

◆ ANY()

BitsAlias com.cliffc.aa.type.BitsAlias.ANY ( )

Definition at line 69 of file BitsAlias.java.

69 { return ANY ; }

References com.cliffc.aa.type.BitsAlias.ANY().

Referenced by com.cliffc.aa.type.BitsAlias.ANY().

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

◆ bitCount()

int com.cliffc.aa.type.Bits< B extends Bits< B >.bitCount
inherited

Definition at line 113 of file Bits.java.

113  {
114  if( _bits==null ) return _con==0 ? 0 : 1;
115  int sum=0;
116  for( long b : _bits )
117  sum += Long.bitCount(b);
118  return sum;
119  }

◆ bits()

static long [] com.cliffc.aa.type.Bits< B extends Bits< B >.bits ( int  b)
staticprivateinherited

Definition at line 283 of file Bits.java.

283 { return new long[idx(b)+1]; }

◆ bitset()

IBitSet com.cliffc.aa.type.Bits< B extends Bits< B >.bitset
inherited

Definition at line 391 of file Bits.java.

391  {
392  IBitSet bs = new IBitSet();
393  for( int alias : this )
394  bs.set(alias);
395  return bs;
396  }

◆ check()

boolean com.cliffc.aa.type.Bits< B extends Bits< B >.check
privateinherited

Definition at line 89 of file Bits.java.

89  {
90  if( _bits==null ) return true; // Must be a single bit#
91  if( _con != 1 && _con != -1 ) return false;
92  if( _bits.length==0 ) return false; // Empty bits replaced by a con
93  if( _bits.length==1 && _bits[0]== 0 ) return false; // NO bits is bad, use EMPTY instead
94  if( _bits[_bits.length-1]==0 ) return false; // Array is "tight"
95  if( _bits.length==1 && _bits[0]==1 ) return true; // NIL
96  // No set bit has a parent bit set, because the parent overrides
97  Tree<B> tree = tree();
98  for( int i : this )
99  while( (i = tree.parent(i)) != 0 )
100  if( test(i) )
101  return false;
102  // For efficiency, 1 bit set uses 'con' instead of 'bits'
103  return check_multi_bits(_bits); // Found multiple bits
104  }

◆ check_multi_bits()

static boolean com.cliffc.aa.type.Bits< B extends Bits< B >.check_multi_bits ( long[]  bits)
staticprivateinherited

Definition at line 105 of file Bits.java.

105  {
106  int len = bits.length;
107  long b = bits[len-1]; // Last word
108  if( (b & (b-1))!=0 ) return true; // Last word has multiple bits
109  // Check multiple bits spread over multiple words
110  for( int i=0; i<len-1; i++ ) if( bits[i] != 0 ) return true;
111  return false; // Found a single bit in last word
112  }

◆ clear()

B com.cliffc.aa.type.Bits< B extends Bits< B >.clear ( int  bit)
inherited

Definition at line 255 of file Bits.java.

255  {
256  if( !test(bit) ) return (B)this;
257  if( _bits == null ) return EMPTY();
258  long[] bs = _bits.clone();
259  and(bs,bit);
260  return make(_con==-1,bs);
261  }

◆ dual()

B com.cliffc.aa.type.Bits< B extends Bits< B >.dual
inherited

Definition at line 368 of file Bits.java.

368 { return make_impl(-_con,_bits); }

◆ EMPTY()

BitsAlias com.cliffc.aa.type.BitsAlias.EMPTY ( )

Definition at line 70 of file BitsAlias.java.

70 { return EMPTY ; }

References com.cliffc.aa.type.BitsAlias.EMPTY().

Referenced by com.cliffc.aa.type.BitsAlias.EMPTY().

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

◆ equals()

boolean com.cliffc.aa.type.Bits< B extends Bits< B >.equals ( Object  o)
inherited

Definition at line 121 of file Bits.java.

121  {
122  if( this==o ) return true;
123  if( !(o instanceof Bits) ) return false;
124  Bits bs = (Bits)o;
125  if( _con != bs._con || _hash != bs._hash ) return false;
126  if( _bits == bs._bits ) return true;
127  if( _bits ==null || bs._bits==null ) return false;
128  if( _bits.length != bs._bits.length ) return false;
129  for( int i=0; i<_bits.length; i++ )
130  if( _bits[i]!=bs._bits[i] ) return false;
131  return true;
132  }

◆ get_kids()

static int [] com.cliffc.aa.type.BitsAlias.get_kids ( int  par)
static

Definition at line 61 of file BitsAlias.java.

61 { return TREE.get_kids(par); }

References com.cliffc.aa.type.BitsAlias.TREE.

Referenced by com.cliffc.aa.node.MemSplitNode.split_alias().

Here is the caller graph for this function:

◆ getbit()

int com.cliffc.aa.type.Bits< B extends Bits< B >.getbit
inherited

Definition at line 202 of file Bits.java.

202 { assert _bits==null && _con!=0; return _con; }

◆ hashCode()

int com.cliffc.aa.type.Bits< B extends Bits< B >.hashCode
inherited

Definition at line 120 of file Bits.java.

120 { return _hash; }

◆ idx()

static int com.cliffc.aa.type.Bits< B extends Bits< B >.idx ( long  i)
staticprivateinherited

Definition at line 199 of file Bits.java.

199 { return (int)(i>>6); }

◆ init()

void com.cliffc.aa.type.Bits< B extends Bits< B >.init ( int  con,
long[]  bits 
)
packageinherited

Definition at line 80 of file Bits.java.

80  {
81  _con = con;
82  _bits=bits;
83  long sum=_con;
84  if( _bits != null ) for( long l : _bits ) sum += l;
85  _hash = (int)((sum>>32)+sum);
86  if( _hash==0 ) _hash=1;
87  assert check();
88  }

◆ init0()

static void com.cliffc.aa.type.BitsAlias.init0 ( )
static

Definition at line 63 of file BitsAlias.java.

63 { TREE.init0(); }

References com.cliffc.aa.type.BitsAlias.TREE.

Referenced by com.cliffc.aa.Env.record_for_top_reset1().

Here is the caller graph for this function:

◆ is_con()

boolean com.cliffc.aa.type.Bits< B extends Bits< B >.is_con
inherited

Definition at line 206 of file Bits.java.

206 { return is_nil() || is_empty(); }

◆ is_empty()

boolean com.cliffc.aa.type.Bits< B extends Bits< B >.is_empty
inherited

Definition at line 207 of file Bits.java.

207 { return _bits==null && _con==0; }

◆ is_nil()

boolean com.cliffc.aa.type.Bits< B extends Bits< B >.is_nil
inherited

Definition at line 208 of file Bits.java.

208 { return _bits!=null && _bits.length==1 && _bits[0]==1; }

◆ is_parent() [1/2]

static boolean com.cliffc.aa.type.BitsAlias.is_parent ( int  idx)
static

Definition at line 57 of file BitsAlias.java.

57 { return TREE.is_parent(idx); }

References com.cliffc.aa.type.Bits< BitsAlias >.idx(), and com.cliffc.aa.type.BitsAlias.TREE.

Here is the call graph for this function:

◆ is_parent() [2/2]

static boolean com.cliffc.aa.type.BitsAlias.is_parent ( int  par,
int  kid 
)
static

Definition at line 55 of file BitsAlias.java.

55 { return TREE.is_parent(par,kid); }

References com.cliffc.aa.type.BitsAlias.TREE.

◆ isa()

boolean com.cliffc.aa.type.Bits< B extends Bits< B >.isa ( bs)
inherited

Definition at line 372 of file Bits.java.

372 { return meet(bs) == bs; }

◆ iterator()

Iterator<Integer> com.cliffc.aa.type.Bits< B extends Bits< B >.iterator
inherited
Returns
an iterator

Definition at line 523 of file Bits.java.

523 { return new Iter(); }

◆ join() [1/2]

Bits<B> com.cliffc.aa.type.Bits< B extends Bits< B >.join ( Bits< B >  bs)
inherited

Definition at line 370 of file Bits.java.

370 { return dual().meet(bs.dual()).dual(); }

◆ join() [2/2]

static void com.cliffc.aa.type.Bits< B extends Bits< B >.join ( Tree  tree,
long[]  bits0,
long[]  bits1,
long[]  bits2 
)
staticprivateinherited

Definition at line 349 of file Bits.java.

349  {
350  // If a 'parent' bit is set, then no need to have any child bits set.
351  for( int i=0; i<bits0.length; i++ ) { // For all words
352  long l = bits0[i];
353  if( l!=0 ) {
354  // TODO: Use Long.numberOfTrailingZeros (or LeadingZeros probably) to
355  // do this only once-per-set-bit.
356  for( int j=0; j<64; j++ ) // For all bits in word
357  if( (mask(j)&l) != 0 ) {
358  for( int par = (i<<6)+j; par!=0; par = tree.parent(par) ) // Walk parent chain
359  if( test(bits1,par) ) // If parent set
360  { bits2[i]|=mask(j); break; } // then set kid
361  }
362  }
363  }
364  }

◆ make() [1/3]

B com.cliffc.aa.type.Bits< B extends Bits< B >.make ( boolean  any,
long[]  bits 
)
privateinherited

Definition at line 154 of file Bits.java.

154  {
155  // If a 'parent' bit is set, then no need to have any child bits set.
156  Tree<B> tree = tree();
157  // TODO: Run this loop backwards, avoids most tree-walks; lowers O(n log n) to O(n).
158  for( int i=0; i<bits.length; i++ ) { // For all words
159  long l = bits[i];
160  if( l!=0 ) {
161  for( int j=0; j<64; j++ ) // For all bits in word
162  if( (mask(j)&l) != 0 ) {
163  int par = (i<<6)+j; // Kid index
164  while( (par = tree.parent(par)) != 0 ) // Walk parent chain
165  if( test(bits,par) ) // If parent set
166  { bits[i]&=~mask(j); break; } // then clear kid
167  }
168  }
169  }
170 
171  // Remove any trailing empty words
172  int len = bits.length;
173  while( len > 1 && bits[len-1]==0 ) len--;
174  if( bits.length != len ) bits = Arrays.copyOf(bits,len);
175 
176  // Check for a single bit or NO bits
177  if( check_multi_bits(bits) ) return make_impl(any ? -1 : 1,bits);
178  // Special check for +/-0
179  if( len==1 && bits[0]==1 ) return make_impl(any ? -1 : 1,bits);
180  // Empty is self-dual, ignores 'any'
181  if( len==1 && bits[0]==0 ) return make_impl(0,null);
182  // Single bit
183  int bnum0 = 63 - Long.numberOfLeadingZeros(bits[len-1]);
184  int bnum = bnum0 + ((len-1)<<6);
185  if( any ) bnum = -bnum;
186  return make_impl(bnum,null);
187  }

◆ make() [2/3]

final B com.cliffc.aa.type.Bits< B extends Bits< B >.make ( int  bit)
packageinherited

Definition at line 189 of file Bits.java.

189 { return bit==0 ? make_impl(1,new long[]{1}) : make_impl(bit,null); }

◆ make() [3/3]

final B com.cliffc.aa.type.Bits< B extends Bits< B >.make ( int...  bits)
inherited

Definition at line 191 of file Bits.java.

191  {
192  int max= 0; // Find max bit
193  for( int bit : bits ) max=Math.max(max,bit);
194  long[] ls = bits(max); // Big enuf bits
195  for( int bit : bits ) or(ls,bit);
196  return make(false,ls);
197  }

◆ make0()

static BitsAlias com.cliffc.aa.type.BitsAlias.make0 ( int  bit)
static

◆ make_impl()

BitsAlias com.cliffc.aa.type.BitsAlias.make_impl ( int  con,
long[]  bits 
)
package

Definition at line 13 of file BitsAlias.java.

13  {
14  BitsAlias b1 = FREE;
15  if( b1 == null ) b1 = new BitsAlias();
16  else FREE = null;
17  b1.init(con,bits);
18  BitsAlias b2 = INTERN.get(b1);
19  if( b2 != null ) { FREE = b1; return b2; }
20  else { INTERN.put(b1,b1); return b1; }
21  }

References com.cliffc.aa.type.Bits< BitsAlias >.bits(), com.cliffc.aa.type.BitsAlias.FREE, com.cliffc.aa.type.Bits< B extends Bits< B >.init(), and com.cliffc.aa.type.BitsAlias.INTERN.

Here is the call graph for this function:

◆ mask()

static long com.cliffc.aa.type.Bits< B extends Bits< B >.mask ( long  i)
staticprivateinherited

Definition at line 200 of file Bits.java.

200 { return 1L<<(i&63); }

◆ max()

int com.cliffc.aa.type.Bits< B extends Bits< B >.max
inherited

Definition at line 284 of file Bits.java.

284  {
285  return _bits==null ? Math.abs(_con) : (63 - Long.numberOfLeadingZeros(_bits[_bits.length-1]))+((_bits.length-1)<<6);
286  }

◆ may_nil()

boolean com.cliffc.aa.type.Bits< B extends Bits< B >.may_nil
packageinherited

Definition at line 209 of file Bits.java.

209 { return _con==-1 && _bits != null && ((_bits[0]&1) == 1); }

◆ meet()

B com.cliffc.aa.type.Bits< B extends Bits< B >.meet ( final B  bs)
inherited

Definition at line 298 of file Bits.java.

298  {
299  if( this==bs ) return (B)this;
300  B full = ALL(); // Subclass-specific version of full
301  if( this==full || bs==full ) return full;
302  B any = ANY(); // Subclass-specific version of any
303  if( this==any ) return bs;
304  if( bs ==any ) return (B)this;
305  // Empty is a little odd; similar to meeting two JOIN sets with nothing in
306  // common - it is on the center, and forces above values to fall, and
307  // itself falls to below values.
308  if( is_empty() ) return bs.above_center() ? (B)this : bs;
309  if( bs.is_empty() ) return above_center() ? bs : (B)this;
310 
311  long[] bits0 = _bits, bits1 = bs._bits;
312  int con0 = Math.abs(_con), con1 = Math.abs(bs._con);
313 
314  // Expand any single bits
315  if( bits0==null ) or(bits0=bits(con0), con0);
316  if( bits1==null ) or(bits1=bits(con1), con1);
317  con0 = _con < 0 ? -1 : 1;
318  con1 = bs._con < 0 ? -1 : 1;
319 
320  // Bigger in bits0
321  if( bits0.length < bits1.length ) { long[] tmp=bits0; bits0=bits1; bits1=tmp; int t=con0; con0=con1; con1=t; }
322  // Both meets? Set-union
323  if( con0 == 1 && con1 == 1 ) {
324  long[] bits = bits0.clone(); // Clone larger
325  for( int i=0; i<bits1.length; i++ ) // OR in smaller bits
326  bits[i] |= bits1[i];
327  return make(false,bits); // This will remove parent/child dups
328  }
329 
330  // Both joins? Set-intersection
331  Tree<B> tree = tree();
332  if( con0 == -1 && con1 == -1 ) {
333  long[] bits = new long[bits0.length];// Result array
334  join(tree,bits0,bits1,bits); // Merge left into right
335  join(tree,bits1,bits0,bits); // Merge right into left
336  // Nil is not part of the parent tree, so needs to be set explicitly
337  if( (bits0[0]&1)==1 && (bits1[0]&1)==1 ) bits[0]|=1;
338  // Just the intersection, which may be empty.
339  return make(true,bits);
340  }
341 
342  // Mixed meet/join. Toss away the join, keep only the meet bits.
343  return above_center() ? bs : (B)this;
344  }

◆ meet_nil()

B com.cliffc.aa.type.Bits< B extends Bits< B >.meet_nil
inherited

Definition at line 212 of file Bits.java.

212  {
213  if( above_center() ) return make(0); // Crossing centerline, drop all above bits, just [0]
214  if( test(0) ) return (B)this;// Already has nil
215  long[] bs = _bits;
216  if( bs==null ) // Is a single compressed bit
217  or(bs = bits(Math.abs(_con)),Math.abs(_con)); // Decompress single bit into array
218  else bs = _bits.clone(); // Make a private set
219  bs[0] |= 1; // Set nil
220  return make(false,bs); // Its below center now, even if the original was above
221  }

◆ new_alias()

◆ next_kid()

static int com.cliffc.aa.type.BitsAlias.next_kid ( int  alias,
int  kid 
)
static

Definition at line 66 of file BitsAlias.java.

66 { return TREE.next_kid(alias,kid); }

References com.cliffc.aa.type.BitsAlias.TREE.

Referenced by com.cliffc.aa.type.TypeStruct._dull(), com.cliffc.aa.type.TypeMem.all_reaching_aliases(), com.cliffc.aa.type.TypeMem.ld(), and com.cliffc.aa.type.TypeMem.update().

Here is the caller graph for this function:

◆ not_nil()

B com.cliffc.aa.type.Bits< B extends Bits< B >.not_nil
packageinherited

Definition at line 246 of file Bits.java.

246  {
247  if( !above_center() || _bits == null ) return (B)this; // Some constant not-nil
248  if( !test(_bits,0) ) return (B)this; // No nil choice
249  long[] bs = _bits.clone(); // Keep all other bits
250  and(bs,0); // remove nil choice
251  return make(true,bs); // Choices without nil
252  }

◆ oob()

TypeObj com.cliffc.aa.type.Bits< B extends Bits< B >.oob ( TypeObj  t)
inherited

Definition at line 397 of file Bits.java.

397 { return above_center() ? (TypeObj)t.dual() : t; }

◆ or()

BitsAlias com.cliffc.aa.type.BitsAlias.or ( int  bit)

Definition at line 73 of file BitsAlias.java.

73 { return set(bit); }

◆ overlaps()

boolean com.cliffc.aa.type.Bits< B extends Bits< B >.overlaps ( Bits< B >  bs)
inherited

Definition at line 382 of file Bits.java.

382  {
383  for( int alias : this )
384  for( int kid=alias; kid!=0; kid = tree().next_kid(alias,kid) )
385  if( bs.test_recur(kid) )
386  return true;
387  return false;
388  }

◆ parent()

static int com.cliffc.aa.type.BitsAlias.parent ( int  kid)
static

Definition at line 59 of file BitsAlias.java.

59 { return TREE.parent(kid); }

References com.cliffc.aa.type.BitsAlias.TREE.

Referenced by com.cliffc.aa.node.FunNode.split_callers().

Here is the caller graph for this function:

◆ reset_to_init0()

static void com.cliffc.aa.type.BitsAlias.reset_to_init0 ( )
static

Definition at line 64 of file BitsAlias.java.

64 { TREE.reset_to_init0(); }

References com.cliffc.aa.type.BitsAlias.TREE.

Referenced by com.cliffc.aa.HM.HM8.reset(), com.cliffc.aa.HM.HM9.reset(), com.cliffc.aa.HM.HM.reset(), and com.cliffc.aa.Env.top_reset().

Here is the caller graph for this function:

◆ set()

B com.cliffc.aa.type.Bits< B extends Bits< B >.set ( int  bit)
inherited

Definition at line 264 of file Bits.java.

264  {
265  if( test(bit) ) return (B)this;
266  B b = make(bit);
267  if( this == EMPTY() ) return b;
268  return meet(b);
269  }

◆ set_alias()

static int com.cliffc.aa.type.BitsAlias.set_alias ( int  par)
staticprivate

Definition at line 77 of file BitsAlias.java.

77 { return TREE.split(par); }

References com.cliffc.aa.type.BitsAlias.TREE.

Referenced by com.cliffc.aa.type.BitsAlias.new_alias(), and com.cliffc.aa.type.BitsAlias.type_alias().

Here is the caller graph for this function:

◆ str()

SB com.cliffc.aa.type.Bits< B extends Bits< B >.str ( SB  sb)
inherited

Definition at line 134 of file Bits.java.

134  {
135  if( _bits==null ) {
136  if( _con== 0 ) return sb.p("[]"); // EMPTY
137  if( _con== 1 ) return sb.p("[ALL]");
138  if( _con==-1 ) return sb.p("[ANY]");
139  return sb.p('[').p(_con).p(']');
140  }
141  sb.p('[');
142  if( above_center() ) sb.p('~');
143  char sep = above_center()?'+':',';
144  if( test(_bits,1) ) {
145  if( test(_bits,0) ) sb.p('0').p(sep);
146  return sb.p(above_center() ? "ANY]" : "ALL]");
147  }
148  for( Integer idx : this ) sb.p(idx).p(sep);
149  return sb.unchar().p(']');
150  }

◆ strip_nil()

B com.cliffc.aa.type.Bits< B extends Bits< B >.strip_nil
inherited

Definition at line 273 of file Bits.java.

273  {
274  if( _bits == null ) return (B)this; // Should not be a nil to remove
275  if( (_bits[0] &1)==0 ) return (B) this; // No nil
276  long[] bs = _bits.clone();
277  bs[0] &= ~1; // Strip nil
278  return make(_con==-1,bs);
279  }

◆ subtract()

Bits<B> com.cliffc.aa.type.Bits< B extends Bits< B >.subtract ( Bits< B >  bs)
inherited

Definition at line 374 of file Bits.java.

374  {
375  Bits<B> bs0 = this;
376  for( int alias : this )
377  for( int kid=alias; kid!=0; kid = tree().next_kid(alias,kid) )
378  if( bs.test_recur(kid) )
379  bs0 = bs0.clear(kid);
380  return bs0;
381  }

◆ test() [1/2]

boolean com.cliffc.aa.type.Bits< B extends Bits< B >.test ( int  i)
inherited

Definition at line 226 of file Bits.java.

226  {
227  if( _bits==null ) return i!=0 && i==Math.abs(_con);
228  int idx = idx(i);
229  return idx < _bits.length && test(_bits, i);
230  }

◆ test() [2/2]

static boolean com.cliffc.aa.type.Bits< B extends Bits< B >.test ( long[]  bits,
int  i 
)
staticprivateinherited

Definition at line 224 of file Bits.java.

224 { return idx(i) < bits.length && (bits[idx(i)]&mask(i))!=0; }

◆ test_recur()

boolean com.cliffc.aa.type.Bits< B extends Bits< B >.test_recur ( int  i)
inherited

Definition at line 232 of file Bits.java.

232  {
233  if( test(i) ) return true;
234  Tree<B> tree = tree();
235  while( (i = tree.parent(i)) != 0 )
236  if( test(i) )
237  return true;
238  return false;
239  }

◆ toString()

String com.cliffc.aa.type.Bits< B extends Bits< B >.toString
inherited

Definition at line 133 of file Bits.java.

133 { return str(new SB()).toString(); }

◆ tree()

Tree<BitsAlias> com.cliffc.aa.type.BitsAlias.tree ( )

Definition at line 24 of file BitsAlias.java.

24 { return TREE; }

References com.cliffc.aa.type.BitsAlias.TREE.

◆ type_alias()

static int com.cliffc.aa.type.BitsAlias.type_alias ( int  par)
static

Definition at line 76 of file BitsAlias.java.

76 { return set_alias(par); }

References com.cliffc.aa.type.BitsAlias.set_alias().

Referenced by com.cliffc.aa.type.TestType.testOOPsNulls(), com.cliffc.aa.type.TestType.testStructTuple(), com.cliffc.aa.Parse.tstmt(), and com.cliffc.aa.Parse.type0().

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

Member Data Documentation

◆ _bits

long [] com.cliffc.aa.type.Bits< B extends Bits< B >._bits
packageinherited

Definition at line 68 of file Bits.java.

◆ _con

int com.cliffc.aa.type.Bits< B extends Bits< B >._con
packageinherited

Definition at line 69 of file Bits.java.

◆ _hash

int com.cliffc.aa.type.Bits< B extends Bits< B >._hash
packageinherited

Definition at line 70 of file Bits.java.

◆ AARY

◆ ABC

final int com.cliffc.aa.type.BitsAlias.ABC
staticpackage

Definition at line 25 of file BitsAlias.java.

Referenced by com.cliffc.aa.node.TestNodeSmall.tmem().

◆ ALL

final int com.cliffc.aa.type.BitsAlias.ALL
static

◆ ANY

BitsAlias com.cliffc.aa.type.BitsAlias.ANY
staticpackage

Definition at line 27 of file BitsAlias.java.

◆ ARY

final int com.cliffc.aa.type.BitsAlias.ARY
staticpackage

Definition at line 25 of file BitsAlias.java.

◆ ARYBITS

BitsAlias com.cliffc.aa.type.BitsAlias.ARYBITS
staticpackage

Definition at line 27 of file BitsAlias.java.

◆ ARYBITS0

BitsAlias com.cliffc.aa.type.BitsAlias.ARYBITS0
staticpackage

Definition at line 26 of file BitsAlias.java.

Referenced by com.cliffc.aa.type.TypeMemPtr.widen().

◆ EMPTY

◆ FREE

BitsAlias com.cliffc.aa.type.BitsAlias.FREE =null
staticprivate

Definition at line 12 of file BitsAlias.java.

Referenced by com.cliffc.aa.type.BitsAlias.make_impl().

◆ FULL

◆ INTERN

final HashMap<BitsAlias,BitsAlias> com.cliffc.aa.type.BitsAlias.INTERN = new HashMap<>()
staticprivate

Definition at line 11 of file BitsAlias.java.

Referenced by com.cliffc.aa.type.BitsAlias.make_impl().

◆ NIL

◆ NZERO

BitsAlias com.cliffc.aa.type.BitsAlias.NZERO
staticpackage

◆ REC

◆ RECORD_BITS

◆ RECORD_BITS0

BitsAlias com.cliffc.aa.type.BitsAlias.RECORD_BITS0
staticpackage

◆ STR

final int com.cliffc.aa.type.BitsAlias.STR
staticpackage

◆ STRBITS

◆ STRBITS0

BitsAlias com.cliffc.aa.type.BitsAlias.STRBITS0
staticpackage

Definition at line 26 of file BitsAlias.java.

Referenced by com.cliffc.aa.type.TypeMemPtr.widen().

◆ TREE

◆ XNIL

BitsAlias com.cliffc.aa.type.BitsAlias.XNIL
staticpackage

The documentation for this class was generated from the following file:
com.cliffc.aa.type.Bits< BitsAlias >::bits
static long[] bits(int b)
Definition: Bits.java:283
com.cliffc.aa.type.Bits< BitsAlias >::dual
B dual()
Definition: Bits.java:368
com.cliffc.aa.type.BitsAlias.FULL
static BitsAlias FULL
Definition: BitsAlias.java:27
com.cliffc.aa.type.Bits< BitsAlias >::ANY
abstract B ANY()
com.cliffc.aa.type.Bits< BitsAlias >::str
SB str(SB sb)
Definition: Bits.java:134
com.cliffc.aa.type.BitsAlias.set_alias
static int set_alias(int par)
Definition: BitsAlias.java:77
com.cliffc.aa.type.Bits< BitsAlias >::check
boolean check()
Definition: Bits.java:89
com.cliffc.aa.type.Bits< BitsAlias >::make
B make(boolean any, long[] bits)
Definition: Bits.java:154
com.cliffc.aa.type.BitsAlias.INTERN
static final HashMap< BitsAlias, BitsAlias > INTERN
Definition: BitsAlias.java:11
com.cliffc.aa.type.BitsAlias.ANY
static BitsAlias ANY
Definition: BitsAlias.java:27
com.cliffc.aa.type.Bits< BitsAlias >::mask
static long mask(long i)
Definition: Bits.java:200
com.cliffc.aa.type.BitsAlias.TREE
static final Bits.Tree< BitsAlias > TREE
Definition: BitsAlias.java:23
com.cliffc.aa.type.Bits< BitsAlias >::test
static boolean test(long[] bits, int i)
Definition: Bits.java:224
com.cliffc.aa.type.Bits< BitsAlias >::check_multi_bits
static boolean check_multi_bits(long[] bits)
Definition: Bits.java:105
com.cliffc.aa.type.Bits< BitsAlias >::above_center
boolean above_center()
Definition: Bits.java:204
com.cliffc.aa.type.Bits< BitsAlias >::_bits
long[] _bits
Definition: Bits.java:68
com.cliffc.aa.type.Bits< BitsAlias >::join
static void join(Tree tree, long[] bits0, long[] bits1, long[] bits2)
Definition: Bits.java:349
com.cliffc.aa.type.Bits.init
void init(int con, long[] bits)
Definition: Bits.java:80
com.cliffc.aa.type.Bits< BitsAlias >::_hash
int _hash
Definition: Bits.java:70
com.cliffc.aa.type.Bits< BitsAlias >::_con
int _con
Definition: Bits.java:69
com.cliffc.aa.type.Bits< BitsAlias >::idx
static int idx(long i)
Definition: Bits.java:199
com.cliffc.aa.type.BitsAlias.EMPTY
static BitsAlias EMPTY
Definition: BitsAlias.java:27
com.cliffc.aa.type.BitsAlias.FREE
static BitsAlias FREE
Definition: BitsAlias.java:12
com.cliffc.aa.type.Bits< BitsAlias >::max
int max()
Definition: Bits.java:284
com.cliffc.aa.type.Bits< BitsAlias >::and
static void and(long[] bits, long con)
Definition: Bits.java:282
com.cliffc.aa.type.Bits< BitsAlias >::make_impl
abstract B make_impl(int con, long[] bits)
com.cliffc.aa.type.Bits< BitsAlias >::EMPTY
abstract B EMPTY()
com.cliffc.aa.type.Bits< BitsAlias >::tree
abstract Tree< B > tree()
com.cliffc.aa.type.Bits< BitsAlias >::ALL
abstract B ALL()
com.cliffc.aa.type.Bits< BitsAlias >::or
static void or(long[] bits, long con)
Definition: Bits.java:281
com.cliffc.aa.type.Bits< BitsAlias >::meet
B meet(final B bs)
Definition: Bits.java:298
com.cliffc.aa.type.BitsAlias.NZERO
static BitsAlias NZERO
Definition: BitsAlias.java:27
com.cliffc.aa.type.Bits< BitsAlias >::is_nil
boolean is_nil()
Definition: Bits.java:208
com.cliffc.aa.util.SB.toString
String toString()
Definition: SB.java:62
com.cliffc.aa.type.Bits< BitsAlias >::is_empty
boolean is_empty()
Definition: Bits.java:207