bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #29817] `define*' procedures get invalid source info [1.9.10]


From: Ludovic Courtès
Subject: [bug #29817] `define*' procedures get invalid source info [1.9.10]
Date: Fri, 07 May 2010 09:48:32 +0000
User-agent: Mozilla/5.0 (GNU; rv:1.9.1.7) Gecko/20100107 IceCat/3.6 (like Firefox/3.6)

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/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]