From: "Ludovic Courtès" <INVALID.NOREPLY@gnu.org>
To: "Ludovic Courtès" <ludo@gnu.org>, bug-guile@gnu.org
Subject: [bug #29817] `define*' procedures get invalid source info [1.9.10]
Date: Fri, 07 May 2010 09:48:32 +0000 [thread overview]
Message-ID: <20100507-094831.sv15145.86664@savannah.gnu.org> (raw)
In-Reply-To:
URL:
<http://savannah.gnu.org/bugs/?29817>
Summary: `define*' procedures get invalid source info
[1.9.10]
Project: Guile
Submitted by: civodul
Submitted on: Fri 07 May 2010 09:48:31 AM GMT
Category: None
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
Consider this procedure of one optional argument:
#v+
scheme@(guile-user)> (define* (foo #:optional y) (baz))
scheme@(guile-user)> (program-sources foo)
$25 = ((25 #f 64 . 28))
scheme@(guile-user)> ,x foo
Disassembly of #<procedure foo (#:optional y)>:
0 (assert-nargs-ge 0 0)
3 (bind-optionals 0 1)
6 (assert-nargs-ee 0 1)
9 (reserve-locals 0 1)
12 (local-bound? 0)
14 (br-if :L730) ;; -> 21
18 (make-false)
19 (local-set 0) ;; `y'
21 (toplevel-ref 1) ;; `baz'
23 (tail-call 0) at (unknown
file):64:28
#v-
Its program source info points at IP 25 whereas its last IP is 23. In
addition, it has no info associated with IP 0, which single-arity procedures
always have AFAICS.
The latter is solved when using `lambda*', but not the former:
#v+
scheme@(guile-user)> (define foo (lambda* (#:optional y) (baz)))
scheme@(guile-user)> (program-sources foo)
$26 = ((0 #f 67 . 12) (25 #f 67 . 36))
scheme@(guile-user)> ,x foo
Disassembly of #<procedure foo (#:optional y)>:
0 (assert-nargs-ge 0 0)
3 (bind-optionals 0 1)
6 (assert-nargs-ee 0 1)
9 (reserve-locals 0 1)
12 (local-bound? 0)
14 (br-if :L757) ;; -> 21
18 (make-false)
19 (local-set 0) ;; `y'
21 (toplevel-ref 1) ;; `baz'
23 (tail-call 0) at (unknown
file):67:36
#v-
Finally, using `case-lambda' leads to different code, with more source info,
but again with one IP off (19 instead of 17):
#v+
scheme@(guile-user)> (define foo (case-lambda (() (baz)) ((y) (baz))))
scheme@(guile-user)> (program-sources foo)
$27 = ((0 #f 70 . 12) (13 #f 70 . 29) (15 #f 70 . 12) (19 #f 70 . 41))
scheme@(guile-user)> ,x foo
Disassembly of #<procedure foo () | (y)>:
0 (br-if-nargs-ne 0 0 :L785) ;; -> 13
6 (reserve-locals 0 0)
9 (toplevel-ref 1) ;; `baz'
11 (tail-call 0) at (unknown
file):70:29
13 (assert-nargs-ee/locals 1) at (unknown
file):70:12
15 (toplevel-ref 1) ;; `baz'
17 (tail-call 0) at (unknown
file):70:41
#v-
Ludo'.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?29817>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
next reply other threads:[~2010-05-07 9:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-07 9:48 Ludovic Courtès [this message]
2010-05-21 11:21 ` [bug #29817] `define*' procedures get invalid source info [1.9.10] Andy Wingo
2010-06-05 17:51 ` Andy Wingo
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
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100507-094831.sv15145.86664@savannah.gnu.org \
--to=invalid.noreply@gnu.org \
--cc=bug-guile@gnu.org \
--cc=ludo@gnu.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).