Coverage Report

Created: 2017-04-15 07:07

/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
35
/* Various fact flags. */
36
803k
#define MVM_SPESH_FACT_KNOWN_TYPE           1   /* Has a known type. */
37
456k
#define MVM_SPESH_FACT_KNOWN_VALUE          2   /* Has a known value. */
38
572k
#define MVM_SPESH_FACT_DECONTED             4   /* Know it's decontainerized. */
39
168k
#define MVM_SPESH_FACT_CONCRETE             8   /* Know it's a concrete object. */
40
254k
#define MVM_SPESH_FACT_TYPEOBJ              16  /* Know it's a type object. */
41
349k
#define MVM_SPESH_FACT_KNOWN_DECONT_TYPE    32  /* Has a known type after decont. */
42
173k
#define MVM_SPESH_FACT_DECONT_CONCRETE      64  /* Is concrete after decont. */
43
173k
#define MVM_SPESH_FACT_DECONT_TYPEOBJ       128 /* Is a type object after decont. */
44
2.04M
#define MVM_SPESH_FACT_FROM_LOG_GUARD       256 /* Depends on a guard being met. */
45
125
#define MVM_SPESH_FACT_HASH_ITER            512 /* Is an iter over hashes. */
46
134
#define MVM_SPESH_FACT_ARRAY_ITER           1024 /* Is an iter over arrays
47
                                                    (mutually exclusive with HASH_ITER, but neither of them is necessarily set) */
48
18.0k
#define MVM_SPESH_FACT_KNOWN_BOX_SRC        2048 /* We know what register this value was boxed from */
49
496k
#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. */
50
35.4k
#define MVM_SPESH_FACT_RW_CONT               8192 /* Known to be an rw container */
51
52
void MVM_spesh_facts_discover(MVMThreadContext *tc, MVMSpeshGraph *g);
53
void MVM_spesh_facts_depend(MVMThreadContext *tc, MVMSpeshGraph *g,
54
    MVMSpeshFacts *target, MVMSpeshFacts *source);
55
MVMint32 MVM_spesh_facts_decont_blocked_by_alias(MVMThreadContext *tc, MVMSpeshGraph *g, MVMSpeshIns *ins);