Line | Branch | Exec | Source |
---|---|---|---|
1 | #include "gwion_util.h" | ||
2 | #include "gwion_ast.h" | ||
3 | #include "gwion_env.h" | ||
4 | #include "vm.h" | ||
5 | #include "gwion.h" | ||
6 | |||
7 | 126924 | ANN void free_value(Value a, Gwion gwion) { | |
8 | 126924 | const Type t = a->type; | |
9 |
5/6✓ Branch 0 taken 9 times.
✓ Branch 1 taken 126915 times.
✓ Branch 3 taken 9 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✓ Branch 6 taken 8 times.
|
126924 | if (t->size > SZ_INT && !vflag(a, vflag_func) && a->d.ptr) |
10 | 1 | _mp_free(gwion->mp, t->size, a->d.ptr); | |
11 |
2/2✓ Branch 1 taken 37638 times.
✓ Branch 2 taken 89285 times.
|
126923 | else if (is_class(gwion, t)) |
12 | 37638 | type_remref(t, gwion); | |
13 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 126919 times.
|
126924 | if(a->used_by) free_mp_vector(gwion->mp, Func, a->used_by); |
14 | 126924 | mp_free(gwion->mp, ValueFrom, a->from); | |
15 | 126924 | mp_free(gwion->mp, Value, a); | |
16 | 126924 | } | |
17 | |||
18 | 164967 | ANN Value new_value(const Env env, const Type type, const m_str name, const loc_t loc) { | |
19 | 164967 | const Value a = mp_calloc(env->gwion->mp, Value); | |
20 | 164967 | a->from = mp_calloc(env->gwion->mp, ValueFrom); | |
21 | 164967 | a->type = type; | |
22 | 164967 | a->name = name; | |
23 | 164967 | a->ref = 1; | |
24 | 164967 | a->from->filename = env->name; | |
25 | 164967 | a->from->loc = loc; | |
26 | 164967 | return a; | |
27 | } | ||
28 | |||
29 | 204536 | ANN void valuefrom(const Env env, ValueFrom *from) { | |
30 | 204536 | from->owner = env->curr; | |
31 |
2/2✓ Branch 0 taken 204533 times.
✓ Branch 1 taken 3 times.
|
204536 | from->owner_class = env->scope->depth ? NULL : env->class_def; |
32 | 204536 | from->ctx = env->context; | |
33 | 204536 | } | |
34 |