mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 11:50:28 +02:00
compile all of base/; some arbitrary changes; more "fixes" to `link'
* module/language/scheme/translate.scm (lookup-transformer): When expanding syncase macros, use the eval closure from the ghil-env. Probably doesn't make any difference whatsoever. * module/system/base/Makefile.am (SOURCES): Compile pmatch.scm, now that it works :-)) * module/system/base/compile.scm (compile-in): Compile inside a save-module-excursion, so that side effects of evaluation don't leak out. * module/system/base/pmatch.scm: Change from :use-syntax/:export-syntax to simply :use-modules/:export. Also probably has no effect. * module/system/il/ghil.scm (fix-ghil-mod!): Suppress warnings resulting from compilation of define-module. * src/vm_loader.c (link): So, referencing variables defined but not exported from the current module didn't work. Fixed that, but it's hacky. There are still some uncaught cases.
This commit is contained in:
parent
8f43eb2b42
commit
1b8abe5514
6 changed files with 42 additions and 30 deletions
|
@ -50,8 +50,8 @@
|
|||
'(procedure->syntax procedure->macro procedure->memoizing-macro))
|
||||
|
||||
(define (lookup-transformer e head retrans)
|
||||
(let ((val (and=> (module-variable (ghil-mod-module (ghil-env-mod e)) head)
|
||||
variable-ref)))
|
||||
(let* ((mod (ghil-mod-module (ghil-env-mod e)))
|
||||
(val (and=> (module-variable mod head) variable-ref)))
|
||||
(cond
|
||||
((or (primitive-macro? val) (eq? val eval-case))
|
||||
(or (assq-ref primitive-syntax-table head)
|
||||
|
@ -68,7 +68,7 @@
|
|||
(sc-expand3 (module-ref the-syncase-module 'sc-expand3)))
|
||||
(lambda (env loc exp)
|
||||
(retrans
|
||||
(with-fluids ((eec (module-eval-closure (current-module))))
|
||||
(with-fluids ((eec (module-eval-closure mod)))
|
||||
(sc-expand3 exp 'c '(compile load eval)))))))
|
||||
|
||||
((macro? val)
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
SOURCES = syntax.scm compile.scm language.scm
|
||||
# we don't deal well with syncase yet
|
||||
NOCOMP_SOURCES = pmatch.scm
|
||||
SOURCES = pmatch.scm syntax.scm compile.scm language.scm
|
||||
GOBJECTS = $(SOURCES:%.scm=%.go)
|
||||
|
||||
vmdir = $(guiledir)/system/vm
|
||||
vm_DATA = $(SOURCES) $(NOCOMP_SOURCES) $(GOBJECTS)
|
||||
vm_DATA = $(SOURCES) $(GOBJECTS)
|
||||
|
||||
CLEANFILES = $(GOBJECTS)
|
||||
|
||||
|
|
|
@ -115,20 +115,22 @@
|
|||
(call-with-input-file file (language-read-file lang)))
|
||||
|
||||
(define (compile-in x e lang . opts)
|
||||
(catch 'result
|
||||
(lambda ()
|
||||
;; expand
|
||||
(set! x ((language-expander lang) x e))
|
||||
(if (memq :e opts) (throw 'result x))
|
||||
;; translate
|
||||
(set! x ((language-translator lang) x e))
|
||||
(if (memq :t opts) (throw 'result x))
|
||||
;; compile
|
||||
(set! x (apply compile x e opts))
|
||||
(if (memq :c opts) (throw 'result x))
|
||||
;; assemble
|
||||
(apply assemble x e opts))
|
||||
(lambda (key val) val)))
|
||||
(save-module-excursion
|
||||
(lambda ()
|
||||
(catch 'result
|
||||
(lambda ()
|
||||
;; expand
|
||||
(set! x ((language-expander lang) x e))
|
||||
(if (memq :e opts) (throw 'result x))
|
||||
;; translate
|
||||
(set! x ((language-translator lang) x e))
|
||||
(if (memq :t opts) (throw 'result x))
|
||||
;; compile
|
||||
(set! x (apply compile x e opts))
|
||||
(if (memq :c opts) (throw 'result x))
|
||||
;; assemble
|
||||
(apply assemble x e opts))
|
||||
(lambda (key val) val)))))
|
||||
|
||||
;;;
|
||||
;;;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
(define-module (system base pmatch)
|
||||
#:use-syntax (ice-9 syncase)
|
||||
#:export-syntax (pmatch ppat))
|
||||
#:use-module (ice-9 syncase)
|
||||
#:export (pmatch ppat))
|
||||
;; FIXME: shouldn't have to export ppat...
|
||||
|
||||
;; Originally written by Oleg Kiselyov. Taken from:
|
||||
|
|
|
@ -191,9 +191,15 @@
|
|||
(make-ghil-env (make-ghil-mod iface)))))
|
||||
|
||||
(define (fix-ghil-mod! mod for-sym)
|
||||
(warn "during lookup of" for-sym ":" (ghil-mod-module mod) "!= current" (current-module))
|
||||
;;; So, these warnings happen for all instances of define-module.
|
||||
;;; Rather than fixing the problem, I'm going to suppress the common
|
||||
;;; warnings.
|
||||
(if (not (eq? for-sym 'process-define-module))
|
||||
(warn "during lookup of" for-sym ":"
|
||||
(ghil-mod-module mod) "!= current" (current-module)))
|
||||
(if (not (null? (ghil-mod-table mod)))
|
||||
(warn "throwing away old variable table" (ghil-mod-table mod)))
|
||||
(warn "throwing away old variable table"
|
||||
(ghil-mod-module) (ghil-mod-table mod)))
|
||||
(set! (ghil-mod-module mod) (current-module))
|
||||
(set! (ghil-mod-table mod) '())
|
||||
(set! (ghil-mod-imports mod) '()))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue