ruby-changes:12279
From: shyouhei <ko1@a...>
Date: Mon, 6 Jul 2009 16:26:03 +0900 (JST)
Subject: [ruby-changes:12279] Ruby:r23972 (ruby_1_8_7): merge revision(s) 23096:
shyouhei 2009-07-06 16:25:47 +0900 (Mon, 06 Jul 2009) New Revision: 23972 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23972 Log: merge revision(s) 23096: * 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_7/ChangeLog branches/ruby_1_8_7/eval.c branches/ruby_1_8_7/version.h Index: ruby_1_8_7/ChangeLog =================================================================== --- ruby_1_8_7/ChangeLog (revision 23971) +++ ruby_1_8_7/ChangeLog (revision 23972) @@ -1,3 +1,10 @@ +Mon Jul 6 16:01:38 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. + Sun Jul 5 03:50:52 2009 Nobuyoshi Nakada <nobu@r...> * lib/test/unit.rb: use Kernel.exit to get rid of using Index: ruby_1_8_7/version.h =================================================================== --- ruby_1_8_7/version.h (revision 23971) +++ ruby_1_8_7/version.h (revision 23972) @@ -1,15 +1,15 @@ #define RUBY_VERSION "1.8.7" -#define RUBY_RELEASE_DATE "2009-07-05" +#define RUBY_RELEASE_DATE "2009-07-06" #define RUBY_VERSION_CODE 187 -#define RUBY_RELEASE_CODE 20090705 -#define RUBY_PATCHLEVEL 178 +#define RUBY_RELEASE_CODE 20090706 +#define RUBY_PATCHLEVEL 179 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 #define RUBY_VERSION_TEENY 7 #define RUBY_RELEASE_YEAR 2009 #define RUBY_RELEASE_MONTH 7 -#define RUBY_RELEASE_DAY 5 +#define RUBY_RELEASE_DAY 6 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; Index: ruby_1_8_7/eval.c =================================================================== --- ruby_1_8_7/eval.c (revision 23971) +++ ruby_1_8_7/eval.c (revision 23972) @@ -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)); @@ -2962,6 +2963,7 @@ goto finish; \ } while (0) + eval_check_tick(); again: if (!node) RETURN(Qnil); @@ -5612,6 +5614,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 @@ -5843,7 +5856,6 @@ NODE *b2; /* OK */ volatile VALUE result = Qnil; int itr; - static int tick; TMP_PROTECT; volatile int safe = -1; @@ -5862,11 +5874,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; @@ -6601,14 +6609,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/