Skip to content

Commit 7c03cc5

Browse files
committed
Fix playground
1 parent 22fc0ec commit 7c03cc5

File tree

8 files changed

+12
-43
lines changed

8 files changed

+12
-43
lines changed

src/playground_wasm/main.zig

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -942,48 +942,11 @@ fn compileSource(source: []const u8) !CompilerStageData {
942942
const base_ptr = @intFromPtr(buffer.ptr);
943943

944944
logDebug("loadCompiledModule: About to deserialize common\n", .{});
945-
const deserialized_common = serialized_ptr.common.deserialize(@as(i64, @intCast(base_ptr)), module_source).*;
946-
logDebug("loadCompiledModule: common deserialized successfully\n", .{});
947-
948-
logDebug("loadCompiledModule: About to deserialize types\n", .{});
949-
const deserialized_types = serialized_ptr.types.deserialize(@as(i64, @intCast(base_ptr)), gpa).*;
950-
logDebug("loadCompiledModule: types deserialized successfully\n", .{});
951-
952-
logDebug("loadCompiledModule: About to deserialize external_decls\n", .{});
953-
const deserialized_external_decls = serialized_ptr.external_decls.deserialize(@as(i64, @intCast(base_ptr))).*;
954-
logDebug("loadCompiledModule: external_decls deserialized successfully\n", .{});
955-
956-
logDebug("loadCompiledModule: About to deserialize imports\n", .{});
957-
const deserialized_imports = serialized_ptr.imports.deserialize(@as(i64, @intCast(base_ptr)), gpa).*;
958-
logDebug("loadCompiledModule: imports deserialized successfully\n", .{});
959-
960-
logDebug("loadCompiledModule: About to deserialize store\n", .{});
961-
const deserialized_store_ptr = serialized_ptr.store.deserialize(@as(i64, @intCast(base_ptr)), gpa);
962-
const deserialized_store = deserialized_store_ptr.*;
963-
logDebug("loadCompiledModule: store deserialized successfully\n", .{});
964-
965-
// Intern the module name for fast comparisons
966-
const module_name_idx = module_env_ptr.common.idents.insert(gpa, base.Ident.for_text(module_name_param)) catch unreachable;
967-
968-
logDebug("loadCompiledModule: All deserialized, constructing ModuleEnv\n", .{});
969-
module_env_ptr.* = ModuleEnv{
970-
.gpa = gpa,
971-
.common = deserialized_common,
972-
.types = deserialized_types,
973-
.module_kind = serialized_ptr.module_kind,
974-
.all_defs = serialized_ptr.all_defs,
975-
.all_statements = serialized_ptr.all_statements,
976-
.exports = serialized_ptr.exports,
977-
.builtin_statements = serialized_ptr.builtin_statements,
978-
.external_decls = deserialized_external_decls,
979-
.imports = deserialized_imports,
980-
.module_name = module_name_param,
981-
.module_name_idx = module_name_idx,
982-
.diagnostics = serialized_ptr.diagnostics,
983-
.store = deserialized_store,
984-
.evaluation_order = null,
985-
};
986-
logDebug("loadCompiledModule: ModuleEnv constructed successfully\n", .{});
945+
// Use the built-in deserialize method instead of manually deserializing each field
946+
// This ensures proper offset calculations when the struct layout changes
947+
logDebug("loadCompiledModule: About to deserialize ModuleEnv\n", .{});
948+
module_env_ptr.* = serialized_ptr.deserialize(@as(i64, @intCast(base_ptr)), gpa, module_source, module_name_param).*;
949+
logDebug("loadCompiledModule: ModuleEnv deserialized successfully\n", .{});
987950

988951
logDebug("loadCompiledModule: Returning LoadedModule\n", .{});
989952
return .{ .env = module_env_ptr, .buffer = buffer, .gpa = gpa };

test/serialization_size_check.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const expected_safelist_u8_size = 24;
3131
const expected_safelist_u32_size = 24;
3232
const expected_safemultilist_teststruct_size = 24;
3333
const expected_safemultilist_node_size = 24;
34-
const expected_moduleenv_size = 604; // Platform-independent size
34+
const expected_moduleenv_size = 608; // Platform-independent size
3535
const expected_nodestore_size = 96; // Platform-independent size
3636

3737
// Compile-time assertions - build will fail if sizes don't match expected values

test/snapshots/fuzz_crash/fuzz_crash_027.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ TOO FEW ARGS - fuzz_crash_027.md:21:3:22:4
228228
INVALID IF CONDITION - fuzz_crash_027.md:50:5:50:5
229229
INCOMPATIBLE MATCH PATTERNS - fuzz_crash_027.md:64:2:64:2
230230
TYPE MISMATCH - fuzz_crash_027.md:111:2:113:3
231+
TYPE MISMATCH - fuzz_crash_027.md:143:2:147:3
231232
# PROBLEMS
232233
**LEADING ZERO**
233234
Numbers cannot have leading zeros.
46 Bytes
Binary file not shown.

test/snapshots/plume_package/Color.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ is_named_color = |str|{
8181
MODULE HEADER DEPRECATED - Color.md:1:1:8:2
8282
UNUSED VARIABLE - Color.md:30:5:30:25
8383
DOES NOT EXIST - Color.md:68:14:68:27
84+
TYPE MISMATCH - Color.md:32:5:45:6
8485
TYPE MISMATCH - Color.md:51:104:51:105
8586
# PROBLEMS
8687
**MODULE HEADER DEPRECATED**

test/snapshots/type_app_complex_nested.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ UNDECLARED TYPE - type_app_complex_nested.md:4:30:4:35
3333
UNDECLARED TYPE - type_app_complex_nested.md:4:51:4:56
3434
UNUSED VARIABLE - type_app_complex_nested.md:7:12:7:21
3535
UNDECLARED TYPE - type_app_complex_nested.md:12:14:12:19
36+
TOO MANY ARGS - type_app_complex_nested.md:18:44:18:63
37+
TOO MANY ARGS - type_app_complex_nested.md:4:41:4:61
3638
# PROBLEMS
3739
**UNDECLARED TYPE**
3840
The type _Maybe_ is not declared in this scope.

test/snapshots/type_app_multiple_args.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ main! = |_| processDict(Dict.empty().insert("one", 1))
1414
~~~
1515
# EXPECTED
1616
DOES NOT EXIST - type_app_multiple_args.md:6:25:6:35
17+
TOO MANY ARGS - type_app_multiple_args.md:3:15:3:29
1718
# PROBLEMS
1819
**DOES NOT EXIST**
1920
`Dict.empty` does not exist.

test/snapshots/type_comprehensive_scope.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ TYPE REDECLARED - type_comprehensive_scope.md:10:1:10:37
4747
UNDECLARED TYPE - type_comprehensive_scope.md:13:19:13:23
4848
TYPE REDECLARED - type_comprehensive_scope.md:22:1:22:13
4949
UNDECLARED TYPE - type_comprehensive_scope.md:25:11:25:29
50+
TOO MANY ARGS - type_comprehensive_scope.md:29:10:29:24
5051
# PROBLEMS
5152
**TYPE REDECLARED**
5253
The type _Result_ is being redeclared.

0 commit comments

Comments
 (0)