aa
com.cliffc.aa.HM.HM9.Field Class Reference
Inheritance diagram for com.cliffc.aa.HM.HM9.Field:
[legend]
Collaboration diagram for com.cliffc.aa.HM.HM9.Field:
[legend]

Public Member Functions

String p ()
 
final String toString ()
 

Package Functions

 Field (String id, Syntax str)
 
void add_hm_work (Worklist work)
 
void add_val_work (Syntax child, Worklist work)
 
T2 debug_find ()
 
T2 find ()
 
boolean hm (Worklist work)
 
boolean more_work (Worklist work)
 
final boolean more_work_impl (Worklist work)
 
final SB p0 (SB sb, VBitSet dups)
 
SB p1 (SB sb)
 
SB p2 (SB sb, VBitSet dups)
 
void prep_lookup_deps (Ident id)
 
int prep_tree (Syntax par, VStack nongen, Worklist work)
 
final void prep_tree_impl (Syntax par, VStack nongen, Worklist work, T2 t)
 
SB str (SB sb)
 
Type val (Worklist work)
 

Package Attributes

Type _flow
 
T2 _hmt
 
final String _id
 
VStack _nongen
 
Syntax _par
 
final Syntax _rec
 

Detailed Description

Definition at line 869 of file HM9.java.

Constructor & Destructor Documentation

◆ Field()

com.cliffc.aa.HM.HM9.Field.Field ( String  id,
Syntax  str 
)
package

Definition at line 872 of file HM9.java.

872 { _id=id; _rec =str; }

References com.cliffc.aa.HM.HM9.Field._id, com.cliffc.aa.HM.HM9.Field._rec, com.cliffc.aa.HM.HM9.id(), and com.cliffc.aa.HM.HM9.Field.str().

Here is the call graph for this function:

Member Function Documentation

◆ add_hm_work()

void com.cliffc.aa.HM.HM9.Field.add_hm_work ( Worklist  work)
package

Reimplemented from com.cliffc.aa.HM.HM9.Syntax.

Definition at line 895 of file HM9.java.

895  {
896  work.push(_par);
897  work.push(_rec);
898  _rec.add_hm_work(work);
899  }

References com.cliffc.aa.HM.HM9.Syntax._par, com.cliffc.aa.HM.HM9.Field._rec, com.cliffc.aa.HM.HM9.Syntax.add_hm_work(), and com.cliffc.aa.HM.HM9.Worklist.push().

Here is the call graph for this function:

◆ add_val_work()

void com.cliffc.aa.HM.HM9.Syntax.add_val_work ( Syntax  child,
Worklist  work 
)
packageinherited

Reimplemented in com.cliffc.aa.HM.HM9.PrimSyn, com.cliffc.aa.HM.HM9.Apply, com.cliffc.aa.HM.HM9.Let, and com.cliffc.aa.HM.HM9.Lambda.

Definition at line 346 of file HM9.java.

346 {} // Add affected neighbors to worklist

Referenced by com.cliffc.aa.HM.HM9.hm().

Here is the caller graph for this function:

◆ debug_find()

T2 com.cliffc.aa.HM.HM9.Syntax.debug_find ( )
packageinherited

Definition at line 329 of file HM9.java.

329 { return _hmt.debug_find(); } // Find, without the roll-up

References com.cliffc.aa.HM.HM9.Syntax._hmt, and com.cliffc.aa.HM.HM9.T2.debug_find().

Referenced by com.cliffc.aa.HM.HM9.hm().

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

◆ find()

◆ hm()

boolean com.cliffc.aa.HM.HM9.Field.hm ( Worklist  work)
package

Reimplemented from com.cliffc.aa.HM.HM9.Syntax.

Definition at line 876 of file HM9.java.

876  {
877  if( find().is_err() ) return false; // Already an error; no progress
878  T2 rec = _rec.find();
879  if( (rec._alias!=null && rec._alias.test(0)) || rec._flow == Type.XNIL )
880  return find().unify(T2.make_err("May be nil when loading field "+_id),work);
881  int idx = rec._ids==null ? -1 : Util.find(rec._ids,_id);
882  if( idx!= -1 ) // Unify against a pre-existing field
883  return rec.args(idx).unify(find(), work);
884  // The remaining cases all make progress and return true
885  if( work==null ) return true;
886  if( rec.is_err() ) return find().unify(rec,work);
887  // Not a struct or no field, force it to be one
888  if( rec.is_struct() && rec._open ) // Effectively unify with an extended struct.
889  return rec.add_fld(_id,find(),work);
890  if( rec.is_leaf() )
891  return T2.make_struct(BitsAlias.EMPTY,new String[]{_id}, new T2[]{find().push_update(rec._deps)},true).unify(rec.push_update(this), work);
892 
893  return find().unify(rec.miss_field(_id),work);
894  }

References com.cliffc.aa.HM.HM9.T2._alias, com.cliffc.aa.HM.HM9.T2._flow, com.cliffc.aa.HM.HM9.Field._id, com.cliffc.aa.HM.HM9.T2._ids, com.cliffc.aa.HM.HM9.T2._open, com.cliffc.aa.HM.HM9.Field._rec, com.cliffc.aa.HM.HM9.T2.add_fld(), com.cliffc.aa.HM.HM9.T2.args(), com.cliffc.aa.type.BitsAlias.EMPTY, com.cliffc.aa.util.Util.find(), com.cliffc.aa.HM.HM9.Syntax.find(), com.cliffc.aa.HM.HM9.T2.is_err(), com.cliffc.aa.HM.HM9.T2.is_leaf(), com.cliffc.aa.HM.HM9.T2.is_struct(), com.cliffc.aa.HM.HM9.T2.make_err(), com.cliffc.aa.HM.HM9.T2.make_struct(), com.cliffc.aa.HM.HM9.T2.miss_field(), com.cliffc.aa.HM.HM9.T2.push_update(), com.cliffc.aa.type.Bits< B extends Bits< B >.test(), com.cliffc.aa.HM.HM9.T2.unify(), and com.cliffc.aa.type.Type< T extends Type< T >.XNIL.

Here is the call graph for this function:

◆ more_work()

boolean com.cliffc.aa.HM.HM9.Field.more_work ( Worklist  work)
package

Reimplemented from com.cliffc.aa.HM.HM9.Syntax.

Definition at line 919 of file HM9.java.

919  {
920  if( !more_work_impl(work) ) return false;
921  return _rec.more_work(work);
922  }

References com.cliffc.aa.HM.HM9.Field._rec, com.cliffc.aa.HM.HM9.Syntax.more_work(), and com.cliffc.aa.HM.HM9.Syntax.more_work_impl().

Here is the call graph for this function:

◆ more_work_impl()

final boolean com.cliffc.aa.HM.HM9.Syntax.more_work_impl ( Worklist  work)
packageinherited

Definition at line 362 of file HM9.java.

362  {
363  if( work.has(this) ) return true;
364  if( DO_HM && hm(null) ) // Any more HM work?
365  return false; // Found HM work not on worklist
366  if( DO_GCP && val(null)!=_flow )
367  return false; // Found GCP work not on worklist
368  return true;
369  }

References com.cliffc.aa.HM.HM9.Syntax._flow, com.cliffc.aa.HM.HM9.DO_GCP, com.cliffc.aa.HM.HM9.DO_HM, com.cliffc.aa.HM.HM9.Worklist.has(), com.cliffc.aa.HM.HM9.Syntax.hm(), and com.cliffc.aa.HM.HM9.Syntax.val().

Referenced by com.cliffc.aa.HM.HM9.Con.more_work(), com.cliffc.aa.HM.HM9.Ident.more_work(), com.cliffc.aa.HM.HM9.Lambda.more_work(), com.cliffc.aa.HM.HM9.Let.more_work(), com.cliffc.aa.HM.HM9.Apply.more_work(), com.cliffc.aa.HM.HM9.Struct.more_work(), com.cliffc.aa.HM.HM9.Field.more_work(), and com.cliffc.aa.HM.HM9.PrimSyn.more_work().

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

◆ p()

String com.cliffc.aa.HM.HM9.Syntax.p ( )
inherited

Definition at line 374 of file HM9.java.

374 { return p0(new SB(), new VBitSet()).toString(); }

References com.cliffc.aa.HM.HM9.Syntax.p0(), and com.cliffc.aa.util.SB.toString().

Here is the call graph for this function:

◆ p0()

final SB com.cliffc.aa.HM.HM9.Syntax.p0 ( SB  sb,
VBitSet  dups 
)
packageinherited

Definition at line 375 of file HM9.java.

375  {
376  _hmt.get_dups(dups);
377  VBitSet visit = new VBitSet();
378  p1(sb.i());
379  if( DO_HM ) _hmt .str(sb.p(", HM="), visit,dups);
380  if( DO_GCP ) _flow.str(sb.p(", CCP="),visit.clr(),null,false);
381  sb.nl();
382  return p2(sb.ii(1),dups).di(1);
383  }

References com.cliffc.aa.HM.HM9.Syntax._flow, com.cliffc.aa.HM.HM9.Syntax._hmt, com.cliffc.aa.util.VBitSet.clr(), com.cliffc.aa.util.SB.di(), com.cliffc.aa.HM.HM9.DO_GCP, com.cliffc.aa.HM.HM9.DO_HM, com.cliffc.aa.HM.HM9.T2.get_dups(), com.cliffc.aa.util.SB.i(), com.cliffc.aa.util.SB.ii(), com.cliffc.aa.util.SB.nl(), com.cliffc.aa.util.SB.p(), com.cliffc.aa.HM.HM9.Syntax.p1(), com.cliffc.aa.HM.HM9.Syntax.p2(), com.cliffc.aa.type.Type< T extends Type< T >.str(), and com.cliffc.aa.HM.HM9.T2.str().

Referenced by com.cliffc.aa.HM.HM9.Syntax.p(), com.cliffc.aa.HM.HM9.Lambda.p2(), com.cliffc.aa.HM.HM9.Let.p2(), com.cliffc.aa.HM.HM9.Apply.p2(), com.cliffc.aa.HM.HM9.Struct.p2(), and com.cliffc.aa.HM.HM9.Field.p2().

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

◆ p1()

SB com.cliffc.aa.HM.HM9.Field.p1 ( SB  sb)
package

Reimplemented from com.cliffc.aa.HM.HM9.Syntax.

Definition at line 874 of file HM9.java.

874 { return sb.p(".").p(_id); }

References com.cliffc.aa.HM.HM9.Field._id, and com.cliffc.aa.util.SB.p().

Here is the call graph for this function:

◆ p2()

SB com.cliffc.aa.HM.HM9.Field.p2 ( SB  sb,
VBitSet  dups 
)
package

Reimplemented from com.cliffc.aa.HM.HM9.Syntax.

Definition at line 875 of file HM9.java.

875 { return _rec.p0(sb,dups); }

References com.cliffc.aa.HM.HM9.Field._rec, and com.cliffc.aa.HM.HM9.Syntax.p0().

Here is the call graph for this function:

◆ prep_lookup_deps()

void com.cliffc.aa.HM.HM9.Syntax.prep_lookup_deps ( Ident  id)
packageinherited

Reimplemented in com.cliffc.aa.HM.HM9.Let, and com.cliffc.aa.HM.HM9.Lambda.

Definition at line 358 of file HM9.java.

358 {}

◆ prep_tree()

int com.cliffc.aa.HM.HM9.Field.prep_tree ( Syntax  par,
VStack  nongen,
Worklist  work 
)
package

Reimplemented from com.cliffc.aa.HM.HM9.Syntax.

Definition at line 915 of file HM9.java.

915  {
916  prep_tree_impl(par, nongen, work, T2.make_leaf());
917  return _rec.prep_tree(this,nongen,work)+1;
918  }

References com.cliffc.aa.HM.HM9.Field._rec, com.cliffc.aa.HM.HM9.T2.make_leaf(), com.cliffc.aa.HM.HM9.Syntax.prep_tree(), and com.cliffc.aa.HM.HM9.Syntax.prep_tree_impl().

Here is the call graph for this function:

◆ prep_tree_impl()

final void com.cliffc.aa.HM.HM9.Syntax.prep_tree_impl ( Syntax  par,
VStack  nongen,
Worklist  work,
T2  t 
)
packageinherited

Definition at line 351 of file HM9.java.

351  {
352  _par = par;
353  _hmt = t;
354  _flow= Type.XSCALAR;
355  _nongen = nongen;
356  work.push(this);
357  }

References com.cliffc.aa.HM.HM9.Syntax._flow, com.cliffc.aa.HM.HM9.Syntax._hmt, com.cliffc.aa.HM.HM9.Syntax._nongen, com.cliffc.aa.HM.HM9.Syntax._par, com.cliffc.aa.HM.HM9.Worklist.push(), and com.cliffc.aa.type.Type< T extends Type< T >.XSCALAR.

Referenced by com.cliffc.aa.HM.HM9.Con.prep_tree(), com.cliffc.aa.HM.HM9.Ident.prep_tree(), com.cliffc.aa.HM.HM9.Lambda.prep_tree(), com.cliffc.aa.HM.HM9.Let.prep_tree(), com.cliffc.aa.HM.HM9.Apply.prep_tree(), com.cliffc.aa.HM.HM9.Struct.prep_tree(), com.cliffc.aa.HM.HM9.Field.prep_tree(), and com.cliffc.aa.HM.HM9.PrimSyn.prep_tree().

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

◆ str()

SB com.cliffc.aa.HM.HM9.Field.str ( SB  sb)
package

Reimplemented from com.cliffc.aa.HM.HM9.Syntax.

Definition at line 873 of file HM9.java.

873 { return _rec.str(sb.p(".").p(_id).p(' ')); }

References com.cliffc.aa.HM.HM9.Field._id, com.cliffc.aa.HM.HM9.Field._rec, com.cliffc.aa.util.SB.p(), and com.cliffc.aa.HM.HM9.Syntax.str().

Referenced by com.cliffc.aa.HM.HM9.Field.Field().

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

◆ toString()

final String com.cliffc.aa.HM.HM9.Syntax.toString ( )
inherited

Definition at line 371 of file HM9.java.

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

References com.cliffc.aa.HM.HM9.Syntax.str(), and com.cliffc.aa.util.SB.toString().

Referenced by com.cliffc.aa.HM.HM9.Lambda.p1().

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

◆ val()

Type com.cliffc.aa.HM.HM9.Field.val ( Worklist  work)
package

Reimplemented from com.cliffc.aa.HM.HM9.Syntax.

Definition at line 900 of file HM9.java.

900  {
901  Type trec = _rec._flow;
902  if( trec.above_center() ) return Type.XSCALAR;
903  if( trec instanceof TypeMemPtr ) {
904  TypeMemPtr tmp = (TypeMemPtr)trec;
905  if( tmp._obj instanceof TypeStruct ) {
906  TypeStruct tstr = (TypeStruct)tmp._obj;
907  int idx = tstr.fld_find(_id);
908  if( idx!=-1 ) return tstr.at(idx); // Field type
909  }
910  if( tmp._obj.above_center() ) return Type.XSCALAR;
911  }
912  // TODO: Need an error type here
913  return Type.SCALAR;
914  }

References com.cliffc.aa.HM.HM9.Syntax._flow, com.cliffc.aa.HM.HM9.Field._id, com.cliffc.aa.type.TypeMemPtr._obj, com.cliffc.aa.HM.HM9.Field._rec, com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.above_center(), com.cliffc.aa.type.Type< T extends Type< T >.above_center(), com.cliffc.aa.type.TypeStruct.at(), com.cliffc.aa.type.TypeStruct.fld_find(), com.cliffc.aa.type.Type< T extends Type< T >.SCALAR, and com.cliffc.aa.type.Type< T extends Type< T >.XSCALAR.

Here is the call graph for this function:

Member Data Documentation

◆ _flow

◆ _hmt

◆ _id

◆ _nongen

VStack com.cliffc.aa.HM.HM9.Syntax._nongen
packageinherited

◆ _par

◆ _rec


The documentation for this class was generated from the following file:
com.cliffc.aa.HM.HM9.Syntax.prep_tree_impl
final void prep_tree_impl(Syntax par, VStack nongen, Worklist work, T2 t)
Definition: HM9.java:351
com.cliffc.aa.type.TypeObj.above_center
boolean above_center()
Definition: TypeObj.java:77
com.cliffc.aa.util.Util.find
static int find(int[] es, int e)
Definition: Util.java:6
com.cliffc.aa.HM.HM9.Syntax.hm
abstract boolean hm(Worklist work)
com.cliffc.aa.HM.HM9.Syntax.more_work
abstract boolean more_work(Worklist work)
com.cliffc.aa.util.SB.ii
SB ii(int i)
Definition: SB.java:44
com.cliffc.aa.HM.HM9.Syntax.find
T2 find()
Definition: HM9.java:325
com.cliffc.aa.type.Type.SCALAR
static final Type SCALAR
Definition: Type.java:328
com.cliffc.aa.util.SB.di
SB di(int i)
Definition: SB.java:46
com.cliffc.aa.type.Type.XSCALAR
static final Type XSCALAR
Definition: Type.java:329
com.cliffc.aa.HM.HM9.Syntax.p0
final SB p0(SB sb, VBitSet dups)
Definition: HM9.java:375
com.cliffc.aa.type.Type
an implementation of language AA
Definition: Type.java:94
com.cliffc.aa.type.BitsAlias
Definition: BitsAlias.java:8
com.cliffc.aa.HM.HM9.Field._id
final String _id
Definition: HM9.java:870
com.cliffc.aa.util.VBitSet.clr
VBitSet clr()
Definition: VBitSet.java:9
com.cliffc.aa.HM.HM9.Syntax.add_hm_work
abstract void add_hm_work(Worklist work)
com.cliffc.aa.type.TypeStruct
A memory-based collection of optionally named fields.
Definition: TypeStruct.java:50
com.cliffc.aa.type.Type.str
SB str(SB sb, VBitSet dups, TypeMem mem, boolean debug)
Definition: Type.java:131
com.cliffc.aa.type.TypeMemPtr._obj
TypeObj _obj
Definition: TypeMemPtr.java:26
com.cliffc.aa.type.TypeStruct.at
Type at(int idx)
Definition: TypeStruct.java:1013
com.cliffc.aa.HM.HM9.Syntax.p1
abstract SB p1(SB sb)
com.cliffc.aa.HM.HM9.Field._rec
final Syntax _rec
Definition: HM9.java:871
com.cliffc.aa.HM.HM9.T2.find
T2 find()
Definition: HM9.java:1355
com.cliffc.aa.type.Type.above_center
boolean above_center()
Definition: Type.java:741
com.cliffc.aa.HM.HM9.Field.str
SB str(SB sb)
Definition: HM9.java:873
com.cliffc.aa.util.Util
Definition: Util.java:5
com.cliffc.aa.HM.HM9.Syntax._hmt
T2 _hmt
Definition: HM9.java:324
com.cliffc.aa.HM.HM9.T2.debug_find
T2 debug_find()
Definition: HM9.java:1344
com.cliffc.aa.HM.HM9.Syntax.more_work_impl
final boolean more_work_impl(Worklist work)
Definition: HM9.java:362
com.cliffc.aa.HM.HM9.T2.str
SB str(SB sb, VBitSet visit, VBitSet dups)
Definition: HM9.java:2040
com.cliffc.aa.type.BitsAlias.EMPTY
static BitsAlias EMPTY
Definition: BitsAlias.java:27
com.cliffc.aa.util.VBitSet
Definition: VBitSet.java:5
com.cliffc.aa.HM.HM9.id
static String id()
Definition: HM9.java:224
com.cliffc.aa.util.SB
Tight/tiny StringBuilder wrapper.
Definition: SB.java:8
com.cliffc.aa.HM.HM9.Syntax.str
abstract SB str(SB sb)
com.cliffc.aa.type.TypeStruct.fld_find
int fld_find(String fld)
Definition: TypeStruct.java:1038
com.cliffc.aa.util.SB.nl
SB nl()
Definition: SB.java:48
com.cliffc.aa.util.SB.p
SB p(String s)
Definition: SB.java:13
com.cliffc.aa.HM.HM9.Syntax.prep_tree
abstract int prep_tree(Syntax par, VStack nongen, Worklist work)
com.cliffc.aa.type.Type.XNIL
static final Type XNIL
Definition: Type.java:333
com.cliffc.aa.HM.HM9.Syntax._nongen
VStack _nongen
Definition: HM9.java:323
com.cliffc.aa.util.SB.i
SB i(int d)
Definition: SB.java:38
com.cliffc.aa.HM.HM9.DO_GCP
static final boolean DO_GCP
Definition: HM9.java:79
com.cliffc.aa.HM.HM9.T2.unify
boolean unify(T2 that, Worklist work)
Definition: HM9.java:1528
com.cliffc.aa.HM.HM9.Syntax.p2
abstract SB p2(SB sb, VBitSet dups)
com.cliffc.aa.HM.HM9.DO_HM
static final boolean DO_HM
Definition: HM9.java:78
com.cliffc.aa.HM.HM9.Syntax._flow
Type _flow
Definition: HM9.java:332
com.cliffc.aa.util.SB.toString
String toString()
Definition: SB.java:62
com.cliffc.aa.type.TypeMemPtr
Definition: TypeMemPtr.java:14
com.cliffc.aa.HM.HM9.T2.get_dups
VBitSet get_dups(VBitSet dups)
Definition: HM9.java:2025
com.cliffc.aa.HM.HM9.Syntax.val
abstract Type val(Worklist work)
com.cliffc.aa.HM.HM9.Syntax._par
Syntax _par
Definition: HM9.java:322