Skip to content

Commit

Permalink
remove redundant jl_show entry point
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Apr 6, 2017
1 parent a8cb33b commit d199c9a
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 30 deletions.
2 changes: 1 addition & 1 deletion examples/embedding/embedding.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ int main()
jl_eval_string("this_function_does_not_exist()");

if (jl_exception_occurred()) {
jl_show(jl_stderr_obj(), jl_exception_occurred());
jl_call2(jl_get_function(jl_base_module, "show"), jl_stderr_obj(), jl_exception_occurred());
jl_printf(jl_stderr_stream(), "\n");
}

Expand Down
1 change: 0 additions & 1 deletion src/jlapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ JL_DLLEXPORT jl_value_t *jl_eval_string(const char *str)
jl_exception_clear();
}
JL_CATCH {
//jl_show(jl_stderr_obj(), jl_exception_in_transit);
r = NULL;
}
return r;
Expand Down
1 change: 0 additions & 1 deletion src/julia.h
Original file line number Diff line number Diff line change
Expand Up @@ -1662,7 +1662,6 @@ JL_DLLEXPORT JL_STREAM *jl_stdin_stream(void);
JL_DLLEXPORT JL_STREAM *jl_stderr_stream(void);

// showing and std streams
JL_DLLEXPORT void jl_show(jl_value_t *stream, jl_value_t *v);
JL_DLLEXPORT void jl_flush_cstdio(void);
JL_DLLEXPORT jl_value_t *jl_stdout_obj(void);
JL_DLLEXPORT jl_value_t *jl_stderr_obj(void);
Expand Down
24 changes: 1 addition & 23 deletions src/rtutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,27 +439,6 @@ JL_DLLEXPORT jl_value_t *jl_stderr_obj(void)
return stderr_obj;
}

static jl_function_t *jl_show_gf=NULL;

JL_DLLEXPORT void jl_show(jl_value_t *stream, jl_value_t *v)
{
if (jl_base_module) {
if (jl_show_gf == NULL) {
jl_show_gf = (jl_function_t*)jl_get_global(jl_base_module, jl_symbol("show"));
}
if (jl_show_gf==NULL || stream==NULL) {
jl_printf(JL_STDERR, " could not show value of type %s",
jl_symbol_name(((jl_datatype_t*)jl_typeof(v))->name->name));
return;
}
jl_value_t *args[3] = {jl_show_gf,stream,v};
size_t last_age = jl_get_ptls_states()->world_age;
jl_get_ptls_states()->world_age = jl_get_world_counter();
jl_apply(args, 3);
jl_get_ptls_states()->world_age = last_age;
}
}

// toys for debugging ---------------------------------------------------------

static size_t jl_show_svec(JL_STREAM *out, jl_svec_t *t, const char *head, const char *opn, const char *cls)
Expand Down Expand Up @@ -871,8 +850,7 @@ static size_t jl_static_show_x_(JL_STREAM *out, jl_value_t *v, jl_datatype_t *vt

static size_t jl_static_show_x(JL_STREAM *out, jl_value_t *v, struct recur_list *depth)
{
// mimic jl_show, but never calling a julia method and
// never allocate through julia gc
// show values without calling a julia method or allocating through the GC
if (v == NULL) {
return jl_printf(out, "#<null>");
}
Expand Down
2 changes: 0 additions & 2 deletions src/toplevel.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,6 @@ static jl_method_instance_t *jl_new_thunk(jl_code_info_t *src, jl_module_t *modu
jl_value_t *jl_toplevel_eval_flex(jl_value_t *e, int fast, int expanded)
{
jl_ptls_t ptls = jl_get_ptls_states();
//jl_show(ex);
//jl_printf(JL_STDOUT, "\n");
if (!jl_is_expr(e)) {
if (jl_is_linenode(e)) {
jl_lineno = jl_linenode_line(e);
Expand Down
4 changes: 2 additions & 2 deletions ui/repl.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static int exec_program(char *program)
jl_value_t *errs = jl_stderr_obj();
jl_value_t *e = ptls->exception_in_transit;
// Manually save and restore the backtrace so that we print the original
// one instead of the one caused by `jl_show`.
// one instead of the one caused by `show`.
// We can't use safe_restore since that will cause any error
// (including the ones that would have been caught) to abort.
uintptr_t *volatile bt_data = NULL;
Expand All @@ -61,7 +61,7 @@ static int exec_program(char *program)
if (errs) {
bt_data = (uintptr_t*)malloc(bt_size * sizeof(void*));
memcpy(bt_data, ptls->bt_data, bt_size * sizeof(void*));
jl_show(errs, e);
jl_call2(jl_get_function(jl_base_module, "show"), errs, e);
jl_printf(JL_STDERR, "\n");
free(bt_data);
}
Expand Down

0 comments on commit d199c9a

Please sign in to comment.