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

Public Member Functions

String toString ()
 

Protected Member Functions

final void add_work (Worklist work)
 

Package Functions

 Let (String arg0, Syntax body, Syntax use)
 
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

final String _arg0
 
HMType _hm
 
Syntax[] _kids
 
Syntax _par
 

Private Member Functions

Syntax body ()
 
Syntax use ()
 

Detailed Description

Definition at line 217 of file HM3.java.

Constructor & Destructor Documentation

◆ Let()

com.cliffc.aa.HM.HM3.Let.Let ( String  arg0,
Syntax  body,
Syntax  use 
)
package

Definition at line 219 of file HM3.java.

219 { _arg0=arg0; _kids=new Syntax[]{body,use}; body._par=use._par=this; }

References com.cliffc.aa.HM.HM3.Let._arg0, com.cliffc.aa.HM.HM3.Syntax._kids, com.cliffc.aa.HM.HM3.Syntax._par, com.cliffc.aa.HM.HM3.Let.body(), and com.cliffc.aa.HM.HM3.Let.use().

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:

◆ body()

Syntax com.cliffc.aa.HM.HM3.Let.body ( )
private

Definition at line 220 of file HM3.java.

220 { return _kids[0]; }

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

Referenced by com.cliffc.aa.HM.HM3.Let.get_ids(), com.cliffc.aa.HM.HM3.Let.hm(), com.cliffc.aa.HM.HM3.Let.Let(), com.cliffc.aa.HM.HM3.Let.progress(), and com.cliffc.aa.HM.HM3.Let.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:

◆ get_ids()

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

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

Definition at line 240 of file HM3.java.

240  {
241  HMVar var = new HMVar();
242  ENV.put(_arg0, var);
243  body().get_ids(new VStack(vstk,var),work);
244  use() .get_ids(vstk,work);
245  }

References com.cliffc.aa.HM.HM3.Let._arg0, com.cliffc.aa.HM.HM3.Let.body(), com.cliffc.aa.HM.HM3.ENV, com.cliffc.aa.HM.HM3.Syntax.get_ids(), and com.cliffc.aa.HM.HM3.Let.use().

Here is the call graph for this function:

◆ hm()

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

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

Definition at line 223 of file HM3.java.

223  {
224  if( _hm!=null && !progress() ) return null;
225  HMType tbody = body()._hm.find();
226  HMType trez = use() ._hm.find();
227  HMType tnew = ENV.get(_arg0).find();
228  tnew.union(tbody,work);
229  if( _hm!=null ) _hm.union(trez,work);
230  return trez;
231  }

References com.cliffc.aa.HM.HM3.Let._arg0, com.cliffc.aa.HM.HM3.Syntax._hm, com.cliffc.aa.HM.HM3.Let.body(), com.cliffc.aa.HM.HM3.ENV, com.cliffc.aa.HM.HM3.HMType.find(), com.cliffc.aa.HM.HM3.Let.progress(), com.cliffc.aa.HM.HM3.HMType.union(), and com.cliffc.aa.HM.HM3.Let.use().

Here is the call graph for this function:

◆ progress()

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

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

Definition at line 232 of file HM3.java.

232  {
233  HMType tbody = body()._hm.find();
234  HMType trez = use() ._hm.find();
235  HMType tnew = ENV.get(_arg0).find();
236  // Progress if tnew != tbody (they get unioned) OR
237  // trez != _hm
238  return !tnew.eq(tbody) || !_hm.find().eq(trez);
239  }

References com.cliffc.aa.HM.HM3.Let._arg0, com.cliffc.aa.HM.HM3.Syntax._hm, com.cliffc.aa.HM.HM3.Let.body(), com.cliffc.aa.HM.HM3.ENV, com.cliffc.aa.HM.HM3.HMType.eq(), com.cliffc.aa.HM.HM3.HMType.find(), and com.cliffc.aa.HM.HM3.Let.use().

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

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

◆ toString()

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

Definition at line 222 of file HM3.java.

222 { return "let "+_arg0+" = "+body()+" in "+use()+" }"; }

References com.cliffc.aa.HM.HM3.Let._arg0, com.cliffc.aa.HM.HM3.Let.body(), and com.cliffc.aa.HM.HM3.Let.use().

Here is the call graph for this function:

◆ use()

Syntax com.cliffc.aa.HM.HM3.Let.use ( )
private

Definition at line 221 of file HM3.java.

221 { return _kids[1]; }

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

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

Here is the caller graph for this function:

Member Data Documentation

◆ _arg0

◆ _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.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.Let.use
Syntax use()
Definition: HM3.java:221
com.cliffc.aa.HM.HM3.ENV
static final HashMap< String, HMType > ENV
Definition: HM3.java:32
com.cliffc.aa.HM.HM3.Let.body
Syntax body()
Definition: HM3.java:220
com.cliffc.aa.HM.HM3.Let.progress
boolean progress()
Definition: HM3.java:232
com.cliffc.aa.HM.HM3.Syntax.add_work
final void add_work(Worklist work)
Definition: HM3.java:126
com.cliffc.aa.HM.HM3.Let._arg0
final String _arg0
Definition: HM3.java:218
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