expander: fix tracking of MPIs for cross-submodule inlining

This commit is contained in:
Matthew Flatt 2018-02-26 17:18:54 -07:00
parent 40219b88f3
commit 55a27e01a6
5 changed files with 34 additions and 10 deletions

View File

@ -2262,6 +2262,29 @@ case of module-leve bindings; it doesn't cover local bindings.
(require 'check-shadowing-in-other-phase-b)
b)
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Make sure that cross-module inlinign doesn't
;; lose track of shifts for module path indices
(module likely-inlines-across-two-submodules racket/base
(provide result)
(module a racket/base
(provide get-x)
(define x 5)
(set! x x)
(define (get-x) x))
(module b racket/base
(require (submod ".." a))
(provide get-x2)
(define (get-x2) (get-x)))
(require 'b)
(define result (get-x2)))
(test 5 dynamic-require ''likely-inlines-across-two-submodules 'result)
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(report-errs)

View File

@ -404,7 +404,7 @@
(values phase
(module-linklet-info linklet
(hash-ref phase-to-link-module-uses phase #f)
self
(compiled-in-memory-original-self cim)
#f ; inspector is the same as the module being compiled
(compiled-in-memory-compile-time-inspector cim)
(and phase-to-extra-inspectorsss

View File

@ -172,13 +172,13 @@
(define module-uses (hash-ref phase-to-link-modules phase-level))
(define-values (import-module-instances import-instances)
(for/lists (mis is) ([mu (in-list module-uses)])
(namespace-module-use->module+linklet-instances
ns mu
#:shift-from original-self
#:shift-to self
#:phase-shift
(phase+ (phase- phase-level (module-use-phase mu))
phase-shift))))
(namespace-module-use->module+linklet-instances
ns mu
#:shift-from original-self
#:shift-to self
#:phase-shift
(phase+ (phase- phase-level (module-use-phase mu))
phase-shift))))
(check-require-access phase-linklet #:skip-imports 2
module-uses import-module-instances insp

View File

@ -522,7 +522,7 @@
(cond
[(not (expand-context-to-parsed? init-ctx))
;; Shift the "self" reference that we have been using for expansion
;; to a generic and constant (for a particualr submodule path)
;; to a generic and constant (for a particular submodule path)
;; "self", so that we can reocognize it for compilation or to shift
;; back on any future re-expansion:
(define generic-self (make-generic-self-module-path-index self))

View File

@ -35670,7 +35670,8 @@ static const char *startup_source =
" phase-to-link-module-uses_5"
" phase_93"
" #f)"
" self_25"
"(compiled-in-memory-original-self"
" cim_10)"
" #f"
"(compiled-in-memory-compile-time-inspector"
" cim_10)"