Coverage Report

Created: 2018-07-03 15:31

/home/travis/build/MoarVM/MoarVM/src/6model/reprs/Uninstantiable.c
Line
Count
Source (jump to first uncovered line)
1
#include "moar.h"
2
3
/* This representation's function pointer table. */
4
static const MVMREPROps Uninstantiable_this_repr;
5
6
/* Creates a new type object of this representation, and associates it with
7
 * the given HOW. */
8
319
static MVMObject * type_object_for(MVMThreadContext *tc, MVMObject *HOW) {
9
319
    MVMSTable *st  = MVM_gc_allocate_stable(tc, &Uninstantiable_this_repr, HOW);
10
319
11
319
    MVMROOT(tc, st, {
12
319
        MVMObject *obj = MVM_gc_allocate_type_object(tc, st);
13
319
        MVM_ASSIGN_REF(tc, &(st->header), st->WHAT, obj);
14
319
        st->size = sizeof(MVMUninstantiable);
15
319
    });
16
319
17
319
    return st->WHAT;
18
319
}
19
20
/* Creates a new instance based on the type object. */
21
0
static MVMObject * allocate(MVMThreadContext *tc, MVMSTable *st) {
22
0
    MVM_exception_throw_adhoc(tc,
23
0
        "You cannot create an instance of this type (%s)", MVM_6model_get_stable_debug_name(tc, st));
24
0
}
25
26
/* Copies the body of one object to another. */
27
0
static void copy_to(MVMThreadContext *tc, MVMSTable *st, void *src, MVMObject *dest_root, void *dest) {
28
0
    /* Nothing to copy. */
29
0
}
30
31
static const MVMStorageSpec storage_spec = {
32
    MVM_STORAGE_SPEC_REFERENCE, /* inlineable */
33
    0,                          /* bits */
34
    0,                          /* align */
35
    MVM_STORAGE_SPEC_BP_NONE,   /* boxed_primitive */
36
    0,                          /* can_box */
37
    0,                          /* is_unsigned */
38
};
39
40
41
/* Gets the storage specification for this representation. */
42
57
static const MVMStorageSpec * get_storage_spec(MVMThreadContext *tc, MVMSTable *st) {
43
57
    return &storage_spec;
44
57
}
45
46
/* Compose the representation. */
47
1
static void compose(MVMThreadContext *tc, MVMSTable *st, MVMObject *info) {
48
1
    /* Nothing to do for this REPR. */
49
1
}
50
51
/* Set the size of the STable. */
52
3.46k
static void deserialize_stable_size(MVMThreadContext *tc, MVMSTable *st, MVMSerializationReader *reader) {
53
3.46k
    st->size = sizeof(MVMUninstantiable);
54
3.46k
}
55
56
/* Initializes the representation. */
57
144
const MVMREPROps * MVMUninstantiable_initialize(MVMThreadContext *tc) {
58
144
    return &Uninstantiable_this_repr;
59
144
}
60
61
static const MVMREPROps Uninstantiable_this_repr = {
62
    type_object_for,
63
    allocate,
64
    NULL, /* initialize */
65
    copy_to,
66
    MVM_REPR_DEFAULT_ATTR_FUNCS,
67
    MVM_REPR_DEFAULT_BOX_FUNCS,
68
    MVM_REPR_DEFAULT_POS_FUNCS,
69
    MVM_REPR_DEFAULT_ASS_FUNCS,
70
    MVM_REPR_DEFAULT_ELEMS,
71
    get_storage_spec,
72
    NULL, /* change_type */
73
    NULL, /* serialize */
74
    NULL, /* deserialize */
75
    NULL, /* serialize_repr_data */
76
    NULL, /* deserialize_repr_data */
77
    deserialize_stable_size,
78
    NULL, /* gc_mark */
79
    NULL, /* gc_free */
80
    NULL, /* gc_cleanup */
81
    NULL, /* gc_mark_repr_data */
82
    NULL, /* gc_free_repr_data */
83
    compose,
84
    NULL, /* spesh */
85
    "Uninstantiable", /* name */
86
    MVM_REPR_ID_Uninstantiable,
87
    NULL, /* unmanaged_size */
88
    NULL, /* describe_refs */
89
};