Skip to content

Commit

Permalink
Add missing MVMROOT in MVM_spesh_plugin_register
Browse files Browse the repository at this point in the history
name and plugin could be moved by the GC before we add them to spesh_plugins
  • Loading branch information
niner committed Jul 27, 2019
1 parent 0a12e3c commit f18bfad
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/spesh/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ void MVM_spesh_plugin_register(MVMThreadContext *tc, MVMString *language,
MVMString *name, MVMObject *plugin) {
MVMHLLConfig *hll = MVM_hll_get_config_for(tc, language);
uv_mutex_lock(&tc->instance->mutex_hllconfigs);
if (!hll->spesh_plugins)
hll->spesh_plugins = MVM_repr_alloc_init(tc, tc->instance->boot_types.BOOTHash);
if (!hll->spesh_plugins) {
MVMROOT2(tc, name, plugin, {
hll->spesh_plugins = MVM_repr_alloc_init(tc, tc->instance->boot_types.BOOTHash);
});
}
MVM_repr_bind_key_o(tc, hll->spesh_plugins, name, plugin);
uv_mutex_unlock(&tc->instance->mutex_hllconfigs);
}
Expand Down

0 comments on commit f18bfad

Please sign in to comment.