Gwion coverage report


Directory: src/
File: src/gwiondata.c
Date: 2023-01-30 18:32:28
Exec Total Coverage
Lines: 29 29 100.0%
Functions: 5 5 100.0%
Branches: 2 2 100.0%

Line Branch Exec Source
1 #include "gwion_util.h"
2 #include "gwion_ast.h"
3 #include "gwion_env.h"
4 #include "plug.h"
5 #include "gwiondata.h"
6 #include "vm.h"
7 #include "instr.h"
8 #include "emit.h"
9 #include "gwion.h"
10 #include "specialid.h"
11 #include "pass.h"
12
13 712 ANN static inline GwionData *gwiondata(MemPool mp) {
14 712 struct GwionData_ *data = mp_calloc(mp, GwionData);
15 712 MUTEX_SETUP(data->mutex);
16 712 return data;
17 }
18
19 707 ANN GwionData *new_gwiondata(const MemPool mp) {
20 707 GwionData *data = gwiondata(mp);
21 707 map_init(&data->freearg);
22 707 map_init(&data->id);
23 707 return data;
24 }
25
26 5 ANN GwionData *cpy_gwiondata(MemPool mp, const GwionData *src) {
27 5 GwionData *data = gwiondata(mp);
28 5 data->freearg = src->freearg;
29 5 data->id = src->id;
30 5 data->plugs = src->plugs;
31 5 data->passes = src->passes;
32 5 return data;
33 }
34
35 708 ANN void free_gwiondata_cpy(const MemPool mp, GwionData *data) {
36 708 MUTEX_CLEANUP(data->mutex);
37 708 mp_free(mp, GwionData, data);
38 708 }
39
40 707 ANN void free_gwiondata(const Gwion gwion) {
41 707 GwionData *data = gwion->data;
42 707 map_release(&data->freearg);
43
2/2
✓ Branch 1 taken 6380 times.
✓ Branch 2 taken 707 times.
7087 for (m_uint i = 0; i < map_size(&data->id); ++i)
44 6380 mp_free(gwion->mp, SpecialId, (struct SpecialId_ *)map_at(&data->id, i));
45 707 map_release(&data->id);
46 707 free_passes(gwion->mp, data->passes);
47 707 free_gwiondata_cpy(gwion->mp, data);
48 707 }
49