Serialize abilities store and solved implementations with subs

This commit is contained in:
Ayaz Hafiz 2022-10-11 10:31:21 -05:00
parent 46eb427393
commit 7e79ff55f1
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
7 changed files with 281 additions and 80 deletions

View file

@ -211,7 +211,7 @@ impl Subs {
(UlsOfVar(vec_map), offset)
}
pub fn deserialize(bytes: &[u8]) -> (Self, &[(Symbol, Variable)]) {
pub fn deserialize(bytes: &[u8]) -> ((Self, &[(Symbol, Variable)]), usize) {
let mut offset = 0;
let header_slice = &bytes[..std::mem::size_of::<SubsHeader>()];
offset += header_slice.len();
@ -235,24 +235,27 @@ impl Subs {
bytes::deserialize_slice(bytes, header.unspecialized_lambda_sets as usize, offset);
let (uls_of_var, offset) =
Self::deserialize_uls_of_var(bytes, header.uls_of_var as usize, offset);
let (exposed_vars_by_symbol, _) =
let (exposed_vars_by_symbol, offset) =
bytes::deserialize_slice(bytes, header.exposed_vars_by_symbol as usize, offset);
(
Self {
utable,
variables: variables.to_vec(),
tag_names: tag_names.to_vec(),
closure_names: closure_names.to_vec(),
field_names,
record_fields: record_fields.to_vec(),
variable_slices: variable_slices.to_vec(),
unspecialized_lambda_sets: unspecialized_lambda_sets.to_vec(),
tag_name_cache: Default::default(),
problems: Default::default(),
uls_of_var,
},
exposed_vars_by_symbol,
(
Self {
utable,
variables: variables.to_vec(),
tag_names: tag_names.to_vec(),
closure_names: closure_names.to_vec(),
field_names,
record_fields: record_fields.to_vec(),
variable_slices: variable_slices.to_vec(),
unspecialized_lambda_sets: unspecialized_lambda_sets.to_vec(),
tag_name_cache: Default::default(),
problems: Default::default(),
uls_of_var,
},
exposed_vars_by_symbol,
),
offset,
)
}