ruby-changes:11471
From: nobu <ko1@a...>
Date: Mon, 30 Mar 2009 12:13:10 +0900 (JST)
Subject: [ruby-changes:11471] Ruby:r23096 (ruby_1_8): * eval.c (rb_eval): checks for interrupt, stack and finalizers too.
nobu 2009-03-30 12:12:08 +0900 (Mon, 30 Mar 2009) New Revision: 23096 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23096 Log: * eval.c (rb_eval): checks for interrupt, stack and finalizers too. [ruby-dev:38208], [Bug #1329] * eval.c (eval): replaces the message if frozen. Modified files: branches/ruby_1_8/ChangeLog branches/ruby_1_8/eval.c branches/ruby_1_8/version.h Index: ruby_1_8/ChangeLog =================================================================== --- ruby_1_8/ChangeLog (revision 23095) +++ ruby_1_8/ChangeLog (revision 23096) @@ -1,3 +1,10 @@ +Mon Mar 30 12:12:07 2009 Nobuyoshi Nakada <nobu@r...> + + * eval.c (rb_eval): checks for interrupt, stack and finalizers too. + [ruby-dev:38208], [Bug #1329] + + * eval.c (eval): replaces the message if frozen. + Sat Mar 28 04:31:36 2009 Nobuyoshi Nakada <nobu@r...> * ext/dl/{mkcall,mkcallback,mkcbtable}.rb: no needs of mkmf. Index: ruby_1_8/version.h =================================================================== --- ruby_1_8/version.h (revision 23095) +++ ruby_1_8/version.h (revision 23096) @@ -1,7 +1,7 @@ #define RUBY_VERSION "1.8.8" -#define RUBY_RELEASE_DATE "2009-03-28" +#define RUBY_RELEASE_DATE "2009-03-30" #define RUBY_VERSION_CODE 188 -#define RUBY_RELEASE_CODE 20090328 +#define RUBY_RELEASE_CODE 20090330 #define RUBY_PATCHLEVEL -1 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 8 #define RUBY_RELEASE_YEAR 2009 #define RUBY_RELEASE_MONTH 3 -#define RUBY_RELEASE_DAY 28 +#define RUBY_RELEASE_DAY 30 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; Index: ruby_1_8/eval.c =================================================================== --- ruby_1_8/eval.c (revision 23095) +++ ruby_1_8/eval.c (revision 23096) @@ -233,6 +233,7 @@ static void rb_f_END _((void)); static VALUE rb_f_block_given_p _((void)); static VALUE block_pass _((VALUE,NODE*)); +static void eval_check_tick _((void)); VALUE rb_cMethod; static VALUE method_call _((int, VALUE*, VALUE)); @@ -2998,6 +2999,7 @@ goto finish; \ } while (0) + eval_check_tick(); again: if (!node) RETURN(Qnil); @@ -5660,6 +5662,17 @@ } } +static void +eval_check_tick() +{ + static int tick; + if ((++tick & 0xff) == 0) { + CHECK_INTS; /* better than nothing */ + stack_check(); + rb_gc_finalize_deferred(); + } +} + static int last_call_status; #define CSTAT_PRIV 1 @@ -5891,7 +5904,6 @@ NODE *b2; /* OK */ volatile VALUE result = Qnil; int itr; - static int tick; TMP_PROTECT; volatile int safe = -1; @@ -5910,11 +5922,7 @@ break; } - if ((++tick & 0xff) == 0) { - CHECK_INTS; /* better than nothing */ - stack_check(); - rb_gc_finalize_deferred(); - } + eval_check_tick(); if (argc < 0) { VALUE tmp; VALUE *nargv; @@ -6650,14 +6658,22 @@ if (state == TAG_RAISE) { if (strcmp(file, "(eval)") == 0) { VALUE mesg, errat, bt2; + ID id_mesg; + id_mesg = rb_intern("mesg"); errat = get_backtrace(ruby_errinfo); - mesg = rb_attr_get(ruby_errinfo, rb_intern("mesg")); + mesg = rb_attr_get(ruby_errinfo, id_mesg); if (!NIL_P(errat) && TYPE(errat) == T_ARRAY && (bt2 = backtrace(-2), RARRAY_LEN(bt2) > 0)) { if (!NIL_P(mesg) && TYPE(mesg) == T_STRING) { - rb_str_update(mesg, 0, 0, rb_str_new2(": ")); - rb_str_update(mesg, 0, 0, RARRAY_PTR(errat)[0]); + if (OBJ_FROZEN(mesg)) { + VALUE m = rb_str_cat(rb_str_dup(RARRAY_PTR(errat)[0]), ": ", 2); + rb_ivar_set(ruby_errinfo, id_mesg, rb_str_append(m, mesg)); + } + else { + rb_str_update(mesg, 0, 0, rb_str_new2(": ")); + rb_str_update(mesg, 0, 0, RARRAY_PTR(errat)[0]); + } } RARRAY_PTR(errat)[0] = RARRAY_PTR(bt2)[0]; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/