cs: improve raco dec
output
Handle `--linklet` mode better and show fasled arguments to compiled linklet functions.
This commit is contained in:
parent
a76380a343
commit
4ad93bcca0
|
@ -84,7 +84,8 @@
|
|||
(list '#:key k '#:value (decompile v #:to-linklets? to-linklets?))]))))]
|
||||
[else
|
||||
(decompile-module top)])]
|
||||
[(linkl? top)
|
||||
[(or (linkl? top)
|
||||
(linklet? top))
|
||||
(decompile-linklet top)]
|
||||
[(faslable-correlated-linklet? top)
|
||||
(strip-correlated (faslable-correlated-linklet-expr top))]
|
||||
|
@ -257,7 +258,10 @@
|
|||
(case fmt
|
||||
[(compile)
|
||||
(define proc ((vm-eval `(load-compiled-from-port (open-bytevector-input-port ,uncompressed-code)))))
|
||||
(decompile-chez-procedure (if (null? args) proc (apply proc args)))]
|
||||
(let ([proc (decompile-chez-procedure (if (null? args) proc (apply proc args)))])
|
||||
(if (null? args)
|
||||
proc
|
||||
(cons proc (map (vm-primitive 'force-unfasl) args))))]
|
||||
[(interpret)
|
||||
(define bytecode (vm-eval `(fasl-read (open-bytevector-input-port ,uncompressed-code))))
|
||||
(list `(#%interpret ,(unwrap-chez-interpret-jitified bytecode)))]
|
||||
|
|
|
@ -125,20 +125,25 @@
|
|||
[else (relative-path-elements->path e)]))
|
||||
|
||||
(define (force-unfasl tf)
|
||||
(define vb (to-fasl-vb tf))
|
||||
(define v (unbox vb))
|
||||
(cond
|
||||
[(bytes? v)
|
||||
(define v2 (parameterize ([current-load-relative-directory (to-fasl-wrt tf)])
|
||||
(fasl->s-exp v
|
||||
#:datum-intern? #t
|
||||
#:external-lifts (to-fasl-lifts tf))))
|
||||
(box-cas! vb v v2)
|
||||
(set-to-fasl-wrt! tf #f)
|
||||
(unbox vb)]
|
||||
[(not (to-fasl? tf))
|
||||
;; act as identity on other values for the benefit of `raco decompile`
|
||||
tf]
|
||||
[else
|
||||
;; already forced (or never fasled)
|
||||
v]))
|
||||
(define vb (to-fasl-vb tf))
|
||||
(define v (unbox vb))
|
||||
(cond
|
||||
[(bytes? v)
|
||||
(define v2 (parameterize ([current-load-relative-directory (to-fasl-wrt tf)])
|
||||
(fasl->s-exp v
|
||||
#:datum-intern? #t
|
||||
#:external-lifts (to-fasl-lifts tf))))
|
||||
(box-cas! vb v v2)
|
||||
(set-to-fasl-wrt! tf #f)
|
||||
(unbox vb)]
|
||||
[else
|
||||
;; already forced (or never fasled)
|
||||
v])]))
|
||||
|
||||
(define (cannot-fasl v)
|
||||
(error 'write
|
||||
|
|
Loading…
Reference in New Issue
Block a user