Skip to content

Commit

Permalink
reorganize and clean up interpreter code
Browse files Browse the repository at this point in the history
removes some cruft and makes the code better match the structure of valid IR
  • Loading branch information
JeffBezanson committed Nov 9, 2017
1 parent 6e31adb commit c47aaaa
Show file tree
Hide file tree
Showing 9 changed files with 366 additions and 363 deletions.
5 changes: 1 addition & 4 deletions base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2590,8 +2590,6 @@ function abstract_eval(@nospecialize(e), vtypes::VarTable, sv::InferenceState)
t = (length(e.args) == 1) ? Any : Void
elseif e.head === :copyast
t = abstract_eval(e.args[1], vtypes, sv)
elseif e.head === :inert
return abstract_eval_constant(e.args[1])
elseif e.head === :invoke
error("type inference data-flow error: tried to double infer a function")
elseif e.head === :boundscheck
Expand Down Expand Up @@ -2776,8 +2774,7 @@ issubstate(a::VarState, b::VarState) = (a.typ ⊑ b.typ && a.undef <= b.undef)
# Meta expression head, these generally can't be deleted even when they are
# in a dead branch but can be ignored when analyzing uses/liveness.
is_meta_expr_head(head::Symbol) =
(head === :inbounds || head === :boundscheck || head === :meta ||
head === :line || head === :simdloop)
(head === :inbounds || head === :boundscheck || head === :meta || head === :simdloop)
is_meta_expr(ex::Expr) = is_meta_expr_head(ex.head)

function tmerge(@nospecialize(typea), @nospecialize(typeb))
Expand Down
9 changes: 1 addition & 8 deletions src/ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -785,16 +785,9 @@ jl_value_t *jl_parse_eval_all(const char *fname,
}
jl_get_ptls_states()->world_age = jl_world_counter;
form = scm_to_julia(fl_ctx, expression, inmodule);
jl_sym_t *head = NULL;
if (jl_is_expr(form))
head = ((jl_expr_t*)form)->head;
JL_SIGATOMIC_END();
jl_get_ptls_states()->world_age = jl_world_counter;
if (head == jl_incomplete_sym)
jl_errorf("syntax: %s", jl_string_data(jl_exprarg(form, 0)));
else if (head == error_sym)
jl_interpret_toplevel_expr_in(inmodule, form, NULL, NULL);
else if (jl_is_linenode(form))
if (jl_is_linenode(form))
jl_lineno = jl_linenode_line(form);
else
result = jl_toplevel_eval_flex(inmodule, form, 1, 1);
Expand Down
2 changes: 0 additions & 2 deletions src/datatype.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,6 @@ void jl_compute_field_offsets(jl_datatype_t *st)
jl_errorf("type %s has field offset %d that exceeds the page size", jl_symbol_name(st->name->name), descsz);
}

extern int jl_boot_file_loaded;

JL_DLLEXPORT jl_datatype_t *jl_new_datatype(
jl_sym_t *name,
jl_module_t *module,
Expand Down
2 changes: 0 additions & 2 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ JL_DLLEXPORT const char* __asan_default_options() {
}
#endif

int jl_boot_file_loaded = 0;
size_t jl_page_size;

void jl_init_stack_limits(int ismaster)
Expand Down Expand Up @@ -696,7 +695,6 @@ void _julia_init(JL_IMAGE_SEARCH rel)

jl_load(jl_core_module, "boot.jl");
jl_get_builtin_hooks();
jl_boot_file_loaded = 1;
jl_init_box_caches();
}

Expand Down
Loading

0 comments on commit c47aaaa

Please sign in to comment.