aa
com.cliffc.aa.HM.HM7.Struct Class Reference
Inheritance diagram for com.cliffc.aa.HM.HM7.Struct:
[legend]
Collaboration diagram for com.cliffc.aa.HM.HM7.Struct:
[legend]

Public Member Functions

String p ()
 
final String toString ()
 

Package Functions

 Struct (String[] ids, Syntax[] flds)
 
void add_kids (Worklist work)
 
void add_occurs (Worklist work)
 
T2 debug_find ()
 
T2 find ()
 
boolean hm (Worklist work)
 
T2 lookup (String name)
 
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)
 

Package Attributes

final Syntax[] _flds
 
final String[] _ids
 
VStack _nongen
 
Syntax _par
 
T2 _t
 

Detailed Description

Definition at line 525 of file HM7.java.

Constructor & Destructor Documentation

◆ Struct()

com.cliffc.aa.HM.HM7.Struct.Struct ( String[]  ids,
Syntax[]  flds 
)
package

Definition at line 528 of file HM7.java.

528 { _ids=ids; _flds=flds; }

References com.cliffc.aa.HM.HM7.Struct._flds, and com.cliffc.aa.HM.HM7.Struct._ids.

Member Function Documentation

◆ add_kids()

void com.cliffc.aa.HM.HM7.Struct.add_kids ( Worklist  work)
package

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

Definition at line 563 of file HM7.java.

563 { for( Syntax fld : _flds ) work.push(fld); }

References com.cliffc.aa.HM.HM7.Struct._flds, and com.cliffc.aa.HM.HM7.Worklist.push().

Here is the call graph for this function:

◆ add_occurs()

void com.cliffc.aa.HM.HM7.Syntax.add_occurs ( Worklist  work)
packageinherited

Reimplemented in com.cliffc.aa.HM.HM7.Field, com.cliffc.aa.HM.HM7.Let, com.cliffc.aa.HM.HM7.Lambda, and com.cliffc.aa.HM.HM7.Ident.

Definition at line 266 of file HM7.java.

266 {}

Referenced by com.cliffc.aa.HM.HM7.Field.add_occurs(), and com.cliffc.aa.HM.HM7.hm().

Here is the caller graph for this function:

◆ debug_find()

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

Definition at line 250 of file HM7.java.

250 { return _t.find(); } // Find, without the roll-up

References com.cliffc.aa.HM.HM7.Syntax._t, and com.cliffc.aa.HM.HM7.T2.find().

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

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

◆ find()

T2 com.cliffc.aa.HM.HM7.Syntax.find ( )
packageinherited

Definition at line 246 of file HM7.java.

246  { // U-F find
247  T2 t = _t.find();
248  return t==_t ? t : (_t=t);
249  }

References com.cliffc.aa.HM.HM7.Syntax._t, and com.cliffc.aa.HM.HM7.T2.find().

Referenced by com.cliffc.aa.HM.HM7.T2._occurs_in(), com.cliffc.aa.HM.HM7.Lambda.add_occurs(), com.cliffc.aa.HM.HM7.Let.add_occurs(), com.cliffc.aa.HM.HM7.Ident.hm(), com.cliffc.aa.HM.HM7.Lambda.hm(), com.cliffc.aa.HM.HM7.Let.hm(), com.cliffc.aa.HM.HM7.Apply.hm(), com.cliffc.aa.HM.HM7.Struct.hm(), com.cliffc.aa.HM.HM7.Field.hm(), com.cliffc.aa.HM.HM7.Apply.is_if_nil(), and com.cliffc.aa.HM.HM7.Struct.prep_tree().

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

◆ hm()

boolean com.cliffc.aa.HM.HM7.Struct.hm ( Worklist  work)
package

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

Definition at line 544 of file HM7.java.

544  {
545  // Check for progress before making new
546  T2 old = find();
547  if( old.is_struct() ) { // Already a struct? Compare-by-parts
548  for( int i=0; i<_ids.length; i++ ) {
549  int idx = Util.find(old._ids,_ids[i]);
550  if( idx== -1 || old.args(idx).unify(_flds[i].find(),work) ) { old=null; break; }
551  }
552  if( old!=null ) return false; // Shortcut: no progress, no allocation
553  }
554 
555  // Make a new T2 for progress
556  T2[] t2s = new T2[_ids.length];
557  for( int i=0; i<_ids.length; i++ )
558  t2s[i] = _flds[i].find();
559  T2 tstruct = T2.make_struct(_ids,t2s);
560  return tstruct.unify(find(),work);
561  }

References com.cliffc.aa.HM.HM7.Struct._flds, com.cliffc.aa.HM.HM7.Struct._ids, com.cliffc.aa.HM.HM7.T2._ids, com.cliffc.aa.HM.HM7.T2.args(), com.cliffc.aa.util.Util.find(), com.cliffc.aa.HM.HM7.Syntax.find(), com.cliffc.aa.HM.HM7.T2.is_struct(), com.cliffc.aa.HM.HM7.T2.make_struct(), and com.cliffc.aa.HM.HM7.T2.unify().

Here is the call graph for this function:

◆ lookup()

T2 com.cliffc.aa.HM.HM7.Struct.lookup ( String  name)
package

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

Definition at line 562 of file HM7.java.

562 { return _par==null ? null : _par.lookup(name); }

References com.cliffc.aa.HM.HM7.Syntax._par, and com.cliffc.aa.HM.HM7.Syntax.lookup().

Here is the call graph for this function:

◆ more_work()

boolean com.cliffc.aa.HM.HM7.Struct.more_work ( Worklist  work)
package

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

Definition at line 575 of file HM7.java.

575  {
576  if( !more_work_impl(work) ) return false;
577  for( Syntax fld : _flds )
578  if( !fld.more_work(work) )
579  return false;
580  return true;
581  }

References com.cliffc.aa.HM.HM7.Struct._flds, and com.cliffc.aa.HM.HM7.Syntax.more_work_impl().

Here is the call graph for this function:

◆ more_work_impl()

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

Definition at line 270 of file HM7.java.

270  {
271  boolean no_more_work = work.has(this) || !hm(null); // Either on worklist, or no-progress
272  return no_more_work;
273  }

References com.cliffc.aa.HM.HM7.Worklist.has(), and com.cliffc.aa.HM.HM7.Syntax.hm().

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

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

◆ p()

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

Definition at line 278 of file HM7.java.

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

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

Here is the call graph for this function:

◆ p0()

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

Definition at line 279 of file HM7.java.

279  {
280  _t.get_dups(dups);
281  _t.str(p1(sb.i()).p(" "), new VBitSet(),dups).nl();
282  return p2(sb.ii(1),dups).di(1);
283  }

References com.cliffc.aa.HM.HM7.Syntax._t, com.cliffc.aa.util.SB.di(), com.cliffc.aa.HM.HM7.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.HM7.Syntax.p1(), com.cliffc.aa.HM.HM7.Syntax.p2(), and com.cliffc.aa.HM.HM7.T2.str().

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

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

◆ p1()

SB com.cliffc.aa.HM.HM7.Struct.p1 ( SB  sb)
package

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

Definition at line 538 of file HM7.java.

538 { return sb.p("@{ ... } "); }

References com.cliffc.aa.util.SB.p().

Here is the call graph for this function:

◆ p2()

SB com.cliffc.aa.HM.HM7.Struct.p2 ( SB  sb,
VBitSet  dups 
)
package

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

Definition at line 539 of file HM7.java.

539  {
540  for( int i=0; i<_ids.length; i++ )
541  _flds[i].p0(sb.p(_ids[i]).p(" = "),dups);
542  return sb;
543  }

References com.cliffc.aa.HM.HM7.Struct._flds, com.cliffc.aa.HM.HM7.Struct._ids, com.cliffc.aa.util.SB.p(), and com.cliffc.aa.HM.HM7.Syntax.p0().

Here is the call graph for this function:

◆ prep_lookup_deps()

void com.cliffc.aa.HM.HM7.Struct.prep_lookup_deps ( Ident  id)
package

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

Definition at line 574 of file HM7.java.

574 { }

◆ prep_tree()

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

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

Definition at line 564 of file HM7.java.

564  {
565  T2[] t2s = new T2[_ids.length];
566  prep_tree_impl(par, nongen, work, T2.make_struct(_ids,t2s));
567  int cnt = 1; // One for self
568  for( int i=0; i<_flds.length; i++ ) { // Prep all sub-fields
569  cnt += _flds[i].prep_tree(this,nongen,work);
570  t2s[i] = _flds[i].find();
571  }
572  return cnt;
573  }

References com.cliffc.aa.HM.HM7.Struct._flds, com.cliffc.aa.HM.HM7.Struct._ids, com.cliffc.aa.HM.HM7.Syntax.find(), com.cliffc.aa.HM.HM7.T2.make_struct(), com.cliffc.aa.HM.HM7.Syntax.prep_tree(), and com.cliffc.aa.HM.HM7.Syntax.prep_tree_impl().

Here is the call graph for this function:

◆ prep_tree_impl()

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

Definition at line 260 of file HM7.java.

260 { _par=par; _t=t; _nongen = nongen; work.push(this); }

References com.cliffc.aa.HM.HM7.Syntax._nongen, com.cliffc.aa.HM.HM7.Syntax._par, com.cliffc.aa.HM.HM7.Syntax._t, and com.cliffc.aa.HM.HM7.Worklist.push().

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

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

◆ str()

SB com.cliffc.aa.HM.HM7.Struct.str ( SB  sb)
package

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

Definition at line 529 of file HM7.java.

529  {
530  sb.p("@{");
531  for( int i=0; i<_ids.length; i++ ) {
532  sb.p(' ').p(_ids[i]).p(" = ");
533  _flds[i].str(sb);
534  if( i < _ids.length-1 ) sb.p(',');
535  }
536  return sb.p("}");
537  }

References com.cliffc.aa.HM.HM7.Struct._flds, com.cliffc.aa.HM.HM7.Struct._ids, com.cliffc.aa.util.SB.p(), and com.cliffc.aa.HM.HM7.Syntax.str().

Here is the call graph for this function:

◆ toString()

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

Definition at line 275 of file HM7.java.

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

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

Here is the call graph for this function:

Member Data Documentation

◆ _flds

◆ _ids

◆ _nongen

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

◆ _par

◆ _t


The documentation for this class was generated from the following file:
com.cliffc.aa.HM.HM7.T2.str
SB str(SB sb, VBitSet visit, VBitSet dups)
Definition: HM7.java:1046
com.cliffc.aa.HM.HM7.T2.find
T2 find()
Definition: HM7.java:669
com.cliffc.aa.util.Util.find
static int find(int[] es, int e)
Definition: Util.java:6
com.cliffc.aa.util.SB.ii
SB ii(int i)
Definition: SB.java:44
com.cliffc.aa.util.SB.di
SB di(int i)
Definition: SB.java:46
com.cliffc.aa.HM.HM7.Syntax._par
Syntax _par
Definition: HM7.java:243
com.cliffc.aa.HM.HM7.T2.make_struct
static T2 make_struct(String[] ids, T2[] flds)
Definition: HM7.java:647
com.cliffc.aa.HM.HM7.Syntax.p1
abstract SB p1(SB sb)
com.cliffc.aa.HM.HM7.Syntax.prep_tree
abstract int prep_tree(Syntax par, VStack nongen, Worklist work)
com.cliffc.aa.HM.HM7.Syntax._nongen
VStack _nongen
Definition: HM7.java:244
com.cliffc.aa.HM.HM7.Syntax.str
abstract SB str(SB sb)
com.cliffc.aa.HM.HM7.Struct._ids
final String[] _ids
Definition: HM7.java:526
com.cliffc.aa.HM.HM7.Syntax.prep_tree_impl
final void prep_tree_impl(Syntax par, VStack nongen, Worklist work, T2 t)
Definition: HM7.java:260
com.cliffc.aa.HM.HM7.Syntax.find
T2 find()
Definition: HM7.java:246
com.cliffc.aa.HM.HM7.Syntax.p0
final SB p0(SB sb, VBitSet dups)
Definition: HM7.java:279
com.cliffc.aa.util.Util
Definition: Util.java:5
com.cliffc.aa.HM.HM7.Syntax.hm
abstract boolean hm(Worklist work)
com.cliffc.aa.util.VBitSet
Definition: VBitSet.java:5
com.cliffc.aa.util.SB
Tight/tiny StringBuilder wrapper.
Definition: SB.java:8
com.cliffc.aa.HM.HM7.Syntax._t
T2 _t
Definition: HM7.java:245
com.cliffc.aa.HM.HM7.Syntax.p2
abstract SB p2(SB sb, VBitSet dups)
com.cliffc.aa.util.SB.nl
SB nl()
Definition: SB.java:48
com.cliffc.aa.HM.HM7.T2.get_dups
VBitSet get_dups(VBitSet dups)
Definition: HM7.java:1033
com.cliffc.aa.util.SB.p
SB p(String s)
Definition: SB.java:13
com.cliffc.aa.HM.HM7.Struct._flds
final Syntax[] _flds
Definition: HM7.java:527
com.cliffc.aa.HM.HM7.T2.unify
boolean unify(T2 that, Worklist work)
Definition: HM7.java:724
com.cliffc.aa.HM.HM7.Syntax.more_work_impl
final boolean more_work_impl(Worklist work)
Definition: HM7.java:270
com.cliffc.aa.util.SB.i
SB i(int d)
Definition: SB.java:38
com.cliffc.aa.util.SB.toString
String toString()
Definition: SB.java:62
com.cliffc.aa.HM.HM7.Syntax.lookup
abstract T2 lookup(String name)