Skip to content

Commit 98c4864

Browse files
committed
fixes after rebase
1 parent 31bac2e commit 98c4864

File tree

4 files changed

+31
-142
lines changed

4 files changed

+31
-142
lines changed

compiler/src/codegen/compcore.re

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3404,7 +3404,8 @@ exception WasmRunnerError(Module.t, option(string), string);
34043404
let validate_module = (~name=?, wasm_mod: Module.t) =>
34053405
try(assert(Module.validate(wasm_mod) == 1)) {
34063406
| Assert_failure(_) =>
3407-
raise(WasmRunnerError(wasm_mod, name, "WARNING: Invalid module"))
3407+
Module.print(wasm_mod);
3408+
raise(WasmRunnerError(wasm_mod, name, "WARNING: Invalid module"));
34083409
};
34093410

34103411
let compile_wasm_module =
@@ -3458,10 +3459,9 @@ let compile_wasm_module =
34583459

34593460
let compile_one = (dep_id, prog: mash_code) => {
34603461
let env = {...env, dep_id, compilation_mode: prog.compilation_mode};
3462+
ignore @@ compile_imports(wasm_mod, env, prog, import_map);
34613463
ignore @@ compile_globals(wasm_mod, env, prog);
34623464
ignore @@ compile_functions(wasm_mod, env, prog);
3463-
ignore @@ compile_exports(wasm_mod, env, prog);
3464-
ignore @@ compile_imports(wasm_mod, env, prog, import_map);
34653465
ignore @@ compile_tables(wasm_mod, env, prog);
34663466
};
34673467

compiler/test/__snapshots__/modules.b59b0085.0.snapshot

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ modules › reprovided_module
1414
(mimp_kind MImportGrain) (mimp_setup MCallGetter) (mimp_used true))))
1515
(exports
1616
((WasmFunctionExport (ex_function_name Simple.Simple.func)
17-
(ex_function_internal_name func_1125))
17+
(ex_function_internal_name func_1049))
1818
(WasmGlobalExport (ex_global_name Simple.Simple.func)
19-
(ex_global_internal_name func_1125))
19+
(ex_global_internal_name func_1049))
2020
(WasmGlobalExport (ex_global_name Simple.Simple.foo)
21-
(ex_global_internal_name foo_1126))))
21+
(ex_global_internal_name foo_1050))))
2222
(main_body
2323
(((instr_desc
2424
(MImmediate

compiler/test/__snapshots__/provides.30cbc409.0.snapshot

Lines changed: 0 additions & 116 deletions
This file was deleted.

compiler/test/suites/provides.re

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,39 @@ describe("provides", ({test, testSkip}) => {
1717
test(
1818
name,
1919
({expect}) => {
20-
let state =
20+
ignore(
2121
compile(
22-
~hook=Grain.Compile.stop_after_compiled,
22+
~link=true,
2323
~config_fn=
2424
() => {
2525
Grain_utils.Config.use_start_section := use_start_section
2626
},
2727
name,
2828
prog,
29-
);
30-
();
31-
switch (state.Grain.Compile.cstate_desc) {
32-
| Compiled({asm}) =>
33-
let num_exports = Binaryen.Export.get_num_exports(asm);
34-
let exports =
35-
List.init(
36-
num_exports,
37-
i => {
38-
let export = Binaryen.Export.get_export_by_index(asm, i);
39-
(
40-
Binaryen.Export.get_name(export),
41-
Binaryen.Export.export_get_kind(export),
42-
);
43-
},
44-
);
45-
List.iter(expect.list(exports).toContainEqual, expectedExports);
46-
| _ => assert(false)
29+
),
30+
);
31+
let bytes = {
32+
let ic = open_in_bin(wasmfile(name));
33+
let chan_len = in_channel_length(ic);
34+
let bytes = Bytes.create(chan_len);
35+
really_input(ic, bytes, 0, chan_len);
36+
close_in(ic);
37+
bytes;
4738
};
39+
let asm = Binaryen.Module.read(bytes);
40+
let num_exports = Binaryen.Export.get_num_exports(asm);
41+
let exports =
42+
List.init(
43+
num_exports,
44+
i => {
45+
let export = Binaryen.Export.get_export_by_index(asm, i);
46+
(
47+
Binaryen.Export.get_name(export),
48+
Binaryen.Export.export_get_kind(export),
49+
);
50+
},
51+
);
52+
List.iter(expect.list(exports).toContainEqual, expectedExports);
4853
},
4954
);
5055
};

0 commit comments

Comments
 (0)