aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-05 21:34:24 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-05 21:34:24 +0000
commit60870c4cccbd94d15137241fed8ef699053bd529 (patch)
tree135ec18c0de6c6af48b98ff5132ac8f26eb1cc77
parent77f7ce87a6a3b7c065040905c82d9690ead7dee5 (diff)
downloadruby-60870c4cccbd94d15137241fed8ef699053bd529.tar.gz
* 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
-rw-r--r--ChangeLog9
-rw-r--r--NEWS6
-rw-r--r--proc.c11
-rw-r--r--test/ruby/test_backtrace.rb8
4 files changed, 22 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 51f2478487..937cedfd57 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/NEWS b/NEWS
index 10e5e11d73..8a4141e198 100644
--- a/NEWS
+++ b/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]
diff --git a/proc.c b/proc.c
index 6370904109..b84a4fc9d9 100644
--- a/proc.c
+++ b/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);
diff --git a/test/ruby/test_backtrace.rb b/test/ruby/test_backtrace.rb
index 7fbfddf94c..3076f37017 100644
--- a/test/ruby/test_backtrace.rb
+++ b/test/ruby/test_backtrace.rb
@@ -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])
#