Skip to content

Commit

Permalink
vm: save using updated header format
Browse files Browse the repository at this point in the history
  • Loading branch information
nomennescio committed May 16, 2024
1 parent 3231325 commit 6336b93
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions vm/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,9 @@ bool factor_vm::save_image(const vm_char* saving_filename,
h.magic = image_magic;
h.version = image_version;
h.data_relocation_base = data->tenured->start;
h.data_size = data->tenured->occupied_space();
h.compressed_data_size = h.escaped_data_size = data->tenured->occupied_space();
h.code_relocation_base = code->allocator->start;
h.code_size = code->allocator->occupied_space();
h.compressed_code_size = h.code_size = code->allocator->occupied_space();

for (cell i = 0; i < special_object_count; i++)
h.special_objects[i] =
Expand All @@ -331,8 +331,8 @@ bool factor_vm::save_image(const vm_char* saving_filename,
return false;
if (safe_fwrite(&h, sizeof(image_header), 1, file) != 1)
return false;
if (h.data_size > 0 &&
safe_fwrite((void*)data->tenured->start, h.data_size, 1, file) != 1)
if (h.escaped_data_size > 0 &&
safe_fwrite((void*)data->tenured->start, h.escaped_data_size, 1, file) != 1)
return false;
if (h.code_size > 0 &&
safe_fwrite((void*)code->allocator->start, h.code_size, 1, file) != 1)
Expand Down

0 comments on commit 6336b93

Please sign in to comment.