ruby-changes:37847
From: ko1 <ko1@a...>
Date: Wed, 11 Mar 2015 09:21:07 +0900 (JST)
Subject: [ruby-changes:37847] ko1:r49928 (trunk): * internal.h: define struct MEMO.
ko1 2015-03-11 09:20:45 +0900 (Wed, 11 Mar 2015) New Revision: 49928 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49928 Log: * internal.h: define struct MEMO. * enum.c: use MEMO. * enumerator.c: ditto. * load.c: ditto. * node.h: return (struct MEMO *) pointer. Modified files: trunk/ChangeLog trunk/enum.c trunk/enumerator.c trunk/internal.h trunk/load.c trunk/node.h Index: ChangeLog =================================================================== --- ChangeLog (revision 49927) +++ ChangeLog (revision 49928) @@ -1,3 +1,15 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Mar 11 09:15:21 2015 Koichi Sasada <ko1@a...> + + * internal.h: define struct MEMO. + + * enum.c: use MEMO. + + * enumerator.c: ditto. + + * load.c: ditto. + + * node.h: return (struct MEMO *) pointer. + Wed Mar 11 06:26:21 2015 Koichi Sasada <ko1@a...> * vm_insnhelper.h (THROW_DATA_STATE): return int, not VALUE. Index: enumerator.c =================================================================== --- enumerator.c (revision 49927) +++ enumerator.c (revision 49928) @@ -494,9 +494,9 @@ enumerator_each(int argc, VALUE *argv, V https://github.com/ruby/ruby/blob/trunk/enumerator.c#L494 static VALUE enumerator_with_index_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, m)) { - NODE *memo = (NODE *)m; - VALUE idx = memo->u1.value; - memo->u1.value = rb_int_succ(idx); + struct MEMO *memo = (struct MEMO *)m; + VALUE idx = memo->v1; + memo->v1 = rb_int_succ(idx); if (argc <= 1) return rb_yield_values(2, val, idx); Index: enum.c =================================================================== --- enum.c (revision 49927) +++ enum.c (revision 49928) @@ -43,11 +43,11 @@ rb_enum_values_pack(int argc, const VALU https://github.com/ruby/ruby/blob/trunk/enum.c#L43 static VALUE grep_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args)) { - NODE *memo = RNODE(args); + struct MEMO *memo = MEMO_CAST(args); ENUM_WANT_SVALUE(); - if (RTEST(rb_funcall(memo->u1.value, id_eqq, 1, i))) { - rb_ary_push(memo->u2.value, i); + if (RTEST(rb_funcall(memo->v1, id_eqq, 1, i))) { + rb_ary_push(memo->v2, i); } return Qnil; } @@ -55,11 +55,11 @@ grep_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arg https://github.com/ruby/ruby/blob/trunk/enum.c#L55 static VALUE grep_iter_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args)) { - NODE *memo = RNODE(args); + struct MEMO *memo = MEMO_CAST(args); ENUM_WANT_SVALUE(); - if (RTEST(rb_funcall(memo->u1.value, id_eqq, 1, i))) { - rb_ary_push(memo->u2.value, rb_yield(i)); + if (RTEST(rb_funcall(memo->v1, id_eqq, 1, i))) { + rb_ary_push(memo->v2, rb_yield(i)); } return Qnil; } @@ -86,7 +86,7 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/enum.c#L86 enum_grep(VALUE obj, VALUE pat) { VALUE ary = rb_ary_new(); - NODE *memo = NEW_MEMO(pat, ary, 0); + struct MEMO *memo = NEW_MEMO(pat, ary, 0); rb_block_call(obj, id_each, 0, 0, rb_block_given_p() ? grep_iter_i : grep_i, (VALUE)memo); @@ -96,11 +96,11 @@ enum_grep(VALUE obj, VALUE pat) https://github.com/ruby/ruby/blob/trunk/enum.c#L96 static VALUE count_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop)) { - NODE *memo = RNODE(memop); + struct MEMO *memo = MEMO_CAST(memop); ENUM_WANT_SVALUE(); - if (rb_equal(i, memo->u1.value)) { + if (rb_equal(i, memo->v1)) { memo->u3.cnt++; } return Qnil; @@ -109,7 +109,7 @@ count_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, me https://github.com/ruby/ruby/blob/trunk/enum.c#L109 static VALUE count_iter_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop)) { - NODE *memo = RNODE(memop); + struct MEMO *memo = MEMO_CAST(memop); if (RTEST(enum_yield(argc, argv))) { memo->u3.cnt++; @@ -120,7 +120,7 @@ count_iter_i(RB_BLOCK_CALL_FUNC_ARGLIST( https://github.com/ruby/ruby/blob/trunk/enum.c#L120 static VALUE count_all_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop)) { - NODE *memo = RNODE(memop); + struct MEMO *memo = MEMO_CAST(memop); memo->u3.cnt++; return Qnil; @@ -148,7 +148,7 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/enum.c#L148 enum_count(int argc, VALUE *argv, VALUE obj) { VALUE item = Qnil; - NODE *memo; + struct MEMO *memo; rb_block_call_func *func; if (argc == 0) { @@ -178,8 +178,8 @@ find_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, mem https://github.com/ruby/ruby/blob/trunk/enum.c#L178 ENUM_WANT_SVALUE(); if (RTEST(rb_yield(i))) { - NODE *memo = RNODE(memop); - memo->u1.value = i; + struct MEMO *memo = MEMO_CAST(memop); + memo->v1 = i; memo->u3.cnt = 1; rb_iter_break(); } @@ -208,7 +208,7 @@ find_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, mem https://github.com/ruby/ruby/blob/trunk/enum.c#L208 static VALUE enum_find(int argc, VALUE *argv, VALUE obj) { - NODE *memo; + struct MEMO *memo; VALUE if_none; rb_scan_args(argc, argv, "01", &if_none); @@ -216,7 +216,7 @@ enum_find(int argc, VALUE *argv, VALUE o https://github.com/ruby/ruby/blob/trunk/enum.c#L216 memo = NEW_MEMO(Qundef, 0, 0); rb_block_call(obj, id_each, 0, 0, find_i, (VALUE)memo); if (memo->u3.cnt) { - return memo->u1.value; + return memo->v1; } if (!NIL_P(if_none)) { return rb_funcallv(if_none, id_call, 0, 0); @@ -227,12 +227,12 @@ enum_find(int argc, VALUE *argv, VALUE o https://github.com/ruby/ruby/blob/trunk/enum.c#L227 static VALUE find_index_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop)) { - NODE *memo = RNODE(memop); + struct MEMO *memo = MEMO_CAST(memop); ENUM_WANT_SVALUE(); - if (rb_equal(i, memo->u2.value)) { - memo->u1.value = UINT2NUM(memo->u3.cnt); + if (rb_equal(i, memo->v2)) { + memo->v1 = UINT2NUM(memo->u3.cnt); rb_iter_break(); } memo->u3.cnt++; @@ -242,10 +242,10 @@ find_index_i(RB_BLOCK_CALL_FUNC_ARGLIST( https://github.com/ruby/ruby/blob/trunk/enum.c#L242 static VALUE find_index_iter_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop)) { - NODE *memo = RNODE(memop); + struct MEMO *memo = MEMO_CAST(memop); if (RTEST(enum_yield(argc, argv))) { - memo->u1.value = UINT2NUM(memo->u3.cnt); + memo->v1 = UINT2NUM(memo->u3.cnt); rb_iter_break(); } memo->u3.cnt++; @@ -274,7 +274,7 @@ find_index_iter_i(RB_BLOCK_CALL_FUNC_ARG https://github.com/ruby/ruby/blob/trunk/enum.c#L274 static VALUE enum_find_index(int argc, VALUE *argv, VALUE obj) { - NODE *memo; /* [return value, current index, ] */ + struct MEMO *memo; /* [return value, current index, ] */ VALUE condition_value = Qnil; rb_block_call_func *func; @@ -292,7 +292,7 @@ enum_find_index(int argc, VALUE *argv, V https://github.com/ruby/ruby/blob/trunk/enum.c#L292 memo = NEW_MEMO(Qnil, condition_value, 0); rb_block_call(obj, id_each, 0, 0, func, (VALUE)memo); - return memo->u1.value; + return memo->v1; } static VALUE @@ -566,15 +566,15 @@ enum_to_h(int argc, VALUE *argv, VALUE o https://github.com/ruby/ruby/blob/trunk/enum.c#L566 static VALUE inject_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, p)) { - NODE *memo = RNODE(p); + struct MEMO *memo = MEMO_CAST(p); ENUM_WANT_SVALUE(); - if (memo->u1.value == Qundef) { - memo->u1.value = i; + if (memo->v1 == Qundef) { + memo->v1 = i; } else { - memo->u1.value = rb_yield_values(2, memo->u1.value, i); + memo->v1 = rb_yield_values(2, memo->v1, i); } return Qnil; } @@ -582,23 +582,23 @@ inject_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, p https://github.com/ruby/ruby/blob/trunk/enum.c#L582 static VALUE inject_op_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, p)) { - NODE *memo = RNODE(p); + struct MEMO *memo = MEMO_CAST(p); VALUE name; ENUM_WANT_SVALUE(); - if (memo->u1.value == Qundef) { - memo->u1.value = i; + if (memo->v1 == Qundef) { + memo->v1 = i; } else if (SYMBOL_P(name = memo->u3.value)) { const ID mid = SYM2ID(name); - memo->u1.value = rb_funcall(memo->u1.value, mid, 1, i); + memo->v1 = rb_funcall(memo->v1, mid, 1, i); } else { VALUE args[2]; args[0] = name; args[1] = i; - memo->u1.value = rb_f_send(numberof(args), args, memo->u1.value); + memo->v1 = rb_f_send(numberof(args), args, memo->v1); } return Qnil; } @@ -649,7 +649,7 @@ inject_op_i(RB_BLOCK_CALL_FUNC_ARGLIST(i https://github.com/ruby/ruby/blob/trunk/enum.c#L649 static VALUE enum_inject(int argc, VALUE *argv, VALUE obj) { - NODE *memo; + struct MEMO *memo; VALUE init, op; rb_block_call_func *iter = inject_i; ID id; @@ -678,22 +678,22 @@ enum_inject(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/enum.c#L678 } memo = NEW_MEMO(init, Qnil, op); rb_block_call(obj, id_each, 0, 0, iter, (VALUE)memo); - if (memo->u1.value == Qundef) return Qnil; - return memo->u1.value; + if (memo->v1 == Qundef) return Qnil; + return memo->v1; } static VALUE partition_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arys)) { - NODE *memo = RNODE(arys); + struct MEMO *memo = MEMO_CAST(arys); VALUE ary; ENUM_WANT_SVALUE(); if (RTEST(rb_yield(i))) { - ary = memo->u1.value; + ary = memo->v1; } else { - ary = memo->u2.value; + ary = memo->v2; } rb_ary_push(ary, i); return Qnil; @@ -717,14 +717,14 @@ partition_i(RB_BLOCK_CALL_FUNC_ARGLIST(i https://github.com/ruby/ruby/blob/trunk/enum.c#L717 static VALUE enum_partition(VALUE obj) { - NODE *memo; + struct MEMO *memo; RETURN_SIZED_ENUMERATOR(obj, 0, 0, enum_size); memo = NEW_MEMO(rb_ary_new(), rb_ary_new(), 0); rb_block_call(obj, id_each, 0, 0, partition_i, (VALUE)memo); - return rb_assoc_new(memo->u1.value, memo->u2.value); + return rb_assoc_new(memo->v1, memo->v2); } static VALUE @@ -779,10 +779,10 @@ enum_group_by(VALUE obj) https://github.com/ruby/ruby/blob/trunk/enum.c#L779 static VALUE first_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, params)) { - NODE *memo = RNODE(params); + struct MEMO *memo = MEMO_CAST(params); ENUM_WANT_SVALUE(); - memo->u1.value = i; + memo->v1 = i; rb_iter_break(); UNREACHABLE; @@ -809,7 +809,7 @@ static VALUE enum_take(VALUE obj, VALUE https://github.com/ruby/ruby/blob/trunk/enum.c#L809 static VALUE enum_first(int argc, VALUE *argv, VALUE obj) { - NODE *memo; + struct MEMO *memo; rb_check_arity(argc, 0, 1); if (argc > 0) { return enum_take(obj, argv[0]); @@ -817,7 +817,7 @@ enum_first(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/enum.c#L817 else { memo = NEW_MEMO(Qnil, 0, 0); rb_block_call(obj, id_each, 0, 0, first_i, (VALUE)memo); - return memo->u1.value; + return memo->v1; } } @@ -855,7 +855,7 @@ struct sort_by_data { https://github.com/ruby/ruby/blob/trunk/enum.c#L855 static VALUE sort_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, _data)) { - struct sort_by_data *data = (struct sort_by_data *)&RNODE(_data)->u1; + struct sort_by_data *data = (struct sort_by_data *)&MEMO_CAST(_data)->v1; VALUE ary = data->ary; VALUE v; @@ -972,7 +972,7 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/enum.c#L972 enum_sort_by(VALUE obj) { VALUE ary, buf; - NODE *memo; + struct MEMO *memo; long i; struct sort_by_data *data; @@ -989,7 +989,7 @@ enum_sort_by(VALUE obj) https://github.com/ruby/ruby/blob/trunk/enum.c#L989 rb_ary_store(buf, SORT_BY_BUFSIZE*2-1, Qnil); memo = NEW_MEMO(0, 0, 0); OBJ_INFECT(memo, obj); - data = (struct sort_by_data *)&memo->u1; + data = (struct sort_by_data *)&memo->v1; data->ary = ary; data->buf = buf; data->n = 0; @@ -1021,27 +1021,27 @@ enum_sort_by(VALUE obj) https://github.com/ruby/ruby/blob/trunk/enum.c#L1021 #define ENUMFUNC(name) rb_block_given_p() ? name##_iter_i : name##_i #define DEFINE_ENUMFUNCS(name) \ -static VALUE enum_##name##_func(VALUE result, NODE *memo); \ +static VALUE enum_##name##_func(VALUE result, struct MEMO *memo); \ \ static VALUE \ name##_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memo)) \ { \ - return enum_##name##_func(rb_enum_values_pack(argc, argv), RNODE(memo)); \ + return enum_##name##_func(rb_enum_values_pack(argc, argv), MEMO_CAST(memo)); \ } \ \ static VALUE \ name##_iter_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memo)) \ { \ - return enum_##name##_func(enum_yield(argc, argv), RNODE(memo)); \ + return enum_##name##_func(enum_yield(argc, argv), MEMO_CAST(memo)); \ } \ \ static VALUE \ -enum_##name##_func(VALUE result, NODE *memo) +enum_##name##_func(VALUE result, struct MEMO *memo) DEFINE_ENUMFUNCS(all) { if (!RTEST(result)) { - memo->u1.value = Qfalse; + memo->v1 = Qfalse; rb_iter_break(); } return Qnil; @@ -1067,15 +1067,15 @@ DEFINE_ENUMFUNCS(all) https://github.com/ruby/ruby/blob/trunk/enum.c#L1067 static VALUE enum_all(VALUE obj) { - NODE *memo = NEW_MEMO(Qtrue, 0, 0); + struct MEMO *memo = NEW_MEMO(Qtrue, 0, 0); rb_block_call(obj, id_each, 0, 0, ENUMFUNC(all), (VALUE)memo); - return memo->u1.value; + return memo->v1; } DEFINE_ENUMFUNCS(any) { if (RTEST(result)) { - memo->u1.value = Qtrue; + memo->v1 = Qtrue; rb_iter_break(); } return Qnil; @@ -1101,19 +1101,19 @@ DEFINE_ENUMFUNCS(any) https://github.com/ruby/ruby/blob/trunk/enum.c#L1101 static VALUE enum_any(VALUE obj) { - NODE *memo = NEW_MEMO(Qfalse, 0, 0); + struct MEMO *memo = NEW_MEMO(Qfalse, 0, 0); rb_block_call(obj, id_each, 0, 0, ENUMFUNC(any), (VALUE)memo); - return memo->u1.value; + return memo->v1; } DEFINE_ENUMFUNCS(one) { if (RTEST(result)) { - if (memo->u1.value == Qundef) { - memo->u1.value = Qtrue; + if (memo->v1 == Qundef) { + memo->v1 = Qtrue; } - else if (memo->u1.value == Qtrue) { - memo->u1.value = Qfalse; + else if (memo->v1 == Qtrue) { + memo->v1 = Qfalse; rb_iter_break(); } } @@ -1344,11 +1344,11 @@ nmin_run(VALUE obj, VALUE num, int by, i https://github.com/ruby/ruby/blob/trunk/enum.c#L1344 static VALUE enum_one(VALUE obj) { - NODE *memo = NEW_MEMO(Qundef, 0, 0); + struct MEMO *memo = NEW_MEMO(Qundef, 0, 0); VALUE result; rb_block_call(obj, id_each, 0, 0, ENUMFUNC(one), (VALUE)memo); - result = memo->u1.value; + result = memo->v1; if (result == Qundef) return Qfalse; return result; } @@ -1356,7 +1356,7 @@ enum_one(VALUE obj) https://github.com/ruby/ruby/blob/trunk/enum.c#L1356 DEFINE_ENUMFUNCS(none) { if (RTEST(result)) { - memo->u1.value = Qfalse; + memo->v1 = Qfalse; rb_iter_break(); } return Qnil; @@ -1380,26 +1380,26 @@ DEFINE_ENUMFUNCS(none) https://github.com/ruby/ruby/blob/trunk/enum.c#L1380 static VALUE enum_none(VALUE obj) { - NODE *memo = NEW_MEMO(Qtrue, 0, 0); + struct MEMO *memo = NEW_MEMO(Qtrue, 0, 0); rb_block_call(obj, id_each, 0, 0, ENUMFUNC(none), (VALUE)memo); - return memo->u1.value; + return memo->v1; } static VALUE min_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args)) { VALUE cmp; - NODE *memo = RNODE(args); + struct MEMO *memo = MEMO_CAST(args); ENUM_WANT_SVALUE(); - if (memo->u1.value == Qundef) { - memo->u1.value = i; + if (memo->v1 == Qundef) { + memo->v1 = i; } else { - cmp = rb_funcall(i, id_cmp, 1, memo->u1.value); - if (rb_cmpint(cmp, i, memo->u1.value) < 0) { - memo->u1.value = i; + cmp = rb_funcall(i, id_cmp, 1, memo->v1); + if (rb_cmpint(cmp, i, memo->v1) < 0) { + memo->v1 = i; } } return Qnil; @@ -1409,17 +1409,17 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/enum.c#L1409 min_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, args)) { VALUE cmp; - NODE *memo = RNODE(args); + struct MEMO *memo = MEMO_CAST(args); ENUM_WANT_SVALUE(); - if (memo->u1.value == Qundef) { - memo->u1.value = i; + if (memo->v1 == Qundef) { + memo->v1 = i; } else { - cmp = rb_yield_values(2, i, memo->u1.value); - if (rb_cmpint(cmp, i, memo->u1.value) < 0) { - memo->u1.value = i; + cmp = rb_yield_values(2, i, memo->v1); + if (rb_cmpint(cmp, i, memo->v1) < 0) { + memo->v1 = i; } } return Qnil; @@ -1452,7 +1452,7 @@ min_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, arg https://github.com/ruby/ruby/blob/trunk/enum.c#L1452 static VALUE enum_min(int argc, VALUE *argv, VALUE obj) { - NODE *memo = NEW_MEMO(Qundef, 0, 0); + struct MEMO *memo = NEW_MEMO(Qundef, 0, 0); VALUE result; VALUE num; @@ -1467,7 +1467,7 @@ enum_min(int argc, VALUE *argv, VALUE ob https://github.com/ruby/ruby/blob/trunk/enum.c#L1467 else { rb_block_call(obj, id_each, 0, 0, min_i, (VALUE)memo); } - result = memo->u1.value; + result = memo->v1; if (result == Qundef) return Qnil; return result; } @@ -1475,18 +1475,18 @@ enum_min(int argc, VALUE *argv, VALUE ob https://github.com/ruby/ruby/blob/trunk/enum.c#L1475 static VALUE max_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args)) { - NODE *memo = RNODE(args); + struct MEMO *memo = MEMO_CAST(args); VALUE cmp; ENUM_WANT_SVALUE(); - if (memo->u1.value == Qundef) { - memo->u1.value = i; + if (memo->v1 == Qundef) { + memo->v1 = i; } else { - cmp = rb_funcall(i, id_cmp, 1, memo->u1.value); - if (rb_cmpint(cmp, i, memo->u1.value) > 0) { - memo->u1.value = i; + cmp = rb_funcall(i, id_cmp, 1, memo->v1); + if (rb_cmpint(cmp, i, memo->v1) > 0) { + memo->v1 = i; } } return Qnil; @@ -1495,18 +1495,18 @@ max_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args https://github.com/ruby/ruby/blob/trunk/enum.c#L1495 static VALUE max_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, args)) { - NODE *memo = RNODE(args); + struct MEMO *memo = MEMO_CAST(args); VALUE cmp; ENUM_WANT_SVALUE(); - if (memo->u1.value == Qundef) { - memo->u1.value = i; + if (memo->v1 == Qundef) { + memo->v1 = i; } else { - cmp = rb_yield_values(2, i, memo->u1.value); - if (rb_cmpint(cmp, i, memo->u1.value) > 0) { - memo->u1.value = i; + cmp = rb_yield_values(2, i, memo->v1); + if (rb_cmpint(cmp, i, memo->v1) > 0) { + memo->v1 = i; } } return Qnil; @@ -1538,7 +1538,7 @@ max_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, arg https://github.com/ruby/ruby/blob/trunk/enum.c#L1538 static VALUE enum_max(int argc, VALUE *argv, VALUE obj) { - NODE *memo = NEW_MEMO(Qundef, 0, 0); + struct MEMO *memo = NEW_MEMO(Qundef, 0, 0); VALUE result; VALUE num; @@ -1553,7 +1553,7 @@ enum_max(int argc, VALUE *argv, VALUE ob https://github.com/ruby/ruby/blob/trunk/enum.c#L1553 else { rb_block_call(obj, id_each, 0, 0, max_i, (VALUE)memo); } - result = memo->u1.value; + result = memo->v1; if (result == Qundef) return Qnil; return result; } @@ -1590,7 +1590,7 @@ minmax_i_update(VALUE i, VALUE j, struct https://github.com/ruby/ruby/blob/trunk/enum.c#L1590 static VALUE minmax_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, _memo)) { - struct minmax_t *memo = (struct minmax_t *)&RNODE(_memo)->u1.value; + struct minmax_t *memo = (struct minmax_t *)&MEMO_CAST(_memo)->v1; int n; VALUE j; @@ -1642,7 +1642,7 @@ minmax_ii_update(VALUE i, VALUE j, struc https://github.com/ruby/ruby/blob/trunk/enum.c#L1642 static VALUE minmax_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, _memo)) { - struct minmax_t *memo = (struct minmax_t *)&RNODE(_memo)->u1.value; + struct minmax_t *memo = (struct minmax_t *)&MEMO_CAST(_memo)->v1; int n; VALUE j; @@ -1688,8 +1688,8 @@ minmax_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, https://github.com/ruby/ruby/blob/trunk/enum.c#L1688 static VALUE enum_minmax(VALUE obj) { - NODE *memo = NEW_MEMO(Qundef, Qundef, Qundef); - struct minmax_t *m = (struct minmax_t *)&memo->u1.value; + struct MEMO *memo = NEW_MEMO(Qundef, Qundef, Qundef); + struct minmax_t *m = (struct minmax_t *)&memo->v1; VALUE ary = rb_ary_new3(2, Qnil, Qnil); m->min = Qundef; @@ -1714,19 +1714,19 @@ enum_minmax(VALUE obj) https://github.com/ruby/ruby/blob/trunk/enum.c#L1714 static VALUE min_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args)) { - NODE *memo = RNODE(args); + struct MEMO *memo = MEMO_CAST(args); VALUE v; ENUM_WANT_SVALUE(); v = rb_yield(i); - if (memo->u1.value == Qundef) { - memo->u1.value = v; - memo->u2.value = i; - } - else if (rb_cmpint(rb_funcall(v, id_cmp, 1, memo->u1.value), v, memo->u1.value) < 0) { - memo->u1.value = v; - memo->u2.value = i; + if (memo->v1 == Qundef) { + memo->v1 = v; + memo->v2 = i; + } + (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/