Skip to content

Commit 53a99e1

Browse files
committed
Flag to generate the new exception handling instructions
1 parent 22e5dce commit 53a99e1

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

compiler/bin-wasm_of_ocaml/compile.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ let preprocessor_variables () =
8484
| `Disabled | `Jspi -> "jspi"
8585
| `Cps -> "cps"
8686
| `Double_translation -> assert false) )
87+
; "exnref", Wat_preprocess.Bool (Config.Flag.exnref ())
8788
]
8889

8990
let with_runtime_files ~runtime_wasm_files f =

compiler/bin-wasm_of_ocaml/gen/gen.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ let check_js_file fname =
7575
(* Keep the two variables below in sync with function build_runtime in
7676
../compile.ml *)
7777

78-
let default_flags = []
78+
let default_flags = [ "exnref", `B false ]
7979

8080
let interesting_runtimes = [ [ "effects", `S "jspi" ]; [ "effects", `S "cps" ] ]
8181

compiler/lib-wasm/binaryen.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ let optimize
135135
~output_file
136136
() =
137137
command
138-
("wasm-opt"
139-
:: (common_options ()
140-
@ (match options with
141-
| Some o -> o
142-
| None -> optimization_options profile)
143-
@ [ Filename.quote input_file; "-o"; Filename.quote output_file ])
138+
(("wasm-opt" :: (if Config.Flag.exnref () then [ "--emit-exnref" ] else []))
139+
@ common_options ()
140+
@ (match options with
141+
| Some o -> o
142+
| None -> optimization_options profile)
143+
@ [ Filename.quote input_file; "-o"; Filename.quote output_file ]
144144
@ opt_flag "--input-source-map" opt_input_sourcemap
145145
@ opt_flag "--output-source-map" opt_output_sourcemap)

compiler/lib/config.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ module Flag = struct
106106
let es6 = o ~name:"es6" ~default:false
107107

108108
let load_shapes_auto = o ~name:"load-shapes-auto" ~default:false
109+
110+
let exnref = o ~name:"exnref" ~default:false
109111
end
110112

111113
module Param = struct

compiler/lib/config.mli

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ module Flag : sig
7676

7777
val load_shapes_auto : unit -> bool
7878

79+
val exnref : unit -> bool
80+
7981
val enable : string -> unit
8082

8183
val disable : string -> unit

0 commit comments

Comments
 (0)