diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2014-08-28 12:44:01 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2014-08-28 14:55:10 -0700 |
commit | d95ed21da9bbec9b1aca098866e7c08944f5d6b6 (patch) | |
tree | 6c8f0c0e3698328727ef4be9fc0690399f68405c /sys.arc | |
parent | 576d603f8fb35a2ac30a3161eec321ede144fd84 (diff) | |
download | mu-d95ed21da9bbec9b1aca098866e7c08944f5d6b6.tar.gz |
81 - reify machine state into a 'context' variable
Beginning of concurrency primitives.
Diffstat (limited to 'sys.arc')
-rw-r--r-- | sys.arc | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/sys.arc b/sys.arc index 7364bfa9..b5f9c436 100644 --- a/sys.arc +++ b/sys.arc @@ -7,8 +7,38 @@ ((2 integer) <- literal 2)))) initialization-fns*) -; todo: copy types* info into simulated machine -; todo: sizeof +(enq (fn () + (build-type-table) + initialization-fns*) + +(= Free 3) +(= Type-array Free) +(def build-type-table () + (allocate-type-array) + (build-types) + (fill-in-type-array)) + +(def allocate-type-array () + (= memory*.Free len.types*) + (++ Free) + (++ Free len.types*)) + +(def build-types () + (each type types* ; todo + ( + +(def sizeof (typeinfo) + (if (~or typeinfo!record typeinfo!array) + typeinfo!size + typeinfo!record + (sum idfn + (accum yield + (each elem typeinfo!elems + (yield (sizeof type*.elem))))) + typeinfo!array + (* (sizeof (type* typeinfo!elem)) + ( + ;; 'new' - simple slab allocator. Intended only to carve out isolated memory ;; for different threads/routines as they request. |