Tweak boot-init mechanism to only run when necessary.
authorChris Hanson <org/chris-hanson/cph>
Fri, 6 Jan 2017 06:40:31 +0000 (22:40 -0800)
committerChris Hanson <org/chris-hanson/cph>
Fri, 6 Jan 2017 06:40:31 +0000 (22:40 -0800)
Also eliminate never-used exports.

src/runtime/boot.scm
src/runtime/make.scm
src/runtime/runtime.pkg

index 1cc4b8ec527da092b23e94e422e9be6fd226446b..3350632a88f11524baaa2d11ce0eafea6abe2a39 100644 (file)
@@ -143,22 +143,6 @@ USA.
 (define-integrable (default-object)
   ((ucode-primitive object-set-type) (ucode-type constant) 7))
 
-(define (load-with-boot-inits! . arguments)
-  (receive (value inits)
-      (let ((inner '()))
-       (define (swap!)
-         (set! boot-inits (set! inner (set! boot-inits)))
-         unspecific)
-       (dynamic-wind
-           swap!
-           (lambda ()
-             (let ((value (apply load arguments)))
-               (values value (reverse! boot-inits))))
-           swap!))
-    (for-each (lambda (init) (init))
-             inits)
-    value))
-
 (define (init-boot-inits!)
   (set! boot-inits '())
   unspecific)
@@ -174,15 +158,16 @@ USA.
     (set! boot-inits #f)
     ((ucode-primitive local-assignment) environment saved-boot-inits inits)))
 
-(define (run-boot-inits! environment)
+(define (get-boot-init-runner environment)
   (and (not (lexical-unreferenceable? environment saved-boot-inits))
        (let ((inits
              ((ucode-primitive lexical-reference)
               environment
               saved-boot-inits)))
         ((ucode-primitive unbind-variable) environment saved-boot-inits)
-        (for-each (lambda (init) (init))
-                  inits))))
+        (lambda ()
+          (for-each (lambda (init) (init))
+                    inits)))))
 
 (define boot-inits #f)
 (define saved-boot-inits '|#[saved-boot-inits]|)
\ No newline at end of file
index ff466d02fbd23406ff7b87330ba7192833b9b2ff..3de6e6bcb7fd28a9e9eb029677a4c3a1a850a4c6 100644 (file)
@@ -176,7 +176,7 @@ USA.
                (let ((env (package/environment package)))
                  (if (not procedure-name)
                      (if (lexical-unreferenceable? env 'INITIALIZE-PACKAGE!)
-                         (lambda () ((access run-boot-inits! boot-defs) env))
+                         ((access get-boot-init-runner boot-defs) env)
                          (lexical-reference env 'INITIALIZE-PACKAGE!))
                      (and (not (lexical-unreferenceable? env procedure-name))
                           (lexical-reference env procedure-name))))))
index 9d4f4b4a1639e13d4e934c8dba7ece81b67215f0..2ab8b383039c64d9c6c8278a87167539b5d6ab07 100644 (file)
@@ -168,9 +168,7 @@ USA.
          with-limited-interrupts
          without-interrupts)
   (export (runtime)
-         add-boot-init!
-         load-with-boot-inits!
-         run-boot-inits!))
+         add-boot-init!))
 
 (define-package (runtime equality)
   (files "equals")