* struct.c (rb_struct_s_members): wrong call of struct_members.

[ruby-dev:24333]

* eval.c (proc_invoke): propagate DVAR_DONT_RECYCLE on termination
  to avoid double call to rb_gc_force_recycle(). [ruby-dev:24311]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2004-09-24 16:58:51 +00:00
Родитель 7c29bcfb03
Коммит 08f84dcf44
3 изменённых файлов: 36 добавлений и 6 удалений

Просмотреть файл

@ -1,3 +1,13 @@
Sat Sep 25 01:52:49 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* struct.c (rb_struct_s_members): wrong call of struct_members.
[ruby-dev:24333]
Fri Sep 24 16:09:42 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (proc_invoke): propagate DVAR_DONT_RECYCLE on termination
to avoid double call to rb_gc_force_recycle(). [ruby-dev:24311]
Fri Sep 24 08:29:45 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (rb_parser_append_print): should handle prelude.

12
eval.c
Просмотреть файл

@ -8090,6 +8090,14 @@ proc_invoke(proc, args, self, klass)
POP_ITER();
ruby_block = old_block;
ruby_wrapper = old_wrapper;
if (FL_TEST(ruby_dyna_vars, DVAR_DONT_RECYCLE)) {
struct RVarmap *vars;
for (vars = old_dvars; vars; vars = vars->next) {
if (FL_TEST(vars, DVAR_DONT_RECYCLE)) break;
FL_SET(vars, DVAR_DONT_RECYCLE);
}
}
ruby_dyna_vars = old_dvars;
if (proc_safe_level_p(proc)) ruby_safe_level = safe;
@ -12136,6 +12144,7 @@ rb_callcc(self)
volatile rb_thread_t th_save;
struct tag *tag;
struct RVarmap *vars;
struct BLOCK *blk;
THREAD_ALLOC(th);
cont = Data_Wrap_Struct(rb_cCont, thread_mark, thread_free, th);
@ -12146,11 +12155,10 @@ rb_callcc(self)
}
th->thread = curr_thread->thread;
for (vars = th->dyna_vars; vars; vars = vars->next) {
for (vars = ruby_dyna_vars; vars; vars = vars->next) {
if (FL_TEST(vars, DVAR_DONT_RECYCLE)) break;
FL_SET(vars, DVAR_DONT_RECYCLE);
}
th_save = th;
if (THREAD_SAVE_CONTEXT(th)) {
return th_save->result;

Просмотреть файл

@ -33,11 +33,23 @@ rb_struct_iv_get(c, name)
}
}
static VALUE
struct_s_members(klass)
VALUE klass;
{
VALUE members = rb_struct_iv_get(klass, "__members__");
if (NIL_P(members)) {
rb_bug("non-initialized struct");
}
return members;
}
static VALUE
struct_members(s)
VALUE s;
{
VALUE members = rb_struct_iv_get(rb_obj_class(s), "__members__");
VALUE members = struct_s_members(rb_obj_class(s));
if (NIL_P(members)) {
rb_bug("non-initialized struct");
@ -50,13 +62,13 @@ struct_members(s)
}
static VALUE
rb_struct_s_members(obj)
VALUE obj;
rb_struct_s_members(klass)
VALUE klass;
{
VALUE members, ary;
VALUE *p, *pend;
members = struct_members(obj);
members = struct_s_members(klass);
ary = rb_ary_new2(RARRAY(members)->len);
p = RARRAY(members)->ptr; pend = p + RARRAY(members)->len;
while (p < pend) {