aa
com.cliffc.aa.HM.HM3.Apply Class Reference
Inheritance diagram for com.cliffc.aa.HM.HM3.Apply:
[legend]
Collaboration diagram for com.cliffc.aa.HM.HM3.Apply:
[legend]

Public Member Functions

String toString ()
 

Protected Member Functions

final void add_work (Worklist work)
 

Package Functions

 Apply (Syntax fun, Syntax arg)
 
final void add_neighbors (Worklist work)
 
final boolean all_kids_ready ()
 
boolean check_progress (Worklist work)
 
void get_ids (VStack vstk, Worklist work)
 
HMType hm (Worklist work)
 
boolean progress ()
 

Package Attributes

HMType _hm
 
Syntax[] _kids
 
Syntax _par
 

Private Member Functions

Syntax arg ()
 
Syntax fun ()
 

Detailed Description

Definition at line 247 of file HM3.java.

Constructor & Destructor Documentation

◆ Apply()

com.cliffc.aa.HM.HM3.Apply.Apply ( Syntax  fun,
Syntax  arg 
)
package

Definition at line 248 of file HM3.java.

248 { _kids=new Syntax[]{fun,arg}; fun._par=arg._par=this; }

References com.cliffc.aa.HM.HM3.Syntax._kids, com.cliffc.aa.HM.HM3.Syntax._par, com.cliffc.aa.HM.HM3.Apply.arg(), and com.cliffc.aa.HM.HM3.Apply.fun().

Here is the call graph for this function:

Member Function Documentation

◆ add_neighbors()

final void com.cliffc.aa.HM.HM3.Syntax.add_neighbors ( Worklist  work)
packageinherited

Definition at line 128 of file HM3.java.

128  {
129  if( _par!=null ) _par.add_work(work);
130  if( _kids!=null )
131  for( Syntax kid : _kids )
132  kid.add_work(work);
133  }

References com.cliffc.aa.HM.HM3.Syntax._kids, com.cliffc.aa.HM.HM3.Syntax._par, and com.cliffc.aa.HM.HM3.Syntax.add_work().

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

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

◆ add_work()

final void com.cliffc.aa.HM.HM3.Syntax.add_work ( Worklist  work)
protectedinherited

Definition at line 126 of file HM3.java.

126 { if( all_kids_ready() ) work.push(this); }

References com.cliffc.aa.HM.HM3.Syntax.all_kids_ready(), and com.cliffc.aa.HM.HM3.Worklist.push().

Referenced by com.cliffc.aa.HM.HM3.Syntax.add_neighbors(), com.cliffc.aa.HM.HM3.Con.get_ids(), and com.cliffc.aa.HM.HM3.Ident.get_ids().

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

◆ all_kids_ready()

final boolean com.cliffc.aa.HM.HM3.Syntax.all_kids_ready ( )
packageinherited

Definition at line 135 of file HM3.java.

135  {
136  if( _kids==null ) return true;
137  for( Syntax kid : _kids ) if( kid._hm==null ) return false;
138  return true;
139  }

References com.cliffc.aa.HM.HM3.Syntax._kids.

Referenced by com.cliffc.aa.HM.HM3.Syntax.add_work(), and com.cliffc.aa.HM.HM3.Syntax.check_progress().

Here is the caller graph for this function:

◆ arg()

Syntax com.cliffc.aa.HM.HM3.Apply.arg ( )
private

Definition at line 250 of file HM3.java.

250 { return _kids[1]; }

References com.cliffc.aa.HM.HM3.Syntax._kids.

Referenced by com.cliffc.aa.HM.HM3.Apply.Apply(), com.cliffc.aa.HM.HM3.Apply.get_ids(), com.cliffc.aa.HM.HM3.Apply.hm(), com.cliffc.aa.HM.HM3.Apply.progress(), and com.cliffc.aa.HM.HM3.Apply.toString().

Here is the caller graph for this function:

◆ check_progress()

boolean com.cliffc.aa.HM.HM3.Syntax.check_progress ( Worklist  work)
packageinherited

Definition at line 144 of file HM3.java.

144  {
145  if( all_kids_ready() ) // If kids are not ready, then cannot compute hm() so not on worklist
146  if( _hm==null || progress() ) // Progress is possible
147  if( !work.has(this) ) // Not on worklist?
148  return false; // Fails check
149  if( _kids!=null ) // For all kids
150  for( Syntax kid : _kids )
151  if( !kid.check_progress(work) ) // Recursively check nodes that can make progress on worklist
152  return false;
153  return true;
154  }

References com.cliffc.aa.HM.HM3.Syntax._hm, com.cliffc.aa.HM.HM3.Syntax._kids, com.cliffc.aa.HM.HM3.Syntax.all_kids_ready(), com.cliffc.aa.HM.HM3.Worklist.has(), and com.cliffc.aa.HM.HM3.Syntax.progress().

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

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

◆ fun()

Syntax com.cliffc.aa.HM.HM3.Apply.fun ( )
private

Definition at line 249 of file HM3.java.

249 { return _kids[0]; }

References com.cliffc.aa.HM.HM3.Syntax._kids.

Referenced by com.cliffc.aa.HM.HM3.Apply.Apply(), com.cliffc.aa.HM.HM3.Apply.get_ids(), com.cliffc.aa.HM.HM3.Apply.hm(), com.cliffc.aa.HM.HM3.Apply.progress(), and com.cliffc.aa.HM.HM3.Apply.toString().

Here is the caller graph for this function:

◆ get_ids()

void com.cliffc.aa.HM.HM3.Apply.get_ids ( VStack  vstk,
Worklist  work 
)
package

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

Definition at line 272 of file HM3.java.

272 { fun().get_ids(vstk,work); arg().get_ids(vstk,work); }

References com.cliffc.aa.HM.HM3.Apply.arg(), com.cliffc.aa.HM.HM3.Apply.fun(), and com.cliffc.aa.HM.HM3.Syntax.get_ids().

Here is the call graph for this function:

◆ hm()

HMType com.cliffc.aa.HM.HM3.Apply.hm ( Worklist  work)
package

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

Definition at line 252 of file HM3.java.

252  {
253  if( _hm!=null && !progress() ) return null;
254  HMType tfun = fun()._hm.find();
255  HMType targ = arg()._hm.find();
256  HMType trez = new HMVar();
257  HMType nfun = Oper.fun(targ,trez);
258  nfun.union(tfun,work);
259  if( _hm!=null ) _hm.union(trez.find(),work);
260  return trez.find();
261  }

References com.cliffc.aa.HM.HM3.Syntax._hm, com.cliffc.aa.HM.HM3.Apply.arg(), com.cliffc.aa.HM.HM3.HMType.find(), com.cliffc.aa.HM.HM3.Apply.fun(), com.cliffc.aa.HM.HM3.Oper.fun(), com.cliffc.aa.HM.HM3.Apply.progress(), and com.cliffc.aa.HM.HM3.HMType.union().

Here is the call graph for this function:

◆ progress()

boolean com.cliffc.aa.HM.HM3.Apply.progress ( )
package

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

Definition at line 262 of file HM3.java.

262  {
263  // Progress if tfun is not a Oper.fun, OR
264  // tfun[0] != targ (they get unioned)
265  HMType tfun = fun()._hm.find();
266  HMType targ = arg()._hm.find();
267  if( !(tfun instanceof Oper) ) return true;
268  if( !((Oper)tfun)._name.equals("->") ) return true;
269  HMType arg0 = ((Oper)tfun)._args[0].find();
270  return !arg0.eq(targ);
271  }

References com.cliffc.aa.HM.HM3.Syntax._hm, com.cliffc.aa.HM.HM3.Apply.arg(), com.cliffc.aa.HM.HM3.HMType.eq(), com.cliffc.aa.HM.HM3.HMType.find(), and com.cliffc.aa.HM.HM3.Apply.fun().

Referenced by com.cliffc.aa.HM.HM3.Apply.hm().

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

◆ toString()

String com.cliffc.aa.HM.HM3.Apply.toString ( )

Definition at line 251 of file HM3.java.

251 { return "("+fun()+" "+arg()+")"; }

References com.cliffc.aa.HM.HM3.Apply.arg(), and com.cliffc.aa.HM.HM3.Apply.fun().

Here is the call graph for this function:

Member Data Documentation

◆ _hm

◆ _kids

◆ _par

Syntax com.cliffc.aa.HM.HM3.Syntax._par
packageinherited

The documentation for this class was generated from the following file:
com.cliffc.aa.HM.HM3.HMType.union
abstract HMType union(HMType t, Worklist work)
com.cliffc.aa.HM.HM3.HMType.eq
final boolean eq(HMType v)
Definition: HM3.java:291
com.cliffc.aa.HM.HM3.Syntax.all_kids_ready
final boolean all_kids_ready()
Definition: HM3.java:135
com.cliffc.aa.HM.HM3.Apply.arg
Syntax arg()
Definition: HM3.java:250
com.cliffc.aa.HM.HM3.Syntax.progress
abstract boolean progress()
com.cliffc.aa.HM.HM3.HMType.find
abstract HMType find()
com.cliffc.aa.HM.HM3.Syntax._par
Syntax _par
Definition: HM3.java:116
com.cliffc.aa.HM.HM3.Apply.progress
boolean progress()
Definition: HM3.java:262
com.cliffc.aa.HM.HM3.Syntax.add_work
final void add_work(Worklist work)
Definition: HM3.java:126
com.cliffc.aa.HM.HM3.Apply.fun
Syntax fun()
Definition: HM3.java:249
com.cliffc.aa.HM.HM3.Syntax.get_ids
abstract void get_ids(VStack vstk, Worklist work)
com.cliffc.aa.HM.HM3.Syntax._hm
HMType _hm
Definition: HM3.java:118
com.cliffc.aa.HM.HM3.Syntax._kids
Syntax[] _kids
Definition: HM3.java:117