guile-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] debugger: Support generics. WIP.


From: Matt Wette
Subject: Re: [PATCH] debugger: Support generics. WIP.
Date: Wed, 12 Sep 2018 05:36:07 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 09/12/2018 04:44 AM, Jan Nieuwenhuizen wrote:
Hi!

I'm looking at the debugger again and have found a number of things*)
that I would like to fix.  My first attempt is for GOOPS support: I want
,break-at-source FILE LINE to also support breaking if LINE happens to
be in a define-method.


I have been looking into debugging also.  My first attempt is to add option
(... #:debug #t ...) that will expand the frame so that slots are not reused.
Nothing is working yet, but to give you an idea ...

scripts/compile.scm:
@@ -95,6 +95,12 @@
                                     (cons (string->symbol arg) warnings)
                                     (alist-delete 'warnings result))))))
+ (option '(#\g "debug") #f #f
+               (lambda (opt name arg result)
+                 (alist-cons 'optimizations
+                             (cons* #:debug #t (optimizations-for-level 0))
+                             result)))
+       
        (option '(#\O "optimize") #t #f
                (lambda (opt name arg result)
                   (define (return val)


cps/compile-bytecode.scm:
@@ -84,6 +90,9 @@
 (define (compile-function cps asm opts)
   (let* ((allocation (allocate-slots cps #:precolor-calls?
                                      (kw-arg-ref opts #:precolor-calls? #t)))
+        (allocation (if (kw-arg-ref opts #:debug #f)
+                        (expand-slots allocation)
+                        allocation))
          (forwarding-labels (compute-forwarding-labels cps allocation))
          (frame-size (lookup-nlocals allocation)))
     (define (forward-label k)
@@ -581,6 +590,7 @@
          (emit-end-arity asm)
          (emit-end-program asm))))



cps/slot-allocation.scm:
@@ -1059,3 +1059,19 @@
                (frame-size (compute-frame-size cps slots calls shuffles)))
           (make-allocation slots representations constants calls
                            shuffles frame-size))))))
+
+(define (expand-slots allocation)
+  (display "expanding slots\n")
+  (match allocation
+    (($ $allocation slots representations constant-values call-allocs
+       shuffles frame-size)
+     (call-with-values
+        (lambda ()
+          (intmap-fold
+           (lambda (ix iv im n) (values (intmap-add im ix n) (1+ n)))
+           slots empty-intmap 0))
+       (lambda (xslots xframe-size)
+        (make-allocation xslots representations constant-values call-allocs
+                         shuffles xframe-size))))))
+(export expand-slots)
+




reply via email to

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