diff --git a/whalesong/compiler/compiler.rkt b/whalesong/compiler/compiler.rkt index 745203a..ef0e07b 100644 --- a/whalesong/compiler/compiler.rkt +++ b/whalesong/compiler/compiler.rkt @@ -277,11 +277,13 @@ (append-instruction-sequences (make-TestAndJump (make-TestTrue (make-ModulePredicate a-module-name 'linked?)) linked) - ;; TODO: raise an exception here that says that the module hasn't been + ;; TODO: try to link dynamically, using plt.runtime.currentModuleLoader. + (make-Perform (make-LinkModule! a-module-name)) + ;; If that fails, finally raise an exception here that says that the module hasn't been ;; linked yet. - (make-DebugPrint (make-Const - (format "DEBUG: the module ~a hasn't been linked in!!!" - (ModuleLocator-name a-module-name)))) + #;(make-DebugPrint (make-Const + (format "DEBUG: the module ~a hasn't been linked in!!!" + (ModuleLocator-name a-module-name)))) (make-Goto (make-Label (LinkedLabel-label on-return))) linked (make-TestAndJump (make-TestTrue diff --git a/whalesong/compiler/il-structs.rkt b/whalesong/compiler/il-structs.rkt index 8e3dfdc..213459e 100644 --- a/whalesong/compiler/il-structs.rkt +++ b/whalesong/compiler/il-structs.rkt @@ -473,6 +473,9 @@ (define-struct: InstallContinuationMarkEntry! () #:transparent) +;; Use the dynamic module loader to link the module into the runtime. +(define-struct: LinkModule! ([path : ModuleLocator])) + ;; Installs a module record into the machine (define-struct: InstallModuleEntry! ([name : Symbol] [path : ModuleLocator] @@ -520,6 +523,7 @@ RestoreEnvironment! RestoreControl! + LinkModule! InstallModuleEntry! MarkModuleInvoked! AliasModuleAsMain!