diff --git a/src/dump.c b/src/dump.c index 957ac3413c0d4..3b2dffaa05b5c 100644 --- a/src/dump.c +++ b/src/dump.c @@ -418,6 +418,8 @@ static void jl_serialize_module(ios_t *s, jl_module_t *m) } } jl_serialize_value(s, m->constant_table); + write_int32(s, (uint32_t)m->uuid); + write_int32(s, (uint32_t)(m->uuid>>32)); } static int is_ast_node(jl_value_t *v) @@ -1088,6 +1090,8 @@ static jl_value_t *jl_deserialize_value_(ios_t *s, int pos, jl_value_t *vtag, jl i++; } m->constant_table = (jl_array_t*)jl_deserialize_value(s, (jl_value_t**)&m->constant_table); + m->uuid = read_int32(s); + m->uuid |= ((uint64_t)read_int32(s))<<32; return (jl_value_t*)m; } else if (vtag == (jl_value_t*)SmallInt64_tag) { diff --git a/src/julia.h b/src/julia.h index d19c4c41bd9a9..13dc46a6672af 100644 --- a/src/julia.h +++ b/src/julia.h @@ -255,6 +255,7 @@ typedef struct _jl_module_t { htable_t bindings; arraylist_t usings; // modules with all bindings potentially imported jl_array_t *constant_table; + uint64_t uuid; } jl_module_t; typedef struct _jl_methlist_t { diff --git a/src/module.c b/src/module.c index 41aa9513e707d..18e850a463403 100644 --- a/src/module.c +++ b/src/module.c @@ -22,6 +22,7 @@ jl_module_t *jl_new_module(jl_sym_t *name) assert(jl_is_symbol(name)); m->name = name; m->constant_table = NULL; + m->uuid = uv_now(uv_default_loop()); htable_new(&m->bindings, 0); arraylist_new(&m->usings, 0); if (jl_core_module) { @@ -425,6 +426,7 @@ DLLEXPORT jl_value_t *jl_module_names(jl_module_t *m, int all, int imported) DLLEXPORT jl_sym_t *jl_module_name(jl_module_t *m) { return m->name; } DLLEXPORT jl_module_t *jl_module_parent(jl_module_t *m) { return m->parent; } +DLLEXPORT uint64_t jl_module_uuid(jl_module_t *m) { return m->uuid; } int jl_module_has_initializer(jl_module_t *m) {