* [bug #29817] `define*' procedures get invalid source info [1.9.10]
@ 2010-05-07 9:48 Ludovic Courtès
2010-05-21 11:21 ` Andy Wingo
2010-06-05 17:51 ` Andy Wingo
0 siblings, 2 replies; 3+ messages in thread
From: Ludovic Courtès @ 2010-05-07 9:48 UTC (permalink / raw)
To: Ludovic Courtès, bug-guile
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/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [bug #29817] `define*' procedures get invalid source info [1.9.10]
2010-05-07 9:48 [bug #29817] `define*' procedures get invalid source info [1.9.10] Ludovic Courtès
@ 2010-05-21 11:21 ` Andy Wingo
2010-06-05 17:51 ` Andy Wingo
1 sibling, 0 replies; 3+ messages in thread
From: Andy Wingo @ 2010-05-21 11:21 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: bug-guile
On Fri 07 May 2010 11:48, Ludovic Courtès <INVALID.NOREPLY@gnu.org> writes:
> Summary: `define*' procedures get invalid source info
Interesting bug! Added to my list. Should not be difficult to fix.
Andy
--
http://wingolog.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
* [bug #29817] `define*' procedures get invalid source info [1.9.10]
2010-05-07 9:48 [bug #29817] `define*' procedures get invalid source info [1.9.10] Ludovic Courtès
2010-05-21 11:21 ` Andy Wingo
@ 2010-06-05 17:51 ` Andy Wingo
1 sibling, 0 replies; 3+ messages in thread
From: Andy Wingo @ 2010-06-05 17:51 UTC (permalink / raw)
To: Ludovic Courtès, Andy Wingo, bug-guile
Update of bug #29817 (project guile):
Status: None => Fixed
Open/Closed: Open => Closed
_______________________________________________________
Follow-up Comment #1:
Source location with IP 25 is not actually invalid, as IP 23 is actually the
IP just before the tail-call; 25 is the IP afterwards, where source location
info is associated. That part is correct, giving the right location for the
procedure call.
The fact that there is no source location associated with the definition was
a bug in which output introduced by a macro would have no source location
information. Logically it actually has at least two source locations: the
location of the macro definition, and that of the use.
Usually the use location is more useful, which is fortunate as we don't
actually have a way to record locations in macro definitions (due to lack of
needed fields in syntax objects).
So, the solution was to associate the source location of use with output
introduced by the macro (i.e. define*). This has been checked into master.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?29817>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-06-05 17:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-07 9:48 [bug #29817] `define*' procedures get invalid source info [1.9.10] Ludovic Courtès
2010-05-21 11:21 ` Andy Wingo
2010-06-05 17:51 ` Andy Wingo
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).