From db0ddd43f4250c0373eba9dd6bb8fe7f800705e7 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Thu, 5 Jan 2017 22:40:31 -0800 Subject: [PATCH] Tweak boot-init mechanism to only run when necessary. Also eliminate never-used exports. --- src/runtime/boot.scm | 23 ++++------------------- src/runtime/make.scm | 2 +- src/runtime/runtime.pkg | 4 +--- 3 files changed, 6 insertions(+), 23 deletions(-) diff --git a/src/runtime/boot.scm b/src/runtime/boot.scm index 1cc4b8ec5..3350632a8 100644 --- a/src/runtime/boot.scm +++ b/src/runtime/boot.scm @@ -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 diff --git a/src/runtime/make.scm b/src/runtime/make.scm index ff466d02f..3de6e6bcb 100644 --- a/src/runtime/make.scm +++ b/src/runtime/make.scm @@ -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)))))) diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index 9d4f4b4a1..2ab8b3830 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -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") -- 2.25.1