diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-06-04 07:24:44 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-06-04 07:24:44 +0000 |
commit | 06513cc1cf5bbe1e23f871f920df7e2b7b793d9d (patch) | |
tree | 1dcf0ad338e0363cbf89f83c6b36b280fa40e49f | |
parent | 82aa43407ca3f4096ec2be2a13869fb584775952 (diff) |
* 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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | eval.c | 3 | ||||
-rw-r--r-- | vm_core.h | 2 | ||||
-rw-r--r-- | vm_eval.c | 4 | ||||
-rw-r--r-- | vm_insnhelper.h | 4 |
5 files changed, 16 insertions, 8 deletions
@@ -1,3 +1,14 @@ +Mon Jun 4 16:13:00 2012 Koichi Sasada <ko1@atdot.net> + + * 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@ruby-lang.org> * win32/win32.c (constat_apply): apply VT100 functions. @@ -604,8 +604,7 @@ rb_block_given_p(void) { 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 { @@ -622,6 +622,8 @@ typedef rb_control_frame_t * #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) \ @@ -1660,9 +1660,7 @@ rb_f_block_given_p(void) 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 { diff --git a/vm_insnhelper.h b/vm_insnhelper.h index 050b8d8ae0..97e2b1e2ba 100644 --- a/vm_insnhelper.h +++ b/vm_insnhelper.h @@ -170,9 +170,7 @@ extern VALUE ruby_vm_const_missing_count; } \ } 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 */ |