diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4a5527ca29..7971777b4b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,7 +18,7 @@ jobs: uses: ocaml/setup-ocaml@v2 with: ocaml-compiler: 4.12.x - - run: opam install --yes ocamlbuild.0.14.0 + - run: opam install --yes dune - run: cd interpreter && opam exec make all build-js-api-spec: @@ -51,7 +51,7 @@ jobs: submodules: "recursive" - run: pip install bikeshed && bikeshed update - run: pip install six - - run: sudo apt-get update -y && sudo apt-get install -y latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended + - run: sudo apt update -y && sudo apt install -y latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended - run: pip install sphinx==4.0.0 - run: cd document/core && make all - uses: actions/upload-artifact@v2 diff --git a/interpreter/Makefile b/interpreter/Makefile index 4ff333d177..f0952ad3b1 100644 --- a/interpreter/Makefile +++ b/interpreter/Makefile @@ -2,197 +2,84 @@ # package manager to build. However, Opam package management is available # optionally through the check/install/uninstall targets. # -# The $(JSLIB) target requires node.js and BuckleScript. +# The wast.js target requires node.js and BuckleScript. # # See README.me for instructions. # Configuration -NAME = wasm -UNOPT = $(NAME).debug -OPT = $(NAME) -LIB = $(NAME) -ZIP = $(NAME).zip -JSLIB = wast.js -WINMAKE = winmake.bat - -DIRS = util syntax binary text valid runtime exec script host main tests -LIBS = bigarray -FLAGS = -lexflags -ml -cflags '-w +a-4-27-42-44-45 -warn-error +a-3' -OCBA = ocamlbuild $(FLAGS) $(DIRS:%=-I %) -OCB = $(OCBA) $(LIBS:%=-libs %) -JS = # set to JS shell command to run JS tests - +BUILDDIR = _build/default +UNOPT = $(BUILDDIR)/main/main.bc +OPT = $(BUILDDIR)/main/main.exe +JS = # set to JS shell command to run JS tests +TESTDIR = ../test/core +# Skip _output directory, since that's a tmp directory, and list all other wast files. +TESTFILES = $(shell cd $(TESTDIR); ls *.wast; ls [a-z]*/*.wast) # Main targets -.PHONY: default opt unopt libopt libunopt jslib all land zip smallint - -default: opt -debug: unopt -opt: $(OPT) -unopt: $(UNOPT) -libopt: _build/$(LIB).cmx _build/$(LIB).cmxa -libunopt: _build/$(LIB).cmo _build/$(LIB).cma -jslib: $(JSLIB) -all: unopt opt libunopt libopt test -land: $(WINMAKE) all -zip: $(ZIP) -smallint: smallint.native - - -# Building executable - -empty = -space = $(empty) $(empty) -comma = , - -.INTERMEDIATE: _tags -_tags: - echo >$@ "true: bin_annot" - echo >>$@ "true: debug" - echo >>$@ "<{$(subst $(space),$(comma),$(DIRS))}/*.cmx>: for-pack($(PACK))" - -$(UNOPT): main.byte - mv $< $@ - -$(OPT): main.native - mv $< $@ - -.PHONY: main.byte main.native -main.byte: _tags - $(OCB) -quiet $@ - -main.native: _tags - $(OCB) -quiet $@ - -.PHONY: smallint.byte smallint.native -smallint.byte: _tags - $(OCB) -quiet $@ -smallint.native: _tags - $(OCB) -quiet $@ - - -# Building library - -FILES = $(shell ls $(DIRS:%=%/*) | grep '[.]ml[^.]*$$') -PACK = $(shell echo `echo $(LIB) | sed 's/^\(.\).*$$/\\1/g' | tr [:lower:] [:upper:]``echo $(LIB) | sed 's/^.\(.*\)$$/\\1/g'`) +.PHONY: default jslib all land zip -.INTERMEDIATE: $(LIB).mlpack -$(LIB).mlpack: $(DIRS) - ls $(FILES) \ - | sed 's:\(.*/\)\{0,1\}\(.*\)\.[^\.]*:\2:' \ - | grep -v main \ - | sort | uniq \ - >$@ - -.INTERMEDIATE: $(LIB).mllib -$(LIB).mllib: - echo Wasm >$@ - -_build/$(LIB).cmo: $(FILES) $(LIB).mlpack _tags Makefile - $(OCB) -quiet $(LIB).cmo - -_build/$(LIB).cmx: $(FILES) $(LIB).mlpack _tags Makefile - $(OCB) -quiet $(LIB).cmx - -_build/$(LIB).cma: $(FILES) $(LIB).mllib _tags Makefile - $(OCBA) -quiet $(LIB).cma - -_build/$(LIB).cmxa: $(FILES) $(LIB).mllib _tags Makefile - $(OCBA) -quiet $(LIB).cmxa - - -# Building JavaScript library - -.PHONY: $(JSLIB) -$(JSLIB): $(UNOPT) - mkdir -p _build/jslib/src - cp meta/jslib/* _build/jslib - cp $(DIRS:%=_build/%/*.ml*) meta/jslib/*.ml _build/jslib/src - rm _build/jslib/src/*.ml[^i] - (cd _build/jslib; ./build.sh ../../$@) - - -# Building Windows build file - -$(WINMAKE): clean - echo rem Auto-generated from Makefile! >$@ - echo set NAME=$(NAME) >>$@ - echo if \'%1\' neq \'\' set NAME=%1 >>$@ - $(OCB) main.byte \ - | grep -v ocamldep \ - | grep -v mkdir \ - | sed s:`which ocaml`:ocaml:g \ - | sed s:main/main.d.byte:%NAME%.exe: \ - >>$@ +default: $(OPT) +debug: $(UNOPT) +jslib: $(BUILDDIR)/jslib/wasm.bc.js +all: $(UNOPT) $(OPT) test +land: all +zip: wasm.zip +$(BUILDDIR)/%: + dune build $* # Executing test suite -TESTDIR = ../test/core -# Skip _output directory, since that's a tmp directory, and list all other wast files. -TESTFILES = $(shell cd $(TESTDIR); ls *.wast; ls [a-z]*/*.wast) -TESTS = $(TESTFILES:%.wast=%) +.PHONY: test debugtest partest winmake.bat -.PHONY: test debugtest partest +winmake.bat: + dune clean + dune build main/main.bc + cat _build/log | grep -v "^#" | grep -v "ocamldep\.opt" | sed s:`which ocaml`:ocaml:g | sed s:_build/default:_build/:g | sed s:"cd _build/ &&"::g | sed s:".wasm.objs/"::g | sed s:"byte/"::g | sed s:"-I byte"::g | sed s:"^...."::g | sed s:")"::g | sed s:" ":" ":g -test: $(OPT) smallint - $(TESTDIR)/run.py --wasm `pwd`/$(OPT) $(if $(JS),--js '$(JS)',) - ./smallint.native -debugtest: $(UNOPT) smallint - $(TESTDIR)/run.py --wasm `pwd`/$(UNOPT) $(if $(JS),--js '$(JS)',) - ./smallint.native +test/%: $(OPT) + $(TESTDIR)/run.py --wasm `pwd`/$< $(if $(JS),--js '$(JS)',) $(TESTDIR)/$*.wast +debugtest/%: $(UNOPT) + $(TESTDIR)/run.py --wasm `pwd`/$< $(if $(JS),--js '$(JS)',) $(TESTDIR)/$*.wast -test/%: $(OPT) - $(TESTDIR)/run.py --wasm `pwd`/$(OPT) $(if $(JS),--js '$(JS)',) $(TESTDIR)/$*.wast -debugtest/%: $(UNOPT) - $(TESTDIR)/run.py --wasm `pwd`/$(UNOPT) $(if $(JS),--js '$(JS)',) $(TESTDIR)/$*.wast +test: $(OPT) smallinttest + $(TESTDIR)/run.py --wasm `pwd`/$< $(if $(JS),--js '$(JS)',) +debugtest: $(UNOPT) smallinttest + $(TESTDIR)/run.py --wasm `pwd`/$< $(if $(JS),--js '$(JS)',) -run/%: $(OPT) - ./$(OPT) $(TESTDIR)/$*.wast -debug/%: $(UNOPT) - ./$(UNOPT) $(TESTDIR)/$*.wast +run/%: + dune exec -- main/main.exe $(TESTDIR)/$*.wast +debug/%: + dune exec -- main/main.bc $(TESTDIR)/$*.wast -partest: $(TESTS:%=quiettest/%) +partest: $(TESTFILES:%.wast=quiettest/%) @echo All tests passed. -quiettest/%: $(OPT) +quiettest/%: $(OPT) @ ( \ - $(TESTDIR)/run.py 2>$(@F).out --wasm `pwd`/$(OPT) $(if $(JS),--js '$(JS)',) $(TESTDIR)/$*.wast && \ + $(TESTDIR)/run.py 2>$(@F).out --wasm `pwd`/$< $(if $(JS),--js '$(JS)',) $(TESTDIR)/$*.wast && \ rm $(@F).out \ ) || \ cat $(@F).out || rm $(@F).out || exit 1 -smallinttest: smallint - @./smallint.native +smallinttest: + dune runtest # Miscellaneous targets -.PHONY: clean - -$(ZIP): $(WINMAKE) - git archive --format=zip --prefix=$(NAME)/ -o $@ HEAD +wasm.zip: + git archive --format=zip --prefix=wasm/ -o $@ HEAD clean: - rm -rf _build/jslib $(LIB).mlpack _tags - $(OCB) -clean - + dune clean # Opam support -.PHONY: check install uninstall - -check: - # Check that we can find all relevant libraries - # when using ocamlfind - ocamlfind query $(LIBS) - -install: _build/$(LIB).cmx _build/$(LIB).cmo - ocamlfind install $(LIB) meta/findlib/META _build/$(LIB).o \ - $(wildcard _build/$(LIB).cm*) \ - $(wildcard $(DIRS:%=%/*.mli)) +install: + dune install uninstall: - ocamlfind remove $(LIB) + dune uninstall diff --git a/interpreter/binary/decode.ml b/interpreter/binary/decode.ml index 78b4667766..cd5921c843 100644 --- a/interpreter/binary/decode.ml +++ b/interpreter/binary/decode.ml @@ -513,7 +513,7 @@ let rec instr s = | 0x0al -> let a, o = memop s in v128_load64_splat a o | 0x0bl -> let a, o = memop s in v128_store a o | 0x0cl -> v128_const (at v128 s) - | 0x0dl -> i8x16_shuffle (List.init 16 (fun x -> u8 s)) + | 0x0dl -> i8x16_shuffle (List.init 16 (fun _x -> u8 s)) | 0x0el -> i8x16_swizzle | 0x0fl -> i8x16_splat | 0x10l -> i16x8_splat @@ -925,7 +925,7 @@ let code_section s = (* Element section *) -let passive s = +let passive _s = Passive let active s = @@ -938,7 +938,7 @@ let active_zero s = let offset = const s in Active {index; offset} -let declarative s = +let declarative _s = Declarative let elem_index s = diff --git a/interpreter/binary/utf8.ml b/interpreter/binary/utf8.ml index 5cf17997e5..1fd0376fe5 100644 --- a/interpreter/binary/utf8.ml +++ b/interpreter/binary/utf8.ml @@ -5,7 +5,7 @@ let con n = 0x80 lor (n land 0x3f) let rec encode ns = Lib.String.implode (List.map Char.chr (encode' ns)) and encode' = function | [] -> [] - | n::ns when n < 0 -> + | n::_ns when n < 0 -> raise Utf8 | n::ns when n < 0x80 -> n :: encode' ns @@ -29,7 +29,7 @@ and decode' = function | [] -> [] | b1::bs when b1 < 0x80 -> code 0x0 b1 :: decode' bs - | b1::bs when b1 < 0xc0 -> + | b1::_bs when b1 < 0xc0 -> raise Utf8 | b1::b2::bs when b1 < 0xe0 -> code 0x80 ((b1 land 0x1f) lsl 6 + con b2) :: decode' bs diff --git a/interpreter/dune b/interpreter/dune new file mode 100644 index 0000000000..1aa5b32634 --- /dev/null +++ b/interpreter/dune @@ -0,0 +1,47 @@ +(copy_files# + (files binary/*.ml*)) + +(copy_files# + (files exec/*.ml*)) + +(copy_files# + (files host/*.ml*)) + +(copy_files# + (files main/flags.ml)) + +(copy_files# + (files runtime/*.ml*)) + +(copy_files# + (files script/*.ml*)) + +(copy_files# + (files syntax/*.ml*)) + +(copy_files# + (files text/*.ml*)) + +(copy_files# + (files util/*.ml*)) + +(copy_files# + (files valid/*.ml*)) + +(library + (public_name wasm) + (wrapped false)) + +; we don't use the `ocamllex` stanza directly as there's no way to pass the `-ml` +; if we don't pass `-ml` we have a transition table overflow... + +(rule + (target lexer.ml) + (deps lexer.mll) + (action + (chdir + %{workspace_root} + (run %{bin:ocamllex} -q -ml -o %{target} %{deps})))) + +(ocamlyacc + (modules parser)) diff --git a/interpreter/dune-project b/interpreter/dune-project new file mode 100644 index 0000000000..a332d18032 --- /dev/null +++ b/interpreter/dune-project @@ -0,0 +1,26 @@ +(lang dune 2.8) + +(implicit_transitive_deps false) + +(name wasm) + +(license Apache-2.0) + +(authors "TODO") + +(maintainers "TODO") + +(source + (github WebAssembly/spec)) + +(generate_opam_files true) + +(package + (name wasm) + (synopsis "WebAssembly library") + (description "A library for writing/reading/running WebAssembly binaries.") + (tags + (wasm webassembly spec interpreter)) + (depends + (ocaml + (>= 4.05)))) diff --git a/interpreter/exec/eval.ml b/interpreter/exec/eval.ml index fb7beac05f..7ff9c177eb 100644 --- a/interpreter/exec/eval.ml +++ b/interpreter/exec/eval.ml @@ -101,7 +101,7 @@ let func_ref inst x i at = | _ -> Crash.error at ("type mismatch for element " ^ Int32.to_string i) let func_type_of = function - | Func.AstFunc (t, inst, f) -> t + | Func.AstFunc (t, _inst, _f) -> t | Func.HostFunc (t, _) -> t let block_type inst bt = @@ -165,7 +165,7 @@ let rec step (c : config) : config = vs', [Label (n2, [], (args, List.map plain es')) @@ e.at] | Loop (bt, es'), vs -> - let FuncType (ts1, ts2) = block_type frame.inst bt in + let FuncType (ts1, _ts2) = block_type frame.inst bt in let n1 = Lib.List32.length ts1 in let args, vs' = take n1 vs e.at, drop n1 vs e.at in vs', [Label (n1, [e' @@ e.at], (args, List.map plain es')) @@ e.at] @@ -204,7 +204,7 @@ let rec step (c : config) : config = else vs, [Invoke func @@ e.at] - | Drop, v :: vs' -> + | Drop, _v :: vs' -> vs', [] | Select _, Num (I32 i) :: v2 :: v1 :: vs' -> @@ -360,7 +360,7 @@ let rec step (c : config) : config = vs', [] with exn -> vs', [Trapping (memory_error e.at exn) @@ e.at]); - | VecLoadLane ({offset; ty; pack; _}, j), Vec (V128 v) :: Num (I32 i) :: vs' -> + | VecLoadLane ({offset; pack; _}, j), Vec (V128 v) :: Num (I32 i) :: vs' -> let mem = memory frame.inst (0l @@ e.at) in let addr = I64_convert.extend_i32_u i in (try @@ -381,7 +381,7 @@ let rec step (c : config) : config = in Vec (V128 v) :: vs', [] with exn -> vs', [Trapping (memory_error e.at exn) @@ e.at]) - | VecStoreLane ({offset; ty; pack; _}, j), Vec (V128 v) :: Num (I32 i) :: vs' -> + | VecStoreLane ({offset; pack; _}, j), Vec (V128 v) :: Num (I32 i) :: vs' -> let mem = memory frame.inst (0l @@ e.at) in let addr = I64_convert.extend_i32_u i in (try @@ -590,48 +590,48 @@ let rec step (c : config) : config = | Refer r, vs -> Ref r :: vs, [] - | Trapping msg, vs -> + | Trapping _msg, _vs -> assert false - | Returning vs', vs -> + | Returning _vs', _vs -> Crash.error e.at "undefined frame" - | Breaking (k, vs'), vs -> + | Breaking (_k, _vs'), _vs -> Crash.error e.at "undefined label" - | Label (n, es0, (vs', [])), vs -> + | Label (_n, _es0, (vs', [])), vs -> vs' @ vs, [] - | Label (n, es0, (vs', {it = Trapping msg; at} :: es')), vs -> + | Label (_n, _es0, (_vs', {it = Trapping msg; at} :: _es')), vs -> vs, [Trapping msg @@ at] - | Label (n, es0, (vs', {it = Returning vs0; at} :: es')), vs -> + | Label (_n, _es0, (_vs', {it = Returning vs0; at} :: _es')), vs -> vs, [Returning vs0 @@ at] - | Label (n, es0, (vs', {it = Breaking (0l, vs0); at} :: es')), vs -> + | Label (n, es0, (_vs', {it = Breaking (0l, vs0); _} :: _es')), vs -> take n vs0 e.at @ vs, List.map plain es0 - | Label (n, es0, (vs', {it = Breaking (k, vs0); at} :: es')), vs -> + | Label (_n, _es0, (_vs', {it = Breaking (k, vs0); at} :: _es')), vs -> vs, [Breaking (Int32.sub k 1l, vs0) @@ at] | Label (n, es0, code'), vs -> let c' = step {c with code = code'} in vs, [Label (n, es0, c'.code) @@ e.at] - | Frame (n, frame', (vs', [])), vs -> + | Frame (_n, _frame', (vs', [])), vs -> vs' @ vs, [] - | Frame (n, frame', (vs', {it = Trapping msg; at} :: es')), vs -> + | Frame (_n, _frame', (_vs', {it = Trapping msg; at} :: _es')), vs -> vs, [Trapping msg @@ at] - | Frame (n, frame', (vs', {it = Returning vs0; at} :: es')), vs -> + | Frame (n, _frame', (_vs', {it = Returning vs0; _} :: _es')), vs -> take n vs0 e.at @ vs, [] | Frame (n, frame', code'), vs -> let c' = step {frame = frame'; code = code'; budget = c.budget - 1} in vs, [Frame (n, c'.frame, c'.code) @@ e.at] - | Invoke func, vs when c.budget = 0 -> + | Invoke _func, _vs when c.budget = 0 -> Exhaustion.error e.at "call stack exhausted" | Invoke func, vs -> @@ -639,13 +639,13 @@ let rec step (c : config) : config = let n1, n2 = Lib.List32.length ins, Lib.List32.length out in let args, vs' = take n1 vs e.at, drop n1 vs e.at in (match func with - | Func.AstFunc (t, inst', f) -> + | Func.AstFunc (_t, inst', f) -> let locals' = List.rev args @ List.map default_value f.it.locals in let frame' = {inst = !inst'; locals = List.map ref locals'} in let instr' = [Label (n2, [], ([], List.map plain f.it.body)) @@ f.at] in vs', [Frame (n2, frame', ([], instr')) @@ e.at] - | Func.HostFunc (t, f) -> + | Func.HostFunc (_t, f) -> try List.rev (f (List.rev args)) @ vs', [] with Crash (_, msg) -> Crash.error e.at msg ) @@ -657,10 +657,10 @@ let rec eval (c : config) : value stack = | vs, [] -> vs - | vs, {it = Trapping msg; at} :: _ -> + | _vs, {it = Trapping msg; at} :: _ -> Trap.error at msg - | vs, es -> + | _vs, _es -> eval (step c) @@ -668,7 +668,7 @@ let rec eval (c : config) : value stack = let invoke (func : func_inst) (vs : value list) : value list = let at = match func with Func.AstFunc (_, _, f) -> f.at | _ -> no_region in - let FuncType (ins, out) = Func.type_of func in + let FuncType (ins, _out) = Func.type_of func in if List.length vs <> List.length ins then Crash.error at "wrong number of arguments"; if not (List.for_all2 (fun v -> (=) (type_of_value v)) vs ins) then @@ -681,7 +681,7 @@ let eval_const (inst : module_inst) (const : const) : value = let c = config inst [] (List.map plain const.it) in match eval c with | [v] -> v - | vs -> Crash.error const.at "wrong number of results on stack" + | _vs -> Crash.error const.at "wrong number of results on stack" (* Modules *) @@ -689,12 +689,12 @@ let eval_const (inst : module_inst) (const : const) : value = let create_func (inst : module_inst) (f : func) : func_inst = Func.alloc (type_ inst f.it.ftype) (ref inst) f -let create_table (inst : module_inst) (tab : table) : table_inst = +let create_table (_inst : module_inst) (tab : table) : table_inst = let {ttype} = tab.it in let TableType (_lim, t) = ttype in Table.alloc ttype (NullRef t) -let create_memory (inst : module_inst) (mem : memory) : memory_inst = +let create_memory (_inst : module_inst) (mem : memory) : memory_inst = let {mtype} = mem.it in Memory.alloc mtype @@ -714,10 +714,10 @@ let create_export (inst : module_inst) (ex : export) : export_inst = in (name, ext) let create_elem (inst : module_inst) (seg : elem_segment) : elem_inst = - let {etype; einit; _} = seg.it in + let einit = seg.it.einit in ref (List.map (fun c -> as_ref (eval_const inst c)) einit) -let create_data (inst : module_inst) (seg : data_segment) : data_inst = +let create_data (_inst : module_inst) (seg : data_segment) : data_inst = let {dinit; _} = seg.it in ref dinit diff --git a/interpreter/exec/eval_num.ml b/interpreter/exec/eval_num.ml index f1245a133b..3b00ce8bf4 100644 --- a/interpreter/exec/eval_num.ml +++ b/interpreter/exec/eval_num.ml @@ -89,7 +89,7 @@ struct | CopySign -> FXX.copysign in fun v1 v2 -> to_num (f (of_num 1 v1) (of_num 2 v2)) - let testop op = assert false + let testop _op = assert false let relop op = let f = match op with @@ -195,4 +195,3 @@ let eval_binop = op I32Op.binop I64Op.binop F32Op.binop F64Op.binop let eval_testop = op I32Op.testop I64Op.testop F32Op.testop F64Op.testop let eval_relop = op I32Op.relop I64Op.relop F32Op.relop F64Op.relop let eval_cvtop = op I32CvtOp.cvtop I64CvtOp.cvtop F32CvtOp.cvtop F64CvtOp.cvtop - diff --git a/interpreter/exec/ixx.ml b/interpreter/exec/ixx.ml index 18f8b7d060..cfa10a5f67 100644 --- a/interpreter/exec/ixx.ml +++ b/interpreter/exec/ixx.ml @@ -175,7 +175,7 @@ struct (* result is floored (which is the same as truncating for unsigned values) *) let div_u x y = - let q, r = divrem_u x y in q + let q, _r = divrem_u x y in q (* result has the sign of the dividend *) let rem_s x y = @@ -185,7 +185,7 @@ struct Rep.rem x y let rem_u x y = - let q, r = divrem_u x y in r + let _q, r = divrem_u x y in r let avgr_u x y = let open Int64 in diff --git a/interpreter/exec/v128.ml b/interpreter/exec/v128.ml index 550fd9bfab..5ad0687b8e 100644 --- a/interpreter/exec/v128.ml +++ b/interpreter/exec/v128.ml @@ -109,7 +109,7 @@ struct let reduceop f a s = List.fold_left (fun a b -> f a (b <> IXX.zero)) a (to_lanes s) let cmp f x y = if f x y then IXX.of_int_s (-1) else IXX.zero - let splat x = of_lanes (List.init num_lanes (fun i -> x)) + let splat x = of_lanes (List.init num_lanes (fun _i -> x)) let extract_lane_s i s = List.nth (to_lanes s) i let extract_lane_u i s = IXX.as_unsigned (extract_lane_s i s) let replace_lane i v x = unopi (fun j y -> if j = i then x else y) v @@ -212,7 +212,7 @@ struct let all_ones = FXX.of_float (Int64.float_of_bits (Int64.minus_one)) let cmp f x y = if f x y then all_ones else FXX.zero - let splat x = of_lanes (List.init num_lanes (fun i -> x)) + let splat x = of_lanes (List.init num_lanes (fun _i -> x)) let extract_lane i s = List.nth (to_lanes s) i let replace_lane i v x = unopi (fun j y -> if j = i then x else y) v diff --git a/interpreter/host/env.ml b/interpreter/host/env.ml index 58239d10bc..85ea591f88 100644 --- a/interpreter/host/env.ml +++ b/interpreter/host/env.ml @@ -18,12 +18,12 @@ let type_error v t = let empty = function | [] -> () - | vs -> error "type error, too many arguments" + | _vs -> error "type error, too many arguments" let single = function | [] -> error "type error, missing arguments" | [v] -> v - | vs -> error "type error, too many arguments" + | _vs -> error "type error, too many arguments" let int = function | Num (I32 i) -> Int32.to_int i diff --git a/interpreter/jslib/dune b/interpreter/jslib/dune new file mode 100644 index 0000000000..b65e2516ba --- /dev/null +++ b/interpreter/jslib/dune @@ -0,0 +1,4 @@ +(executable + (name wasm) + (modes js) + (libraries wasm)) diff --git a/interpreter/meta/jslib/wasm.ml b/interpreter/jslib/wasm.ml similarity index 88% rename from interpreter/meta/jslib/wasm.ml rename to interpreter/jslib/wasm.ml index 915fdafb08..9a392b1157 100644 --- a/interpreter/meta/jslib/wasm.ml +++ b/interpreter/jslib/wasm.ml @@ -3,6 +3,7 @@ let encode s = match def.Source.it with | Script.Textual m -> Encode.encode m | Script.Encoded (_, bs) -> bs + | _ -> failwith "unimplemented" let decode s width = let m = Decode.decode "(decode)" s in diff --git a/interpreter/main/dune b/interpreter/main/dune new file mode 100644 index 0000000000..ab34eeee1a --- /dev/null +++ b/interpreter/main/dune @@ -0,0 +1,6 @@ +(executable + (public_name wasm) + (name main) + (modules main) + (modes byte exe) + (libraries wasm)) diff --git a/interpreter/meta/findlib/META b/interpreter/meta/findlib/META deleted file mode 100644 index 2c1d96dd03..0000000000 --- a/interpreter/meta/findlib/META +++ /dev/null @@ -1,4 +0,0 @@ -description = "A library for writing/reading/running WebAssembly binaries" -requires = "bigarray,str" -archive(byte) = "wasm.cmo" -archive(native) = "wasm.cmx" diff --git a/interpreter/meta/jslib/bsconfig.json b/interpreter/meta/jslib/bsconfig.json deleted file mode 100644 index d313bf93d8..0000000000 --- a/interpreter/meta/jslib/bsconfig.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "wasm", - "sources": [ - {"dir": "src"}, - ] -} diff --git a/interpreter/meta/jslib/build.sh b/interpreter/meta/jslib/build.sh deleted file mode 100755 index 14471217b5..0000000000 --- a/interpreter/meta/jslib/build.sh +++ /dev/null @@ -1,97 +0,0 @@ -link () { -echo "// DO NOT EDIT. Generated from WebAssembly spec interpreter" -echo " -let WebAssemblyText = (function() { -  let _registry = {__proto__: null}; - function normalize(file) { - return file.split('/').reverse()[0].split('.')[0]; - } -  function require(file) { -    let name = normalize(file); - if (!(name in _registry)) { - throw new Error('missing module: ' + name) -    } else if (typeof _registry[name] === 'function') { -" -if (($LOG == 1)) -then - echo 1>&2 Logging on - echo " - console.log(name); -" -fi -echo " -      let f = _registry[name]; -      _registry[name] = function() { throw new Error('cyclic module: ' + name) }; -      _registry[name] = f(); -    } -    return _registry[name]; -  } -" - -for file in $* -do - echo 1>&2 Including $file - name=`basename $file | sed s/[.]js//g` - echo " - _registry['$name'] = function() { -    let exports = {}; -//////// start of $name.js ////////" - cat $file - echo "//////// end of $name.js //////// -    return exports; -  }; -" -done - -echo " - function binary(bytes) { - let buffer = new ArrayBuffer(bytes.length); - let view = new Uint8Array(buffer); - for (let i = 0; i < bytes.length; ++i) { - view[i] = bytes.charCodeAt(i); - } - return buffer; - } - function bytes(buffer) { - let string = ''; - let view = new Uint8Array(buffer); - for (let i = 0; i < view.length; ++i) { - string += String.fromCodePoint(view[i]); - } - return string; - } -  let Wasm = require('wasm'); - return { - encode(s) { return binary(Wasm.encode(s)) }, - decode(b, w = 80) { return Wasm.decode(bytes(b), w) } - }; -})(); - -" -} - -echo 1>&2 ==== Preparing ==== -npm link bs-platform - -echo 1>&2 ==== Compiling ==== -bsb || exit 1 - -echo 1>&2 ==== Linking full version ==== -LOG=1 -FILES='node_modules/bs-platform/lib/js/*.js lib/js/src/*.js' -link $FILES >temp.js || exit 1 - -echo 1>&2 ==== Running for dependencies ==== -node temp.js | tee temp.log || exit 1 - -echo 1>&2 ==== Linking stripped version ==== -used='' -for file in `ls $FILES` -do - if grep -q `basename $file | sed s/.js//g` temp.log - then - used="$used $file" - fi -done -LOG=0 -link $used >$1 || exit 1 diff --git a/interpreter/runtime/table.ml b/interpreter/runtime/table.ml index bb10cab8b3..8ed41e0d8a 100644 --- a/interpreter/runtime/table.ml +++ b/interpreter/runtime/table.ml @@ -50,7 +50,7 @@ let load tab i = try Lib.Array32.get tab.content i with Invalid_argument _ -> raise Bounds let store tab i r = - let TableType (lim, t) = tab.ty in + let TableType (_lim, t) = tab.ty in if type_of_ref r <> t then raise Type; try Lib.Array32.set tab.content i r with Invalid_argument _ -> raise Bounds diff --git a/interpreter/script/import.ml b/interpreter/script/import.ml index c9e65eafcd..a5fe91da4c 100644 --- a/interpreter/script/import.ml +++ b/interpreter/script/import.ml @@ -10,7 +10,8 @@ let registry = ref Registry.empty let register name lookup = registry := Registry.add name lookup !registry let lookup (m : module_) (im : import) : Instance.extern = - let {module_name; item_name; idesc} = im.it in + let module_name = im.it.module_name in + let item_name = im.it.item_name in let t = import_type m im in try Registry.find module_name !registry item_name t with Not_found -> Unknown.error im.at diff --git a/interpreter/script/js.ml b/interpreter/script/js.ml index 093da2463c..cf8fab864e 100644 --- a/interpreter/script/js.ml +++ b/interpreter/script/js.ml @@ -216,7 +216,7 @@ let bind (mods : modules) x_opt m = let lookup (mods : modules) x_opt name at = let exports = try Map.find (of_var_opt mods x_opt) mods.env with Not_found -> - raise (Eval.Crash (at, + raise (Eval.Crash (at, if x_opt = None then "no module defined within script" else "unknown module " ^ of_var_opt mods x_opt ^ " within script")) in try NameMap.find name exports with Not_found -> @@ -274,10 +274,10 @@ let invoke ft vs at = let get t at = [], GlobalImport t @@ at, [GlobalGet (subject_idx @@ at) @@ at] -let run ts at = +let run _ts _at = [], [] -let assert_return ress ts at = +let assert_return ress _ts at = let test res = let nan_bitmask_of = function | CanonicalNan -> abs_mask_of (* must only differ from the canonical NaN in its sign bit *) @@ -353,7 +353,7 @@ let assert_return ress ts at = VecTest (V128 (V128.I8x16 V128Op.AllTrue)) @@ at; Test (I32 I32Op.Eqz) @@ at; BrIf (0l @@ at) @@ at ] - | RefResult (RefPat {it = Values.NullRef t; _}) -> + | RefResult (RefPat {it = Values.NullRef _t; _}) -> [ RefIsNull @@ at; Test (Values.I32 I32Op.Eqz) @@ at; BrIf (0l @@ at) @@ at ] @@ -424,8 +424,8 @@ let is_js_num_type = function let is_js_value_type = function | NumType t -> is_js_num_type t - | VecType t -> false - | RefType t -> true + | VecType _t -> false + | RefType _t -> true let is_js_global_type = function | GlobalType (t, mut) -> is_js_value_type t && mut = Immutable @@ -507,7 +507,7 @@ let of_num_pat = function | Values.F32 n | Values.F64 n -> of_nan n let of_vec_pat = function - | VecPat (Values.V128 (shape, pats)) -> + | VecPat (Values.V128 (_shape, pats)) -> Printf.sprintf "v128(\"%s\")" (String.concat " " (List.map of_num_pat pats)) let of_ref_pat = function diff --git a/interpreter/script/run.ml b/interpreter/script/run.ml index e0019d84a0..33d28e572e 100644 --- a/interpreter/script/run.ml +++ b/interpreter/script/run.ml @@ -155,7 +155,7 @@ let input_binary_file file run = success with exn -> close_in ic; raise exn -let input_js_file file run = +let input_js_file file _run = raise (Sys_error (file ^ ": unrecognized input file type")) let input_file file run = @@ -268,7 +268,7 @@ let string_of_num_pat (p : num_pat) = let string_of_vec_pat (p : vec_pat) = match p with - | VecPat (Values.V128 (shape, ns)) -> + | VecPat (Values.V128 (_shape, ns)) -> String.concat " " (List.map string_of_num_pat ns) let string_of_ref_pat (p : ref_pat) = @@ -347,7 +347,7 @@ let run_action act : Values.value list = let inst = lookup_instance x_opt act.at in (match Instance.export inst name with | Some (Instance.ExternFunc f) -> - let Types.FuncType (ins, out) = Func.type_of f in + let Types.FuncType (ins, _out) = Func.type_of f in if List.length vs <> List.length ins then Script.error act.at "wrong number of arguments"; List.iter2 (fun v t -> diff --git a/interpreter/syntax/free.ml b/interpreter/syntax/free.ml index 78c09baf3f..11178cc688 100644 --- a/interpreter/syntax/free.ml +++ b/interpreter/syntax/free.ml @@ -102,8 +102,8 @@ let const (c : const) = block c.it let global (g : global) = const g.it.ginit let func (f : func) = {(block f.it.body) with locals = Set.empty} -let table (t : table) = empty -let memory (m : memory) = empty +let table (_t : table) = empty +let memory (_m : memory) = empty let segment_mode f (m : segment_mode) = match m.it with @@ -116,7 +116,7 @@ let elem (s : elem_segment) = let data (s : data_segment) = segment_mode memories s.it.dmode -let type_ (t : type_) = empty +let type_ (_t : type_) = empty let export_desc (d : export_desc) = match d.it with @@ -128,9 +128,9 @@ let export_desc (d : export_desc) = let import_desc (d : import_desc) = match d.it with | FuncImport x -> types (var x) - | TableImport tt -> empty - | MemoryImport mt -> empty - | GlobalImport gt -> empty + | TableImport _tt -> empty + | MemoryImport _mt -> empty + | GlobalImport _gt -> empty let export (e : export) = export_desc e.it.edesc let import (i : import) = import_desc i.it.idesc diff --git a/interpreter/syntax/values.ml b/interpreter/syntax/values.ml index eefe37d5d0..e7fa5d1b90 100644 --- a/interpreter/syntax/values.ml +++ b/interpreter/syntax/values.ml @@ -81,7 +81,7 @@ module V128Vec = struct type t = V128.t let to_vec i = V128 i - let of_vec n = function V128 z -> z + let of_vec _n = function V128 z -> z end @@ -169,7 +169,7 @@ let string_of_vec = function let hex_string_of_vec = function | V128 v -> V128.to_hex_string v -let string_of_ref' = ref (function NullRef t -> "null" | _ -> "ref") +let string_of_ref' = ref (function NullRef _t -> "null" | _ -> "ref") let string_of_ref r = !string_of_ref' r let string_of_value = function diff --git a/interpreter/tests/dune b/interpreter/tests/dune new file mode 100644 index 0000000000..ec36eb2c41 --- /dev/null +++ b/interpreter/tests/dune @@ -0,0 +1,3 @@ +(test + (name smallint) + (libraries wasm)) diff --git a/interpreter/text/arrange.ml b/interpreter/text/arrange.ml index cdcd4f84db..0117e15e3f 100644 --- a/interpreter/text/arrange.ml +++ b/interpreter/text/arrange.ml @@ -102,10 +102,10 @@ module IntOp = struct open Ast.IntOp - let testop xx = function + let testop _xx = function | Eqz -> "eqz" - let relop xx = function + let relop _xx = function | Eq -> "eq" | Ne -> "ne" | LtS -> "lt_s" @@ -117,13 +117,13 @@ struct | GeS -> "ge_s" | GeU -> "ge_u" - let unop xx = function + let unop _xx = function | Clz -> "clz" | Ctz -> "ctz" | Popcnt -> "popcnt" | ExtendS sz -> "extend" ^ pack_size sz ^ "_s" - let binop xx = function + let binop _xx = function | Add -> "add" | Sub -> "sub" | Mul -> "mul" @@ -159,9 +159,9 @@ module FloatOp = struct open Ast.FloatOp - let testop xx = function (_ : testop) -> . + let testop _xx = function (_ : testop) -> . - let relop xx = function + let relop _xx = function | Eq -> "eq" | Ne -> "ne" | Lt -> "lt" @@ -169,7 +169,7 @@ struct | Le -> "le" | Ge -> "ge" - let unop xx = function + let unop _xx = function | Neg -> "neg" | Abs -> "abs" | Ceil -> "ceil" @@ -178,7 +178,7 @@ struct | Nearest -> "nearest" | Sqrt -> "sqrt" - let binop xx = function + let binop _xx = function | Add -> "add" | Sub -> "sub" | Mul -> "mul" @@ -213,17 +213,17 @@ struct | "32x4" -> "64x2" | _ -> assert false - let voidop xxxx = function (_ : void) -> . + let voidop _xxxx = function (_ : void) -> . - let itestop xxxx (op : itestop) = match op with + let itestop _xxxx (op : itestop) = match op with | AllTrue -> "all_true" - let iunop xxxx (op : iunop) = match op with + let iunop _xxxx (op : iunop) = match op with | Neg -> "neg" | Abs -> "abs" | Popcnt -> "popcnt" - let funop xxxx (op : funop) = match op with + let funop _xxxx (op : funop) = match op with | Neg -> "neg" | Abs -> "abs" | Sqrt -> "sqrt" @@ -256,7 +256,7 @@ struct | Shuffle is -> "shuffle " ^ String.concat " " (List.map nat is) | Swizzle -> "swizzle" - let fbinop xxxx (op : fbinop) = match op with + let fbinop _xxxx (op : fbinop) = match op with | Add -> "add" | Sub -> "sub" | Mul -> "mul" @@ -266,7 +266,7 @@ struct | Pmin -> "pmin" | Pmax -> "pmax" - let irelop xxxx (op : irelop) = match op with + let irelop _xxxx (op : irelop) = match op with | Eq -> "eq" | Ne -> "ne" | LtS -> "lt_s" @@ -278,7 +278,7 @@ struct | GeS -> "ge_s" | GeU -> "ge_u" - let frelop xxxx (op : frelop) = match op with + let frelop _xxxx (op : frelop) = match op with | Eq -> "eq" | Ne -> "ne" | Lt -> "lt" @@ -306,12 +306,12 @@ struct | ConvertUI32x4 -> "convert_" ^ (if xxxx = "32x4" then "" else "low_") ^ "i32x4_u" - let ishiftop xxxx (op : ishiftop) = match op with + let ishiftop _xxxx (op : ishiftop) = match op with | Shl -> "shl" | ShrS -> "shr_s" | ShrU -> "shr_u" - let ibitmaskop xxxx (op : ibitmaskop) = match op with + let ibitmaskop _xxxx (op : ibitmaskop) = match op with | Bitmask -> "bitmask" let vtestop (op : vtestop) = match op with @@ -329,16 +329,16 @@ struct let vternop (op : vternop) = match op with | Bitselect -> "bitselect" - let splatop xxxx (op : nsplatop) = match op with + let splatop _xxxx (op : nsplatop) = match op with | Splat -> "splat" - let pextractop xxxx (op : extension nextractop) = match op with + let pextractop _xxxx (op : extension nextractop) = match op with | Extract (i, ext) -> "extract_lane" ^ extension ext ^ " " ^ nat i - let extractop xxxx (op : unit nextractop) = match op with + let extractop _xxxx (op : unit nextractop) = match op with | Extract (i, ()) -> "extract_lane " ^ nat i - let replaceop xxxx (op : nreplaceop) = match op with + let replaceop _xxxx (op : nreplaceop) = match op with | Replace i -> "replace_lane " ^ nat i let lane_oper (pop, iop, fop) op = @@ -507,7 +507,7 @@ let rec instr e = let const head c = match c.it with | [e] -> instr e - | es -> Node (head, list instr c.it) + | _es -> Node (head, list instr c.it) (* Functions *) diff --git a/interpreter/text/parser.mly b/interpreter/text/parser.mly index e91c3fe86e..eed48a15ca 100644 --- a/interpreter/text/parser.mly +++ b/interpreter/text/parser.mly @@ -352,16 +352,16 @@ num_list: | num num_list { $1 :: $2 } var : - | NAT { let at = at () in fun c lookup -> nat32 $1 at @@ at } + | NAT { let at = at () in fun _c _lookup -> nat32 $1 at @@ at } | VAR { let at = at () in fun c lookup -> lookup c ($1 @@ at) @@ at } var_list : - | /* empty */ { fun c lookup -> [] } + | /* empty */ { fun _c _lookup -> [] } | var var_list { fun c lookup -> $1 c lookup :: $2 c lookup } bind_var_opt : - | /* empty */ { fun c anon bind -> anon c } - | bind_var { fun c anon bind -> bind c $1 } /* Sugar */ + | /* empty */ { fun c anon _bind -> anon c } + | bind_var { fun c _anon bind -> bind c $1 } /* Sugar */ bind_var : | VAR { $1 @@ at () } @@ -404,15 +404,15 @@ instr : | expr { $1 } /* Sugar */ plain_instr : - | UNREACHABLE { fun c -> unreachable } - | NOP { fun c -> nop } - | DROP { fun c -> drop } + | UNREACHABLE { fun _c -> unreachable } + | NOP { fun _c -> nop } + | DROP { fun _c -> drop } | BR var { fun c -> br ($2 c label) } | BR_IF var { fun c -> br_if ($2 c label) } | BR_TABLE var var_list { fun c -> let xs, x = Lib.List.split_last ($2 c label :: $3 c label) in br_table xs x } - | RETURN { fun c -> return } + | RETURN { fun _c -> return } | CALL var { fun c -> call ($2 c func) } | LOCAL_GET var { fun c -> local_get ($2 c local) } | LOCAL_SET var { fun c -> local_set ($2 c local) } @@ -426,55 +426,55 @@ plain_instr : | TABLE_FILL var { fun c -> table_fill ($2 c table) } | TABLE_COPY var var { fun c -> table_copy ($2 c table) ($3 c table) } | TABLE_INIT var var { fun c -> table_init ($2 c table) ($3 c elem) } - | TABLE_GET { let at = at () in fun c -> table_get (0l @@ at) } /* Sugar */ - | TABLE_SET { let at = at () in fun c -> table_set (0l @@ at) } /* Sugar */ - | TABLE_SIZE { let at = at () in fun c -> table_size (0l @@ at) } /* Sugar */ - | TABLE_GROW { let at = at () in fun c -> table_grow (0l @@ at) } /* Sugar */ - | TABLE_FILL { let at = at () in fun c -> table_fill (0l @@ at) } /* Sugar */ + | TABLE_GET { let at = at () in fun _c -> table_get (0l @@ at) } /* Sugar */ + | TABLE_SET { let at = at () in fun _c -> table_set (0l @@ at) } /* Sugar */ + | TABLE_SIZE { let at = at () in fun _c -> table_size (0l @@ at) } /* Sugar */ + | TABLE_GROW { let at = at () in fun _c -> table_grow (0l @@ at) } /* Sugar */ + | TABLE_FILL { let at = at () in fun _c -> table_fill (0l @@ at) } /* Sugar */ | TABLE_COPY /* Sugar */ - { let at = at () in fun c -> table_copy (0l @@ at) (0l @@ at) } + { let at = at () in fun _c -> table_copy (0l @@ at) (0l @@ at) } | TABLE_INIT var /* Sugar */ { let at = at () in fun c -> table_init (0l @@ at) ($2 c elem) } | ELEM_DROP var { fun c -> elem_drop ($2 c elem) } - | LOAD offset_opt align_opt { fun c -> $1 $3 $2 } - | STORE offset_opt align_opt { fun c -> $1 $3 $2 } - | VEC_LOAD offset_opt align_opt { fun c -> $1 $3 $2 } - | VEC_STORE offset_opt align_opt { fun c -> $1 $3 $2 } + | LOAD offset_opt align_opt { fun _c -> $1 $3 $2 } + | STORE offset_opt align_opt { fun _c -> $1 $3 $2 } + | VEC_LOAD offset_opt align_opt { fun _c -> $1 $3 $2 } + | VEC_STORE offset_opt align_opt { fun _c -> $1 $3 $2 } | VEC_LOAD_LANE offset_opt align_opt NAT - { let at = at () in fun c -> $1 $3 $2 (vec_lane_index $4 at) } + { let at = at () in fun _c -> $1 $3 $2 (vec_lane_index $4 at) } | VEC_STORE_LANE offset_opt align_opt NAT - { let at = at () in fun c -> $1 $3 $2 (vec_lane_index $4 at) } - | MEMORY_SIZE { fun c -> memory_size } - | MEMORY_GROW { fun c -> memory_grow } - | MEMORY_FILL { fun c -> memory_fill } - | MEMORY_COPY { fun c -> memory_copy } + { let at = at () in fun _c -> $1 $3 $2 (vec_lane_index $4 at) } + | MEMORY_SIZE { fun _c -> memory_size } + | MEMORY_GROW { fun _c -> memory_grow } + | MEMORY_FILL { fun _c -> memory_fill } + | MEMORY_COPY { fun _c -> memory_copy } | MEMORY_INIT var { fun c -> memory_init ($2 c data) } | DATA_DROP var { fun c -> data_drop ($2 c data) } - | REF_NULL ref_kind { fun c -> ref_null $2 } - | REF_IS_NULL { fun c -> ref_is_null } + | REF_NULL ref_kind { fun _c -> ref_null $2 } + | REF_IS_NULL { fun _c -> ref_is_null } | REF_FUNC var { fun c -> ref_func ($2 c func) } - | CONST num { fun c -> fst (num $1 $2) } - | TEST { fun c -> $1 } - | COMPARE { fun c -> $1 } - | UNARY { fun c -> $1 } - | BINARY { fun c -> $1 } - | CONVERT { fun c -> $1 } - | VEC_CONST VEC_SHAPE num_list { let at = at () in fun c -> fst (vec $1 $2 $3 at) } - | VEC_UNARY { fun c -> $1 } - | VEC_BINARY { fun c -> $1 } - | VEC_TERNARY { fun c -> $1 } - | VEC_TEST { fun c -> $1 } - | VEC_SHIFT { fun c -> $1 } - | VEC_BITMASK { fun c -> $1 } - | VEC_SHUFFLE num_list { let at = at () in fun c -> i8x16_shuffle (shuffle_lit $2 at) } - | VEC_SPLAT { fun c -> $1 } - | VEC_EXTRACT NAT { let at = at () in fun c -> $1 (vec_lane_index $2 at) } - | VEC_REPLACE NAT { let at = at () in fun c -> $1 (vec_lane_index $2 at) } + | CONST num { fun _c -> fst (num $1 $2) } + | TEST { fun _c -> $1 } + | COMPARE { fun _c -> $1 } + | UNARY { fun _c -> $1 } + | BINARY { fun _c -> $1 } + | CONVERT { fun _c -> $1 } + | VEC_CONST VEC_SHAPE num_list { let at = at () in fun _c -> fst (vec $1 $2 $3 at) } + | VEC_UNARY { fun _c -> $1 } + | VEC_BINARY { fun _c -> $1 } + | VEC_TERNARY { fun _c -> $1 } + | VEC_TEST { fun _c -> $1 } + | VEC_SHIFT { fun _c -> $1 } + | VEC_BITMASK { fun _c -> $1 } + | VEC_SHUFFLE num_list { let at = at () in fun _c -> i8x16_shuffle (shuffle_lit $2 at) } + | VEC_SPLAT { fun _c -> $1 } + | VEC_EXTRACT NAT { let at = at () in fun _c -> $1 (vec_lane_index $2 at) } + | VEC_REPLACE NAT { let at = at () in fun _c -> $1 (vec_lane_index $2 at) } select_instr : | SELECT select_instr_results - { let at = at () in fun c -> let b, ts = $2 in + { let at = at () in fun _c -> let b, ts = $2 in select (if b then (Some ts) else None) @@ at } select_instr_results : @@ -522,7 +522,7 @@ call_instr_results : | LPAR RESULT value_type_list RPAR call_instr_results { fun c -> $3 @ $5 c } | /* empty */ - { fun c -> [] } + { fun _c -> [] } call_instr_instr : @@ -683,18 +683,18 @@ if_ : { fun c c' -> let es = $1 c in let es0, es1, es2 = $2 c c' in es @ es0, es1, es2 } | LPAR THEN instr_list RPAR LPAR ELSE instr_list RPAR /* Sugar */ - { fun c c' -> [], $3 c', $7 c' } + { fun _c c' -> [], $3 c', $7 c' } | LPAR THEN instr_list RPAR /* Sugar */ - { fun c c' -> [], $3 c', [] } + { fun _c c' -> [], $3 c', [] } instr_list : - | /* empty */ { fun c -> [] } + | /* empty */ { fun _c -> [] } | select_instr { fun c -> [$1 c] } | call_instr { fun c -> [$1 c] } | instr instr_list { fun c -> $1 c @ $2 c } expr_list : - | /* empty */ { fun c -> [] } + | /* empty */ { fun _c -> [] } | expr expr_list { fun c -> $1 c @ $2 c } const_expr : @@ -710,23 +710,23 @@ func : func_fields : | type_use func_fields_body - { fun c x at -> + { fun c _x at -> let c' = enter_func c in let y = inline_type_explicit c' ($1 c' type_) (fst $2) at in [{(snd $2 c') with ftype = y} @@ at], [], [] } | func_fields_body /* Sugar */ - { fun c x at -> + { fun c _x at -> let c' = enter_func c in let y = inline_type c' (fst $1) at in [{(snd $1 c') with ftype = y} @@ at], [], [] } | inline_import type_use func_fields_import /* Sugar */ - { fun c x at -> + { fun c _x at -> let y = inline_type_explicit c ($2 c type_) $3 at in [], [{ module_name = fst $1; item_name = snd $1; idesc = FuncImport y @@ at } @@ at ], [] } | inline_import func_fields_import /* Sugar */ - { fun c x at -> + { fun c _x at -> let y = inline_type c $2 at in [], [{ module_name = fst $1; item_name = snd $1; @@ -796,7 +796,7 @@ elem_expr : | expr { let at = at () in fun c -> $1 c @@ at } /* Sugar */ elem_expr_list : - | /* empty */ { fun c -> [] } + | /* empty */ { fun _c -> [] } | elem_expr elem_expr_list { fun c -> $1 c :: $2 c } elem_var_list : @@ -849,9 +849,9 @@ table : table_fields : | table_type - { fun c x at -> [{ttype = $1} @@ at], [], [], [] } + { fun _c _x at -> [{ttype = $1} @@ at], [], [], [] } | inline_import table_type /* Sugar */ - { fun c x at -> + { fun _c _x at -> [], [], [{ module_name = fst $1; item_name = snd $1; idesc = TableImport $2 @@ at } @@ at], [] } @@ -901,9 +901,9 @@ memory : memory_fields : | memory_type - { fun c x at -> [{mtype = $1} @@ at], [], [], [] } + { fun _c _x at -> [{mtype = $1} @@ at], [], [], [] } | inline_import memory_type /* Sugar */ - { fun c x at -> + { fun _c _x at -> [], [], [{ module_name = fst $1; item_name = snd $1; idesc = MemoryImport $2 @@ at } @@ at], [] } @@ -911,7 +911,7 @@ memory_fields : { fun c x at -> let mems, data, ims, exs = $2 c x at in mems, data, ims, $1 (MemoryExport x) c :: exs } | LPAR DATA string_list RPAR /* Sugar */ - { fun c x at -> + { fun _c x at -> let offset = [i32_const (0l @@ at) @@ at] @@ at in let size = Int32.(div (add (of_int (String.length $3)) 65535l) 65536l) in [{mtype = MemoryType {min = size; max = Some size}} @@ at], @@ -926,9 +926,9 @@ global : global_fields : | global_type const_expr - { fun c x at -> [{gtype = $1; ginit = $2 c} @@ at], [], [] } + { fun c _x at -> [{gtype = $1; ginit = $2 c} @@ at], [], [] } | inline_import global_type /* Sugar */ - { fun c x at -> + { fun _c _x at -> [], [{ module_name = fst $1; item_name = snd $1; idesc = GlobalImport $2 @@ at } @@ at], [] } @@ -979,7 +979,7 @@ export : inline_export : | LPAR EXPORT name RPAR - { let at = at () in fun d c -> {name = $3; edesc = d @@ at} @@ at } + { let at = at () in fun d _c -> {name = $3; edesc = d @@ at} @@ at } /* Modules */ diff --git a/interpreter/util/lib.ml b/interpreter/util/lib.ml index 76757eb720..9b15ad4605 100644 --- a/interpreter/util/lib.ml +++ b/interpreter/util/lib.ml @@ -93,8 +93,8 @@ struct and index_where' p xs i = match xs with | [] -> None - | x::xs' when p x -> Some i - | x::xs' -> index_where' p xs' (i+1) + | x::_xs' when p x -> Some i + | _x::xs' -> index_where' p xs' (i+1) let index_of x = index_where ((=) x) diff --git a/interpreter/valid/valid.ml b/interpreter/valid/valid.ml index 780404e509..56fcc1c7fc 100644 --- a/interpreter/valid/valid.ml +++ b/interpreter/valid/valid.ml @@ -104,7 +104,7 @@ let push (ell1, ts1) (ell2, ts2) = (if ell1 = Ellipses || ell2 = Ellipses then Ellipses else NoEllipses), ts2 @ ts1 -let peek i (ell, ts) = +let peek i (_ell, ts) = try List.nth (List.rev ts) i with Failure _ -> None @@ -288,7 +288,7 @@ let rec check_instr (c : context) (e : instr) (s : infer_result_type) : op_type ts1 --> ts2 | CallIndirect (x, y) -> - let TableType (lim, t) = table c x in + let TableType (_lim, t) = table c x in let FuncType (ts1, ts2) = type_ c y in require (t = FuncRefType) x.at ("type mismatch: instruction requires table of functions" ^ @@ -546,13 +546,13 @@ let check_limits {min; max} range at msg = require (I32.le_u min max) at "size minimum must not be greater than maximum" -let check_num_type (t : num_type) at = +let check_num_type (_t : num_type) _at = () -let check_vec_type (t : vec_type) at = +let check_vec_type (_t : vec_type) _at = () -let check_ref_type (t : ref_type) at = +let check_ref_type (_t : ref_type) _at = () let check_value_type (t : value_type) at = @@ -577,7 +577,7 @@ let check_memory_type (mt : memory_type) at = "memory size must be at most 65536 pages (4GiB)" let check_global_type (gt : global_type) at = - let GlobalType (t, mut) = gt in + let GlobalType (t, _mut) = gt in check_value_type t at @@ -623,11 +623,11 @@ let check_const (c : context) (const : const) (t : value_type) = (* Tables, Memories, & Globals *) -let check_table (c : context) (tab : table) = +let check_table (_c : context) (tab : table) = let {ttype} = tab.it in check_table_type ttype tab.at -let check_memory (c : context) (mem : memory) = +let check_memory (_c : context) (mem : memory) = let {mtype} = mem.it in check_memory_type mtype mem.at @@ -656,12 +656,12 @@ let check_data_mode (c : context) (mode : segment_mode) = | Declarative -> assert false let check_data (c : context) (seg : data_segment) = - let {dinit; dmode} = seg.it in + let dmode = seg.it.dmode in check_data_mode c dmode let check_global (c : context) (glob : global) = let {gtype; ginit} = glob.it in - let GlobalType (t, mut) = gtype in + let GlobalType (t, _mut) = gtype in check_const c ginit t diff --git a/interpreter/wasm.opam b/interpreter/wasm.opam new file mode 100644 index 0000000000..e437638110 --- /dev/null +++ b/interpreter/wasm.opam @@ -0,0 +1,30 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +synopsis: "WebAssembly library" +description: "A library for writing/reading/running WebAssembly binaries." +maintainer: ["TODO"] +authors: ["TODO"] +license: "Apache-2.0" +tags: ["wasm" "webassembly" "spec" "interpreter"] +homepage: "https://github.com/WebAssembly/spec" +bug-reports: "https://github.com/WebAssembly/spec/issues" +depends: [ + "dune" {>= "2.8"} + "ocaml" {>= "4.05"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] +] +dev-repo: "git+https://github.com/WebAssembly/spec.git" diff --git a/interpreter/winmake.bat b/interpreter/winmake.bat index 6ff7e8caae..6ac1bb7ed7 100644 --- a/interpreter/winmake.bat +++ b/interpreter/winmake.bat @@ -1,75 +1,3 @@ -rem Auto-generated from Makefile! set NAME=wasm if '%1' neq '' set NAME=%1 -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/numeric_error.cmo exec/numeric_error.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/int.cmo exec/int.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I util -I main -I syntax -I text -I binary -I exec -I script -I runtime -I host -I valid -o util/lib.cmi util/lib.mli -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/i32.cmo exec/i32.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/float.cmo exec/float.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I syntax -I main -I text -I binary -I exec -I script -I runtime -I util -I host -I valid -o syntax/types.cmo syntax/types.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/f32.cmo exec/f32.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/f64.cmo exec/f64.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/i64.cmo exec/i64.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I syntax -I main -I text -I binary -I exec -I script -I runtime -I util -I host -I valid -o syntax/values.cmo syntax/values.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I runtime -I main -I syntax -I text -I binary -I exec -I script -I util -I host -I valid -o runtime/memory.cmi runtime/memory.mli -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I util -I main -I syntax -I text -I binary -I exec -I script -I runtime -I host -I valid -o util/source.cmi util/source.mli -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I syntax -I main -I text -I binary -I exec -I script -I runtime -I util -I host -I valid -o syntax/ast.cmo syntax/ast.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I runtime -I main -I syntax -I text -I binary -I exec -I script -I util -I host -I valid -o runtime/func.cmi runtime/func.mli -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I runtime -I main -I syntax -I text -I binary -I exec -I script -I util -I host -I valid -o runtime/global.cmi runtime/global.mli -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I runtime -I main -I syntax -I text -I binary -I exec -I script -I util -I host -I valid -o runtime/table.cmi runtime/table.mli -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I runtime -I main -I syntax -I text -I binary -I exec -I script -I util -I host -I valid -o runtime/instance.cmo runtime/instance.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/eval.cmi exec/eval.mli -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I binary -I main -I syntax -I text -I exec -I script -I runtime -I util -I host -I valid -o binary/utf8.cmi binary/utf8.mli -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I host -I main -I syntax -I text -I binary -I exec -I script -I runtime -I util -I valid -o host/env.cmo host/env.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I main -I syntax -I text -I binary -I exec -I script -I runtime -I util -I host -I valid -o main/flags.cmo main/flags.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I script -I main -I syntax -I text -I binary -I exec -I runtime -I util -I host -I valid -o script/import.cmi script/import.mli -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I script -I main -I syntax -I text -I binary -I exec -I runtime -I util -I host -I valid -o script/run.cmi script/run.mli -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I host -I main -I syntax -I text -I binary -I exec -I script -I runtime -I util -I valid -o host/spectest.cmo host/spectest.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I main -I syntax -I text -I binary -I exec -I script -I runtime -I util -I host -I valid -o main/main.cmo main/main.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I util -I main -I syntax -I text -I binary -I exec -I script -I runtime -I host -I valid -o util/error.cmi util/error.mli -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I script -I main -I syntax -I text -I binary -I exec -I runtime -I util -I host -I valid -o script/script.cmo script/script.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I binary -I main -I syntax -I text -I exec -I script -I runtime -I util -I host -I valid -o binary/decode.cmi binary/decode.mli -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I binary -I main -I syntax -I text -I exec -I script -I runtime -I util -I host -I valid -o binary/encode.cmi binary/encode.mli -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I script -I main -I syntax -I text -I binary -I exec -I runtime -I util -I host -I valid -o script/js.cmi script/js.mli -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I text -I main -I syntax -I binary -I exec -I script -I runtime -I util -I host -I valid -o text/parse.cmi text/parse.mli -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I text -I main -I syntax -I binary -I exec -I script -I runtime -I util -I host -I valid -o text/print.cmi text/print.mli -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I valid -I main -I syntax -I text -I binary -I exec -I script -I runtime -I util -I host -o valid/valid.cmi valid/valid.mli -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I script -I main -I syntax -I text -I binary -I exec -I runtime -I util -I host -I valid -o script/import.cmo script/import.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I script -I main -I syntax -I text -I binary -I exec -I runtime -I util -I host -I valid -o script/run.cmo script/run.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I binary -I main -I syntax -I text -I exec -I script -I runtime -I util -I host -I valid -o binary/utf8.cmo binary/utf8.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/eval_numeric.cmi exec/eval_numeric.mli -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/i64_convert.cmi exec/i64_convert.mli -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/eval.cmo exec/eval.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I runtime -I main -I syntax -I text -I binary -I exec -I script -I util -I host -I valid -o runtime/func.cmo runtime/func.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I util -I main -I syntax -I text -I binary -I exec -I script -I runtime -I host -I valid -o util/source.cmo util/source.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/f32_convert.cmi exec/f32_convert.mli -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/f64_convert.cmi exec/f64_convert.mli -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/i32_convert.cmi exec/i32_convert.mli -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I util -I main -I syntax -I text -I binary -I exec -I script -I runtime -I host -I valid -o util/error.cmo util/error.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/eval_numeric.cmo exec/eval_numeric.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I runtime -I main -I syntax -I text -I binary -I exec -I script -I util -I host -I valid -o runtime/global.cmo runtime/global.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/i64_convert.cmo exec/i64_convert.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I util -I main -I syntax -I text -I binary -I exec -I script -I runtime -I host -I valid -o util/lib.cmo util/lib.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I runtime -I main -I syntax -I text -I binary -I exec -I script -I util -I host -I valid -o runtime/memory.cmo runtime/memory.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I runtime -I main -I syntax -I text -I binary -I exec -I script -I util -I host -I valid -o runtime/table.cmo runtime/table.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/f32_convert.cmo exec/f32_convert.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/f64_convert.cmo exec/f64_convert.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/i32_convert.cmo exec/i32_convert.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I syntax -I main -I text -I binary -I exec -I script -I runtime -I util -I host -I valid -o syntax/operators.cmo syntax/operators.ml -ocamlyacc text/parser.mly -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I text -I main -I syntax -I binary -I exec -I script -I runtime -I util -I host -I valid -o text/parser.cmi text/parser.mli -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I text -I main -I syntax -I binary -I exec -I script -I runtime -I util -I host -I valid -o text/lexer.cmi text/lexer.mli -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I util -I main -I syntax -I text -I binary -I exec -I script -I runtime -I host -I valid -o util/sexpr.cmi util/sexpr.mli -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I text -I main -I syntax -I binary -I exec -I script -I runtime -I util -I host -I valid -o text/arrange.cmi text/arrange.mli -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I binary -I main -I syntax -I text -I exec -I script -I runtime -I util -I host -I valid -o binary/decode.cmo binary/decode.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I binary -I main -I syntax -I text -I exec -I script -I runtime -I util -I host -I valid -o binary/encode.cmo binary/encode.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I script -I main -I syntax -I text -I binary -I exec -I runtime -I util -I host -I valid -o script/js.cmo script/js.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I text -I main -I syntax -I binary -I exec -I script -I runtime -I util -I host -I valid -o text/parse.cmo text/parse.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I text -I main -I syntax -I binary -I exec -I script -I runtime -I util -I host -I valid -o text/print.cmo text/print.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I valid -I main -I syntax -I text -I binary -I exec -I script -I runtime -I util -I host -o valid/valid.cmo valid/valid.ml -ocamllex.opt -q text/lexer.mll -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I text -I main -I syntax -I binary -I exec -I script -I runtime -I util -I host -I valid -o text/lexer.cmo text/lexer.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I text -I main -I syntax -I binary -I exec -I script -I runtime -I util -I host -I valid -o text/parser.cmo text/parser.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I text -I main -I syntax -I binary -I exec -I script -I runtime -I util -I host -I valid -o text/arrange.cmo text/arrange.ml -ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I util -I main -I syntax -I text -I binary -I exec -I script -I runtime -I host -I valid -o util/sexpr.cmo util/sexpr.ml -ocamlc.opt bigarray.cma -I util -I binary -I exec -I syntax -I runtime -I host -I main -I script -I text -I valid util/lib.cmo binary/utf8.cmo exec/float.cmo exec/f32.cmo exec/f64.cmo exec/numeric_error.cmo exec/int.cmo exec/i32.cmo exec/i64.cmo exec/i32_convert.cmo exec/f32_convert.cmo exec/i64_convert.cmo exec/f64_convert.cmo syntax/types.cmo syntax/values.cmo runtime/memory.cmo util/source.cmo syntax/ast.cmo exec/eval_numeric.cmo runtime/func.cmo runtime/global.cmo runtime/table.cmo runtime/instance.cmo util/error.cmo exec/eval.cmo host/env.cmo host/spectest.cmo main/flags.cmo script/import.cmo binary/encode.cmo syntax/operators.cmo binary/decode.cmo script/script.cmo text/parser.cmo text/lexer.cmo text/parse.cmo script/js.cmo util/sexpr.cmo text/arrange.cmo text/print.cmo valid/valid.cmo script/run.cmo main/main.cmo -o main/main.byte +dune build main/main.byte