Skip to content

Commit 1051aec

Browse files
committed
1 parent a4bb843 commit 1051aec

File tree

11 files changed

+141
-47
lines changed

11 files changed

+141
-47
lines changed

binaryen.opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ depends: [
1616
"dune" {>= "3.0.0"}
1717
"dune-configurator" {>= "3.0.0"}
1818
"js_of_ocaml-compiler" {>= "6.0.0" < "7.0.0"}
19-
"libbinaryen" {>= "122.0.1" < "123.0.0"}
19+
"libbinaryen" {>= "123.0.0" < "124.0.0"}
2020
]
2121
x-maintenance-intent: ["0.(latest)"]

esy.lock/index.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"license": "Apache-2.0",
77
"dependencies": {
88
"ocaml": ">= 4.13.0 < 5.4.0",
9-
"@grain/libbinaryen": ">= 122.0.0 < 123.0.0",
9+
"@grain/libbinaryen": ">= 123.0.0 < 124.0.0",
1010
"@opam/dune": ">= 3.0.0",
1111
"@opam/dune-configurator": ">= 3.0.0"
1212
},
@@ -16,7 +16,8 @@
1616
"@opam/ocaml-lsp-server": ">= 1.9.1 < 2.0.0"
1717
},
1818
"resolutions": {
19-
"@opam/ocp-indent": "1.7.0"
19+
"@opam/ocp-indent": "1.7.0",
20+
"@grain/libbinaryen": "git+https://github.com/grain-lang/libbinaryen.git#cb37a909a8b27ab2f5ef89b5c5c346e2622424f0"
2021
},
2122
"esy": {
2223
"build": "dune build -p binaryen"

src/expression.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1868,7 +1868,7 @@ caml_binaryen_ref_func(value _module, value _name, value _ty) {
18681868
CAMLparam3(_module, _name, _ty);
18691869
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
18701870
char* name = Safe_String_val(_name);
1871-
BinaryenType ty = BinaryenType_val(_ty);
1871+
BinaryenHeapType ty = BinaryenHeapType_val(_ty);
18721872
BinaryenExpressionRef exp = BinaryenRefFunc(module, name, ty);
18731873
CAMLreturn(alloc_BinaryenExpressionRef(exp));
18741874
}

src/expression.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,8 @@ module Ref = struct
825825
external as_ : Module.t -> Op.t -> t -> t = "caml_binaryen_ref_as"
826826
(** Module, op, value *)
827827

828-
external func : Module.t -> string -> Type.t -> t = "caml_binaryen_ref_func"
828+
external func : Module.t -> string -> Heap_type.t -> t
829+
= "caml_binaryen_ref_func"
829830
(** Module, func, type *)
830831

831832
external eq : Module.t -> t -> t -> t = "caml_binaryen_ref_eq"

src/expression.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ module Ref : sig
343343
val as_ : Module.t -> Op.t -> t -> t
344344
(** Module, op, value *)
345345

346-
val func : Module.t -> string -> Type.t -> t
346+
val func : Module.t -> string -> Heap_type.t -> t
347347
(** Module, func, type *)
348348

349349
val eq : Module.t -> t -> t -> t

src/module.ml

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ module Feature = struct
1414

1515
let atomics = atomics ()
1616

17-
external bulk_memory : unit -> t = "caml_binaryen_feature_bulk_memory"
18-
19-
let bulk_memory = bulk_memory ()
20-
2117
external mutable_globals : unit -> t = "caml_binaryen_feature_mutable_globals"
2218

2319
let mutable_globals = mutable_globals ()
@@ -27,14 +23,18 @@ module Feature = struct
2723

2824
let nontrapping_fp_to_int = nontrapping_fp_to_int ()
2925

30-
external sign_ext : unit -> t = "caml_binaryen_feature_sign_ext"
31-
32-
let sign_ext = sign_ext ()
33-
3426
external simd128 : unit -> t = "caml_binaryen_feature_simd128"
3527

3628
let simd128 = simd128 ()
3729

30+
external bulk_memory : unit -> t = "caml_binaryen_feature_bulk_memory"
31+
32+
let bulk_memory = bulk_memory ()
33+
34+
external sign_ext : unit -> t = "caml_binaryen_feature_sign_ext"
35+
36+
let sign_ext = sign_ext ()
37+
3838
external exception_handling : unit -> t
3939
= "caml_binaryen_feature_exception_handling"
4040

@@ -76,6 +76,28 @@ module Feature = struct
7676

7777
let multi_memory = multi_memory ()
7878

79+
external stack_switching : unit -> t = "caml_binaryen_feature_stack_switching"
80+
81+
let stack_switching = stack_switching ()
82+
83+
external shared_everything : unit -> t
84+
= "caml_binaryen_feature_shared_everything"
85+
86+
let shared_everything = shared_everything ()
87+
88+
external fp16 : unit -> t = "caml_binaryen_feature_fp16"
89+
90+
let fp16 = fp16 ()
91+
92+
external bulk_memory_opt : unit -> t = "caml_binaryen_feature_bulk_memory_opt"
93+
94+
let bulk_memory_opt = bulk_memory_opt ()
95+
96+
external call_indirect_overlong : unit -> t
97+
= "caml_binaryen_feature_call_indirect_overlong"
98+
99+
let call_indirect_overlong = call_indirect_overlong ()
100+
79101
external all : unit -> t = "caml_binaryen_feature_all"
80102

81103
let all = all ()

src/module.mli

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ module Feature : sig
55

66
val mvp : t
77
val atomics : t
8-
val bulk_memory : t
98
val mutable_globals : t
109
val nontrapping_fp_to_int : t
11-
val sign_ext : t
1210
val simd128 : t
11+
val bulk_memory : t
12+
val sign_ext : t
1313
val exception_handling : t
1414
val tail_call : t
1515
val reference_types : t
@@ -20,6 +20,11 @@ module Feature : sig
2020
val extended_const : t
2121
val strings : t
2222
val multi_memory : t
23+
val stack_switching : t
24+
val shared_everything : t
25+
val fp16 : t
26+
val bulk_memory_opt : t
27+
val call_indirect_overlong : t
2328
val all : t
2429
end
2530

src/module_feature.c

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ caml_binaryen_feature_atomics(value unit) {
3535
CAMLreturn(Val_int(BinaryenFeatureAtomics()));
3636
}
3737

38-
CAMLprim value
39-
caml_binaryen_feature_bulk_memory(value unit) {
40-
CAMLparam1(unit);
41-
CAMLreturn(Val_int(BinaryenFeatureBulkMemory()));
42-
}
43-
4438
CAMLprim value
4539
caml_binaryen_feature_mutable_globals(value unit) {
4640
CAMLparam1(unit);
@@ -54,15 +48,21 @@ caml_binaryen_feature_nontrapping_fp_to_int(value unit) {
5448
}
5549

5650
CAMLprim value
57-
caml_binaryen_feature_sign_ext(value unit) {
51+
caml_binaryen_feature_simd128(value unit) {
5852
CAMLparam1(unit);
59-
CAMLreturn(Val_int(BinaryenFeatureSignExt()));
53+
CAMLreturn(Val_int(BinaryenFeatureSIMD128()));
6054
}
6155

6256
CAMLprim value
63-
caml_binaryen_feature_simd128(value unit) {
57+
caml_binaryen_feature_bulk_memory(value unit) {
6458
CAMLparam1(unit);
65-
CAMLreturn(Val_int(BinaryenFeatureSIMD128()));
59+
CAMLreturn(Val_int(BinaryenFeatureBulkMemory()));
60+
}
61+
62+
CAMLprim value
63+
caml_binaryen_feature_sign_ext(value unit) {
64+
CAMLparam1(unit);
65+
CAMLreturn(Val_int(BinaryenFeatureSignExt()));
6666
}
6767

6868
CAMLprim value
@@ -125,6 +125,36 @@ caml_binaryen_feature_multi_memory(value unit) {
125125
CAMLreturn(Val_int(BinaryenFeatureMultiMemory()));
126126
}
127127

128+
CAMLprim value
129+
caml_binaryen_feature_stack_switching(value unit) {
130+
CAMLparam1(unit);
131+
CAMLreturn(Val_int(BinaryenFeatureStackSwitching()));
132+
}
133+
134+
CAMLprim value
135+
caml_binaryen_feature_shared_everything(value unit) {
136+
CAMLparam1(unit);
137+
CAMLreturn(Val_int(BinaryenFeatureSharedEverything()));
138+
}
139+
140+
CAMLprim value
141+
caml_binaryen_feature_fp16(value unit) {
142+
CAMLparam1(unit);
143+
CAMLreturn(Val_int(BinaryenFeatureFP16()));
144+
}
145+
146+
CAMLprim value
147+
caml_binaryen_feature_bulk_memory_opt(value unit) {
148+
CAMLparam1(unit);
149+
CAMLreturn(Val_int(BinaryenFeatureBulkMemoryOpt()));
150+
}
151+
152+
CAMLprim value
153+
caml_binaryen_feature_call_indirect_overlong(value unit) {
154+
CAMLparam1(unit);
155+
CAMLreturn(Val_int(BinaryenFeatureCallIndirectOverlong()));
156+
}
157+
128158
CAMLprim value
129159
caml_binaryen_feature_all(value unit) {
130160
CAMLparam1(unit);

src/module_feature.js

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ function caml_binaryen_feature_atomics() {
2020
return Binaryen.Features.Atomics;
2121
}
2222

23-
//Provides: caml_binaryen_feature_bulk_memory
24-
//Requires: Binaryen
25-
function caml_binaryen_feature_bulk_memory() {
26-
return Binaryen.Features.BulkMemory;
27-
}
28-
2923
//Provides: caml_binaryen_feature_mutable_globals
3024
//Requires: Binaryen
3125
function caml_binaryen_feature_mutable_globals() {
@@ -38,18 +32,24 @@ function caml_binaryen_feature_nontrapping_fp_to_int() {
3832
return Binaryen.Features.NontrappingFPToInt;
3933
}
4034

41-
//Provides: caml_binaryen_feature_sign_ext
42-
//Requires: Binaryen
43-
function caml_binaryen_feature_sign_ext() {
44-
return Binaryen.Features.SignExt;
45-
}
46-
4735
//Provides: caml_binaryen_feature_simd128
4836
//Requires: Binaryen
4937
function caml_binaryen_feature_simd128() {
5038
return Binaryen.Features.SIMD128;
5139
}
5240

41+
//Provides: caml_binaryen_feature_bulk_memory
42+
//Requires: Binaryen
43+
function caml_binaryen_feature_bulk_memory() {
44+
return Binaryen.Features.BulkMemory;
45+
}
46+
47+
//Provides: caml_binaryen_feature_sign_ext
48+
//Requires: Binaryen
49+
function caml_binaryen_feature_sign_ext() {
50+
return Binaryen.Features.SignExt;
51+
}
52+
5353
//Provides: caml_binaryen_feature_exception_handling
5454
//Requires: Binaryen
5555
function caml_binaryen_feature_exception_handling() {
@@ -110,6 +110,36 @@ function caml_binaryen_feature_multi_memory() {
110110
return Binaryen.Features.MultiMemory;
111111
}
112112

113+
//Provides: caml_binaryen_feature_stack_switching
114+
//Requires: Binaryen
115+
function caml_binaryen_feature_stack_switching() {
116+
return Binaryen.Features.StackSwitching;
117+
}
118+
119+
//Provides: caml_binaryen_feature_shared_everything
120+
//Requires: Binaryen
121+
function caml_binaryen_feature_shared_everything() {
122+
return Binaryen.Features.SharedEverything;
123+
}
124+
125+
//Provides: caml_binaryen_feature_fp16
126+
//Requires: Binaryen
127+
function caml_binaryen_feature_fp16() {
128+
return Binaryen.Features.FP16;
129+
}
130+
131+
//Provides: caml_binaryen_feature_bulk_memory_opt
132+
//Requires: Binaryen
133+
function caml_binaryen_feature_bulk_memory_opt() {
134+
return Binaryen.Features.BulkMemoryOpt;
135+
}
136+
137+
//Provides: caml_binaryen_feature_call_indirect_overlong
138+
//Requires: Binaryen
139+
function caml_binaryen_feature_call_indirect_overlong() {
140+
return Binaryen.Features.BulkMemoryOpt;
141+
}
142+
113143
//Provides: caml_binaryen_feature_all
114144
//Requires: Binaryen
115145
function caml_binaryen_feature_all() {

0 commit comments

Comments
 (0)