From e9e08a5b105a3ea8ea54a856e977376d2dcd1ab9 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 18 Jul 2015 10:52:19 +0000 Subject: gc.c: reduce EXEC_TAGs * gc.c (run_finalizer): set and restore safe level here to reduce nested EXEC_TAGs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- gc.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'gc.c') diff --git a/gc.c b/gc.c index 2bb5f7a5b0..195be83ec6 100644 --- a/gc.c +++ b/gc.c @@ -2551,34 +2551,32 @@ static VALUE run_single_final(VALUE arg) { VALUE *args = (VALUE *)arg; - rb_eval_cmd(args[0], args[1], (int)args[2]); - return Qnil; + + return rb_check_funcall(args[0], idCall, 1, args+1); } static void run_finalizer(rb_objspace_t *objspace, VALUE obj, VALUE table) { long i; - int status; - VALUE args[3]; - VALUE objid = nonspecial_obj_id(obj); + VALUE args[2]; + const int safe = rb_safe_level(); + const VALUE errinfo = rb_errinfo(); - if (RARRAY_LEN(table) > 0) { - args[1] = rb_obj_freeze(rb_ary_new3(1, objid)); - } - else { - args[1] = 0; - } + args[1] = nonspecial_obj_id(obj); - args[2] = (VALUE)rb_safe_level(); for (i=0; i