VALUE invoke_Range_each_special_block(VALUE range, VALUE beg, VALUE end, int excl) { rb_thread_t *th = GET_THREAD(); rb_block_t *orig_block = GC_GUARDED_PTR_REF(th->cfp->lfp[0]); if (BUILTIN_TYPE(orig_block->iseq) != T_NODE) { void *builder = excl ? build_Range_each_node_LT : build_Range_each_node_LE; VALUE tsiseqval = iseq_special_block(orig_block->iseq, builder); rb_iseq_t *tsiseq; VALUE argv[2]; if (tsiseqval) { VALUE val; rb_block_t block = *orig_block; GetISeqPtr(tsiseqval, tsiseq); block.iseq = tsiseq; th->cfp->lfp[0] = GC_GUARDED_PTR(&block); argv[0] = beg; argv[1] = end; val = vm_yield(th, 2, argv); if (val == Qundef) { return range; } else { return val; } } } return Qundef; }
VALUE invoke_Array_each_special_block(VALUE ary) { rb_thread_t *th = GET_THREAD(); rb_block_t *orig_block = GC_GUARDED_PTR_REF(th->cfp->lfp[0]); if (BUILTIN_TYPE(orig_block->iseq) != T_NODE) { VALUE tsiseqval = iseq_special_block(orig_block->iseq, build_Array_each_node); rb_iseq_t *tsiseq; VALUE argv[2]; if (tsiseqval) { VALUE val; rb_block_t block = *orig_block; GetISeqPtr(tsiseqval, tsiseq); block.iseq = tsiseq; th->cfp->lfp[0] = GC_GUARDED_PTR(&block); argv[0] = 0; argv[1] = ary; val = vm_yield(th, 2, argv); if (val == Qundef) { return ary; } else { return val; } } } return Qundef; }
VALUE invoke_Integer_times_special_block(VALUE num) { rb_thread_t *th = GET_THREAD(); rb_block_t *orig_block = GC_GUARDED_PTR_REF(th->cfp->lfp[0]); if (orig_block && BUILTIN_TYPE(orig_block->iseq) != T_NODE) { VALUE tsiseqval = iseq_special_block(orig_block->iseq, build_Integer_times_node); rb_iseq_t *tsiseq; VALUE argv[2], val; if (tsiseqval) { rb_block_t block = *orig_block; GetISeqPtr(tsiseqval, tsiseq); block.iseq = tsiseq; th->cfp->lfp[0] = GC_GUARDED_PTR(&block); argv[0] = INT2FIX(0); argv[1] = num; val = vm_yield(th, 2, argv); if (val == Qundef) { return num; } else { return val; } } } return Qundef; }
static inline VALUE rb_yield_0(int argc, const VALUE * argv) { return vm_yield(GET_THREAD(), argc, argv); }