Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions interpreter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,27 +164,29 @@ instr:
op:
unreachable
nop
drop
select
br <var>
br_if <var>
br_table <var>+
return
call <var>
call_indirect <var>
drop
select
get_local <var>
set_local <var>
tee_local <var>
get_global <var>
set_global <var>
<type>.load((8|16|32)_<sign>)? <offset>? <align>?
<type>.store(8|16|32)? <offset>? <align>?
current_memory
grow_memory
<type>.const <value>
<type>.<unop>
<type>.<binop>
<type>.<testop>
<type>.<relop>
<type>.<cvtop>/<type>
<type>.load((8|16|32)_<sign>)? <offset>? <align>?
<type>.store(8|16|32)? <offset>? <align>?
current_memory
grow_memory

func: ( func <name>? <func_sig> <local>* <instr>* )
( func <name>? ( export <string> ) <func_sig> <local>* <instrr>* ) ;; = (export <string> (func <N>) (func <name>? <func_sig> <local>* <instr>*)
Expand Down
4 changes: 2 additions & 2 deletions interpreter/host/main.ml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
let name = "wasm"
let version = "0.5"
let version = "0.6"

let configure () =
Import.register "spectest" Spectest.lookup;
Import.register "env" Env.lookup

let banner () =
print_endline
(name ^ "-" ^ Printf.sprintf "0x%02lx" Encode.version ^
(name ^ "-" ^ Printf.sprintf "0x%lX" Encode.version ^
" " ^ version ^ " reference interpreter")

let usage = "Usage: " ^ name ^ " [option] [file ...]"
Expand Down
18 changes: 9 additions & 9 deletions interpreter/spec/ast.ml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct
type binop = Add | Sub | Mul | DivS | DivU | RemS | RemU
| And | Or | Xor | Shl | ShrS | ShrU | Rotl | Rotr
type testop = Eqz
type relop = Eq | Ne | LtS | LtU | LeS | LeU | GtS | GtU | GeS | GeU
type relop = Eq | Ne | LtS | LtU | GtS | GtU | LeS | LeU | GeS | GeU
type cvtop = ExtendSI32 | ExtendUI32 | WrapI64
| TruncSF32 | TruncUF32 | TruncSF64 | TruncUF64
| ReinterpretFloat
Expand All @@ -38,7 +38,7 @@ struct
type unop = Neg | Abs | Ceil | Floor | Trunc | Nearest | Sqrt
type binop = Add | Sub | Mul | Div | Min | Max | CopySign
type testop
type relop = Eq | Ne | Lt | Le | Gt | Ge
type relop = Eq | Ne | Lt | Gt | Le | Ge
type cvtop = ConvertSI32 | ConvertUI32 | ConvertSI64 | ConvertUI64
| PromoteF32 | DemoteF64
| ReinterpretInt
Expand Down Expand Up @@ -70,32 +70,32 @@ type instr = instr' Source.phrase
and instr' =
| Unreachable (* trap unconditionally *)
| Nop (* do nothing *)
| Drop (* forget a value *)
| Select (* branchless conditional *)
| Block of stack_type * instr list (* execute in sequence *)
| Loop of stack_type * instr list (* loop header *)
| If of stack_type * instr list * instr list (* conditional *)
| Br of var (* break to n-th surrounding label *)
| BrIf of var (* conditional break *)
| BrTable of var list * var (* indexed break *)
| Return (* break from function body *)
| If of stack_type * instr list * instr list (* conditional *)
| Call of var (* call function *)
| CallIndirect of var (* call function through table *)
| Drop (* forget a value *)
| Select (* branchless conditional *)
| GetLocal of var (* read local variable *)
| SetLocal of var (* write local variable *)
| TeeLocal of var (* write local variable and keep value *)
| GetGlobal of var (* read global variable *)
| SetGlobal of var (* write global variable *)
| Load of loadop (* read memory at address *)
| Store of storeop (* write memory at address *)
| CurrentMemory (* size of linear memory *)
| GrowMemory (* grow linear memory *)
| Const of literal (* constant *)
| Unary of unop (* unary numeric operator *)
| Binary of binop (* binary numeric operator *)
| Test of testop (* numeric test *)
| Compare of relop (* numeric comparison *)
| Unary of unop (* unary numeric operator *)
| Binary of binop (* binary numeric operator *)
| Convert of cvtop (* conversion *)
| CurrentMemory (* size of linear memory *)
| GrowMemory (* grow linear memory *)


(* Globals & Functions *)
Expand Down
Loading