Skip to content
Permalink
Browse files
Do not funcall() Exception#set_backtrace from runtime.
This change reduce flexibility but makes mruby simpler and faster.
  • Loading branch information
matz committed Feb 15, 2017
1 parent 8efa7b0 commit 1e57fefbcf1ab327113699eebf2b08d9ec450dfe
Showing 1 changed file with 10 additions and 11 deletions.
@@ -202,12 +202,9 @@ exc_get_backtrace(mrb_state *mrb, mrb_value exc)
return backtrace;
}

static mrb_value
exc_set_backtrace(mrb_state *mrb, mrb_value exc)
static void
set_backtrace(mrb_state *mrb, mrb_value exc, mrb_value backtrace)
{
mrb_value backtrace;

mrb_get_args(mrb, "o", &backtrace);
if (!mrb_array_p(backtrace)) {
type_err:
mrb_raise(mrb, E_TYPE_ERROR, "backtrace must be Array of String");
@@ -222,7 +219,15 @@ exc_set_backtrace(mrb_state *mrb, mrb_value exc)
}
}
mrb_iv_set(mrb, exc, mrb_intern_lit(mrb, "backtrace"), backtrace);
}

static mrb_value
exc_set_backtrace(mrb_state *mrb, mrb_value exc)
{
mrb_value backtrace;

mrb_get_args(mrb, "o", &backtrace);
set_backtrace(mrb, exc, backtrace);
return backtrace;
}

@@ -253,12 +258,6 @@ exc_debug_info(mrb_state *mrb, struct RObject *exc)
}
}

static void
set_backtrace(mrb_state *mrb, mrb_value info, mrb_value bt)
{
mrb_funcall(mrb, info, "set_backtrace", 1, bt);
}

static mrb_bool
have_backtrace(mrb_state *mrb, struct RObject *exc)
{

0 comments on commit 1e57fef

Please sign in to comment.