@@ -90,7 +90,7 @@ function sertag(@nospecialize(v))
90
90
end
91
91
return Int32 (- 1 )
92
92
end
93
- desertag (i:: Int32 ) = TAGS[i]
93
+ desertag (i:: Int32 ) = @inbounds ( TAGS[i])
94
94
95
95
# tags >= this just represent themselves, their whole representation is 1 byte
96
96
const VALUE_TAGS = sertag (())
@@ -102,6 +102,7 @@ const EMPTYTUPLE_TAG = sertag(())
102
102
const TUPLE_TAG = sertag (Tuple)
103
103
const SIMPLEVECTOR_TAG = sertag (SimpleVector)
104
104
const SYMBOL_TAG = sertag (Symbol)
105
+ const INT8_TAG = sertag (Int8)
105
106
const ARRAY_TAG = sertag (Array)
106
107
const EXPR_TAG = sertag (Expr)
107
108
const MODULE_TAG = sertag (Module)
337
338
338
339
function serialize_mod_names (s:: AbstractSerializer , m:: Module )
339
340
p = parentmodule (m)
340
- if p === m
341
+ if p === m || m === Base
341
342
key = Base. root_module_key (m)
342
343
serialize (s, key. uuid === nothing ? nothing : key. uuid. value)
343
344
serialize (s, Symbol (key. name))
@@ -586,6 +587,13 @@ function serialize(s::AbstractSerializer, n::Int64)
586
587
nothing
587
588
end
588
589
590
+ for i in 0 : 13
591
+ tag = Int32 (INT8_TAG + i)
592
+ ty = TAGS[tag]
593
+ (ty === Int32 || ty === Int64) && continue
594
+ @eval serialize (s:: AbstractSerializer , n:: $ty ) = (writetag (s. io, $ tag); write (s. io, n); nothing )
595
+ end
596
+
589
597
serialize (s:: AbstractSerializer , :: Type{Bottom} ) = write_as_tag (s. io, BOTTOM_TAG)
590
598
591
599
function serialize (s:: AbstractSerializer , u:: UnionAll )
@@ -748,6 +756,9 @@ function handle_deserialize(s::AbstractSerializer, b::Int32)
748
756
return unwrap_unionall (tname. wrapper)
749
757
elseif b == OBJECT_TAG
750
758
t = deserialize (s)
759
+ if t === Missing
760
+ return missing
761
+ end
751
762
return deserialize (s, t)
752
763
elseif b == REF_OBJECT_TAG
753
764
slot = s. counter; s. counter += 1
@@ -788,8 +799,36 @@ function handle_deserialize(s::AbstractSerializer, b::Int32)
788
799
read (s. io, UInt8)
789
800
end
790
801
return deserialize (s)
802
+ elseif b == INT8_TAG
803
+ return read (s. io, Int8)
804
+ elseif b == INT8_TAG+ 1
805
+ return read (s. io, UInt8)
806
+ elseif b == INT8_TAG+ 2
807
+ return read (s. io, Int16)
808
+ elseif b == INT8_TAG+ 3
809
+ return read (s. io, UInt16)
810
+ elseif b == INT32_TAG
811
+ return read (s. io, Int32)
812
+ elseif b == INT8_TAG+ 5
813
+ return read (s. io, UInt32)
814
+ elseif b == INT64_TAG
815
+ return read (s. io, Int64)
816
+ elseif b == INT8_TAG+ 7
817
+ return read (s. io, UInt64)
818
+ elseif b == INT8_TAG+ 8
819
+ return read (s. io, Int128)
820
+ elseif b == INT8_TAG+ 9
821
+ return read (s. io, UInt128)
822
+ elseif b == INT8_TAG+ 10
823
+ return read (s. io, Float16)
824
+ elseif b == INT8_TAG+ 11
825
+ return read (s. io, Float32)
826
+ elseif b == INT8_TAG+ 12
827
+ return read (s. io, Float64)
828
+ elseif b == INT8_TAG+ 13
829
+ return read (s. io, Char)
791
830
end
792
- t = desertag (b)
831
+ t = desertag (b):: DataType
793
832
if t. mutable && length (t. types) > 0 # manual specialization of fieldcount
794
833
slot = s. counter; s. counter += 1
795
834
push! (s. pending_refs, slot)
@@ -949,6 +988,11 @@ function deserialize_array(s::AbstractSerializer)
949
988
A = Array {elty, length(dims)} (undef, dims)
950
989
s. table[slot] = A
951
990
sizehint! (s. table, s. counter + div (length (A),4 ))
991
+ deserialize_fillarray! (A, s)
992
+ return A
993
+ end
994
+
995
+ function deserialize_fillarray! (A:: Array{T} , s:: AbstractSerializer ) where {T}
952
996
for i = eachindex (A)
953
997
tag = Int32 (read (s. io, UInt8):: UInt8 )
954
998
if tag != UNDEFREF_TAG
0 commit comments