summaryrefslogtreecommitdiffhomepage
path: root/src/error.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-02-15 11:59:47 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-02-15 11:59:47 +0900
commit8efa7b00df2842eaff31cdabc95651a856e40549 (patch)
tree97463ecf5a55ab26a85303fc126f700dd557e9a5 /src/error.c
parent0376d4d4c63140abfb45d119514a7049d286c141 (diff)
downloadmruby-8efa7b00df2842eaff31cdabc95651a856e40549.tar.gz
mruby-8efa7b00df2842eaff31cdabc95651a856e40549.zip
Preallocate SystemStackError; ref #3421
Diffstat (limited to 'src/error.c')
-rw-r--r--src/error.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/error.c b/src/error.c
index a71ee548f..7916ca65b 100644
--- a/src/error.c
+++ b/src/error.c
@@ -532,7 +532,7 @@ mrb_no_method_error(mrb_state *mrb, mrb_sym id, mrb_value args, char const* fmt,
void
mrb_init_exception(mrb_state *mrb)
{
- struct RClass *exception, *runtime_error, *script_error;
+ struct RClass *exception, *runtime_error, *script_error, *stack_error;
mrb->eException_class = exception = mrb_define_class(mrb, "Exception", mrb->object_class); /* 15.2.22 */
MRB_SET_INSTANCE_TT(exception, MRB_TT_EXCEPTION);
@@ -553,5 +553,6 @@ mrb_init_exception(mrb_state *mrb)
#endif
script_error = mrb_define_class(mrb, "ScriptError", mrb->eException_class); /* 15.2.37 */
mrb_define_class(mrb, "SyntaxError", script_error); /* 15.2.38 */
- mrb_define_class(mrb, "SystemStackError", exception);
+ stack_error = mrb_define_class(mrb, "SystemStackError", exception);
+ mrb->stack_err = mrb_obj_ptr(mrb_exc_new_str_lit(mrb, stack_error, "stack level too deep"));
}