@grain/binaryen.ml 0.11.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 (67) hide show
  1. binaryen-archive/CHANGELOG.md +53 -0
  2. binaryen-archive/README.md +25 -1
  3. binaryen-archive/binaryen.opam +5 -5
  4. binaryen-archive/esy.lock/index.json +325 -310
  5. binaryen-archive/esy.lock/opam/base-bytes.base/opam +9 -0
  6. binaryen-archive/esy.lock/opam/{base.v0.14.2 → base.v0.14.3}/opam +2 -2
  7. binaryen-archive/esy.lock/opam/{dune-build-info.2.9.1 → dune-build-info.2.9.3}/opam +5 -4
  8. binaryen-archive/esy.lock/opam/{dune-configurator.2.9.1 → dune-configurator.2.9.3}/opam +5 -4
  9. binaryen-archive/esy.lock/opam/{dune.2.9.1 → dune.2.9.3}/opam +5 -4
  10. binaryen-archive/esy.lock/opam/either.1.0.0/opam +40 -0
  11. binaryen-archive/esy.lock/opam/{fix.20211231 → fix.20220121}/opam +3 -3
  12. binaryen-archive/esy.lock/opam/menhir.20211128/opam +1 -1
  13. binaryen-archive/esy.lock/opam/{ocaml-lsp-server.1.9.0 → ocaml-lsp-server.1.9.1}/opam +5 -5
  14. binaryen-archive/esy.lock/opam/{ocamlfind.1.9.1 → ocamlfind.1.9.3}/opam +3 -3
  15. binaryen-archive/esy.lock/opam/{ocamlformat.0.18.0 → ocamlformat.0.20.1}/opam +14 -15
  16. binaryen-archive/esy.lock/opam/ocp-indent.1.7.0/opam +57 -0
  17. binaryen-archive/esy.lock/opam/odoc-parser.1.0.0/opam +46 -0
  18. binaryen-archive/esy.lock/opam/{ppxlib.0.22.2 → ppxlib.0.24.0}/opam +9 -6
  19. binaryen-archive/esy.lock/opam/{topkg.1.0.4 → topkg.1.0.5}/opam +3 -3
  20. binaryen-archive/esy.lock/overrides/{opam__s__ocamlfind_opam__c__1.9.1_opam_override/files/findlib-1.9.1.patch → opam__s__ocamlfind_opam__c__1.9.3_opam_override/files/findlib.patch} +0 -0
  21. binaryen-archive/esy.lock/overrides/{opam__s__ocamlfind_opam__c__1.9.1_opam_override → opam__s__ocamlfind_opam__c__1.9.3_opam_override}/package.json +1 -1
  22. binaryen-archive/js/binaryen.es5.js +363 -5
  23. binaryen-archive/js/dune +1 -1
  24. binaryen-archive/js/export.ml +1 -4
  25. binaryen-archive/js/expression.ml +161 -0
  26. binaryen-archive/js/literal.ml +0 -1
  27. binaryen-archive/js/module.ml +9 -9
  28. binaryen-archive/js/op.ml +0 -223
  29. binaryen-archive/js/prelude.js +2 -0
  30. binaryen-archive/js/table.ml +2 -2
  31. binaryen-archive/js/type.ml +0 -9
  32. binaryen-archive/package.json +11 -8
  33. binaryen-archive/src/binaryen_stubs_exports.c +2 -2
  34. binaryen-archive/src/binaryen_stubs_expressions.c +250 -0
  35. binaryen-archive/src/binaryen_stubs_features.c +24 -0
  36. binaryen-archive/src/binaryen_stubs_modules.c +7 -0
  37. binaryen-archive/src/binaryen_stubs_tables.c +4 -3
  38. binaryen-archive/src/dune +1 -2
  39. binaryen-archive/src/element_segment.ml +0 -1
  40. binaryen-archive/src/export.ml +2 -4
  41. binaryen-archive/src/expression.ml +94 -63
  42. binaryen-archive/src/function.ml +0 -6
  43. binaryen-archive/src/global.ml +0 -2
  44. binaryen-archive/src/literal.ml +0 -3
  45. binaryen-archive/src/module.ml +19 -9
  46. binaryen-archive/src/settings.ml +0 -6
  47. binaryen-archive/src/table.ml +2 -2
  48. binaryen-archive/src/type.ml +0 -1
  49. binaryen-archive/test/config/ocamlopt_flags.ml +8 -1
  50. binaryen-archive/test/test.expected +13 -5
  51. binaryen-archive/test/test.ml +47 -22
  52. binaryen-archive/virtual/element_segment.mli +0 -4
  53. binaryen-archive/virtual/export.mli +1 -16
  54. binaryen-archive/virtual/expression.mli +93 -115
  55. binaryen-archive/virtual/function.mli +0 -12
  56. binaryen-archive/virtual/global.mli +0 -8
  57. binaryen-archive/virtual/import.mli +0 -4
  58. binaryen-archive/virtual/literal.mli +0 -5
  59. binaryen-archive/virtual/module.mli +5 -28
  60. binaryen-archive/virtual/op.mli +0 -315
  61. binaryen-archive/virtual/settings.mli +0 -17
  62. binaryen-archive/virtual/table.mli +1 -4
  63. binaryen-archive/virtual/type.mli +0 -11
  64. binaryen-archive/esy.lock/opam/ocaml-migrate-parsetree.2.3.0/opam +0 -39
  65. binaryen-archive/esy.lock/opam/odoc.1.5.3/opam +0 -53
  66. binaryen-archive/esy.lock/opam/tyxml.4.5.0/opam +0 -42
  67. binaryen-archive/js/postlude.js +0 -2
@@ -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
@@ -1,11 +1,8 @@
1
1
  type t
2
2
 
3
3
  external int32 : int32 -> t = "caml_binaryen_literal_int32"
4
-
5
4
  external int64 : int64 -> t = "caml_binaryen_literal_int64"
6
-
7
5
  external float32_bits : int32 -> t = "caml_binaryen_literal_float32_bits"
8
-
9
6
  external float64_bits : int64 -> t = "caml_binaryen_literal_float64_bits"
10
7
 
11
8
  let float32 n = float32_bits @@ Int32.bits_of_float n
@@ -1,5 +1,4 @@
1
1
  let _ = Callback.register "array_of_list" Array.of_list
2
-
3
2
  let _ = Callback.register "array_length" Array.length
4
3
 
5
4
  type t
@@ -53,28 +52,39 @@ module Feature = struct
53
52
 
54
53
  let multivalue = multivalue ()
55
54
 
55
+ external gc : unit -> t = "caml_binaryen_feature_gc"
56
+
57
+ let gc = gc ()
58
+
59
+ external memory64 : unit -> t = "caml_binaryen_feature_memory64"
60
+
61
+ let memory64 = memory64 ()
62
+
63
+ external typed_function_references : unit -> t
64
+ = "caml_binaryen_feature_typed_function_references"
65
+
66
+ let typed_function_references = typed_function_references ()
67
+
68
+ external relaxed_simd : unit -> t = "caml_binaryen_feature_relaxed_simd"
69
+
70
+ let relaxed_simd = relaxed_simd ()
71
+
56
72
  external all : unit -> t = "caml_binaryen_feature_all"
57
73
 
58
74
  let all = all ()
59
75
  end
60
76
 
61
77
  external create : unit -> t = "caml_binaryen_module_create"
62
-
63
78
  external dispose : t -> unit = "caml_binaryen_module_dispose"
64
79
 
65
80
  external add_custom_section : t -> string -> string -> unit
66
81
  = "caml_binaryen_add_custom_section"
67
82
 
68
83
  external parse : string -> t = "caml_binaryen_module_parse"
69
-
70
84
  external print : t -> unit = "caml_binaryen_module_print"
71
-
72
85
  external print_asmjs : t -> unit = "caml_binaryen_module_print_asmjs"
73
-
74
86
  external validate : t -> int = "caml_binaryen_module_validate"
75
-
76
87
  external optimize : t -> unit = "caml_binaryen_module_optimize"
77
-
78
88
  external get_features : t -> int = "caml_binaryen_module_get_features"
79
89
 
80
90
  let get_features wasm_mod =
@@ -103,9 +113,7 @@ external write : t -> string option -> bytes * string option
103
113
  = "caml_binaryen_module_write"
104
114
 
105
115
  external write_text : t -> string = "caml_binaryen_module_write_text"
106
-
107
116
  external read : bytes -> t = "caml_binaryen_module_read"
108
-
109
117
  external interpret : t -> unit = "caml_binaryen_module_interpret"
110
118
 
111
119
  external add_debug_info_filename : t -> string -> int
@@ -113,3 +121,5 @@ external add_debug_info_filename : t -> string -> int
113
121
 
114
122
  external get_debug_info_filename : t -> int -> string
115
123
  = "caml_binaryen_module_get_debug_info_filename"
124
+
125
+ external update_maps : t -> unit = "caml_binaryen_module_update_maps"
@@ -1,13 +1,8 @@
1
1
  external get_optimize_level : unit -> int = "caml_binaryen_get_optimize_level"
2
-
3
2
  external set_optimize_level : int -> unit = "caml_binaryen_set_optimize_level"
4
-
5
3
  external get_shrink_level : unit -> int = "caml_binaryen_get_shrink_level"
6
-
7
4
  external set_shrink_level : int -> unit = "caml_binaryen_set_shrink_level"
8
-
9
5
  external get_debug_info : unit -> bool = "caml_binaryen_get_debug_info"
10
-
11
6
  external set_debug_info : bool -> unit = "caml_binaryen_set_debug_info"
12
7
 
13
8
  external get_low_memory_unused : unit -> bool
@@ -41,5 +36,4 @@ external set_one_caller_inline_max_size : int -> unit
41
36
  = "caml_binaryen_set_one_caller_inline_max_size"
42
37
 
43
38
  external set_colors_enabled : bool -> unit = "caml_binaryen_set_colors_enabled"
44
-
45
39
  external are_colors_enabled : unit -> bool = "caml_binaryen_are_colors_enabled"
@@ -1,8 +1,8 @@
1
1
  type t
2
2
 
3
- external add_table : Module.t -> string -> int -> int -> t
3
+ external add_table : Module.t -> string -> int -> int -> Type.t -> t
4
4
  = "caml_binaryen_add_table"
5
- (** Module, name, initial size, maximum size. *)
5
+ (** Module, name, initial size, maximum size, table type *)
6
6
 
7
7
  external add_active_element_segment :
8
8
  Module.t ->
@@ -41,5 +41,4 @@ external auto : unit -> t = "caml_binaryen_type_auto"
41
41
  let auto = auto ()
42
42
 
43
43
  external create : t array -> t = "caml_binaryen_type_create"
44
-
45
44
  external expand : t -> t array = "caml_binaryen_type_expand"
@@ -8,7 +8,14 @@ let () =
8
8
  match C.ocaml_config_var c "system" with
9
9
  | Some "macosx" ->
10
10
  (* These flags preserve the original C++ error behavior. Ref https://github.com/ocaml/ocaml/issues/10423 *)
11
- [ "-cc"; "clang++" ]
11
+ [
12
+ "-cc";
13
+ "clang++";
14
+ "-cclib";
15
+ "-Wl,-keep_dwarf_unwind";
16
+ "-cclib";
17
+ "-Wl,-no_compact_unwind";
18
+ ]
12
19
  | Some _ -> default
13
20
  | None -> default
14
21
  in
@@ -1,8 +1,16 @@
1
+ (table.get $table
2
+ (i32.const 0)
3
+ )
4
+ (table.size $table)
5
+ (table.grow $table
6
+ (ref.null func)
7
+ (i32.const 0)
8
+ )
1
9
  (module
2
10
  (type $i32_i32_=>_i32 (func (param i32 i32) (result i32)))
3
11
  (type $none_=>_none (func))
4
- (type $externref_=>_i32 (func (param externref) (result i32)))
5
12
  (type $externref_i32_i32_=>_i32 (func (param externref i32 i32) (result i32)))
13
+ (type $externref_=>_i32 (func (param externref) (result i32)))
6
14
  (import "future-wasi" "write" (func $write (param externref i32 i32) (result i32)))
7
15
  (global $max_int64 i64 (i64.const 9223372036854775807))
8
16
  (global $test_float64_bits f64 (f64.const 1.23))
@@ -49,10 +57,10 @@
49
57
  )
50
58
  )
51
59
  (module
52
- (type $none_=>_none (func))
53
- (type $externref_=>_i32 (func (param externref) (result i32)))
54
60
  (type $i32_i32_=>_i32 (func (param i32 i32) (result i32)))
61
+ (type $none_=>_none (func))
55
62
  (type $externref_i32_i32_=>_i32 (func (param externref i32 i32) (result i32)))
63
+ (type $externref_=>_i32 (func (param externref) (result i32)))
56
64
  (import "future-wasi" "write" (func $write (param externref i32 i32) (result i32)))
57
65
  (memory $0 1)
58
66
  (table $table 1 1 funcref)
@@ -90,10 +98,10 @@
90
98
  )
91
99
  )
92
100
  (module
101
+ (type $externref_i32_i32_=>_i32 (func (param externref i32 i32) (result i32)))
102
+ (type $i32_i32_=>_i32 (func (param i32 i32) (result i32)))
93
103
  (type $none_=>_none (func))
94
104
  (type $externref_=>_i32 (func (param externref) (result i32)))
95
- (type $i32_i32_=>_i32 (func (param i32 i32) (result i32)))
96
- (type $externref_i32_i32_=>_i32 (func (param externref i32 i32) (result i32)))
97
105
  (import "future-wasi" "write" (func $fimport$0 (param externref i32 i32) (result i32)))
98
106
  (memory $0 1)
99
107
  (table $0 1 1 funcref)