Concision.

This commit is contained in:
Tony Garnock-Jones 2012-01-10 13:21:54 -05:00
parent 818cfed24a
commit 6c66e632f4
1 changed files with 7 additions and 20 deletions

27
os.rkt
View File

@ -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