ruby-changes:23857
From: ko1 <ko1@a...>
Date: Mon, 4 Jun 2012 16:24:56 +0900 (JST)
Subject: [ruby-changes:23857] ko1:r35908 (trunk): * vm_insnhelper.h: remove magical code "lfp[0] & 0x02".
ko1 2012-06-04 16:24:44 +0900 (Mon, 04 Jun 2012) New Revision: 35908 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35908 Log: * vm_insnhelper.h: remove magical code "lfp[0] & 0x02". Current VM doesn't use this bit. * vm_core.h (RUBY_VM_GET_BLOCK_PTR): added. * eval.c (rb_block_given_p): use RUBY_VM_GET_BLOCK_PTR(). * vm_eval.c (rb_f_block_given_p): ditto. Modified files: trunk/ChangeLog trunk/eval.c trunk/vm_core.h trunk/vm_eval.c trunk/vm_insnhelper.h Index: ChangeLog =================================================================== --- ChangeLog (revision 35907) +++ ChangeLog (revision 35908) @@ -1,3 +1,14 @@ +Mon Jun 4 16:13:00 2012 Koichi Sasada <ko1@a...> + + * vm_insnhelper.h: remove magical code "lfp[0] & 0x02". + Current VM doesn't use this bit. + + * vm_core.h (RUBY_VM_GET_BLOCK_PTR): added. + + * eval.c (rb_block_given_p): use RUBY_VM_GET_BLOCK_PTR(). + + * vm_eval.c (rb_f_block_given_p): ditto. + Mon Jun 4 15:39:33 2012 Nobuyoshi Nakada <nobu@r...> * win32/win32.c (constat_apply): apply VT100 functions. Index: vm_core.h =================================================================== --- vm_core.h (revision 35907) +++ vm_core.h (revision 35908) @@ -622,6 +622,8 @@ #define GC_GUARDED_PTR_REF(p) ((void *)(((VALUE)(p)) & ~0x03)) #define GC_GUARDED_PTR_P(p) (((VALUE)(p)) & 0x01) +#define RUBY_VM_GET_BLOCK_PTR(cfp) ((rb_block_t *)(GC_GUARDED_PTR_REF((cfp)->lfp[0]))) + #define RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp) ((cfp)+1) #define RUBY_VM_NEXT_CONTROL_FRAME(cfp) ((cfp)-1) #define RUBY_VM_END_CONTROL_FRAME(th) \ Index: vm_eval.c =================================================================== --- vm_eval.c (revision 35907) +++ vm_eval.c (revision 35908) @@ -1660,9 +1660,7 @@ rb_control_frame_t *cfp = th->cfp; cfp = vm_get_ruby_level_caller_cfp(th, RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp)); - if (cfp != 0 && - (cfp->lfp[0] & 0x02) == 0 && - GC_GUARDED_PTR_REF(cfp->lfp[0])) { + if (cfp != 0 && RUBY_VM_GET_BLOCK_PTR(cfp)) { return Qtrue; } else { Index: eval.c =================================================================== --- eval.c (revision 35907) +++ eval.c (revision 35908) @@ -604,8 +604,7 @@ { rb_thread_t *th = GET_THREAD(); - if ((th->cfp->lfp[0] & 0x02) == 0 && - GC_GUARDED_PTR_REF(th->cfp->lfp[0])) { + if (RUBY_VM_GET_BLOCK_PTR(th->cfp)) { return TRUE; } else { Index: vm_insnhelper.h =================================================================== --- vm_insnhelper.h (revision 35907) +++ vm_insnhelper.h (revision 35908) @@ -170,9 +170,7 @@ } \ } while (0) -#define GET_BLOCK_PTR() \ - ((rb_block_t *)(GC_GUARDED_PTR_REF(GET_LFP()[0] & \ - ((GET_LFP()[0] & 0x02) - 0x02)))) +#define GET_BLOCK_PTR() ((rb_block_t *)(GC_GUARDED_PTR_REF(GET_LFP()[0]))) /**********************************************************/ /* deal with control flow 3: exception */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/