@grain/binaryen.ml 0.12.1 → 0.13.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.
Files changed (41) hide show
  1. binaryen-archive/CHANGELOG.md +14 -0
  2. binaryen-archive/README.md +24 -0
  3. binaryen-archive/binaryen.opam +2 -2
  4. binaryen-archive/esy.lock/index.json +6 -6
  5. binaryen-archive/js/binaryen.es5.js +363 -5
  6. binaryen-archive/js/dune +1 -1
  7. binaryen-archive/js/export.ml +0 -3
  8. binaryen-archive/js/expression.ml +161 -0
  9. binaryen-archive/js/literal.ml +0 -1
  10. binaryen-archive/js/module.ml +6 -9
  11. binaryen-archive/js/op.ml +0 -223
  12. binaryen-archive/js/prelude.js +2 -11
  13. binaryen-archive/js/type.ml +0 -9
  14. binaryen-archive/package.json +2 -2
  15. binaryen-archive/src/binaryen_stubs_expressions.c +250 -0
  16. binaryen-archive/src/binaryen_stubs_features.c +24 -0
  17. binaryen-archive/src/element_segment.ml +0 -1
  18. binaryen-archive/src/export.ml +0 -2
  19. binaryen-archive/src/expression.ml +94 -63
  20. binaryen-archive/src/function.ml +0 -6
  21. binaryen-archive/src/global.ml +0 -2
  22. binaryen-archive/src/literal.ml +0 -3
  23. binaryen-archive/src/module.ml +17 -9
  24. binaryen-archive/src/settings.ml +0 -6
  25. binaryen-archive/src/type.ml +0 -1
  26. binaryen-archive/test/config/ocamlopt_flags.ml +8 -1
  27. binaryen-archive/test/test.expected +8 -0
  28. binaryen-archive/test/test.ml +44 -22
  29. binaryen-archive/virtual/element_segment.mli +0 -4
  30. binaryen-archive/virtual/export.mli +0 -15
  31. binaryen-archive/virtual/expression.mli +93 -115
  32. binaryen-archive/virtual/function.mli +0 -12
  33. binaryen-archive/virtual/global.mli +0 -8
  34. binaryen-archive/virtual/import.mli +0 -4
  35. binaryen-archive/virtual/literal.mli +0 -5
  36. binaryen-archive/virtual/module.mli +4 -29
  37. binaryen-archive/virtual/op.mli +0 -315
  38. binaryen-archive/virtual/settings.mli +0 -17
  39. binaryen-archive/virtual/table.mli +0 -3
  40. binaryen-archive/virtual/type.mli +0 -11
  41. binaryen-archive/js/postlude.js +0 -2
@@ -1708,3 +1708,253 @@ caml_binaryen_tuple_extract_set_tuple(value _exp, value _value) {
1708
1708
  BinaryenTupleExtractSetTuple(exp, val);
1709
1709
  CAMLreturn(Val_unit);
1710
1710
  }
1711
+
1712
+ // Ref operations
1713
+ CAMLprim value
1714
+ caml_binaryen_ref_null(value _module, value _ty) {
1715
+ CAMLparam2(_module, _ty);
1716
+ BinaryenModuleRef module = BinaryenModuleRef_val(_module);
1717
+ BinaryenType ty = BinaryenType_val(_ty);
1718
+ BinaryenExpressionRef exp = BinaryenRefNull(module, ty);
1719
+ CAMLreturn(alloc_BinaryenExpressionRef(exp));
1720
+ }
1721
+
1722
+ CAMLprim value
1723
+ caml_binaryen_ref_is(value _module, value _op, value _value) {
1724
+ CAMLparam3(_module, _op, _value);
1725
+ BinaryenModuleRef module = BinaryenModuleRef_val(_module);
1726
+ BinaryenOp op = BinaryenOp_val(_op);
1727
+ BinaryenExpressionRef val = BinaryenExpressionRef_val(_value);
1728
+ BinaryenExpressionRef exp = BinaryenRefIs(module, op, val);
1729
+ CAMLreturn(alloc_BinaryenExpressionRef(exp));
1730
+ }
1731
+
1732
+ CAMLprim value
1733
+ caml_binaryen_ref_as(value _module, value _op, value _value) {
1734
+ CAMLparam3(_module, _op, _value);
1735
+ BinaryenModuleRef module = BinaryenModuleRef_val(_module);
1736
+ BinaryenOp op = BinaryenOp_val(_op);
1737
+ BinaryenExpressionRef val = BinaryenExpressionRef_val(_value);
1738
+ BinaryenExpressionRef exp = BinaryenRefAs(module, op, val);
1739
+ CAMLreturn(alloc_BinaryenExpressionRef(exp));
1740
+ }
1741
+
1742
+ CAMLprim value
1743
+ caml_binaryen_ref_func(value _module, value _name, value _ty) {
1744
+ CAMLparam3(_module, _name, _ty);
1745
+ BinaryenModuleRef module = BinaryenModuleRef_val(_module);
1746
+ char* name = Safe_String_val(_name);
1747
+ BinaryenType ty = BinaryenType_val(_ty);
1748
+ BinaryenExpressionRef exp = BinaryenRefFunc(module, name, ty);
1749
+ CAMLreturn(alloc_BinaryenExpressionRef(exp));
1750
+ }
1751
+
1752
+ CAMLprim value
1753
+ caml_binaryen_ref_eq(value _module, value _left, value _right) {
1754
+ CAMLparam3(_module, _left, _right);
1755
+ BinaryenModuleRef module = BinaryenModuleRef_val(_module);
1756
+ BinaryenExpressionRef left = BinaryenExpressionRef_val(_left);
1757
+ BinaryenExpressionRef right = BinaryenExpressionRef_val(_right);
1758
+ BinaryenExpressionRef exp = BinaryenRefEq(module, left, right);
1759
+ CAMLreturn(alloc_BinaryenExpressionRef(exp));
1760
+ }
1761
+
1762
+ // Table operations
1763
+ CAMLprim value
1764
+ caml_binaryen_table_get(value _module, value _name, value _index, value _ty) {
1765
+ CAMLparam4(_module, _name, _index, _ty);
1766
+ BinaryenModuleRef module = BinaryenModuleRef_val(_module);
1767
+ char* name = Safe_String_val(_name);
1768
+ BinaryenExpressionRef index = BinaryenExpressionRef_val(_index);
1769
+ BinaryenType ty = BinaryenType_val(_ty);
1770
+ BinaryenExpressionRef exp = BinaryenTableGet(module, name, index, ty);
1771
+ CAMLreturn(alloc_BinaryenExpressionRef(exp));
1772
+ }
1773
+
1774
+ CAMLprim value
1775
+ caml_binaryen_table_set(value _module, value _name, value _index, value _value) {
1776
+ CAMLparam4(_module, _name, _index, _value);
1777
+ BinaryenModuleRef module = BinaryenModuleRef_val(_module);
1778
+ char* name = Safe_String_val(_name);
1779
+ BinaryenExpressionRef index = BinaryenExpressionRef_val(_index);
1780
+ BinaryenExpressionRef val = BinaryenExpressionRef_val(_value);
1781
+ BinaryenExpressionRef exp = BinaryenTableSet(module, name, index, val);
1782
+ CAMLreturn(alloc_BinaryenExpressionRef(exp));
1783
+ }
1784
+
1785
+ CAMLprim value
1786
+ caml_binaryen_table_size(value _module, value _name) {
1787
+ CAMLparam2(_module, _name);
1788
+ BinaryenModuleRef module = BinaryenModuleRef_val(_module);
1789
+ char* name = Safe_String_val(_name);
1790
+ BinaryenExpressionRef exp = BinaryenTableSize(module, name);
1791
+ CAMLreturn(alloc_BinaryenExpressionRef(exp));
1792
+ }
1793
+
1794
+ CAMLprim value
1795
+ caml_binaryen_table_grow(value _module, value _name, value _value, value _delta) {
1796
+ CAMLparam4(_module, _name, _value, _delta);
1797
+ BinaryenModuleRef module = BinaryenModuleRef_val(_module);
1798
+ char* name = Safe_String_val(_name);
1799
+ BinaryenExpressionRef val = BinaryenExpressionRef_val(_value);
1800
+ BinaryenExpressionRef delta = BinaryenExpressionRef_val(_delta);
1801
+ BinaryenExpressionRef exp = BinaryenTableGrow(module, name, val, delta);
1802
+ CAMLreturn(alloc_BinaryenExpressionRef(exp));
1803
+ }
1804
+
1805
+ // TableGet operations
1806
+ CAMLprim value
1807
+ caml_binaryen_tableget_get_table(value _exp) {
1808
+ CAMLparam1(_exp);
1809
+ BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
1810
+ const char* name = BinaryenTableGetGetTable(exp);
1811
+ CAMLreturn(caml_copy_string(name));
1812
+ }
1813
+
1814
+ CAMLprim value
1815
+ caml_binaryen_tableget_set_table(value _exp, value _table) {
1816
+ CAMLparam2(_exp, _table);
1817
+ BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
1818
+ char* table = Safe_String_val(_table);
1819
+ BinaryenTableGetSetTable(exp, table);
1820
+ CAMLreturn(Val_unit);
1821
+ }
1822
+
1823
+ CAMLprim value
1824
+ caml_binaryen_tableget_get_index(value _exp) {
1825
+ CAMLparam1(_exp);
1826
+ BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
1827
+ BinaryenExpressionRef index = BinaryenTableGetGetIndex(exp);
1828
+ CAMLreturn(alloc_BinaryenExpressionRef(index));
1829
+ }
1830
+
1831
+ CAMLprim value
1832
+ caml_binaryen_tableget_set_index(value _exp, value _index) {
1833
+ CAMLparam2(_exp, _index);
1834
+ BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
1835
+ BinaryenExpressionRef index = BinaryenExpressionRef_val(_index);
1836
+ BinaryenTableGetSetIndex(exp, index);
1837
+ CAMLreturn(Val_unit);
1838
+ }
1839
+
1840
+ // TableSet operations
1841
+ CAMLprim value
1842
+ caml_binaryen_tableset_get_table(value _exp) {
1843
+ CAMLparam1(_exp);
1844
+ BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
1845
+ const char* name = BinaryenTableSetGetTable(exp);
1846
+ CAMLreturn(caml_copy_string(name));
1847
+ }
1848
+
1849
+ CAMLprim value
1850
+ caml_binaryen_tableset_set_table(value _exp, value _table) {
1851
+ CAMLparam2(_exp, _table);
1852
+ BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
1853
+ char* table = Safe_String_val(_table);
1854
+ BinaryenTableSetSetTable(exp, table);
1855
+ CAMLreturn(Val_unit);
1856
+ }
1857
+
1858
+ CAMLprim value
1859
+ caml_binaryen_tableset_get_index(value _exp) {
1860
+ CAMLparam1(_exp);
1861
+ BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
1862
+ BinaryenExpressionRef index = BinaryenTableSetGetIndex(exp);
1863
+ CAMLreturn(alloc_BinaryenExpressionRef(index));
1864
+ }
1865
+
1866
+ CAMLprim value
1867
+ caml_binaryen_tableset_set_index(value _exp, value _index) {
1868
+ CAMLparam2(_exp, _index);
1869
+ BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
1870
+ BinaryenExpressionRef index = BinaryenExpressionRef_val(_index);
1871
+ BinaryenTableSetSetIndex(exp, index);
1872
+ CAMLreturn(Val_unit);
1873
+ }
1874
+
1875
+ CAMLprim value
1876
+ caml_binaryen_tableset_get_value(value _exp) {
1877
+ CAMLparam1(_exp);
1878
+ BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
1879
+ BinaryenExpressionRef val = BinaryenTableSetGetValue(exp);
1880
+ CAMLreturn(alloc_BinaryenExpressionRef(val));
1881
+ }
1882
+
1883
+ CAMLprim value
1884
+ caml_binaryen_tableset_set_value(value _exp, value _value) {
1885
+ CAMLparam2(_exp, _value);
1886
+ BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
1887
+ BinaryenExpressionRef val = BinaryenExpressionRef_val(_value);
1888
+ BinaryenTableSetSetValue(exp, val);
1889
+ CAMLreturn(Val_unit);
1890
+ }
1891
+
1892
+ // TableSize operations
1893
+ CAMLprim value
1894
+ caml_binaryen_tablesize_get_table(value _exp) {
1895
+ CAMLparam1(_exp);
1896
+ BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
1897
+ const char* name = BinaryenTableSizeGetTable(exp);
1898
+ CAMLreturn(caml_copy_string(name));
1899
+ }
1900
+
1901
+ CAMLprim value
1902
+ caml_binaryen_tablesize_set_table(value _exp, value _table) {
1903
+ CAMLparam2(_exp, _table);
1904
+ BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
1905
+ char* table = Safe_String_val(_table);
1906
+ BinaryenTableSizeSetTable(exp, table);
1907
+ CAMLreturn(Val_unit);
1908
+ }
1909
+
1910
+ // TableGrow operations
1911
+ CAMLprim value
1912
+ caml_binaryen_tablegrow_get_table(value _exp) {
1913
+ CAMLparam1(_exp);
1914
+ BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
1915
+ const char* name = BinaryenTableGrowGetTable(exp);
1916
+ CAMLreturn(caml_copy_string(name));
1917
+ }
1918
+
1919
+ CAMLprim value
1920
+ caml_binaryen_tablegrow_set_table(value _exp, value _table) {
1921
+ CAMLparam2(_exp, _table);
1922
+ BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
1923
+ char* table = Safe_String_val(_table);
1924
+ BinaryenTableGrowSetTable(exp, table);
1925
+ CAMLreturn(Val_unit);
1926
+ }
1927
+
1928
+ CAMLprim value
1929
+ caml_binaryen_tablegrow_get_value(value _exp) {
1930
+ CAMLparam1(_exp);
1931
+ BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
1932
+ BinaryenExpressionRef val = BinaryenTableGrowGetValue(exp);
1933
+ CAMLreturn(alloc_BinaryenExpressionRef(val));
1934
+ }
1935
+
1936
+ CAMLprim value
1937
+ caml_binaryen_tablegrow_set_value(value _exp, value _value) {
1938
+ CAMLparam2(_exp, _value);
1939
+ BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
1940
+ BinaryenExpressionRef val = BinaryenExpressionRef_val(_value);
1941
+ BinaryenTableGrowSetValue(exp, val);
1942
+ CAMLreturn(Val_unit);
1943
+ }
1944
+
1945
+ CAMLprim value
1946
+ caml_binaryen_tablegrow_get_delta(value _exp) {
1947
+ CAMLparam1(_exp);
1948
+ BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
1949
+ BinaryenExpressionRef delta = BinaryenTableGrowGetDelta(exp);
1950
+ CAMLreturn(alloc_BinaryenExpressionRef(delta));
1951
+ }
1952
+
1953
+ CAMLprim value
1954
+ caml_binaryen_tablegrow_set_delta(value _exp, value _delta) {
1955
+ CAMLparam2(_exp, _delta);
1956
+ BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
1957
+ BinaryenExpressionRef delta = BinaryenExpressionRef_val(_delta);
1958
+ BinaryenTableGrowSetDelta(exp, delta);
1959
+ CAMLreturn(Val_unit);
1960
+ }
@@ -89,6 +89,30 @@ caml_binaryen_feature_multivalue(value unit) {
89
89
  CAMLreturn(Val_int(BinaryenFeatureMultivalue()));
90
90
  }
91
91
 
92
+ CAMLprim value
93
+ caml_binaryen_feature_gc(value unit) {
94
+ CAMLparam1(unit);
95
+ CAMLreturn(Val_int(BinaryenFeatureGC()));
96
+ }
97
+
98
+ CAMLprim value
99
+ caml_binaryen_feature_memory64(value unit) {
100
+ CAMLparam1(unit);
101
+ CAMLreturn(Val_int(BinaryenFeatureMemory64()));
102
+ }
103
+
104
+ CAMLprim value
105
+ caml_binaryen_feature_typed_function_references(value unit) {
106
+ CAMLparam1(unit);
107
+ CAMLreturn(Val_int(BinaryenFeatureTypedFunctionReferences()));
108
+ }
109
+
110
+ CAMLprim value
111
+ caml_binaryen_feature_relaxed_simd(value unit) {
112
+ CAMLparam1(unit);
113
+ CAMLreturn(Val_int(BinaryenFeatureRelaxedSIMD()));
114
+ }
115
+
92
116
  CAMLprim value
93
117
  caml_binaryen_feature_all(value unit) {
94
118
  CAMLparam1(unit);
@@ -1,7 +1,6 @@
1
1
  type t
2
2
 
3
3
  external get_name : t -> string = "caml_binaryen_element_segment_get_name"
4
-
5
4
  external get_table : t -> string = "caml_binaryen_element_segment_get_table"
6
5
 
7
6
  external get_offset : t -> Expression.t
@@ -28,9 +28,7 @@ external get_export_by_index : Module.t -> int -> t
28
28
  = "caml_binaryen_get_export_by_index"
29
29
 
30
30
  external get_name : t -> string = "caml_binaryen_export_get_name"
31
-
32
31
  external get_value : t -> string = "caml_binaryen_export_get_value"
33
-
34
32
  external external_function : unit -> int = "caml_binaryen_external_function"
35
33
 
36
34
  let external_function = external_function ()
@@ -69,7 +69,6 @@ type kind =
69
69
  | RefAs
70
70
 
71
71
  external get_id : t -> int = "caml_binaryen_expression_get_id"
72
-
73
72
  external id_invalid : unit -> int = "caml_binaryen_expression_id_invalid"
74
73
 
75
74
  let id_invalid = id_invalid ()
@@ -426,7 +425,6 @@ external print : t -> unit = "caml_binaryen_expression_print"
426
425
  (** Print an expression to the console. *)
427
426
 
428
427
  external finalize : t -> unit = "caml_binaryen_expression_finalize"
429
-
430
428
  external copy : t -> Module.t -> t = "caml_binaryen_expression_copy"
431
429
 
432
430
  (** Expression manipulation *)
@@ -440,11 +438,8 @@ module Block = struct
440
438
  make wasm_mod name exprs return_type
441
439
 
442
440
  external get_name : t -> string option = "caml_binaryen_block_get_name"
443
-
444
441
  external set_name : t -> string -> unit = "caml_binaryen_block_set_name"
445
-
446
442
  external get_num_children : t -> int = "caml_binaryen_block_get_num_children"
447
-
448
443
  external get_child_at : t -> int -> t = "caml_binaryen_block_get_child_at"
449
444
 
450
445
  external set_child_at : t -> int -> t -> unit
@@ -464,15 +459,10 @@ module If = struct
464
459
  (** Module, condition, true branch, false branch. False branch may be null. *)
465
460
 
466
461
  external get_condition : t -> t = "caml_binaryen_if_get_condition"
467
-
468
462
  external set_condition : t -> t -> unit = "caml_binaryen_if_set_condition"
469
-
470
463
  external get_if_true : t -> t = "caml_binaryen_if_get_if_true"
471
-
472
464
  external set_if_true : t -> t -> unit = "caml_binaryen_if_set_if_true"
473
-
474
465
  external get_if_false : t -> t option = "caml_binaryen_if_get_if_false"
475
-
476
466
  external set_if_false : t -> t -> unit = "caml_binaryen_if_set_if_false"
477
467
  end
478
468
 
@@ -481,11 +471,8 @@ module Loop = struct
481
471
  (** Module, loop name, body. *)
482
472
 
483
473
  external get_name : t -> string = "caml_binaryen_loop_get_name"
484
-
485
474
  external set_name : t -> string -> unit = "caml_binaryen_loop_set_name"
486
-
487
475
  external get_body : t -> t = "caml_binaryen_loop_get_body"
488
-
489
476
  external set_body : t -> t -> unit = "caml_binaryen_loop_set_body"
490
477
  end
491
478
 
@@ -494,15 +481,10 @@ module Break = struct
494
481
  (** Module, block name, condition, result. Value and condition may be null. *)
495
482
 
496
483
  external get_name : t -> string = "caml_binaryen_break_get_name"
497
-
498
484
  external set_name : t -> string -> unit = "caml_binaryen_break_set_name"
499
-
500
485
  external get_condition : t -> t option = "caml_binaryen_break_get_condition"
501
-
502
486
  external set_condition : t -> t -> unit = "caml_binaryen_break_set_condition"
503
-
504
487
  external get_value : t -> t option = "caml_binaryen_break_get_value"
505
-
506
488
  external set_value : t -> t -> unit = "caml_binaryen_break_set_value"
507
489
  end
508
490
 
@@ -512,7 +494,6 @@ module Switch = struct
512
494
  (** Module, branch names, default branch name, condition, value. Value may be null. *)
513
495
 
514
496
  external get_num_names : t -> int = "caml_binaryen_switch_get_num_names"
515
-
516
497
  external get_name_at : t -> int -> string = "caml_binaryen_switch_get_name_at"
517
498
 
518
499
  external set_name_at : t -> int -> string -> unit
@@ -533,11 +514,8 @@ module Switch = struct
533
514
  = "caml_binaryen_switch_set_default_name"
534
515
 
535
516
  external get_condition : t -> t = "caml_binaryen_switch_get_condition"
536
-
537
517
  external set_condition : t -> t -> unit = "caml_binaryen_switch_set_condition"
538
-
539
518
  external get_value : t -> t option = "caml_binaryen_switch_get_value"
540
-
541
519
  external set_value : t -> t -> unit = "caml_binaryen_switch_set_value"
542
520
  end
543
521
 
@@ -551,11 +529,8 @@ module Call = struct
551
529
  (** Module, function name, params, return type. *)
552
530
 
553
531
  external get_target : t -> string = "caml_binaryen_call_get_target"
554
-
555
532
  external set_target : t -> string -> unit = "caml_binaryen_call_set_target"
556
-
557
533
  external get_num_operands : t -> int = "caml_binaryen_call_get_num_operands"
558
-
559
534
  external get_operand_at : t -> int -> t = "caml_binaryen_call_get_operand_at"
560
535
 
561
536
  external set_operand_at : t -> int -> t -> unit
@@ -570,7 +545,6 @@ module Call = struct
570
545
  = "caml_binaryen_call_remove_operand_at"
571
546
 
572
547
  external is_return : t -> bool = "caml_binaryen_call_is_return"
573
-
574
548
  external set_return : t -> bool -> unit = "caml_binaryen_call_set_return"
575
549
  end
576
550
 
@@ -628,7 +602,6 @@ module Local_set = struct
628
602
  (** Module, slot, value. *)
629
603
 
630
604
  external get_value : t -> t = "caml_binaryen_local_set_get_value"
631
-
632
605
  external set_value : t -> t -> unit = "caml_binaryen_local_set_set_value"
633
606
  end
634
607
 
@@ -643,7 +616,6 @@ module Global_get = struct
643
616
  (** Module, name, type. *)
644
617
 
645
618
  external get_name : t -> string = "caml_binaryen_global_get_get_name"
646
-
647
619
  external set_name : t -> string -> unit = "caml_binaryen_global_get_set_name"
648
620
  end
649
621
 
@@ -652,11 +624,8 @@ module Global_set = struct
652
624
  (** Module, name, value. *)
653
625
 
654
626
  external get_name : t -> string = "caml_binaryen_global_set_get_name"
655
-
656
627
  external set_name : t -> string -> unit = "caml_binaryen_global_set_set_name"
657
-
658
628
  external get_value : t -> t = "caml_binaryen_global_set_get_value"
659
-
660
629
  external set_value : t -> t -> unit = "caml_binaryen_global_set_set_value"
661
630
  end
662
631
 
@@ -669,7 +638,6 @@ module Load = struct
669
638
  make wasm_mod bytes signed offset align ty ptr
670
639
 
671
640
  external get_ptr : t -> t = "caml_binaryen_load_get_ptr"
672
-
673
641
  external set_ptr : t -> t -> unit = "caml_binaryen_load_set_ptr"
674
642
  end
675
643
 
@@ -679,11 +647,8 @@ module Store = struct
679
647
  (** Module, num_bytes, offset, align, ptr, value, type. *)
680
648
 
681
649
  external get_ptr : t -> t = "caml_binaryen_store_get_ptr"
682
-
683
650
  external set_ptr : t -> t -> unit = "caml_binaryen_store_set_ptr"
684
-
685
651
  external get_value : t -> t = "caml_binaryen_store_get_value"
686
-
687
652
  external set_value : t -> t -> unit = "caml_binaryen_store_set_value"
688
653
  end
689
654
 
@@ -693,21 +658,15 @@ end
693
658
 
694
659
  module Unary = struct
695
660
  external make : Module.t -> Op.t -> t -> t = "caml_binaryen_unary"
696
-
697
661
  external get_value : t -> t = "caml_binaryen_unary_get_value"
698
-
699
662
  external set_value : t -> t -> unit = "caml_binaryen_unary_set_value"
700
663
  end
701
664
 
702
665
  module Binary = struct
703
666
  external make : Module.t -> Op.t -> t -> t -> t = "caml_binaryen_binary"
704
-
705
667
  external get_left : t -> t = "caml_binaryen_binary_get_left"
706
-
707
668
  external set_left : t -> t -> unit = "caml_binaryen_binary_set_left"
708
-
709
669
  external get_right : t -> t = "caml_binaryen_binary_get_right"
710
-
711
670
  external set_right : t -> t -> unit = "caml_binaryen_binary_set_right"
712
671
  end
713
672
 
@@ -719,31 +678,22 @@ module Select = struct
719
678
  let make wasm_mod cond tru fals = make wasm_mod cond tru fals Type.auto
720
679
 
721
680
  external get_if_true : t -> t = "caml_binaryen_select_get_if_true"
722
-
723
681
  external set_if_true : t -> t -> unit = "caml_binaryen_select_set_if_true"
724
-
725
682
  external get_if_false : t -> t = "caml_binaryen_select_get_if_false"
726
-
727
683
  external set_if_false : t -> t -> unit = "caml_binaryen_select_set_if_false"
728
-
729
684
  external get_condition : t -> t = "caml_binaryen_select_get_condition"
730
-
731
685
  external set_condition : t -> t -> unit = "caml_binaryen_select_set_condition"
732
686
  end
733
687
 
734
688
  module Drop = struct
735
689
  external make : Module.t -> t -> t = "caml_binaryen_drop"
736
-
737
690
  external get_value : t -> t = "caml_binaryen_drop_get_value"
738
-
739
691
  external set_value : t -> t -> unit = "caml_binaryen_drop_set_value"
740
692
  end
741
693
 
742
694
  module Return = struct
743
695
  external make : Module.t -> t -> t = "caml_binaryen_return"
744
-
745
696
  external get_value : t -> t = "caml_binaryen_return_get_value"
746
-
747
697
  external set_value : t -> t -> unit = "caml_binaryen_return_set_value"
748
698
  end
749
699
 
@@ -753,9 +703,7 @@ end
753
703
 
754
704
  module Memory_grow = struct
755
705
  external make : Module.t -> t -> t = "caml_binaryen_memory_grow"
756
-
757
706
  external get_delta : t -> t = "caml_binaryen_memory_grow_get_delta"
758
-
759
707
  external set_delta : t -> t -> unit = "caml_binaryen_memory_grow_set_delta"
760
708
  end
761
709
 
@@ -764,15 +712,10 @@ module Memory_copy = struct
764
712
  (** Module, destination, source, size. *)
765
713
 
766
714
  external get_dest : t -> t = "caml_binaryen_memory_copy_get_dest"
767
-
768
715
  external set_dest : t -> t -> unit = "caml_binaryen_memory_copy_set_dest"
769
-
770
716
  external get_source : t -> t = "caml_binaryen_memory_copy_get_source"
771
-
772
717
  external set_source : t -> t -> unit = "caml_binaryen_memory_copy_set_source"
773
-
774
718
  external get_size : t -> t = "caml_binaryen_memory_copy_get_size"
775
-
776
719
  external set_size : t -> t -> unit = "caml_binaryen_memory_copy_set_size"
777
720
  end
778
721
 
@@ -781,15 +724,10 @@ module Memory_fill = struct
781
724
  (** Module, destination, value, size. *)
782
725
 
783
726
  external get_dest : t -> t = "caml_binaryen_memory_fill_get_dest"
784
-
785
727
  external set_dest : t -> t -> unit = "caml_binaryen_memory_fill_set_dest"
786
-
787
728
  external get_value : t -> t = "caml_binaryen_memory_fill_get_value"
788
-
789
729
  external set_value : t -> t -> unit = "caml_binaryen_memory_fill_set_value"
790
-
791
730
  external get_size : t -> t = "caml_binaryen_memory_fill_get_size"
792
-
793
731
  external set_size : t -> t -> unit = "caml_binaryen_memory_fill_set_size"
794
732
  end
795
733
 
@@ -821,7 +759,6 @@ module Tuple_extract = struct
821
759
  (** Module, tuple, index *)
822
760
 
823
761
  external get_tuple : t -> t = "caml_binaryen_tuple_extract_get_tuple"
824
-
825
762
  external set_tuple : t -> t -> unit = "caml_binaryen_tuple_extract_set_tuple"
826
763
  end
827
764
 
@@ -842,3 +779,97 @@ module Null = struct
842
779
  external make : unit -> t = "caml_binaryen_null_expression"
843
780
  (** A null reference. *)
844
781
  end
782
+
783
+ module Ref = struct
784
+ external null : Module.t -> Type.t -> t = "caml_binaryen_ref_null"
785
+ (** Module, type *)
786
+
787
+ external is : Module.t -> Op.t -> t -> t = "caml_binaryen_ref_is"
788
+ (** Module, op, value *)
789
+
790
+ external as_ : Module.t -> Op.t -> t -> t = "caml_binaryen_ref_as"
791
+ (** Module, op, value *)
792
+
793
+ external func : Module.t -> string -> Type.t -> t = "caml_binaryen_ref_func"
794
+ (** Module, func, type *)
795
+
796
+ external eq : Module.t -> t -> t -> t = "caml_binaryen_ref_eq"
797
+ (** Module, left, right *)
798
+ end
799
+
800
+ module Table = struct
801
+ external get : Module.t -> string -> t -> Type.t -> t
802
+ = "caml_binaryen_table_get"
803
+ (** Module, name, index, type *)
804
+
805
+ external set : Module.t -> string -> t -> t -> t = "caml_binaryen_table_set"
806
+ (** Module, name, index, value *)
807
+
808
+ external size : Module.t -> string -> t = "caml_binaryen_table_size"
809
+ (** Module, name *)
810
+
811
+ external grow : Module.t -> string -> t -> t -> t = "caml_binaryen_table_grow"
812
+ (** Module, name, value, delta *)
813
+ end
814
+
815
+ module Table_get = struct
816
+ external get_table : t -> string = "caml_binaryen_tableget_get_table"
817
+ (** Gets the name of the table being accessed by a `Table.get` expression. *)
818
+
819
+ external set_table : t -> string -> unit = "caml_binaryen_tableget_set_table"
820
+ (** Gets the name of the table being accessed by a `Table.get` expression. *)
821
+
822
+ external get_index : t -> t = "caml_binaryen_tableget_get_index"
823
+ (** Gets the index expression of a `Table.get` expression. *)
824
+
825
+ external set_index : t -> t -> unit = "caml_binaryen_tableget_set_index"
826
+ (** Gets the index expression of a `Table.get` expression. *)
827
+ end
828
+
829
+ module Table_set = struct
830
+ external get_table : t -> string = "caml_binaryen_tableset_get_table"
831
+ (** Gets the name of the table being accessed by a `Table.set` expression. *)
832
+
833
+ external set_table : t -> string -> unit = "caml_binaryen_tableset_set_table"
834
+ (** Sets the name of the table being accessed by a `Table.set` expression. *)
835
+
836
+ external get_index : t -> t = "caml_binaryen_tableset_get_index"
837
+ (** Gets the index expression of a `Table.set` expression. *)
838
+
839
+ external set_index : t -> t -> unit = "caml_binaryen_tableset_set_index"
840
+ (** Sets the index expression of a `Table.set` expression. *)
841
+
842
+ external get_value : t -> t = "caml_binaryen_tableset_get_value"
843
+ (** Gets the value expression of a `Table.set` expression. *)
844
+
845
+ external set_value : t -> t -> unit = "caml_binaryen_tableset_set_value"
846
+ (** Sets the value expression of a `Table.set` expression. *)
847
+ end
848
+
849
+ module Table_size = struct
850
+ external get_table : t -> string = "caml_binaryen_tablesize_get_table"
851
+ (** Gets the name of the table being accessed by a `Table.size` expression. *)
852
+
853
+ external set_table : t -> string -> unit = "caml_binaryen_tablesize_set_table"
854
+ (** Sets the name of the table being accessed by a `Table.size` expression. *)
855
+ end
856
+
857
+ module Table_grow = struct
858
+ external get_table : t -> string = "caml_binaryen_tablegrow_get_table"
859
+ (** Gets the name of the table being accessed by a `Table.grow` expression. *)
860
+
861
+ external set_table : t -> string -> unit = "caml_binaryen_tablegrow_set_table"
862
+ (** Gets the name of the table being accessed by a `Table.grow` expression. *)
863
+
864
+ external get_value : t -> t = "caml_binaryen_tablegrow_get_value"
865
+ (** Gets the value expression of a `Table.grow` expression. *)
866
+
867
+ external set_value : t -> t -> unit = "caml_binaryen_tablegrow_set_value"
868
+ (** Sets the value expression of a `Table.grow` expression. *)
869
+
870
+ external get_delta : t -> t = "caml_binaryen_tablegrow_get_delta"
871
+ (** Gets the delta of a `Table.grow` expression. *)
872
+
873
+ external set_delta : t -> t -> unit = "caml_binaryen_tablegrow_set_delta"
874
+ (** Sets the delta of a `Table.grow` expression. *)
875
+ end
@@ -19,17 +19,11 @@ external remove_function : Module.t -> string -> unit
19
19
  = "caml_binaryen_remove_function"
20
20
 
21
21
  external get_num_functions : Module.t -> int = "caml_binaryen_get_num_functions"
22
-
23
22
  external get_name : t -> string = "caml_binaryen_function_get_name"
24
-
25
23
  external get_params : t -> Type.t = "caml_binaryen_function_get_params"
26
-
27
24
  external get_results : t -> Type.t = "caml_binaryen_function_get_results"
28
-
29
25
  external get_num_vars : t -> int = "caml_binaryen_function_get_num_vars"
30
-
31
26
  external get_var : t -> int -> Type.t = "caml_binaryen_function_get_var"
32
-
33
27
  external get_body : t -> Expression.t = "caml_binaryen_function_get_body"
34
28
 
35
29
  external set_body : t -> Expression.t -> unit
@@ -15,9 +15,7 @@ external get_global_by_index : Module.t -> int -> t
15
15
  = "caml_binaryen_get_global_by_index"
16
16
 
17
17
  external get_name : t -> string = "caml_binaryen_global_get_name"
18
-
19
18
  external get_type : t -> Type.t = "caml_binaryen_global_get_type"
20
-
21
19
  external is_mutable : t -> bool = "caml_binaryen_global_is_mutable"
22
20
 
23
21
  external get_init_expr : t -> Expression.t