Skip to content

Commit

Permalink
use li->roots instead of module constant table
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Jan 12, 2016
1 parent 305890a commit 34d8b8e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 25 deletions.
23 changes: 10 additions & 13 deletions src/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,6 @@ static void jl_serialize_module(ios_t *s, jl_module_t *m)
jl_serialize_value(s, (jl_value_t*)m->usings.items[i]);
}
}
jl_serialize_value(s, m->constant_table);
write_uint8(s, m->istopmod);
write_uint8(s, m->std_imports);
write_uint64(s, m->uuid);
Expand Down Expand Up @@ -1456,8 +1455,6 @@ static jl_value_t *jl_deserialize_value_(ios_t *s, jl_value_t *vtag, jl_value_t
m->usings.items[i] = jl_deserialize_value(s, (jl_value_t**)&m->usings.items[i]);
i++;
}
m->constant_table = (jl_array_t*)jl_deserialize_value(s, (jl_value_t**)&m->constant_table);
if (m->constant_table != NULL) jl_gc_wb(m, m->constant_table);
m->istopmod = read_uint8(s);
m->std_imports = read_uint8(s);
m->uuid = read_uint64(s);
Expand Down Expand Up @@ -1964,11 +1961,11 @@ JL_DLLEXPORT jl_value_t *jl_ast_rettype(jl_lambda_info_t *li, jl_value_t *ast)
JL_LOCK(dump); // Might GC
DUMP_MODES last_mode = mode;
mode = MODE_AST;
if (li->module->constant_table == NULL) {
li->module->constant_table = jl_alloc_cell_1d(0);
jl_gc_wb(li->module, li->module->constant_table);
if (li->def->roots == NULL) {
li->def->roots = jl_alloc_cell_1d(0);
jl_gc_wb(li->def, li->def->roots);
}
tree_literal_values = li->module->constant_table;
tree_literal_values = li->def->roots;
ios_t src;
jl_array_t *bytes = (jl_array_t*)ast;
ios_mem(&src, 0);
Expand Down Expand Up @@ -1996,11 +1993,11 @@ JL_DLLEXPORT jl_value_t *jl_compress_ast(jl_lambda_info_t *li, jl_value_t *ast)
jl_module_t *last_tem = tree_enclosing_module;
int en = jl_gc_enable(0); // Might GC

if (li->module->constant_table == NULL) {
li->module->constant_table = jl_alloc_cell_1d(0);
jl_gc_wb(li->module, li->module->constant_table);
if (li->def->roots == NULL) {
li->def->roots = jl_alloc_cell_1d(0);
jl_gc_wb(li->def, li->def->roots);
}
tree_literal_values = li->module->constant_table;
tree_literal_values = li->def->roots;
tree_enclosing_module = li->module;
li->capt = (jl_value_t*)jl_lam_capt((jl_expr_t*)ast);
jl_gc_wb(li, li->capt);
Expand All @@ -2013,7 +2010,7 @@ JL_DLLEXPORT jl_value_t *jl_compress_ast(jl_lambda_info_t *li, jl_value_t *ast)

jl_value_t *v = (jl_value_t*)jl_takebuf_array(&dest);
if (jl_array_len(tree_literal_values) == 0 && last_tlv == NULL) {
li->module->constant_table = NULL;
li->def->roots = NULL;
}
tree_literal_values = last_tlv;
tree_enclosing_module = last_tem;
Expand All @@ -2032,7 +2029,7 @@ JL_DLLEXPORT jl_value_t *jl_uncompress_ast(jl_lambda_info_t *li, jl_value_t *dat
DUMP_MODES last_mode = mode;
mode = MODE_AST;
jl_array_t *bytes = (jl_array_t*)data;
tree_literal_values = li->module->constant_table;
tree_literal_values = li->def->roots;
tree_enclosing_module = li->module;
ios_t src;
ios_mem(&src, 0);
Expand Down
4 changes: 0 additions & 4 deletions src/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1711,10 +1711,6 @@ NOINLINE static int gc_mark_module(jl_module_t *m, int d)
for(i=0; i < m->usings.len; i++) {
refyoung |= gc_push_root(m->usings.items[i], d);
}
if (m->constant_table) {
verify_parent1("module", m, &m->constant_table, "constant_table");
refyoung |= gc_push_root(m->constant_table, d);
}

if (m->parent) {
refyoung |= gc_push_root(m->parent, d);
Expand Down
6 changes: 0 additions & 6 deletions src/gf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1812,12 +1812,6 @@ static void _compile_all_enq(jl_value_t *v, htable_t *h, jl_array_t *found, jl_f
}
}
}
if (m->constant_table != NULL) {
for(i=0; i < jl_array_len(m->constant_table); i++) {
jl_value_t *v = jl_cellref(m->constant_table, i);
_compile_all_enq(v, h, found, 0);
}
}
}
jl_datatype_t *dt = (jl_datatype_t*)jl_typeof(v);
size_t i, nf = jl_datatype_nfields(dt);
Expand Down
1 change: 0 additions & 1 deletion src/julia.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,6 @@ typedef struct _jl_module_t {
struct _jl_module_t *parent;
htable_t bindings;
arraylist_t usings; // modules with all bindings potentially imported
jl_array_t *constant_table;
jl_function_t *call_func; // cached lookup of `call` within this module
uint8_t istopmod;
uint8_t std_imports; // only for temporarily deprecating `importall Base.Operators`
Expand Down
1 change: 0 additions & 1 deletion src/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ JL_DLLEXPORT jl_module_t *jl_new_module(jl_sym_t *name)
assert(jl_is_symbol(name));
m->name = name;
m->parent = NULL;
m->constant_table = NULL;
m->call_func = NULL;
m->istopmod = 0;
m->std_imports = 0;
Expand Down

0 comments on commit 34d8b8e

Please sign in to comment.