(loader '((title |schedule.lo|))) (if (not (>= (version) 15.2)) (progn (error 'load 'erricf 'schedule))) (defvar #:sys-package:colon 'schedule) (defvar #:system:clock-tick .05) (putprop 'clock 'parano '#:complice:fvar) (loader'((fentry clock subr0) (entry clock subr0) (mov '() a1) (jcall debug) (btnil a1 102) (push (@ 103)) (push '46) (mov '1 a4) (jmp princn) 103 (eval ()) 102 (jmp suspend) )) (loader'((fentry clockstart dmsubr) (entry clockstart dmsubr) (mov '(clockalarm #:system:clock-tick) a1) (return) )) (loader'((fentry clockstop dmsubr) (entry clockstop dmsubr) (mov '(clockalarm 0.) a1) (return) )) (defvar #:schedule:ll) (putprop 'parallel 'parano '#:complice:fvar) (loader'((fentry parallel fsubr) (entry parallel fsubr) (push (cvalq #:schedule:ll)) (mov a1 (cvalq #:schedule:ll)) (push '1) (push '(#:schedule:ll)) (push (@ parallel)) (push llink) (mov nil llink) (push dlink) (push cbindn) (stack dlink) (push (@ 101)) (jcall #:llcp:without-interrupts) (push (@ 102)) (push (cvalq #:schedule:ll)) (push nil) (mov '2 a4) (jmp append) 102 (eval ()) (push (cvalq #:schedule:l)) (mov a1 (cvalq #:schedule:l)) (push '1) (push '(#:schedule:l)) (push 'lambda) (push llink) (push dlink) (push cbindn) (stack dlink) 103 (btnil (cvalq #:schedule:l) 104) (bra 106) (fentry #:parallel:g106 subr1) (entry #:parallel:g106 subr1) (push (@ 107)) (push 'resume) (jcall kwote) (push a1) (mov '2 a4) (jmp list) 107 (eval ()) (push (@ 108)) (push (cvalq #:schedule:l)) (jcall ncons) (push a1) (mov '2 a4) (jmp nconc) 108 (eval ()) (mov a1 (cvalq #:schedule:l)) (return) 106 (mov '#:parallel:g106 a1) (push (@ 105)) (jcall #:llcp:schedule) (mov (cvalq #:schedule:l) a4) (mov (cdr a4) (cvalq #:schedule:l)) (push (car a4)) (push (cvalq #:schedule:e)) (mov (& 1) (cvalq #:schedule:e)) (push '1) (push '(#:schedule:e)) (push 'lambda) (push llink) (push dlink) (push cbindn) (stack dlink) (mov (cvalq #:system:clock-tick) a1) (jcall clockalarm) (push (@ 109)) (jcall #:llcp:with-interrupts) (push (@ 110)) (push (cvalq #:schedule:e)) (mov '1 a4) (jmp eval) 110 (eval ()) (return) 109 (eval ()) (mov '0. a1) (jcall clockalarm) (mov (& 1) dlink) (mov (& 6) (cvalq #:schedule:e)) (adjstk '8) (return) 105 (eval ()) (bra 103) 104 (mov nil a1) (mov (& 1) dlink) (mov (& 6) (cvalq #:schedule:l)) (adjstk '7) (return) 101 (eval ()) (mov (& 1) dlink) (mov (& 2) llink) (mov (& 6) (cvalq #:schedule:ll)) (adjstk '7) (return) )) (putprop 'parallelvalues 'parano '#:complice:fvar) (loader'((fentry parallelvalues fsubr) (entry parallelvalues fsubr) (push (cvalq #:schedule:ll)) (mov a1 (cvalq #:schedule:ll)) (push '1) (push '(#:schedule:ll)) (push (@ parallelvalues)) (push llink) (mov nil llink) (push dlink) (push cbindn) (stack dlink) (push (@ 101)) (jcall #:llcp:without-interrupts) (mov (cvalq #:schedule:ll) a1) (jcall length) (mov nil a2) (jcall makelist) (push nil) (push (cvalq #:schedule:ll)) (push '-1) (push (cvalq #:schedule:r)) (mov a1 (cvalq #:schedule:r)) (push (cvalq #:schedule:i)) (mov (& 2) (cvalq #:schedule:i)) (push (cvalq #:schedule:l)) (mov (& 4) (cvalq #:schedule:l)) (push (cvalq #:schedule:ltask)) (mov (& 6) (cvalq #:schedule:ltask)) (push '4) (push '(#:schedule:r #:schedule:i #:schedule:l #:schedule:ltask)) (push 'lambda) (push llink) (push dlink) (push cbindn) (stack dlink) 102 (bfnil (cvalq #:schedule:l) 106) (btnil (cvalq #:schedule:ltask) 103) (bra 106) (fentry #:parallelvalues:g107 subr1) (entry #:parallelvalues:g107 subr1) (push (@ 107)) (push (cvalq #:schedule:ltask)) (jcall ncons) (push a1) (mov '2 a4) (jmp nconc) 107 (eval ()) (mov a1 (cvalq #:schedule:ltask)) (return) 106 (mov '#:parallelvalues:g107 a1) (push (@ 105)) (jcall #:llcp:schedule) (mov (cvalq #:system:clock-tick) a1) (jcall clockalarm) (bfnil (cvalq #:schedule:l) 108) (mov (cvalq #:schedule:ltask) a1) (mov (cdr a1) (cvalq #:schedule:ltask)) (mov (car a1) a1) (jcall resume) (bra 109) 108 (mov (cvalq #:schedule:l) a4) (mov (cdr a4) (cvalq #:schedule:l)) (push (car a4)) (push (cvalq #:schedule:e)) (mov (& 1) (cvalq #:schedule:e)) (push '1) (push '(#:schedule:e)) (push 'lambda) (push llink) (push dlink) (push cbindn) (stack dlink) (mov (cvalq #:schedule:i) a1) (jcall 1+) (mov a1 (cvalq #:schedule:i)) (mov (cvalq #:schedule:r) a2) (jcall nthcdr) (push a1) (push (@ 110)) (jcall #:llcp:with-interrupts) (push (@ 111)) (push (cvalq #:schedule:e)) (mov '1 a4) (jmp eval) 111 (eval ()) (return) 110 (eval ()) (pop a4) (mov a1 (car a4)) (mov (& 1) dlink) (mov (& 6) (cvalq #:schedule:e)) (adjstk '8) 109 (mov '0. a1) (jmp clockalarm) 105 (eval ()) (bra 102) 103 (mov (cvalq #:schedule:r) a1) (mov (& 1) dlink) (mov (& 6) (cvalq #:schedule:ltask)) (mov (& 7) (cvalq #:schedule:l)) (mov (& 8) (cvalq #:schedule:i)) (mov (& 9) (cvalq #:schedule:r)) (adjstk '13) (return) 101 (eval ()) (mov (& 1) dlink) (mov (& 2) llink) (mov (& 6) (cvalq #:schedule:ll)) (adjstk '7) (return) )) (putprop 'tryinparallel 'parano '#:complice:fvar) (loader'((fentry tryinparallel fsubr) (entry tryinparallel fsubr) (push (cvalq #:schedule:ll)) (mov a1 (cvalq #:schedule:ll)) (push '1) (push '(#:schedule:ll)) (push (@ tryinparallel)) (push llink) (mov nil llink) (push dlink) (push cbindn) (stack dlink) (push (@ 101)) (jcall #:llcp:without-interrupts) (push nil) (push (cvalq #:schedule:ll)) (push (cvalq #:schedule:l)) (mov (& 1) (cvalq #:schedule:l)) (push (cvalq #:schedule:ltask)) (mov (& 3) (cvalq #:schedule:ltask)) (push '2) (push '(#:schedule:l #:schedule:ltask)) (push 'lambda) (push llink) (push dlink) (push cbindn) (stack dlink) (push (@ 102)) (push '#:schedule:return-value) (push dlink) (push tag) (stack dlink) 103 (bfnil (cvalq #:schedule:l) 107) (btnil (cvalq #:schedule:ltask) 104) (bra 107) (fentry #:tryinparallel:g108 subr1) (entry #:tryinparallel:g108 subr1) (push (@ 108)) (push (cvalq #:schedule:ltask)) (jcall ncons) (push a1) (mov '2 a4) (jmp nconc) 108 (eval ()) (mov a1 (cvalq #:schedule:ltask)) (return) 107 (mov '#:tryinparallel:g108 a1) (push (@ 106)) (jcall #:llcp:schedule) (mov (cvalq #:system:clock-tick) a1) (jcall clockalarm) (mov (cvalq #:schedule:l) a4) (mov (cdr a4) (cvalq #:schedule:l)) (push (car a4)) (push (cvalq #:schedule:e)) (mov (& 1) (cvalq #:schedule:e)) (push '1) (push '(#:schedule:e)) (push 'lambda) (push llink) (push dlink) (push cbindn) (stack dlink) (btnil (cvalq #:schedule:e) 110) (push (@ 111)) (jcall #:llcp:with-interrupts) (push (@ 112)) (push (cvalq #:schedule:e)) (mov '1 a4) (jmp eval) 112 (eval ()) (return) 111 (eval ()) (push a1) (mov '0. a1) (jcall clockalarm) (pop a1) (mov '#:schedule:return-value a2) (jmp #:llcp:exit) 110 (mov (cvalq #:schedule:ltask) a1) (mov (cdr a1) (cvalq #:schedule:ltask)) (mov (car a1) a1) (jcall resume) (mov (& 1) dlink) (mov (& 6) (cvalq #:schedule:e)) (adjstk '8) (return) 106 (eval ()) (bra 103) 104 (mov nil a1) (mov (& 1) dlink) (adjstk '4) 102 (eval ()) (mov (& 1) dlink) (mov (& 6) (cvalq #:schedule:ltask)) (mov (& 7) (cvalq #:schedule:l)) (adjstk '10) (return) 101 (eval ()) (mov (& 1) dlink) (mov (& 2) llink) (mov (& 6) (cvalq #:schedule:ll)) (adjstk '7) (return) )) (loader'((fentry progn-no-suspend dmsubr) (entry progn-no-suspend dmsubr) (push (@ 101)) (push 'schedule) (push 'resume) (push a1) (mov '3 a4) (jmp mcons) 101 (eval ()) (return) )) (loader'((fentry letparallel dmsubr) (entry letparallel dmsubr) (mov (cdr a1) a4) (mov (car a1) a1) (push a1) (push a4) (push (@ 101)) (push 'letvq) (push a1) (push nil) 102 (bfcons (& 1) 103) (mov (& 1) a1) (mov (cdr a1) (& 1)) (mov (car a1) a1) (mov (& 0) a2) (mov (car a1) a1) (jcall cons) (mov a1 (& 0)) (bra 102) 103 (mov (& 0) a1) (jcall nreverse) (adjstk '2) (push a1) (push (& 4)) (push nil) 104 (bfcons (& 1) 105) (mov (& 1) a1) (mov (cdr a1) (& 1)) (mov (car a1) a1) (mov (cdr a1) a1) (mov (& 0) a2) (mov (car a1) a1) (jcall cons) (mov a1 (& 0)) (bra 104) 105 (mov (& 0) a1) (jcall nreverse) (adjstk '2) (mov a1 a2) (mov 'parallelvalues a1) (jcall cons) (push a1) (push (& 4)) (mov '4 a4) (jmp mcons) 101 (eval ()) (adjstk '2) (return) )) (loader '((end)))