Coverage Report

Created: 2017-04-15 07:07

/home/travis/build/MoarVM/MoarVM/src/core/callsite.h
Line
Count
Source
1
/* Callsite argument flags. */
2
8.55M
#define MVM_CALLSITE_ARG_MASK 31
3
typedef enum {
4
    /* Argument is an object. */
5
    MVM_CALLSITE_ARG_OBJ = 1,
6
7
    /* Argument is a native integer, signed. */
8
    MVM_CALLSITE_ARG_INT = 2,
9
10
    /* Argument is a native floating point number. */
11
    MVM_CALLSITE_ARG_NUM = 4,
12
13
    /* Argument is a native NFG string (MVMString REPR). */
14
    MVM_CALLSITE_ARG_STR = 8,
15
16
    /* Argument is named. The name is placed in the MVMCallsite. */
17
    MVM_CALLSITE_ARG_NAMED = 32,
18
19
    /* Argument is flattened. What this means is up to the target. */
20
    MVM_CALLSITE_ARG_FLAT = 64,
21
22
    /* Argument is flattened and named. */
23
    MVM_CALLSITE_ARG_FLAT_NAMED = 128
24
} MVMCallsiteFlags;
25
26
typedef enum {
27
    /* Zero argument callsite. */
28
    MVM_CALLSITE_ID_NULL_ARGS,
29
30
    /* Dummy, invocant-arg callsite. Taken from coerce.c;
31
     * OBJ */
32
    MVM_CALLSITE_ID_INV_ARG,
33
34
    /* Callsite for container store. Taken from containers.c;
35
     * OBJ, OBJ */
36
    MVM_CALLSITE_ID_TWO_OBJ,
37
38
    /* Callsite for method not found errors. Taken from 6model.c;
39
     * OBJ, STR */
40
    MVM_CALLSITE_ID_METH_NOT_FOUND,
41
42
    /* Callsite for finding methods. Taken from 6model.c;
43
     * OBJ, OBJ, STR */
44
    MVM_CALLSITE_ID_FIND_METHOD,
45
46
    /* Callsite for typechecks. Taken from 6model.c;
47
     * OBJ, OBJ, OBJ */
48
    MVM_CALLSITE_ID_TYPECHECK,
49
50
    /* Callsite OBJ, INT */
51
    MVM_CALLSITE_ID_OBJ_INT,
52
53
    /* Callsite OBJ, INT */
54
    MVM_CALLSITE_ID_OBJ_NUM,
55
56
    /* Callsite OBJ, STR */
57
    MVM_CALLSITE_ID_OBJ_STR,
58
59
    /* Callsite INT, INT */
60
    MVM_CALLSITE_ID_INT_INT,
61
} MVMCommonCallsiteID;
62
63
/* A callsite entry is just one of the above flags. */
64
typedef MVMuint8 MVMCallsiteEntry;
65
66
/* A callsite is an argument count, a bunch of flags, and names of named
67
 * arguments (excluding any flattening ones). Note that it does not contain
68
 * the argument values; this is the *statically known* things about the
69
 * callsite and is immutable. It describes how to process the callsite
70
 * memory buffer. */
71
struct MVMCallsite {
72
    /* The set of flags. */
73
    MVMCallsiteEntry *arg_flags;
74
75
    /* The number of arg flags. */
76
    MVMuint16 flag_count;
77
78
    /* The total argument count (including 2 for each named arg). */
79
    MVMuint16 arg_count;
80
81
    /* Number of positionals, including flattening positionals but
82
     * excluding named positionals. */
83
    MVMuint16 num_pos;
84
85
    /* Whether it has any flattening args. */
86
    MVMuint8 has_flattening;
87
88
    /* Whether it has been interned (which means it is suitable for using in
89
     * specialization). */
90
    MVMuint8 is_interned;
91
92
    /* Cached version of this callsite with an extra invocant arg. */
93
    MVMCallsite *with_invocant;
94
95
    /* Names of named arguments, in the order that they are passed (and thus
96
     * matching the flags). Note that named flattening args do not have an
97
     * entry here, even though they come in the nameds section. */
98
    MVMString **arg_names;
99
};
100
101
/* Minimum callsite size is due to certain things internally expecting us to
102
 * have that many slots available (e.g. find_method(how, obj, name)). */
103
2.61k
#define MVM_MIN_CALLSITE_SIZE 3
104
105
/* Maximum arity + 1 that we'll intern callsites by. */
106
805k
#define MVM_INTERN_ARITY_LIMIT 8
107
108
/* Interned callsites data structure. */
109
struct MVMCallsiteInterns {
110
    /* Array of callsites, by arity. */
111
    MVMCallsite **by_arity[MVM_INTERN_ARITY_LIMIT];
112
113
    /* Number of callsites we have interned by arity. */
114
    MVMint32 num_by_arity[MVM_INTERN_ARITY_LIMIT];
115
};
116
117
/* Initialize the "common" callsites */
118
void MVM_callsite_initialize_common(MVMThreadContext *tc);
119
120
/* Get any of the "common" callsites */
121
MVM_PUBLIC MVMCallsite *MVM_callsite_get_common(MVMThreadContext *tc, MVMCommonCallsiteID id);
122
123
int MVM_callsite_is_common(MVMCallsite *cs);
124
125
void MVM_callsite_destroy(MVMCallsite *cs);
126
127
MVMCallsite *MVM_callsite_copy(MVMThreadContext *tc, const MVMCallsite *cs);
128
129
/* Callsite interning function. */
130
MVM_PUBLIC void MVM_callsite_try_intern(MVMThreadContext *tc, MVMCallsite **cs);
131
132
/* Count the number of nameds (excluding flattening). */
133
12.5M
MVM_STATIC_INLINE MVMuint16 MVM_callsite_num_nameds(MVMThreadContext *tc, const MVMCallsite *cs) {
134
12.5M
    MVMuint16 i = cs->num_pos;
135
12.5M
    MVMuint16 nameds = 0;
136
13.6M
    while (i < cs->flag_count) {
137
1.13M
        if (!(cs->arg_flags[i] & MVM_CALLSITE_ARG_FLAT_NAMED))
138
1.05M
            nameds++;
139
1.13M
        i++;
140
1.13M
    }
141
12.5M
    return nameds;
142
12.5M
}
Unexecuted instantiation: NativeRef.c:MVM_callsite_num_nameds
Unexecuted instantiation: CUnion.c:MVM_callsite_num_nameds
Unexecuted instantiation: ReentrantMutex.c:MVM_callsite_num_nameds
Unexecuted instantiation: ConditionVariable.c:MVM_callsite_num_nameds
Unexecuted instantiation: Semaphore.c:MVM_callsite_num_nameds
Unexecuted instantiation: ConcBlockingQueue.c:MVM_callsite_num_nameds
Unexecuted instantiation: MVMAsyncTask.c:MVM_callsite_num_nameds
Unexecuted instantiation: MVMNull.c:MVM_callsite_num_nameds
Unexecuted instantiation: CPPStruct.c:MVM_callsite_num_nameds
Unexecuted instantiation: CStruct.c:MVM_callsite_num_nameds
Unexecuted instantiation: MultiDimArray.c:MVM_callsite_num_nameds
Unexecuted instantiation: Decoder.c:MVM_callsite_num_nameds
Unexecuted instantiation: 6model.c:MVM_callsite_num_nameds
Unexecuted instantiation: bootstrap.c:MVM_callsite_num_nameds
Unexecuted instantiation: sc.c:MVM_callsite_num_nameds
Unexecuted instantiation: serialization.c:MVM_callsite_num_nameds
Unexecuted instantiation: compiler.c:MVM_callsite_num_nameds
Unexecuted instantiation: driver.c:MVM_callsite_num_nameds
Unexecuted instantiation: MVMException.c:MVM_callsite_num_nameds
Unexecuted instantiation: MVMThread.c:MVM_callsite_num_nameds
Unexecuted instantiation: MVMIter.c:MVM_callsite_num_nameds
Unexecuted instantiation: MVMContext.c:MVM_callsite_num_nameds
Unexecuted instantiation: SCRef.c:MVM_callsite_num_nameds
Unexecuted instantiation: Lexotic.c:MVM_callsite_num_nameds
Unexecuted instantiation: MVMCallCapture.c:MVM_callsite_num_nameds
Unexecuted instantiation: P6bigint.c:MVM_callsite_num_nameds
Unexecuted instantiation: NFA.c:MVM_callsite_num_nameds
Unexecuted instantiation: dump.c:MVM_callsite_num_nameds
Unexecuted instantiation: MVMDLLSym.c:MVM_callsite_num_nameds
Unexecuted instantiation: MVMMultiCache.c:MVM_callsite_num_nameds
Unexecuted instantiation: MVMContinuation.c:MVM_callsite_num_nameds
Unexecuted instantiation: NativeCall.c:MVM_callsite_num_nameds
Unexecuted instantiation: CPointer.c:MVM_callsite_num_nameds
Unexecuted instantiation: CStr.c:MVM_callsite_num_nameds
Unexecuted instantiation: CArray.c:MVM_callsite_num_nameds
Unexecuted instantiation: profile.c:MVM_callsite_num_nameds
Unexecuted instantiation: nfg.c:MVM_callsite_num_nameds
Unexecuted instantiation: unicode.c:MVM_callsite_num_nameds
Unexecuted instantiation: normalize.c:MVM_callsite_num_nameds
Unexecuted instantiation: latin1.c:MVM_callsite_num_nameds
Unexecuted instantiation: utf16.c:MVM_callsite_num_nameds
Unexecuted instantiation: windows1252.c:MVM_callsite_num_nameds
Unexecuted instantiation: bigintops.c:MVM_callsite_num_nameds
Unexecuted instantiation: instrument.c:MVM_callsite_num_nameds
Unexecuted instantiation: utf8_c8.c:MVM_callsite_num_nameds
Unexecuted instantiation: heapsnapshot.c:MVM_callsite_num_nameds
Unexecuted instantiation: crossthreadwrite.c:MVM_callsite_num_nameds
Unexecuted instantiation: line_coverage.c:MVM_callsite_num_nameds
Unexecuted instantiation: moar.c:MVM_callsite_num_nameds
Unexecuted instantiation: mmap.c:MVM_callsite_num_nameds
Unexecuted instantiation: time.c:MVM_callsite_num_nameds
Unexecuted instantiation: sys.c:MVM_callsite_num_nameds
Unexecuted instantiation: emit_posix_x64.c:MVM_callsite_num_nameds
Unexecuted instantiation: threshold.c:MVM_callsite_num_nameds
Unexecuted instantiation: graph.c:MVM_callsite_num_nameds
Unexecuted instantiation: codegen.c:MVM_callsite_num_nameds
Unexecuted instantiation: candidate.c:MVM_callsite_num_nameds
Unexecuted instantiation: manipulate.c:MVM_callsite_num_nameds
Unexecuted instantiation: facts.c:MVM_callsite_num_nameds
Unexecuted instantiation: optimize.c:MVM_callsite_num_nameds
Unexecuted instantiation: deopt.c:MVM_callsite_num_nameds
Unexecuted instantiation: log.c:MVM_callsite_num_nameds
Unexecuted instantiation: HashAttrStore.c:MVM_callsite_num_nameds
Unexecuted instantiation: inline.c:MVM_callsite_num_nameds
Unexecuted instantiation: osr.c:MVM_callsite_num_nameds
Unexecuted instantiation: lookup.c:MVM_callsite_num_nameds
Unexecuted instantiation: compile.c:MVM_callsite_num_nameds
Unexecuted instantiation: decode_stream.c:MVM_callsite_num_nameds
Unexecuted instantiation: ascii.c:MVM_callsite_num_nameds
Unexecuted instantiation: utf8.c:MVM_callsite_num_nameds
Unexecuted instantiation: orchestrate.c:MVM_callsite_num_nameds
Unexecuted instantiation: ext.c:MVM_callsite_num_nameds
Unexecuted instantiation: nativecall.c:MVM_callsite_num_nameds
Unexecuted instantiation: nativecall_dyncall.c:MVM_callsite_num_nameds
Unexecuted instantiation: continuation.c:MVM_callsite_num_nameds
Unexecuted instantiation: intcache.c:MVM_callsite_num_nameds
Unexecuted instantiation: fixedsizealloc.c:MVM_callsite_num_nameds
Unexecuted instantiation: regionalloc.c:MVM_callsite_num_nameds
Unexecuted instantiation: config.c:MVM_callsite_num_nameds
Unexecuted instantiation: dll.c:MVM_callsite_num_nameds
Unexecuted instantiation: allocation.c:MVM_callsite_num_nameds
Unexecuted instantiation: worklist.c:MVM_callsite_num_nameds
Unexecuted instantiation: roots.c:MVM_callsite_num_nameds
Unexecuted instantiation: collect.c:MVM_callsite_num_nameds
Unexecuted instantiation: gen2.c:MVM_callsite_num_nameds
Unexecuted instantiation: wb.c:MVM_callsite_num_nameds
Unexecuted instantiation: objectid.c:MVM_callsite_num_nameds
Unexecuted instantiation: finalize.c:MVM_callsite_num_nameds
Unexecuted instantiation: validation.c:MVM_callsite_num_nameds
args.c:MVM_callsite_num_nameds
Line
Count
Source
133
12.4M
MVM_STATIC_INLINE MVMuint16 MVM_callsite_num_nameds(MVMThreadContext *tc, const MVMCallsite *cs) {
134
12.4M
    MVMuint16 i = cs->num_pos;
135
12.4M
    MVMuint16 nameds = 0;
136
13.5M
    while (i < cs->flag_count) {
137
1.05M
        if (!(cs->arg_flags[i] & MVM_CALLSITE_ARG_FLAT_NAMED))
138
979k
            nameds++;
139
1.05M
        i++;
140
1.05M
    }
141
12.4M
    return nameds;
142
12.4M
}
Unexecuted instantiation: exceptions.c:MVM_callsite_num_nameds
Unexecuted instantiation: interp.c:MVM_callsite_num_nameds
Unexecuted instantiation: threadcontext.c:MVM_callsite_num_nameds
Unexecuted instantiation: compunit.c:MVM_callsite_num_nameds
Unexecuted instantiation: bytecode.c:MVM_callsite_num_nameds
Unexecuted instantiation: frame.c:MVM_callsite_num_nameds
Unexecuted instantiation: callstack.c:MVM_callsite_num_nameds
Unexecuted instantiation: debug.c:MVM_callsite_num_nameds
Unexecuted instantiation: bytecodedump.c:MVM_callsite_num_nameds
Unexecuted instantiation: threads.c:MVM_callsite_num_nameds
Unexecuted instantiation: ops.c:MVM_callsite_num_nameds
Unexecuted instantiation: hll.c:MVM_callsite_num_nameds
Unexecuted instantiation: loadbytecode.c:MVM_callsite_num_nameds
Unexecuted instantiation: num.c:MVM_callsite_num_nameds
Unexecuted instantiation: coerce.c:MVM_callsite_num_nameds
Unexecuted instantiation: P6opaque.c:MVM_callsite_num_nameds
Unexecuted instantiation: parametric.c:MVM_callsite_num_nameds
Unexecuted instantiation: MVMString.c:MVM_callsite_num_nameds
Unexecuted instantiation: VMArray.c:MVM_callsite_num_nameds
Unexecuted instantiation: MVMHash.c:MVM_callsite_num_nameds
Unexecuted instantiation: MVMCFunction.c:MVM_callsite_num_nameds
Unexecuted instantiation: KnowHOWREPR.c:MVM_callsite_num_nameds
Unexecuted instantiation: KnowHOWAttributeREPR.c:MVM_callsite_num_nameds
Unexecuted instantiation: P6str.c:MVM_callsite_num_nameds
Unexecuted instantiation: containers.c:MVM_callsite_num_nameds
Unexecuted instantiation: MVMCode.c:MVM_callsite_num_nameds
Unexecuted instantiation: MVMOSHandle.c:MVM_callsite_num_nameds
Unexecuted instantiation: MVMCompUnit.c:MVM_callsite_num_nameds
Unexecuted instantiation: MVMStaticFrame.c:MVM_callsite_num_nameds
Unexecuted instantiation: P6int.c:MVM_callsite_num_nameds
Unexecuted instantiation: P6num.c:MVM_callsite_num_nameds
Unexecuted instantiation: Uninstantiable.c:MVM_callsite_num_nameds
Unexecuted instantiation: procops.c:MVM_callsite_num_nameds
Unexecuted instantiation: io.c:MVM_callsite_num_nameds
Unexecuted instantiation: eventloop.c:MVM_callsite_num_nameds
Unexecuted instantiation: syncfile.c:MVM_callsite_num_nameds
Unexecuted instantiation: syncstream.c:MVM_callsite_num_nameds
Unexecuted instantiation: syncpipe.c:MVM_callsite_num_nameds
Unexecuted instantiation: syncsocket.c:MVM_callsite_num_nameds
Unexecuted instantiation: fileops.c:MVM_callsite_num_nameds
Unexecuted instantiation: dirops.c:MVM_callsite_num_nameds
callsite.c:MVM_callsite_num_nameds
Line
Count
Source
133
67.9k
MVM_STATIC_INLINE MVMuint16 MVM_callsite_num_nameds(MVMThreadContext *tc, const MVMCallsite *cs) {
134
67.9k
    MVMuint16 i = cs->num_pos;
135
67.9k
    MVMuint16 nameds = 0;
136
143k
    while (i < cs->flag_count) {
137
75.3k
        if (!(cs->arg_flags[i] & MVM_CALLSITE_ARG_FLAT_NAMED))
138
72.5k
            nameds++;
139
75.3k
        i++;
140
75.3k
    }
141
67.9k
    return nameds;
142
67.9k
}
Unexecuted instantiation: timers.c:MVM_callsite_num_nameds
Unexecuted instantiation: filewatchers.c:MVM_callsite_num_nameds
Unexecuted instantiation: signals.c:MVM_callsite_num_nameds
Unexecuted instantiation: asyncsocket.c:MVM_callsite_num_nameds
Unexecuted instantiation: asyncsocketudp.c:MVM_callsite_num_nameds
Unexecuted instantiation: reprs.c:MVM_callsite_num_nameds
Unexecuted instantiation: reprconv.c:MVM_callsite_num_nameds