Go to the documentation of this file. 1 package com.cliffc.aa.node;
8 import org.jetbrains.annotations.NotNull;
10 import java.util.Arrays;
11 import java.util.BitSet;
97 assert defs[DSP_IDX]==
null || defs[DSP_IDX]._val==
Type.
ALL || defs[DSP_IDX]._val==
Type.
ANY || defs[DSP_IDX]._val instanceof
TypeMemPtr;
98 assert defs.length > DSP_IDX+1;
163 if( !(tcall instanceof
TypeTuple) )
return null;
190 if( cc!=
null )
return set_def(0,cc);
194 assert
nargs()==ARG_IDX+1;
198 int alias = ((
TypeMemPtr)tadr)._aliases.abit();
199 if( alias == -1 )
throw unimpl();
211 remove(
_defs._len-1);
218 GVN.add_work_all(
unkeep());
225 if( !(tc instanceof
TypeTuple) )
return null;
235 for(
int i=ARG_IDX; i<
_defs._len; i++ )
254 if( fun !=
null && !fun.
is_dead() ) {
298 boolean dsp_nil=
true;
301 { dsp_nil=
false;
break; }
319 if( GVN._opt_mode._CG &&
err(
true)==
null ) {
320 Node progress =
null;
321 for(
int i=DSP_IDX; i<
nargs(); i++ )
325 if( progress !=
null )
return this;
353 if( cepim ==
null )
return null;
354 if( !(cepim.
_val instanceof
TypeMem) )
return null;
363 for(
int i=1; i<
mem.
_defs._len; i++ )
366 if( x!=
null )
return x;
375 int alias =
mem.nnn()._alias;
386 if( !escs2.
is_empty() && !esc_out.test_recur(alias) ) {
439 for(
int i=DSP_IDX; i<
nargs(); i++ )
461 ts[
_defs._len-1] = tfp;
479 return esc_out2.
meet(esc_in);
506 }
else if( chg ==
mem() ) {
519 if( !opt_mode._CG ) {
534 return super.
live(opt_mode);
565 int argn =
_defs.find(def);
586 for(
int i=DSP_IDX; i<
nargs(); i++ ) {
632 for(
int fidx : choices ) {
642 for(
int j=DSP_IDX; j<
nargs(); j++ ) {
644 Type formal = formals.
at(j);
645 if( actual==formal )
continue;
646 if(
Type.
ALL==formal )
continue;
648 if( cvt == -1 )
return null;
652 if( cvts < best_cvts ) {
655 best_formals = formals;
657 }
else if( cvts==best_cvts ) {
660 for(
int i=0; i<formals.
_ts.length; i++ ) {
661 Type ff = formals.
at(i), bf = best_formals.
at(i);
662 if( ff==bf )
continue;
665 else if( bf==mt ) fcnt++;
666 else { fcnt=bcnt=-1;
break; }
669 if( fcnt > 0 && bcnt==0 ) { best_fptr =
get_fptr(fun,unk); best_formals = formals; }
670 else if( fcnt==0 && bcnt > 0 ) {}
675 if( best_cvts >= 99 )
return null;
676 return tied ? null : best_fptr;
681 if( fptr !=
null )
return fptr;
696 for(
int j=ARG_IDX; j<
nargs(); j++ )
726 for(
int fidx :
fidxs ) {
728 if( fun==
null || fun.
is_dead() || fun.
ret()==null )
continue;
736 if( munr ==
null || munr.
_val==unr.
_val ) { munr = unr;
continue outer; }
744 for(
int j=ARG_IDX; j<
nargs(); j++ ) {
747 for(
int fidx :
fidxs ) {
748 if( fidx==0 )
continue;
749 for(
int kid=fidx; kid!=0; kid = tree.
next_kid(fidx,kid) ) {
751 if( fun==
null || fun.
is_dead() )
continue;
753 if( fun.
parm(j)==
null )
continue;
754 Type formal = formals.
at(j);
755 if( actual.
isa(formal) )
continue;
757 if( ts==
null ) ts =
new Ary<>(
new Type[1],0);
758 if( ts.
find(formal) == -1 )
778 @Override
public boolean equals(Object o) {
779 if(
this==o )
return true;
780 if( !super.equals(o) )
return false;
781 if( !(o instanceof
CallNode) )
return false;
TypeMem live_use_call(int dfidx)
CallNode copy(boolean copy_edges)
TypeTuple set(int idx, Type t)
static final Type NO_DISP
static final BitsFun EMPTY
static final TypeMem DEAD
E push(E e)
Add element in amortized constant time.
static TypeRPC make(BitsRPC rpcs)
Memory type; the state of all of memory; memory edges order memory ops.
static final TypeMem XMEM
static final TypeMemPtr OOP
void add_flow_uses(Node n)
BitsAlias get_alias(Type t)
static final Type XSCALAR
TypeMem live(GVNGCM.Mode opt_mode)
static final TypeFunPtr GENERIC_FUNPTR
static final TypeMem ESCAPE
Node add_work_all(Node n)
an implementation of language AA
static ErrMsg typerr(Parse loc, Type actual, Type t0mem, Type expected)
void add_flow_extra(Type old)
void revalive(Node... ns)
public< N extends Node > N keep()
static TypeFunPtr ttfpx(Type tcall)
static final TypeMem ALLMEM
boolean test_recur(int i)
static boolean test(long[] bits, int i)
static final byte OP_CALL
static final TypeMem ANYMEM
static int new_rpc(int par)
static final TypeMem LNO_DISP
static int def_idx(int fld)
public< N extends Node > N unkeep()
BitsAlias and_unused(BitsAlias escs)
static boolean is_parent(int idx)
static ErrMsg syntax(Parse loc, String msg)
Node _ideal_grow(MrgProjNode mem, ProjNode cepim, ProjNode cepid, BitsAlias escs, int i)
boolean _not_resolved_by_gcp
static ProjNode proj(Node head, int idx)
void add_flow_def_extra(Node chg)
static FunNode find_fidx(int fidx)
static BitsAlias esc_out(TypeMem tmem, Type trez)
static final TypeObj ISUSED
static TypeTuple make(boolean any, Type[] ts)
static final TypeMem ALIVE
Node insert(int idx, Node n)
FunPtrNode least_cost(BitsFun choices, Node unk)
static TypeMem emem(Type[] ts)
an implementation of language AA
void add_flow_use_extra(Node chg)
Node set_arg(int idx, Node arg)
static TypeFunPtr ttfp(Type tcall)
Node set_def(int idx, Node n)
static Type targ(Type[] ts, int x)
static final TypeTuple CALLE
public< N extends Node > N add_reduce(N n)
static Type tctl(Type tcall)
static int next_kid(int alias, int kid)
void add_flow_defs(Node n)
BitsAlias all_reaching_aliases(BitsAlias aliases)
static FunPtrNode get_fptr(FunNode fun, Node unk)
static ErrMsg unresolved(Parse loc, String msg)
String names(boolean debug)
Node swap_new(Node cepim, MrgProjNode mrg)
TypeMem live_use(GVNGCM.Mode opt_mode, Node def)
public< N extends Node > N add_flow(N n)
static Type targ(Type tcall, int x)
int find(E e)
Find the first matching element using ==, or -1 if none.
static TypeTuple set_ttfp(TypeTuple tcall, TypeFunPtr nfptr)
static ErrMsg forward_ref(Parse loc, FunPtrNode fun)
CallNode(boolean unpacked, Parse[] badargs, Node... defs)
static Node insert_split(Node tail1, BitsAlias head1_escs, Node head1, Node tail2, Node head2)
an implementation of language AA
TypeMem slice_reaching_aliases(BitsAlias aliases)
static TypeMem emem(Type tcall)
static TypeMemPtr tesc(Type tcall)
TypeFunPtr make_from(TypeMemPtr disp)
Type value(GVNGCM.Mode opt_mode)
static TypeMemPtr make(BitsAlias aliases, TypeObj obj)