Skip to content

Commit

Permalink
add some code comments / improve some error message wording
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Jul 1, 2015
1 parent e063f77 commit 6f55437
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
12 changes: 9 additions & 3 deletions src/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -908,8 +908,8 @@ static jl_value_t *jl_deserialize_datatype(ios_t *s, int pos, jl_value_t **loc)
if (tag == 7) {
jl_svec_t *parameters = (jl_svec_t*)jl_deserialize_value(s, NULL);
dtv = jl_apply_type(dtv, parameters);
backref_list.items[pos] = dtv;
}
backref_list.items[pos] = dtv;
return dtv;
}
uint16_t nf = read_uint16(s);
Expand Down Expand Up @@ -1389,6 +1389,10 @@ void jl_deserialize_lambdas_from_mod(ios_t *s)

int jl_deserialize_verify_mod_list(ios_t *s)
{
if (!jl_main_module->uuid) {
jl_printf(JL_STDERR, "error: Main module uuid state is invalid for module deserialization.\n");
return 0;
}
while (1) {
size_t len = read_int32(s);
if (len == 0)
Expand All @@ -1399,15 +1403,15 @@ int jl_deserialize_verify_mod_list(ios_t *s)
uint64_t uuid = read_uint64(s);
jl_module_t *m = (jl_module_t*)jl_get_global(jl_main_module, jl_symbol(name));
if (!m) {
jl_printf(JL_STDERR, "Module %s must be loaded first\n", name);
jl_printf(JL_STDERR, "error: Module %s must be loaded first\n", name);
return 0;
}
if (!jl_is_module(m)) {
ios_close(s);
jl_errorf("typeassert: expected %s::Module", name);
}
if (m->uuid != uuid) {
jl_printf(JL_STDERR, "Module %s uuid did not match cache file\n", name);
jl_printf(JL_STDERR, "error: Module %s uuid did not match cache file\n", name);
return 0;
}
}
Expand All @@ -1424,6 +1428,7 @@ void jl_save_system_image_to_stream(ios_t *f)
int en = jl_gc_enable(0);
htable_reset(&backref_table, 250000);
arraylist_new(&reinit_list, 0);
backref_table_numel = 0;

// orphan old Base module if present
jl_base_module = (jl_module_t*)jl_get_global(jl_main_module, jl_symbol("Base"));
Expand Down Expand Up @@ -1732,6 +1737,7 @@ int jl_save_new_module(const char *fname, jl_module_t *mod)
jl_serialize_mod_list(&f);
htable_new(&backref_table, 5000);
ptrhash_put(&backref_table, jl_main_module, (void*)(uintptr_t)0);
backref_table_numel = 1;

int en = jl_gc_enable(0);
DUMP_MODES last_mode = mode;
Expand Down
1 change: 0 additions & 1 deletion src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@

#include "julia.h"
#include "julia_internal.h"
#include <stdio.h>

#ifdef __cplusplus
extern "C" {
Expand Down
3 changes: 2 additions & 1 deletion src/toplevel.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ jl_value_t *jl_eval_module_expr(jl_expr_t *ex)
jl_binding_t *b = jl_get_binding_wr(parent_module, name);
jl_declare_constant(b);
if (b->value != NULL && !jl_generating_output()) {
// suppress warning "replacing module Core.Inference" during bootstrapping
jl_printf(JL_STDERR, "Warning: replacing module %s\n", name->name);
}
jl_module_t *newm = jl_new_module(name);
Expand All @@ -130,7 +131,7 @@ jl_value_t *jl_eval_module_expr(jl_expr_t *ex)
jl_typeerror_type = NULL;
jl_methoderror_type = NULL;
jl_loaderror_type = NULL;
jl_current_task->tls = jl_nothing;
jl_current_task->tls = jl_nothing; // may contain an entry for :SOURCE_FILE that is not valid in the new base
}
// export all modules from Main
if (parent_module == jl_main_module)
Expand Down

0 comments on commit 6f55437

Please sign in to comment.