aa
TestNodeSmall.java
Go to the documentation of this file.
1 package com.cliffc.aa.node;
2 
3 import com.cliffc.aa.Env;
4 import com.cliffc.aa.GVNGCM;
5 import com.cliffc.aa.type.*;
6 import org.junit.Ignore;
7 import org.junit.Test;
8 
9 import java.util.*;
10 
11 import static com.cliffc.aa.AA.*;
12 import static com.cliffc.aa.type.TypeMemPtr.NO_DISP;
13 import static com.cliffc.aa.type.TypeFld.Access;
14 import static org.junit.Assert.assertEquals;
15 import static org.junit.Assert.assertTrue;
16 
17 public class TestNodeSmall {
18 
19  @Ignore
20  @Test public void testUnresolvedAdd() {
21  Env top = Env.top_scope();
22  GVNGCM gvn = Env.GVN;
23 
24  // Current theory on Unresolved: Call.resolve moves closer to the centerline:
25  // LOW fidxs are all must-calls, and removing one LIFTS . If args are MEET, removing LIFTS.
26  // HIGH fidxs are all may -calls, and removing one LOWERS. If args are JOIN, removing LOWERS.
27 
28  // Phi: always MEET, so highs meet to empty; and lows MEET.
29  // During GCP fidxs are high, then move to low.
30  // Call.resolve: choices get removed which lifts or lowers
31 
32  // WANT: During GCP, high choices fed to Call.resolve. Choices get removed, which LOWERS resolved.
33  // Means Unresolved during GCP produces only HIGH choices.
34  // WANT: During Iter, low choices fed to Call.resolve. Choices get removed, which LIFTS resolved.
35  // Means Unresolved during ITER produces only LOW choices.
36  // WANT: Same behavior during GCP and ITER, but doesn't appear I can have that.
37 
38  // Unresolved: ITER: all is MEET and no FIDX goes HIGH (except for dead/dying).
39 
40  // Unresolved: GCP : if FunPtr above center optional to ignore or JOIN.
41  // if FunPtr below center, flip to high and JOIN. Also high/ignore args kept high, and low args moved high for JOIN.
42  // Kinda sorta looks like: use startype on incoming, and JOIN.
43 
45  UnresolvedNode uadd = (UnresolvedNode)top.lookup("+"); // {int int -> int} and {flt flt -> flt} and {str str -> str}
46  FunPtrNode aflt = (FunPtrNode)uadd.in(0);
47  FunPtrNode aint = (FunPtrNode)uadd.in(1);
48  FunPtrNode astr = (FunPtrNode)uadd.in(2);
49  // Make a flt/int combo, drops off string.
50  UnresolvedNode anum = (UnresolvedNode)gvn.xform(new UnresolvedNode(null,aflt,aint));
51 
52  // All nodes have this property: START >= {ALL.dual(),value(START)} >= value(ALL.dual()) >= value(ALL) >= ALL
53  // Holds for both ITER and GCP.
54 
55 
56  // Compute Node.all_type() and all_type.startype()
57  Type uaddALL = uadd._val, uaddSTART = Type.ANY;
58  Type anumALL = anum._val, anumSTART = Type.ANY;
59  Type afltALL = aflt._val, afltSTART = Type.ANY;
60  Type aintALL = aint._val, aintSTART = Type.ANY;
61  Type astrALL = astr._val, astrSTART = Type.ANY;
62 
63  // Compute Node.value() where initial GVN is startype()
64  uadd._val = uaddSTART;
65  anum._val = anumSTART;
66  aflt._val = afltSTART;
67  aint._val = aintSTART;
68  astr._val = astrSTART;
70  Type uaddVAL1START = uadd.value(gvn._opt_mode);
71  Type anumVAL1START = anum.value(gvn._opt_mode);
72  Type afltVAL1START = aflt.value(gvn._opt_mode);
73  Type aintVAL1START = aint.value(gvn._opt_mode);
74  Type astrVAL1START = astr.value(gvn._opt_mode);
76  Type uaddVAL2START = uadd.value(gvn._opt_mode);
77  Type anumVAL2START = anum.value(gvn._opt_mode);
78  Type afltVAL2START = aflt.value(gvn._opt_mode);
79  Type aintVAL2START = aint.value(gvn._opt_mode);
80  Type astrVAL2START = astr.value(gvn._opt_mode);
81 
82  // Compute Node.value() where initial GVN is all_type.dual()
83  uadd._val = uaddALL.dual();
84  anum._val = anumALL.dual();
85  aflt._val = afltALL.dual();
86  aint._val = aintALL.dual();
87  astr._val = astrALL.dual();
89  Type uaddVAL1XALL = uadd.value(gvn._opt_mode);
90  Type anumVAL1XALL = anum.value(gvn._opt_mode);
91  Type afltVAL1XALL = aflt.value(gvn._opt_mode);
92  Type aintVAL1XALL = aint.value(gvn._opt_mode);
93  Type astrVAL1XALL = astr.value(gvn._opt_mode);
95  Type uaddVAL2XALL = uadd.value(gvn._opt_mode);
96  Type anumVAL2XALL = anum.value(gvn._opt_mode);
97  Type afltVAL2XALL = aflt.value(gvn._opt_mode);
98  Type aintVAL2XALL = aint.value(gvn._opt_mode);
99  Type astrVAL2XALL = astr.value(gvn._opt_mode);
100 
101  // Compute Node.value() where initial GVN is all_type()
102  uadd._val = uaddALL;
103  anum._val = uaddALL;
104  aflt._val = afltALL;
105  aint._val = aintALL;
106  astr._val = astrALL;
108  Type uaddVAL1ALL = uadd.value(gvn._opt_mode);
109  Type anumVAL1ALL = anum.value(gvn._opt_mode);
110  Type afltVAL1ALL = aflt.value(gvn._opt_mode);
111  Type aintVAL1ALL = aint.value(gvn._opt_mode);
112  Type astrVAL1ALL = astr.value(gvn._opt_mode);
114  Type uaddVAL2ALL = uadd.value(gvn._opt_mode);
115  Type anumVAL2ALL = anum.value(gvn._opt_mode);
116  Type afltVAL2ALL = aflt.value(gvn._opt_mode);
117  Type aintVAL2ALL = aint.value(gvn._opt_mode);
118  Type astrVAL2ALL = astr.value(gvn._opt_mode);
119 
120  Type[] uadds = new Type[]{uaddSTART,uaddALL.dual(),uaddVAL1START,uaddVAL2START,uaddVAL1XALL,uaddVAL2XALL,uaddVAL1ALL,uaddVAL2ALL,uaddALL};
121  Type[] anums = new Type[]{anumSTART,anumALL.dual(),anumVAL1START,anumVAL2START,anumVAL1XALL,anumVAL2XALL,anumVAL1ALL,anumVAL2ALL,anumALL};
122  Type[] aflts = new Type[]{afltSTART,afltALL.dual(),afltVAL1START,afltVAL2START,afltVAL1XALL,afltVAL2XALL,afltVAL1ALL,afltVAL2ALL,afltALL};
123  Type[] aints = new Type[]{aintSTART,aintALL.dual(),aintVAL1START,aintVAL2START,aintVAL1XALL,aintVAL2XALL,aintVAL1ALL,aintVAL2ALL,aintALL};
124  Type[] astrs = new Type[]{astrSTART,astrALL.dual(),astrVAL1START,astrVAL2START,astrVAL1XALL,astrVAL2XALL,astrVAL1ALL,astrVAL2ALL,astrALL};
125  Type[][] tfpss = new Type[][]{aflts,aints,astrs,anums,uadds};
126 
127  // All nodes have these properties:
128  // START >= {ALL.dual(),value1(START)} >= value1(ALL.dual()) >= value1(ALL) >= ALL
129  // START >= {ALL.dual(),value2(START)} >= value2(ALL.dual()) >= value2(ALL) >= ALL
130  for( Type[] tfps : tfpss ) {
131  Type start = tfps[0], xall = tfps[1], val1s = tfps[2], val2s = tfps[3];
132  Type val1x = tfps[4], val2x = tfps[5], val1a = tfps[6], val2a = tfps[7];
133  Type all = tfps[8];
134 
135  assertTrue(start.isa(xall ));
136  assertTrue(start.isa(val1s)); assertTrue(start.isa(val2s));
137  assertTrue(xall .isa(val1x)); assertTrue(xall .isa(val2x));
138  assertTrue(val1s.isa(val1x)); assertTrue(val2s.isa(val2x));
139  assertTrue(val1x.isa(val1a)); assertTrue(val2x.isa(val2a));
140  assertTrue(val1a.isa(all )); assertTrue(val2a.isa(all ));
141  }
142 
143  // Also, for CallNode.resolve we want the properties:
144  // UnresolvedAdd.XAll >= AnumAdd.Xall} >= {Flt,Int,Str}XAdd.All-- Removing a choice during GCP lowers
145  // {Flt,Int,Str}Add.ALL >= AnumAdd.ALL >= UnresolvedAdd.All -- Removing a choice during ITER lifts
146  assertTrue(uaddALL.dual().isa(anumALL.dual()));
147  assertTrue(anumALL.dual().isa(afltALL.dual()));
148  assertTrue(anumALL.dual().isa(aintALL.dual()));
149  assertTrue(uaddALL.dual().isa(astrALL.dual()));
150 
151  assertTrue(astrALL.isa(uaddALL));
152  assertTrue(aintALL.isa(anumALL));
153  assertTrue(afltALL.isa(anumALL));
154  assertTrue(anumALL.isa(uaddALL));
155 
156  }
157 
158  private Type[] _testMonotonicChain(Node[] ins, Node n, TypeTuple[] argss) {
159  GVNGCM gvn = Env.GVN;
160 
161  // First validate the test itself. If two tuples are 'isa' then the result
162  // is also 'isa'. To allow the tests in any order, we check a slightly
163  // strong condition: if all tuples are isa IN SOME ORDER, then the result
164  // is also 'isa' IN THAT ORDER.
165  int len = argss.length;
166  int num = argss[0]._ts.length;
167  for( int i=0; i<len; i++ ) {
168  TypeTuple tti = argss[i];
169  int order=0; // no order picked
170  midloop:
171  for( int j=i+1; j<len; j++ ) { // Triangulate
172  TypeTuple ttj = argss[j];
173  for( int k=0; k<num-1; k++ ) { // Check all parts are 'isa', except the answer
174  Type ttik = tti.at(k);
175  Type ttjk = ttj.at(k);
176  if( ttik==ttjk ) continue; // Does not affect outcome
177  if( ttik.isa(ttjk) ) order |= 1;// i isa j
178  else if( ttjk.isa(ttik) ) order |= 2;// j isa i
179  else order |= 3; // Unordered
180  if( order==3 ) continue midloop; // Mixed/unordered
181  }
182  assert order==1 || order==2;
183  Type ttiN = tti.at(num-1); // Then check last answer element is 'isa'
184  Type ttjN = ttj.at(num-1);
185  if( order==1 ) assertTrue("Test is broken: "+tti+" isa "+ttj+", but "+ttiN+" !isa "+ttjN,ttiN.isa(ttjN));
186  else assertTrue("Test is broken: "+ttj+" isa "+tti+", but "+ttjN+" !isa "+ttiN,ttjN.isa(ttiN));
187  }
188  }
189 
190 
191  // Now call Node.value()
192  TypeTuple[] tns= new TypeTuple[argss.length];
193  for( int i=0; i<argss.length; i++ ) {
194  for( int j=0; j<ins.length; j++ )
195  ins[j]._val = argss[i].at(j);
196  tns[i] = (TypeTuple)n.value(gvn._opt_mode);
197  }
198  // Equals check after computing them all
199  for( int i=0; i<argss.length; i++ ) {
200  TypeFunPtr expect = (TypeFunPtr)argss[i].at(ins.length);
201  TypeFunPtr actual = CallNode.ttfp(tns[i]); // Looking at the TFP from the Call, ignore ctrl,memory,args
202  assertEquals("Expect "+expect+", but actual is "+actual+", for ("+argss[i].at(3)+", "+argss[i].at(4)+")",
203  expect.fidxs(),actual.fidxs());
204  }
205  return tns;
206  }
207 
208 
209  private static TypeFunPtr v(Node n, GVNGCM gvn) { return (TypeFunPtr)n.value(gvn._opt_mode); }
210 
246  @SuppressWarnings("unchecked")
247  @Ignore
248  @Test public void testCallNodeResolve() {
249  Env top = Env.top_scope();
250  GVNGCM gvn = Env.GVN;
251 
252  // Make a Unknown/CallNode/CallEpi combo.
253  // Unwired. Validate the resolve process and monotonicity.
255  ConNode ctrl = (ConNode) gvn.xform(new ConNode<>(Type.CTRL));
256  UnresolvedNode fp_mul = (UnresolvedNode)top.lookup("*"); // {int int -> int} and {flt flt -> flt}
257  FunPtrNode mflt = (FunPtrNode)fp_mul.in(0);
258  FunPtrNode mint = (FunPtrNode)fp_mul.in(1);
259  UnresolvedNode fp_add = (UnresolvedNode)top.lookup("+"); // {int int -> int} and {flt flt -> flt} and {str str -> str}
260  FunPtrNode aflt = (FunPtrNode)fp_add.in(0);
261  FunPtrNode aint = (FunPtrNode)fp_add.in(1);
262  FunPtrNode astr = (FunPtrNode)fp_add.in(2);
263  // Make a flt/int combo, drops off string.
264  ConNode mem = gvn.init(new ConNode<>(TypeMem.MEM));
265  ConNode arg1 = gvn.init(new ConNode<>(Type.SCALAR));
266  ConNode arg2 = gvn.init(new ConNode<>(Type.SCALAR));
267  Node dsp = gvn.xform(new ConNode<>(TypeMemPtr.NO_DISP));
268  CallNode call = (CallNode)gvn.xform(new CallNode(true, null, ctrl, mem, dsp, arg1, arg2, fp_mul));
269  CallEpiNode cepi = (CallEpiNode)gvn.xform(new CallEpiNode(call, Env.DEFMEM)); // Unwired
270 
271  call.unelock(); // Will be hacking edges
272  Node[] ins = new Node[]{ctrl,mem,fp_mul,arg1,arg2};
273 
274  // Args to calls
275  Type tctl = Type.CTRL, txctl = Type.XCTRL;
276  Type tscl = Type.SCALAR, txscl = Type.XSCALAR;
277  Type tnil = Type.XNIL;
278  TypeMem tfull = TypeMem.MEM;
279  Type t2 = TypeInt.con(2); // Small ints are ambiguously either ints or floats
280  Type t3 = TypeInt.con(3);
281  Type tint=TypeInt.INT64;
282  Type tflt=TypeFlt.FLT64;
284 
285  // iter(), not gcp(). Types always rise. Very low types might lift to be
286  // valid, but e.g. a 2:int will never lift to a str.
288 
289  // The various kinds of results we expect
290  TypeFunPtr tmul1 = v(fp_mul,gvn), tmul1X = tmul1.dual();
291  TypeFunPtr tadd1 = v(fp_add,gvn), tadd1X = tadd1.dual();
292 
293  UnresolvedNode anum = gvn.init(new UnresolvedNode(null,aflt,aint));
294  TypeFunPtr tnum1 = v(anum,gvn), tnum1X = tnum1.dual();
295  TypeFunPtr tflt1 = v(aflt,gvn), tflt1X = tflt1.dual();
296  TypeFunPtr tint1 = v(aint,gvn), tint1X = tint1.dual();
297  TypeFunPtr tstr1 = v(astr,gvn), tstr1X = tstr1.dual();
298  TypeFunPtr tmint = v(mint,gvn), tmintX = tmint.dual();
299  TypeFunPtr tmflt = v(mflt,gvn), tmfltX = tmflt.dual();
300 
301  TypeFunPtr tmul1E = TypeFunPtr.make(BitsFun.EMPTY,0,NO_DISP); // All bad choices
302 
303  assert tadd1X.isa(tnum1X) && tnum1X.isa(tflt1X) && tflt1X.isa(tnum1) && tnum1.isa(tadd1);
304 
305  // Check the fptr {int,flt} meet
306  call.set_fdx(ins[2]=fp_mul);
307  TypeTuple[] argss_mul1 = new TypeTuple[] { // arg1 arg2 resolve
308  TypeTuple.make( tctl, tfull, tmul1, txscl, txscl, tmul1X), // ~S ~S [+int+flt] ; high
309  TypeTuple.make( tctl, tfull, tmul1, t2 , txscl, tmul1X), // 2 ~S [+int+flt] ; good+high
310  TypeTuple.make( tctl, tfull, tmul1, t2 , t3 , tmul1X), // 2 3 [+int+flt] ; good, requires 'least cost' to resolve
311  TypeTuple.make( tctl, tfull, tmul1, t2 , tint , tmintX), // 2 I [+int ] ; good
312  TypeTuple.make( tctl, tfull, tmul1, t2 , tflt , tmfltX), // 2 F [ +flt] ; good
313  TypeTuple.make( tctl, tfull, tmul1, t2 , tscl , tmul1 ), // 2 S [ int,flt] ; low+good
314  TypeTuple.make( tctl, tfull, tmul1, tscl , tscl , tmul1 ), // S S [ int,flt] ; low
315  TypeTuple.make( tctl, tfull, tmul1, txscl, tscl , tmul1 ), // ~S S [ int,flt] ; low +high
316  TypeTuple.make( tctl, tfull, tmul1, txscl, tabc , tmul1X), // ~S str [+int+flt] ; bad high
317  TypeTuple.make( tctl, tfull, tmul1, tabc , tabc , tmul1 ), // str str [ ] ; bad
318  TypeTuple.make( tctl, tfull, tmul1, t2 , tabc , tmul1 ), // 2 str [+int+flt] ; bad+good
319  };
320  _testMonotonicChain(ins,call,argss_mul1);
321 
322  // Check the {int,flt,str} meet.
323  // Rules:
324  // - Some args High & no Low, keep all & join (ignore Good,Bad)
325  // - Some args Low & no High, keep all & meet (ignore Good,Bad)
326  // - Mix High/Low & no Good , keep all & fidx?join:meet
327  // - Some Good, no Low, no High, drop Bad & fidx?join:meet
328  // - All Bad, like Low: keep all & meet
329  call.set_fdx(ins[2]=fp_add);
330  TypeTuple[] argss_add1 = new TypeTuple[] {
331  TypeTuple.make( tctl, tfull, tadd1, txscl, txscl, tadd1X), // ~S ~S [+int+flt+str] (__H,__H,__H) ; All high, keep all, join
332  TypeTuple.make( tctl, tfull, tadd1, txscl, tabc , tadd1X), // ~S str [+int+flt+str] (B_H,B_H,_GH) ; Some high, keep all, join
333  TypeTuple.make( tctl, tfull, tadd1, txscl, tscl , tadd1 ), // ~S S [ int,flt,str] (L_H,L_H,L_H) ; Mix H/L no Good, fidx/meet
334  TypeTuple.make( tctl, tfull, tadd1, tnil , txscl, tadd1X), // 0 ~S [+int+flt+str] (_GH,_GH,_GH) ; Some high, keep all, join
335  TypeTuple.make( tctl, tfull, tadd1, tnil , t3 , tnum1X), // 0 3 [+int+flt ] (_G_,_G_,BG_) ; Some good, drop bad, fidx/meet
336  TypeTuple.make( tctl, tfull, tadd1, tnil , tabc , tstr1X), // 0 str [ +str] (BG_,BG_,_G_) ; Some good, drop bad, fidx/meet
337  TypeTuple.make( tctl, tfull, tadd1, tnil , tint , tint1X), // 0 3 [+int ] (_G_,_G_,_G_) ; All good
338  TypeTuple.make( tctl, tfull, tadd1, tnil , tscl , tadd1 ), // 0 S [ int,flt,str] (LG_,LG_,LG_) ; Some low , keep all, meet
339  TypeTuple.make( tctl, tfull, tadd1, t2 , txscl, tadd1X), // 2 ~S [+int+flt+str] (_GH,_GH,B_H) ; Some high, keep all, join
340  TypeTuple.make( tctl, tfull, tadd1, t2 , t3 , tnum1X), // 2 3 [+int+flt ] (_G_,_G_,B__) ; Some good, drop bad, fidx/meet
341  TypeTuple.make( tctl, tfull, tadd1, t2 , tabc , tadd1 ), // 2 str [ int,flt,str] (BG_,BG_,BG_) ; All bad , keep all, meet
342  TypeTuple.make( tctl, tfull, tadd1, t2 , tscl , tadd1 ), // 2 S [ int,flt,str] (LG_,LG_,B__) ; Some low , keep all, meet
343  TypeTuple.make( tctl, tfull, tadd1, tabc , tabc , tstr1X), // str str [ +str] (B__,B__,_G_) ; Some good, drop bad, fidx/meet
344  TypeTuple.make( tctl, tfull, tadd1, tscl , tscl , tadd1 ), // S S [ int,flt,str] (L__,L__,L__) ; All low , keep all, meet
345  };
346  _testMonotonicChain(ins,call,argss_add1);
347 
348 
349  // gcp(), not iter(). Types always lower. Very high types might lower to be
350  // valid, but e.g. a 2:int will never lower to a str.
352 
353  // The various kinds of results we expect
354  TypeFunPtr tmul2X = v(fp_mul,gvn), tmul2 = tmul2X.dual();
355  TypeFunPtr tadd2X = v(fp_add,gvn), tadd2 = tadd2X.dual();
356 
357  TypeFunPtr tnum2X = v(anum,gvn), tnum2 = tnum2X.dual();
358  TypeFunPtr tflt2 = v(aflt,gvn), tflt2X= tflt2 .dual();
359  TypeFunPtr tint2 = v(aint,gvn), tint2X= tint2 .dual();
360  TypeFunPtr tstr2 = v(astr,gvn), tstr2X= tstr2 .dual();
361 
362  assert tadd2X.isa(tnum2X) && tnum2X.isa(tflt2X) && tflt2X.isa(tnum2) && tnum2.isa(tadd2);
363 
364 
365  // Check the fptr {+int+flt} choices
366  call.set_fdx(ins[2]=fp_mul);
367  TypeTuple[] argss_mul2 = new TypeTuple[] { // arg2 arg2 resolve
368  TypeTuple.make( tctl, tfull, tmul2X, txscl, txscl, tmul2X), // ~S ~S [+int+flt]
369  TypeTuple.make( tctl, tfull, tmul2X, t2 , txscl, tmul2X), // 2 ~S [+int+flt]
370  TypeTuple.make( tctl, tfull, tmul2X, t2 , t3 , tmul2X), // 2 3 [ int,flt]
371  TypeTuple.make( tctl, tfull, tmul2X, t2 , tscl , tmul2 ), // 2 S [ int,flt]
372  TypeTuple.make( tctl, tfull, tmul2X, tscl , tscl , tmul2 ), // S S [ int,flt]
373  TypeTuple.make( tctl, tfull, tmul2X, txscl, tscl , tmul2X), // ~S S [ int,flt]
374  TypeTuple.make( tctl, tfull, tmul2X, txscl, tabc , tmul2X), // ~S str [ int,flt]
375  TypeTuple.make( tctl, tfull, tmul2X, t2 , tabc , tmul2 ), // 2 str [ int,flt]
376  };
377  _testMonotonicChain(ins,call,argss_mul2);
378 
379  // Check the {+int+flt+str} choices
380  call.set_fdx(ins[2]=fp_add);
381  TypeTuple[] argss_add2 = new TypeTuple[] {
382  TypeTuple.make( tctl, tfull, tadd2X, txscl, txscl, tadd2X), // ~S ~S [+int+flt+str] (__H,__H,__H) ; All high, keep all, join
383  TypeTuple.make( tctl, tfull, tadd2X, txscl, tabc , tadd2X), // ~S str [+int+flt+str] (B_H,B_H,_GH) ; Some high, keep all, join
384  TypeTuple.make( tctl, tfull, tadd2X, txscl, tscl , tadd2X), // ~S S [+int+flt+str] (L_H,L_H,L_H) ; Mix H/L, no good, keep all, fidx/join
385  TypeTuple.make( tctl, tfull, tadd2X, tnil , txscl, tadd2X), // 0 ~S [+int+flt+str] (_GH,_GH,_GH) ; Some high, keep all, join
386  TypeTuple.make( tctl, tfull, tadd2X, tnil , t3 , tnum2X), // 0 3 [+int+flt ] (_G_,_G_,BG_) ; Some good, drop bad, fidx/join
387  TypeTuple.make( tctl, tfull, tadd2X, tnil , tabc , tstr2X), // 0 str [ +str] (BG_,BG_,_G_) ; Some good, drop bad, fidx/join
388  TypeTuple.make( tctl, tfull, tadd2X, tnil , tscl , tadd2 ), // 0 S [ int,flt,str] (LG_,LG_,LG_) ; Some low , keep all, meet
389  TypeTuple.make( tctl, tfull, tadd2X, t2 , txscl, tadd2X), // 2 ~S [+int+flt+str] (_GH,_GH,B_H) ; Some high, keep all, join
390  TypeTuple.make( tctl, tfull, tadd2X, t2 , t3 , tnum2X), // 2 3 [+int+flt ] (_G_,_G_,B__) ; Some good, drop bad, fidx/join
391  TypeTuple.make( tctl, tfull, tadd2X, t2 , tabc , tadd2 ), // 2 str [ int,flt,str] (BG_,BG_,BG_) ; All bad , keep all, meet
392  TypeTuple.make( tctl, tfull, tadd2X, t2 , tscl , tadd2 ), // 2 S [ int,flt,str] (LG_,LG_,B__) ; Some low , keep all, meet
393  TypeTuple.make( tctl, tfull, tadd2X, tabc , tabc , tstr2X), // str str [ +str] (B__,B__,_G_) ; Some good, drop bad, fidx/join
394  TypeTuple.make( tctl, tfull, tadd2X, tscl , tscl , tadd2 ), // S S [ int,flt,str] (L__,L__,L__) ; All low , keep all, meet
395  };
396  _testMonotonicChain(ins,call,argss_add2);
397 
398  cepi.kill();
399  }
400 
401  @Test public void testCallNodeResolve2() {
402  Env top = Env.top_scope();
403  GVNGCM gvn = Env.GVN;
405 
406  UnresolvedNode fp_add = (UnresolvedNode)top.lookup("+"); // {int int -> int} and {flt flt -> flt} and {str str -> str}
407  FunPtrNode aflt = (FunPtrNode)fp_add.in(0);
408  FunPtrNode aint = (FunPtrNode)fp_add.in(1);
409  FunPtrNode astr = (FunPtrNode)fp_add.in(2);
410 
411  // Make a Unknown/CallNode/CallEpi combo. Unwired.
412  ConNode ctrl = (ConNode)gvn.xform(new ConNode<>(Type.CTRL));
413  ConNode mem = (ConNode)gvn.xform(new ConNode<>(TypeMem.MEM));
414  ConNode dsp = (ConNode)gvn.xform(new ConNode<>(TypeMemPtr.NO_DISP));
415  ConNode arg3 = gvn.init(new ConNode<>(Type.SCALAR));
416  ConNode arg4 = gvn.init(new ConNode<>(Type.SCALAR));
417  ConNode fdx = gvn.init(new ConNode<>(fp_add._val));
418  CallNode call = gvn.init(new CallNode(true, null, ctrl, mem, dsp, arg3, arg4, fdx));
419  CallEpiNode cepi = gvn.init(new CallEpiNode(call, Env.DEFMEM)); // Unwired
420 
421  // Types we see on inputs, choosen to walk across the sample space
422  Type i32 = TypeInt.INT32; // Subsets both int64 and flt64
423  Type i64 = TypeInt.INT64;
424  Type f64 = TypeFlt.FLT64;
425  Type scl = Type.SCALAR;
426  Type abc = TypeMemPtr.ABCPTR.simple_ptr(); // Constant string
427  Type tup = TypeMemPtr.STRUCT.simple_ptr(); // Tuple pointer (always wrong
428  // All args, including duals
429  Type[] targs = new Type[]{i64,i64.dual(),
430  f64,f64.dual(),
431  scl,scl.dual(),
432  //abc,abc.dual(),
433  //i32,i32.dual(),
434  //tup,tup.dual(),
435  };
436  // Functions we see, in all combos
437  Type fint = aint._val;
438  Type fflt = aflt._val;
439  Type fstr = astr._val;
440  Type fif_ = fint.meet(fflt);
441  Type f_fs = fstr.meet(fflt);
442  Type fi_s = fstr.meet(fint);
443  Type fifs = fint.meet(fflt).meet(fstr);
444  // All FDXS, including duals
445  Type[] tfdxs = new Type[]{fint,fint.dual(),fflt,fflt.dual(),fstr,fstr.dual(),
446  fif_,fif_.dual(),f_fs,f_fs.dual(),
447  fi_s,fi_s.dual(),fifs,fifs.dual(),};
448 
449  // Pre-compute them all
450  HashMap<TypeTuple,Type> cvals = new HashMap<>();
451  for( Type targ3 : targs ) {
452  arg3._val = targ3;
453  for( Type targ4 : targs ) {
454  arg4._val = targ4;
455  for( Type tfdx : tfdxs ) {
456  fdx._val = tfdx;
457  Type tcall = call.value(GVNGCM.Mode.Parse);
458  TypeTuple args = TypeTuple.make(targ3,targ4,tfdx);
459  cvals.put(args,tcall);
460  }
461  }
462  }
463 
464  // Verify ISA relation
465  Set<TypeTuple> keys = cvals.keySet();
466  for( TypeTuple key0 : keys )
467  for( TypeTuple key1 : keys )
468  if( key0.isa(key1) )
469  assertTrue(cvals.get(key0).isa(cvals.get(key1)));
470 
471 
472 
473  }
474 
475  // When making a recursive function, we get a pointer cycle with the display
476  // and function arguments. Validate that we can re-discover this closed
477  // cycle during GCP from whole cloth.
478 
479  // Code: "fact={ x -> x>1 ? fact(x-1)*x : 1 }"
480  // tfp = [36]{^:[*10] x:int -> Scalar} // Function def, with standard display. Note the display is dead here.
481  // *[10] -> {^:[*6] fact:tfp} // File-level scope
482  // *[6] -> { ^:nil PRIMS...} // Prim-level scope
483  //
484  // Here's an example where the display is not dead-by-default:
485  // Code: "gen_ctr={cnt;{cnt++}}; ctrA=gen_ctr(); ctrB=gen_ctr(); ctrA(); ctrB(); ctrB()"
486  //
487  @Test public void testRecursiveDisplay() {
488  Env top = Env.top_scope();
489  GVNGCM gvn = Env.GVN;
490 
491  // Build the graph for the "fact" example:
492  // NewObj (display); inputs are prior display and FunPtr
493  // OProj
494  // DProj
495  // MemMerge; default mem and OProj
496  // Fun (and Fun._tf) - Just default control and some other control
497  // Parm:^ - Default display and DProj
498  // Parm:mem - Default mem and the MemMerge of OProj
499  // Ret - {Fun,Mem,Parm:^} - Not really fact() nor gen_ctr() code but upwards exposed closure
500  // FunPtr - Ret
502  ConNode ctl = gvn.init(new ConNode<>(Type.CTRL));
503  ctl._val = Type.CTRL;
504  ConNode mem = (ConNode)gvn.xform(new ConNode<>(TypeMem.ANYMEM)).keep();
505  ConNode rpc = (ConNode)gvn.xform(new ConNode<>(TypeRPC.ALL_CALL));
506  ConNode dsp_prims = (ConNode) gvn.xform(new ConNode<>(TypeMemPtr.DISP_SIMPLE));
507  // The file-scope display closing the graph-cycle. Needs the FunPtr, not
508  // yet built.
509  NewObjNode dsp_file = (NewObjNode)gvn.xform(new NewObjNode(true,TypeMemPtr.DISPLAY,dsp_prims));
510  MrgProjNode dsp_file_obj = Env.DEFMEM.make_mem_proj(dsp_file,mem);
511  ProjNode dsp_file_ptr = ( ProjNode)gvn.xform(new ProjNode(DSP_IDX, dsp_file));
513  // The Fun and Fun._tf:
515  TypeMem.MEM,
516  dsp_file_ptr._val, // File-scope display as arg0
517  Type.SCALAR)); // Some scalar arg1
518  TypeFunSig sig = TypeFunSig.make(TypeTuple.RET,formals);
519  FunNode fun = new FunNode(null,sig,-1,false);
520  gvn.init(fun.add_def(ctl).add_def(ctl)).unkeep();
521  // Parms for the Fun. Note that the default type is "weak" because the
522  // file-level display can not yet know about "fact".
523  ParmNode parm_mem = new ParmNode(MEM_IDX," mem",fun,mem,null);
524  gvn.xform(parm_mem.add_def(dsp_file_obj));
525  ParmNode parm_dsp = new ParmNode(DSP_IDX,"^" ,fun,Type.SCALAR,Node.con(dsp_file_ptr._val),null);
526  gvn.xform(parm_dsp.add_def(dsp_file_ptr));
527  // Close the function up
528  RetNode ret = gvn.init(new RetNode(fun,parm_mem,parm_dsp,rpc,fun));
529  FunPtrNode fptr = gvn.init(new FunPtrNode(ret,dsp_file_ptr));
530  // Close the cycle
531  dsp_file.create("fact",fptr,Access.Final);
532  dsp_file.no_more_fields();
533  // Return the fptr to keep all alive
534  ScopeNode env = new ScopeNode(null,true);
535  env.set_ctrl(ctl);
536  env.set_ptr (dsp_file_ptr);
537  env.set_mem (dsp_file_obj);
538  env.set_rez (fptr);
539  gvn.init(env);
540 
541  Node[] nodes = new Node[]{ctl,mem,rpc,dsp_prims,dsp_file,dsp_file_obj,dsp_file_ptr,fun,parm_mem,parm_dsp,ret,fptr,env};
542 
543  // Validate graph initial conditions. No optimizations, as this
544  // pile-o-bits is all dead and will vaporize if the optimizer is turned
545  // loose on it. Just check the types flow correctly.
547  for( Node n : nodes ) {
548  Type old = n._val;
549  Type nnn = n.value(gvn._opt_mode);
550  assert nnn.isa(old);
551  }
552 
553  // Now run GCP to closure. This is the key call being tested.
554  gvn.gcp(GVNGCM.Mode.Opto,env);
555 
556  // Validate cyclic display/function type
557  TypeFunPtr tfptr0 = (TypeFunPtr) fptr._val;
558  Type tdptr0 = tfptr0._disp;
559  Type tret = ((TypeTuple) ret._val).at(2);
560  assertEquals(tdptr0,tret); // Returning the display
561  // Display contains 'fact' pointing to self
562  TypeMem tmem = (TypeMem) dsp_file_obj._val;
563  TypeStruct tdisp0 = (TypeStruct)tmem.ld((TypeMemPtr)tdptr0);
564  assertEquals(tfptr0,tdisp0.at(tdisp0.fld_find("fact")));
565  }
566 
567 
568  // Memory checks args "just like" normal args, except it changes contents of
569  // memory to match incoming args.
570  //
571  // Single bad ptr + memory, e.g. [13]->obj and [13:@{x==1,y==2}] but the
572  // formal is [2:Point:@{x,y}]. Can change memory directly here (no sharing):
573  // [13:Point:@{x,y}] and leave the ptr alone.
574  //
575  // Can also make a new fake alias: 14>>13, change both ptr and mem:
576  // *[14]->obj, [14:Point:@{x,y}]. If [13] lifts to some other refinement
577  // alias, may need new fake aliases. If [13] lifts to a refinement with a
578  // valid memory, no need to change memory.
579  //
580  // Must be monotonic towards correctness, if theres any chance to lift (fall)
581  // and be correct. If always an error, can go sideways but still monotonic
582  // on the side path.
583  //
584  // Have to figure out how to handle N busted ptrs, and N busted memories.
585  // Either fake aliases for all, or union the incompatible types? Begs for a
586  // custom test: Fun, Parm:mem, Parm:x, Parm:y. Outputs always within formal
587  // bounds, and always monotonic, and preserves shape if in-bounds.
588 
589  private static int ERR=0;
590  @Test public void testMemoryArgs() {
591  Env top = Env.top_scope();
592  GVNGCM gvn = Env.GVN;
593 
594  // Check Parm.value calls are monotonic, and within Fun.sig bounds -
595  // including memory args.
596 
597  // Build a bunch of aliases.
598  int a1 = BitsAlias.new_alias(BitsAlias.REC);
599  int a2 = BitsAlias.new_alias(BitsAlias.REC);
600  int a3 = BitsAlias.new_alias(BitsAlias.REC);
603  // @{ a:int; b:"abc" }
604  TypeStruct a_int_b_abc = TypeStruct.make(TypeFld.NO_DISP,
605  TypeFld.make("a",TypeInt.INT64,1),
606  TypeFld.make("b",TypeMemPtr.ABCPTR,2));
607 
608  // Build a bunch of function type signatures
609  TypeFunSig[] sigs = new TypeFunSig[] {
610  TypeFunSig.make(TypeTuple.RET,ts_int_flt), // {int flt -> }
611  TypeFunSig.make(TypeTuple.RET,ts_int_abc), // {int "abc" -> }
612  // { flt @{a:int; b:"abc"} -> }
614  };
615 
616  // Build a bunch of memory parm types
617  TypeMem[] mems = new TypeMem[] {
618  tmem(null),
619  tmem(null).dual(),
620  tmem(new int[]{a1},TypeStr.STR),
621  tmem(new int[]{a1},a_int_b_abc),
622  };
623 
624  // Build a bunch of parameter types
625  Type[] args = new Type[] {
626  Type.NIL,
627  Type.XNIL,
628  TypeInt.INT64,
629  TypeInt.INT64.dual(),
630  TypeInt.NINT64,
632  TypeMemPtr.ABCPTR.dual().simple_ptr(),
634  TypeMemPtr.make(a1,TypeObj.OBJ).dual().simple_ptr(),
635  };
636 
637  // One-off jig for testing single combo
638  // Known easy fail: 0,0,0,[6,5]
639  // Known easy fail: 2,1,0,[6,7]
640  // Known easy fail: 1,0,0,[8,5]
641  // Known easy fail: 2,[1,0],0,7
642  Type[] rez1 = check(gvn,sigs[2],mems[1],args[0],args[8]);
643  Type[] rez2 = check(gvn,sigs[2],mems[0],args[0],args[8]);
644  for( int k=0; k<rez1.length; k++ )
645  assertTrue(rez1[k].isa(rez2[k]));
646 
647 
648  // Call for all combos.
649  // Check results are isa-sig.
650  Type[][][][][] rezs = new Type[sigs.length][mems.length][args.length][args.length][];
651  for( int is = 0; is<sigs.length; is++ )
652  for( int im = 0; im<mems.length; im++ )
653  for( int ia0 = 0; ia0<args.length; ia0++ )
654  for( int ia1 = 0; ia1<args.length; ia1++ )
655  rezs[is][im][ia0][ia1] = check(gvn,sigs[is],mems[im],args[ia0],args[ia1]);
656 
657  // Check results are monotonic:
658  for( int is = 0; is<sigs.length; is++ )
659  for( int js = 0; js<sigs.length; js++ )
660  if( sigs[is].isa(sigs[js]) )
661  for( int im = 0; im<mems.length; im++ )
662  for( int jm = 0; jm<mems.length; jm++ )
663  if( mems[im].isa(mems[jm]) )
664  for( int ia0 = 0; ia0<args.length; ia0++ )
665  for( int ja0 = 0; ja0<args.length; ja0++ )
666  if( args[ia0].isa(args[ja0]) )
667  for( int ia1 = 0; ia1<args.length; ia1++ )
668  for( int ja1 = 0; ja1<args.length; ja1++ )
669  if( args[ia1].isa(args[ja1]) ) {
670  Type[] rezi = rezs[is][im][ia0][ia1];
671  Type[] rezj = rezs[js][jm][ja0][ja1];
672  for( int k=0; k<rezi.length; k++ )
673  if( !rezi[k].isa(rezj[k]) )
674  perror("Not monotonic",rezi[k],rezj[k]);
675  }
676  assertEquals(0,ERR);
677  }
678 
679  // Check that the Parm.value calls for these incoming args are monotonic, and
680  // within the sig bounds.
681  private static Type[] check( GVNGCM gvn, TypeFunSig tsig, TypeMem tmem, Type targ1, Type targ2 ) {
682  assert targ1.simple_ptr()==targ1;
683  assert targ2.simple_ptr()==targ2;
684  ConNode ctl = gvn.init(new ConNode<>(Type.CTRL));
685  CallNode call = gvn.init(new CallNode(true, null, ctl, null/*mem*/, null/*disp*/, null/*x*/, null/*y*/, null/*fidx*/));
686  CallEpiNode cepi = gvn.init(new CallEpiNode(call, Env.DEFMEM)); // Unwired
687  Node cpj = gvn.xform(new CProjNode(call,0));
688  ConNode mem = (ConNode)gvn.xform(new ConNode<>(tmem ));
689  ConNode arg1= (ConNode)gvn.xform(new ConNode<>(targ1));
690  ConNode arg2= (ConNode)gvn.xform(new ConNode<>(targ2));
691 
692  // Make nodes
693  FunNode fun = new FunNode(null,tsig,-1,false).unkeep();
694  gvn.xform(fun.add_def(cpj));
695 
696  ParmNode parmem= gvn.init(new ParmNode( 0,"mem" ,fun,mem ,null));
697  ParmNode parm1 = gvn.init(new ParmNode( 2,"arg1",fun,arg1,null));
698  ParmNode parm2 = gvn.init(new ParmNode( 3,"arg2",fun,arg2,null));
699 
700  // Types for normal args before memory type
701  Type tp1 = parm1 .xval ();
702  Type tp2 = parm2 .xval ();
703  Type tpm = parmem.value(gvn._opt_mode);
704 
705  // Check the isa(sig) on complex pointer args
706  Type actual1 = tpm.sharptr(tp1);
707  Type formal1 = fun.formal(2);
708  if( !actual1.isa(formal1) && !formal1.isa(actual1) )
709  perror("arg1-vs-formal1",actual1,formal1);
710  Type actual2 = tpm.sharptr(tp2);
711  Type formal2 = fun.formal(3);
712  if( !actual2.isa(formal2) && !formal2.isa(actual2) )
713  perror("arg2-vs-formal2",actual2,formal2);
714 
715  // Record for later monotonic check
716  return new Type[]{tpm,tp1,tp2};
717  }
718 
719  static void perror( String msg, Type t1, Type t2 ) {
720  if( ERR < 10 )
721  System.out.println(msg+", "+t1+" is not "+t2);
722  ERR++;
723  }
724 
725 
726  // Helper to make memory
727  private static TypeMem tmem(int[] as, TypeObj... ts) {
728  int max = BitsAlias.AARY;
729  if( as !=null && as.length> 0 ) max = Math.max(max,as[as.length-1]);
730  TypeObj[] tos = new TypeObj[max+1];
731  tos[BitsAlias.ALL] = TypeObj.OBJ;
733  tos[BitsAlias.ABC] = TypeStr.ABC; //
734  tos[BitsAlias.STR] = TypeStr.STR;
735  tos[BitsAlias.AARY] = TypeAry.ARY;
736  if( as != null )
737  for( int i=0; i<as.length; i++ )
738  tos[as[i]] = ts[i];
739  return TypeMem.make0(tos);
740  }
741 }
742 
com.cliffc.aa.type.TypeFld.Access.Final
Final
Definition: TypeFld.java:112
com.cliffc.aa.type.TypeMemPtr.NO_DISP
static final Type NO_DISP
Definition: TypeMemPtr.java:80
com.cliffc.aa.node.TestNodeSmall.testCallNodeResolve2
void testCallNodeResolve2()
Definition: TestNodeSmall.java:401
com.cliffc.aa.type.BitsFun.EMPTY
static final BitsFun EMPTY
Definition: BitsFun.java:37
com.cliffc.aa.type.TypeMem.ld
TypeObj ld(TypeMemPtr ptr)
Definition: TypeMem.java:325
com.cliffc.aa.type.TypeFunPtr
Definition: TypeFunPtr.java:23
com.cliffc.aa.node.TestNodeSmall.ERR
static int ERR
Definition: TestNodeSmall.java:589
com.cliffc.aa.node.TestNodeSmall.tmem
static TypeMem tmem(int[] as, TypeObj... ts)
Definition: TestNodeSmall.java:727
com.cliffc.aa.type.TypeTuple.make_args
static TypeTuple make_args(Type[] ts)
Definition: TypeTuple.java:106
com.cliffc.aa.node.NewObjNode.no_more_fields
void no_more_fields()
Definition: NewObjNode.java:48
com.cliffc.aa.type.Type.isa
boolean isa(Type t)
Definition: Type.java:623
com.cliffc.aa.type.TypeMemPtr.ABCPTR
static final TypeMemPtr ABCPTR
Definition: TypeMemPtr.java:99
com.cliffc.aa.type.TypeMem
Memory type; the state of all of memory; memory edges order memory ops.
Definition: TypeMem.java:53
com.cliffc.aa.node.TestNodeSmall
Definition: TestNodeSmall.java:17
com.cliffc.aa.type.Type.SCALAR
static final Type SCALAR
Definition: Type.java:328
com.cliffc
com.cliffc.aa.Env.top_scope
static Env top_scope()
Definition: Env.java:72
com.cliffc.aa.type.BitsAlias.AARY
static final int AARY
Definition: BitsAlias.java:25
com.cliffc.aa.type.TypeFld
Definition: TypeFld.java:12
com.cliffc.aa.node.ScopeNode
Definition: ScopeNode.java:17
com.cliffc.aa.type.Type.XSCALAR
static final Type XSCALAR
Definition: Type.java:329
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.type.TypeInt
Definition: TypeInt.java:9
com.cliffc.aa.type.Type
an implementation of language AA
Definition: Type.java:94
com.cliffc.aa.type.TypeFunSig.make
static TypeFunSig make(String[] args, TypeTuple formals, TypeTuple ret)
Definition: TypeFunSig.java:71
com.cliffc.aa.type.TypeFlt
Definition: TypeFlt.java:9
com.cliffc.aa.type.TypeStruct.ALLSTRUCT
static final TypeStruct ALLSTRUCT
Definition: TypeStruct.java:228
com.cliffc.aa.node.CProjNode
Definition: CProjNode.java:10
com.cliffc.aa.type.BitsAlias
Definition: BitsAlias.java:8
com.cliffc.aa.type.TypeTuple
Definition: TypeTuple.java:11
com.cliffc.aa.type.TypeFld.NO_DISP
static final TypeFld NO_DISP
Definition: TypeFld.java:170
com.cliffc.aa.type.TypeInt.con
static TypeInt con(long con)
Definition: TypeInt.java:37
com.cliffc.aa.node.Node.unelock
void unelock()
Definition: Node.java:128
com.cliffc.aa.type.TypeFunPtr.fidxs
BitsFun fidxs()
Definition: TypeFunPtr.java:127
com.cliffc.aa.node.Node._val
Type _val
Definition: Node.java:88
com.cliffc.aa.type.Type.ANY
static final Type ANY
Definition: Type.java:325
com.cliffc.aa.node.ConNode
Definition: ConNode.java:9
Test
com.cliffc.aa.type.BitsAlias.new_alias
static int new_alias(int par)
Definition: BitsAlias.java:75
com.cliffc.aa.node.Node.add_def
Node add_def(Node n)
Definition: Node.java:152
com.cliffc.aa.node.FunPtrNode
Definition: FunPtrNode.java:40
com.cliffc.aa.type.TypeAry
Definition: TypeAry.java:7
com.cliffc.aa.type.Type.meet
final Type meet(Type t)
Definition: Type.java:412
com.cliffc.aa.node.FunNode.formal
Type formal(int idx)
Definition: FunNode.java:187
com.cliffc.aa.node.RetNode
Definition: RetNode.java:19
com.cliffc.aa.type.TypeStruct
A memory-based collection of optionally named fields.
Definition: TypeStruct.java:50
com.cliffc.aa.type.TypeFld.make
static TypeFld make(String fld, Type t, int order)
Definition: TypeFld.java:58
com.cliffc.aa.node.CallNode
Definition: CallNode.java:86
com.cliffc.aa.node.TestNodeSmall.v
static TypeFunPtr v(Node n, GVNGCM gvn)
Definition: TestNodeSmall.java:209
com.cliffc.aa.Env.ALL_DISPLAYS
static BitsAlias ALL_DISPLAYS
Definition: Env.java:28
com.cliffc.aa.type.TypeMem.ANYMEM
static final TypeMem ANYMEM
Definition: TypeMem.java:228
com.cliffc.aa.type.Types
Definition: Types.java:9
com.cliffc.aa.GVNGCM.Mode.PesiNoCG
PesiNoCG
Definition: GVNGCM.java:16
com.cliffc.aa.Env.lookup
Node lookup(String name)
Definition: Env.java:186
com.cliffc.aa.type.Types.ts
static Type[] ts(Type t0)
Definition: Types.java:90
com.cliffc.aa.GVNGCM.xform
Node xform(Node n)
Definition: GVNGCM.java:126
com.cliffc.aa.type.BitsAlias.REC
static final int REC
Definition: BitsAlias.java:25
com.cliffc.aa.type.TypeMem.make0
static TypeMem make0(TypeObj[] as)
Definition: TypeMem.java:170
com.cliffc.aa.Env.GVN
static final GVNGCM GVN
Definition: Env.java:13
com.cliffc.aa.type.TypeInt.INT64
static final TypeInt INT64
Definition: TypeInt.java:39
com.cliffc.aa.type.TypeObj.OBJ
static final TypeObj OBJ
Definition: TypeObj.java:44
com.cliffc.aa.type.TypeMemPtr.DISP_SIMPLE
static final TypeMemPtr DISP_SIMPLE
Definition: TypeMemPtr.java:105
com.cliffc.aa.type.TypeObj
Definition: TypeObj.java:15
com.cliffc.aa.node.ParmNode.value
Type value(GVNGCM.Mode opt_mode)
Definition: ParmNode.java:59
com.cliffc.aa.node.Node.unkeep
public< N extends Node > N unkeep()
Definition: Node.java:232
com.cliffc.aa.type.TypeAry.ARY
static final TypeAry ARY
Definition: TypeAry.java:44
com.cliffc.aa.node.TestNodeSmall.testUnresolvedAdd
void testUnresolvedAdd()
Definition: TestNodeSmall.java:20
com.cliffc.aa.node.Node.value
abstract Type value(GVNGCM.Mode opt_mode)
com.cliffc.aa.node.Node.kill
Node kill()
Definition: Node.java:211
com.cliffc.aa.type.TypeTuple.RET
static final TypeTuple RET
Definition: TypeTuple.java:130
com.cliffc.aa.node.TestNodeSmall._testMonotonicChain
Type[] _testMonotonicChain(Node[] ins, Node n, TypeTuple[] argss)
Definition: TestNodeSmall.java:158
com.cliffc.aa.type.TypeMemPtr.DISPLAY
static final TypeStruct DISPLAY
Definition: TypeMemPtr.java:78
com.cliffc.aa.type.TypeFunPtr._disp
Type _disp
Definition: TypeFunPtr.java:28
com.cliffc.aa.type.TypeStr.ABC
static final TypeStr ABC
Definition: TypeStr.java:47
com.cliffc.aa.type.BitsAlias.ALL
static final int ALL
Definition: BitsAlias.java:25
com.cliffc.aa.type.Type.CTRL
static final Type CTRL
Definition: Type.java:326
com.cliffc.aa.type.TypeInt.INT32
static final TypeInt INT32
Definition: TypeInt.java:40
com.cliffc.aa.type.TypeTuple.make
static TypeTuple make(boolean any, Type[] ts)
Definition: TypeTuple.java:82
com.cliffc.aa.node.TestNodeSmall.perror
static void perror(String msg, Type t1, Type t2)
Definition: TestNodeSmall.java:719
com.cliffc.aa.node.Node.in
Node in(int i)
Definition: Node.java:126
com.cliffc.aa.node.TestNodeSmall.testCallNodeResolve
void testCallNodeResolve()
Validate monotonicity of CallNode.resolve().
Definition: TestNodeSmall.java:248
com.cliffc.aa.type.TypeMemPtr.STRUCT
static final TypeMemPtr STRUCT
Definition: TypeMemPtr.java:101
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.type.TypeFunPtr.make
static TypeFunPtr make(BitsFun fidxs, int nargs, Type disp)
Definition: TypeFunPtr.java:67
com.cliffc.aa.type.Type.sharptr
Type sharptr(Type ptr)
Definition: Type.java:930
com.cliffc.aa.type.BitsAlias.ABC
static final int ABC
Definition: BitsAlias.java:25
com.cliffc.aa.type.Type.simple_ptr
Type simple_ptr()
Definition: Type.java:358
com.cliffc.aa.type.TypeStr
Definition: TypeStr.java:14
com.cliffc.aa.node.TestNodeSmall.testRecursiveDisplay
void testRecursiveDisplay()
Definition: TestNodeSmall.java:487
com.cliffc.aa.node.ProjNode
Definition: ProjNode.java:11
com.cliffc.aa.node.NewObjNode.create
void create(String name, Node val, Access mutable)
Definition: NewObjNode.java:51
com.cliffc.aa.type.BitsFun
Definition: BitsFun.java:7
com.cliffc.aa.node.NewObjNode
Definition: NewObjNode.java:20
com.cliffc.aa.type.Type.NIL
static final Type NIL
Definition: Type.java:332
com.cliffc.aa.node.TestNodeSmall.testMemoryArgs
void testMemoryArgs()
Definition: TestNodeSmall.java:590
com.cliffc.aa.node.Node.con
static Node con(Type t)
Definition: Node.java:670
com.cliffc.aa.type.TypeMemPtr.simple_ptr
Type simple_ptr()
Definition: TypeMemPtr.java:160
com.cliffc.aa.AA
an implementation of language AA
Definition: AA.java:9
com.cliffc.aa.type.TypeInt.NINT64
static final TypeInt NINT64
Definition: TypeInt.java:48
com.cliffc.aa.node.UnresolvedNode.value
Type value(GVNGCM.Mode opt_mode)
Definition: UnresolvedNode.java:45
com.cliffc.aa
Definition: AA.java:1
com.cliffc.aa.node.UnresolvedNode
Definition: UnresolvedNode.java:13
com.cliffc.aa.node.ScopeNode.set_rez
void set_rez(Node n)
Definition: ScopeNode.java:51
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.GVNGCM.gcp
void gcp(Mode mode, ScopeNode rez)
Definition: GVNGCM.java:217
com.cliffc.aa.node.CallNode.ttfp
static TypeFunPtr ttfp(Type tcall)
Definition: CallNode.java:157
com.cliffc.aa.type.TypeTuple.at
Type at(int idx)
Definition: TypeTuple.java:182
com.cliffc.aa.type.TypeFunSig
Definition: TypeFunSig.java:10
com.cliffc.aa.type.Type.dual
final T dual()
Definition: Type.java:361
com.cliffc.aa.node.CallEpiNode
Definition: CallEpiNode.java:24
com.cliffc.aa.node.ParmNode
Definition: ParmNode.java:14
com.cliffc.aa.type.TypeStruct.make
static TypeStruct make(String fld_name, Type t)
Definition: TypeStruct.java:190
com.cliffc.aa.GVNGCM.Mode.Opto
Opto
Definition: GVNGCM.java:17
com.cliffc.aa.node.TestNodeSmall.check
static Type[] check(GVNGCM gvn, TypeFunSig tsig, TypeMem tmem, Type targ1, Type targ2)
Definition: TestNodeSmall.java:681
com.cliffc.aa.type.TypeRPC
Definition: TypeRPC.java:7
com.cliffc.aa.node.FunPtrNode.value
Type value(GVNGCM.Mode opt_mode)
Definition: FunPtrNode.java:129
com.cliffc.aa.node.Node.xval
Type xval()
Definition: Node.java:460
com.cliffc.aa.type.TypeTuple._ts
Type[] _ts
Definition: TypeTuple.java:13
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.node.CallNode.set_fdx
Node set_fdx(Node fun)
Definition: CallNode.java:132
com.cliffc.aa.node.NewNode._alias
int _alias
Definition: NewNode.java:20
com.cliffc.aa.type.TypeStr.STR
static final TypeStr STR
Definition: TypeStr.java:45
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
com.cliffc.aa.type.Bits.set
B set(int bit)
Definition: Bits.java:264
com.cliffc.aa.type.TypeMem.MEM
static final TypeMem MEM
Definition: TypeMem.java:224
com.cliffc.aa.Env.DEFMEM
static DefMemNode DEFMEM
Definition: Env.java:19
com.cliffc.aa.Env
Definition: Env.java:12
com.cliffc.aa.type.BitsAlias.STR
static final int STR
Definition: BitsAlias.java:25
com.cliffc.aa.GVNGCM.Mode.Parse
Parse
Definition: GVNGCM.java:15
com.cliffc.aa.node.ScopeNode.set_mem
Node set_mem(Node n)
Definition: ScopeNode.java:54
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.type.TypeMemPtr
Definition: TypeMemPtr.java:14
com.cliffc.aa.type.TypeFlt.FLT64
static final TypeFlt FLT64
Definition: TypeFlt.java:38
com.cliffc.aa.GVNGCM.Mode
Definition: GVNGCM.java:14
com.cliffc.aa.node.CallNode.value
Type value(GVNGCM.Mode opt_mode)
Definition: CallNode.java:421
com.cliffc.aa.type.TypeMemPtr.make
static TypeMemPtr make(BitsAlias aliases, TypeObj obj)
Definition: TypeMemPtr.java:66