[#74190] [Ruby trunk Feature#12134] Comparison between `true` and `false` — duerst@...
SXNzdWUgIzEyMTM0IGhhcyBiZWVuIHVwZGF0ZWQgYnkgTWFydGluIETDvHJzdC4KCgpUc3V5b3No
3 messages
2016/03/07
[#74269] Type systems for Ruby — Rob Blanco <ml@...>
Dear ruby-core,
5 messages
2016/03/10
[#74395] [Ruby trunk Feature#12142] Hash tables with open addressing — shyouhei@...
Issue #12142 has been updated by Shyouhei Urabe.
3 messages
2016/03/17
[ruby-core:74240] [Ruby trunk Bug#12082] Tail-calling method can't catch exception raised by tail-called method
From:
k@...
Date:
2016-03-09 09:24:20 UTC
List:
ruby-core #74240
Issue #12082 has been updated by Kazuki Yamaguchi.
File 0001-compile.c-don-t-do-tail-call-optimization-if-covered-v2.patch added
Updating my patch, because it breaks such code:
~~~ruby
def errinfo
$!
end
RubyVM::InstructionSequence.compile(<<EOF, __FILE__, __FILE__, __LINE__, tailcall_optimization: true).eval
def test_rescue
raise "a"
rescue
errinfo
end
EOF
p test_rescue # should return a RuntimeError
~~~
----------------------------------------
Bug #12082: Tail-calling method can't catch exception raised by tail-called method
https://bugs.ruby-lang.org/issues/12082#change-57376
* Author: Kazuki Yamaguchi
* Status: Open
* Priority: Normal
* Assignee: Koichi Sasada
* ruby -v:
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
The following code doesn't work as expected, on all versions of Ruby with tail call optimization (1.9.1 to 2.3.0).
~~~ruby
def do_raise
raise "should be rescued"
end
options = {
tailcall_optimization: true,
trace_instruction: false,
}
RubyVM::InstructionSequence.compile(<<EOF, __FILE__, __FILE__, __LINE__, options).eval
def test_rescue
return do_raise
1 + 2
rescue
:ok
end
EOF
p test_rescue # should print :ok, but raises "should be rescued"
~~~
Looks like `nop` instruction is (also) used to avoid this optimization ([compile.c](https://github.com/ruby/ruby/blob/1282a4a/compile.c#L4321)), but when doing early return, no `nop` is inserted.
I attached a (dirty) fix for this. Maybe there is a cleaner way.
---Files--------------------------------
0001-compile.c-don-t-do-tail-call-optimization-if-covered.patch (7.21 KB)
0001-compile.c-don-t-do-tail-call-optimization-if-covered-v2.patch (7.49 KB)
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>