@@ -260,15 +260,21 @@ def $data(state, dataidx) : datainst hint(show %.DATAS[%]) hint(macro "
260260def $elem(state, tableidx) : eleminst hint(show %.ELEMS[%]) hint(macro "Z%")
261261def $local(state, localidx) : val? hint(show %.LOCALS[%]) hint(macro "Z%")
262262
263- def $type((s; f), x) = f.MODULE.TYPES[x]
264- def $tag((s; f), x) = s.TAGS[f.MODULE.TAGS[x]]
265- def $global((s; f), x) = s.GLOBALS[f.MODULE.GLOBALS[x]]
266- def $mem((s; f), x) = s.MEMS[f.MODULE.MEMS[x]]
267- def $table((s; f), x) = s.TABLES[f.MODULE.TABLES[x]]
268- def $func((s; f), x) = s.FUNCS[f.MODULE.FUNCS[x]]
269- def $data((s; f), x) = s.DATAS[f.MODULE.DATAS[x]]
270- def $elem((s; f), x) = s.ELEMS[f.MODULE.ELEMS[x]]
271- def $local((s; f), x) = f.LOCALS[x]
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+
269+ def $type(z, x) = $fof(z).MODULE.TYPES[x]
270+ def $tag(z, x) = $sof(z).TAGS[$fof(z).MODULE.TAGS[x]]
271+ def $global(z, x) = $sof(z).GLOBALS[$fof(z).MODULE.GLOBALS[x]]
272+ def $mem(z, x) = $sof(z).MEMS[$fof(z).MODULE.MEMS[x]]
273+ def $table(z, x) = $sof(z).TABLES[$fof(z).MODULE.TABLES[x]]
274+ def $func(z, x) = $sof(z).FUNCS[$fof(z).MODULE.FUNCS[x]]
275+ def $data(z, x) = $sof(z).DATAS[$fof(z).MODULE.DATAS[x]]
276+ def $elem(z, x) = $sof(z).ELEMS[$fof(z).MODULE.ELEMS[x]]
277+ def $local(z, x) = $fof(z).LOCALS[x]
272278
273279
274280;; State update
@@ -284,25 +290,25 @@ def $with_data(state, dataidx, byte*) : state hint(show %[.DATAS[%
284290def $with_struct(state, structaddr, nat, fieldval) : state hint(show %[.STRUCTS[%].FIELDS[%] = %]) hint(macro "ZS%") hint(prose "Replace" $structinst(%1)[%2].FIELDS[%3] "with" %4)
285291def $with_array(state, arrayaddr, nat, fieldval) : state hint(show %[.ARRAYS[%].FIELDS[%] = %]) hint(macro "ZA%") hint(prose "Replace" $arrayinst(%1)[%2].FIELDS[%3] "with" %4)
286292
287- def $with_local((s; f) , x, v) = s; f [.LOCALS[x] = v]
288- def $with_global((s; f) , x, v) = s [.GLOBALS[f .MODULE.GLOBALS[x]].VALUE = v]; f
289- def $with_table((s; f) , x, i, r) = s [.TABLES[f .MODULE.TABLES[x]].REFS[i] = r]; f
290- def $with_tableinst((s; f) , x, ti) = s [.TABLES[f .MODULE.TABLES[x]] = ti]; f
291- def $with_mem((s; f) , x, i, j, b*) = s [.MEMS[f .MODULE.MEMS[x]].BYTES[i : j] = b*]; f
292- def $with_meminst((s; f) , x, mi) = s [.MEMS[f .MODULE.MEMS[x]] = mi]; f
293- def $with_elem((s; f) , x, r*) = s [.ELEMS[f .MODULE.ELEMS[x]].REFS = r*]; f
294- def $with_data((s; f) , x, b*) = s [.DATAS[f .MODULE.DATAS[x]].BYTES = b*]; f
295- def $with_struct((s; f) , a, i, fv) = s [.STRUCTS[a].FIELDS[i] = fv]; f
296- def $with_array((s; f) , a, i, fv) = s [.ARRAYS[a].FIELDS[i] = fv]; f
293+ def $with_local(z , x, v) = $sof(z); $fof(z) [.LOCALS[x] = v]
294+ def $with_global(z , x, v) = $sof(z) [.GLOBALS[$fof(z) .MODULE.GLOBALS[x]].VALUE = v]; $fof(z)
295+ def $with_table(z , x, i, r) = $sof(z) [.TABLES[$fof(z) .MODULE.TABLES[x]].REFS[i] = r]; $fof(z)
296+ def $with_tableinst(z , x, ti) = $sof(z) [.TABLES[$fof(z) .MODULE.TABLES[x]] = ti]; $fof(z)
297+ def $with_mem(z , x, i, j, b*) = $sof(z) [.MEMS[$fof(z) .MODULE.MEMS[x]].BYTES[i : j] = b*]; $fof(z)
298+ def $with_meminst(z , x, mi) = $sof(z) [.MEMS[$fof(z) .MODULE.MEMS[x]] = mi]; $fof(z)
299+ def $with_elem(z , x, r*) = $sof(z) [.ELEMS[$fof(z) .MODULE.ELEMS[x]].REFS = r*]; $fof(z)
300+ def $with_data(z , x, b*) = $sof(z) [.DATAS[$fof(z) .MODULE.DATAS[x]].BYTES = b*]; $fof(z)
301+ def $with_struct(z , a, i, fv) = $sof(z) [.STRUCTS[a].FIELDS[i] = fv]; $fof(z)
302+ def $with_array(z , a, i, fv) = $sof(z) [.ARRAYS[a].FIELDS[i] = fv]; $fof(z)
297303
298304
299305def $add_structinst(state, structinst*) : state hint(show %[.STRUCTS =++ %]) hint(macro "Z%") hint(prose "Append" %2 "to" $structinst(%1))
300306def $add_arrayinst(state, arrayinst*) : state hint(show %[.ARRAYS =++ %]) hint(macro "Z%") hint(prose "Append" %2 "to" $arrayinst(%1))
301307def $add_exninst(state, exninst*) : state hint(show %[.EXNS =++ %]) hint(macro "Z%") hint(prose "Append" %2 "to" $exninst(%1))
302308
303- def $add_structinst((s; f) , si*) = s [.STRUCTS =++ si*]; f
304- def $add_arrayinst((s; f) , ai*) = s [.ARRAYS =++ ai*]; f
305- def $add_exninst((s; f) , exn*) = s [.EXNS =++ exn*]; f
309+ def $add_structinst(z , si*) = $sof(z) [.STRUCTS =++ si*]; $fof(z)
310+ def $add_arrayinst(z , ai*) = $sof(z) [.ARRAYS =++ ai*]; $fof(z)
311+ def $add_exninst(z , exn*) = $sof(z) [.EXNS =++ exn*]; $fof(z)
306312
307313
308314;; Growing
0 commit comments