From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 56477 invoked by alias); 12 Feb 2016 21:53:59 -0000 Mailing-List: contact kawa-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: kawa-owner@sourceware.org Received: (qmail 56454 invoked by uid 89); 12 Feb 2016 21:53:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: aibo.runbox.com Received: from aibo.runbox.com (HELO aibo.runbox.com) (91.220.196.211) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 12 Feb 2016 21:53:56 +0000 Received: from [10.9.9.213] (helo=mailfront13.runbox.com) by bars.runbox.com with esmtp (Exim 4.71) (envelope-from ) id 1aULew-00041X-VE; Fri, 12 Feb 2016 22:53:51 +0100 Received: from 70-36-239-75.dsl.dynamic.fusionbroadband.com ([70.36.239.75] helo=toshie.bothner.com) by mailfront13.runbox.com with esmtpsa (uid:757155 ) (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) id 1aULew-0003Nr-Gg; Fri, 12 Feb 2016 22:53:50 +0100 Subject: Re: How do i debug --no-inline or --full-tailcalls options? To: OKUMURA Yuki , kawa@sourceware.org References: <56BC9451.30002@bothner.com> From: Per Bothner Message-ID: <56BE546B.7050207@bothner.com> Date: Fri, 12 Feb 2016 21:53:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-q1/txt/msg00014.txt.bz2 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/