public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: OKUMURA Yuki <mjt@cltn.org>
To: kawa@sourceware.org
Subject: Re: How do i debug --no-inline or --full-tailcalls options?
Date: Thu, 11 Feb 2016 18:26:00 -0000	[thread overview]
Message-ID: <CAG1-Us2AMj5s_TwMmeh5-9y8RA9P+iPYVUmM88y7yroPAH0T2w@mail.gmail.com> (raw)
In-Reply-To: <56BC9451.30002@bothner.com>

Ah, thanks for the comments!

2016-02-11 23:01 GMT+09:00 Per Bothner <per@bothner.com>:
- snip -
> Why do you want to use --no-inlining?  One advantage I can see is beter
> stack traces (at least when --no-full-tailcalls).  It might be reasonable to
> retrict --no-inlining's effect to "normal" functions.

Use of --no-inline is just because it (accidentally) solved another problem:
(https://github.com/okuoku/yuni/issues/34)

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!)

I prepared (somewhat) minified program which exhibits the problem:

https://gist.github.com/okuoku/d5cba6f31b781db911aa

The code prepares 2 vectors which hold some data but when
I move some setters into a R7RS library, these setters are
mysteriously "skipped" and a vector field would left uninitialized.

Without --full-tailcall nor --no-inline, it works fine:

$ java kawa.repl --r7rs check3.scm
(SET!-CALLED: 0 test)
(SET!-CALLED: 1 #<procedure testfunc>)
(SET!-CALLED: 0 #(test #<procedure testfunc>))
(SET!-CALLED: 1 (INIT1 . INIT2))
(#(test #<procedure testfunc>) ("INIT1" . "INIT2"))

but with --full-tailcall, a SET!-CALLED message is missing;

$ java kawa.repl --r7rs --full-tailcalls check3.scm
(SET!-CALLED: 0 test)
(SET!-CALLED: 1 #<procedure testfunc>)
(SET!-CALLED: 1 (INIT1 . INIT2))
("UNINITIALIZED_x" ("INIT1" . "INIT2"))

this means a line here★

(define (make-minidispatch-obj class param)
  (let ((obj (make-minitype-obj)))
   (baseset! obj 0 class) ★
   (baseset! obj 1 param)
   obj))))

was skipped.


The problem is gone in case we added --no-inline:

$ java kawa.repl --r7rs --full-tailcalls --no-inline check3.scm
(SET!-CALLED: 0 test)
(SET!-CALLED: 1 #<procedure testfunc>)
(SET!-CALLED: 0 #(test #<procedure testfunc>))
(SET!-CALLED: 1 (INIT1 . INIT2))
(#(test #<procedure testfunc>) ("INIT1" . "INIT2"))

This is why I ended up specifying --no-inline.

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

  reply	other threads:[~2016-02-11 18:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-11  8:51 OKUMURA Yuki
2016-02-11 14:02 ` Per Bothner
2016-02-11 18:26   ` OKUMURA Yuki [this message]
2016-02-12 21:53     ` Per Bothner
2016-02-12  1:26 ` Per Bothner
2016-02-12  7:25   ` Per Bothner
2016-02-12 17:33     ` OKUMURA Yuki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAG1-Us2AMj5s_TwMmeh5-9y8RA9P+iPYVUmM88y7yroPAH0T2w@mail.gmail.com \
    --to=mjt@cltn.org \
    --cc=kawa@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).