Don't serialize the frozen field

This commit is contained in:
Richard Feldman 2025-10-18 21:48:08 -04:00
parent ce70ac5dd9
commit 51affced49
No known key found for this signature in database
3 changed files with 6 additions and 9 deletions

View file

@ -140,7 +140,7 @@ pub fn build(b: *std.Build) void {
.name = "builtin_compiler",
.root_source_file = b.path("src/build/builtin_compiler/main.zig"),
.target = b.graph.host, // this runs at build time on the *host* machine!
.optimize = .ReleaseFast, // Must match playground optimization to ensure struct compatibility
.optimize = .Debug, // No need to optimize - only compiles builtin modules
// Note: libc linking is handled by add_tracy below (required when tracy is enabled)
});
@ -234,7 +234,7 @@ pub fn build(b: *std.Build) void {
.name = "builtin_compiler",
.root_source_file = b.path("src/build/builtin_compiler/main.zig"),
.target = b.graph.host,
.optimize = .ReleaseFast, // Must match playground optimization to ensure struct compatibility
.optimize = .Debug,
});
builtin_compiler_exe_force.root_module.addImport("base", roc_modules.base);

View file

@ -223,7 +223,6 @@ pub const Serialized = struct {
bytes: collections.SafeList(u8).Serialized,
hash_table: collections.SafeList(Idx).Serialized,
entry_count: u32,
frozen: if (std.debug.runtime_safety) bool else void,
/// Serialize a SmallStringInterner into this Serialized struct, appending data to the writer
pub fn serialize(
@ -238,7 +237,7 @@ pub const Serialized = struct {
try self.hash_table.serialize(&interner.hash_table, allocator, writer);
// Copy simple values directly
self.entry_count = interner.entry_count;
self.frozen = interner.frozen;
// Note: frozen is not serialized - it will always be true after deserialization
}
/// Deserialize this Serialized struct into a SmallStringInterner
@ -253,7 +252,7 @@ pub const Serialized = struct {
.bytes = self.bytes.deserialize(offset).*,
.hash_table = self.hash_table.deserialize(offset).*,
.entry_count = self.entry_count,
.frozen = self.frozen,
.frozen = if (std.debug.runtime_safety) true else {}, // Always frozen after deserialization
};
return interner;

View file

@ -115,7 +115,6 @@ pub const Store = struct {
/// Serialized representation of a Store
pub const Serialized = struct {
buffer: collections.SafeList(u8).Serialized,
frozen: if (std.debug.runtime_safety) bool else void,
/// Serialize a Store into this Serialized struct, appending data to the writer
pub fn serialize(
@ -126,8 +125,7 @@ pub const Store = struct {
) std.mem.Allocator.Error!void {
// Serialize the buffer SafeList
try self.buffer.serialize(&store.buffer, allocator, writer);
// Copy the frozen field
self.frozen = store.frozen;
// Note: frozen is not serialized - it will always be true after deserialization
}
/// Deserialize this Serialized struct into a Store
@ -140,7 +138,7 @@ pub const Store = struct {
store.* = Store{
.buffer = self.buffer.deserialize(offset).*,
.frozen = self.frozen,
.frozen = if (std.debug.runtime_safety) true else {}, // Always frozen after deserialization
};
return store;