aa
com.cliffc.aa.node.TestNode Class Reference
Collaboration diagram for com.cliffc.aa.node.TestNode:
[legend]

Public Member Functions

void testMonotonic ()
 
void testNode ()
 

Static Public Member Functions

static void main (String[] args)
 

Private Member Functions

Type get (long h)
 
Type get_value_type (long xx)
 
int[][] make_minimal_graph ()
 
int[][] make_subtypes ()
 
long pop ()
 
void print (int x, int d)
 
void push (long x)
 
Type put (long h, Type t)
 
void redo_ (Node n, int idx, int xidx, int yx, Type[] all)
 
void set_type (int idx, Type tyx)
 
void set_value_type (Node n, Type vn, long xx, long xxx, int idx, int yx, Type[] all)
 
int[] stx (final Node n, long xx, int i)
 
Type test1jig (final Node n, Type t0, Type t1, Type t2, Type t3)
 
void test1monotonic (Node n)
 
void test1monotonic_init (final Node n)
 
void test1monotonic_intrinsic (NewNode.NewPrimNode prim)
 
void test1monotonic_prim (PrimNode prim, Node mem)
 

Static Private Member Functions

static long hash (long h)
 
static long xx (int i0, int i1, int i2, int i3)
 
static int xx (long xx, int i)
 

Private Attributes

Type[] _alltypes
 
int _errs
 
GVNGCM _gvn
 
Node[] _ins
 
int[][] _min_subtypes
 
int[][] _subtypes
 
NonBlockingHashMapLong< Type_values
 
long[] _work = new long[1]
 
int _work_len
 

Static Private Attributes

static final int[] stx_any = new int[]{}
 

Detailed Description

Definition at line 16 of file TestNode.java.

Member Function Documentation

◆ get()

Type com.cliffc.aa.node.TestNode.get ( long  h)
private

Definition at line 45 of file TestNode.java.

45 { return _values.get(hash(h)); }

References com.cliffc.aa.node.TestNode._values, and com.cliffc.aa.node.TestNode.hash().

Here is the call graph for this function:

◆ get_value_type()

Type com.cliffc.aa.node.TestNode.get_value_type ( long  xx)
private

Definition at line 407 of file TestNode.java.

407  {
408  Type vt = get(xx);
409  assert vt!=null;
410  return vt;
411  }

References com.cliffc.aa.node.TestNode.xx().

Referenced by com.cliffc.aa.node.TestNode.test1monotonic_init().

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

◆ hash()

static long com.cliffc.aa.node.TestNode.hash ( long  h)
staticprivate

Definition at line 39 of file TestNode.java.

39  {
40  h ^= (h>>>20) ^ (h>>>12);
41  h ^= (h>>> 7) ^ (h>>> 4);
42  h += h<<7; // smear low bits up high, for hashcodes that only differ by 1
43  return h;
44  }

Referenced by com.cliffc.aa.node.TestNode.get(), and com.cliffc.aa.node.TestNode.put().

Here is the caller graph for this function:

◆ main()

static void com.cliffc.aa.node.TestNode.main ( String[]  args)
static

Definition at line 157 of file TestNode.java.

157 { new TestNode().testMonotonic(); }

References com.cliffc.aa.node.TestNode.testMonotonic().

Here is the call graph for this function:

◆ make_minimal_graph()

int [][] com.cliffc.aa.node.TestNode.make_minimal_graph ( )
private

Definition at line 87 of file TestNode.java.

87  {
88 
89  int[][] subs = new int[_subtypes.length][];
90  for( int i=0; i<subs.length; i++ )
91  subs[i] = _subtypes[i].clone();
92 
93  // For all types
94  for( int i=0; i<subs.length; i++ ) {
95  int[] subis = subs[i];
96  // For all 'i' subtypes
97  for( int j=0; j<subis.length && subis[j] != -1; j++ ) {
98  int[] subjs = subs[subis[j]];
99  // Pull out of subis all things found in subjs. We have a subtype isa
100  // path from i->j by design of _subtypes, and the j->k list in subjs.
101  // Remove any i->k as being redundant.
102  int ix = j+1, ixx = j+1; // Index to read, index to keep non-dups
103  int jx = 0; // Index to read the k's
104  while( ix<subis.length && jx<subjs.length ) {
105  int six = subis[ix];
106  int sjx = subjs[jx];
107  assert sjx != -1;
108  if( six==-1 ) break; // Hit end-of-array sentinel
109  if( six==sjx ) { ix++; jx++; } // i->j and j->sjx and i->sjx, skip both forward
110  else if( six < sjx ) subis[ixx++] = subis[ix++]; // Keep and advance
111  else jx++; // Advance
112  }
113  while( ixx < ix ) subis[ixx++] = -1; // Sentinel remaining unused elements
114  }
115  int ix = Util.find(subs[i],-1);
116  if( ix != -1 ) subs[i] = Arrays.copyOfRange(subs[i],0,ix); // Compress extra elements
117  }
118 
119  return subs;
120  }

References com.cliffc.aa.node.TestNode._subtypes, and com.cliffc.aa.util.Util.find().

Referenced by com.cliffc.aa.node.TestNode.testMonotonic().

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

◆ make_subtypes()

int [][] com.cliffc.aa.node.TestNode.make_subtypes ( )
private

Definition at line 63 of file TestNode.java.

63  {
64  // First simplify alltype ptrs - nodes can only produce and consume simple ptr types.
65  for( int i=0; i<_alltypes.length; i++ ) {
66  _alltypes[i] = _alltypes[i].simple_ptr();
67  assert i==0 || _alltypes[i] != _alltypes[i-1]; // Quick check for dups
68  }
69 
70  int[][] subs = new int[_alltypes.length][];
71  int[] tmp = new int[_alltypes.length];
72  for( int i=0; i<subs.length; i++ ) {
73  int len=0;
74  for( int j=0; j<subs.length; j++ )
75  if( i!=j && _alltypes[i].isa(_alltypes[j]) )
76  tmp[len++]=j; // isa numbers are sorted by increasing 'j'
77  subs[i] = Arrays.copyOfRange(tmp,0,len);
78  }
79  return subs;
80  }

References com.cliffc.aa.node.TestNode._alltypes, and com.cliffc.aa.type.Type< T extends Type< T >.simple_ptr().

Referenced by com.cliffc.aa.node.TestNode.testMonotonic().

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

◆ pop()

long com.cliffc.aa.node.TestNode.pop ( )
private

Definition at line 128 of file TestNode.java.

128 { return _work[--_work_len]; }

References com.cliffc.aa.node.TestNode._work, and com.cliffc.aa.node.TestNode._work_len.

Referenced by com.cliffc.aa.node.TestNode.test1monotonic_init().

Here is the caller graph for this function:

◆ print()

void com.cliffc.aa.node.TestNode.print ( int  x,
int  d 
)
private

Definition at line 131 of file TestNode.java.

131  {
132  Type dt = get(x);
133  if( dt==null ) {
134  put(x,dt=TypeInt.con(d));
135  int[] subs = _min_subtypes[x];
136  for( int sub : subs )
137  print(sub,d+1);
138  System.out.println("#"+x+" = "+_alltypes[x]+" "+d+" "+dt.getl());
139  } else if( d < dt.getl() ) {
140  put(x,TypeInt.con(d));
141  System.out.println("Shrink #"+x+" = "+_alltypes[x]+" "+d+" "+dt.getl());
142  }
143  }

References com.cliffc.aa.node.TestNode._alltypes, com.cliffc.aa.node.TestNode._min_subtypes, com.cliffc.aa.type.TypeInt.con(), com.cliffc.aa.type.Type< T extends Type< T >.getl(), and com.cliffc.aa.node.TestNode.put().

Here is the call graph for this function:

◆ push()

void com.cliffc.aa.node.TestNode.push ( long  x)
private

Definition at line 122 of file TestNode.java.

122  {
123  if( _work_len == _work.length )
124  _work = Arrays.copyOf(_work,_work_len<<1);
125  _work[_work_len++] = x;
126  }

References com.cliffc.aa.node.TestNode._work, and com.cliffc.aa.node.TestNode._work_len.

Referenced by com.cliffc.aa.node.TestNode.set_value_type(), and com.cliffc.aa.node.TestNode.test1monotonic_init().

Here is the caller graph for this function:

◆ put()

Type com.cliffc.aa.node.TestNode.put ( long  h,
Type  t 
)
private

Definition at line 46 of file TestNode.java.

46 { return _values.put(hash(h),t); }

References com.cliffc.aa.node.TestNode._values, and com.cliffc.aa.node.TestNode.hash().

Referenced by com.cliffc.aa.node.TestNode.print(), com.cliffc.aa.node.TestNode.set_value_type(), and com.cliffc.aa.node.TestNode.test1monotonic_init().

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

◆ redo_()

void com.cliffc.aa.node.TestNode.redo_ ( Node  n,
int  idx,
int  xidx,
int  yx,
Type[]  all 
)
private

Definition at line 384 of file TestNode.java.

384  {
385  set_type(idx,all[xidx]);
386  Type err_n = n.value(_gvn._opt_mode);
387 
388  set_type(idx,all[yx]);
389  Type err_m = n.value(_gvn._opt_mode);
390 
391  assert err_n.isa(err_m);
392  }

References com.cliffc.aa.node.TestNode._gvn, com.cliffc.aa.GVNGCM._opt_mode, com.cliffc.aa.type.Type< T extends Type< T >.isa(), com.cliffc.aa.node.TestNode.set_type(), and com.cliffc.aa.node.Node.value().

Referenced by com.cliffc.aa.node.TestNode.set_value_type().

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

◆ set_type()

void com.cliffc.aa.node.TestNode.set_type ( int  idx,
Type  tyx 
)
private

Definition at line 395 of file TestNode.java.

395  {
396  if( idx > 0 ) ((ConNode)_ins[idx])._t = tyx;
397  _ins[idx]._val = tyx;
398  }

References com.cliffc.aa.node.TestNode._ins, and com.cliffc.aa.node.Node._val.

Referenced by com.cliffc.aa.node.TestNode.redo_(), com.cliffc.aa.node.TestNode.set_value_type(), com.cliffc.aa.node.TestNode.test1monotonic_init(), and com.cliffc.aa.node.TestNode.testMonotonic().

Here is the caller graph for this function:

◆ set_value_type()

void com.cliffc.aa.node.TestNode.set_value_type ( Node  n,
Type  vn,
long  xx,
long  xxx,
int  idx,
int  yx,
Type[]  all 
)
private

Definition at line 363 of file TestNode.java.

363  {
364  Type vm = get(xxx);
365  if( vm == null ) {
366  set_type(idx,all[yx]);
367  vm = n.value(_gvn._opt_mode);
368  Type old = put(xxx,vm);
369  assert old==null;
370  push(xxx); // Now visit all children
371  }
372  // The major monotonicity assert
373  int x1 = xx(xx,1);
374  int y1 = idx==1 ? yx : x1;
375  if( vn!= vm && !vn.isa(vm) ) {
376  int x0 = xx(xx,0), x2 = xx(xx,2), x3 = xx(xx,3);
377  System.out.println(n.xstr()+"("+all[x0]+","+all[x1]+","+all[x2]+","+all[x3]+") = "+vn);
378  System.out.println(n.xstr()+"("+all[idx==0?yx:x0]+","+all[idx==1?yx:x1]+","+all[idx==2?yx:x2]+","+all[idx==3?yx:x3]+") = "+vm);
379  _errs++;
380  redo_(n,idx, xx(xx,idx),yx,all);
381  }
382  }

References com.cliffc.aa.node.TestNode._errs, com.cliffc.aa.node.TestNode._gvn, com.cliffc.aa.GVNGCM._opt_mode, com.cliffc.aa.type.Type< T extends Type< T >.isa(), com.cliffc.aa.node.TestNode.push(), com.cliffc.aa.node.TestNode.put(), com.cliffc.aa.node.TestNode.redo_(), com.cliffc.aa.node.TestNode.set_type(), com.cliffc.aa.node.Node.value(), com.cliffc.aa.node.Node.xstr(), and com.cliffc.aa.node.TestNode.xx().

Referenced by com.cliffc.aa.node.TestNode.test1monotonic_init().

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

◆ stx()

int [] com.cliffc.aa.node.TestNode.stx ( final Node  n,
long  xx,
int  i 
)
private

Definition at line 401 of file TestNode.java.

401  {
402  if( i >= n._defs._len || n.in(i) == null ) return stx_any;
403  return _min_subtypes[xx(xx,i)];
404  }

References com.cliffc.aa.node.Node._defs, com.cliffc.aa.node.TestNode._min_subtypes, com.cliffc.aa.node.Node.in(), com.cliffc.aa.node.TestNode.stx_any, and com.cliffc.aa.node.TestNode.xx().

Referenced by com.cliffc.aa.node.TestNode.test1monotonic_init().

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

◆ test1jig()

Type com.cliffc.aa.node.TestNode.test1jig ( final Node  n,
Type  t0,
Type  t1,
Type  t2,
Type  t3 
)
private

Definition at line 271 of file TestNode.java.

271  {
272  // Prep graph edges
273  _ins[0]._val = t0;
274  _ins[1]._val = ((ConNode)_ins[1])._t = t1;
275  _ins[2]._val = ((ConNode)_ins[2])._t = t2;
276  _ins[3]._val = ((ConNode)_ins[3])._t = t3;
277  return n.value(_gvn._opt_mode);
278  }

References com.cliffc.aa.node.TestNode._gvn, com.cliffc.aa.node.TestNode._ins, com.cliffc.aa.GVNGCM._opt_mode, and com.cliffc.aa.node.Node._val.

Referenced by com.cliffc.aa.node.TestNode.testMonotonic().

Here is the caller graph for this function:

◆ test1monotonic()

void com.cliffc.aa.node.TestNode.test1monotonic ( Node  n)
private

Definition at line 280 of file TestNode.java.

280  {
281  assert n._defs._len>0;
283  }

References com.cliffc.aa.node.Node._defs, and com.cliffc.aa.node.TestNode.test1monotonic_init().

Referenced by com.cliffc.aa.node.TestNode.testMonotonic().

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

◆ test1monotonic_init()

void com.cliffc.aa.node.TestNode.test1monotonic_init ( final Node  n)
private

Definition at line 309 of file TestNode.java.

309  {
310  System.out.println(n.xstr());
311  _values.clear(true);
312 
313  put(0,Type.ANY); // First args are all ANY, so is result
314  push(0); // Init worklist
315 
316  Type[] all = _alltypes;
317  long t0 = System.currentTimeMillis(), t2=t0;
318  long nprobes = 0, nprobes1=0;
319  while( _work_len > 0 ) {
320  long xx = pop();
321  Type vn = get_value_type(xx);
322  int x0 = xx(xx,0), x1 = xx(xx,1), x2 = xx(xx,2), x3 = xx(xx,3);
323  // Prep graph edges
324  _ins[0]._val = all[x0];
325  _ins[1]._val = ((ConNode)_ins[1])._t = all[x1];
326  _ins[2]._val = ((ConNode)_ins[2])._t = all[x2];
327  _ins[3]._val = ((ConNode)_ins[3])._t = all[x3];
328 
329  // Subtypes in 4 node input directions
330  int[] stx0 = stx(n,xx,0);
331  for( int y0 : stx0 )
332  set_value_type(n, vn, xx, xx(y0,x1,x2,x3), 0, y0, all );
333  set_type(0,all[x0]);
334 
335  int[] stx1 = stx(n,xx,1);
336  for( int y1 : stx1 )
337  set_value_type(n, vn, xx, xx(x0,y1,x2,x3), 1, y1, all );
338  set_type(1,all[x1]);
339 
340  int[] stx2 = stx(n,xx,2);
341  for( int y2 : stx2 )
342  set_value_type(n, vn, xx, xx(x0,x1,y2,x3), 2, y2, all );
343  set_type(2,all[x2]);
344 
345  int[] stx3 = stx(n,xx,3);
346  for( int y3 : stx3 )
347  set_value_type(n, vn, xx, xx(x0,x1,x2,y3), 3, y3, all );
348  set_type(3,all[x3]);
349 
350  nprobes1 += stx0.length+stx1.length+stx2.length+stx3.length;
351  long t1 = System.currentTimeMillis();
352  if( t1-t0 >= 1000 ) {
353  nprobes += nprobes1;
354  System.out.println("Did "+nprobes1+" in "+(t1-t0)+"msecs, worklist has "+_work_len+" states, total probes "+nprobes+", values="+_values.size());
355  nprobes1=0;
356  t0=t1;
357  }
358  }
359  nprobes += nprobes1;
360  System.out.println("Total probes "+nprobes+" in "+(t0-t2)+"msecs, values="+_values.size());
361  }

References com.cliffc.aa.node.TestNode._alltypes, com.cliffc.aa.node.TestNode._ins, com.cliffc.aa.node.Node._val, com.cliffc.aa.node.TestNode._values, com.cliffc.aa.node.TestNode._work_len, com.cliffc.aa.type.Type< T extends Type< T >.ANY, com.cliffc.aa.node.TestNode.get_value_type(), com.cliffc.aa.node.TestNode.pop(), com.cliffc.aa.node.TestNode.push(), com.cliffc.aa.node.TestNode.put(), com.cliffc.aa.node.TestNode.set_type(), com.cliffc.aa.node.TestNode.set_value_type(), com.cliffc.aa.node.TestNode.stx(), and com.cliffc.aa.node.TestNode.xx().

Referenced by com.cliffc.aa.node.TestNode.test1monotonic(), com.cliffc.aa.node.TestNode.test1monotonic_intrinsic(), and com.cliffc.aa.node.TestNode.test1monotonic_prim().

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

◆ test1monotonic_intrinsic()

void com.cliffc.aa.node.TestNode.test1monotonic_intrinsic ( NewNode.NewPrimNode  prim)
private

Definition at line 297 of file TestNode.java.

297  {
298  NewNode.NewPrimNode n = (NewNode.NewPrimNode)prim.copy(false);
299  assert n._defs._len==0;
300  n.add_def( null );
301  n.add_def(_ins[1]); // memory
302  n.add_def(null); // display
303  n.add_def(_ins[2]); // arg#1
304  if( n._sig.nargs() >= 2 ) n.add_def(_ins[3]);
306  }

References com.cliffc.aa.node.Node._defs, com.cliffc.aa.node.TestNode._ins, com.cliffc.aa.node.NewNode< T extends TypeObj< T >.copy(), and com.cliffc.aa.node.TestNode.test1monotonic_init().

Referenced by com.cliffc.aa.node.TestNode.testMonotonic().

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

◆ test1monotonic_prim()

void com.cliffc.aa.node.TestNode.test1monotonic_prim ( PrimNode  prim,
Node  mem 
)
private

Definition at line 286 of file TestNode.java.

286  {
287  PrimNode n = (PrimNode)prim.copy(false);
288  assert n._defs._len==0;
289  n.add_def( null );
290  n.add_def(_ins[n._defs._len]);
291  if( n instanceof MemPrimNode ) n.add_def(mem);
292  if( n._sig.nargs() >= 3 ) n.add_def(_ins[n._defs._len-1]);
293  if( n._sig.nargs() >= 4 ) n.add_def(_ins[n._defs._len-1]);
295  }

References com.cliffc.aa.node.Node._defs, com.cliffc.aa.node.TestNode._ins, com.cliffc.aa.node.PrimNode._sig, com.cliffc.aa.node.Node.add_def(), com.cliffc.aa.node.Node.copy(), com.cliffc.aa.type.TypeFunSig.nargs(), and com.cliffc.aa.node.TestNode.test1monotonic_init().

Referenced by com.cliffc.aa.node.TestNode.testMonotonic().

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

◆ testMonotonic()

void com.cliffc.aa.node.TestNode.testMonotonic ( )

Definition at line 159 of file TestNode.java.

159  {
160  Env top = Env.top_scope();
161  Env.file_scope(top);
162  assert _errs == 0; // Start with no errors
163 
164  // Types we are testing
165  _alltypes = Type.ALL_TYPES().asAry();
166  // A subset used to help diagnose this algorithm.
167  //Type[] ts = new Type[] {
168  // Type.ALL,Type.ANY,Type.CTRL,Type.XCTRL, Type.SCALAR, Type.XSCALAR, Type.NSCALR, Type.XNSCALR,
169  // Type.NUM, Type.XNUM, Type.NIL
170  //};
171  //for( int i=0; i<ts.length; i++ )
172  // for( int j=i+1; j<ts.length; j++ )
173  // if( ts[j].isa(ts[i]) ) { Type tmp = ts[i]; ts[i] = ts[j]; ts[j] = tmp; }
174  //_alltypes = ts;
175 
176  // All The Types we care to reason about. There's an infinite number of
177  // Types, but mostly are extremely similar - so we limit ourselves to a
178  // subset which has at least one of unique subtype, plus some variations
179  // inside the more complex Types.
181 
182  // Build a minimal spanning sub-Type tree from the set of sample types.
183  // We'll use this to know which other types sub-Type this type... and thus be
184  // more efficient in testing all Types which subtype another Type.
186 
187  // Per-node-type cached value() results
188  _values = new NonBlockingHashMapLong<Type>(128*1024*1024,false);
189 
190  // Print the types and subtypes in a RPO
191  //print(0,0);
192  //_values.clear(true);
193 
194  // Setup to compute a value() call: we need a tiny chunk of Node graph with
195  // known inputs.
196  _gvn = Env.GVN;
197  _ins = new Node[4];
198  _ins[0] = new RegionNode(null,new ConNode<>(Type.CTRL),new ConNode<>(Type.CTRL));
199  for( int i=1; i<_ins.length; i++ )
200  _ins[i] = new ConNode<>(Type.SCALAR);
201  Node mem = new ConNode<Type>(TypeMem.MEM);
202  mem._val = TypeMem.MEM;
203  FunNode fun_forward_ref = new FunNode("some_fcn");
204  Env.DEFMEM._val = TypeMem.MEM;
205 
206  Node unr = top.lookup("+"); // All the "+" functions
207  FunNode fun_plus = ((FunPtrNode)unr.in(1)).fun();
208  RetNode ret = fun_plus.ret();
209  CallNode call = new CallNode(false,null,_ins[0],unr,mem);
210  call._val = TypeTuple.CALLE;
211  TypeStruct tname = TypeStruct.NAMEPT;
212 
213  // Testing 1 set of types into a value call.
214  // Comment out when not debugging.
215  CallEpiNode cepi = new CallEpiNode(call,Env.DEFMEM,_ins[2]);
217 
218  // All the Nodes, all Values, all Types
219  test1monotonic(new CallNode(false,null,_ins[0], unr ,mem,_ins[2],_ins[3]));
220  test1monotonic(new CallNode(false,null,_ins[0],_ins[1],mem,_ins[2],_ins[3]));
221  test1monotonic(new CallEpiNode(call,Env.DEFMEM,_ins[2])); // CallNode, then some count of RetNode, not flowing
222  test1monotonic(new ConNode<Type>( TypeInt.FALSE));
223  test1monotonic(new ConNode<Type>( TypeStr.ABC ));
224  test1monotonic(new ConNode<Type>( TypeFlt.FLT64));
225  // Cannot cast-to-NIL - can only move away from NIL
226  //test1monotonic(new CastNode(_ins[0],_ins[1],TypeInt.FALSE));
227  test1monotonic(new CastNode(_ins[0],_ins[1],Type.NSCALR));
228  test1monotonic(new CastNode(_ins[0],_ins[1],TypeFlt.FLT64));
229  test1monotonic(new CastNode(_ins[0],_ins[1],TypeMemPtr.STRPTR));
230  test1monotonic(new CastNode(_ins[0],_ins[1],TypeMemPtr.STR0));
231  test1monotonic(new CProjNode(_ins[0],0));
232  test1monotonic(new ErrNode(_ins[0],null,"\nerr\n"));
233  test1monotonic(new FunNode(new String[]{"^","x"},new Type[]{TypeMemPtr.DISP_SIMPLE,TypeInt.INT64}));
234  test1monotonic(new FunPtrNode("anon",ret,null));
235  test1monotonic(new FP2DispNode(_ins[1])); // Only takes in a TFP
236  test1monotonic(new IfNode(_ins[0],_ins[1]));
237  for( NewNode.NewPrimNode prim : NewNode.NewPrimNode.INTRINSICS() )
239  test1monotonic(new IntrinsicNode(tname,null,null,mem,_ins[2]));
240  test1monotonic(new LoadNode(_ins[1],_ins[2],"x",null));
241  NewObjNode nnn1 = new NewObjNode(false,TypeMemPtr.DISPLAY,Node.con(Type.NIL));
242  set_type(1,Type.SCALAR); nnn1.create_active("x",_ins[1],Access.Final);
243  set_type(2,Type.SCALAR); nnn1.create_active("y",_ins[2],Access.Final);
244  test1monotonic(nnn1);
245  NewObjNode nnn2 = new NewObjNode(false,TypeMemPtr.DISPLAY,Node.con(Type.NIL));
246  set_type(1,Type.SCALAR); nnn2.create_active("x",_ins[1],Access.Final);
247  set_type(2,Type.SCALAR); nnn2.create_active("y",_ins[2],Access.Final);
248  nnn2.sets(tname);
249  test1monotonic(nnn2);
250  ((ConNode<Type>)_ins[1])._t = Type.SCALAR; // ParmNode reads this for _alltype
251  test1monotonic(new ParmNode( 1, "x",_ins[0],(ConNode)_ins[1],null).add_def(_ins[2]));
252  test1monotonic(new PhiNode(Type.SCALAR,null,_ins[0],_ins[1],_ins[2]));
253  for( PrimNode prim : PrimNode.PRIMS() )
254  test1monotonic_prim(prim,mem);
255  test1monotonic(new ProjNode(1, _ins[0]));
256  test1monotonic(new RegionNode(null,_ins[1],_ins[2]));
257  test1monotonic(new RetNode(_ins[0],mem,_ins[1],_ins[2],fun_plus)); // ctl,mem,val,rpc,fun
258  test1monotonic(new StoreNode(_ins[1],_ins[2],_ins[3],Access.RW ,"x",null));
259  test1monotonic(new StoreNode(_ins[1],_ins[2],_ins[3],Access.Final,"x",null));
260  // ScopeNode has no inputs, and value() call is monotonic
261  test1monotonic(new AssertNode(_ins[1],_ins[2],TypeInt.FALSE ,null, null));
262  test1monotonic(new AssertNode(_ins[1],_ins[2],TypeMemPtr.STRPTR,null, null));
263  test1monotonic(new AssertNode(_ins[1],_ins[2],TypeFlt.FLT64 ,null, null));
264  _gvn._opt_mode=GVNGCM.Mode.PesiNoCG; test1monotonic(new UnresolvedNode(null,_ins[1],_ins[2])); _gvn._opt_mode=GVNGCM.Mode.Parse;
265  _gvn._opt_mode=GVNGCM.Mode.PesiCG ; test1monotonic(new UnresolvedNode(null,_ins[1],_ins[2])); _gvn._opt_mode=GVNGCM.Mode.Parse;
266 
267  assertEquals(0,_errs);
268  }

References com.cliffc.aa.node.TestNode._alltypes, com.cliffc.aa.node.TestNode._errs, com.cliffc.aa.node.TestNode._gvn, com.cliffc.aa.node.TestNode._ins, com.cliffc.aa.node.TestNode._min_subtypes, com.cliffc.aa.GVNGCM._opt_mode, com.cliffc.aa.node.TestNode._subtypes, com.cliffc.aa.node.Node._val, com.cliffc.aa.node.TestNode._values, com.cliffc.aa.type.TypeStr.ABC, com.cliffc.aa.type.Type< T extends Type< T >.ALL_TYPES, com.cliffc.aa.type.Type< T extends Type< T >.ANY, com.cliffc.aa.type.TypeTuple.CALLE, com.cliffc.aa.node.Node.con(), com.cliffc.aa.node.NewObjNode.create_active(), com.cliffc.aa.type.Type< T extends Type< T >.CTRL, com.cliffc.aa.Env.DEFMEM, com.cliffc.aa.type.TypeMemPtr.DISP_SIMPLE, com.cliffc.aa.type.TypeMemPtr.DISPLAY, com.cliffc.aa.type.TypeInt.FALSE, com.cliffc.aa.Env.file_scope(), com.cliffc.aa.type.TypeFld.Access.Final, com.cliffc.aa.type.TypeFlt.FLT64, com.cliffc.aa.Env.GVN, com.cliffc.aa.node.Node.in(), com.cliffc.aa.type.TypeInt.INT64, com.cliffc.aa.node.NewNode< T extends TypeObj< T >.NewPrimNode< T extends TypeObj< T >.INTRINSICS, com.cliffc.aa.Env.lookup(), com.cliffc.aa.node.TestNode.make_minimal_graph(), com.cliffc.aa.node.TestNode.make_subtypes(), com.cliffc.aa.type.TypeMem.MEM, com.cliffc.aa.type.TypeStruct.NAMEPT, com.cliffc.aa.type.Type< T extends Type< T >.NIL, com.cliffc.aa.type.Type< T extends Type< T >.NSCALR, com.cliffc.aa.GVNGCM.Mode.Parse, com.cliffc.aa.GVNGCM.Mode.PesiCG, com.cliffc.aa.GVNGCM.Mode.PesiNoCG, com.cliffc.aa.node.PrimNode.PRIMS, com.cliffc.aa.type.TypeTuple.RET, com.cliffc.aa.node.FunNode.ret(), com.cliffc.aa.type.TypeFld.Access.RW, com.cliffc.aa.type.Type< T extends Type< T >.SCALAR, com.cliffc.aa.node.TestNode.set_type(), com.cliffc.aa.node.NewNode< T extends TypeObj< T >.sets(), com.cliffc.aa.type.TypeMemPtr.STR0, com.cliffc.aa.type.TypeMemPtr.STRPTR, com.cliffc.aa.type.TypeTuple.TEST0, com.cliffc.aa.node.TestNode.test1jig(), com.cliffc.aa.node.TestNode.test1monotonic(), com.cliffc.aa.node.TestNode.test1monotonic_intrinsic(), com.cliffc.aa.node.TestNode.test1monotonic_prim(), and com.cliffc.aa.Env.top_scope().

Referenced by com.cliffc.aa.node.TestNode.main().

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

◆ testNode()

void com.cliffc.aa.node.TestNode.testNode ( )

Definition at line 55 of file TestNode.java.

55  {
57  }

References com.cliffc.aa.Env.file_scope(), and com.cliffc.aa.Env.top_scope().

Here is the call graph for this function:

◆ xx() [1/2]

static long com.cliffc.aa.node.TestNode.xx ( int  i0,
int  i1,
int  i2,
int  i3 
)
staticprivate

Definition at line 413 of file TestNode.java.

413  {
414  return i0+(i1<<8)+(i2<<16)+(i3<<24);
415  }

Referenced by com.cliffc.aa.node.TestNode.get_value_type(), com.cliffc.aa.node.TestNode.set_value_type(), com.cliffc.aa.node.TestNode.stx(), com.cliffc.aa.node.TestNode.test1monotonic_init(), and com.cliffc.aa.node.TestNode.xx().

Here is the caller graph for this function:

◆ xx() [2/2]

static int com.cliffc.aa.node.TestNode.xx ( long  xx,
int  i 
)
staticprivate

Definition at line 416 of file TestNode.java.

416 { return (int)((xx>>(i<<3)) & 0xffL); }

References com.cliffc.aa.node.TestNode.xx().

Here is the call graph for this function:

Member Data Documentation

◆ _alltypes

◆ _errs

int com.cliffc.aa.node.TestNode._errs
private

◆ _gvn

◆ _ins

◆ _min_subtypes

int [][] com.cliffc.aa.node.TestNode._min_subtypes
private

◆ _subtypes

int [][] com.cliffc.aa.node.TestNode._subtypes
private

◆ _values

◆ _work

long [] com.cliffc.aa.node.TestNode._work = new long[1]
private

◆ _work_len

int com.cliffc.aa.node.TestNode._work_len
private

◆ stx_any

final int [] com.cliffc.aa.node.TestNode.stx_any = new int[]{}
staticprivate

Definition at line 400 of file TestNode.java.

Referenced by com.cliffc.aa.node.TestNode.stx().


The documentation for this class was generated from the following file:
com.cliffc.aa.node.TestNode.xx
static long xx(int i0, int i1, int i2, int i3)
Definition: TestNode.java:413
com.cliffc.aa.type.Type.NSCALR
static final Type NSCALR
Definition: Type.java:330
com.cliffc.aa.node.TestNode.make_minimal_graph
int[][] make_minimal_graph()
Definition: TestNode.java:87
com.cliffc.aa.type.TypeFld.Access.Final
Final
Definition: TypeFld.java:112
com.cliffc.aa.node.TestNode.test1monotonic_intrinsic
void test1monotonic_intrinsic(NewNode.NewPrimNode prim)
Definition: TestNode.java:297
com.cliffc.aa.node.TestNode.get_value_type
Type get_value_type(long xx)
Definition: TestNode.java:407
com.cliffc.aa.node.TestNode.redo_
void redo_(Node n, int idx, int xidx, int yx, Type[] all)
Definition: TestNode.java:384
com.cliffc.aa.node.PrimNode
Definition: PrimNode.java:20
com.cliffc.aa.type.Type.isa
boolean isa(Type t)
Definition: Type.java:623
com.cliffc.aa.util.Util.find
static int find(int[] es, int e)
Definition: Util.java:6
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.type.Type.SCALAR
static final Type SCALAR
Definition: Type.java:328
com.cliffc.aa.node.TestNode.test1jig
Type test1jig(final Node n, Type t0, Type t1, Type t2, Type t3)
Definition: TestNode.java:271
com.cliffc.aa.Env.top_scope
static Env top_scope()
Definition: Env.java:72
com.cliffc.aa.type.TypeInt
Definition: TypeInt.java:9
com.cliffc.aa.node.TestNode.set_value_type
void set_value_type(Node n, Type vn, long xx, long xxx, int idx, int yx, Type[] all)
Definition: TestNode.java:363
com.cliffc.aa.type.Type
an implementation of language AA
Definition: Type.java:94
com.cliffc.aa.type.TypeFlt
Definition: TypeFlt.java:9
com.cliffc.aa.type.TypeTuple
Definition: TypeTuple.java:11
com.cliffc.aa.type.TypeFld.Access.RW
RW
Definition: TypeFld.java:111
com.cliffc.aa.type.TypeInt.con
static TypeInt con(long con)
Definition: TypeInt.java:37
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.TestNode._subtypes
int[][] _subtypes
Definition: TestNode.java:29
com.cliffc.aa.node.Node.add_def
Node add_def(Node n)
Definition: Node.java:152
com.cliffc.aa.type.TypeStruct
A memory-based collection of optionally named fields.
Definition: TypeStruct.java:50
com.cliffc.aa.node.TestNode.print
void print(int x, int d)
Definition: TestNode.java:131
com.cliffc.aa.Env.lookup
Node lookup(String name)
Definition: Env.java:186
com.cliffc.aa.type.Type.ALL_TYPES
static Ary< Type > ALL_TYPES
Definition: Type.java:650
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.TypeFunSig.nargs
int nargs()
Definition: TypeFunSig.java:87
com.cliffc.aa.type.TypeMemPtr.DISP_SIMPLE
static final TypeMemPtr DISP_SIMPLE
Definition: TypeMemPtr.java:105
com.cliffc.aa.type.TypeMemPtr.STR0
static final TypeMemPtr STR0
Definition: TypeMemPtr.java:98
com.cliffc.aa.node.TestNode.put
Type put(long h, Type t)
Definition: TestNode.java:46
com.cliffc.aa.node.PrimNode._sig
final TypeFunSig _sig
Definition: PrimNode.java:22
com.cliffc.aa.type.TypeTuple.RET
static final TypeTuple RET
Definition: TypeTuple.java:130
com.cliffc.aa.type.TypeMemPtr.DISPLAY
static final TypeStruct DISPLAY
Definition: TypeMemPtr.java:78
com.cliffc.aa.node.PrimNode.PRIMS
static PrimNode[] PRIMS
Definition: PrimNode.java:36
com.cliffc.aa.node.TestNode.test1monotonic
void test1monotonic(Node n)
Definition: TestNode.java:280
com.cliffc.aa.type.TypeStr.ABC
static final TypeStr ABC
Definition: TypeStr.java:47
com.cliffc.aa.util.Util
Definition: Util.java:5
com.cliffc.aa.type.Type.CTRL
static final Type CTRL
Definition: Type.java:326
com.cliffc.aa.node.TestNode.test1monotonic_prim
void test1monotonic_prim(PrimNode prim, Node mem)
Definition: TestNode.java:286
com.cliffc.aa.node.TestNode.test1monotonic_init
void test1monotonic_init(final Node n)
Definition: TestNode.java:309
com.cliffc.aa.node.TestNode._work_len
int _work_len
Definition: TestNode.java:50
com.cliffc.aa.node.TestNode.make_subtypes
int[][] make_subtypes()
Definition: TestNode.java:63
com.cliffc.aa.node.TestNode.push
void push(long x)
Definition: TestNode.java:122
com.cliffc.aa.node.TestNode.set_type
void set_type(int idx, Type tyx)
Definition: TestNode.java:395
com.cliffc.aa.Env.file_scope
static Env file_scope(Env top_scope)
Definition: Env.java:116
com.cliffc.aa.type.Type.simple_ptr
Type simple_ptr()
Definition: Type.java:358
com.cliffc.aa.node.TestNode.stx
int[] stx(final Node n, long xx, int i)
Definition: TestNode.java:401
com.cliffc.aa.type.TypeStr
Definition: TypeStr.java:14
com.cliffc.aa.GVNGCM.Mode.Mode
Mode(boolean CG)
Definition: GVNGCM.java:20
com.cliffc.aa.type.Type.NIL
static final Type NIL
Definition: Type.java:332
com.cliffc.aa.node.TestNode._min_subtypes
int[][] _min_subtypes
Definition: TestNode.java:36
com.cliffc.aa.node.TestNode._ins
Node[] _ins
Definition: TestNode.java:19
com.cliffc.aa.node.Node.copy
Node copy(boolean copy_edges)
Definition: Node.java:264
com.cliffc.aa.type.TypeInt.FALSE
static final Type FALSE
Definition: TypeInt.java:45
com.cliffc.aa.type.TypeTuple.CALLE
static final TypeTuple CALLE
Definition: TypeTuple.java:131
com.cliffc.aa.GVNGCM._opt_mode
Mode _opt_mode
Definition: GVNGCM.java:22
com.cliffc.aa.node.TestNode.hash
static long hash(long h)
Definition: TestNode.java:39
com.cliffc.aa.type.TypeFld.Access
Definition: TypeFld.java:109
com.cliffc.aa.type.TypeMemPtr.STRPTR
static final TypeMemPtr STRPTR
Definition: TypeMemPtr.java:97
com.cliffc.aa.node.TestNode.stx_any
static final int[] stx_any
Definition: TestNode.java:400
com.cliffc.aa.node.FunNode
Definition: FunNode.java:58
com.cliffc.aa.type.Type.getl
long getl()
Definition: Type.java:802
com.cliffc.aa.type.TypeStruct.NAMEPT
static final TypeStruct NAMEPT
Definition: TypeStruct.java:232
com.cliffc.aa.node.TestNode._alltypes
Type[] _alltypes
Definition: TestNode.java:24
com.cliffc.aa.type.TypeMem.MEM
static final TypeMem MEM
Definition: TypeMem.java:224
com.cliffc.aa.node.TestNode._gvn
GVNGCM _gvn
Definition: TestNode.java:21
com.cliffc.aa.Env.DEFMEM
static DefMemNode DEFMEM
Definition: Env.java:19
com.cliffc.aa.Env
Definition: Env.java:12
com.cliffc.aa.node.TestNode.pop
long pop()
Definition: TestNode.java:128
com.cliffc.aa.node.TestNode._work
long[] _work
Definition: TestNode.java:49
com.cliffc.aa.node.Node._defs
Ary< Node > _defs
Definition: Node.java:124
com.cliffc.aa.type.TypeMemPtr
Definition: TypeMemPtr.java:14
com.cliffc.aa.node.FunNode.ret
RetNode ret()
Definition: FunNode.java:900
com.cliffc.aa.type.TypeFlt.FLT64
static final TypeFlt FLT64
Definition: TypeFlt.java:38
com.cliffc.aa.node.TestNode._values
NonBlockingHashMapLong< Type > _values
Definition: TestNode.java:38
com.cliffc.aa.node.TestNode._errs
int _errs
Definition: TestNode.java:52
com.cliffc.aa.type.TypeTuple.TEST0
static final TypeTuple TEST0
Definition: TypeTuple.java:132