Fix playground discrepancy

This commit is contained in:
Richard Feldman 2025-10-18 21:38:47 -04:00
parent 6de8870577
commit ce70ac5dd9
No known key found for this signature in database
2 changed files with 5 additions and 4 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 = .Debug, // No need to optimize - only compiles builtin modules
.optimize = .ReleaseFast, // Must match playground optimization to ensure struct compatibility
// 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 = .Debug,
.optimize = .ReleaseFast, // Must match playground optimization to ensure struct compatibility
});
builtin_compiler_exe_force.root_module.addImport("base", roc_modules.base);

View file

@ -1385,12 +1385,12 @@ pub fn getSourceLine(self: *const Self, region: Region) ![]const u8 {
return self.common.getSourceLine(region);
}
/// Serialized representation of ModuleEnv
/// Serialized representation of ModuleEnv.
/// NOTE: Field order matters for cross-platform compatibility! Keep `module_kind` at the end.
pub const Serialized = struct {
gpa: [2]u64, // Reserve space for allocator (vtable ptr + context ptr), provided during deserialization
common: CommonEnv.Serialized,
types: TypeStore.Serialized,
module_kind: ModuleKind, // Must match field order in Self
all_defs: CIR.Def.Span,
all_statements: CIR.Statement.Span,
exports: CIR.Def.Span,
@ -1400,6 +1400,7 @@ pub const Serialized = struct {
module_name: [2]u64, // Reserve space for slice (ptr + len), provided during deserialization
diagnostics: CIR.Diagnostic.Span,
store: NodeStore.Serialized,
module_kind: ModuleKind,
/// Serialize a ModuleEnv into this Serialized struct, appending data to the writer
pub fn serialize(