Adjust expansion of contract submod redirection

The `local-expand` based trick defeats optimizations for the
contract system because of the extra `let-values` that's
introduced, so use `syntax-local-lift-require` instead.

This commit combined with the previous commit improves
the performance of the test at

  typed-racket-test/performance/function-contract.

by a significant amount back to v6.1.1 performance.

Thanks to Robby for discovering the regression.
This commit is contained in:
Asumu Takikawa 2015-10-27 23:33:02 -04:00
parent 555571c268
commit a24852548a
2 changed files with 6 additions and 6 deletions

View File

@ -529,8 +529,8 @@
;; indirection here (see the implementation in
;; provide-handling.rkt).
;;
;; First, we generate a macro that expands to a
;; `local-require` of the contracted identifier in the
;; First, we generate a macro that lifts a
;; `require` of the contracted identifier in the
;; #%contract-defs submodule:
;; (define-syntax con-f (mk-redirect f))
;;
@ -542,7 +542,7 @@
;; because it's important for `export-f` to be a
;; rename-transformer (making things like
;; `syntax-local-value` work right), but `con-f` can't be,
;; since it expands to a `local-require`.
;; since it lifts a `require`
new-export-defs ...
;; Finally, we do the export:

View File

@ -31,9 +31,9 @@
(with-syntax ([mp (collapse-module-path-index
contract-defs-submod-modidx)]
[i (datum->syntax id (syntax-e id) stx stx)])
#`(let ()
(local-require (only-in mp [#,(datum->syntax #'mp (syntax-e #'i)) i]))
i))]
(syntax-local-lift-require
#`(rename mp i #,(datum->syntax #'mp (syntax-e #'i)))
#'i))]
[else
(datum->syntax stx
(cons (redirect (car (syntax-e stx)))