ruby-changes:17346
From: ko1 <ko1@a...>
Date: Mon, 27 Sep 2010 23:47:36 +0900 (JST)
Subject: [ruby-changes:17346] Ruby:r29351 (trunk): * insns.def (opt_case_dispatch), vm_insnhelper.c:
ko1 2010-09-27 23:47:30 +0900 (Mon, 27 Sep 2010) New Revision: 29351 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29351 Log: * insns.def (opt_case_dispatch), vm_insnhelper.c: execute the procedures of "when" clauses by bytecode instead of st_foreach() when the object does not hit prepared hash. [ruby-dev:42304] Modified files: trunk/ChangeLog trunk/insns.def trunk/vm_insnhelper.c Index: ChangeLog =================================================================== --- ChangeLog (revision 29350) +++ ChangeLog (revision 29351) @@ -1,3 +1,10 @@ +Mon Sep 27 23:30:34 2010 Koichi Sasada <ko1@a...> + + * insns.def (opt_case_dispatch), vm_insnhelper.c: + execute the procedures of "when" clauses by bytecode + instead of st_foreach() when the object does not hit + prepared hash. [ruby-dev:42304] + Mon Sep 27 15:54:03 2010 URABE Shyouhei <shyouhei@r...> * test/net/http/test_https.rb: As always, localhost is not Index: insns.def =================================================================== --- insns.def (revision 29350) +++ insns.def (revision 29351) @@ -1281,20 +1281,8 @@ } break; } - default: { /* fall through (else) */ - struct opt_case_dispatch_i_arg arg; - - arg.obj = key; - arg.label = -1; - st_foreach(RHASH_TBL(hash), opt_case_dispatch_i, (st_data_t)&arg); - - if (arg.label != -1) { - JUMP(arg.label); - } - else { - JUMP(else_offset); - } - } + default: + break; } } Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 29350) +++ vm_insnhelper.c (revision 29351) @@ -1699,22 +1699,3 @@ return Qundef; } -struct opt_case_dispatch_i_arg { - VALUE obj; - int label; -}; - -static int -opt_case_dispatch_i(st_data_t key, st_data_t data, st_data_t p) -{ - struct opt_case_dispatch_i_arg *arg = (void *)p; - - if (RTEST(rb_funcall((VALUE)key, idEqq, 1, arg->obj))) { - arg->label = FIX2INT((VALUE)data); - return ST_STOP; - } - else { - return ST_CONTINUE; - } -} - -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/