This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How do i debug --no-inline or --full-tailcalls options?




On 02/11/2016 10:26 AM, OKUMURA Yuki wrote:
I don't fully understand what is happening on that issue yet;
with --full-tailcalls and without --no-inline,
Kawa seems to skip some procedures when its result is not
consumed at all. (ie. every skipped procedures were wrapper around SET!)

This was a bug in the code generation.  When you compile with --full-tailcalls,
a function call is split into two parts:
(1) The first part pushes the arguments and a reference to the function
into the per-thread CallContext.
(2) The actual body of the function is a separate method that is executed by the
"trampoline loop" in CallContext.

If the call is a tail-call, then the caller returns after doing (1), and the trampoline
loop is done by caller's caller (and so on if the caller's call is also a tail-call).

The problem when the call is *not* a tail-call.  In that case, the
caller must make sure the trampoline loop is called so we get the
function's result (or in this case side effects).  This was not happening
in your test-case.

I suspect this behaviour is backend's problem since when I merged
explicit libraries into a module, problem would just disappear.

The define-library affects the code generation because it affects
what functions are exported and how things are inlined.

I checked in a fix, along with a simplified version of your testcase.  Thanks!
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]