aa
Env.java
Go to the documentation of this file.
1 package com.cliffc.aa;
2 
3 import com.cliffc.aa.node.*;
4 import com.cliffc.aa.tvar.TV2;
5 import com.cliffc.aa.type.*;
6 import com.cliffc.aa.util.*;
7 
8 import java.util.HashSet;
9 
10 import static com.cliffc.aa.type.TypeFld.Access;
11 
12 public class Env implements AutoCloseable {
13  public final static GVNGCM GVN = new GVNGCM(); // Initial GVN
14  public static StartNode START; // Program start values (control, empty memory, cmd-line args)
15  public static CProjNode CTL_0; // Program start value control
16  public static StartMemNode MEM_0; // Program start value memory
17  public static NewObjNode STK_0; // Program start stack frame (has primitives)
18  public static ScopeNode SCP_0; // Program start scope
19  public static DefMemNode DEFMEM;// Default memory (all structure types)
20  public static ConNode ALL_CTRL; // Default control
21  public static ConNode XCTRL; // Always dead control
22  public static ConNode XNIL; // Common XNIL
23  public static ConNode NIL; // Common NIL
24  public static ConNode ANY; // Common ANY / used for dead
25  public static ConNode ALL; // Common ALL / used for errors
26  public static ConNode ALL_CALL; // Common during function call construction
27  // Set of all display aliases, used to track escaped displays at call sites for asserts.
29  // Set of lexically active display aliases, used for a conservative display
30  // approx for forward references.
32 
33 
34  final public Env _par; // Parent environment
35  public final ScopeNode _scope; // Lexical anchor; "end of display"; goes when this environment leaves scope
36  public VStack _nongen; // Hindley-Milner "non-generative" variable set; current/pending defs
37 
38  // Top-level Env. Contains, e.g. the primitives.
39  // Above any file-scope level Env.
40  private Env( ) {
41  _par = null;
42  _nongen = null;
43  _scope = init(CTL_0,XNIL,MEM_0,Type.XNIL,null,true);
44  }
45 
46  // A file-level Env, or below. Contains user written code.
47  Env( Env par, Parse P, boolean is_closure, Node ctrl, Node mem ) {
49  _par = par;
50  nongen_push(par);
51  ScopeNode s = par._scope; // Parent scope
52  _scope = init(ctrl,s.ptr(),mem,s.stk()._tptr,P==null ? null : P.errMsg(),is_closure);
53  }
54  // Make the Scope object for an Env.
55  private static ScopeNode init(Node ctl, Node clo, Node mem, Type back_ptr, Parse errmsg, boolean is_closure) {
56  TypeStruct tdisp = TypeStruct.open(back_ptr);
57  mem.keep(2);
58  NewObjNode nnn = GVN.xform(new NewObjNode(is_closure,tdisp,clo)).keep(2);
59  MrgProjNode frm = DEFMEM.make_mem_proj(nnn,mem.unkeep(2));
60  Node ptr = GVN.xform(new ProjNode(nnn.unkeep(2),AA.REZ_IDX));
61  ALL_DISPLAYS = ALL_DISPLAYS.set(nnn._alias); // Displays for all time
62  LEX_DISPLAYS = LEX_DISPLAYS.set(nnn._alias); // Lexically active displays
63  ScopeNode scope = new ScopeNode(errmsg,is_closure);
64  scope.set_ctrl(ctl);
65  scope.set_ptr (ptr); // Address for 'nnn', the local stack frame
66  scope.set_mem (frm); // Memory includes local stack frame
67  scope.set_rez (Node.con(Type.SCALAR));
68  return scope;
69  }
70 
71  // Makes a new top Env with primitives
72  public static Env top_scope() {
73  boolean first_time = START == null;
74  if( first_time ) record_for_top_reset1();
75  else top_reset();
76 
77  // Top-level default values; ALL_CTRL is used by declared functions to
78  // indicate that future not-yet-parsed code may call the function.
79  START = GVN.init (new StartNode());
82  XNIL = GVN.xform(new ConNode<>(Type.XNIL )).keep();
83  NIL = GVN.xform(new ConNode<>(Type.NIL )).keep();
84  ANY = GVN.xform(new ConNode<>(Type.ANY )).keep();
85  ALL = GVN.xform(new ConNode<>(Type.ALL )).keep();
87  // Initial control & memory
88  CTL_0 = GVN.init(new CProjNode(START,0));
89  DEFMEM = GVN.init(new DefMemNode( CTL_0));
90  MEM_0 = GVN.init(new StartMemNode(START ));
91  // Top-most (file-scope) lexical environment
92  Env top = new Env();
93  // Top-level display defining all primitives
94  SCP_0 = top._scope;
95  SCP_0.init(); // Add base types
96  STK_0 = SCP_0.stk();
97 
98  STK_0.keep(); // Inputs & type will rapidly change
99  for( PrimNode prim : PrimNode.PRIMS() )
100  STK_0.add_fun(null,prim._name,(FunPtrNode) GVN.xform(prim.as_fun(GVN)));
102  STK_0.add_fun(null,lib ._name,(FunPtrNode) GVN.xform(lib .as_fun(GVN)));
103  // Top-level constants
106  STK_0.unkeep();
107  // Run the worklist dry
109 
110  if( first_time ) record_for_top_reset2();
111  return top;
112  }
113 
114  // A new Env for the current Parse scope (generally a file-scope or a
115  // test-scope), above this is the basic public Env with all the primitives
116  public static Env file_scope(Env top_scope) {
117  return new Env(top_scope,null, true, top_scope._scope.ctrl(), top_scope._scope.mem());
118  }
119 
120  // Wire up an early function exit
121  Node early_exit( Parse P, Node val ) {
122  return _scope.is_closure() ? P.do_exit(_scope,val) : _par.early_exit(P,val); // Hunt for an early-exit-enabled scope
123  }
124 
125  // Close any currently open display, and remove its alias from the set of
126  // active display aliases (which are otherwise available to all function
127  // definitions getting parsed).
128  public void close_display( GVNGCM gvn ) {
129  Node ptr = _scope.ptr();
130  if( ptr == null ) return; // Already done
131  NewObjNode stk = _scope.stk();
132  stk.no_more_fields();
133  gvn.add_flow(stk); // Scope object going dead, trigger following projs to cleanup
134  _scope.set_ptr(null); // Clear pointer to display
135  gvn.add_flow(ptr); // Clearing pointer changes liveness
136  gvn.add_work_all(_scope.unkeep());
138  }
139 
140  // Close the current Env and lexical scope.
141  @Override public void close() {
142  // Promote forward refs to the next outer scope
143  ScopeNode pscope = _par._scope;
144  if( pscope != null && _par._par != null )
145  _scope.stk().promote_forward(pscope.stk());
149  assert _scope.is_dead();
150  }
151 
152  // Record global static state for reset
153  private static void record_for_top_reset1() {
154  BitsAlias.init0();
155  BitsFun .init0();
156  BitsRPC .init0();
157  }
158  private static void record_for_top_reset2() { GVN.init0(); Node.init0(); }
159 
160  // Reset all global statics for the next parse. Useful during testing when
161  // many top-level parses happen in a row.
162  private static void top_reset() {
166  TV2 .reset_to_init0();
167  GVN .reset_to_init0();
168  Node .reset_to_init0();
169  FunNode .reset();
171  PrimNode .reset();
172  ALL_DISPLAYS = BitsAlias.EMPTY; // Reset aliases declared as Displays
174  }
175 
176  // Return Scope for a name, so can be used to determine e.g. mutability
177  ScopeNode lookup_scope( String name, boolean lookup_current_scope_only ) {
178  if( name == null ) return null; // Handle null here, easier on parser
179  if( _scope.stk().exists(name) ) return _scope;
180  return _par == null || lookup_current_scope_only ? null : _par.lookup_scope(name,false);
181  }
182 
183  // Name lookup is the same for all variables, including function defs (which
184  // are literally assigning a lambda to a ref). Only returns nodes registered
185  // with GVN.
186  public Node lookup( String name ) {
187  ScopeNode scope = lookup_scope(name,false);
188  return scope==null ? null : scope.get(name);
189  }
190  // Test support, return top-level name type
191  Type lookup_valtype( String name ) {
192  Node n = lookup(name);
193  if( !(n instanceof UnresolvedNode) ) return n._val;
194  // For unresolved, use the ambiguous type
195  return n.value(GVNGCM.Mode.Opto);
196  }
197 
198  // Lookup the operator name. Use the longest name that's found, so that long
199  // strings of operator characters are naturally broken by (greedy) strings.
200  // If nargs is positive, filter by nargs.
201  // If nargs is zero, this is a balanced-op lookup, filter by op_prec==0
202  // Always makes a 'fresh' result, as-if HM.Ident primitive lookup.
203  UnOrFunPtrNode lookup_filter_fresh( String name, int nargs, Node ctrl ) {
204  if( !Parse.isOp(name) ) return null; // Limit to operators
205  for( int i=name.length(); i>0; i-- ) {
206  UnOrFunPtrNode n = (UnOrFunPtrNode)lookup(name.substring(0,i).intern());
207  if( n != null ) { // First name found will return
208  UnOrFunPtrNode u = nargs == 0 // Requiring a balanced-op?
209  ? (n.op_prec()==0 ? n : null) // Return a balanced-op or error
210  : n.filter(nargs); // Non-balanced ops also check arg count; distinguish e.g. -x from x-y.
211  return u==null ? null : (UnOrFunPtrNode)Env.GVN.xform(new FreshNode(_nongen,ctrl,u));
212  }
213  }
214  return null;
215  }
216 
217  // Update function name token to Node mapping in the current scope
218  Node add_fun( Parse bad, String name, Node val ) { return _scope.stk().add_fun(bad,name,(FunPtrNode)val); }
219 
220 
221  // Type lookup in any scope
222  ConTypeNode lookup_type( String name ) {
223  ConTypeNode t = _scope.get_type(name);
224  if( t != null ) return t;
225  return _par == null ? null : _par.lookup_type(name);
226  }
227  // Lookup by alias
228  public ConTypeNode lookup_type( int alias ) {
229  ConTypeNode t = _scope.get_type(alias);
230  if( t != null ) return t;
231  return _par == null ? null : _par.lookup_type(alias);
232  }
233  // Update type name token to type mapping in the current scope
234  void add_type( String name, ConTypeNode t ) { _scope.add_type(name,t); }
235 
236  // Collect TVars from all variables in-scope. Used to build a
237  // "non-generative" set of TVars for Hindley-Milner typing.
238  public HashSet<TV2> collect_active_scope() {
239  HashSet<TV2> tvars = new HashSet<>();
240  Env e = this;
241  while( e!=null ) {
242  for( Node def : _scope.stk()._defs )
243  if( def != null ) tvars.add(def.tvar());
244  e = e._par;
245  }
246  return tvars;
247  }
248 
249  // Small classic tree of TV2s, immutable, with sharing at the root parts.
250  // Used to track the lexical scopes of vars, to allow for the H-M 'occurs_in'
251  // check. This stack sub-sequences the main Env._scope stack, having splits
252  // for every unrelated set of mutually-self-recursive definitions. This is
253  // typically just a single variable, currently being defined.
254  Node nongen_pop(Node ret) { _nongen = _nongen._par; return ret;}
255  void nongen_push(Env par) { _nongen = new VStack(par._nongen); }
256  public static class VStack {
257  public final VStack _par; // Parent
258  public Ary<String> _flds; // Field names, unique per-Scope
259  public Ary<TV2> _tvars; // Type variable, set at first reference (forward-ref or not)
260  private VStack( VStack par ) { _par=par; _flds = new Ary<>(new String[1],0); _tvars = new Ary<>(new TV2[1],0); }
261  String add_var(String fld, TV2 tv) { _flds.push(fld); _tvars.push(tv); return fld; }
262  public boolean isEmpty() {
263  return _flds.isEmpty() && (_par == null || _par.isEmpty());
264  }
265 
266  // Return a compact list of active tvars
267  public TV2[] compact() {
268  int cnt=0;
269  for( VStack vs = this; vs!=null; vs=vs._par )
270  cnt += vs._tvars._len;
271  TV2[] tv2s = new TV2[cnt];
272  cnt=0;
273  for( VStack vs = this; vs!=null; vs=vs._par ) {
274  System.arraycopy(vs._tvars._es,0,tv2s,cnt,vs._tvars._len);
275  cnt += vs._tvars._len;
276  }
277  return tv2s;
278  }
279 
280 
281  @Override public String toString() {
282  // These types get large & complex; find all the dups up-front to allow
283  // for prettier printing. Uses '$A' style for repeats.
285  VBitSet bs = new VBitSet();
286  for( VStack vs = this; vs!=null ; vs=vs._par )
287  if( vs._tvars != null )
288  for( TV2 tv2 : vs._tvars )
289  if( tv2 != null ) tv2.find_dups(bs,dups,0);
290 
291  // Print stack of types, grouped by depth
292  bs.clr();
293  SB sb = new SB().p("[");
294  for( VStack vs = this; vs!=null ; vs=vs._par ) {
295  if( vs._tvars != null ) {
296  for( int i=0; i<vs._tvars._len; i++ ) {
297  sb.p(vs._flds.at(i)).p('=');
298  TV2 tv2 = vs._tvars.at(i);
299  if( tv2 !=null ) tv2.str(sb,bs,dups,false,0,0);
300  sb.p(", ");
301  }
302  if( vs._tvars._len>0 ) sb.unchar(2);
303  }
304  sb.p(" >> ");
305  }
306  if( _par!=null ) sb.unchar(4);
307  return sb.p("]").toString();
308  }
309  }
310 
311  Env lookup_fref(String tok) {
312  if( _nongen!=null && _nongen._flds.find(tok)!= -1 ) return this;
313  return _par==null ? null : _par.lookup_fref(tok);
314  }
315 }
com.cliffc.aa.node.NewObjNode.exists
boolean exists(String name)
Definition: NewObjNode.java:38
com.cliffc.aa.node.ScopeNode.add_type
void add_type(String name, ConTypeNode t)
Definition: ScopeNode.java:97
com.cliffc.aa.type.BitsRPC.reset_to_init0
static void reset_to_init0()
Definition: BitsRPC.java:29
com.cliffc.aa.type.TypeFld.Access.Final
Final
Definition: TypeFld.java:112
com.cliffc.aa.node.PrimNode.reset
static void reset()
Definition: PrimNode.java:40
com.cliffc.aa.Env.VStack.isEmpty
boolean isEmpty()
Definition: Env.java:262
com.cliffc.aa.node.PrimNode
Definition: PrimNode.java:20
com.cliffc.aa.util.Ary.push
E push(E e)
Add element in amortized constant time.
Definition: Ary.java:58
com.cliffc.aa.node.NewObjNode.no_more_fields
void no_more_fields()
Definition: NewObjNode.java:48
com.cliffc.aa.util.Ary.isEmpty
boolean isEmpty()
Definition: Ary.java:20
com.cliffc.aa.Env.lookup_valtype
Type lookup_valtype(String name)
Definition: Env.java:191
com.cliffc.aa.Env.XCTRL
static ConNode XCTRL
Definition: Env.java:21
com.cliffc.aa.Env.close
void close()
Definition: Env.java:141
com.cliffc.aa.type.Bits.clear
B clear(int bit)
Definition: Bits.java:255
com.cliffc.aa.type.Type.SCALAR
static final Type SCALAR
Definition: Type.java:328
com.cliffc
com.cliffc.aa.Env.ALL_CALL
static ConNode ALL_CALL
Definition: Env.java:26
com.cliffc.aa.Env.top_scope
static Env top_scope()
Definition: Env.java:72
com.cliffc.aa.Env.add_fun
Node add_fun(Parse bad, String name, Node val)
Definition: Env.java:218
com.cliffc.aa.type.TypeFld
Definition: TypeFld.java:12
com.cliffc.aa.node.ScopeNode
Definition: ScopeNode.java:17
com.cliffc.aa.node.Node
Definition: Node.java:16
com.cliffc.aa.type.TypeRPC.ALL_CALL
static final TypeRPC ALL_CALL
Definition: TypeRPC.java:31
com.cliffc.aa.util
Definition: AbstractEntry.java:1
com.cliffc.aa.node.ScopeNode.ctrl
Node ctrl()
Definition: ScopeNode.java:44
com.cliffc.aa.Env.early_exit
Node early_exit(Parse P, Node val)
Definition: Env.java:121
com.cliffc.aa.Env.top_reset
static void top_reset()
Definition: Env.java:162
com.cliffc.aa.node.UnOrFunPtrNode
Definition: UnOrFunPtrNode.java:6
com.cliffc.aa.type.BitsFun.init0
static void init0()
Definition: BitsFun.java:28
com.cliffc.aa.GVNGCM.add_work_all
Node add_work_all(Node n)
Definition: GVNGCM.java:73
com.cliffc.aa.tvar
Definition: TV2.java:1
com.cliffc.aa.type.Type
an implementation of language AA
Definition: Type.java:94
com.cliffc.aa.Env.add_type
void add_type(String name, ConTypeNode t)
Definition: Env.java:234
com.cliffc.aa.type.TypeFlt
Definition: TypeFlt.java:9
com.cliffc.aa.util.Ary< String >
com.cliffc.aa.node.CProjNode
Definition: CProjNode.java:10
com.cliffc.aa.type.BitsAlias
Definition: BitsAlias.java:8
com.cliffc.aa.node.NewNode.NewPrimNode
Definition: NewNode.java:170
com.cliffc.aa.node.Node.keep
public< N extends Node > N keep()
Definition: Node.java:228
com.cliffc.aa.Env.nongen_push
void nongen_push(Env par)
Definition: Env.java:255
com.cliffc.aa.Env.record_for_top_reset1
static void record_for_top_reset1()
Definition: Env.java:153
com.cliffc.aa.Env.lookup_type
ConTypeNode lookup_type(String name)
Definition: Env.java:222
com.cliffc.aa.node.Node._val
Type _val
Definition: Node.java:88
com.cliffc.aa.type.TypeFlt.PI
static final TypeFlt PI
Definition: TypeFlt.java:40
com.cliffc.aa.Env.STK_0
static NewObjNode STK_0
Definition: Env.java:17
com.cliffc.aa.node.NewObjNode.add_fun
FunPtrNode add_fun(Parse bad, String name, FunPtrNode ptr)
Definition: NewObjNode.java:76
com.cliffc.aa.util.VBitSet.clr
VBitSet clr()
Definition: VBitSet.java:9
com.cliffc.aa.Env.XNIL
static ConNode XNIL
Definition: Env.java:22
com.cliffc.aa.node.StartMemNode
Definition: StartMemNode.java:8
com.cliffc.aa.type.Type.ANY
static final Type ANY
Definition: Type.java:325
com.cliffc.aa.node.ConNode
Definition: ConNode.java:9
com.cliffc.aa.node.ScopeNode.ptr
Node ptr()
Definition: ScopeNode.java:46
com.cliffc.aa.node.FunPtrNode
Definition: FunPtrNode.java:40
com.cliffc.aa.GVNGCM.reset_to_init0
void reset_to_init0()
Definition: GVNGCM.java:89
com.cliffc.aa.type.TypeStruct
A memory-based collection of optionally named fields.
Definition: TypeStruct.java:50
com.cliffc.aa.Env.ALL_DISPLAYS
static BitsAlias ALL_DISPLAYS
Definition: Env.java:28
com.cliffc.aa.Env.collect_active_scope
HashSet< TV2 > collect_active_scope()
Definition: Env.java:238
com.cliffc.aa.Env.START
static StartNode START
Definition: Env.java:14
com.cliffc.aa.tvar.TV2.reset_to_init0
static void reset_to_init0()
Definition: TV2.java:183
com.cliffc.aa.Env.lookup
Node lookup(String name)
Definition: Env.java:186
com.cliffc.aa.node.Node.init0
static void init0()
Definition: Node.java:70
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.Env.ALL
static ConNode ALL
Definition: Env.java:25
com.cliffc.aa.node.NewNode._tptr
TypeMemPtr _tptr
Definition: NewNode.java:34
com.cliffc.aa.GVNGCM.xform
Node xform(Node n)
Definition: GVNGCM.java:126
com.cliffc.aa.Env.VStack._tvars
Ary< TV2 > _tvars
Definition: Env.java:259
com.cliffc.aa.Env.GVN
static final GVNGCM GVN
Definition: Env.java:13
com.cliffc.aa.node.Node.unkeep
public< N extends Node > N unkeep()
Definition: Node.java:232
com.cliffc.aa.Env.init
static ScopeNode init(Node ctl, Node clo, Node mem, Type back_ptr, Parse errmsg, boolean is_closure)
Definition: Env.java:55
com.cliffc.aa.node.Node.is_dead
boolean is_dead()
Definition: Node.java:820
com.cliffc.aa.Env.close_display
void close_display(GVNGCM gvn)
Definition: Env.java:128
com.cliffc.aa.node.Node.value
abstract Type value(GVNGCM.Mode opt_mode)
com.cliffc.aa.node.NewNode.NewPrimNode.INTRINSICS
static final Ary< NewPrimNode > INTRINSICS
Definition: NewNode.java:186
com.cliffc.aa.node.ScopeNode.mem
Node mem()
Definition: ScopeNode.java:45
com.cliffc.aa.node.DefMemNode.make_mem_proj
MrgProjNode make_mem_proj(NewNode nn, Node mem)
Definition: DefMemNode.java:59
com.cliffc.aa.node.PrimNode.PRIMS
static PrimNode[] PRIMS
Definition: PrimNode.java:36
com.cliffc.aa.Parse.errMsg
Parse errMsg()
Definition: Parse.java:1455
com.cliffc.aa.type.BitsRPC
Definition: BitsRPC.java:8
com.cliffc.aa.AA.REZ_IDX
static final int REZ_IDX
Definition: AA.java:16
com.cliffc.aa.type.Type.CTRL
static final Type CTRL
Definition: Type.java:326
com.cliffc.aa.node.FunNode.reset
static void reset()
Definition: FunNode.java:100
com.cliffc.aa.Env._nongen
VStack _nongen
Definition: Env.java:36
com.cliffc.aa.Env.CTL_0
static CProjNode CTL_0
Definition: Env.java:15
com.cliffc.aa.type.Type.XCTRL
static final Type XCTRL
Definition: Type.java:327
com.cliffc.aa.GVNGCM
Definition: GVNGCM.java:12
com.cliffc.aa.Env.file_scope
static Env file_scope(Env top_scope)
Definition: Env.java:116
com.cliffc.aa.tvar.TV2.find_dups
final int find_dups(VBitSet bs, NonBlockingHashMapLong< String > dups, int scnt)
Definition: TV2.java:720
com.cliffc.aa.node.ScopeNode.get
Node get(String name)
Definition: ScopeNode.java:76
com.cliffc.aa.type.TypeStruct.open
static TypeStruct open(Type tdisp)
Definition: TypeStruct.java:210
com.cliffc.aa.node.FreshNode
Definition: FreshNode.java:11
com.cliffc.aa.node.ScopeNode.is_closure
boolean is_closure()
Definition: ScopeNode.java:102
com.cliffc.aa.node.UnOrFunPtrNode.filter
abstract UnOrFunPtrNode filter(int nargs)
com.cliffc.aa.type.BitsAlias.EMPTY
static BitsAlias EMPTY
Definition: BitsAlias.java:27
com.cliffc.aa.node.ProjNode
Definition: ProjNode.java:11
com.cliffc.aa.util.VBitSet
Definition: VBitSet.java:5
com.cliffc.aa.node.DefMemNode
Definition: DefMemNode.java:8
com.cliffc.aa.type.BitsFun
Definition: BitsFun.java:7
com.cliffc.aa.Env.MEM_0
static StartMemNode MEM_0
Definition: Env.java:16
com.cliffc.aa.node.NewObjNode
Definition: NewObjNode.java:20
com.cliffc.aa.type.BitsAlias.init0
static void init0()
Definition: BitsAlias.java:63
com.cliffc.aa.util.SB
Tight/tiny StringBuilder wrapper.
Definition: SB.java:8
com.cliffc.aa.type.Type.NIL
static final Type NIL
Definition: Type.java:332
com.cliffc.aa.Env.VStack
Definition: Env.java:256
com.cliffc.aa.Env.record_for_top_reset2
static void record_for_top_reset2()
Definition: Env.java:158
com.cliffc.aa.node.Node.con
static Node con(Type t)
Definition: Node.java:670
com.cliffc.aa.tvar.TV2.str
final String str(int d)
Definition: TV2.java:707
com.cliffc.aa.Parse.isOp
static boolean isOp(String s)
Definition: Parse.java:1089
com.cliffc.aa.Parse.do_exit
Node do_exit(ScopeNode s, Node rez)
Definition: Parse.java:1019
com.cliffc.aa.Env.VStack._par
final VStack _par
Definition: Env.java:257
com.cliffc.aa.AA
an implementation of language AA
Definition: AA.java:9
com.cliffc.aa.Env._par
final Env _par
Definition: Env.java:34
com.cliffc.aa.GVNGCM.init0
void init0()
Definition: GVNGCM.java:83
com.cliffc.aa
Definition: AA.java:1
com.cliffc.aa.node.ConTypeNode
Definition: ConTypeNode.java:18
com.cliffc.aa.node.UnresolvedNode
Definition: UnresolvedNode.java:13
com.cliffc.aa.type.BitsRPC.init0
static void init0()
Definition: BitsRPC.java:28
com.cliffc.aa.node.ScopeNode.set_rez
void set_rez(Node n)
Definition: ScopeNode.java:51
com.cliffc.aa.node.NewNode
Definition: NewNode.java:17
com.cliffc.aa.Env.Env
Env()
Definition: Env.java:40
com.cliffc.aa.node.ScopeNode.stk
NewObjNode stk()
Definition: ScopeNode.java:48
com.cliffc.aa.node.ScopeNode.set_ptr
void set_ptr(Node n)
Definition: ScopeNode.java:50
com.cliffc.aa.node.MrgProjNode
Definition: MrgProjNode.java:10
com.cliffc.aa.util.SB.p
SB p(String s)
Definition: SB.java:13
AutoCloseable
com.cliffc.aa.Env.VStack.toString
String toString()
Definition: Env.java:281
com.cliffc.aa.type.BitsFun.reset_to_init0
static void reset_to_init0()
Definition: BitsFun.java:29
com.cliffc.aa.Env.SCP_0
static ScopeNode SCP_0
Definition: Env.java:18
com.cliffc.aa.Env.LEX_DISPLAYS
static BitsAlias LEX_DISPLAYS
Definition: Env.java:31
com.cliffc.aa.node.Node.reset_to_init0
static void reset_to_init0()
Definition: Node.java:77
com.cliffc.aa.node.StartNode
Definition: StartNode.java:12
com.cliffc.aa.tvar.TV2
Definition: TV2.java:23
com.cliffc.aa.GVNGCM.Mode.Opto
Opto
Definition: GVNGCM.java:17
com.cliffc.aa.util.NonBlockingHashMapLong< String >
com.cliffc.aa.type.TypeRPC
Definition: TypeRPC.java:7
com.cliffc.aa.node.NewObjNode.create_active
void create_active(String name, Node val, Access mutable)
Definition: NewObjNode.java:57
com.cliffc.aa.GVNGCM._opt_mode
Mode _opt_mode
Definition: GVNGCM.java:22
com.cliffc.aa.type.Type.XNIL
static final Type XNIL
Definition: Type.java:333
com.cliffc.aa.Env._scope
final ScopeNode _scope
Definition: Env.java:35
com.cliffc.aa.Env.NIL
static ConNode NIL
Definition: Env.java:23
com.cliffc.aa.GVNGCM.add_flow
public< N extends Node > N add_flow(N n)
Definition: GVNGCM.java:50
com.cliffc.aa.Env.nongen_pop
Node nongen_pop(Node ret)
Definition: Env.java:254
com.cliffc.aa.GVNGCM.add_dead
void add_dead(Node n)
Definition: GVNGCM.java:48
com.cliffc.aa.node.NewNode._alias
int _alias
Definition: NewNode.java:20
com.cliffc.aa.GVNGCM.iter
void iter(Mode opt_mode)
Definition: GVNGCM.java:147
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.TypeFld.Access
Definition: TypeFld.java:109
com.cliffc.aa.node.ScopeNode.set_ctrl
public< N extends Node > N set_ctrl(N n)
Definition: ScopeNode.java:49
com.cliffc.aa.node.FunNode
Definition: FunNode.java:58
com.cliffc.aa.Env.lookup_fref
Env lookup_fref(String tok)
Definition: Env.java:311
com.cliffc.aa.Env.lookup_type
ConTypeNode lookup_type(int alias)
Definition: Env.java:228
com.cliffc.aa.node.ScopeNode.get_type
ConTypeNode get_type(String name)
Definition: ScopeNode.java:85
com.cliffc.aa.Env.ANY
static ConNode ANY
Definition: Env.java:24
com.cliffc.aa.Env.VStack.add_var
String add_var(String fld, TV2 tv)
Definition: Env.java:261
com
com.cliffc.aa.Env.VStack.VStack
VStack(VStack par)
Definition: Env.java:260
com.cliffc.aa.type.Bits.set
B set(int bit)
Definition: Bits.java:264
com.cliffc.aa.node.NewNode.NewPrimNode.reset
static void reset()
Definition: NewNode.java:188
com.cliffc.aa.node.NewObjNode.promote_forward
void promote_forward(NewObjNode parent)
Definition: NewObjNode.java:94
com.cliffc.aa.Env.DEFMEM
static DefMemNode DEFMEM
Definition: Env.java:19
com.cliffc.aa.node.ScopeNode.init
void init()
Definition: ScopeNode.java:37
com.cliffc.aa.Env.lookup_filter_fresh
UnOrFunPtrNode lookup_filter_fresh(String name, int nargs, Node ctrl)
Definition: Env.java:203
com.cliffc.aa.node.Node.op_prec
byte op_prec()
Definition: Node.java:533
com.cliffc.aa.Env
Definition: Env.java:12
com.cliffc.aa.GVNGCM.Mode.Parse
Parse
Definition: GVNGCM.java:15
com.cliffc.aa.util.SB.toString
String toString()
Definition: SB.java:62
com.cliffc.aa.node.ScopeNode.set_mem
Node set_mem(Node n)
Definition: ScopeNode.java:54
com.cliffc.aa.Env.VStack.compact
TV2[] compact()
Definition: Env.java:267
com.cliffc.aa.type
Definition: Bits.java:1
com.cliffc.aa.GVNGCM.init
public< N extends Node > N init(N n)
Definition: GVNGCM.java:99
com.cliffc.aa.Parse
an implementation of language AA
Definition: Parse.java:68
com.cliffc.aa.Env.ALL_CTRL
static ConNode ALL_CTRL
Definition: Env.java:20
com.cliffc.aa.Env.VStack._flds
Ary< String > _flds
Definition: Env.java:258
com.cliffc.aa.node
Definition: AssertNode.java:1
com.cliffc.aa.GVNGCM.Mode
Definition: GVNGCM.java:14
com.cliffc.aa.Env.lookup_scope
ScopeNode lookup_scope(String name, boolean lookup_current_scope_only)
Definition: Env.java:177
com.cliffc.aa.type.BitsAlias.reset_to_init0
static void reset_to_init0()
Definition: BitsAlias.java:64
com.cliffc.aa.Env.Env
Env(Env par, Parse P, boolean is_closure, Node ctrl, Node mem)
Definition: Env.java:47