cs: drop unused correlation early

The improvements reported in 74012f8c57 were actually due to a broken
experiment that dropped source locations on application forms, instead
of preserving them in marshaled code. Adjust the expansion pipeline
to do that earlier and intentionally.

The xify pas doesn't help all that much after all, but it's still more
comfortable to be independent of local-variable names.
This commit is contained in:
Matthew Flatt 2018-06-22 11:04:00 -06:00
parent 74012f8c57
commit cf0b38aee9
6 changed files with 25 additions and 11 deletions

View File

@ -4,7 +4,8 @@
load-on-demand-enabled load-on-demand-enabled
call-in-main-thread call-in-main-thread
version version
exit) exit
compile-keep-source-locations!)
(import (except (chezpart) (import (except (chezpart)
syntax->datum syntax->datum
datum->syntax) datum->syntax)

View File

@ -43,6 +43,7 @@
compiled-position->primitive compiled-position->primitive
primitive-in-category? primitive-in-category?
omit-debugging? ; not exported to racket
platform-independent-zo-mode? ; not exported to racket platform-independent-zo-mode? ; not exported to racket
linklet-performance-init! ; not exported to racket linklet-performance-init! ; not exported to racket
linklet-performance-report! ; not exported to racket linklet-performance-report! ; not exported to racket
@ -276,7 +277,7 @@
(wrapped-code-content-set! wc f) (wrapped-code-content-set! wc f)
f)] f)]
[else [else
(let* ([f (compile* (wrapped-code-content wc))]) (let ([f (compile* f)])
(when jit-demand-on? (when jit-demand-on?
(show "JIT demand" (strip-nested-annotations (wrapped-code-content wc)))) (show "JIT demand" (strip-nested-annotations (wrapped-code-content wc))))
(wrapped-code-content-set! wc f) (wrapped-code-content-set! wc f)

View File

@ -25,16 +25,20 @@
module->language-info module->language-info
module-path-index-join module-path-index-join
version version
exit) exit
compile-keep-source-locations!)
(regexp) (regexp)
(io) (io)
(thread) (thread)
(only (linklet) (only (linklet)
omit-debugging?
platform-independent-zo-mode? platform-independent-zo-mode?
linklet-performance-init! linklet-performance-init!
linklet-performance-report!)) linklet-performance-report!))
(linklet-performance-init!) (linklet-performance-init!)
(unless omit-debugging?
(compile-keep-source-locations! #t))
(define the-command-line-arguments (define the-command-line-arguments
(or (and (top-level-bound? 'bytes-command-line-arguments) (or (and (top-level-bound? 'bytes-command-line-arguments)

View File

@ -12,7 +12,11 @@
(provide correlate* (provide correlate*
correlate~ correlate~
correlate/app correlate/app
->correlated) ->correlated
compile-keep-source-locations!)
(define keep-source-locations? #f)
(define (correlate* stx s-exp) (define (correlate* stx s-exp)
(if (syntax-srcloc stx) (if (syntax-srcloc stx)
@ -26,9 +30,13 @@
s-exp) s-exp)
(define (correlate/app stx s-exp) (define (correlate/app stx s-exp)
(if (eq? (system-type 'vm) 'chez-scheme) (if keep-source-locations?
(correlate* stx s-exp) (correlate* stx s-exp)
(correlate~ stx s-exp))) (correlate~ stx s-exp)))
(define (->correlated s) (define (->correlated s)
(datum->correlated s #f)) (datum->correlated s #f))
(define (compile-keep-source-locations! on?)
(set! keep-source-locations? on?))

View File

@ -18,6 +18,8 @@
"namespace/core.rkt" "namespace/core.rkt"
"namespace/primitive-module.rkt" "namespace/primitive-module.rkt"
"expand/missing-module.rkt" "expand/missing-module.rkt"
(only-in "compile/correlate.rkt"
compile-keep-source-locations!)
"boot/kernel.rkt" "boot/kernel.rkt"
"boot/read-primitive.rkt" "boot/read-primitive.rkt"
"boot/main-primitive.rkt" "boot/main-primitive.rkt"
@ -104,7 +106,9 @@
declare-primitive-module! ; to support "extensions" declare-primitive-module! ; to support "extensions"
embedded-load ; for -k embedded-load ; for -k
compile-keep-source-locations! ; to enable if the back end wants them
;; This functions are provided for basic testing ;; This functions are provided for basic testing
;; (such as "demo.rkt") ;; (such as "demo.rkt")
syntax? syntax-e syntax? syntax-e

View File

@ -65,11 +65,7 @@
(define u-id (unwrap (car ids))) (define u-id (unwrap (car ids)))
(define x (or (hash-ref env u-id #f) (define x (or (hash-ref env u-id #f)
(string->symbol (string-append "x" (number->string (hash-count env)))))) (string->symbol (string-append "x" (number->string (hash-count env))))))
(define-values (rest-xs rest-env) (xify-ids (cdr ids) (define-values (rest-xs rest-env) (xify-ids (cdr ids) (hash-set env u-id x)))
(if (and (eq? x u-id)
(not (hash-ref env u-id #f)))
env
(hash-set env u-id x))))
(values (cons x rest-xs) rest-env)] (values (cons x rest-xs) rest-env)]
[(null? ids) (values '() env)] [(null? ids) (values '() env)]
[else [else