Concision.
This commit is contained in:
parent
818cfed24a
commit
6c66e632f4
27
os.rkt
27
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
|
||||
|
|
Loading…
Reference in New Issue