How do you separate context for different julia nodes? It seems that every instance share the same module. I think it’s better to create different modules for each node with jl_new_module. Also, new modules doesnt` have reference for Base, they are bare, you should link them to Base. Actually, don’t use jl_new_module, instead write custom function like this from modules.c.
JL_DLLEXPORT jl_value_t *jl_f_new_module(jl_sym_t *name, uint8_t std_imports)
{
// TODO: should we prohibit this during incremental compilation?
jl_module_t *m = jl_new_module(name);
JL_GC_PUSH1(&m);
m->parent = jl_main_module; // TODO: this is a lie
jl_gc_wb(m, m->parent);
if (std_imports)
jl_add_standard_imports(m);
JL_GC_POP();
// TODO: should we somehow try to gc-root this correctly?
return (jl_value_t*)m;
}