https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112018-11-19T16:22:21ZRuby Issue Tracking SystemRuby master - Bug #15313: [PATCH] Let debuggers know when a tail call happenshttps://redmine.ruby-lang.org/issues/15313?journal_id=749542018-11-19T16:22:21Zalanwu (Alan Wu)
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/74954/diff?detail_id=50308">diff</a>)</li></ul> Ruby master - Bug #15313: [PATCH] Let debuggers know when a tail call happenshttps://redmine.ruby-lang.org/issues/15313?journal_id=750112018-11-21T19:05:15Zko1 (Koichi Sasada)
<ul><li><strong>Assignee</strong> set to <i>ko1 (Koichi Sasada)</i></li></ul><p>fix <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: Return tracepoint doesn't fire when tailcall optimization is applied (Closed)" href="https://redmine.ruby-lang.org/issues/15303">#15303</a> (invoke return event) doesn't solve it?</p>
<p>BTW, if you provide an API, sample code will help us to understand.</p> Ruby master - Bug #15313: [PATCH] Let debuggers know when a tail call happenshttps://redmine.ruby-lang.org/issues/15313?journal_id=750252018-11-21T23:58:41Zalanwu (Alan Wu)
<ul></ul><p>Yes if the return events can fire as usual even when tail calls happen it would be perfect and would fix <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: Return tracepoint doesn't fire when tailcall optimization is applied (Closed)" href="https://redmine.ruby-lang.org/issues/15303">#15303</a>.</p>
<p>I don't see a way to fire the return events in the normal order without extra allocations, though. Maybe it's possible?</p>
<p>We could fire the return event before the tailcall happens, #return_value method would be confusing though.</p>
<blockquote>
<p>BTW, if you provide an API, sample code will help us to understand.</p>
</blockquote>
<p>Thank you for letting me know! I will remember to also post examples on the tracker next time.</p>
<p>The following demonstrates how this API could be used :</p>
<pre><code>require 'forwardable'
trace = TracePoint.new(:call) do |tp|
puts(if tp.tailcall?
"a tail call happened!"
else
"a normal call happened"
end)
end
trace.enable do
# call some methods
printer = String.new
printer.extend Forwardable
printer.def_delegator "STDOUT", "puts"
printer.puts "Howdy!"
end
</code></pre> Ruby master - Bug #15313: [PATCH] Let debuggers know when a tail call happenshttps://redmine.ruby-lang.org/issues/15313?journal_id=750872018-11-22T17:49:11Zalanwu (Alan Wu)
<ul><li><strong>File</strong> <a href="/attachments/7481">0001-Add-a-tail-call-predicate-for-TracePoint.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/7481/0001-Add-a-tail-call-predicate-for-TracePoint.patch">0001-Add-a-tail-call-predicate-for-TracePoint.patch</a> added</li><li><strong>File</strong> deleted (<del><i>0001-Add-a-tail-call-predicate-for-TracePoint.patch</i></del>)</li></ul><p>I noticed that the original patch doesn't compile with GCC.<br>
-Werror=declaration-after-statement doesn't seem to have any effect on Clang: <a href="https://godbolt.org/z/8Qykk4" class="external">https://godbolt.org/z/8Qykk4</a> (switch to gcc to see it fail to compile. It compiles on Clang)<br>
seems to be a known issue: <a href="https://bugs.llvm.org/show_bug.cgi?id=27493" class="external">https://bugs.llvm.org/show_bug.cgi?id=27493</a></p> Ruby master - Bug #15313: [PATCH] Let debuggers know when a tail call happenshttps://redmine.ruby-lang.org/issues/15313?journal_id=754032018-12-05T04:59:54Zalanwu (Alan Wu)
<ul></ul><p>Could I ask for some feedback on this?</p> Ruby master - Bug #15313: [PATCH] Let debuggers know when a tail call happenshttps://redmine.ruby-lang.org/issues/15313?journal_id=754082018-12-05T07:05:19Zko1 (Koichi Sasada)
<ul></ul><p>how about <a href="https://bugs.ruby-lang.org/issues/15303#note-2" class="external">https://bugs.ruby-lang.org/issues/15303#note-2</a> ?</p> Ruby master - Bug #15313: [PATCH] Let debuggers know when a tail call happenshttps://redmine.ruby-lang.org/issues/15313?journal_id=835082019-12-29T10:33:31Zhsbt (Hiroshi SHIBATA)hsbt@ruby-lang.org
<ul><li><strong>Tags</strong> set to <i>patch, tracepoint</i></li></ul> Ruby master - Bug #15313: [PATCH] Let debuggers know when a tail call happenshttps://redmine.ruby-lang.org/issues/15313?journal_id=873242020-08-31T20:17:07Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>As tailcall optimization was removed in <a class="changeset" title="Disable tailcall optimization [Bug #15303] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@663..." href="https://redmine.ruby-lang.org/projects/ruby-master/repository/git/revisions/241dced625f9ba8a4071954579778a0940e75179">241dced625f9ba8a4071954579778a0940e75179</a>, I think this can be closed.</p>