/home/travis/build/MoarVM/MoarVM/src/spesh/facts.h
Line | Count | Source |
1 | | /* Facts we might have about a local. */ |
2 | | struct MVMSpeshFacts { |
3 | | /* Flags indicating things we know. */ |
4 | | MVMint32 flags; |
5 | | |
6 | | /* The number of usages it has. */ |
7 | | MVMint32 usages; |
8 | | |
9 | | /* Known type, if any. */ |
10 | | MVMObject *type; |
11 | | |
12 | | /* Known type post-decontainerization, if any. */ |
13 | | MVMObject *decont_type; |
14 | | |
15 | | /* Known value, if any. */ |
16 | | union { |
17 | | MVMObject *o; |
18 | | MVMint64 i; |
19 | | MVMnum64 n; |
20 | | MVMString *s; |
21 | | } value; |
22 | | |
23 | | /* The instruction that writes the register (noting we're in SSA form, so |
24 | | * this is unique). */ |
25 | | MVMSpeshIns *writer; |
26 | | |
27 | | /* The deoptimization index in effect at the point of declaration, or -1 |
28 | | * if none yet. */ |
29 | | MVMint32 deopt_idx; |
30 | | |
31 | | /* The log guard the facts depend on, if any. */ |
32 | | MVMuint32 log_guard; |
33 | | |
34 | | /* Has the instruction that wrote this value been deleted? */ |
35 | | MVMuint32 dead_writer; |
36 | | }; |
37 | | |
38 | | /* Various fact flags. */ |
39 | 564k | #define MVM_SPESH_FACT_KNOWN_TYPE 1 /* Has a known type. */ |
40 | 312k | #define MVM_SPESH_FACT_KNOWN_VALUE 2 /* Has a known value. */ |
41 | 529k | #define MVM_SPESH_FACT_DECONTED 4 /* Know it's decontainerized. */ |
42 | 187k | #define MVM_SPESH_FACT_CONCRETE 8 /* Know it's a concrete object. */ |
43 | 235k | #define MVM_SPESH_FACT_TYPEOBJ 16 /* Know it's a type object. */ |
44 | 320k | #define MVM_SPESH_FACT_KNOWN_DECONT_TYPE 32 /* Has a known type after decont. */ |
45 | 320k | #define MVM_SPESH_FACT_DECONT_CONCRETE 64 /* Is concrete after decont. */ |
46 | 320k | #define MVM_SPESH_FACT_DECONT_TYPEOBJ 128 /* Is a type object after decont. */ |
47 | 17.8M | #define MVM_SPESH_FACT_FROM_LOG_GUARD 256 /* Depends on a guard being met. */ |
48 | 340 | #define MVM_SPESH_FACT_HASH_ITER 512 /* Is an iter over hashes. */ |
49 | 527 | #define MVM_SPESH_FACT_ARRAY_ITER 1024 /* Is an iter over arrays |
50 | | (mutually exclusive with HASH_ITER, but neither of them is necessarily set) */ |
51 | 8.08k | #define MVM_SPESH_FACT_KNOWN_BOX_SRC 2048 /* We know what register this value was boxed from */ |
52 | 485k | #define MVM_SPESH_FACT_MERGED_WITH_LOG_GUARD 4096 /* These facts were merged at a PHI node, but at least one of the incoming facts had a "from log guard" flag set, so we'll have to look for that fact and increment its uses if we use this here fact. */ |
53 | 36.6k | #define MVM_SPESH_FACT_RW_CONT 8192 /* Known to be an rw container */ |
54 | | |
55 | | void MVM_spesh_facts_discover(MVMThreadContext *tc, MVMSpeshGraph *g, MVMSpeshPlanned *p); |
56 | | void MVM_spesh_facts_depend(MVMThreadContext *tc, MVMSpeshGraph *g, |
57 | | MVMSpeshFacts *target, MVMSpeshFacts *source); |
58 | | void MVM_spesh_facts_object_facts(MVMThreadContext *tc, MVMSpeshGraph *g, |
59 | | MVMSpeshOperand tgt, MVMObject *obj); |