mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* proc.c: enable optimization of Proc#call.
[Feature #11569] * NEWS: write about this optimization and incompatibilities. * test/ruby/test_backtrace.rb: catch up this fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9b77261a12
commit
0018a71184
4 changed files with 22 additions and 12 deletions
|
@ -1,3 +1,12 @@
|
|||
Tue Oct 6 06:32:52 2015 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* proc.c: enable optimization of Proc#call.
|
||||
[Feature #11569]
|
||||
|
||||
* NEWS: write about this optimization and incompatibilities.
|
||||
|
||||
* test/ruby/test_backtrace.rb: catch up this fix.
|
||||
|
||||
Tue Oct 6 04:41:03 2015 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* vm_insnhelper.c: solve goto spaghetti.
|
||||
|
|
6
NEWS
6
NEWS
|
@ -65,6 +65,12 @@ with all sufficient information, see the ChangeLog file.
|
|||
true when the receiver is positive and negative respectively.
|
||||
[Feature #11151]
|
||||
|
||||
* Proc
|
||||
|
||||
* Proc#call (and also #[], #===, #yield) are optimized.
|
||||
Backtrace doesn't show each methods (show block lines directly).
|
||||
TracePoint also ignore these calls. [Feature #11569]
|
||||
|
||||
* Thread
|
||||
* Thread#name, Thread#name= are added to handle thread names [Feature #11251]
|
||||
|
||||
|
|
11
proc.c
11
proc.c
|
@ -733,7 +733,7 @@ rb_block_clear_env_self(VALUE proc)
|
|||
* from prog.rb:5:in `<main>'
|
||||
*
|
||||
*/
|
||||
|
||||
#if 0
|
||||
static VALUE
|
||||
proc_call(int argc, VALUE *argv, VALUE procval)
|
||||
{
|
||||
|
@ -759,6 +759,7 @@ proc_call(int argc, VALUE *argv, VALUE procval)
|
|||
RB_GC_GUARD(passed_procval);
|
||||
return vret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if SIZEOF_LONG > SIZEOF_INT
|
||||
static inline int
|
||||
|
@ -2803,7 +2804,6 @@ Init_Proc(void)
|
|||
rb_undef_alloc_func(rb_cProc);
|
||||
rb_define_singleton_method(rb_cProc, "new", rb_proc_s_new, -1);
|
||||
|
||||
#if 0 /* incomplete. */
|
||||
rb_add_method(rb_cProc, rb_intern("call"), VM_METHOD_TYPE_OPTIMIZED,
|
||||
(void *)OPTIMIZED_METHOD_TYPE_CALL, 0);
|
||||
rb_add_method(rb_cProc, rb_intern("[]"), VM_METHOD_TYPE_OPTIMIZED,
|
||||
|
@ -2812,12 +2812,7 @@ Init_Proc(void)
|
|||
(void *)OPTIMIZED_METHOD_TYPE_CALL, 0);
|
||||
rb_add_method(rb_cProc, rb_intern("yield"), VM_METHOD_TYPE_OPTIMIZED,
|
||||
(void *)OPTIMIZED_METHOD_TYPE_CALL, 0);
|
||||
#else
|
||||
rb_define_method(rb_cProc, "call", proc_call, -1);
|
||||
rb_define_method(rb_cProc, "[]", proc_call, -1);
|
||||
rb_define_method(rb_cProc, "===", proc_call, -1);
|
||||
rb_define_method(rb_cProc, "yield", proc_call, -1);
|
||||
#endif
|
||||
|
||||
rb_define_method(rb_cProc, "to_proc", proc_to_proc, 0);
|
||||
rb_define_method(rb_cProc, "arity", proc_arity, 0);
|
||||
rb_define_method(rb_cProc, "clone", proc_clone, 0);
|
||||
|
|
|
@ -79,10 +79,10 @@ class TestBacktrace < Test::Unit::TestCase
|
|||
cs << caller(5)
|
||||
}.call
|
||||
}.resume
|
||||
assert_equal(3, cs[0].size)
|
||||
assert_equal(2, cs[1].size)
|
||||
assert_equal(1, cs[2].size)
|
||||
assert_equal(0, cs[3].size)
|
||||
assert_equal(2, cs[0].size)
|
||||
assert_equal(1, cs[1].size)
|
||||
assert_equal(0, cs[2].size)
|
||||
assert_equal(nil, cs[3])
|
||||
assert_equal(nil, cs[4])
|
||||
|
||||
#
|
||||
|
|
Loading…
Reference in a new issue