mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
82aa43407c
commit
06513cc1cf
5 changed files with 16 additions and 8 deletions
11
ChangeLog
11
ChangeLog
|
@ -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.
|
||||
|
|
3
eval.c
3
eval.c
|
@ -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 {
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in a new issue