aa
com.cliffc.aa.type.TypeStruct Class Reference

A memory-based collection of optionally named fields. More...

Inheritance diagram for com.cliffc.aa.type.TypeStruct:
[legend]
Collaboration diagram for com.cliffc.aa.type.TypeStruct:
[legend]

Classes

class  TPair
 

Public Member Functions

boolean above_center ()
 
TypeStruct add_fld (String name, Access mutable)
 
TypeStruct add_fld (String name, Access mutable, Type tfld)
 
TypeStruct approx (int cutoff, int alias)
 
Type at (int idx)
 
TypeStruct close ()
 
int compute_hash ()
 
TypeStruct crush ()
 
boolean cycle_equals (Type o)
 
boolean equals (Object o)
 
TypeFld fld (int idx)
 
int fld_find (String fld)
 
TypeFld[] flds ()
 
TypeStruct install_cyclic (Ary< Type > reachs)
 
boolean is_con ()
 
byte isBitShape (Type t)
 
Type last ()
 
int len ()
 
TypeStruct make_from (String name)
 
TypeStruct make_from (Type head, TypeMem mem, VBitSet visit)
 
TypeStruct make_from (TypeFld[] flds)
 
TypeStruct make_from_flds (TypeStruct ts)
 
boolean may_be_con ()
 
boolean may_nil ()
 
Type meet_loop (Type t2)
 
Type meet_nil (Type nil)
 
boolean must_nil ()
 
Ary< Typereachable ()
 
TypeStruct set_fld (int i, Type t, Access ff)
 
SB str (SB sb, VBitSet dups, TypeMem mem, boolean debug)
 
TypeStruct update (Access fin, String fld, Type val)
 
TypeObj update (TypeInt idx, Type val)
 
void walk (Predicate< Type > p)
 
TypeStruct widen ()
 

Static Public Member Functions

static TypeFld[] flds (Type t1)
 
static TypeFld[] flds (Type t1, Type t2)
 
static TypeStruct make (String fld_name, Type t)
 
static TypeStruct make (String fld_name, Type t, Access a)
 
static TypeStruct make (String name, boolean any, TypeFld[] flds, boolean open)
 
static TypeStruct make (Type... ts)
 
static TypeStruct make (TypeFld... flds)
 
static TypeStruct malloc (String name, boolean any, TypeFld[] flds, boolean open)
 
static TypeStruct open (Type tdisp)
 
static TypeStruct shrink (Ary< Type > reaches, TypeStruct tstart)
 
static TypeFld[] tups (Type t1, Type t2)
 
static TypeFld[] tups (Type t1, Type t2, Type t3)
 

Public Attributes

boolean _cyclic
 
boolean _open
 

Static Public Attributes

static final TypeStruct A = make("a",TypeFlt.FLT64)
 
static final TypeStruct ALLSTRUCT = make("",false,new TypeFld[0],true )
 
static final TypeStruct ANYSTRUCT = make("",true ,new TypeFld[0],false)
 
static final TypeStruct ARW = make("a",TypeFlt.FLT64,Access.RW)
 
static final TypeStruct FLT64 = make(flds(TypeFlt.FLT64))
 
static final TypeStruct INT64_INT64 = make(flds(TypeInt.INT64,TypeInt.INT64))
 
static final TypeObj ISUSED
 
static final TypeStruct NAMEPT = make("Point:",false,POINT._flds,false)
 
static final TypeObj OBJ
 
static final TypeStruct POINT = make(flds(TypeFlt.FLT64,TypeFlt.FLT64))
 
static final NonBlockingHashMapLong< TypeUF = new NonBlockingHashMapLong<>()
 
static final TypeObj UNUSED
 
static final TypeObj XOBJ
 

Protected Member Functions

init (byte type, String name, boolean any, boolean use)
 
TypeStruct xdual ()
 
Type xmeet (Type t)
 

Package Functions

boolean any_modifiable ()
 
boolean contains (Type t, VBitSet bs)
 
TypeObj flatten_fields ()
 
boolean intern_check1 ()
 
boolean is_display ()
 
TypeStruct rdual ()
 
TypeObj remove_other_flds (String fld, Type live)
 
TypeStruct repeats_in_cycles ()
 
TypeStruct repeats_in_cycles (TypeStruct head, VBitSet bs)
 

Static Package Functions

 [static initializer]
 
static boolean isDigit (char c)
 
static TypeMemPtr sharpen (TypeMem mem, TypeMemPtr dull)
 

Package Attributes

boolean _any
 
boolean _use
 

Static Package Attributes

static final TypeStruct TFLT64 = make(".",TypeFlt.FLT64)
 
static final TypeStruct[] TYPES = new TypeStruct[]{ALLSTRUCT,POINT,NAMEPT,A,C0,D1,ARW,INT64_INT64}
 

Private Member Functions

TypeStruct _clone ()
 
int cmp (TypeStruct t)
 
boolean cycle_equals0 (TypeStruct t)
 
TypeStruct cyclic_meet (TypeStruct that)
 
TypeStruct find_other ()
 
BitSet get_cyclic ()
 
TypeStruct hashcons_freeS ()
 
TypeStruct init (String name, boolean any, TypeFld[] flds, boolean open)
 
boolean is_tup ()
 
int len (TypeStruct tt)
 
int len0 (TypeStruct tmax)
 
void mark_cyclic (BitSet bcs, Ary< Type > reaches)
 
void push (Ary< Type > work, Type t)
 
TypeStruct update (Access fin, String fld, Type val, boolean precise)
 
TypeStruct xmeet1 (TypeStruct tmax, boolean is_loop)
 

Static Private Member Functions

static void _dull (TypeMem mem, TypeMemPtr dull, HashMap< BitsAlias, TypeMemPtr > dull_cache)
 
static boolean _is_sharp (Type t)
 
static TypeMemPtr _sharp (TypeMem mem, TypeMemPtr dull, HashMap< BitsAlias, TypeMemPtr > dull_cache)
 
static Type ax_impl_fptr (int alias, int cutoff, Ary< TypeStruct > cutoffs, int d, TypeStruct dold, TypeFunPtr old)
 
static TypeMemPtr ax_impl_ptr (int alias, int cutoff, Ary< TypeStruct > cutoffs, int d, TypeStruct dold, TypeMemPtr old)
 
static TypeStruct ax_impl_struct (int alias, boolean isnews, int cutoff, Ary< TypeStruct > cutoffs, int d, TypeStruct dold, TypeStruct old)
 
static Type ax_meet (BitSetSparse bs, Type nt, Type old)
 
static boolean check_interned (Ary< Type > reachs)
 
static boolean check_uf (Ary< Type > reaches)
 
static BitSet get_cyclic (BitSet bcs, VBitSet bs, Ary< Type > stack, Type t)
 
static boolean post_mod (Type t)
 
static< T extends Type > T ufind (T t)
 
static< T extends Type > T union (T lost, T kept)
 

Private Attributes

TypeFld[] _flds
 

Static Private Attributes

static final TypeStruct C0 = make("c",TypeInt.FALSE)
 
static final Ary< TypeStructCYCLES = new Ary<>(new TypeStruct[0])
 
static final TypeStruct D1 = make("d",TypeInt.TRUE )
 
static final IHashMap DUPS = new IHashMap()
 
static final HashMap< TPair, TypeStructMEETS0 = new HashMap<>()
 
static final IHashMap OLD2APX = new IHashMap()
 

Detailed Description

A memory-based collection of optionally named fields.

This is a recursive type, only produced by NewNode and structure or tuple constants. Fields can be indexed by field name or numeric constant (i.e. tuples), but NOT by a general number - thats an Array. Field access mods make a small lattice of: {choice,r/w,final,r-o}. Note that mixing r/w and final moves to r-o and loses the final property.

The recursive type poses some interesting challenges. It is represented as literally a cycle of pointers which must include a TypeStruct (and not a TypeTuple which only roots Types) and a TypeMemPtr (edge) or a TypeFunPtr (display pointer). Type inference involves finding the Meet of two cyclic structures. The cycles will not generally be of the same length. However, each field Meets independently (and fields in one structure but not the other are not in the final Meet). This means we are NOT trying to solve the general problem of graph-equivalence (a known NP hard problem). Instead we can solve each field independently and also intersect across common fields.

When solving across a single field, we will find some prefix and then possibly a cycle - conceptually the type unrolls forever. When doing the Meet we conceptually unroll both types forever, compute the Meet element by element... but when both types have looped, we can stop and the discovered cycle is the Meet's cycle.

TODO: Cleaning up this mess somewhat... A try-with-resources: try( Ary<TypeFld> flds = TypeFld.get_flds()) { while( pred ) flds.push(fld); // Accumulate, drop dups, screw around malloc(... flds ...); // Finally use } // Exit unwinds the get_flds These can be scope-alloced from a free-list. Moving TypeStruct to an UNORDERED list of fields.

Definition at line 50 of file TypeStruct.java.

Member Function Documentation

◆ [static initializer]()

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

◆ _clone()

TypeStruct com.cliffc.aa.type.TypeStruct._clone ( )
private

Definition at line 465 of file TypeStruct.java.

465  {
466  assert interned();
467  TypeFld[] flds = TypeFlds.clone(_flds); // Shallow field clone
468  TypeStruct t = malloc(_name,_any,flds,_open);
469  t._hash = t.compute_hash();
470  return t;
471  }

References com.cliffc.aa.type.TypeObj< TypeStruct >._any, com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeStruct._open, com.cliffc.aa.type.TypeFlds.clone(), com.cliffc.aa.type.TypeStruct.compute_hash(), com.cliffc.aa.type.TypeStruct.flds(), and com.cliffc.aa.type.TypeStruct.malloc().

Referenced by com.cliffc.aa.type.TypeStruct._sharp(), and com.cliffc.aa.type.TypeStruct.cyclic_meet().

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

◆ _dull()

static void com.cliffc.aa.type.TypeStruct._dull ( TypeMem  mem,
TypeMemPtr  dull,
HashMap< BitsAlias, TypeMemPtr dull_cache 
)
staticprivate

Definition at line 909 of file TypeStruct.java.

909  {
910  // Check caches and return
911  if( mem.sharp_get(dull) != null ) return;
912  if( dull_cache.get(dull._aliases) != null ) return;
913  if( dull==NO_DISP || dull==NO_DISP.dual() ) { mem.sharput(dull,dull); return; }
914  // Walk and meet "dull" fields; all TMPs will point to ISUSED (hence are dull).
915  boolean any = dull._aliases.above_center();
916  Type t = any ? TypeObj.ISUSED : TypeObj.UNUSED;
917  for( int alias : dull._aliases )
918  if( alias != 0 )
919  for( int kid=alias; kid != 0; kid=BitsAlias.next_kid(alias,kid) ) {
920  TypeObj x = mem.at(kid);
921  t = any ? t.join(x) : t.meet(x);
922  }
923  TypeMemPtr dptr = dull.make_from((TypeObj)t);
924  if( _is_sharp(t) ) { // If sharp, install and return
925  mem.sharput(dull,dptr);
926  return;
927  }
928  // Install in dull result in dull cache BEFORE recursing. We might see it
929  // again if cyclic types.
930  dull_cache.put(dull._aliases,dptr);
931  // Visit all dull pointers and recursively collect
932  for( TypeFld fld : ((TypeStruct)t)._flds ) {
933  Type tt = fld._t;
934  if( tt instanceof TypeFunPtr ) tt = ((TypeFunPtr)tt)._disp;
935  if( tt instanceof TypeMemPtr )
936  _dull(mem,(TypeMemPtr)tt,dull_cache);
937  }
938  }

References com.cliffc.aa.type.TypeMemPtr._aliases, com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeStruct._is_sharp(), com.cliffc.aa.type.TypeFld._t, com.cliffc.aa.type.Bits< B extends Bits< B >.above_center(), com.cliffc.aa.type.TypeMem.at(), com.cliffc.aa.type.Type< T extends Type< T >.dual(), com.cliffc.aa.type.TypeStruct.fld(), com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.ISUSED, com.cliffc.aa.type.Type< T extends Type< T >.join(), com.cliffc.aa.type.TypeMemPtr.make_from(), com.cliffc.aa.type.Type< T extends Type< T >.meet(), com.cliffc.aa.type.BitsAlias.next_kid(), com.cliffc.aa.type.TypeMem.sharp_get(), com.cliffc.aa.type.TypeMem.sharput(), and com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.UNUSED.

Referenced by com.cliffc.aa.type.TypeStruct.sharpen().

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

◆ _is_sharp()

static boolean com.cliffc.aa.type.TypeStruct._is_sharp ( Type  t)
staticprivate

Definition at line 940 of file TypeStruct.java.

940  {
941  if( !(t instanceof TypeStruct) ) return true;
942  TypeStruct ts = (TypeStruct)t;
943  for( TypeFld fld : ts._flds ) {
944  Type tt = fld._t;
945  assert fld.interned()==tt.interned();
946  if( !tt.interned() || // Not interned internal, then this is not finished
947  (tt instanceof TypeMemPtr && // Or has internal dull pointers
948  ((TypeMemPtr)tt)._obj == TypeObj.ISUSED) )
949  return false;
950  }
951  return true;
952  }

References com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeMemPtr._obj, com.cliffc.aa.type.TypeFld._t, com.cliffc.aa.type.TypeStruct.fld(), com.cliffc.aa.type.Type< T extends Type< T >.interned(), and com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.ISUSED.

Referenced by com.cliffc.aa.type.TypeStruct._dull(), and com.cliffc.aa.type.TypeStruct._sharp().

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

◆ _sharp()

static TypeMemPtr com.cliffc.aa.type.TypeStruct._sharp ( TypeMem  mem,
TypeMemPtr  dull,
HashMap< BitsAlias, TypeMemPtr dull_cache 
)
staticprivate

Definition at line 963 of file TypeStruct.java.

963  {
964  TypeMemPtr sharp = mem.sharp_get(dull);
965  if( sharp != null ) return sharp; // Value returned is sharp and interned
966  TypeMemPtr dptr = dull_cache.get(dull._aliases);
967  if( !dptr.interned() ) // Closed a cycle
968  return dptr; // Not-yet-sharp and not interned; return the work-in-progress
969  // Copy, replace dull with not-interned dull clone. Fields are also cloned, not interned.
970  TypeStruct dts2 = ((TypeStruct)dptr._obj)._clone();
971  TypeMemPtr dptr2 = (TypeMemPtr)dptr.clone();
972  dptr2._obj = dts2; dptr2._hash = dptr2.compute_hash();
973  dull_cache.put(dull._aliases,dptr2);
974  // walk all fields, copy unless TMP.
975  for( int i=0; i<dts2._flds.length; i++ ) {
976  TypeFld dts2_fld = dts2._flds[i];
977  Type t = dts2_fld._t;
978  if( t instanceof TypeMemPtr ) // For TMP, recurse on dull pointers.
979  dts2_fld.setX(_sharp(mem,((TypeMemPtr)t),dull_cache));
980  if( t instanceof TypeFunPtr ) {
981  TypeFunPtr tf = (TypeFunPtr) t;
982  if( tf._disp instanceof TypeMemPtr ) { // Need a pointer to sharpen
983  TypeMemPtr dptr3 = _sharp(mem, (TypeMemPtr) tf._disp, dull_cache);
984  dts2_fld.setX(dptr3.interned() // Sharp return?
985  ? tf.make_from(dptr3) // Make sharp TFP field
986  : tf._sharpen_clone(dptr3)); // Make dull TFP field
987  }
988  }
989  if( dts2_fld._t.interned() )
990  dts2._flds[i] = dts2_fld.hashcons_free();
991  }
992  if( !_is_sharp(dts2) ) return dptr2; // Return the work-in-progress
993  // Then copied field types are all sharp and interned.
994  // Intern the fields themselves.
995  for( int i=0; i<dts2._flds.length; i++ )
996  if( !dts2._flds[i]._t.interned() )
997  dts2._flds[i] = dts2._flds[i].hashcons_free();
998  dull_cache.remove(dull._aliases);// Move the entry from dull cache to sharp cache
999  TypeStruct sts = dts2.hashcons_freeS();
1000  return mem.sharput(dull,dull.make_from(sts));
1001  }

References com.cliffc.aa.type.TypeMemPtr._aliases, com.cliffc.aa.type.TypeStruct._clone(), com.cliffc.aa.type.TypeFunPtr._disp, com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.Type< T extends Type< T >._hash, com.cliffc.aa.type.TypeStruct._is_sharp(), com.cliffc.aa.type.TypeMemPtr._obj, com.cliffc.aa.type.TypeFunPtr._sharpen_clone(), com.cliffc.aa.type.TypeFld._t, com.cliffc.aa.type.Type< T extends Type< T >.clone(), com.cliffc.aa.type.TypeMemPtr.compute_hash(), com.cliffc.aa.type.Type< T extends Type< T >.hashcons_free(), com.cliffc.aa.type.TypeStruct.hashcons_freeS(), com.cliffc.aa.type.Type< T extends Type< T >.interned(), com.cliffc.aa.type.TypeMemPtr.make_from(), com.cliffc.aa.type.TypeFunPtr.make_from(), com.cliffc.aa.type.TypeFld.setX(), com.cliffc.aa.type.TypeMem.sharp_get(), and com.cliffc.aa.type.TypeMem.sharput().

Referenced by com.cliffc.aa.type.TypeStruct.sharpen().

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

◆ above_center()

boolean com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.above_center
inherited

Definition at line 77 of file TypeObj.java.

77 { return _any; }

◆ add_fld() [1/2]

TypeStruct com.cliffc.aa.type.TypeStruct.add_fld ( String  name,
Access  mutable 
)

Definition at line 1021 of file TypeStruct.java.

1021 { return add_fld(name,mutable,Type.SCALAR); }

References com.cliffc.aa.type.TypeStruct.add_fld(), and com.cliffc.aa.type.Type< T extends Type< T >.SCALAR.

Referenced by com.cliffc.aa.type.TypeStruct.add_fld().

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

◆ add_fld() [2/2]

TypeStruct com.cliffc.aa.type.TypeStruct.add_fld ( String  name,
Access  mutable,
Type  tfld 
)

Definition at line 1022 of file TypeStruct.java.

1022  {
1023  assert name==null || Util.eq(name,TypeFld.fldBot) || fld_find(name)==-1;
1024  assert !_any && _open;
1025  TypeFld[] flds = TypeFlds.copyOf(_flds,_flds.length+1);
1026  flds[_flds.length] = TypeFld.make(name==null ? TypeFld.fldBot : name,tfld,mutable,_flds.length);
1027  return make(_name,_any,flds,true);
1028  }

References com.cliffc.aa.type.TypeObj< TypeStruct >._any, com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeStruct._open, com.cliffc.aa.type.TypeFlds.copyOf(), com.cliffc.aa.util.Util.eq(), com.cliffc.aa.type.TypeStruct.fld_find(), com.cliffc.aa.type.TypeFld.fldBot, com.cliffc.aa.type.TypeStruct.flds(), com.cliffc.aa.type.TypeFld.make(), and com.cliffc.aa.type.TypeStruct.make().

Here is the call graph for this function:

◆ any_modifiable()

boolean com.cliffc.aa.type.TypeStruct.any_modifiable ( )
package

Definition at line 1080 of file TypeStruct.java.

1080  {
1081  //if( _open ) return true;
1082  //for( byte b : _flags )
1083  // if( is_modifable(fmod(b)) )
1084  // return true;
1085  //return false;
1086  throw unimpl();
1087  }

◆ approx()

TypeStruct com.cliffc.aa.type.TypeStruct.approx ( int  cutoff,
int  alias 
)

Definition at line 477 of file TypeStruct.java.

477  {
478  boolean shallow=true;
479  for( TypeFld fld : _flds )
480  if( fld._t._type == TMEMPTR ) { shallow=false; break; }
481  if( shallow ) return this; // Fast cutout for boring structs
482 
483  // Scan the old copy for elements that are too deep.
484  // 'Meet' those into the clone at one layer up.
485  RECURSIVE_MEET++;
486  assert UF.isEmpty();
487  assert OLD2APX.isEmpty();
488  TypeStruct apx = ax_impl_struct( alias, true, cutoff, null, 0, this, this );
489  // Remove any leftover internal duplication
490  apx = shrink(apx.reachable(),apx);
491  RECURSIVE_MEET--;
492  TypeStruct rez = this;
493  if( apx != this ) {
494  Ary<Type> reaches = apx.reachable();
495  assert check_uf(reaches);
496  assert !check_interned(reaches);
497  rez = apx.install_cyclic(reaches);
498  assert this.isa(rez);
499  }
500  UF.clear();
501  OLD2APX.clear();
502  return rez;
503  }

References com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeFld._t, com.cliffc.aa.type.Type< T extends Type< T >._type, com.cliffc.aa.type.TypeStruct.ax_impl_struct(), com.cliffc.aa.type.TypeStruct.check_interned(), com.cliffc.aa.type.TypeStruct.check_uf(), com.cliffc.aa.util.IHashMap.clear(), com.cliffc.aa.type.TypeStruct.fld(), com.cliffc.aa.type.TypeStruct.install_cyclic(), com.cliffc.aa.util.IHashMap.isEmpty(), com.cliffc.aa.type.TypeStruct.OLD2APX, com.cliffc.aa.type.TypeStruct.reachable(), com.cliffc.aa.type.TypeStruct.shrink(), and com.cliffc.aa.type.TypeStruct.UF.

Referenced by com.cliffc.aa.HM.TestHM.build_cycle(), com.cliffc.aa.HM.TestHM9.build_cycle(), com.cliffc.aa.HM.TestHM.build_cycle2(), com.cliffc.aa.HM.TestHM9.test36(), com.cliffc.aa.type.TestApprox.testApprox1(), com.cliffc.aa.type.TestApprox.testApprox2(), com.cliffc.aa.type.TestApprox.testApprox3(), com.cliffc.aa.type.TestApprox.testApprox4(), com.cliffc.aa.type.TestApprox.testApprox5(), com.cliffc.aa.type.TestApprox.testApprox6(), com.cliffc.aa.type.TestApprox.testApprox7(), com.cliffc.aa.type.TestApprox.testApprox8(), com.cliffc.aa.type.TestType.testRecursive(), com.cliffc.aa.type.TestType.testType(), com.cliffc.aa.HM.HM9.Struct.val(), and com.cliffc.aa.HM.HM.Struct.val().

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

◆ at()

◆ ax_impl_fptr()

static Type com.cliffc.aa.type.TypeStruct.ax_impl_fptr ( int  alias,
int  cutoff,
Ary< TypeStruct cutoffs,
int  d,
TypeStruct  dold,
TypeFunPtr  old 
)
staticprivate

Definition at line 569 of file TypeStruct.java.

569  {
570  assert old.interned();
571  // TODO: If past depth, never use OLD, forces maximal cloning for the
572  // last step, as the last step will be MEET with an arbitrary structure.
573  // Use alternative OLD past depth, to keep looping unrelated types
574  // folding up. Otherwise unrelated types might expand endlessly.
575  TypeFunPtr nt = OLD2APX.get(old);
576  if( nt != null ) return ufind(nt);
577  if( old._disp==Type.ANY )
578  return old; // no ufind because its old
579 
580  // Walk internal structure, meeting into the approximation
581  TypeFunPtr nmp = (TypeFunPtr)old.clone();
582  OLD2APX.put(old,nmp);
583  nmp._disp = ax_impl_ptr(alias,cutoff,cutoffs,d,dold,(TypeMemPtr)old._disp);
584  OLD2APX.put(old,null); // Do not keep sharing the "tails"
585  return nmp;
586  }

References com.cliffc.aa.type.TypeFunPtr._disp, com.cliffc.aa.type.Type< T extends Type< T >.ANY, com.cliffc.aa.type.TypeStruct.ax_impl_ptr(), com.cliffc.aa.type.Type< T extends Type< T >.clone(), com.cliffc.aa.util.IHashMap.get(), com.cliffc.aa.type.Type< T extends Type< T >.interned(), com.cliffc.aa.type.TypeStruct.OLD2APX, com.cliffc.aa.util.IHashMap.put(), and com.cliffc.aa.type.TypeStruct.ufind().

Referenced by com.cliffc.aa.type.TypeStruct.ax_impl_struct().

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

◆ ax_impl_ptr()

static TypeMemPtr com.cliffc.aa.type.TypeStruct.ax_impl_ptr ( int  alias,
int  cutoff,
Ary< TypeStruct cutoffs,
int  d,
TypeStruct  dold,
TypeMemPtr  old 
)
staticprivate

Definition at line 546 of file TypeStruct.java.

546  {
547  assert old.interned();
548  // TODO: If past depth, never use OLD, forces maximal cloning for the
549  // last step, as the last step will be MEET with an arbitrary structure.
550  // Use alternative OLD past depth, to keep looping unrelated types
551  // folding up. Otherwise unrelated types might expand endlessly.
552  TypeMemPtr nt = OLD2APX.get(old);
553  if( nt != null ) return ufind(nt);
554 
555  // Walk internal structure, meeting into the approximation
556  TypeMemPtr nmp = (TypeMemPtr)old.clone();
557  OLD2APX.put(old,nmp);
558  if( old._obj instanceof TypeStruct )
559  nmp._obj = ax_impl_struct(alias,nmp._aliases.test(alias),cutoff,cutoffs,d,dold,(TypeStruct)old._obj);
560  else if( old._obj == TypeObj.XOBJ || old._obj==nmp._obj )
561  ; // No change to nmp._obj
562  else if( old._obj == TypeObj.OBJ )
563  nmp._obj = TypeObj.OBJ; // Falls hard
564  else
565  throw com.cliffc.aa.AA.unimpl();
566  OLD2APX.put(old,null); // Do not keep sharing the "tails"
567  return nmp;
568  }

References com.cliffc.aa.type.TypeMemPtr._aliases, com.cliffc.aa.type.TypeMemPtr._obj, com.cliffc.aa.type.TypeStruct.ax_impl_struct(), com.cliffc.aa.type.Type< T extends Type< T >.clone(), com.cliffc.aa.util.IHashMap.get(), com.cliffc.aa.type.Type< T extends Type< T >.interned(), com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.OBJ, com.cliffc.aa.type.TypeStruct.OLD2APX, com.cliffc.aa.util.IHashMap.put(), com.cliffc.aa.type.Bits< B extends Bits< B >.test(), com.cliffc.aa.type.TypeStruct.ufind(), com.cliffc.aa.AA.unimpl(), and com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.XOBJ.

Referenced by com.cliffc.aa.type.TypeStruct.ax_impl_fptr(), and com.cliffc.aa.type.TypeStruct.ax_impl_struct().

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

◆ ax_impl_struct()

static TypeStruct com.cliffc.aa.type.TypeStruct.ax_impl_struct ( int  alias,
boolean  isnews,
int  cutoff,
Ary< TypeStruct cutoffs,
int  d,
TypeStruct  dold,
TypeStruct  old 
)
staticprivate

Definition at line 507 of file TypeStruct.java.

507  {
508  assert old.interned();
509  // TODO: If past depth, never use OLD, forces maximal cloning for the
510  // last step, as the last step will be MEET with an arbitrary structure.
511  // Use alternative OLD past depth, to keep looping unrelated types
512  // folding up. Otherwise unrelated types might expand endlessly.
513  TypeStruct nt = OLD2APX.get(old);
514  if( nt != null ) return ufind(nt);
515 
516  if( isnews ) { // Depth-increasing struct?
517  if( d==cutoff ) { // Cannot increase depth any more
518  cutoffs.push(old); // Save cutoff point for later MEET
519  return OLD2APX.get(dold); // Return last valid depth - forces cycle
520  } else {
521  assert cutoffs == null; // Approaching max depth, make a place to record cutoffs
522  if( d+1==cutoff ) cutoffs = new Ary<>(TypeStruct.class);
523  }
524  d++; // Increase depth
525  dold = old; // And this is the last TypeStruct seen at this depth
526  }
527  // Clone the old, to make the approximation into
528  TypeStruct nts = (TypeStruct)old.clone();
529  nts._flds = TypeFlds.clone(old._flds);
530  OLD2APX.put(old,nts);
531  for( int i=0; i<old._flds.length; i++ ) // Fill clone with approximation
532  if( old._flds[i]._t._type == TMEMPTR )
533  nts._flds[i].setX(ax_impl_ptr (alias,cutoff,cutoffs,d,dold,(TypeMemPtr)old._flds[i]._t));
534  else if( old._flds[i]._t._type == TFUNPTR )
535  nts._flds[i].setX(ax_impl_fptr(alias,cutoff,cutoffs,d,dold,(TypeFunPtr)old._flds[i]._t));
536  if( isnews && d==cutoff ) {
537  while( !cutoffs.isEmpty() ) { // At depth limit, meet with cutoff to make the approximation
538  Type mt = ax_meet(new BitSetSparse(), nts,cutoffs.pop());
539  assert mt==nts;
540  }
541  }
542  OLD2APX.put(old,null); // Do not keep sharing the "tails"
543  return nts;
544  }

References com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeFld._t, com.cliffc.aa.type.Type< T extends Type< T >._type, com.cliffc.aa.type.TypeStruct.ax_impl_fptr(), com.cliffc.aa.type.TypeStruct.ax_impl_ptr(), com.cliffc.aa.type.TypeStruct.ax_meet(), com.cliffc.aa.type.TypeFlds.clone(), com.cliffc.aa.util.IHashMap.get(), com.cliffc.aa.util.Ary< E >.isEmpty(), com.cliffc.aa.type.TypeStruct.OLD2APX, com.cliffc.aa.util.Ary< E >.pop(), com.cliffc.aa.util.Ary< E >.push(), com.cliffc.aa.util.IHashMap.put(), com.cliffc.aa.type.TypeFld.setX(), and com.cliffc.aa.type.TypeStruct.ufind().

Referenced by com.cliffc.aa.type.TypeStruct.approx(), and com.cliffc.aa.type.TypeStruct.ax_impl_ptr().

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

◆ ax_meet()

static Type com.cliffc.aa.type.TypeStruct.ax_meet ( BitSetSparse  bs,
Type  nt,
Type  old 
)
staticprivate

Definition at line 591 of file TypeStruct.java.

591  {
592  assert old.interned();
593  if( nt._hash != 0 && nt.interned() ) return nt.meet(old);
594  assert nt._hash==0; // Not definable yet
595  nt = ufind(nt);
596  if( nt == old ) return old;
597  if( bs.tset(nt._uid,old._uid) ) return nt; // Been there, done that
598 
599  // TODO: Make a non-recursive "meet into".
600  // Meet old into nt
601  switch( nt._type ) {
602  case TSCALAR: break; // Nothing to meet
603  case TFUNPTR: {
604  TypeFunPtr nptr = (TypeFunPtr)nt;
605  if( old == Type.NIL || old == Type.XNIL ) return nptr.ax_meet_nil(old);
606  if( old == Type.SCALAR )
607  return union(nt,old); // Result is a scalar, which changes the structure of the new types.
608  if( old == Type.XSCALAR ) break; // Result is the nt unchanged
609  if( !(old instanceof TypeFunPtr) ) throw AA.unimpl(); // Not a xscalar, not a funptr, probably falls to scalar
610  TypeFunPtr optr = (TypeFunPtr)old;
611  nptr._fidxs = nptr._fidxs.meet(optr._fidxs);
612  // While structs normally meet, function args *join*, although the return still meets.
613  nptr._disp = ax_meet(bs,nptr._disp,optr._disp);
614  break;
615  }
616  case TMEMPTR: {
617  TypeMemPtr nptr = (TypeMemPtr)nt;
618  if( old == Type.NIL || old == Type.XNIL ) return nptr.ax_meet_nil(old);
619  if( old == Type.SCALAR )
620  return union(nt,old); // Result is a scalar, which changes the structure of the new types.
621  if( old == Type.XSCALAR || old == Type.ANY ) break; // Result is the nt unchanged
622  if( !(old instanceof TypeMemPtr) ) throw AA.unimpl(); // Not a xscalar, not a memptr, probably falls to scalar
623  TypeMemPtr optr = (TypeMemPtr)old;
624  nptr._aliases = nptr._aliases.meet(optr._aliases);
625  nptr._obj = (TypeObj)ax_meet(bs,nptr._obj,optr._obj);
626  break;
627  }
628  case TSTRUCT:
629  if( old == TypeObj. OBJ || old == TypeObj.ISUSED ) { nt = old; break; }
630  if( old == TypeObj.XOBJ || old == TypeObj.UNUSED ) break; // No changes, take nt as it is
631  if( !(old instanceof TypeStruct) ) throw AA.unimpl();
632  TypeStruct ots = (TypeStruct)old, nts = (TypeStruct)nt;
633  // Compute a new target length. Generally size is unchanged, but will
634  // change if mixing structs.
635  int len = ots.len(nts); // New length
636  if( len != nts._flds.length ) // Grow/shrink as needed
637  nts._flds = Arrays.copyOf(nts._flds, len);
638  int clen = Math.min(len,ots._flds.length);
639  // Meet all the non-recursive parts
640  nts._any &= ots._any ; nts._use = nts._any;
641  nts._open|= ots._open;
642  for( int i=0; i<clen; i++ )
643  nts._flds[i].cmeet(ots._flds[i]);
644  // Now recursively do all common fields
645  for( int i=0; i<clen; i++ )
646  nts._flds[i].setX(ax_meet(bs,nts._flds[i]._t,ots._flds[i]._t));
647  break;
648  default: throw AA.unimpl();
649  }
650  return nt;
651  }

References com.cliffc.aa.type.TypeMemPtr._aliases, com.cliffc.aa.type.TypeObj< O extends TypeObj< O >._any, com.cliffc.aa.type.TypeFunPtr._disp, com.cliffc.aa.type.TypeFunPtr._fidxs, com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.Type< T extends Type< T >._hash, com.cliffc.aa.type.TypeMemPtr._obj, com.cliffc.aa.type.TypeStruct._open, com.cliffc.aa.type.TypeFld._t, com.cliffc.aa.type.Type< T extends Type< T >._type, com.cliffc.aa.type.Type< T extends Type< T >._uid, com.cliffc.aa.type.Type< T extends Type< T >.ANY, com.cliffc.aa.type.TypeFunPtr.ax_meet_nil(), com.cliffc.aa.type.TypeMemPtr.ax_meet_nil(), com.cliffc.aa.type.Type< T extends Type< T >.interned(), com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.ISUSED, com.cliffc.aa.type.TypeStruct.len(), com.cliffc.aa.type.Bits< B extends Bits< B >.meet(), com.cliffc.aa.type.Type< T extends Type< T >.meet(), com.cliffc.aa.type.Type< T extends Type< T >.NIL, com.cliffc.aa.type.TypeObj< TypeStruct >.OBJ, com.cliffc.aa.type.Type< T extends Type< T >.SCALAR, com.cliffc.aa.util.BitSetSparse.tset(), com.cliffc.aa.type.TypeStruct.ufind(), com.cliffc.aa.AA.unimpl(), com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.UNUSED, com.cliffc.aa.type.Type< T extends Type< T >.XNIL, com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.XOBJ, and com.cliffc.aa.type.Type< T extends Type< T >.XSCALAR.

Referenced by com.cliffc.aa.type.TypeStruct.ax_impl_struct().

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

◆ check_interned()

static boolean com.cliffc.aa.type.TypeStruct.check_interned ( Ary< Type reachs)
staticprivate

Definition at line 770 of file TypeStruct.java.

770  {
771  for( Type t : reachs )
772  if( t.intern_lookup() != null )
773  return true;
774  return false;
775  }

Referenced by com.cliffc.aa.type.TypeStruct.approx().

Here is the caller graph for this function:

◆ check_uf()

static boolean com.cliffc.aa.type.TypeStruct.check_uf ( Ary< Type reaches)
staticprivate

Definition at line 804 of file TypeStruct.java.

804  {
805  int err=0;
806  HashMap<Type,Type> ss = new HashMap<>();
807  for( Type t : reaches ) {
808  Type tt;
809  if( ss.get(t) != null || // Found unresolved dup; ts0.equals(ts1) but ts0!=ts1
810  ((tt = t.intern_lookup()) != null && tt != t) ||
811  ufind(t) != t )
812  err++;
813  ss.put(t,t);
814  }
815  return err == 0;
816  }

References com.cliffc.aa.type.Type< T extends Type< T >.intern_lookup(), and com.cliffc.aa.type.TypeStruct.ufind().

Referenced by com.cliffc.aa.type.TypeStruct.approx(), com.cliffc.aa.type.TypeStruct.cyclic_meet(), and com.cliffc.aa.type.TypeStruct.sharpen().

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

◆ close()

TypeStruct com.cliffc.aa.type.TypeStruct.close ( )

Definition at line 212 of file TypeStruct.java.

212 { assert _open; return malloc(_name,_any,_flds,false).hashcons_freeS(); } // Mark as no-more-fields

References com.cliffc.aa.type.TypeObj< TypeStruct >._any, com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeStruct._open, com.cliffc.aa.type.TypeStruct.hashcons_freeS(), and com.cliffc.aa.type.TypeStruct.malloc().

Referenced by com.cliffc.aa.node.ConTypeNode.def_fref().

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

◆ cmp()

int com.cliffc.aa.type.TypeStruct.cmp ( TypeStruct  t)
private

Definition at line 76 of file TypeStruct.java.

76  {
77  if( !super.equals(t) ) return 0;
78  if( _flds.length != t._flds.length || _open != t._open ) return 0;
79  if( _flds == t._flds ) return 1;
80  for( int i=0; i<_flds.length; i++ )
81  if( !Util.eq(_flds[i]._fld,t._flds[i]._fld) || _flds[i]._access!=t._flds[i]._access )
82  return 0;
83  for( int i=0; i<_flds.length; i++ )
84  if( _flds[i]._t!=t._flds[i]._t )
85  return -1; // Some not-pointer-equals child types, must do the full check
86  return 1; // All child types are pointer-equals, so must be equals.
87  }

References com.cliffc.aa.type.TypeFld._access, com.cliffc.aa.type.TypeFld._fld, com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeStruct._open, com.cliffc.aa.type.TypeFld._t, and com.cliffc.aa.util.Util.eq().

Referenced by com.cliffc.aa.type.TypeStruct.cycle_equals(), and com.cliffc.aa.type.TypeStruct.equals().

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

◆ compute_hash()

int com.cliffc.aa.type.TypeStruct.compute_hash ( )

Definition at line 66 of file TypeStruct.java.

66  {
67  int hash1 = super.compute_hash(), hash = hash1 +(_open?1023:0);
68  assert hash1 != 0;
69  // Compute hash from field names and orders and access.
70  for( TypeFld fld : _flds ) { assert fld._hash!=0; hash = (hash + fld._hash) | (hash >>> 17); }
71  return hash == 0 ? hash1 : hash;
72  }

References com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.Type< T extends Type< T >._hash, com.cliffc.aa.type.TypeStruct._open, and com.cliffc.aa.type.TypeStruct.fld().

Referenced by com.cliffc.aa.HM.HM9.T2._as_flow(), com.cliffc.aa.HM.HM.T2._as_flow(), com.cliffc.aa.type.TypeStruct._clone(), com.cliffc.aa.type.TypeStruct.cyclic_meet(), com.cliffc.aa.type.TypeStruct.rdual(), com.cliffc.aa.type.TestApprox.testApprox2(), com.cliffc.aa.type.TestApprox.testApprox3(), com.cliffc.aa.type.TestApprox.testApprox6(), com.cliffc.aa.type.TestApprox.testApprox8(), com.cliffc.aa.type.TestType.testNameCycle(), com.cliffc.aa.type.TestType.testRecursive(), and com.cliffc.aa.type.TestApprox.testTSMeet().

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

◆ contains()

boolean com.cliffc.aa.type.TypeStruct.contains ( Type  t,
VBitSet  bs 
)
package

Definition at line 1128 of file TypeStruct.java.

1128  {
1129  if( bs==null ) bs=new VBitSet();
1130  if( bs.tset(_uid) ) return false;
1131  for( TypeFld fld : _flds ) if( fld._t==t || fld._t.contains(t,bs) ) return true;
1132  return false;
1133  }

References com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeFld._t, com.cliffc.aa.type.Type< T extends Type< T >.contains(), com.cliffc.aa.type.TypeStruct.fld(), and com.cliffc.aa.util.VBitSet.tset().

Here is the call graph for this function:

◆ crush()

TypeStruct com.cliffc.aa.type.TypeStruct.crush ( )

Definition at line 1092 of file TypeStruct.java.

1092  {
1093  if( _any ) return this; // No crush on high structs
1094  TypeFld[] flds = TypeFlds.get(_flds.length);
1095  // Keep only the display pointer, as it cannot be stomped even with error code
1096  if( _flds.length>0 && _flds[0].is_display_ptr() )
1097  flds[0] = _flds[0].simple_ptr();
1098  for( int i=1; i<_flds.length; i++ ) { // Widen all fields, as-if crushed by errors, even finals.
1099  // Keep the name and field names untouched.
1100  TypeFld fld = _flds[i];
1101  flds[i] = TypeFld.make(fld._fld,Type.ALL,Access.bot(),fld._order);
1102  }
1103  // Low input so low output.
1104  return make_from(flds);
1105  }

References com.cliffc.aa.type.TypeObj< TypeStruct >._any, com.cliffc.aa.type.TypeFld._fld, com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeFld._order, com.cliffc.aa.type.Type< T extends Type< T >.ALL, com.cliffc.aa.type.TypeFld.Access.bot(), com.cliffc.aa.type.TypeStruct.fld(), com.cliffc.aa.type.TypeStruct.flds(), com.cliffc.aa.type.TypeFlds.get(), com.cliffc.aa.type.TypeFld.is_display_ptr(), com.cliffc.aa.type.TypeFld.make(), com.cliffc.aa.type.TypeStruct.make_from(), and com.cliffc.aa.type.TypeFld.simple_ptr().

Referenced by com.cliffc.aa.node.NewObjNode.ideal_mono().

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

◆ cycle_equals()

boolean com.cliffc.aa.type.TypeStruct.cycle_equals ( Type  o)

Definition at line 110 of file TypeStruct.java.

110  {
111  if( this==o ) return true;
112  if( !(o instanceof TypeStruct) ) return false;
113  TypeStruct t = (TypeStruct)o;
114  TypeStruct t2 = find_other();
115  if( t2 !=null ) return t2==t ; // Already in cycle report equals or not
116  TypeStruct t3 = t.find_other();
117  if( t3 !=null ) return t3==this;// Already in cycle report equals or not
118  int x = cmp(t);
119  if( x != -1 ) return x == 1;
120 
121  int len = CYCLES._len;
122  CYCLES.add(this).add(t);
123  boolean eq=cycle_equals0(t);
124  assert CYCLES._len==len+2;
125  CYCLES._len=len;
126  return eq;
127  }

References com.cliffc.aa.type.TypeStruct.cmp(), com.cliffc.aa.type.TypeStruct.cycle_equals0(), com.cliffc.aa.type.TypeStruct.CYCLES, com.cliffc.aa.type.TypeStruct.find_other(), and com.cliffc.aa.type.TypeStruct.len().

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

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

◆ cycle_equals0()

boolean com.cliffc.aa.type.TypeStruct.cycle_equals0 ( TypeStruct  t)
private

Definition at line 128 of file TypeStruct.java.

128  {
129  for( int i=0; i<_flds.length; i++ ) {
130  Type t0 = _flds[i]._t;
131  Type t1 = t._flds[i]._t;
132  if( t0!=t1 && // Normally suffices to test ptr-equals only
133  (t0==null || t1==null || // Happens when asserting on partially-built cyclic types
134  !t0.cycle_equals(t1)) ) // Must do a full cycle-check
135  return false;
136  }
137  return true;
138  }

References com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeFld._t, and com.cliffc.aa.type.Type< T extends Type< T >.cycle_equals().

Referenced by com.cliffc.aa.type.TypeStruct.cycle_equals().

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

◆ cyclic_meet()

TypeStruct com.cliffc.aa.type.TypeStruct.cyclic_meet ( TypeStruct  that)
private

Definition at line 351 of file TypeStruct.java.

351  {
352  // Walk 'this' and 'that' and map them both (via MEETS0) to a shared common
353  // Meet result. Only walk the cyclic parts... cyclically. When visiting a
354  // finite-sized part we use the normal recursive Meet. When doing the
355  // cyclic part, we use the normal Meet except we need to use the mapped
356  // Meet types. As part of these Meet operations we can end up Meeting Meet
357  // types with each other more than once, or more than once from each side -
358  // which means already visited Types might need to Meet again, even as they
359  // are embedded in other Types - which leads to the need to use Tarjan U-F
360  // to union Types on the fly.
361 
362  // See if we have worked on this unique pair before. If so, the cycle has
363  // been closed and just return that prior (unfinished) result.
364  TypeStruct mt = MEETS0.get(TPair.set(this,that));
365  if( mt != null ) return mt; // Cycle has been closed
366  mt = this._clone();
367  TypeStruct mx = that;
368  MEETS0.put(new TPair(this,that),mt);
369 
370  // Do a shallow MEET: meet of field names and _any and all things that can
371  // be computed without the cycle. _flds[]._t not filled in yet.
372  int len = mt.len(mx); // Length depends on all the Structs Meet'ing here
373  if( len != mt._flds.length )
374  mt._flds = Arrays.copyOf(mt._flds, len);// escaped a _flds
375  if( mt._any && !mx._any ) mt._any = mt._use = false;
376  if(!mt._open && mx._open) mt._open=true ;
377  for( int i=0; i<len; i++ )
378  mt._flds[i] = TypeFld.cmeet(mt._flds[i],i<mx._flds.length ? mx._flds[i] : null);
379  mt._name = mt.mtname(mx,mt);
380  mt._hash = mt.compute_hash(); // Compute hash now that fields and flags are set
381 
382  // Since the result is cyclic, we cannot test the cyclic parts for
383  // pre-existence until the entire cycle is built. We can't intern the
384  // partially built parts, but we want to use the normal xmeet call - which
385  // normally recursively interns. Turn off interning with the global
386  // RECURSIVE_MEET flag.
387  RECURSIVE_MEET++;
388 
389  // For-all _ts edges do the Meet. Some are not-recursive and mapped, some
390  // are part of the cycle and mapped, some
391  for( int i=0; i<len; i++ ) {
392  Type lfi = i<this._flds.length ? this._flds[i]._t : null;
393  Type rti = i<that._flds.length ? that._flds[i]._t : null;
394  Type mti = (lfi==null) ? rti : (rti==null ? lfi : lfi.meet(rti));
395  Type mtx = mt._flds[i]._t; // Prior value, perhaps updated recursively
396  Type mts = mtx==null ? mti : mtx.meet(mti); // Meet again
397  mt._flds[i].setX(mts); // Finally update
398  }
399  // Check for repeats right now
400  for( TypeStruct ts : MEETS0.values() )
401  if( ts!=mt && ts.equals(mt) )
402  { mt = ts; break; } // Union together
403 
404  // Lower recursive-meet flag. At this point the Meet 'mt' is still
405  // speculative and not interned.
406  if( --RECURSIVE_MEET > 0 )
407  return mt; // And, if not yet done, just exit with it
408 
409  // Remove any final UF before installation.
410  // Do not install until the cycle is complete.
411  RECURSIVE_MEET++;
412  mt = shrink(mt.reachable(),mt);
413  Ary<Type> reaches = mt.reachable(); // Recompute reaches after shrink
414  assert check_uf(reaches);
415  UF.clear();
416  RECURSIVE_MEET--;
417  // This completes 'mt' as the Meet structure.
418  return mt.install_cyclic(reaches);
419  }

References com.cliffc.aa.type.TypeObj< O extends TypeObj< O >._any, com.cliffc.aa.type.TypeStruct._clone(), com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeStruct._open, com.cliffc.aa.type.TypeFld._t, com.cliffc.aa.type.TypeObj< O extends TypeObj< O >._use, com.cliffc.aa.type.TypeStruct.check_uf(), com.cliffc.aa.type.TypeFld.cmeet(), com.cliffc.aa.type.TypeStruct.compute_hash(), com.cliffc.aa.type.TypeStruct.equals(), com.cliffc.aa.type.TypeStruct.install_cyclic(), com.cliffc.aa.type.TypeStruct.len(), com.cliffc.aa.type.Type< T extends Type< T >.meet(), com.cliffc.aa.type.TypeStruct.MEETS0, com.cliffc.aa.type.TypeStruct.reachable(), com.cliffc.aa.type.TypeStruct.TPair.set(), com.cliffc.aa.type.TypeFld.setX(), com.cliffc.aa.type.TypeStruct.shrink(), and com.cliffc.aa.type.TypeStruct.UF.

Referenced by com.cliffc.aa.type.TypeStruct.xmeet().

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

◆ equals()

boolean com.cliffc.aa.type.TypeStruct.equals ( Object  o)

Definition at line 89 of file TypeStruct.java.

89  {
90  if( this==o ) return true;
91  if( !(o instanceof TypeStruct) ) return false;
92  TypeStruct t = (TypeStruct)o;
93  // While we would like to use the notion of interned Type[] during the
94  // normal Type.INTERN check, we also get here during building of cyclic
95  // structures for which we'll fall into the cyclic check - as the Type[]s
96  // are not interned yet.
97  int x = cmp(t);
98  if( x != -1 ) return x == 1;
99  // Unlike all other non-cyclic structures which are built bottom-up, cyclic
100  // types have to be built all-at-once, and thus hash-cons and equality-
101  // tested with a cyclic-aware equals check.
102  return cycle_equals(t);
103  }

References com.cliffc.aa.type.TypeStruct.cmp(), and com.cliffc.aa.type.TypeStruct.cycle_equals().

Referenced by com.cliffc.aa.type.TypeStruct.cyclic_meet(), com.cliffc.aa.type.TypeStruct.TPair.equals(), com.cliffc.aa.type.TypeStruct.install_cyclic(), and com.cliffc.aa.type.TypeStruct.repeats_in_cycles().

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

◆ find_other()

TypeStruct com.cliffc.aa.type.TypeStruct.find_other ( )
private

Definition at line 106 of file TypeStruct.java.

106  {
107  int idx = CYCLES.find(this);
108  return idx != -1 ? CYCLES.at(idx^1) : null;
109  }

References com.cliffc.aa.type.TypeStruct.CYCLES.

Referenced by com.cliffc.aa.type.TypeStruct.cycle_equals().

Here is the caller graph for this function:

◆ flatten_fields()

TypeObj com.cliffc.aa.type.TypeStruct.flatten_fields ( )
package

Definition at line 1060 of file TypeStruct.java.

1060  {
1061  TypeFld[] flds = TypeFlds.get(_flds.length);
1062  for( int i=0; i<_flds.length; i++ )
1063  flds[i] = _flds[i].make_from(Type.SCALAR,Access.bot());
1064  return make_from(flds);
1065  }

References com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeFld.Access.bot(), com.cliffc.aa.type.TypeStruct.flds(), com.cliffc.aa.type.TypeFlds.get(), com.cliffc.aa.type.TypeStruct.make_from(), and com.cliffc.aa.type.Type< T extends Type< T >.SCALAR.

Here is the call graph for this function:

◆ fld()

TypeFld com.cliffc.aa.type.TypeStruct.fld ( int  idx)

Definition at line 1012 of file TypeStruct.java.

1012 { return _flds[idx]; } // Field by index

References com.cliffc.aa.type.TypeStruct._flds.

Referenced by com.cliffc.aa.type.TypeStruct._dull(), com.cliffc.aa.type.TypeStruct._is_sharp(), com.cliffc.aa.type.TypeStruct.approx(), com.cliffc.aa.type.TypeStruct.compute_hash(), com.cliffc.aa.type.TypeStruct.contains(), com.cliffc.aa.node.IntrinsicNode.convertTypeNameStruct(), com.cliffc.aa.type.TypeStruct.crush(), com.cliffc.aa.node.StoreNode.err(), com.cliffc.aa.type.TypeStruct.fld_find(), com.cliffc.aa.type.TypeMem.fld_is_mod(), com.cliffc.aa.type.TypeStruct.get_cyclic(), com.cliffc.aa.type.TypeStruct.intern_check1(), com.cliffc.aa.node.NewObjNode.NewObjNode(), com.cliffc.aa.node.NewObjNode.promote_forward(), com.cliffc.aa.type.TypeStruct.remove_other_flds(), com.cliffc.aa.type.TestApprox.testApprox2(), com.cliffc.aa.type.TestApprox.testApprox3(), com.cliffc.aa.type.TestApprox.testApprox6(), com.cliffc.aa.type.TestApprox.testApprox8(), com.cliffc.aa.type.TestType.testNameCycle(), com.cliffc.aa.TestParse.testParse06(), com.cliffc.aa.TestParse.testParse07(), com.cliffc.aa.type.TestType.testRecursive(), com.cliffc.aa.type.TestApprox.testTSMeet(), com.cliffc.aa.type.TypeStruct.update(), com.cliffc.aa.type.TypeStruct.walk(), com.cliffc.aa.HM.HM9.T2.walk_types_out(), com.cliffc.aa.HM.HM.T2.walk_types_out(), and com.cliffc.aa.type.TypeStruct.widen().

Here is the caller graph for this function:

◆ fld_find()

int com.cliffc.aa.type.TypeStruct.fld_find ( String  fld)

◆ flds() [1/3]

◆ flds() [2/3]

static TypeFld [] com.cliffc.aa.type.TypeStruct.flds ( Type  t1)
static

Definition at line 184 of file TypeStruct.java.

184 { return TypeFlds.ts(TypeFld.NO_DISP,TypeFld.make_arg(t1,1)); }

References com.cliffc.aa.type.TypeFld.make_arg(), com.cliffc.aa.type.TypeFld.NO_DISP, and com.cliffc.aa.type.TypeFlds.ts().

Referenced by com.cliffc.aa.type.TypeMem.all_reaching_aliases(), com.cliffc.aa.HM.HM9.Pair1.Pair1X.apply(), com.cliffc.aa.type.TypeMemPtr.depth(), com.cliffc.aa.HM.TestHM.test25(), and com.cliffc.aa.HM.TestHM9.test25().

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

◆ flds() [3/3]

static TypeFld [] com.cliffc.aa.type.TypeStruct.flds ( Type  t1,
Type  t2 
)
static

Definition at line 185 of file TypeStruct.java.

185 { return TypeFlds.ts(TypeFld.NO_DISP,TypeFld.make_arg(t1,1), TypeFld.make_arg(t2,2)); }

References com.cliffc.aa.type.TypeFld.make_arg(), com.cliffc.aa.type.TypeFld.NO_DISP, and com.cliffc.aa.type.TypeFlds.ts().

Here is the call graph for this function:

◆ get_cyclic() [1/2]

BitSet com.cliffc.aa.type.TypeStruct.get_cyclic ( )
private

Definition at line 822 of file TypeStruct.java.

822  {
823  return get_cyclic(new BitSet(),new VBitSet(),new Ary<>(Type.class),this);
824  }

Referenced by com.cliffc.aa.type.TypeStruct.get_cyclic(), and com.cliffc.aa.type.TypeStruct.install_cyclic().

Here is the caller graph for this function:

◆ get_cyclic() [2/2]

static BitSet com.cliffc.aa.type.TypeStruct.get_cyclic ( BitSet  bcs,
VBitSet  bs,
Ary< Type stack,
Type  t 
)
staticprivate

Definition at line 825 of file TypeStruct.java.

825  {
826  if( t.interned() ) return bcs;
827  if( bs.test(t._uid) ) { // If visiting again... have found a cycle t->....->t
828  // All on the stack are flagged as being part of a cycle
829  int i;
830  i=stack._len-1;
831  while( i >= 0 && stack.at(i)!=t ) i--;
832  if( i== -1 ) return bcs; // Due to multi-edges, we might not find if dupped, so just ignore
833  for( ; i < stack._len; i++ )
834  bcs.set(stack.at(i)._uid);
835  bcs.set(t._uid);
836  return bcs;
837  }
838  stack.push(t); // Push on stack, in case a cycle is found
839  switch( t._type ) {
840  case TMEMPTR: get_cyclic(bcs,bs,stack,((TypeMemPtr)t)._obj ); break;
841  case TFUNPTR: get_cyclic(bcs,bs,stack,((TypeFunPtr)t)._disp); break;
842  case TFLD : get_cyclic(bcs,bs,stack,((TypeFld )t)._t ); break;
843  case TSTRUCT: bs.set(t._uid); for( TypeFld fld : ((TypeStruct)t)._flds ) get_cyclic(bcs,bs,stack,fld); break;
844  }
845  stack.pop(); // Pop, not part of anothers cycle
846  return bcs;
847  }

References com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.util.Ary< E >._len, com.cliffc.aa.type.Type< T extends Type< T >._type, com.cliffc.aa.type.Type< T extends Type< T >._uid, com.cliffc.aa.util.Ary< E >.at(), com.cliffc.aa.type.TypeStruct.fld(), com.cliffc.aa.type.TypeStruct.get_cyclic(), com.cliffc.aa.type.Type< T extends Type< T >.interned(), com.cliffc.aa.util.Ary< E >.pop(), com.cliffc.aa.util.Ary< E >.push(), and com.cliffc.aa.util.VBitSet.test().

Here is the call graph for this function:

◆ hashcons_freeS()

TypeStruct com.cliffc.aa.type.TypeStruct.hashcons_freeS ( )
private

Definition at line 178 of file TypeStruct.java.

178  {
179  _flds = TypeFlds.hash_cons(_flds);
180  return hashcons_free();
181  }

References com.cliffc.aa.type.TypeStruct._flds, and com.cliffc.aa.type.TypeFlds.hash_cons().

Referenced by com.cliffc.aa.type.TypeStruct._sharp(), com.cliffc.aa.type.TypeStruct.close(), com.cliffc.aa.type.TypeStruct.make(), com.cliffc.aa.type.TypeStruct.make_from(), com.cliffc.aa.type.TypeStruct.make_from_flds(), and com.cliffc.aa.type.TypeStruct.xmeet1().

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

◆ init() [1/2]

O com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.init ( byte  type,
String  name,
boolean  any,
boolean  use 
)
protectedinherited

Definition at line 19 of file TypeObj.java.

19  {
20  super.init(type,name);
21  _any=any;
22  _use=use;
23  return (O)this;
24  }

◆ init() [2/2]

TypeStruct com.cliffc.aa.type.TypeStruct.init ( String  name,
boolean  any,
TypeFld[]  flds,
boolean  open 
)
private

Definition at line 55 of file TypeStruct.java.

55  {
56  super.init(TSTRUCT, name, any, any);
57  _flds = flds;
58  _open = open;
59  return this;
60  }

References com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeStruct._open, com.cliffc.aa.type.TypeStruct.flds(), com.cliffc.aa.type.TypeStruct.init(), and com.cliffc.aa.type.TypeStruct.open().

Referenced by com.cliffc.aa.type.TypeStruct.init(), com.cliffc.aa.type.TypeStruct.malloc(), com.cliffc.aa.type.TypeStruct.rdual(), and com.cliffc.aa.type.TypeStruct.xdual().

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

◆ install_cyclic()

TypeStruct com.cliffc.aa.type.TypeStruct.install_cyclic ( Ary< Type reachs)

Definition at line 422 of file TypeStruct.java.

422  {
423  // Check for dups. If found, delete entire cycle, and return original.
424  TypeStruct old = (TypeStruct)intern_lookup();
425  // If the cycle already exists, just drop the new Type on the floor and let
426  // GC get it and return the old Type.
427  if( old == null ) { // Not a dup
428  mark_cyclic(get_cyclic(),reachs);
429  assert !_cyclic || repeats_in_cycles()==null;
430  rdual(); // Complete cyclic dual
431  // Insert all members of the cycle into the hashcons. If self-symmetric,
432  // also replace entire cycle with self at each point.
433  if( equals(_dual) ) throw AA.unimpl();
434  walk( t -> {
435  assert t._hash==0 || t._hash==t.compute_hash();
436  if( t.interned() ) return false;
437  if( t.retern() != t._dual ) t._dual.retern();
438  return true;
439  });
440 
441  assert _flds[0]._t.interned();
442  old = this;
443  }
444  MEETS0.clear();
445  return old;
446  }

References com.cliffc.aa.type.TypeStruct._cyclic, com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeFld._t, com.cliffc.aa.type.TypeStruct.equals(), com.cliffc.aa.type.TypeStruct.get_cyclic(), com.cliffc.aa.type.Type< T extends Type< T >.interned(), com.cliffc.aa.type.TypeStruct.mark_cyclic(), com.cliffc.aa.type.TypeStruct.MEETS0, com.cliffc.aa.type.TypeStruct.rdual(), com.cliffc.aa.type.TypeStruct.repeats_in_cycles(), com.cliffc.aa.AA.unimpl(), and com.cliffc.aa.type.TypeStruct.walk().

Referenced by com.cliffc.aa.HM.HM9.T2._as_flow(), com.cliffc.aa.HM.HM.T2._as_flow(), com.cliffc.aa.type.TypeStruct.approx(), com.cliffc.aa.type.TypeStruct.cyclic_meet(), com.cliffc.aa.type.TypeStruct.sharpen(), com.cliffc.aa.type.TestApprox.testApprox2(), com.cliffc.aa.type.TestApprox.testApprox3(), com.cliffc.aa.type.TestApprox.testApprox6(), com.cliffc.aa.type.TestApprox.testApprox8(), com.cliffc.aa.type.TestType.testNameCycle(), com.cliffc.aa.type.TestType.testRecursive(), and com.cliffc.aa.type.TestApprox.testTSMeet().

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

◆ intern_check1()

boolean com.cliffc.aa.type.TypeStruct.intern_check1 ( )
package

Definition at line 1150 of file TypeStruct.java.

1150  {
1151  for( TypeFld fld : _flds )
1152  if( fld.intern_lookup()==null )
1153  return false;
1154  return true;
1155  }

References com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeStruct.fld(), and com.cliffc.aa.type.Type< T extends Type< T >.intern_lookup().

Here is the call graph for this function:

◆ is_con()

boolean com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.is_con
inherited

Definition at line 79 of file TypeObj.java.

79 { return false; }

◆ is_display()

boolean com.cliffc.aa.type.TypeStruct.is_display ( )
package

Definition at line 220 of file TypeStruct.java.

220  {
221  return
222  this==TypeMemPtr.DISPLAY || this==TypeMemPtr.DISPLAY._dual ||
223  (_flds.length >= 1 && _flds[0].is_display_ptr());
224  }

References com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeMemPtr.DISPLAY, and com.cliffc.aa.type.TypeFld.is_display_ptr().

Here is the call graph for this function:

◆ is_tup()

boolean com.cliffc.aa.type.TypeStruct.is_tup ( )
private

Definition at line 141 of file TypeStruct.java.

141  {
142  if( _flds.length<=1 ) return true;
143  return isDigit(_flds[1]._fld.charAt(0));
144  }

References com.cliffc.aa.type.TypeStruct._flds, and com.cliffc.aa.type.TypeStruct.isDigit().

Referenced by com.cliffc.aa.type.TypeStruct.str().

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

◆ isBitShape()

byte com.cliffc.aa.type.TypeStruct.isBitShape ( Type  t)

Definition at line 1120 of file TypeStruct.java.

1120  {
1121  if( isa(t) ) return 0; // Can choose compatible format
1122  if( t.isa(this) ) return 0; // TODO: really: test same flds, each fld isBitShape
1123  return 99;
1124  }

References com.cliffc.aa.type.Type< T extends Type< T >.isa().

Here is the call graph for this function:

◆ isDigit()

static boolean com.cliffc.aa.type.TypeStruct.isDigit ( char  c)
staticpackage

Definition at line 140 of file TypeStruct.java.

140 { return '0' <= c && c <= '9'; }

Referenced by com.cliffc.aa.type.TypeStruct.is_tup(), and com.cliffc.aa.type.TypeFld.str().

Here is the caller graph for this function:

◆ last()

Type com.cliffc.aa.type.TypeStruct.last ( )

Definition at line 1014 of file TypeStruct.java.

1014 { return _flds[_flds.length-1]._t; }

References com.cliffc.aa.type.TypeStruct._flds, and com.cliffc.aa.type.TypeFld._t.

◆ len() [1/2]

int com.cliffc.aa.type.TypeStruct.len ( )

Definition at line 1015 of file TypeStruct.java.

1015 { return _flds.length; } // Count of fields

References com.cliffc.aa.type.TypeStruct._flds.

Referenced by com.cliffc.aa.type.TypeStruct.ax_meet(), com.cliffc.aa.type.TypeStruct.cycle_equals(), com.cliffc.aa.type.TypeStruct.cyclic_meet(), and com.cliffc.aa.type.TypeStruct.xmeet1().

Here is the caller graph for this function:

◆ len() [2/2]

int com.cliffc.aa.type.TypeStruct.len ( TypeStruct  tt)
private

Definition at line 865 of file TypeStruct.java.

865 { return _flds.length <= tt._flds.length ? len0(tt) : tt.len0(this); }

References com.cliffc.aa.type.TypeStruct._flds, and com.cliffc.aa.type.TypeStruct.len0().

Referenced by com.cliffc.aa.type.TypeStruct.ax_meet(), com.cliffc.aa.node.IntrinsicNode.convertTypeNameStruct(), com.cliffc.aa.type.TypeStruct.cyclic_meet(), com.cliffc.aa.type.TypeTuple.make(), com.cliffc.aa.node.NewObjNode.promote_forward(), com.cliffc.aa.HM.HM9.T2.walk_types_out(), and com.cliffc.aa.HM.HM.T2.walk_types_out().

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

◆ len0()

int com.cliffc.aa.type.TypeStruct.len0 ( TypeStruct  tmax)
private

Definition at line 866 of file TypeStruct.java.

866 { return _any ? tmax._flds.length : _flds.length; }

References com.cliffc.aa.type.TypeObj< TypeStruct >._any, and com.cliffc.aa.type.TypeStruct._flds.

Referenced by com.cliffc.aa.type.TypeStruct.len().

Here is the caller graph for this function:

◆ make() [1/5]

static TypeStruct com.cliffc.aa.type.TypeStruct.make ( String  fld_name,
Type  t 
)
static

Definition at line 190 of file TypeStruct.java.

190 { return make(fld_name,t,Access.Final); }

References com.cliffc.aa.type.TypeFld.Access.Final, and com.cliffc.aa.type.TypeStruct.make().

Referenced by com.cliffc.aa.type.TypeStruct.add_fld(), com.cliffc.aa.HM.HM9.Pair1.Pair1X.apply(), com.cliffc.aa.HM.HM9.Pair.apply(), com.cliffc.aa.HM.HM.Pair1.Pair1X.apply(), com.cliffc.aa.HM.HM9.Triple.apply(), com.cliffc.aa.HM.HM.Pair.apply(), com.cliffc.aa.HM.HM.Triple.apply(), com.cliffc.aa.HM.TestHM.build_cycle(), com.cliffc.aa.HM.TestHM9.build_cycle(), com.cliffc.aa.HM.TestHM.build_cycle2(), com.cliffc.aa.type.TypeStruct.make(), com.cliffc.aa.HM.TestHM.make_tups(), com.cliffc.aa.type.TypeStruct.open(), com.cliffc.aa.HM.TestHM9.test02(), com.cliffc.aa.HM.TestHM9.test06(), com.cliffc.aa.HM.TestHM9.test14(), com.cliffc.aa.HM.TestHM9.test18(), com.cliffc.aa.HM.TestHM9.test20(), com.cliffc.aa.HM.TestHM.test25(), com.cliffc.aa.HM.TestHM9.test25(), com.cliffc.aa.HM.TestHM9.test35(), com.cliffc.aa.HM.TestHM9.test36(), com.cliffc.aa.HM.TestHM9.test41(), com.cliffc.aa.HM.TestHM9.test49(), com.cliffc.aa.HM.TestHM9.test50(), com.cliffc.aa.HM.TestHM.test52(), com.cliffc.aa.HM.TestHM.test55(), com.cliffc.aa.HM.TestHM.test57(), com.cliffc.aa.type.TestApprox.testApprox1(), com.cliffc.aa.type.TestApprox.testApprox2(), com.cliffc.aa.type.TestApprox.testApprox3(), com.cliffc.aa.type.TestApprox.testApprox4(), com.cliffc.aa.type.TestApprox.testApprox5(), com.cliffc.aa.type.TestApprox.testApprox6(), com.cliffc.aa.type.TestApprox.testApprox7(), com.cliffc.aa.type.TestApprox.testApprox8(), com.cliffc.aa.node.TestNodeSmall.testMemoryArgs(), com.cliffc.aa.type.TestType.testOOPsNulls(), com.cliffc.aa.TestParse.testParse01a(), com.cliffc.aa.TestParse.testParse02(), com.cliffc.aa.TestParse.testParse03(), com.cliffc.aa.TestParse.testParse04(), com.cliffc.aa.TestParse.testParse06(), com.cliffc.aa.TestParse.testParse07(), com.cliffc.aa.TestParse.testParse08(), com.cliffc.aa.TestParse.testParse09(), com.cliffc.aa.TestParse.testParse10(), com.cliffc.aa.TestParse.testParse14(), com.cliffc.aa.TestParse.testParse15(), com.cliffc.aa.type.TestType.testRecursive(), com.cliffc.aa.type.TestType.testStructTuple(), com.cliffc.aa.type.TestType.testType(), com.cliffc.aa.Parse.type0(), com.cliffc.aa.type.TypeStruct.update(), com.cliffc.aa.HM.HM9.Struct.val(), and com.cliffc.aa.HM.HM.Struct.val().

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

◆ make() [2/5]

static TypeStruct com.cliffc.aa.type.TypeStruct.make ( String  fld_name,
Type  t,
Access  a 
)
static

Definition at line 191 of file TypeStruct.java.

191 { return make(TypeFlds.ts(TypeFld.NO_DISP,TypeFld.make(fld_name,t,a,1))); }

References com.cliffc.aa.type.TypeFld.make(), com.cliffc.aa.type.TypeStruct.make(), com.cliffc.aa.type.TypeFld.NO_DISP, and com.cliffc.aa.type.TypeFlds.ts().

Referenced by com.cliffc.aa.type.TypeStruct.make().

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

◆ make() [3/5]

static TypeStruct com.cliffc.aa.type.TypeStruct.make ( String  name,
boolean  any,
TypeFld[]  flds,
boolean  open 
)
static

Definition at line 207 of file TypeStruct.java.

207 { return malloc(name,any,flds,open).hashcons_freeS(); }

References com.cliffc.aa.type.TypeStruct.flds(), com.cliffc.aa.type.TypeStruct.hashcons_freeS(), com.cliffc.aa.type.TypeStruct.malloc(), and com.cliffc.aa.type.TypeStruct.open().

Here is the call graph for this function:

◆ make() [4/5]

static TypeStruct com.cliffc.aa.type.TypeStruct.make ( Type...  ts)
static

Definition at line 199 of file TypeStruct.java.

199  {
200  TypeFld[] flds = TypeFlds.get(ts.length+1);
201  flds[0]=TypeFld.NO_DISP;
202  for( int i=0; i<ts.length; i++ )
203  flds[i+1] = TypeFld.make(TypeFld.fldBot,ts[i],i+1);
204  return make("",false,flds,false);
205  }

References com.cliffc.aa.type.TypeFld.fldBot, com.cliffc.aa.type.TypeStruct.flds(), com.cliffc.aa.type.TypeFlds.get(), com.cliffc.aa.type.TypeFld.make(), com.cliffc.aa.type.TypeStruct.make(), and com.cliffc.aa.type.TypeFld.NO_DISP.

Here is the call graph for this function:

◆ make() [5/5]

static TypeStruct com.cliffc.aa.type.TypeStruct.make ( TypeFld...  flds)
static

Definition at line 196 of file TypeStruct.java.

196 { return make("",false,flds,false); }

References com.cliffc.aa.type.TypeStruct.flds(), and com.cliffc.aa.type.TypeStruct.make().

Referenced by com.cliffc.aa.type.TypeStruct.make().

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

◆ make_from() [1/3]

TypeStruct com.cliffc.aa.type.TypeStruct.make_from ( String  name)

Definition at line 215 of file TypeStruct.java.

215 { return malloc(name,_any,_flds,_open).hashcons_freeS(); }

References com.cliffc.aa.type.TypeObj< TypeStruct >._any, com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeStruct._open, com.cliffc.aa.type.TypeStruct.hashcons_freeS(), and com.cliffc.aa.type.TypeStruct.malloc().

Referenced by com.cliffc.aa.type.TypeStruct.crush(), com.cliffc.aa.type.TypeStruct.flatten_fields(), com.cliffc.aa.type.TypeStruct.make_from(), com.cliffc.aa.type.TypeStruct.remove_other_flds(), com.cliffc.aa.type.TypeStruct.set_fld(), com.cliffc.aa.HM.HM9.T2.walk_types_out(), com.cliffc.aa.HM.HM.T2.walk_types_out(), and com.cliffc.aa.type.TypeStruct.widen().

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

◆ make_from() [2/3]

TypeStruct com.cliffc.aa.type.TypeStruct.make_from ( Type  head,
TypeMem  mem,
VBitSet  visit 
)

Definition at line 1141 of file TypeStruct.java.

1141  {
1142  if( visit.tset(_uid) ) return null;
1143  TypeFld[] flds = TypeFlds.clone(_flds);
1144  for( int i=0; i<flds.length; i++ )
1145  flds[i] = flds[i].make_from(head,mem,visit);
1146  return make_from(flds);
1147  }

References com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeFlds.clone(), com.cliffc.aa.type.TypeStruct.flds(), com.cliffc.aa.type.TypeStruct.make_from(), and com.cliffc.aa.util.VBitSet.tset().

Here is the call graph for this function:

◆ make_from() [3/3]

TypeStruct com.cliffc.aa.type.TypeStruct.make_from ( TypeFld[]  flds)

Definition at line 217 of file TypeStruct.java.

217 { return malloc(_name,_any,flds,_open).hashcons_freeS(); }

References com.cliffc.aa.type.TypeObj< TypeStruct >._any, com.cliffc.aa.type.TypeStruct._open, com.cliffc.aa.type.TypeStruct.flds(), com.cliffc.aa.type.TypeStruct.hashcons_freeS(), and com.cliffc.aa.type.TypeStruct.malloc().

Here is the call graph for this function:

◆ make_from_flds()

TypeStruct com.cliffc.aa.type.TypeStruct.make_from_flds ( TypeStruct  ts)

Definition at line 218 of file TypeStruct.java.

218 { return malloc(_name,_any,ts._flds,_open).hashcons_freeS(); }

References com.cliffc.aa.type.TypeObj< TypeStruct >._any, com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeStruct._open, com.cliffc.aa.type.TypeStruct.hashcons_freeS(), and com.cliffc.aa.type.TypeStruct.malloc().

Here is the call graph for this function:

◆ malloc()

static TypeStruct com.cliffc.aa.type.TypeStruct.malloc ( String  name,
boolean  any,
TypeFld[]  flds,
boolean  open 
)
static

◆ mark_cyclic()

void com.cliffc.aa.type.TypeStruct.mark_cyclic ( BitSet  bcs,
Ary< Type reaches 
)
private

Definition at line 849 of file TypeStruct.java.

849  {
850  for( Type t : reaches ) {
851  if( bcs.get(t._uid) ) {
852  assert t.intern_lookup()==null; // Not interned
853  t._dual=null; // Remove any duals, so re-inserted clean
854  if( t instanceof TypeStruct ) {
855  TypeStruct ts = (TypeStruct)t;
856  ts._cyclic = true;
857  ts._flds = TypeFlds.hash_cons(ts._flds); // hashcons cyclic arrays
858  }
859  }
860  }
861  }

References com.cliffc.aa.type.TypeStruct._cyclic, com.cliffc.aa.type.TypeStruct._flds, and com.cliffc.aa.type.TypeFlds.hash_cons().

Referenced by com.cliffc.aa.type.TypeStruct.install_cyclic().

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

◆ may_be_con()

boolean com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.may_be_con
inherited

Definition at line 78 of file TypeObj.java.

78 { return _any; }

◆ may_nil()

boolean com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.may_nil
inherited

Definition at line 81 of file TypeObj.java.

81 { return false; }

◆ meet_loop()

Type com.cliffc.aa.type.TypeStruct.meet_loop ( Type  t2)

Definition at line 1003 of file TypeStruct.java.

1003  {
1004  if( this==t2 ) return this;
1005  if( !(t2 instanceof TypeStruct) ) return meet(t2);
1006  if( _flds.length != ((TypeStruct)t2)._flds.length ) return meet(t2);
1007  return xmeet1((TypeStruct)t2,true);
1008  }

References com.cliffc.aa.type.TypeStruct._flds, and com.cliffc.aa.type.TypeStruct.xmeet1().

Here is the call graph for this function:

◆ meet_nil()

Type com.cliffc.aa.type.TypeStruct.meet_nil ( Type  nil)

Definition at line 1126 of file TypeStruct.java.

1126 { return this; }

◆ must_nil()

boolean com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.must_nil
inherited

Definition at line 80 of file TypeObj.java.

80 { return false; }

◆ open()

static TypeStruct com.cliffc.aa.type.TypeStruct.open ( Type  tdisp)
static

Definition at line 210 of file TypeStruct.java.

210 { return make("",false,TypeFlds.ts(TypeFld.make_tup(tdisp,0)),true); }

References com.cliffc.aa.type.TypeStruct.make(), com.cliffc.aa.type.TypeFld.make_tup(), and com.cliffc.aa.type.TypeFlds.ts().

Referenced by com.cliffc.aa.Env.init(), com.cliffc.aa.type.TypeStruct.init(), com.cliffc.aa.type.TypeStruct.make(), com.cliffc.aa.type.TypeStruct.malloc(), and com.cliffc.aa.Parse.tuple().

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

◆ post_mod()

static boolean com.cliffc.aa.type.TypeStruct.post_mod ( Type  t)
staticprivate

Definition at line 743 of file TypeStruct.java.

743  {
744  t._hash = t.compute_hash();
745  DUPS.put(t);
746  return true;
747  }

References com.cliffc.aa.type.Type< T extends Type< T >._hash, com.cliffc.aa.type.Type< T extends Type< T >.compute_hash(), com.cliffc.aa.type.TypeStruct.DUPS, and com.cliffc.aa.util.IHashMap.put().

Referenced by com.cliffc.aa.type.TypeStruct.shrink().

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

◆ push()

void com.cliffc.aa.type.TypeStruct.push ( Ary< Type work,
Type  t 
)
private

Definition at line 795 of file TypeStruct.java.

795  {
796  int y = t._type;
797  if( (y==TMEMPTR || y==TFUNPTR || y==TSTRUCT || y==TFLD) &&
798  (t._hash == 0 || !t.interned()) && work.find(t)==-1 )
799  work.push(t);
800  }

References com.cliffc.aa.type.Type< T extends Type< T >._hash, com.cliffc.aa.type.Type< T extends Type< T >._type, com.cliffc.aa.util.Ary< E >.find(), com.cliffc.aa.type.Type< T extends Type< T >.interned(), and com.cliffc.aa.util.Ary< E >.push().

Referenced by com.cliffc.aa.type.TypeStruct.reachable().

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

◆ rdual()

TypeStruct com.cliffc.aa.type.TypeStruct.rdual ( )
package

Definition at line 252 of file TypeStruct.java.

252  {
253  if( _dual != null ) return _dual;
254  // Clone the fields for the recursive dual, and grab the field duals
255  TypeFld[] flds = TypeFlds.get(_flds.length);
256  for( int i=0; i<_flds.length; i++ )
257  // Some fields are interned already, the cyclic ones are not.
258  flds[i] = _flds[i].interned() ? _flds[i]._dual : _flds[i].xdual();
259  TypeStruct dual = _dual = new TypeStruct().init(_name,!_any,flds,!_open);
260  if( _hash != 0 ) {
261  assert _hash == compute_hash();
262  dual._hash = dual.compute_hash(); // Compute hash before recursion
263  }
264  for( int i=0; i<_flds.length; i++ )
265  flds[i] = _flds[i].interned() ? _flds[i]._dual : _flds[i].rdual();
266  dual._flds = TypeFlds.hash_cons(flds); // hashcons cyclic arrays
267  dual._dual = this;
268  dual._cyclic = _cyclic;
269  return dual;
270  }

References com.cliffc.aa.type.TypeObj< TypeStruct >._any, com.cliffc.aa.type.TypeStruct._cyclic, com.cliffc.aa.type.Type< T extends Type< T >._dual, com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeStruct._open, com.cliffc.aa.type.TypeStruct.compute_hash(), com.cliffc.aa.type.TypeStruct.flds(), com.cliffc.aa.type.TypeFlds.get(), com.cliffc.aa.type.TypeFlds.hash_cons(), com.cliffc.aa.type.TypeStruct.init(), com.cliffc.aa.type.TypeFld.rdual(), and com.cliffc.aa.type.TypeFld.xdual().

Referenced by com.cliffc.aa.type.TypeStruct.install_cyclic().

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

◆ reachable()

Ary<Type> com.cliffc.aa.type.TypeStruct.reachable ( )

Definition at line 779 of file TypeStruct.java.

779  {
780  Ary<Type> work = new Ary<>(new Type[1],0);
781  push(work, this);
782  int idx=0;
783  while( idx < work._len ) {
784  Type t = work.at(idx++);
785  switch( t._type ) {
786  case TMEMPTR: push(work, ((TypeMemPtr)t)._obj ); break;
787  case TFUNPTR: push(work, ((TypeFunPtr)t)._disp); break;
788  case TFLD : push(work, ((TypeFld )t)._t ); break;
789  case TSTRUCT: for( TypeFld tf : ((TypeStruct)t)._flds ) push(work, tf); break;
790  default: break;
791  }
792  }
793  return work;
794  }

References com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.util.Ary< E >._len, com.cliffc.aa.type.Type< T extends Type< T >._type, com.cliffc.aa.util.Ary< E >.at(), and com.cliffc.aa.type.TypeStruct.push().

Referenced by com.cliffc.aa.HM.HM9.T2._as_flow(), com.cliffc.aa.HM.HM.T2._as_flow(), com.cliffc.aa.type.TypeStruct.approx(), com.cliffc.aa.type.TypeStruct.cyclic_meet(), com.cliffc.aa.type.TypeStruct.sharpen(), com.cliffc.aa.type.TestApprox.testApprox2(), com.cliffc.aa.type.TestApprox.testApprox3(), com.cliffc.aa.type.TestApprox.testApprox6(), com.cliffc.aa.type.TestApprox.testApprox8(), com.cliffc.aa.type.TestType.testNameCycle(), com.cliffc.aa.type.TestType.testRecursive(), and com.cliffc.aa.type.TestApprox.testTSMeet().

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

◆ remove_other_flds()

TypeObj com.cliffc.aa.type.TypeStruct.remove_other_flds ( String  fld,
Type  live 
)
package

Definition at line 1069 of file TypeStruct.java.

1069  {
1070  int idx = fld_find(fld);
1071  if( idx == -1 ) return UNUSED; // No such field, so all fields will be XSCALAR so UNUSED instead
1072  TypeFld[] flds = TypeFlds.clone(_flds);
1073  for( int i=0; i<_flds.length; i++ ) {
1074  if( i != idx ) flds[i] = flds[i].setX(XSCALAR,Access.bot());
1075  flds[i] = flds[i].hashcons_free();
1076  }
1077  return make_from(flds);
1078  }

References com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeFld.Access.bot(), com.cliffc.aa.type.TypeFlds.clone(), com.cliffc.aa.type.TypeStruct.fld(), com.cliffc.aa.type.TypeStruct.fld_find(), com.cliffc.aa.type.TypeStruct.flds(), com.cliffc.aa.type.Type< T extends Type< T >.hashcons_free(), com.cliffc.aa.type.TypeStruct.make_from(), com.cliffc.aa.type.TypeFld.setX(), and com.cliffc.aa.type.TypeObj< TypeStruct >.UNUSED.

Here is the call graph for this function:

◆ repeats_in_cycles() [1/2]

TypeStruct com.cliffc.aa.type.TypeStruct.repeats_in_cycles ( )
package

Definition at line 450 of file TypeStruct.java.

450  {
451  assert _cyclic;
452  return repeats_in_cycles(this,new VBitSet());
453  }

References com.cliffc.aa.type.TypeStruct._cyclic.

Referenced by com.cliffc.aa.type.TypeStruct.install_cyclic(), com.cliffc.aa.type.TypeStruct.repeats_in_cycles(), and com.cliffc.aa.type.TestApprox.testTSMeet().

Here is the caller graph for this function:

◆ repeats_in_cycles() [2/2]

TypeStruct com.cliffc.aa.type.TypeStruct.repeats_in_cycles ( TypeStruct  head,
VBitSet  bs 
)
package

Definition at line 454 of file TypeStruct.java.

454  {
455  if( bs.tset(_uid) ) return null;
456  if( this!=head && equals(head) ) return this;
457  for( TypeFld t : _flds ) {
458  TypeStruct ts = t.repeats_in_cycles(head,bs);
459  if( ts!=null ) return ts;
460  }
461  return null;
462  }

References com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeStruct.equals(), com.cliffc.aa.type.TypeStruct.repeats_in_cycles(), and com.cliffc.aa.util.VBitSet.tset().

Here is the call graph for this function:

◆ set_fld()

TypeStruct com.cliffc.aa.type.TypeStruct.set_fld ( int  i,
Type  t,
Access  ff 
)

Definition at line 1030 of file TypeStruct.java.

1030  {
1031  TypeFld[] flds = TypeFlds.copyOf(_flds,_flds.length);
1032  flds[i] = TypeFld.make(_flds[i]._fld,t,ff,_flds[i]._order);
1033  return make_from(flds);
1034  }

References com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeFlds.copyOf(), com.cliffc.aa.type.TypeStruct.flds(), com.cliffc.aa.type.TypeFld.make(), and com.cliffc.aa.type.TypeStruct.make_from().

Referenced by com.cliffc.aa.node.IntrinsicNode.convertTypeNameStruct(), and com.cliffc.aa.TestParse.test_struct().

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

◆ sharpen()

static TypeMemPtr com.cliffc.aa.type.TypeStruct.sharpen ( TypeMem  mem,
TypeMemPtr  dull 
)
staticpackage

Definition at line 875 of file TypeStruct.java.

875  {
876  assert dull==dull.simple_ptr() && mem.sharp_get(dull)==null;
877 
878  // Pass 1: fill "dull" cache
879  HashMap<BitsAlias,TypeMemPtr> dull_cache = new HashMap<>();
880  _dull(mem,dull,dull_cache);
881 
882  // Pass 2: Stitch together structs with dull pointers to make a possibly cyclic result.
883  TypeMemPtr sharp = _sharp(mem,dull,dull_cache);
884  assert sharp.interned() == dull_cache.isEmpty();
885  // See if we need to cycle-install any cyclic types
886  if( dull_cache.isEmpty() )
887  return sharp;
888  // On exit, cyclic-intern all cyclic things; remove from dull cache.
889  RECURSIVE_MEET++;
890  TypeStruct mt = (TypeStruct)sharp._obj;
891  mt = shrink(mt.reachable(),mt); // No shrinking nor UF expected
892  Ary<Type> reaches = mt.reachable(); // Recompute reaches after shrink
893  assert check_uf(reaches);
894  UF.clear();
895  RECURSIVE_MEET--;
896  mt = mt.install_cyclic(reaches); // But yes cycles
897  sharp = sharp.make_from(mt);
898  return mem.sharput(dull,sharp);
899  }

References com.cliffc.aa.type.TypeStruct._dull(), com.cliffc.aa.type.TypeMemPtr._obj, com.cliffc.aa.type.TypeStruct._sharp(), com.cliffc.aa.type.TypeStruct.check_uf(), com.cliffc.aa.type.TypeStruct.install_cyclic(), com.cliffc.aa.type.Type< T extends Type< T >.interned(), com.cliffc.aa.type.TypeMemPtr.make_from(), com.cliffc.aa.type.TypeStruct.reachable(), com.cliffc.aa.type.TypeMem.sharp_get(), com.cliffc.aa.type.TypeMem.sharput(), com.cliffc.aa.type.TypeStruct.shrink(), com.cliffc.aa.type.TypeMemPtr.simple_ptr(), and com.cliffc.aa.type.TypeStruct.UF.

Referenced by com.cliffc.aa.type.TypeMem.sharpen().

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

◆ shrink()

static TypeStruct com.cliffc.aa.type.TypeStruct.shrink ( Ary< Type reaches,
TypeStruct  tstart 
)
static

Definition at line 657 of file TypeStruct.java.

657  {
658  assert DUPS.isEmpty();
659  // Structs never change their hash based on field types. Set their hash first.
660  for( int i=0; i<reaches._len; i++ ) {
661  Type t = reaches.at(i);
662  if( t instanceof TypeStruct || t instanceof TypeFld )
663  t._hash = t.compute_hash();
664  }
665  // TMPs depend on Structs
666  for( int i=0; i<reaches._len; i++ ) {
667  Type t = reaches.at(i);
668  if( t instanceof TypeMemPtr )
669  t._hash = t.compute_hash();
670  }
671  // TFPs depend on TMPS for display
672  for( int i=0; i<reaches._len; i++ ) {
673  Type t = reaches.at(i);
674  if( t instanceof TypeFunPtr )
675  t._hash = t.compute_hash();
676  }
677 
678  // Need back-edges to do this iteratively in 1 pass. This algo just sweeps
679  // until no more progress, but with generic looping instead of recursion.
680  boolean progress = true;
681  while( progress ) {
682  progress = false;
683  DUPS.clear();
684  for( int j=0; j<reaches._len; j++ ) {
685  Type t = reaches.at(j);
686  Type t0 = ufind(t);
687  Type t1 = t0.intern_lookup();
688  if( t1==null ) t1 = DUPS.get(t0);
689  if( t1 != null ) t1 = ufind(t1);
690  if( t1 == t0 ) continue; // This one is already interned
691  if( t1 != null ) { union(t0,t1); progress = true; continue; }
692 
693  switch( t._type ) {
694  case TMEMPTR: // Update TypeMemPtr internal field
695  TypeMemPtr tm = (TypeMemPtr)t0;
696  TypeObj t4 = tm._obj;
697  TypeObj t5 = ufind(t4);
698  if( t4 != t5 ) {
699  tm._obj = t5;
700  progress |= post_mod(tm);
701  if( !t5.interned() ) reaches.push(t5);
702  }
703  break;
704  case TFUNPTR: // Update TypeFunPtr internal field
705  TypeFunPtr tfptr = (TypeFunPtr)t0;
706  Type t6 = tfptr._disp;
707  Type t7 = ufind(t6);
708  if( t6 != t7 ) {
709  tfptr._disp = t7;
710  progress |= post_mod(tfptr);
711  if( !t7.interned() ) reaches.push(t7);
712  }
713  break;
714  case TSTRUCT: // Update all TypeStruct fields
715  TypeStruct ts = (TypeStruct)t0;
716  for( int i=0; i<ts._flds.length; i++ ) {
717  TypeFld tfld = ts._flds[i], tfld2 = ufind(tfld);
718  if( tfld != tfld2 ) {
719  progress = true;
720  ts._flds[i] = tfld2;
721  }
722  }
723  break;
724  case TFLD: // Update all TFlds
725  TypeFld tfld = (TypeFld)t0;
726  Type tft = tfld._t, t2 = ufind(tft);
727  if( tft != t2 ) {
728  progress = true;
729  tfld.setX(t2);
730  }
731  break;
732 
733  default: break;
734  }
735  DUPS.put(t0);
736  }
737  }
738  DUPS.clear();
739  return ufind(tstart);
740  }

References com.cliffc.aa.type.TypeFunPtr._disp, com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.Type< T extends Type< T >._hash, com.cliffc.aa.util.Ary< E >._len, com.cliffc.aa.type.TypeMemPtr._obj, com.cliffc.aa.type.TypeFld._t, com.cliffc.aa.type.Type< T extends Type< T >._type, com.cliffc.aa.util.Ary< E >.at(), com.cliffc.aa.util.IHashMap.clear(), com.cliffc.aa.type.Type< T extends Type< T >.compute_hash(), com.cliffc.aa.type.TypeStruct.DUPS, com.cliffc.aa.util.IHashMap.get(), com.cliffc.aa.type.Type< T extends Type< T >.intern_lookup(), com.cliffc.aa.type.Type< T extends Type< T >.interned(), com.cliffc.aa.util.IHashMap.isEmpty(), com.cliffc.aa.type.TypeStruct.post_mod(), com.cliffc.aa.util.Ary< E >.push(), com.cliffc.aa.util.IHashMap.put(), com.cliffc.aa.type.TypeFld.setX(), and com.cliffc.aa.type.TypeStruct.ufind().

Referenced by com.cliffc.aa.HM.HM9.T2._as_flow(), com.cliffc.aa.HM.HM.T2._as_flow(), com.cliffc.aa.type.TypeStruct.approx(), com.cliffc.aa.type.TypeStruct.cyclic_meet(), and com.cliffc.aa.type.TypeStruct.sharpen().

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

◆ str()

SB com.cliffc.aa.type.TypeStruct.str ( SB  sb,
VBitSet  dups,
TypeMem  mem,
boolean  debug 
)

Definition at line 145 of file TypeStruct.java.

145  {
146  if( dups.tset(_uid) ) return sb.p('$'); // Break recursive printing cycle
147  if( _any ) sb.p('~');
148  sb.p(_name);
149  boolean is_tup = is_tup();
150  sb.p(is_tup ? "(" : "@{");
151  // Special shortcut for the all-prims display type
152  if( fld_find("!") != -1 && fld_find("math_pi") != -1 ) {
153  Type t1 = _flds[1]._t;
154  sb.p(t1 instanceof TypeFunPtr
155  ? (((TypeFunPtr)t1)._fidxs.above_center() ? "PRIMS" : "LOW_PRIMS")
156  : "PRIMS_"+t1);
157  } else {
158  boolean field_sep=false;
159  for( int i=0; i<_flds.length; i++ ) {
160  if( !debug && i==0 && Util.eq(_flds[0]._fld,"^") ) continue; // Do not print the ever-present display
161  _flds[i].str(sb,dups,mem,debug); // Field name, access mod, type
162  sb.p(is_tup ? ", " : "; "); // Between fields
163  field_sep=true;
164  }
165  if( _open ) sb.p("..."); // More fields allowed
166  else if( field_sep ) sb.unchar().unchar();
167  }
168  sb.p(!is_tup ? "}" : ")");
169  return sb;
170  }

References com.cliffc.aa.type.TypeObj< TypeStruct >._any, com.cliffc.aa.type.TypeFld._fld, com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeStruct._open, com.cliffc.aa.type.TypeFld._t, com.cliffc.aa.util.Util.eq(), com.cliffc.aa.type.TypeStruct.fld_find(), com.cliffc.aa.type.TypeStruct.is_tup(), com.cliffc.aa.util.SB.p(), com.cliffc.aa.type.TypeFld.str(), com.cliffc.aa.util.VBitSet.tset(), and com.cliffc.aa.util.SB.unchar().

Here is the call graph for this function:

◆ tups() [1/2]

static TypeFld [] com.cliffc.aa.type.TypeStruct.tups ( Type  t1,
Type  t2 
)
static

Definition at line 186 of file TypeStruct.java.

186 { return TypeFlds.ts(TypeFld.NO_DISP,TypeFld.make_tup(t1,1), TypeFld.make_tup(t2,2)); }

References com.cliffc.aa.type.TypeFld.make_tup(), com.cliffc.aa.type.TypeFld.NO_DISP, and com.cliffc.aa.type.TypeFlds.ts().

Referenced by com.cliffc.aa.HM.HM.Pair1.Pair1X.apply(), com.cliffc.aa.HM.TestHM.make_tups(), com.cliffc.aa.TestParse.testParse01a(), com.cliffc.aa.TestParse.testParse02(), com.cliffc.aa.TestParse.testParse03(), com.cliffc.aa.TestParse.testParse06(), com.cliffc.aa.TestParse.testParse07(), com.cliffc.aa.TestParse.testParse09(), and com.cliffc.aa.TestParse.testParse14().

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

◆ tups() [2/2]

static TypeFld [] com.cliffc.aa.type.TypeStruct.tups ( Type  t1,
Type  t2,
Type  t3 
)
static

Definition at line 187 of file TypeStruct.java.

187 { return TypeFlds.ts(TypeFld.NO_DISP,TypeFld.make_tup(t1,1), TypeFld.make_tup(t2,2), TypeFld.make_tup(t3,3)); }

References com.cliffc.aa.type.TypeFld.make_tup(), com.cliffc.aa.type.TypeFld.NO_DISP, and com.cliffc.aa.type.TypeFlds.ts().

Here is the call graph for this function:

◆ ufind()

static <T extends Type> T com.cliffc.aa.type.TypeStruct.ufind ( t)
staticprivate

Definition at line 751 of file TypeStruct.java.

751  {
752  T t0 = (T)UF.get(t._uid), tu;
753  if( t0 == null ) return t; // One step, hit end of line
754  // Find end of U-F line
755  while( (tu = (T)UF.get(t0._uid)) != null ) t0=tu;
756  // Set whole line to 1-step end of line
757  while( (tu = (T)UF.get(t ._uid)) != null ) { assert t._uid != t0._uid; UF.put(t._uid,t0); t=tu; }
758  return t0;
759  }

References com.cliffc.aa.type.TypeStruct.UF.

Referenced by com.cliffc.aa.type.TypeStruct.ax_impl_fptr(), com.cliffc.aa.type.TypeStruct.ax_impl_ptr(), com.cliffc.aa.type.TypeStruct.ax_impl_struct(), com.cliffc.aa.type.TypeStruct.ax_meet(), com.cliffc.aa.type.TypeStruct.check_uf(), and com.cliffc.aa.type.TypeStruct.shrink().

Here is the caller graph for this function:

◆ union()

static <T extends Type> T com.cliffc.aa.type.TypeStruct.union ( lost,
kept 
)
staticprivate

Definition at line 760 of file TypeStruct.java.

760  {
761  if( lost == kept ) return kept;
762  assert lost._hash==0 || !lost.interned();
763  assert UF.get(lost._uid)==null && UF.get(kept._uid)==null;
764  assert lost._uid != kept._uid;
765  UF.put(lost._uid,kept);
766  return kept;
767  }

References com.cliffc.aa.type.TypeStruct.UF.

◆ update() [1/3]

TypeStruct com.cliffc.aa.type.TypeStruct.update ( Access  fin,
String  fld,
Type  val 
)

Definition at line 1044 of file TypeStruct.java.

1044 { return update(fin,fld,val,false); }

References com.cliffc.aa.type.TypeStruct.fld(), and com.cliffc.aa.type.TypeStruct.update().

Referenced by com.cliffc.aa.type.TypeStruct.update().

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

◆ update() [2/3]

TypeStruct com.cliffc.aa.type.TypeStruct.update ( Access  fin,
String  fld,
Type  val,
boolean  precise 
)
private

Definition at line 1046 of file TypeStruct.java.

1046  {
1047  int idx = fld_find(fld);
1048  if( idx == -1 ) return this; // Unknown field, assume changes no fields
1049  // Pointers & Memory to a Store can fall during GCP, and go from r/w to r/o
1050  // and the StoreNode output must remain monotonic. This means store
1051  // updates are allowed to proceed even if in-error.
1052  if( fin==Access.Final || fin==Access.ReadOnly ) precise=false;
1053  Type pval = precise ? val : _flds[idx]._t.meet(val);
1054  Access pfin = precise ? fin : _flds[idx]._access.meet(fin);
1055  TypeFld[] flds = TypeFlds.copyOf(_flds,_flds.length);
1056  flds[idx] = TypeFld.make(fld,pval,pfin,idx);
1057  return make(_name,_any,flds,_open);
1058  }

References com.cliffc.aa.type.TypeFld._access, com.cliffc.aa.type.TypeObj< TypeStruct >._any, com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeStruct._open, com.cliffc.aa.type.TypeFld._t, com.cliffc.aa.type.TypeFlds.copyOf(), com.cliffc.aa.type.TypeFld.Access.Final, com.cliffc.aa.type.TypeStruct.fld(), com.cliffc.aa.type.TypeStruct.fld_find(), com.cliffc.aa.type.TypeStruct.flds(), com.cliffc.aa.type.TypeFld.make(), com.cliffc.aa.type.TypeStruct.make(), com.cliffc.aa.type.TypeFld.Access.meet(), com.cliffc.aa.type.Type< T extends Type< T >.meet(), and com.cliffc.aa.type.TypeFld.Access.ReadOnly.

Here is the call graph for this function:

◆ update() [3/3]

TypeObj com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.update ( TypeInt  idx,
Type  val 
)
inherited

Definition at line 69 of file TypeObj.java.

69  {
70  if( this==ISUSED || this==OBJ ) return this;
71  return TypeAry.ARY.dual().update(idx,val);
72  }

◆ walk()

void com.cliffc.aa.type.TypeStruct.walk ( Predicate< Type p)

Definition at line 1135 of file TypeStruct.java.

1135  {
1136  if( p.test(this) )
1137  for( TypeFld fld : _flds ) fld.walk(p);
1138  }

References com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeStruct.fld(), and com.cliffc.aa.type.TypeFld.walk().

Referenced by com.cliffc.aa.node.ConTypeNode.def_fref(), and com.cliffc.aa.type.TypeStruct.install_cyclic().

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

◆ widen()

TypeStruct com.cliffc.aa.type.TypeStruct.widen ( )

Definition at line 1107 of file TypeStruct.java.

1107  {
1108  boolean widen=false;
1109  for( TypeFld fld : _flds )
1110  if( fld._t.widen()!=fld._t )
1111  { widen=true; break; }
1112  if( !widen ) return this;
1113  TypeFld[] flds = TypeFlds.clone(_flds);
1114  for( int i=0; i<_flds.length; i++ )
1115  flds[i] = flds[i].setX(_flds[i]._t.widen()).hashcons_free();
1116  return make_from(flds);
1117  }

References com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeFld._t, com.cliffc.aa.type.TypeFlds.clone(), com.cliffc.aa.type.TypeStruct.fld(), com.cliffc.aa.type.TypeStruct.flds(), com.cliffc.aa.type.Type< T extends Type< T >.hashcons_free(), com.cliffc.aa.type.TypeStruct.make_from(), and com.cliffc.aa.type.Type< T extends Type< T >.widen().

Here is the call graph for this function:

◆ xdual()

TypeStruct com.cliffc.aa.type.TypeStruct.xdual ( )
protected

Definition at line 245 of file TypeStruct.java.

245  {
246  TypeFld[] flds = TypeFlds.get(_flds.length);
247  for( int i=0; i<_flds.length; i++ ) flds[i] = _flds[i].dual();
248  return new TypeStruct().init(_name,!_any,TypeFlds.hash_cons(flds),!_open);
249  }

References com.cliffc.aa.type.TypeObj< TypeStruct >._any, com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeStruct._open, com.cliffc.aa.type.TypeStruct.flds(), com.cliffc.aa.type.TypeFlds.get(), com.cliffc.aa.type.TypeFlds.hash_cons(), and com.cliffc.aa.type.TypeStruct.init().

Here is the call graph for this function:

◆ xmeet()

Type com.cliffc.aa.type.TypeStruct.xmeet ( Type  t)
protected

Definition at line 280 of file TypeStruct.java.

280  {
281  switch( t._type ) {
282  case TSTRUCT:break;
283  case TARY:
284  case TLIVE:
285  case TSTR: return OBJ;
286  case TOBJ: return t.xmeet(this);
287  case TFUNSIG:
288  case TFLT:
289  case TINT:
290  case TTUPLE :
291  case TFUNPTR:
292  case TMEMPTR:
293  case TRPC:
294  case TMEM: return ALL;
295  default: throw typerr(t); // All else should not happen
296  }
297  TypeStruct thsi = this;
298  TypeStruct that = (TypeStruct)t;
299  // INVARIANT: Both this and that are prior existing & interned.
300  assert RECURSIVE_MEET > 0 || (thsi.interned() && that.interned());
301  // INVARIANT: Both MEETS are empty at the start. Nothing involved in a
302  // potential cycle is interned until the Meet completes.
303  assert RECURSIVE_MEET > 0 || (MEETS0.isEmpty());
304 
305  // If both are cyclic, we have to do the complicated cyclic-aware meet
306  if( _cyclic && that._cyclic )
307  return cyclic_meet(that);
308  // Recursive but not cyclic; since at least one of these types is
309  // non-cyclic normal recursion will bottom-out.
310 
311  // If unequal length; then if short is low it "wins" (result is short) else
312  // short is high and it "loses" (result is long).
313  return thsi._flds.length <= that._flds.length ? thsi.xmeet1(that,false) : that.xmeet1(thsi,false);
314  }

References com.cliffc.aa.type.TypeStruct._cyclic, com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.Type< T extends Type< T >._type, com.cliffc.aa.type.TypeStruct.cyclic_meet(), com.cliffc.aa.type.TypeStruct.MEETS0, com.cliffc.aa.type.TypeObj< TypeStruct >.OBJ, com.cliffc.aa.type.Type< T extends Type< T >.xmeet(), and com.cliffc.aa.type.TypeStruct.xmeet1().

Here is the call graph for this function:

◆ xmeet1()

TypeStruct com.cliffc.aa.type.TypeStruct.xmeet1 ( TypeStruct  tmax,
boolean  is_loop 
)
private

Definition at line 317 of file TypeStruct.java.

317  {
318  int len = _any ? tmax._flds.length : _flds.length;
319  // Meet of common elements
320  TypeFld[] flds = TypeFlds.get(len);
321  for( int i=0; i<_flds.length; i++ )
322  flds[i] = is_loop && flds[i]._access==Access.Final
323  ? _flds[i] // Ignore RHS on final fields around loops
324  : _flds[i].xmeet(tmax._flds[i]); // Recursive not cyclic
325  // Elements only in the longer tuple; the short struct must be high and so
326  // is effectively infinitely extended with high fields.
327  for( int i=_flds.length; i<len; i++ )
328  flds[i] = tmax._flds[i];
329  // Ignore name in the non-recursive meet, it will be computed by the outer
330  // 'meet' call anyways.
331  return malloc("",_any&tmax._any,flds,_open|tmax._open).hashcons_freeS();
332  }

References com.cliffc.aa.type.TypeObj< TypeStruct >._any, com.cliffc.aa.type.TypeObj< O extends TypeObj< O >._any, com.cliffc.aa.type.TypeStruct._flds, com.cliffc.aa.type.TypeStruct._open, com.cliffc.aa.type.TypeFld.Access.Final, com.cliffc.aa.type.TypeStruct.flds(), com.cliffc.aa.type.TypeFlds.get(), com.cliffc.aa.type.TypeStruct.hashcons_freeS(), com.cliffc.aa.type.TypeStruct.len(), com.cliffc.aa.type.TypeStruct.malloc(), and com.cliffc.aa.type.TypeFld.xmeet().

Referenced by com.cliffc.aa.type.TypeStruct.meet_loop(), and com.cliffc.aa.type.TypeStruct.xmeet().

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

Member Data Documentation

◆ _any

boolean com.cliffc.aa.type.TypeObj< O extends TypeObj< O >._any
packageinherited

Definition at line 16 of file TypeObj.java.

◆ _cyclic

◆ _flds

TypeFld [] com.cliffc.aa.type.TypeStruct._flds
private

Definition at line 51 of file TypeStruct.java.

Referenced by com.cliffc.aa.type.TypeStruct._clone(), com.cliffc.aa.type.TypeStruct._dull(), com.cliffc.aa.type.TypeStruct._is_sharp(), com.cliffc.aa.type.TypeStruct._sharp(), com.cliffc.aa.type.TypeStruct.add_fld(), com.cliffc.aa.type.TypeStruct.approx(), com.cliffc.aa.type.TypeStruct.at(), com.cliffc.aa.type.TypeStruct.ax_impl_struct(), com.cliffc.aa.type.TypeStruct.ax_meet(), com.cliffc.aa.type.TypeStruct.close(), com.cliffc.aa.type.TypeStruct.cmp(), com.cliffc.aa.type.TypeStruct.compute_hash(), com.cliffc.aa.type.TypeStruct.contains(), com.cliffc.aa.type.TypeStruct.crush(), com.cliffc.aa.type.TypeStruct.cycle_equals0(), com.cliffc.aa.type.TypeStruct.cyclic_meet(), com.cliffc.aa.type.TypeStruct.flatten_fields(), com.cliffc.aa.type.TypeStruct.fld(), com.cliffc.aa.type.TypeStruct.fld_find(), com.cliffc.aa.type.TypeStruct.flds(), com.cliffc.aa.type.TypeStruct.get_cyclic(), com.cliffc.aa.type.TypeStruct.hashcons_freeS(), com.cliffc.aa.type.TypeStruct.init(), com.cliffc.aa.type.TypeStruct.install_cyclic(), com.cliffc.aa.type.TypeStruct.intern_check1(), com.cliffc.aa.type.TypeStruct.is_display(), com.cliffc.aa.type.TypeStruct.is_tup(), com.cliffc.aa.type.TypeStruct.last(), com.cliffc.aa.type.TypeStruct.len(), com.cliffc.aa.type.TypeStruct.len0(), com.cliffc.aa.type.TypeStruct.make_from(), com.cliffc.aa.type.TypeStruct.make_from_flds(), com.cliffc.aa.type.TypeStruct.mark_cyclic(), com.cliffc.aa.type.TypeStruct.meet_loop(), com.cliffc.aa.type.TypeStruct.rdual(), com.cliffc.aa.type.TypeStruct.reachable(), com.cliffc.aa.type.TypeStruct.remove_other_flds(), com.cliffc.aa.type.TypeStruct.repeats_in_cycles(), com.cliffc.aa.type.TypeStruct.set_fld(), com.cliffc.aa.type.TypeStruct.shrink(), com.cliffc.aa.type.TypeStruct.str(), com.cliffc.aa.type.TypeStruct.update(), com.cliffc.aa.type.TypeStruct.walk(), com.cliffc.aa.type.TypeStruct.widen(), com.cliffc.aa.type.TypeStruct.xdual(), com.cliffc.aa.type.TypeStruct.xmeet(), and com.cliffc.aa.type.TypeStruct.xmeet1().

◆ _open

◆ _use

boolean com.cliffc.aa.type.TypeObj< O extends TypeObj< O >._use
packageinherited

Definition at line 17 of file TypeObj.java.

◆ A

final TypeStruct com.cliffc.aa.type.TypeStruct.A = make("a",TypeFlt.FLT64)
static

Definition at line 234 of file TypeStruct.java.

Referenced by com.cliffc.aa.type.TestType.testCrush().

◆ ALLSTRUCT

final TypeStruct com.cliffc.aa.type.TypeStruct.ALLSTRUCT = make("",false,new TypeFld[0],true )
static

◆ ANYSTRUCT

final TypeStruct com.cliffc.aa.type.TypeStruct.ANYSTRUCT = make("",true ,new TypeFld[0],false)
static

Definition at line 227 of file TypeStruct.java.

Referenced by com.cliffc.aa.node.NewObjNode.dead_type().

◆ ARW

final TypeStruct com.cliffc.aa.type.TypeStruct.ARW = make("a",TypeFlt.FLT64,Access.RW)
static

Definition at line 237 of file TypeStruct.java.

Referenced by com.cliffc.aa.type.TestType.testCrush().

◆ C0

final TypeStruct com.cliffc.aa.type.TypeStruct.C0 = make("c",TypeInt.FALSE)
staticprivate

Definition at line 235 of file TypeStruct.java.

◆ CYCLES

final Ary<TypeStruct> com.cliffc.aa.type.TypeStruct.CYCLES = new Ary<>(new TypeStruct[0])
staticprivate

◆ D1

final TypeStruct com.cliffc.aa.type.TypeStruct.D1 = make("d",TypeInt.TRUE )
staticprivate

Definition at line 236 of file TypeStruct.java.

◆ DUPS

final IHashMap com.cliffc.aa.type.TypeStruct.DUPS = new IHashMap()
staticprivate

◆ FLT64

final TypeStruct com.cliffc.aa.type.TypeStruct.FLT64 = make(flds(TypeFlt.FLT64))
static

Definition at line 238 of file TypeStruct.java.

◆ INT64_INT64

final TypeStruct com.cliffc.aa.type.TypeStruct.INT64_INT64 = make(flds(TypeInt.INT64,TypeInt.INT64))
static

Definition at line 239 of file TypeStruct.java.

Referenced by com.cliffc.aa.type.TestType.testCrush().

◆ ISUSED

final TypeObj com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.ISUSED
staticinherited

Definition at line 45 of file TypeObj.java.

◆ MEETS0

final HashMap<TPair,TypeStruct> com.cliffc.aa.type.TypeStruct.MEETS0 = new HashMap<>()
staticprivate

◆ NAMEPT

final TypeStruct com.cliffc.aa.type.TypeStruct.NAMEPT = make("Point:",false,POINT._flds,false)
static

◆ OBJ

final TypeObj com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.OBJ
staticinherited

Definition at line 44 of file TypeObj.java.

◆ OLD2APX

◆ POINT

final TypeStruct com.cliffc.aa.type.TypeStruct.POINT = make(flds(TypeFlt.FLT64,TypeFlt.FLT64))
static

Definition at line 231 of file TypeStruct.java.

Referenced by com.cliffc.aa.type.TestType.testCrush().

◆ TFLT64

final TypeStruct com.cliffc.aa.type.TypeStruct.TFLT64 = make(".",TypeFlt.FLT64)
staticpackage

Definition at line 233 of file TypeStruct.java.

Referenced by com.cliffc.aa.type.TestType.testStructTuple().

◆ TYPES

◆ UF

◆ UNUSED

final TypeObj com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.UNUSED
staticinherited

Definition at line 46 of file TypeObj.java.

◆ XOBJ

final TypeObj com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.XOBJ
staticinherited

Definition at line 47 of file TypeObj.java.


The documentation for this class was generated from the following file:
com.cliffc.aa.type.TypeStruct._open
boolean _open
Definition: TypeStruct.java:52
com.cliffc.aa.type.TypeStruct.ax_impl_struct
static TypeStruct ax_impl_struct(int alias, boolean isnews, int cutoff, Ary< TypeStruct > cutoffs, int d, TypeStruct dold, TypeStruct old)
Definition: TypeStruct.java:507
com.cliffc.aa.util.Ary.at
E at(int i)
Definition: Ary.java:25
com.cliffc.aa.type.TypeStruct.ax_impl_ptr
static TypeMemPtr ax_impl_ptr(int alias, int cutoff, Ary< TypeStruct > cutoffs, int d, TypeStruct dold, TypeMemPtr old)
Definition: TypeStruct.java:546
com.cliffc.aa.util.BitSetSparse.tset
boolean tset(int b0, int b1)
Definition: BitSetSparse.java:6
com.cliffc.aa.type.TypeStruct.push
void push(Ary< Type > work, Type t)
Definition: TypeStruct.java:795
com.cliffc.aa.type.TypeStruct.check_uf
static boolean check_uf(Ary< Type > reaches)
Definition: TypeStruct.java:804
com.cliffc.aa.type.TypeStruct.len0
int len0(TypeStruct tmax)
Definition: TypeStruct.java:866
com.cliffc.aa.util.IHashMap.get
public< T > T get(T key)
Definition: IHashMap.java:11
com.cliffc.aa.type.TypeStruct.repeats_in_cycles
TypeStruct repeats_in_cycles()
Definition: TypeStruct.java:450
com.cliffc.aa.type.TypeFld.xmeet
TypeFld xmeet(Type tf)
Definition: TypeFld.java:80
com.cliffc.aa.type.Type.clone
Type clone()
Definition: Type.java:304
com.cliffc.aa.util.Ary.push
E push(E e)
Add element in amortized constant time.
Definition: Ary.java:58
com.cliffc.aa.util.Ary.isEmpty
boolean isEmpty()
Definition: Ary.java:20
com.cliffc.aa.type.Type.isa
boolean isa(Type t)
Definition: Type.java:623
com.cliffc.aa.type.TypeFld._order
int _order
Definition: TypeFld.java:18
com.cliffc.aa.util.Util.eq
static boolean eq(String s0, String s1)
Definition: Util.java:16
com.cliffc.aa.type.TypeStruct.compute_hash
int compute_hash()
Definition: TypeStruct.java:66
com.cliffc.aa.type.TypeObj< TypeStruct >::_any
boolean _any
Definition: TypeObj.java:16
com.cliffc.aa.type.Type.join
Type join(Type t)
Definition: Type.java:619
com.cliffc.aa.type.Type.interned
boolean interned()
Definition: Type.java:209
com.cliffc.aa.type.Type.SCALAR
static final Type SCALAR
Definition: Type.java:328
com.cliffc
com.cliffc.aa.type.Type._hash
int _hash
Definition: Type.java:97
com.cliffc.aa.type.Type.widen
Type widen()
Definition: Type.java:828
com.cliffc.aa.util.Ary.pop
E pop()
Definition: Ary.java:41
com.cliffc.aa.util.VBitSet.test
boolean test(int idx)
Definition: VBitSet.java:8
com.cliffc.aa.type.TypeStruct.UF
static final NonBlockingHashMapLong< Type > UF
Definition: TypeStruct.java:475
com.cliffc.aa.type.Type.XSCALAR
static final Type XSCALAR
Definition: Type.java:329
com.cliffc.aa.type.TypeStruct.ufind
static< T extends Type > T ufind(T t)
Definition: TypeStruct.java:751
com.cliffc.aa.type.TypeFld.is_display_ptr
boolean is_display_ptr()
Definition: TypeFld.java:190
com.cliffc.aa.type.TypeStruct.ax_meet
static Type ax_meet(BitSetSparse bs, Type nt, Type old)
Definition: TypeStruct.java:591
com.cliffc.aa.type.Type
an implementation of language AA
Definition: Type.java:94
com.cliffc.aa.type.TypeFld.xdual
TypeFld xdual()
Definition: TypeFld.java:69
com.cliffc.aa.util.Ary
Definition: Ary.java:11
com.cliffc.aa.type.Type.compute_hash
int compute_hash()
Definition: Type.java:109
com.cliffc.aa.type.Type._type
byte _type
Definition: Type.java:98
com.cliffc.aa.type.TypeFld.NO_DISP
static final TypeFld NO_DISP
Definition: TypeFld.java:170
com.cliffc.aa.util.Ary._len
int _len
Definition: Ary.java:13
com.cliffc.aa.type.TypeStruct.cycle_equals
boolean cycle_equals(Type o)
Definition: TypeStruct.java:110
com.cliffc.aa.type.TypeStruct.rdual
TypeStruct rdual()
Definition: TypeStruct.java:252
com.cliffc.aa.type.Type.ANY
static final Type ANY
Definition: Type.java:325
com.cliffc.aa.type.TypeStruct.hashcons_freeS
TypeStruct hashcons_freeS()
Definition: TypeStruct.java:178
com.cliffc.aa.type.Type.meet
final Type meet(Type t)
Definition: Type.java:412
com.cliffc.aa.type.TypeFld.make
static TypeFld make(String fld, Type t, int order)
Definition: TypeFld.java:58
com.cliffc.aa.AA.unimpl
static RuntimeException unimpl()
Definition: AA.java:10
com.cliffc.aa.type.TypeStruct.flds
TypeFld[] flds()
Definition: TypeStruct.java:1018
com.cliffc.aa.util.BitSetSparse
Definition: BitSetSparse.java:4
com.cliffc.aa.type.TypeStruct.len
int len()
Definition: TypeStruct.java:1015
com.cliffc.aa.util.SB.unchar
SB unchar()
Definition: SB.java:58
com.cliffc.aa.type.Type.ALL
static final Type ALL
Definition: Type.java:324
com.cliffc.aa.type.TypeFld.rdual
TypeFld rdual()
Definition: TypeFld.java:70
com.cliffc.aa.type.Type.cycle_equals
boolean cycle_equals(Type t)
Definition: Type.java:118
com.cliffc.aa.type.TypeStruct.widen
TypeStruct widen()
Definition: TypeStruct.java:1107
com.cliffc.aa.util.VBitSet.tset
boolean tset(int idx)
Definition: VBitSet.java:7
com.cliffc.aa.type.TypeStruct._is_sharp
static boolean _is_sharp(Type t)
Definition: TypeStruct.java:940
com.cliffc.aa.type.TypeObj< TypeStruct >::OBJ
static final TypeObj OBJ
Definition: TypeObj.java:44
com.cliffc.aa.type.TypeFld.fldBot
static final String fldBot
Definition: TypeFld.java:140
com.cliffc.aa.type.TypeFld.setX
TypeFld setX(Type t)
Definition: TypeFld.java:173
com.cliffc.aa.type.TypeFld._access
Access _access
Definition: TypeFld.java:17
com.cliffc.aa.util.IHashMap.isEmpty
boolean isEmpty()
Definition: IHashMap.java:14
com.cliffc.aa.type.TypeStruct.OLD2APX
static final IHashMap OLD2APX
Definition: TypeStruct.java:476
com.cliffc.aa.type.Type._dual
T _dual
Definition: Type.java:100
com.cliffc.aa.type.TypeStruct.equals
boolean equals(Object o)
Definition: TypeStruct.java:89
com.cliffc.aa.type.Type.contains
final boolean contains(Type t)
Definition: Type.java:926
com.cliffc.aa.type.TypeStruct.init
TypeStruct init(String name, boolean any, TypeFld[] flds, boolean open)
Definition: TypeStruct.java:55
com.cliffc.aa.util.Util
Definition: Util.java:5
com.cliffc.aa.type.TypeObj< TypeStruct >::UNUSED
static final TypeObj UNUSED
Definition: TypeObj.java:46
com.cliffc.aa.type.Type.make_from
Type make_from(Type head, TypeMem map, VBitSet visit)
Definition: Type.java:945
com.cliffc.aa.type.TypeStruct.post_mod
static boolean post_mod(Type t)
Definition: TypeStruct.java:743
com.cliffc.aa.type.TypeStruct._sharp
static TypeMemPtr _sharp(TypeMem mem, TypeMemPtr dull, HashMap< BitsAlias, TypeMemPtr > dull_cache)
Definition: TypeStruct.java:963
com.cliffc.aa.type.TypeStruct.isDigit
static boolean isDigit(char c)
Definition: TypeStruct.java:140
com.cliffc.aa.type.Type.xmeet
Type xmeet(Type t)
Definition: Type.java:461
com.cliffc.aa.type.TypeObj.ISUSED
static final TypeObj ISUSED
Definition: TypeObj.java:45
com.cliffc.aa.type.TypeFld._fld
String _fld
Definition: TypeFld.java:15
com.cliffc.aa.type.TypeFld.fldTop
static final String fldTop
Definition: TypeFld.java:139
com.cliffc.aa.type.TypeStruct._clone
TypeStruct _clone()
Definition: TypeStruct.java:465
com.cliffc.aa.type.TypeStruct.DUPS
static final IHashMap DUPS
Definition: TypeStruct.java:656
com.cliffc.aa.type.TypeStruct.open
static TypeStruct open(Type tdisp)
Definition: TypeStruct.java:210
com.cliffc.aa.util.VBitSet
Definition: VBitSet.java:5
com.cliffc.aa.type.Type.hashcons_free
final T hashcons_free()
Definition: Type.java:153
com.cliffc.aa.type.Type.NIL
static final Type NIL
Definition: Type.java:332
com.cliffc.aa.type.TypeStruct.walk
void walk(Predicate< Type > p)
Definition: TypeStruct.java:1135
com.cliffc.aa.type.TypeStruct.is_tup
boolean is_tup()
Definition: TypeStruct.java:141
com.cliffc.aa.type.TypeStruct.ax_impl_fptr
static Type ax_impl_fptr(int alias, int cutoff, Ary< TypeStruct > cutoffs, int d, TypeStruct dold, TypeFunPtr old)
Definition: TypeStruct.java:569
com.cliffc.aa.type.TypeFld.walk
void walk(Predicate< Type > p)
Definition: TypeFld.java:194
com.cliffc.aa.AA
an implementation of language AA
Definition: AA.java:9
com.cliffc.aa.type.TypeStruct.fld_find
int fld_find(String fld)
Definition: TypeStruct.java:1038
com.cliffc.aa
Definition: AA.java:1
com.cliffc.aa.type.TypeStruct.fld
TypeFld fld(int idx)
Definition: TypeStruct.java:1012
com.cliffc.aa.type.Type._uid
int _uid
Definition: Type.java:96
com.cliffc.aa.type.TypeStruct._flds
TypeFld[] _flds
Definition: TypeStruct.java:51
com.cliffc.aa.type.TypeStruct.make_from
TypeStruct make_from(String name)
Definition: TypeStruct.java:215
com.cliffc.aa.type.TypeStruct.cycle_equals0
boolean cycle_equals0(TypeStruct t)
Definition: TypeStruct.java:128
com.cliffc.aa.type.TypeStruct.check_interned
static boolean check_interned(Ary< Type > reachs)
Definition: TypeStruct.java:770
com.cliffc.aa.type.TypeStruct.xmeet1
TypeStruct xmeet1(TypeStruct tmax, boolean is_loop)
Definition: TypeStruct.java:317
com.cliffc.aa.util.SB.p
SB p(String s)
Definition: SB.java:13
com.cliffc.aa.type.TypeFld.simple_ptr
TypeFld simple_ptr()
Definition: TypeFld.java:192
com.cliffc.aa.type.TypeStruct.get_cyclic
BitSet get_cyclic()
Definition: TypeStruct.java:822
com.cliffc.aa.type.TypeStruct.mark_cyclic
void mark_cyclic(BitSet bcs, Ary< Type > reaches)
Definition: TypeStruct.java:849
com.cliffc.aa.type.TypeFld.Access.meet
Access meet(Access a)
Definition: TypeFld.java:130
com.cliffc.aa.type.TypeStruct.add_fld
TypeStruct add_fld(String name, Access mutable)
Definition: TypeStruct.java:1021
com.cliffc.aa.type.TypeFld._t
Type _t
Definition: TypeFld.java:16
com.cliffc.aa.type.TypeStruct.make
static TypeStruct make(String fld_name, Type t)
Definition: TypeStruct.java:190
com.cliffc.aa.type.TypeStruct.shrink
static TypeStruct shrink(Ary< Type > reaches, TypeStruct tstart)
Definition: TypeStruct.java:657
com.cliffc.aa.type.Type.XNIL
static final Type XNIL
Definition: Type.java:333
com.cliffc.aa.type.TypeStruct.malloc
static TypeStruct malloc(String name, boolean any, TypeFld[] flds, boolean open)
Definition: TypeStruct.java:175
com.cliffc.aa.util.Ary.find
int find(E e)
Find the first matching element using ==, or -1 if none.
Definition: Ary.java:192
com.cliffc.aa.type.Type.intern_lookup
Type intern_lookup()
Definition: Type.java:210
com.cliffc.aa.type.TypeObj< TypeStruct >::_use
boolean _use
Definition: TypeObj.java:17
com.cliffc.aa.type.TypeFld.init
TypeFld init( @NotNull String fld, Type t, Access access, int order)
Definition: TypeFld.java:20
com.cliffc.aa.type.TypeStruct.find_other
TypeStruct find_other()
Definition: TypeStruct.java:106
com.cliffc.aa.type.TypeFld.str
SB str(SB sb, VBitSet dups, TypeMem mem, boolean debug)
Definition: TypeFld.java:44
com.cliffc.aa.type.TypeStruct._cyclic
boolean _cyclic
Definition: TypeStruct.java:54
com.cliffc.aa.type.TypeStruct.cyclic_meet
TypeStruct cyclic_meet(TypeStruct that)
Definition: TypeStruct.java:351
com
com.cliffc.aa.util.IHashMap.put
public< T > T put(T kv)
Definition: IHashMap.java:9
com.cliffc.aa.type.TypeStruct._dull
static void _dull(TypeMem mem, TypeMemPtr dull, HashMap< BitsAlias, TypeMemPtr > dull_cache)
Definition: TypeStruct.java:909
com.cliffc.aa.util.IHashMap.clear
void clear()
Definition: IHashMap.java:13
com.cliffc.aa.type.TypeStruct.cmp
int cmp(TypeStruct t)
Definition: TypeStruct.java:76
com.cliffc.aa.type.TypeStruct.CYCLES
static final Ary< TypeStruct > CYCLES
Definition: TypeStruct.java:105
com.cliffc.aa.type.TypeStruct.update
TypeStruct update(Access fin, String fld, Type val)
Definition: TypeStruct.java:1044
com.cliffc.aa.type.TypeStruct.MEETS0
static final HashMap< TPair, TypeStruct > MEETS0
Definition: TypeStruct.java:346