/home/travis/build/MoarVM/MoarVM/src/6model/reprs/MVMDLLSym.c
Line | Count | Source (jump to first uncovered line) |
1 | | #include "moar.h" |
2 | | |
3 | | static const MVMREPROps MVMDLLSym_this_repr; |
4 | | |
5 | 0 | static MVMObject * type_object_for(MVMThreadContext *tc, MVMObject *HOW) { |
6 | 0 | MVMSTable *st = MVM_gc_allocate_stable(tc, &MVMDLLSym_this_repr, HOW); |
7 | 0 |
|
8 | 0 | MVMROOT(tc, st, { |
9 | 0 | MVMObject *obj = MVM_gc_allocate_type_object(tc, st); |
10 | 0 | MVM_ASSIGN_REF(tc, &(st->header), st->WHAT, obj); |
11 | 0 | st->size = sizeof(MVMDLLSym); |
12 | 0 | }); |
13 | 0 |
|
14 | 0 | return st->WHAT; |
15 | 0 | } |
16 | | |
17 | | static void copy_to(MVMThreadContext *tc, MVMSTable *st, void *src, |
18 | 0 | MVMObject *dest_root, void *dest) { |
19 | 0 | MVMDLLSymBody *src_body = src; |
20 | 0 | MVMDLLSymBody *dest_body = dest; |
21 | 0 |
|
22 | 0 | *dest_body = *src_body; |
23 | 0 |
|
24 | 0 | if (dest_body->dll) |
25 | 0 | MVM_incr(&dest_body->dll->refcount); |
26 | 0 | } |
27 | | |
28 | | static const MVMStorageSpec storage_spec = { |
29 | | MVM_STORAGE_SPEC_REFERENCE, /* inlineable */ |
30 | | 0, /* bits */ |
31 | | 0, /* align */ |
32 | | MVM_STORAGE_SPEC_BP_NONE, /* boxed_primitive */ |
33 | | 0, /* can_box */ |
34 | | 0, /* is_unsigned */ |
35 | | }; |
36 | | |
37 | 0 | static const MVMStorageSpec * get_storage_spec(MVMThreadContext *tc, MVMSTable *st) { |
38 | 0 | return &storage_spec; |
39 | 0 | } |
40 | | |
41 | 0 | static void compose(MVMThreadContext *tc, MVMSTable *st, MVMObject *info) { |
42 | 0 | /* noop */ |
43 | 0 | } |
44 | | |
45 | 144 | const MVMREPROps * MVMDLLSym_initialize(MVMThreadContext *tc) { |
46 | 144 | MVMSTable *st = MVM_gc_allocate_stable(tc, &MVMDLLSym_this_repr, NULL); |
47 | 144 | |
48 | 144 | MVMROOT(tc, st, { |
49 | 144 | MVMObject *WHAT = MVM_gc_allocate_type_object(tc, st); |
50 | 144 | tc->instance->raw_types.RawDLLSym = WHAT; |
51 | 144 | MVM_ASSIGN_REF(tc, &(st->header), st->WHAT, WHAT); |
52 | 144 | st->size = sizeof(MVMDLLSym); |
53 | 144 | }); |
54 | 144 | |
55 | 144 | MVM_gc_root_add_permanent_desc(tc, |
56 | 144 | (MVMCollectable **)&tc->instance->raw_types.RawDLLSym, |
57 | 144 | "RawDLLSym"); |
58 | 144 | |
59 | 144 | return &MVMDLLSym_this_repr; |
60 | 144 | } |
61 | | |
62 | | static const MVMREPROps MVMDLLSym_this_repr = { |
63 | | type_object_for, |
64 | | MVM_gc_allocate_object, |
65 | | NULL, /* initialize */ |
66 | | copy_to, |
67 | | MVM_REPR_DEFAULT_ATTR_FUNCS, |
68 | | MVM_REPR_DEFAULT_BOX_FUNCS, |
69 | | MVM_REPR_DEFAULT_POS_FUNCS, |
70 | | MVM_REPR_DEFAULT_ASS_FUNCS, |
71 | | MVM_REPR_DEFAULT_ELEMS, |
72 | | get_storage_spec, |
73 | | NULL, /* change_type */ |
74 | | NULL, /* serialize */ |
75 | | NULL, /* deserialize */ |
76 | | NULL, /* serialize_repr_data */ |
77 | | NULL, /* deserialize_repr_data */ |
78 | | NULL, /* deserialize_stable_size */ |
79 | | NULL, /* gc_mark */ |
80 | | NULL, /* gc_free */ |
81 | | NULL, /* gc_cleanup */ |
82 | | NULL, /* gc_mark_repr_data */ |
83 | | NULL, /* gc_free_repr_data */ |
84 | | compose, |
85 | | NULL, /* spesh */ |
86 | | "MVMDLLSym", |
87 | | MVM_REPR_ID_MVMDLLSym, |
88 | | NULL, /* unmanaged_size */ |
89 | | NULL, /* describe_refs */ |
90 | | }; |