Project

General

Profile

Actions

Feature #11569

closed

Optimize Proc#call

Added by ko1 (Koichi Sasada) about 9 years ago. Updated about 9 years ago.

Status:
Closed
Target version:
-
[ruby-core:<unknown>]

Description

Some years ago, I added optimized Proc#call that skips construction of a method frame for Proc#call and call block directly.
That time, test-all shows some failures.

However, I tried it now it doesn't show any errors.
So that I will enable it.

This change introduces incompatibilities.

(1) Backtrace doesn't show Proc#call line.

->{
  puts caller(0)
}.call

# current
test.rb:4:in `block in <main>'
test.rb:5:in `call'
test.rb:5:in `<main>'

# optimized
../../trunk/test.rb:4:in `block in <main>'
../../trunk/test.rb:5:in `<main>'

(2) TracePoint ignores Proc#call call.

TracePoint.new(:a_call){|tp| p tp}.enable
->{}.call

# current
#<TracePoint:c_call `call'@test.rb:2>
#<TracePoint:b_call@test.rb:2>

# optimized
#<TracePoint:b_call@../../trunk/test.rb:2>

Let me know if you have trouble with these incompatibilities.

BTW, Object#send has already same technique (and behavior with (1), (2)).


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #12332: [PATCH] proc.c: fix RDoc of Proc#===/call/yield/[]ClosedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0