mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* eval.c (rb_eval): checks for interrupt, stack and finalizers too.
[ruby-dev:38208], [Bug #1329] * eval.c (eval): replaces the message if frozen. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@23096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5f79c781e3
commit
a1b9ce96e9
3 changed files with 35 additions and 12 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
Mon Mar 30 12:12:07 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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@ruby-lang.org>
|
Sat Mar 28 04:31:36 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* ext/dl/{mkcall,mkcallback,mkcbtable}.rb: no needs of mkmf.
|
* ext/dl/{mkcall,mkcallback,mkcbtable}.rb: no needs of mkmf.
|
||||||
|
|
30
eval.c
30
eval.c
|
@ -233,6 +233,7 @@ static VALUE rb_f_binding _((VALUE));
|
||||||
static void rb_f_END _((void));
|
static void rb_f_END _((void));
|
||||||
static VALUE rb_f_block_given_p _((void));
|
static VALUE rb_f_block_given_p _((void));
|
||||||
static VALUE block_pass _((VALUE,NODE*));
|
static VALUE block_pass _((VALUE,NODE*));
|
||||||
|
static void eval_check_tick _((void));
|
||||||
|
|
||||||
VALUE rb_cMethod;
|
VALUE rb_cMethod;
|
||||||
static VALUE method_call _((int, VALUE*, VALUE));
|
static VALUE method_call _((int, VALUE*, VALUE));
|
||||||
|
@ -2998,6 +2999,7 @@ rb_eval(self, n)
|
||||||
goto finish; \
|
goto finish; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
eval_check_tick();
|
||||||
again:
|
again:
|
||||||
if (!node) RETURN(Qnil);
|
if (!node) RETURN(Qnil);
|
||||||
|
|
||||||
|
@ -5660,6 +5662,17 @@ stack_check()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
static int last_call_status;
|
||||||
|
|
||||||
#define CSTAT_PRIV 1
|
#define CSTAT_PRIV 1
|
||||||
|
@ -5891,7 +5904,6 @@ rb_call0(klass, recv, id, oid, argc, argv, body, flags)
|
||||||
NODE *b2; /* OK */
|
NODE *b2; /* OK */
|
||||||
volatile VALUE result = Qnil;
|
volatile VALUE result = Qnil;
|
||||||
int itr;
|
int itr;
|
||||||
static int tick;
|
|
||||||
TMP_PROTECT;
|
TMP_PROTECT;
|
||||||
volatile int safe = -1;
|
volatile int safe = -1;
|
||||||
|
|
||||||
|
@ -5910,11 +5922,7 @@ rb_call0(klass, recv, id, oid, argc, argv, body, flags)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((++tick & 0xff) == 0) {
|
eval_check_tick();
|
||||||
CHECK_INTS; /* better than nothing */
|
|
||||||
stack_check();
|
|
||||||
rb_gc_finalize_deferred();
|
|
||||||
}
|
|
||||||
if (argc < 0) {
|
if (argc < 0) {
|
||||||
VALUE tmp;
|
VALUE tmp;
|
||||||
VALUE *nargv;
|
VALUE *nargv;
|
||||||
|
@ -6650,15 +6658,23 @@ eval(self, src, scope, file, line)
|
||||||
if (state == TAG_RAISE) {
|
if (state == TAG_RAISE) {
|
||||||
if (strcmp(file, "(eval)") == 0) {
|
if (strcmp(file, "(eval)") == 0) {
|
||||||
VALUE mesg, errat, bt2;
|
VALUE mesg, errat, bt2;
|
||||||
|
ID id_mesg;
|
||||||
|
|
||||||
|
id_mesg = rb_intern("mesg");
|
||||||
errat = get_backtrace(ruby_errinfo);
|
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 &&
|
if (!NIL_P(errat) && TYPE(errat) == T_ARRAY &&
|
||||||
(bt2 = backtrace(-2), RARRAY_LEN(bt2) > 0)) {
|
(bt2 = backtrace(-2), RARRAY_LEN(bt2) > 0)) {
|
||||||
if (!NIL_P(mesg) && TYPE(mesg) == T_STRING) {
|
if (!NIL_P(mesg) && TYPE(mesg) == T_STRING) {
|
||||||
|
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, rb_str_new2(": "));
|
||||||
rb_str_update(mesg, 0, 0, RARRAY_PTR(errat)[0]);
|
rb_str_update(mesg, 0, 0, RARRAY_PTR(errat)[0]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
RARRAY_PTR(errat)[0] = RARRAY_PTR(bt2)[0];
|
RARRAY_PTR(errat)[0] = RARRAY_PTR(bt2)[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#define RUBY_VERSION "1.8.8"
|
#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_VERSION_CODE 188
|
||||||
#define RUBY_RELEASE_CODE 20090328
|
#define RUBY_RELEASE_CODE 20090330
|
||||||
#define RUBY_PATCHLEVEL -1
|
#define RUBY_PATCHLEVEL -1
|
||||||
|
|
||||||
#define RUBY_VERSION_MAJOR 1
|
#define RUBY_VERSION_MAJOR 1
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
#define RUBY_VERSION_TEENY 8
|
#define RUBY_VERSION_TEENY 8
|
||||||
#define RUBY_RELEASE_YEAR 2009
|
#define RUBY_RELEASE_YEAR 2009
|
||||||
#define RUBY_RELEASE_MONTH 3
|
#define RUBY_RELEASE_MONTH 3
|
||||||
#define RUBY_RELEASE_DAY 28
|
#define RUBY_RELEASE_DAY 30
|
||||||
|
|
||||||
#ifdef RUBY_EXTERN
|
#ifdef RUBY_EXTERN
|
||||||
RUBY_EXTERN const char ruby_version[];
|
RUBY_EXTERN const char ruby_version[];
|
||||||
|
|
Loading…
Add table
Reference in a new issue