From: "H.Yamamoto" Date: 2004-09-10T23:05:35+09:00 Subject: Re: [PATCH] dir.c --- Dir.chdir error handling nobu.nokada@softhome.net wrote: (2004/09/10 10:22) >> VALUE v = ...... >> >> /* GC happened!! before assigned to volatile */ >> >> rb_ensure(......, v); /* v is volatile VALUE */ >> >> is safe? > >In that case, v should be stored somewhere in the function and >subsequent function calls, perhaps on the stack or in a >register, anyway possible to be restored and scannable by GC. >Otherwise it can't be used at calling rb_ensure(). So I think >it's safe. > >There is a potential danger only when the VALUE is no longer >used after any use of its internal pointer. Since data2 in >rb_ensure() is used only once at calling e_proc, it may not be >a "barrier" in the proc and the proc has to keep it in mind. I understand. Well, in ruby.h many VALUE arguments exists, should only 4th argument of rb_rescue2 be volatile? I'm not sure which one should be volatile, so I hope nobu or matz decides it. VALUE rb_each _((VALUE)); VALUE rb_yield _((VALUE)); VALUE rb_yield_values __((int n, ...)); VALUE rb_yield_splat _((VALUE)); int rb_block_given_p _((void)); VALUE rb_iterate _((VALUE(*)(VALUE),VALUE,VALUE(*)(ANYARGS),VALUE)); VALUE rb_rescue _((VALUE(*)(ANYARGS),VALUE,VALUE(*)(ANYARGS),VALUE)); VALUE rb_rescue2 __((VALUE(*)(ANYARGS),VALUE,VALUE(*)(ANYARGS),VALUE,...)); VALUE rb_ensure _((VALUE(*)(ANYARGS),VALUE,VALUE(*)(ANYARGS),VALUE)); VALUE rb_catch _((const char*,VALUE(*)(ANYARGS),VALUE)); NORETURN(void rb_throw _((const char*,VALUE)));