@grain/binaryen.ml 0.17.1 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- binaryen-archive/CHANGELOG.md +38 -0
- binaryen-archive/binaryen.opam +2 -2
- binaryen-archive/esy.lock/index.json +355 -346
- binaryen-archive/esy.lock/opam/camlp-streams.5.0.1/opam +59 -0
- binaryen-archive/esy.lock/opam/chrome-trace.3.5.0/opam +39 -0
- binaryen-archive/esy.lock/opam/{dune-build-info.3.2.0 → dune-build-info.3.5.0}/opam +5 -6
- binaryen-archive/esy.lock/opam/{dune-configurator.3.2.0 → dune-configurator.3.5.0}/opam +6 -6
- binaryen-archive/esy.lock/opam/{dune-rpc.3.2.0 → dune-rpc.3.5.0}/opam +5 -6
- binaryen-archive/esy.lock/opam/{dune.3.2.0 → dune.3.5.0}/opam +4 -5
- binaryen-archive/esy.lock/opam/{dyn.3.2.0 → dyn.3.5.0}/opam +5 -6
- binaryen-archive/esy.lock/opam/{fiber.3.2.0 → fiber.3.5.0}/opam +5 -6
- binaryen-archive/esy.lock/opam/{ocaml-lsp-server.1.11.6 → ocaml-lsp-server.1.14.1}/opam +9 -8
- binaryen-archive/esy.lock/opam/{ocaml-version.3.4.0 → ocaml-version.3.5.0}/opam +4 -4
- binaryen-archive/esy.lock/opam/{ocamlbuild.0.14.1 → ocamlbuild.0.14.2}/opam +3 -3
- binaryen-archive/esy.lock/opam/ocamlfind.1.9.5/files/0001-Fix-bug-when-installing-with-a-system-compiler.patch +26 -0
- binaryen-archive/esy.lock/opam/{ocamlfind.1.9.3 → ocamlfind.1.9.5}/opam +6 -3
- binaryen-archive/esy.lock/opam/{ocamlformat-rpc-lib.0.22.4 → ocamlformat-rpc-lib.0.24.1}/opam +4 -4
- binaryen-archive/esy.lock/opam/ocamlformat.0.20.1/opam +1 -1
- binaryen-archive/esy.lock/opam/{odoc-parser.1.0.0 → odoc-parser.1.0.1}/opam +5 -4
- binaryen-archive/esy.lock/opam/omd.1.3.2/opam +50 -0
- binaryen-archive/esy.lock/opam/{ordering.3.2.0 → ordering.3.5.0}/opam +5 -6
- binaryen-archive/esy.lock/opam/{ppxlib.0.26.0 → ppxlib.0.28.0}/opam +7 -7
- binaryen-archive/esy.lock/opam/sexplib0.v0.14.0/opam +1 -1
- binaryen-archive/esy.lock/opam/{stdune.3.2.0 → stdune.3.5.0}/opam +6 -6
- binaryen-archive/esy.lock/opam/uucp.15.0.0/opam +55 -0
- binaryen-archive/esy.lock/opam/{uuseg.14.0.0 → uuseg.15.0.0}/opam +39 -25
- binaryen-archive/esy.lock/opam/{xdg.3.2.0 → xdg.3.5.0}/opam +5 -6
- binaryen-archive/esy.lock/opam/{yojson.1.7.0 → yojson.2.0.2}/opam +14 -14
- binaryen-archive/esy.lock/overrides/{opam__s__ocamlbuild_opam__c__0.14.1_opam_override → opam__s__ocamlbuild_opam__c__0.14.2_opam_override}/files/winpatch.patch +0 -0
- binaryen-archive/esy.lock/overrides/{opam__s__ocamlbuild_opam__c__0.14.1_opam_override → opam__s__ocamlbuild_opam__c__0.14.2_opam_override}/package.json +0 -0
- binaryen-archive/esy.lock/overrides/{opam__s__ocamlfind_opam__c__1.9.3_opam_override → opam__s__ocamlfind_opam__c__1.9.5_opam_override}/files/findlib.patch +0 -0
- binaryen-archive/esy.lock/overrides/{opam__s__ocamlfind_opam__c__1.9.3_opam_override → opam__s__ocamlfind_opam__c__1.9.5_opam_override}/package.json +0 -0
- binaryen-archive/package.json +2 -2
- binaryen-archive/src/binaryen_stubs_exports.js +36 -20
- binaryen-archive/src/binaryen_stubs_expressions.c +101 -0
- binaryen-archive/src/binaryen_stubs_expressions.js +543 -508
- binaryen-archive/src/binaryen_stubs_features.js +34 -34
- binaryen-archive/src/binaryen_stubs_functions.js +45 -19
- binaryen-archive/src/binaryen_stubs_globals.js +8 -8
- binaryen-archive/src/binaryen_stubs_imports.c +14 -0
- binaryen-archive/src/binaryen_stubs_imports.js +67 -14
- binaryen-archive/src/binaryen_stubs_memory.c +40 -0
- binaryen-archive/src/binaryen_stubs_memory.js +45 -2
- binaryen-archive/src/binaryen_stubs_modules.c +20 -0
- binaryen-archive/src/binaryen_stubs_modules.js +26 -8
- binaryen-archive/src/binaryen_stubs_ops.js +632 -632
- binaryen-archive/src/binaryen_stubs_settings.js +36 -38
- binaryen-archive/src/binaryen_stubs_tables.js +18 -12
- binaryen-archive/src/binaryen_stubs_types.c +23 -2
- binaryen-archive/src/binaryen_stubs_types.js +44 -26
- binaryen-archive/src/expression.ml +27 -0
- binaryen-archive/src/expression.mli +18 -0
- binaryen-archive/src/import.ml +4 -0
- binaryen-archive/src/import.mli +2 -0
- binaryen-archive/src/memory.ml +25 -12
- binaryen-archive/src/memory.mli +12 -6
- binaryen-archive/src/module.ml +2 -0
- binaryen-archive/src/module.mli +2 -0
- binaryen-archive/src/passes.ml +6 -0
- binaryen-archive/src/passes.mli +6 -0
- binaryen-archive/src/type.ml +14 -2
- binaryen-archive/src/type.mli +4 -1
- binaryen-archive/test/test.expected +49 -12
- binaryen-archive/test/test.ml +49 -12
- binaryen-archive/esy.lock/opam/biniou.1.2.1/opam +0 -45
- binaryen-archive/esy.lock/opam/easy-format.1.3.4/opam +0 -56
- binaryen-archive/esy.lock/opam/omd.1.3.1/opam +0 -39
- binaryen-archive/esy.lock/opam/uucp.14.0.0/opam +0 -41
|
@@ -1,120 +1,118 @@
|
|
|
1
1
|
//Provides: caml_binaryen_get_optimize_level
|
|
2
|
-
//Requires:
|
|
2
|
+
//Requires: Binaryen
|
|
3
3
|
function caml_binaryen_get_optimize_level() {
|
|
4
|
-
return
|
|
4
|
+
return Binaryen.getOptimizeLevel();
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
//Provides: caml_binaryen_set_optimize_level
|
|
8
|
-
//Requires:
|
|
8
|
+
//Requires: Binaryen
|
|
9
9
|
function caml_binaryen_set_optimize_level(level) {
|
|
10
|
-
return
|
|
10
|
+
return Binaryen.setOptimizeLevel(level);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
//Provides: caml_binaryen_get_shrink_level
|
|
14
|
-
//Requires:
|
|
14
|
+
//Requires: Binaryen
|
|
15
15
|
function caml_binaryen_get_shrink_level() {
|
|
16
|
-
return
|
|
16
|
+
return Binaryen.getShrinkLevel();
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
//Provides: caml_binaryen_set_shrink_level
|
|
20
|
-
//Requires:
|
|
20
|
+
//Requires: Binaryen
|
|
21
21
|
function caml_binaryen_set_shrink_level(level) {
|
|
22
|
-
return
|
|
22
|
+
return Binaryen.setShrinkLevel(level);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
//Provides: caml_binaryen_get_debug_info
|
|
26
|
-
//Requires:
|
|
26
|
+
//Requires: Binaryen
|
|
27
27
|
function caml_binaryen_get_debug_info() {
|
|
28
28
|
// Uses the `_Binaryen` function because then we are working with ints which are also booleans to JSOO
|
|
29
|
-
return
|
|
29
|
+
return Binaryen._BinaryenGetDebugInfo();
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
//Provides: caml_binaryen_set_debug_info
|
|
33
|
-
//Requires:
|
|
33
|
+
//Requires: Binaryen
|
|
34
34
|
function caml_binaryen_set_debug_info(on) {
|
|
35
35
|
// Uses the `_Binaryen` function because then we are working with ints which are also booleans to JSOO
|
|
36
|
-
return
|
|
36
|
+
return Binaryen._BinaryenSetDebugInfo(on);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
//Provides: caml_binaryen_get_low_memory_unused
|
|
40
|
-
//Requires:
|
|
40
|
+
//Requires: Binaryen
|
|
41
41
|
function caml_binaryen_get_low_memory_unused() {
|
|
42
42
|
// Uses the `_Binaryen` function because then we are working with ints which are also booleans to JSOO
|
|
43
|
-
return
|
|
43
|
+
return Binaryen._BinaryenGetLowMemoryUnused();
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
//Provides: caml_binaryen_set_low_memory_unused
|
|
47
|
-
//Requires:
|
|
47
|
+
//Requires: Binaryen
|
|
48
48
|
function caml_binaryen_set_low_memory_unused(on) {
|
|
49
49
|
// Uses the `_Binaryen` function because then we are working with ints which are also booleans to JSOO
|
|
50
|
-
return
|
|
50
|
+
return Binaryen._BinaryenSetLowMemoryUnused(on);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
//Provides: caml_binaryen_get_pass_argument
|
|
54
|
-
//Requires:
|
|
54
|
+
//Requires: Binaryen
|
|
55
55
|
//Requires: caml_jsstring_of_string
|
|
56
56
|
function caml_binaryen_get_pass_argument(name) {
|
|
57
|
-
return
|
|
58
|
-
caml_jsstring_of_string(name)
|
|
59
|
-
);
|
|
57
|
+
return Binaryen.getPassArgument(caml_jsstring_of_string(name));
|
|
60
58
|
}
|
|
61
59
|
|
|
62
60
|
//Provides: caml_binaryen_set_pass_argument
|
|
63
|
-
//Requires:
|
|
61
|
+
//Requires: Binaryen
|
|
64
62
|
//Requires: caml_jsstring_of_string
|
|
65
63
|
function caml_binaryen_set_pass_argument(name, value) {
|
|
66
|
-
return
|
|
64
|
+
return Binaryen.setPassArgument(
|
|
67
65
|
caml_jsstring_of_string(name),
|
|
68
66
|
caml_jsstring_of_string(value)
|
|
69
67
|
);
|
|
70
68
|
}
|
|
71
69
|
|
|
72
70
|
//Provides: caml_binaryen_get_always_inline_max_size
|
|
73
|
-
//Requires:
|
|
71
|
+
//Requires: Binaryen
|
|
74
72
|
function caml_binaryen_get_always_inline_max_size() {
|
|
75
|
-
return
|
|
73
|
+
return Binaryen.getAlwaysInlineMaxSize();
|
|
76
74
|
}
|
|
77
75
|
|
|
78
76
|
//Provides: caml_binaryen_set_always_inline_max_size
|
|
79
|
-
//Requires:
|
|
77
|
+
//Requires: Binaryen
|
|
80
78
|
function caml_binaryen_set_always_inline_max_size(size) {
|
|
81
|
-
return
|
|
79
|
+
return Binaryen.setAlwaysInlineMaxSize(size);
|
|
82
80
|
}
|
|
83
81
|
|
|
84
82
|
//Provides: caml_binaryen_get_flexible_inline_max_size
|
|
85
|
-
//Requires:
|
|
83
|
+
//Requires: Binaryen
|
|
86
84
|
function caml_binaryen_get_flexible_inline_max_size() {
|
|
87
|
-
return
|
|
85
|
+
return Binaryen.getFlexibleInlineMaxSize();
|
|
88
86
|
}
|
|
89
87
|
|
|
90
88
|
//Provides: caml_binaryen_set_flexible_inline_max_size
|
|
91
|
-
//Requires:
|
|
89
|
+
//Requires: Binaryen
|
|
92
90
|
function caml_binaryen_set_flexible_inline_max_size(size) {
|
|
93
|
-
return
|
|
91
|
+
return Binaryen.setFlexibleInlineMaxSize(size);
|
|
94
92
|
}
|
|
95
93
|
|
|
96
94
|
//Provides: caml_binaryen_get_one_caller_inline_max_size
|
|
97
|
-
//Requires:
|
|
95
|
+
//Requires: Binaryen
|
|
98
96
|
function caml_binaryen_get_one_caller_inline_max_size() {
|
|
99
|
-
return
|
|
97
|
+
return Binaryen.getOneCallerInlineMaxSize();
|
|
100
98
|
}
|
|
101
99
|
|
|
102
100
|
//Provides: caml_binaryen_set_one_caller_inline_max_size
|
|
103
|
-
//Requires:
|
|
101
|
+
//Requires: Binaryen
|
|
104
102
|
function caml_binaryen_set_one_caller_inline_max_size(size) {
|
|
105
|
-
return
|
|
103
|
+
return Binaryen.setOneCallerInlineMaxSize(size);
|
|
106
104
|
}
|
|
107
105
|
|
|
108
106
|
//Provides: caml_binaryen_set_colors_enabled
|
|
109
|
-
//Requires:
|
|
107
|
+
//Requires: Binaryen
|
|
110
108
|
function caml_binaryen_set_colors_enabled(on) {
|
|
111
109
|
// Uses the `_Binaryen` function because then we are working with ints which are also booleans to JSOO
|
|
112
|
-
return
|
|
110
|
+
return Binaryen._BinaryenSetColorsEnabled(on);
|
|
113
111
|
}
|
|
114
112
|
|
|
115
113
|
//Provides: caml_binaryen_are_colors_enabled
|
|
116
|
-
//Requires:
|
|
114
|
+
//Requires: Binaryen
|
|
117
115
|
function caml_binaryen_are_colors_enabled() {
|
|
118
116
|
// Uses the `_Binaryen` function because then we are working with ints which are also booleans to JSOO
|
|
119
|
-
return
|
|
117
|
+
return Binaryen._BinaryenAreColorsEnabled();
|
|
120
118
|
}
|
|
@@ -11,7 +11,13 @@ function caml_binaryen_add_table(wasm_mod, table, initial, maximum, tableType) {
|
|
|
11
11
|
|
|
12
12
|
//Provides: caml_binaryen_add_active_element_segment
|
|
13
13
|
//Requires: caml_jsstring_of_string, caml_list_to_js_array
|
|
14
|
-
function caml_binaryen_add_active_element_segment(
|
|
14
|
+
function caml_binaryen_add_active_element_segment(
|
|
15
|
+
wasm_mod,
|
|
16
|
+
table,
|
|
17
|
+
name,
|
|
18
|
+
funcnames,
|
|
19
|
+
offset
|
|
20
|
+
) {
|
|
15
21
|
return wasm_mod.addActiveElementSegment(
|
|
16
22
|
caml_jsstring_of_string(table),
|
|
17
23
|
caml_jsstring_of_string(name),
|
|
@@ -43,42 +49,42 @@ function caml_binaryen_get_element_segment_by_index(wasm_mod, index) {
|
|
|
43
49
|
}
|
|
44
50
|
|
|
45
51
|
//Provides: caml_binaryen_element_segment_get_name
|
|
46
|
-
//Requires:
|
|
52
|
+
//Requires: Binaryen
|
|
47
53
|
//Requires: caml_string_of_jsstring
|
|
48
54
|
function caml_binaryen_element_segment_get_name(elem) {
|
|
49
|
-
var element_segment_info =
|
|
50
|
-
return caml_string_of_jsstring(element_segment_info.name)
|
|
55
|
+
var element_segment_info = Binaryen.getElementSegmentInfo(elem);
|
|
56
|
+
return caml_string_of_jsstring(element_segment_info.name);
|
|
51
57
|
}
|
|
52
58
|
|
|
53
59
|
// TODO: Implement caml_binaryen_element_segment_set_name
|
|
54
60
|
|
|
55
61
|
//Provides: caml_binaryen_element_segment_get_table
|
|
56
|
-
//Requires:
|
|
62
|
+
//Requires: Binaryen
|
|
57
63
|
//Requires: caml_string_of_jsstring
|
|
58
64
|
function caml_binaryen_element_segment_get_table(elem) {
|
|
59
|
-
var element_segment_info =
|
|
65
|
+
var element_segment_info = Binaryen.getElementSegmentInfo(elem);
|
|
60
66
|
return caml_string_of_jsstring(element_segment_info.table);
|
|
61
67
|
}
|
|
62
68
|
|
|
63
69
|
// TODO: Implement caml_binaryen_element_segment_set_table
|
|
64
70
|
|
|
65
71
|
//Provides: caml_binaryen_element_segment_get_offset
|
|
66
|
-
//Requires:
|
|
72
|
+
//Requires: Binaryen
|
|
67
73
|
function caml_binaryen_element_segment_get_offset(elem) {
|
|
68
|
-
var element_segment_info =
|
|
74
|
+
var element_segment_info = Binaryen.getElementSegmentInfo(elem);
|
|
69
75
|
return element_segment_info.offset;
|
|
70
76
|
}
|
|
71
77
|
|
|
72
78
|
//Provides: caml_binaryen_element_segment_get_length
|
|
73
|
-
//Requires:
|
|
79
|
+
//Requires: Binaryen
|
|
74
80
|
function caml_binaryen_element_segment_get_length(elem) {
|
|
75
|
-
return
|
|
81
|
+
return Binaryen._BinaryenElementSegmentGetLength(elem);
|
|
76
82
|
}
|
|
77
83
|
|
|
78
84
|
//Provides: caml_binaryen_element_segment_get_data
|
|
79
|
-
//Requires:
|
|
85
|
+
//Requires: Binaryen
|
|
80
86
|
//Requires: caml_string_of_jsstring
|
|
81
87
|
function caml_binaryen_element_segment_get_data(elem, index) {
|
|
82
|
-
var element_segment_info =
|
|
88
|
+
var element_segment_info = Binaryen.getElementSegmentInfo(elem);
|
|
83
89
|
return caml_string_of_jsstring(element_segment_info.data[index]);
|
|
84
90
|
}
|
|
@@ -66,9 +66,30 @@ caml_binaryen_type_funcref(value unit) {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
CAMLprim value
|
|
69
|
-
|
|
69
|
+
caml_binaryen_type_anyref(value unit) {
|
|
70
70
|
CAMLparam1(unit);
|
|
71
|
-
BinaryenType ty =
|
|
71
|
+
BinaryenType ty = BinaryenTypeAnyref();
|
|
72
|
+
CAMLreturn(alloc_BinaryenType(ty));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
CAMLprim value
|
|
76
|
+
caml_binaryen_type_eqref(value unit) {
|
|
77
|
+
CAMLparam1(unit);
|
|
78
|
+
BinaryenType ty = BinaryenTypeEqref();
|
|
79
|
+
CAMLreturn(alloc_BinaryenType(ty));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
CAMLprim value
|
|
83
|
+
caml_binaryen_type_i31ref(value unit) {
|
|
84
|
+
CAMLparam1(unit);
|
|
85
|
+
BinaryenType ty = BinaryenTypeI31ref();
|
|
86
|
+
CAMLreturn(alloc_BinaryenType(ty));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
CAMLprim value
|
|
90
|
+
caml_binaryen_type_dataref(value unit) {
|
|
91
|
+
CAMLparam1(unit);
|
|
92
|
+
BinaryenType ty = BinaryenTypeDataref();
|
|
72
93
|
CAMLreturn(alloc_BinaryenType(ty));
|
|
73
94
|
}
|
|
74
95
|
|
|
@@ -1,73 +1,91 @@
|
|
|
1
1
|
//Provides: caml_binaryen_type_none
|
|
2
|
-
//Requires:
|
|
2
|
+
//Requires: Binaryen
|
|
3
3
|
function caml_binaryen_type_none() {
|
|
4
|
-
return
|
|
4
|
+
return Binaryen.none;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
//Provides: caml_binaryen_type_int32
|
|
8
|
-
//Requires:
|
|
8
|
+
//Requires: Binaryen
|
|
9
9
|
function caml_binaryen_type_int32() {
|
|
10
|
-
return
|
|
10
|
+
return Binaryen.i32;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
//Provides: caml_binaryen_type_int64
|
|
14
|
-
//Requires:
|
|
14
|
+
//Requires: Binaryen
|
|
15
15
|
function caml_binaryen_type_int64() {
|
|
16
|
-
return
|
|
16
|
+
return Binaryen.i64;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
//Provides: caml_binaryen_type_float32
|
|
20
|
-
//Requires:
|
|
20
|
+
//Requires: Binaryen
|
|
21
21
|
function caml_binaryen_type_float32() {
|
|
22
|
-
return
|
|
22
|
+
return Binaryen.f32;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
//Provides: caml_binaryen_type_float64
|
|
26
|
-
//Requires:
|
|
26
|
+
//Requires: Binaryen
|
|
27
27
|
function caml_binaryen_type_float64() {
|
|
28
|
-
return
|
|
28
|
+
return Binaryen.f64;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
//Provides: caml_binaryen_type_vec128
|
|
32
|
-
//Requires:
|
|
32
|
+
//Requires: Binaryen
|
|
33
33
|
function caml_binaryen_type_vec128() {
|
|
34
|
-
return
|
|
34
|
+
return Binaryen.v128;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
//Provides: caml_binaryen_type_funcref
|
|
38
|
-
//Requires:
|
|
38
|
+
//Requires: Binaryen
|
|
39
39
|
function caml_binaryen_type_funcref() {
|
|
40
|
-
return
|
|
40
|
+
return Binaryen.funcref;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
//Provides:
|
|
44
|
-
//Requires:
|
|
45
|
-
function
|
|
46
|
-
return
|
|
43
|
+
//Provides: caml_binaryen_type_anyref
|
|
44
|
+
//Requires: Binaryen
|
|
45
|
+
function caml_binaryen_type_anyref() {
|
|
46
|
+
return Binaryen.anyref;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
//Provides: caml_binaryen_type_eqref
|
|
50
|
+
//Requires: Binaryen
|
|
51
|
+
function caml_binaryen_type_eqref() {
|
|
52
|
+
return Binaryen.eqref;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
//Provides: caml_binaryen_type_i31ref
|
|
56
|
+
//Requires: Binaryen
|
|
57
|
+
function caml_binaryen_type_i31ref() {
|
|
58
|
+
return Binaryen.i31ref;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
//Provides: caml_binaryen_type_dataref
|
|
62
|
+
//Requires: Binaryen
|
|
63
|
+
function caml_binaryen_type_dataref() {
|
|
64
|
+
return Binaryen.dataref;
|
|
47
65
|
}
|
|
48
66
|
|
|
49
67
|
//Provides: caml_binaryen_type_unreachable
|
|
50
|
-
//Requires:
|
|
68
|
+
//Requires: Binaryen
|
|
51
69
|
function caml_binaryen_type_unreachable() {
|
|
52
|
-
return
|
|
70
|
+
return Binaryen.unreachable;
|
|
53
71
|
}
|
|
54
72
|
|
|
55
73
|
//Provides: caml_binaryen_type_auto
|
|
56
|
-
//Requires:
|
|
74
|
+
//Requires: Binaryen
|
|
57
75
|
function caml_binaryen_type_auto() {
|
|
58
|
-
return
|
|
76
|
+
return Binaryen.auto;
|
|
59
77
|
}
|
|
60
78
|
|
|
61
79
|
//Provides: caml_binaryen_type_create
|
|
62
|
-
//Requires:
|
|
80
|
+
//Requires: Binaryen
|
|
63
81
|
//Requires: caml_js_from_array
|
|
64
82
|
function caml_binaryen_type_create(typs) {
|
|
65
|
-
return
|
|
83
|
+
return Binaryen.createType(caml_js_from_array(typs));
|
|
66
84
|
}
|
|
67
85
|
|
|
68
86
|
//Provides: caml_binaryen_type_expand
|
|
69
|
-
//Requires:
|
|
87
|
+
//Requires: Binaryen
|
|
70
88
|
//Requires: caml_js_to_array
|
|
71
89
|
function caml_binaryen_type_expand(typ) {
|
|
72
|
-
return caml_js_to_array(
|
|
90
|
+
return caml_js_to_array(Binaryen.expandType(typ));
|
|
73
91
|
}
|
|
@@ -707,6 +707,33 @@ module Memory_grow = struct
|
|
|
707
707
|
external set_delta : t -> t -> unit = "caml_binaryen_memory_grow_set_delta"
|
|
708
708
|
end
|
|
709
709
|
|
|
710
|
+
module Memory_init = struct
|
|
711
|
+
external make : Module.t -> int -> t -> t -> t = "caml_binaryen_memory_init"
|
|
712
|
+
(** Module, segment, destination, offset, size. *)
|
|
713
|
+
|
|
714
|
+
external get_segment : t -> int = "caml_binaryen_memory_init_get_segment"
|
|
715
|
+
|
|
716
|
+
external set_segment : t -> int -> unit
|
|
717
|
+
= "caml_binaryen_memory_init_set_segment"
|
|
718
|
+
|
|
719
|
+
external get_dest : t -> t = "caml_binaryen_memory_init_get_dest"
|
|
720
|
+
external set_dest : t -> t -> unit = "caml_binaryen_memory_init_set_dest"
|
|
721
|
+
external get_offset : t -> t = "caml_binaryen_memory_init_get_offset"
|
|
722
|
+
external set_offset : t -> t -> unit = "caml_binaryen_memory_init_set_offset"
|
|
723
|
+
external get_size : t -> t = "caml_binaryen_memory_init_get_size"
|
|
724
|
+
external set_size : t -> t -> unit = "caml_binaryen_memory_init_set_size"
|
|
725
|
+
end
|
|
726
|
+
|
|
727
|
+
module Data_drop = struct
|
|
728
|
+
external make : Module.t -> int -> t = "caml_binaryen_data_drop"
|
|
729
|
+
(** Module, segment. *)
|
|
730
|
+
|
|
731
|
+
external get_segment : t -> int = "caml_binaryen_data_drop_get_segment"
|
|
732
|
+
|
|
733
|
+
external set_segment : t -> int -> unit
|
|
734
|
+
= "caml_binaryen_data_drop_set_segment"
|
|
735
|
+
end
|
|
736
|
+
|
|
710
737
|
module Memory_copy = struct
|
|
711
738
|
external make : Module.t -> t -> t -> t -> t = "caml_binaryen_memory_copy"
|
|
712
739
|
(** Module, destination, source, size. *)
|
|
@@ -255,6 +255,24 @@ module Memory_grow : sig
|
|
|
255
255
|
val set_delta : t -> t -> unit
|
|
256
256
|
end
|
|
257
257
|
|
|
258
|
+
module Memory_init : sig
|
|
259
|
+
val make : Module.t -> int -> t -> t -> t
|
|
260
|
+
val get_segment : t -> int
|
|
261
|
+
val set_segment : t -> int -> unit
|
|
262
|
+
val get_dest : t -> t
|
|
263
|
+
val set_dest : t -> t -> unit
|
|
264
|
+
val get_offset : t -> t
|
|
265
|
+
val set_offset : t -> t -> unit
|
|
266
|
+
val get_size : t -> t
|
|
267
|
+
val set_size : t -> t -> unit
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
module Data_drop : sig
|
|
271
|
+
val make : Module.t -> int -> t
|
|
272
|
+
val get_segment : t -> int
|
|
273
|
+
val set_segment : t -> int -> unit
|
|
274
|
+
end
|
|
275
|
+
|
|
258
276
|
module Memory_copy : sig
|
|
259
277
|
val make : Module.t -> t -> t -> t -> t
|
|
260
278
|
val get_dest : t -> t
|
binaryen-archive/src/import.ml
CHANGED
|
@@ -20,11 +20,15 @@ external add_global_import :
|
|
|
20
20
|
external function_import_get_module : Function.t -> string
|
|
21
21
|
= "caml_binaryen_function_import_get_module"
|
|
22
22
|
|
|
23
|
+
external memory_import_get_module : Module.t -> string = "caml_binaryen_memory_import_get_module"
|
|
24
|
+
|
|
23
25
|
external global_import_get_module : Global.t -> string
|
|
24
26
|
= "caml_binaryen_global_import_get_module"
|
|
25
27
|
|
|
26
28
|
external function_import_get_base : Function.t -> string
|
|
27
29
|
= "caml_binaryen_function_import_get_base"
|
|
28
30
|
|
|
31
|
+
external memory_import_get_base : Module.t -> string = "caml_binaryen_memory_import_get_base"
|
|
32
|
+
|
|
29
33
|
external global_import_get_base : Global.t -> string
|
|
30
34
|
= "caml_binaryen_global_import_get_base"
|
binaryen-archive/src/import.mli
CHANGED
|
@@ -8,6 +8,8 @@ val add_global_import :
|
|
|
8
8
|
Module.t -> string -> string -> string -> Type.t -> bool -> unit
|
|
9
9
|
|
|
10
10
|
val function_import_get_module : Function.t -> string
|
|
11
|
+
val memory_import_get_module : Module.t -> string
|
|
11
12
|
val global_import_get_module : Global.t -> string
|
|
12
13
|
val function_import_get_base : Function.t -> string
|
|
14
|
+
val memory_import_get_base : Module.t -> string
|
|
13
15
|
val global_import_get_base : Global.t -> string
|
binaryen-archive/src/memory.ml
CHANGED
|
@@ -3,31 +3,34 @@ external set_memory :
|
|
|
3
3
|
int ->
|
|
4
4
|
int ->
|
|
5
5
|
string ->
|
|
6
|
-
|
|
6
|
+
bytes list ->
|
|
7
7
|
bool list ->
|
|
8
8
|
Expression.t list ->
|
|
9
9
|
int list ->
|
|
10
10
|
bool ->
|
|
11
11
|
unit = "caml_binaryen_set_memory__bytecode" "caml_binaryen_set_memory"
|
|
12
12
|
|
|
13
|
-
type segment = {
|
|
14
|
-
|
|
15
|
-
passive : bool;
|
|
16
|
-
offset : Expression.t;
|
|
17
|
-
size : int;
|
|
18
|
-
}
|
|
13
|
+
type segment = { data : bytes; kind : segment_kind; size : int }
|
|
14
|
+
and segment_kind = Passive | Active of { offset : Expression.t }
|
|
19
15
|
|
|
20
16
|
(** Module, initial size, maximum size, export name, segments, shared. *)
|
|
21
17
|
let set_memory wasm_mod initial maximum export_name (segments : segment list)
|
|
22
18
|
shared =
|
|
23
19
|
let split_segments segments =
|
|
24
20
|
List.fold_right
|
|
25
|
-
(fun { data;
|
|
21
|
+
(fun { data; kind; size }
|
|
26
22
|
(segment_data, segment_passive, segment_offsets, segment_sizes) ->
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
match kind with
|
|
24
|
+
| Active { offset } ->
|
|
25
|
+
( data :: segment_data,
|
|
26
|
+
false :: segment_passive,
|
|
27
|
+
offset :: segment_offsets,
|
|
28
|
+
size :: segment_sizes )
|
|
29
|
+
| Passive ->
|
|
30
|
+
( data :: segment_data,
|
|
31
|
+
true :: segment_passive,
|
|
32
|
+
Expression.Null.make () :: segment_offsets,
|
|
33
|
+
size :: segment_sizes ))
|
|
31
34
|
segments ([], [], [], [])
|
|
32
35
|
in
|
|
33
36
|
let segment_data, segment_passive, segment_offsets, segment_sizes =
|
|
@@ -36,4 +39,14 @@ let set_memory wasm_mod initial maximum export_name (segments : segment list)
|
|
|
36
39
|
set_memory wasm_mod initial maximum export_name segment_data segment_passive
|
|
37
40
|
segment_offsets segment_sizes shared
|
|
38
41
|
|
|
42
|
+
external has_memory : Module.t -> bool = "caml_binaryen_has_memory"
|
|
43
|
+
|
|
44
|
+
external get_initial : Module.t -> int = "caml_binaryen_memory_get_initial"
|
|
45
|
+
|
|
46
|
+
external has_max : Module.t -> bool = "caml_binaryen_memory_has_max"
|
|
47
|
+
|
|
48
|
+
external get_max : Module.t -> int = "caml_binaryen_memory_get_max"
|
|
49
|
+
|
|
50
|
+
external is_shared : Module.t -> bool = "caml_binaryen_memory_is_shared"
|
|
51
|
+
|
|
39
52
|
let unlimited = -1
|
binaryen-archive/src/memory.mli
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
type segment = {
|
|
2
|
-
|
|
3
|
-
passive : bool;
|
|
4
|
-
offset : Expression.t;
|
|
5
|
-
size : int;
|
|
6
|
-
}
|
|
1
|
+
type segment = { data : bytes; kind : segment_kind; size : int }
|
|
2
|
+
and segment_kind = Passive | Active of { offset : Expression.t }
|
|
7
3
|
|
|
8
4
|
val set_memory :
|
|
9
5
|
Module.t -> int -> int -> string -> segment list -> bool -> unit
|
|
10
6
|
|
|
7
|
+
val has_memory : Module.t -> bool
|
|
8
|
+
|
|
9
|
+
val get_initial : Module.t -> int
|
|
10
|
+
|
|
11
|
+
val has_max : Module.t -> bool
|
|
12
|
+
|
|
13
|
+
val get_max : Module.t -> int
|
|
14
|
+
|
|
15
|
+
val is_shared : Module.t -> bool
|
|
16
|
+
|
|
11
17
|
val unlimited : int
|
binaryen-archive/src/module.ml
CHANGED
|
@@ -87,6 +87,7 @@ external add_custom_section : t -> string -> string -> unit
|
|
|
87
87
|
external parse : string -> t = "caml_binaryen_module_parse"
|
|
88
88
|
external print : t -> unit = "caml_binaryen_module_print"
|
|
89
89
|
external print_asmjs : t -> unit = "caml_binaryen_module_print_asmjs"
|
|
90
|
+
external print_stack_ir : t -> unit = "caml_binaryen_module_print_stack_ir"
|
|
90
91
|
external validate : t -> int = "caml_binaryen_module_validate"
|
|
91
92
|
external optimize : t -> unit = "caml_binaryen_module_optimize"
|
|
92
93
|
external get_features : t -> int = "caml_binaryen_module_get_features"
|
|
@@ -117,6 +118,7 @@ external write : t -> string option -> bytes * string option
|
|
|
117
118
|
= "caml_binaryen_module_write"
|
|
118
119
|
|
|
119
120
|
external write_text : t -> string = "caml_binaryen_module_write_text"
|
|
121
|
+
external write_stack_ir : t -> string = "caml_binaryen_module_write_stack_ir"
|
|
120
122
|
external read : bytes -> t = "caml_binaryen_module_read"
|
|
121
123
|
external interpret : t -> unit = "caml_binaryen_module_interpret"
|
|
122
124
|
|
binaryen-archive/src/module.mli
CHANGED
|
@@ -28,6 +28,7 @@ val add_custom_section : t -> string -> string -> unit
|
|
|
28
28
|
val parse : string -> t
|
|
29
29
|
val print : t -> unit
|
|
30
30
|
val print_asmjs : t -> unit
|
|
31
|
+
val print_stack_ir : t -> unit
|
|
31
32
|
val validate : t -> int
|
|
32
33
|
val optimize : t -> unit
|
|
33
34
|
val get_features : t -> Feature.t list
|
|
@@ -36,6 +37,7 @@ val run_passes : t -> Passes.t list -> unit
|
|
|
36
37
|
val auto_drop : t -> unit
|
|
37
38
|
val write : t -> string option -> bytes * string option
|
|
38
39
|
val write_text : t -> string
|
|
40
|
+
val write_stack_ir : t -> string
|
|
39
41
|
val read : bytes -> t
|
|
40
42
|
val interpret : t -> unit
|
|
41
43
|
val add_debug_info_filename : t -> string -> int
|
binaryen-archive/src/passes.ml
CHANGED
|
@@ -90,6 +90,9 @@ let global_refining = "global-refining"
|
|
|
90
90
|
(** globally optimize GC types *)
|
|
91
91
|
let gto = "gto"
|
|
92
92
|
|
|
93
|
+
(** globally optimize struct values *)
|
|
94
|
+
let gsi = "gsi"
|
|
95
|
+
|
|
93
96
|
(** apply more specific subtypes to type fields where possible *)
|
|
94
97
|
let type_refining = "type-refining"
|
|
95
98
|
|
|
@@ -311,6 +314,9 @@ let souperify = "souperify"
|
|
|
311
314
|
(** emit Souper IR in text form (single-use nodes only) *)
|
|
312
315
|
let souperify_single_use = "souperify-single-use"
|
|
313
316
|
|
|
317
|
+
(** spill pointers to the C stack (useful for Boehm-style GC) *)
|
|
318
|
+
let spill_pointers = "spill-pointers"
|
|
319
|
+
|
|
314
320
|
(** stub out unsupported JS operations *)
|
|
315
321
|
let stub_unsupported_js = "stub-unsupported-js"
|
|
316
322
|
|
binaryen-archive/src/passes.mli
CHANGED
|
@@ -90,6 +90,9 @@ val global_refining : t
|
|
|
90
90
|
val gto : t
|
|
91
91
|
(** globally optimize GC types *)
|
|
92
92
|
|
|
93
|
+
val gsi : t
|
|
94
|
+
(** globally optimize struct values *)
|
|
95
|
+
|
|
93
96
|
val type_refining : t
|
|
94
97
|
(** apply more specific subtypes to type fields where possible *)
|
|
95
98
|
|
|
@@ -309,6 +312,9 @@ val souperify : t
|
|
|
309
312
|
val souperify_single_use : t
|
|
310
313
|
(** emit Souper IR in text form (single-use nodes only) *)
|
|
311
314
|
|
|
315
|
+
val spill_pointers : t
|
|
316
|
+
(** spill pointers to the C stack (useful for Boehm-style GC) *)
|
|
317
|
+
|
|
312
318
|
val stub_unsupported_js : t
|
|
313
319
|
(** stub out unsupported JS operations *)
|
|
314
320
|
|
binaryen-archive/src/type.ml
CHANGED
|
@@ -28,9 +28,21 @@ external funcref : unit -> t = "caml_binaryen_type_funcref"
|
|
|
28
28
|
|
|
29
29
|
let funcref = funcref ()
|
|
30
30
|
|
|
31
|
-
external
|
|
31
|
+
external anyref : unit -> t = "caml_binaryen_type_anyref"
|
|
32
32
|
|
|
33
|
-
let
|
|
33
|
+
let anyref = anyref ()
|
|
34
|
+
|
|
35
|
+
external eqref : unit -> t = "caml_binaryen_type_eqref"
|
|
36
|
+
|
|
37
|
+
let eqref = eqref ()
|
|
38
|
+
|
|
39
|
+
external i31ref : unit -> t = "caml_binaryen_type_i31ref"
|
|
40
|
+
|
|
41
|
+
let i31ref = i31ref ()
|
|
42
|
+
|
|
43
|
+
external dataref : unit -> t = "caml_binaryen_type_dataref"
|
|
44
|
+
|
|
45
|
+
let dataref = dataref ()
|
|
34
46
|
|
|
35
47
|
external unreachable : unit -> t = "caml_binaryen_type_unreachable"
|
|
36
48
|
|
binaryen-archive/src/type.mli
CHANGED