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
3 changes: 1 addition & 2 deletions interpreter/exec/eval.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1122,8 +1122,7 @@ let rec step (c : config) : config =
| Func.AstFunc (_, inst', func) ->
let Func (_x, ls, es) = func.it in
let m = Lib.Promise.value inst' in
let s = subst_of m in
let ts = List.map (fun {it = Local t; _} -> subst_valtype s t) ls in
let ts = List.map (fun {it = Local t; _} -> t) ls in
let lvs = List.(rev (map Option.some args) @ map default_value ts) in
let frame' = {inst = m; locals = List.map ref lvs} in
let instr' = [Label (n2, [], ([], List.map plain es)) @@ func.at] in
Expand Down
16 changes: 5 additions & 11 deletions specification/wasm-3.0/4.2-execution.types.spectec
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,8 @@ def $inst_globaltype(moduleinst, globaltype) : globaltype hint(show $inst_(%,%)
def $inst_memtype(moduleinst, memtype) : memtype hint(show $inst_(%,%)) hint(macro "insttype")
def $inst_tabletype(moduleinst, tabletype) : tabletype hint(show $inst_(%,%)) hint(macro "insttype")

;; TODO(3, rossberg): make inlining moduleinst.TYPES work
def $inst_valtype(moduleinst, t) = $subst_all_valtype(t, dt*)
-- if dt* = moduleinst.TYPES
def $inst_reftype(moduleinst, rt) = $subst_all_reftype(rt, dt*)
-- if dt* = moduleinst.TYPES
def $inst_globaltype(moduleinst, gt) = $subst_all_globaltype(gt, dt*)
-- if dt* = moduleinst.TYPES
def $inst_memtype(moduleinst, mt) = $subst_all_memtype(mt, dt*)
-- if dt* = moduleinst.TYPES
def $inst_tabletype(moduleinst, tt) = $subst_all_tabletype(tt, dt*)
-- if dt* = moduleinst.TYPES
def $inst_valtype(moduleinst, t) = $subst_all_valtype(t, moduleinst.TYPES)
def $inst_reftype(moduleinst, rt) = $subst_all_reftype(rt, moduleinst.TYPES)
def $inst_globaltype(moduleinst, gt) = $subst_all_globaltype(gt, moduleinst.TYPES)
def $inst_memtype(moduleinst, mt) = $subst_all_memtype(mt, moduleinst.TYPES)
def $inst_tabletype(moduleinst, tt) = $subst_all_tabletype(tt, moduleinst.TYPES)
16 changes: 5 additions & 11 deletions specification/wasm-latest/4.2-execution.types.spectec
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,8 @@ def $inst_globaltype(moduleinst, globaltype) : globaltype hint(show $inst_(%,%)
def $inst_memtype(moduleinst, memtype) : memtype hint(show $inst_(%,%)) hint(macro "insttype")
def $inst_tabletype(moduleinst, tabletype) : tabletype hint(show $inst_(%,%)) hint(macro "insttype")

;; TODO(3, rossberg): make inlining moduleinst.TYPES work
def $inst_valtype(moduleinst, t) = $subst_all_valtype(t, dt*)
-- if dt* = moduleinst.TYPES
def $inst_reftype(moduleinst, rt) = $subst_all_reftype(rt, dt*)
-- if dt* = moduleinst.TYPES
def $inst_globaltype(moduleinst, gt) = $subst_all_globaltype(gt, dt*)
-- if dt* = moduleinst.TYPES
def $inst_memtype(moduleinst, mt) = $subst_all_memtype(mt, dt*)
-- if dt* = moduleinst.TYPES
def $inst_tabletype(moduleinst, tt) = $subst_all_tabletype(tt, dt*)
-- if dt* = moduleinst.TYPES
def $inst_valtype(moduleinst, t) = $subst_all_valtype(t, moduleinst.TYPES)
def $inst_reftype(moduleinst, rt) = $subst_all_reftype(rt, moduleinst.TYPES)
def $inst_globaltype(moduleinst, gt) = $subst_all_globaltype(gt, moduleinst.TYPES)
def $inst_memtype(moduleinst, mt) = $subst_all_memtype(mt, moduleinst.TYPES)
def $inst_tabletype(moduleinst, tt) = $subst_all_tabletype(tt, moduleinst.TYPES)
Binary file modified spectec/doc/example/output/NanoWasm.pdf
Binary file not shown.
15 changes: 5 additions & 10 deletions spectec/test-frontend/TEST.md
Original file line number Diff line number Diff line change
Expand Up @@ -5955,32 +5955,27 @@ relation Externaddr_ok: `%|-%:%`(store, externaddr, externtype)
;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_valtype(moduleinst : moduleinst, valtype : valtype) : valtype
;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_valtype{moduleinst : moduleinst, t : valtype, `dt*` : deftype*}(moduleinst, t) = $subst_all_valtype(t, (dt : deftype <: typeuse)*{dt <- `dt*`})
-- if (dt*{dt <- `dt*`} = moduleinst.TYPES_moduleinst)
def $inst_valtype{moduleinst : moduleinst, t : valtype}(moduleinst, t) = $subst_all_valtype(t, (moduleinst.TYPES_moduleinst : deftype* <: typeuse*))

;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_reftype(moduleinst : moduleinst, reftype : reftype) : reftype
;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_reftype{moduleinst : moduleinst, rt : reftype, `dt*` : deftype*}(moduleinst, rt) = $subst_all_reftype(rt, (dt : deftype <: typeuse)*{dt <- `dt*`})
-- if (dt*{dt <- `dt*`} = moduleinst.TYPES_moduleinst)
def $inst_reftype{moduleinst : moduleinst, rt : reftype}(moduleinst, rt) = $subst_all_reftype(rt, (moduleinst.TYPES_moduleinst : deftype* <: typeuse*))

;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_globaltype(moduleinst : moduleinst, globaltype : globaltype) : globaltype
;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_globaltype{moduleinst : moduleinst, gt : globaltype, `dt*` : deftype*}(moduleinst, gt) = $subst_all_globaltype(gt, (dt : deftype <: typeuse)*{dt <- `dt*`})
-- if (dt*{dt <- `dt*`} = moduleinst.TYPES_moduleinst)
def $inst_globaltype{moduleinst : moduleinst, gt : globaltype}(moduleinst, gt) = $subst_all_globaltype(gt, (moduleinst.TYPES_moduleinst : deftype* <: typeuse*))

;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_memtype(moduleinst : moduleinst, memtype : memtype) : memtype
;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_memtype{moduleinst : moduleinst, mt : memtype, `dt*` : deftype*}(moduleinst, mt) = $subst_all_memtype(mt, (dt : deftype <: typeuse)*{dt <- `dt*`})
-- if (dt*{dt <- `dt*`} = moduleinst.TYPES_moduleinst)
def $inst_memtype{moduleinst : moduleinst, mt : memtype}(moduleinst, mt) = $subst_all_memtype(mt, (moduleinst.TYPES_moduleinst : deftype* <: typeuse*))

;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_tabletype(moduleinst : moduleinst, tabletype : tabletype) : tabletype
;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_tabletype{moduleinst : moduleinst, tt : tabletype, `dt*` : deftype*}(moduleinst, tt) = $subst_all_tabletype(tt, (dt : deftype <: typeuse)*{dt <- `dt*`})
-- if (dt*{dt <- `dt*`} = moduleinst.TYPES_moduleinst)
def $inst_tabletype{moduleinst : moduleinst, tt : tabletype}(moduleinst, tt) = $subst_all_tabletype(tt, (moduleinst.TYPES_moduleinst : deftype* <: typeuse*))

;; ../../../../specification/wasm-latest/4.3-execution.instructions.spectec
relation Step_pure: `%~>%`(instr*, instr*)
Expand Down
10 changes: 5 additions & 5 deletions spectec/test-latex/TEST.md
Original file line number Diff line number Diff line change
Expand Up @@ -9608,31 +9608,31 @@ $$

$$
\begin{array}[t]{@{}lcl@{}l@{}}
{{\mathrm{inst}}}_{{\mathit{moduleinst}}}(t) & = & {t}{{}[ {:=}\, {{\mathit{dt}}^\ast} ]} & \quad \mbox{if}~ {{\mathit{dt}}^\ast} = {\mathit{moduleinst}}{.}\mathsf{types} \\
{{\mathrm{inst}}}_{{\mathit{moduleinst}}}(t) & = & {t}{{}[ {:=}\, {\mathit{moduleinst}}{.}\mathsf{types} ]} \\
\end{array}
$$

$$
\begin{array}[t]{@{}lcl@{}l@{}}
{{\mathrm{inst}}}_{{\mathit{moduleinst}}}({\mathit{rt}}) & = & {{\mathit{rt}}}{{}[ {:=}\, {{\mathit{dt}}^\ast} ]} & \quad \mbox{if}~ {{\mathit{dt}}^\ast} = {\mathit{moduleinst}}{.}\mathsf{types} \\
{{\mathrm{inst}}}_{{\mathit{moduleinst}}}({\mathit{rt}}) & = & {{\mathit{rt}}}{{}[ {:=}\, {\mathit{moduleinst}}{.}\mathsf{types} ]} \\
\end{array}
$$

$$
\begin{array}[t]{@{}lcl@{}l@{}}
{{\mathrm{inst}}}_{{\mathit{moduleinst}}}({\mathit{gt}}) & = & {{\mathit{gt}}}{{}[ {:=}\, {{\mathit{dt}}^\ast} ]} & \quad \mbox{if}~ {{\mathit{dt}}^\ast} = {\mathit{moduleinst}}{.}\mathsf{types} \\
{{\mathrm{inst}}}_{{\mathit{moduleinst}}}({\mathit{gt}}) & = & {{\mathit{gt}}}{{}[ {:=}\, {\mathit{moduleinst}}{.}\mathsf{types} ]} \\
\end{array}
$$

$$
\begin{array}[t]{@{}lcl@{}l@{}}
{{\mathrm{inst}}}_{{\mathit{moduleinst}}}({\mathit{mt}}) & = & {{\mathit{mt}}}{{}[ {:=}\, {{\mathit{dt}}^\ast} ]} & \quad \mbox{if}~ {{\mathit{dt}}^\ast} = {\mathit{moduleinst}}{.}\mathsf{types} \\
{{\mathrm{inst}}}_{{\mathit{moduleinst}}}({\mathit{mt}}) & = & {{\mathit{mt}}}{{}[ {:=}\, {\mathit{moduleinst}}{.}\mathsf{types} ]} \\
\end{array}
$$

$$
\begin{array}[t]{@{}lcl@{}l@{}}
{{\mathrm{inst}}}_{{\mathit{moduleinst}}}({\mathit{tt}}) & = & {{\mathit{tt}}}{{}[ {:=}\, {{\mathit{dt}}^\ast} ]} & \quad \mbox{if}~ {{\mathit{dt}}^\ast} = {\mathit{moduleinst}}{.}\mathsf{types} \\
{{\mathrm{inst}}}_{{\mathit{moduleinst}}}({\mathit{tt}}) & = & {{\mathit{tt}}}{{}[ {:=}\, {\mathit{moduleinst}}{.}\mathsf{types} ]} \\
\end{array}
$$

Expand Down
45 changes: 15 additions & 30 deletions spectec/test-middlend/TEST.md
Original file line number Diff line number Diff line change
Expand Up @@ -5945,32 +5945,27 @@ relation Externaddr_ok: `%|-%:%`(store, externaddr, externtype)
;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_valtype(moduleinst : moduleinst, valtype : valtype) : valtype
;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_valtype{moduleinst : moduleinst, t : valtype, `dt*` : deftype*}(moduleinst, t) = $subst_all_valtype(t, (dt : deftype <: typeuse)*{dt <- `dt*`})
-- if (dt*{dt <- `dt*`} = moduleinst.TYPES_moduleinst)
def $inst_valtype{moduleinst : moduleinst, t : valtype}(moduleinst, t) = $subst_all_valtype(t, (moduleinst.TYPES_moduleinst : deftype* <: typeuse*))

;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_reftype(moduleinst : moduleinst, reftype : reftype) : reftype
;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_reftype{moduleinst : moduleinst, rt : reftype, `dt*` : deftype*}(moduleinst, rt) = $subst_all_reftype(rt, (dt : deftype <: typeuse)*{dt <- `dt*`})
-- if (dt*{dt <- `dt*`} = moduleinst.TYPES_moduleinst)
def $inst_reftype{moduleinst : moduleinst, rt : reftype}(moduleinst, rt) = $subst_all_reftype(rt, (moduleinst.TYPES_moduleinst : deftype* <: typeuse*))

;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_globaltype(moduleinst : moduleinst, globaltype : globaltype) : globaltype
;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_globaltype{moduleinst : moduleinst, gt : globaltype, `dt*` : deftype*}(moduleinst, gt) = $subst_all_globaltype(gt, (dt : deftype <: typeuse)*{dt <- `dt*`})
-- if (dt*{dt <- `dt*`} = moduleinst.TYPES_moduleinst)
def $inst_globaltype{moduleinst : moduleinst, gt : globaltype}(moduleinst, gt) = $subst_all_globaltype(gt, (moduleinst.TYPES_moduleinst : deftype* <: typeuse*))

;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_memtype(moduleinst : moduleinst, memtype : memtype) : memtype
;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_memtype{moduleinst : moduleinst, mt : memtype, `dt*` : deftype*}(moduleinst, mt) = $subst_all_memtype(mt, (dt : deftype <: typeuse)*{dt <- `dt*`})
-- if (dt*{dt <- `dt*`} = moduleinst.TYPES_moduleinst)
def $inst_memtype{moduleinst : moduleinst, mt : memtype}(moduleinst, mt) = $subst_all_memtype(mt, (moduleinst.TYPES_moduleinst : deftype* <: typeuse*))

;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_tabletype(moduleinst : moduleinst, tabletype : tabletype) : tabletype
;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_tabletype{moduleinst : moduleinst, tt : tabletype, `dt*` : deftype*}(moduleinst, tt) = $subst_all_tabletype(tt, (dt : deftype <: typeuse)*{dt <- `dt*`})
-- if (dt*{dt <- `dt*`} = moduleinst.TYPES_moduleinst)
def $inst_tabletype{moduleinst : moduleinst, tt : tabletype}(moduleinst, tt) = $subst_all_tabletype(tt, (moduleinst.TYPES_moduleinst : deftype* <: typeuse*))

;; ../../../../specification/wasm-latest/4.3-execution.instructions.spectec
relation Step_pure: `%~>%`(instr*, instr*)
Expand Down Expand Up @@ -17371,32 +17366,27 @@ relation Externaddr_ok: `%|-%:%`(store, externaddr, externtype)
;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_valtype(moduleinst : moduleinst, valtype : valtype) : valtype
;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_valtype{moduleinst : moduleinst, t : valtype, `dt*` : deftype*}(moduleinst, t) = $subst_all_valtype(t, (dt : deftype <: typeuse)*{dt <- `dt*`})
-- if (dt*{dt <- `dt*`} = moduleinst.TYPES_moduleinst)
def $inst_valtype{moduleinst : moduleinst, t : valtype}(moduleinst, t) = $subst_all_valtype(t, (moduleinst.TYPES_moduleinst : deftype* <: typeuse*))

;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_reftype(moduleinst : moduleinst, reftype : reftype) : reftype
;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_reftype{moduleinst : moduleinst, rt : reftype, `dt*` : deftype*}(moduleinst, rt) = $subst_all_reftype(rt, (dt : deftype <: typeuse)*{dt <- `dt*`})
-- if (dt*{dt <- `dt*`} = moduleinst.TYPES_moduleinst)
def $inst_reftype{moduleinst : moduleinst, rt : reftype}(moduleinst, rt) = $subst_all_reftype(rt, (moduleinst.TYPES_moduleinst : deftype* <: typeuse*))

;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_globaltype(moduleinst : moduleinst, globaltype : globaltype) : globaltype
;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_globaltype{moduleinst : moduleinst, gt : globaltype, `dt*` : deftype*}(moduleinst, gt) = $subst_all_globaltype(gt, (dt : deftype <: typeuse)*{dt <- `dt*`})
-- if (dt*{dt <- `dt*`} = moduleinst.TYPES_moduleinst)
def $inst_globaltype{moduleinst : moduleinst, gt : globaltype}(moduleinst, gt) = $subst_all_globaltype(gt, (moduleinst.TYPES_moduleinst : deftype* <: typeuse*))

;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_memtype(moduleinst : moduleinst, memtype : memtype) : memtype
;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_memtype{moduleinst : moduleinst, mt : memtype, `dt*` : deftype*}(moduleinst, mt) = $subst_all_memtype(mt, (dt : deftype <: typeuse)*{dt <- `dt*`})
-- if (dt*{dt <- `dt*`} = moduleinst.TYPES_moduleinst)
def $inst_memtype{moduleinst : moduleinst, mt : memtype}(moduleinst, mt) = $subst_all_memtype(mt, (moduleinst.TYPES_moduleinst : deftype* <: typeuse*))

;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_tabletype(moduleinst : moduleinst, tabletype : tabletype) : tabletype
;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_tabletype{moduleinst : moduleinst, tt : tabletype, `dt*` : deftype*}(moduleinst, tt) = $subst_all_tabletype(tt, (dt : deftype <: typeuse)*{dt <- `dt*`})
-- if (dt*{dt <- `dt*`} = moduleinst.TYPES_moduleinst)
def $inst_tabletype{moduleinst : moduleinst, tt : tabletype}(moduleinst, tt) = $subst_all_tabletype(tt, (moduleinst.TYPES_moduleinst : deftype* <: typeuse*))

;; ../../../../specification/wasm-latest/4.3-execution.instructions.spectec
relation Step_pure: `%~>%`(instr*, instr*)
Expand Down Expand Up @@ -28930,32 +28920,27 @@ relation Externaddr_ok: `%|-%:%`(store, externaddr, externtype)
;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_valtype(moduleinst : moduleinst, valtype : valtype) : valtype
;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_valtype{moduleinst : moduleinst, t : valtype, `dt*` : deftype*}(moduleinst, t) = $subst_all_valtype(t, (dt : deftype <: typeuse)*{dt <- `dt*`})
-- if (dt*{dt <- `dt*`} = moduleinst.TYPES_moduleinst)
def $inst_valtype{moduleinst : moduleinst, t : valtype}(moduleinst, t) = $subst_all_valtype(t, (moduleinst.TYPES_moduleinst : deftype* <: typeuse*))

;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_reftype(moduleinst : moduleinst, reftype : reftype) : reftype
;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_reftype{moduleinst : moduleinst, rt : reftype, `dt*` : deftype*}(moduleinst, rt) = $subst_all_reftype(rt, (dt : deftype <: typeuse)*{dt <- `dt*`})
-- if (dt*{dt <- `dt*`} = moduleinst.TYPES_moduleinst)
def $inst_reftype{moduleinst : moduleinst, rt : reftype}(moduleinst, rt) = $subst_all_reftype(rt, (moduleinst.TYPES_moduleinst : deftype* <: typeuse*))

;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_globaltype(moduleinst : moduleinst, globaltype : globaltype) : globaltype
;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_globaltype{moduleinst : moduleinst, gt : globaltype, `dt*` : deftype*}(moduleinst, gt) = $subst_all_globaltype(gt, (dt : deftype <: typeuse)*{dt <- `dt*`})
-- if (dt*{dt <- `dt*`} = moduleinst.TYPES_moduleinst)
def $inst_globaltype{moduleinst : moduleinst, gt : globaltype}(moduleinst, gt) = $subst_all_globaltype(gt, (moduleinst.TYPES_moduleinst : deftype* <: typeuse*))

;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_memtype(moduleinst : moduleinst, memtype : memtype) : memtype
;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_memtype{moduleinst : moduleinst, mt : memtype, `dt*` : deftype*}(moduleinst, mt) = $subst_all_memtype(mt, (dt : deftype <: typeuse)*{dt <- `dt*`})
-- if (dt*{dt <- `dt*`} = moduleinst.TYPES_moduleinst)
def $inst_memtype{moduleinst : moduleinst, mt : memtype}(moduleinst, mt) = $subst_all_memtype(mt, (moduleinst.TYPES_moduleinst : deftype* <: typeuse*))

;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_tabletype(moduleinst : moduleinst, tabletype : tabletype) : tabletype
;; ../../../../specification/wasm-latest/4.2-execution.types.spectec
def $inst_tabletype{moduleinst : moduleinst, tt : tabletype, `dt*` : deftype*}(moduleinst, tt) = $subst_all_tabletype(tt, (dt : deftype <: typeuse)*{dt <- `dt*`})
-- if (dt*{dt <- `dt*`} = moduleinst.TYPES_moduleinst)
def $inst_tabletype{moduleinst : moduleinst, tt : tabletype}(moduleinst, tt) = $subst_all_tabletype(tt, (moduleinst.TYPES_moduleinst : deftype* <: typeuse*))

;; ../../../../specification/wasm-latest/4.3-execution.instructions.spectec
relation Step_pure: `%~>%`(instr*, instr*)
Expand Down
Loading
Loading