Skip to content

Commit f0b3460

Browse files
committed
Fix-up init / destroy logic
1 parent 9d8ce54 commit f0b3460

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/staticdata.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@ typedef struct {
9696
htable_t type_in_worklist;
9797
} jl_query_cache;
9898

99+
static void init_query_cache(jl_query_cache *cache)
100+
{
101+
htable_new(&cache->type_in_worklist, 0);
102+
}
103+
104+
static void destroy_query_cache(jl_query_cache *cache)
105+
{
106+
htable_free(&cache->type_in_worklist);
107+
}
108+
99109
#include "staticdata_utils.c"
100110
#include "precompile_utils.c"
101111

@@ -3382,8 +3392,8 @@ JL_DLLEXPORT void jl_create_system_image(void **_native_data, jl_array_t *workli
33823392
int64_t datastartpos = 0;
33833393
JL_GC_PUSH4(&mod_array, &extext_methods, &new_ext_cis, &edges);
33843394

3385-
jl_query_cache query_cache = { 0 };
3386-
htable_new(&query_cache.type_in_worklist, 0);
3395+
jl_query_cache query_cache;
3396+
init_query_cache(&query_cache);
33873397

33883398
if (worklist) {
33893399
mod_array = jl_get_loaded_modules(); // __toplevel__ modules loaded in this session (from Base.loaded_modules_array)
@@ -3461,6 +3471,8 @@ JL_DLLEXPORT void jl_create_system_image(void **_native_data, jl_array_t *workli
34613471
}
34623472
}
34633473

3474+
destroy_query_cache(&query_cache);
3475+
34643476
JL_GC_POP();
34653477
*s = f;
34663478
if (emit_split)

0 commit comments

Comments
 (0)