From 6c66e632f4445566aab24c4fdad0c17a0a64b714 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Tue, 10 Jan 2012 13:21:54 -0500 Subject: [PATCH] Concision. --- os.rkt | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/os.rkt b/os.rkt index d197374..948266c 100644 --- a/os.rkt +++ b/os.rkt @@ -174,9 +174,7 @@ (vm-suspensions state))) (define (run-runnables state) - (foldl (lambda (r state) - (match-define (runnable process-state k) r) - (perform-transition (k process-state) state)) + (foldl (lambda (r state) (perform-transition ((runnable-k r) (runnable-state r)) state)) (struct-copy vm state [pending-processes (make-queue)]) (queue->list (vm-pending-processes state)))) @@ -286,22 +284,11 @@ ;;--------------------------------------------------------------------------- -(define (nested-vm-inert? transition) - (match transition - [(kernel-mode-transition (subscription (vm _ - (? queue-empty?) - (? queue-empty?) - (? queue-empty?) - _) - #f - '() - '()) - _ - _ - '()) - ;; No pending-messages within the nested VM, so no internal - ;; activity is possible, and furthermore it is not waiting for - ;; any outside messages. +(define (nested-vm-inert? sub) + (match sub + [(subscription (vm _ (? queue-empty?) (? queue-empty?) (? queue-empty?) _) #f '() '()) + ;; Inert iff not waiting for any messages or metamessages, and + ;; with no internal work left to do. #t] [_ #f])) @@ -313,7 +300,7 @@ ;; Runs its argument VM until it becomes (provably) inert. (define (ground-vm pattern-predicate boot) (let loop ((transition (run-vm (make-vm pattern-predicate boot)))) - (when (not (nested-vm-inert? transition)) + (when (not (nested-vm-inert? (kernel-mode-transition-subscription transition))) (match transition [(kernel-mode-transition (subscription new-state polling-k