Skip to content

Commit 8a2a75c

Browse files
committed
[spec] Add missing conventions
1 parent fe509ca commit 8a2a75c

6 files changed

Lines changed: 127 additions & 125 deletions

File tree

‎document/core/exec/runtime.rst‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,11 @@ Conventions
655655

656656
* The following shorthands are defined for accessing a state ${:z = (s; f)}:
657657

658+
- ${definition: moduleinst}
659+
- ${definition: funcinst}
660+
- ${definition: structinst}
661+
- ${definition: arrayinst}
662+
- ${definition: exninst}
658663
- ${definition: type}
659664
- ${definition: tag}
660665
- ${definition: global}

‎specification/wasm-3.0/4.0-execution.configurations.spectec‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,12 @@ def $frame(state) : frame hint(show %.FRAME) hint(macro "Z%")
222222
def $store((s; f)) = s
223223
def $frame((s; f)) = f
224224

225+
def $sof(state) : store hint(show s)
226+
def $fof(state) : frame hint(show f)
227+
228+
def $sof(z) = $store(z)
229+
def $fof(z) = $frame(z)
230+
225231
def $tagaddr(state) : tagaddr* hint(show %.MODULE.TAGS) hint(macro "Z%")
226232
def $tagaddr((s; f)) = f.MODULE.TAGS
227233

@@ -237,17 +243,17 @@ def $structinst(state) : structinst* hint(show %.STRUCTS) hint(macro "Z%")
237243
def $arrayinst(state) : arrayinst* hint(show %.ARRAYS) hint(macro "Z%")
238244
def $exninst(state) : exninst* hint(show %.EXNS) hint(macro "Z%")
239245

240-
def $moduleinst((s; f)) = f.MODULE
241-
def $taginst((s; f)) = s.TAGS
242-
def $globalinst((s; f)) = s.GLOBALS
243-
def $meminst((s; f)) = s.MEMS
244-
def $tableinst((s; f)) = s.TABLES
245-
def $funcinst((s; f)) = s.FUNCS
246-
def $datainst((s; f)) = s.DATAS
247-
def $eleminst((s; f)) = s.ELEMS
248-
def $structinst((s; f)) = s.STRUCTS
249-
def $arrayinst((s; f)) = s.ARRAYS
250-
def $exninst((s; f)) = s.EXNS
246+
def $moduleinst(z) = $fof(z).MODULE
247+
def $taginst(z) = $sof(z).TAGS
248+
def $globalinst(z) = $sof(z).GLOBALS
249+
def $meminst(z) = $sof(z).MEMS
250+
def $tableinst(z) = $sof(z).TABLES
251+
def $funcinst(z) = $sof(z).FUNCS
252+
def $datainst(z) = $sof(z).DATAS
253+
def $eleminst(z) = $sof(z).ELEMS
254+
def $structinst(z) = $sof(z).STRUCTS
255+
def $arrayinst(z) = $sof(z).ARRAYS
256+
def $exninst(z) = $sof(z).EXNS
251257

252258

253259
def $type(state, typeidx) : deftype hint(show %.TYPES[%]) hint(macro "Z%")
@@ -260,12 +266,6 @@ def $data(state, dataidx) : datainst hint(show %.DATAS[%]) hint(macro "
260266
def $elem(state, tableidx) : eleminst hint(show %.ELEMS[%]) hint(macro "Z%")
261267
def $local(state, localidx) : val? hint(show %.LOCALS[%]) hint(macro "Z%")
262268

263-
def $sof(state) : store hint(show s)
264-
def $fof(state) : frame hint(show f)
265-
266-
def $sof(z) = $store(z)
267-
def $fof(z) = $frame(z)
268-
269269
def $type(z, x) = $fof(z).MODULE.TYPES[x]
270270
def $tag(z, x) = $sof(z).TAGS[$fof(z).MODULE.TAGS[x]]
271271
def $global(z, x) = $sof(z).GLOBALS[$fof(z).MODULE.GLOBALS[x]]

‎specification/wasm-3.0/4.3-execution.instructions.spectec‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,15 +184,15 @@ rule Step/call_ref-func:
184184
rule Step/call_ref-hostfunc-res:
185185
s; f; val^n (REF.FUNC_ADDR a) (CALL_REF yy) ~> s'; f; $lift_result(result)
186186
----
187-
-- if $funcinst((s; f))[a] = fi
187+
-- if s.FUNCS[a] = fi
188188
-- Expand: fi.TYPE ~~ FUNC t_1^n -> t_2^m
189189
-- if fi.CODE = _HOSTFUNC hf
190190
-- if RES s' result <- $hostcall(_HOSTFUNC hf, s, val^n)
191191

192192
rule Step/call_ref-hostfunc-div:
193193
s; f; val^n (REF.FUNC_ADDR a) (CALL_REF yy) ~> s; f; val^n (REF.FUNC_ADDR a) (CALL_REF yy)
194194
----
195-
-- if $funcinst((s; f))[a] = fi
195+
-- if s.FUNCS[a] = fi
196196
-- Expand: fi.TYPE ~~ FUNC t_1^n -> t_2^m
197197
-- if fi.CODE = _HOSTFUNC hf
198198
-- if BOT <- $hostcall(_HOSTFUNC hf, s, val^n)

‎specification/wasm-latest/4.0-execution.configurations.spectec‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,12 @@ def $frame(state) : frame hint(show %.FRAME) hint(macro "Z%")
222222
def $store((s; f)) = s
223223
def $frame((s; f)) = f
224224

225+
def $sof(state) : store hint(show s)
226+
def $fof(state) : frame hint(show f)
227+
228+
def $sof(z) = $store(z)
229+
def $fof(z) = $frame(z)
230+
225231
def $tagaddr(state) : tagaddr* hint(show %.MODULE.TAGS) hint(macro "Z%")
226232
def $tagaddr((s; f)) = f.MODULE.TAGS
227233

@@ -237,17 +243,17 @@ def $structinst(state) : structinst* hint(show %.STRUCTS) hint(macro "Z%")
237243
def $arrayinst(state) : arrayinst* hint(show %.ARRAYS) hint(macro "Z%")
238244
def $exninst(state) : exninst* hint(show %.EXNS) hint(macro "Z%")
239245

240-
def $moduleinst((s; f)) = f.MODULE
241-
def $taginst((s; f)) = s.TAGS
242-
def $globalinst((s; f)) = s.GLOBALS
243-
def $meminst((s; f)) = s.MEMS
244-
def $tableinst((s; f)) = s.TABLES
245-
def $funcinst((s; f)) = s.FUNCS
246-
def $datainst((s; f)) = s.DATAS
247-
def $eleminst((s; f)) = s.ELEMS
248-
def $structinst((s; f)) = s.STRUCTS
249-
def $arrayinst((s; f)) = s.ARRAYS
250-
def $exninst((s; f)) = s.EXNS
246+
def $moduleinst(z) = $fof(z).MODULE
247+
def $taginst(z) = $sof(z).TAGS
248+
def $globalinst(z) = $sof(z).GLOBALS
249+
def $meminst(z) = $sof(z).MEMS
250+
def $tableinst(z) = $sof(z).TABLES
251+
def $funcinst(z) = $sof(z).FUNCS
252+
def $datainst(z) = $sof(z).DATAS
253+
def $eleminst(z) = $sof(z).ELEMS
254+
def $structinst(z) = $sof(z).STRUCTS
255+
def $arrayinst(z) = $sof(z).ARRAYS
256+
def $exninst(z) = $sof(z).EXNS
251257

252258

253259
def $type(state, typeidx) : deftype hint(show %.TYPES[%]) hint(macro "Z%")
@@ -260,12 +266,6 @@ def $data(state, dataidx) : datainst hint(show %.DATAS[%]) hint(macro "
260266
def $elem(state, tableidx) : eleminst hint(show %.ELEMS[%]) hint(macro "Z%")
261267
def $local(state, localidx) : val? hint(show %.LOCALS[%]) hint(macro "Z%")
262268

263-
def $sof(state) : store hint(show s)
264-
def $fof(state) : frame hint(show f)
265-
266-
def $sof(z) = $store(z)
267-
def $fof(z) = $frame(z)
268-
269269
def $type(z, x) = $fof(z).MODULE.TYPES[x]
270270
def $tag(z, x) = $sof(z).TAGS[$fof(z).MODULE.TAGS[x]]
271271
def $global(z, x) = $sof(z).GLOBALS[$fof(z).MODULE.GLOBALS[x]]

‎specification/wasm-latest/4.3-execution.instructions.spectec‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,15 +184,15 @@ rule Step/call_ref-func:
184184
rule Step/call_ref-hostfunc-res:
185185
s; f; val^n (REF.FUNC_ADDR a) (CALL_REF yy) ~> s'; f; $lift_result(result)
186186
----
187-
-- if $funcinst((s; f))[a] = fi
187+
-- if s.FUNCS[a] = fi
188188
-- Expand: fi.TYPE ~~ FUNC t_1^n -> t_2^m
189189
-- if fi.CODE = _HOSTFUNC hf
190190
-- if RES s' result <- $hostcall(_HOSTFUNC hf, s, val^n)
191191

192192
rule Step/call_ref-hostfunc-div:
193193
s; f; val^n (REF.FUNC_ADDR a) (CALL_REF yy) ~> s; f; val^n (REF.FUNC_ADDR a) (CALL_REF yy)
194194
----
195-
-- if $funcinst((s; f))[a] = fi
195+
-- if s.FUNCS[a] = fi
196196
-- Expand: fi.TYPE ~~ FUNC t_1^n -> t_2^m
197197
-- if fi.CODE = _HOSTFUNC hf
198198
-- if BOT <- $hostcall(_HOSTFUNC hf, s, val^n)

0 commit comments

Comments
 (0)