Skip to content

Commit

Permalink
update actor io for changes in type repr
Browse files Browse the repository at this point in the history
  • Loading branch information
vyzo committed Dec 13, 2024
1 parent 8a77bda commit d308805
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/std/actor-v18/io-test.ss
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
(check-exception (BufferedWriter-marshal buf value) io-error?)))

(def (equal-values? a b)
(and (= (##type a) 1)
(= (##type b) 1)
(and (eq? (type-of a) 'subtyped)
(eq? (type-of b) 'subtyped)
(= (##subtype a) 5)
(= (##subtype b) 5)
(= (##vector-length a) (##vector-length b))
Expand Down
22 changes: 10 additions & 12 deletions src/std/actor-v18/io.ss
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@

;;; internals
(def +type-tag+
(make-vector 4 false))
(make-hash-table-eq))
(def +subtype-tag+
(make-vector 32 false))
(def +marshal+
Expand All @@ -252,7 +252,7 @@
(make-vector 256 #f))

(def (object-tag obj)
(or ((vector-ref +type-tag+ (##type obj)) obj)
(or ((hash-ref +type-tag+ (type-of obj)) obj)
serde-tag))

;;; io registry
Expand Down Expand Up @@ -301,9 +301,9 @@
;; tags
(defrules deftype-tag (=>)
((_ (type tag))
(vector-set! +type-tag+ type (lambda (obj) tag)))
(hash-put! +type-tag+ 'type (lambda (obj) tag)))
((_ (type => fun))
(vector-set! +type-tag+ type fun)))
(hash-put! +type-tag+ 'type fun)))

(defrule (deftype-tags defn ...)
(begin (deftype-tag defn) ...))
Expand Down Expand Up @@ -339,10 +339,6 @@
(else #f)))

(extern namespace: #f
macro-type-fixnum
macro-type-mem1
macro-type-special
macro-type-mem2
macro-subtype-vector
macro-subtype-pair
macro-subtype-structure
Expand All @@ -355,10 +351,12 @@
macro-subtype-bignum)

(deftype-tags
((macro-type-fixnum) integer-tag)
((macro-type-mem1) => subtyped-tag)
((macro-type-special) => immediate-tag)
((macro-type-mem2) pair-tag))
(fixnum integer-tag)
(subtyped => subtyped-tag)
(special => immediate-tag)
(pair pair-tag)
(vector vector-tag)
(flonum double-tag))

(defsubtype-tags
((macro-subtype-vector) vector-tag)
Expand Down

0 comments on commit d308805

Please sign in to comment.