From 78f330253f470500d94ef30c77ac0155de0c1c7f Mon Sep 17 00:00:00 2001 From: raoxiaojia Date: Fri, 13 Mar 2026 08:37:52 -0700 Subject: [PATCH 1/3] 3 general spec fixes --- specification/wasm-3.0/1.3-syntax.instructions.spectec | 2 +- specification/wasm-3.0/2.3-validation.instructions.spectec | 2 +- specification/wasm-3.0/6.3-text.instructions.spectec | 4 ++-- specification/wasm-latest/1.3-syntax.instructions.spectec | 2 +- specification/wasm-latest/2.3-validation.instructions.spectec | 2 +- specification/wasm-latest/6.3-text.instructions.spectec | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/specification/wasm-3.0/1.3-syntax.instructions.spectec b/specification/wasm-3.0/1.3-syntax.instructions.spectec index ae66049aa6..fc706a8451 100644 --- a/specification/wasm-3.0/1.3-syntax.instructions.spectec +++ b/specification/wasm-3.0/1.3-syntax.instructions.spectec @@ -515,7 +515,7 @@ def $free_instr(REF.I31) = {} def $free_instr(I31.GET sx) = {} -def $free_instr(STRUCT.NEW typeidx) = {} +def $free_instr(STRUCT.NEW typeidx) = $free_typeidx(typeidx) def $free_instr(STRUCT.NEW_DEFAULT typeidx) = $free_typeidx(typeidx) def $free_instr(STRUCT.GET sx? typeidx u32) = $free_typeidx(typeidx) def $free_instr(STRUCT.SET typeidx u32) = $free_typeidx(typeidx) diff --git a/specification/wasm-3.0/2.3-validation.instructions.spectec b/specification/wasm-3.0/2.3-validation.instructions.spectec index 131926ba01..a893c85c13 100644 --- a/specification/wasm-3.0/2.3-validation.instructions.spectec +++ b/specification/wasm-3.0/2.3-validation.instructions.spectec @@ -379,7 +379,7 @@ rule Instr_ok/table.size: -- if C.TABLES[x] = at lim rt rule Instr_ok/table.grow: - C |- TABLE.GROW x : rt at -> I32 + C |- TABLE.GROW x : rt at -> at -- if C.TABLES[x] = at lim rt rule Instr_ok/table.fill: diff --git a/specification/wasm-3.0/6.3-text.instructions.spectec b/specification/wasm-3.0/6.3-text.instructions.spectec index 643fe47e22..2f7af9e9c5 100644 --- a/specification/wasm-3.0/6.3-text.instructions.spectec +++ b/specification/wasm-3.0/6.3-text.instructions.spectec @@ -516,8 +516,8 @@ grammar Tplaininstr_(I)/num-cvt-i32 : instr = ... | ... grammar Tplaininstr_(I)/num-cvt-i64 : instr = ... - | "i64.extend_i64_s" => CVTOP I64 I64 EXTEND S - | "i64.extend_i64_u" => CVTOP I64 I64 EXTEND U + | "i64.extend_i32_s" => CVTOP I64 I32 EXTEND S + | "i64.extend_i32_u" => CVTOP I64 I32 EXTEND U | "i64.trunc_f32_s" => CVTOP I64 F32 TRUNC S | "i64.trunc_f32_u" => CVTOP I64 F32 TRUNC U | "i64.trunc_f64_s" => CVTOP I64 F64 TRUNC S diff --git a/specification/wasm-latest/1.3-syntax.instructions.spectec b/specification/wasm-latest/1.3-syntax.instructions.spectec index ae66049aa6..fc706a8451 100644 --- a/specification/wasm-latest/1.3-syntax.instructions.spectec +++ b/specification/wasm-latest/1.3-syntax.instructions.spectec @@ -515,7 +515,7 @@ def $free_instr(REF.I31) = {} def $free_instr(I31.GET sx) = {} -def $free_instr(STRUCT.NEW typeidx) = {} +def $free_instr(STRUCT.NEW typeidx) = $free_typeidx(typeidx) def $free_instr(STRUCT.NEW_DEFAULT typeidx) = $free_typeidx(typeidx) def $free_instr(STRUCT.GET sx? typeidx u32) = $free_typeidx(typeidx) def $free_instr(STRUCT.SET typeidx u32) = $free_typeidx(typeidx) diff --git a/specification/wasm-latest/2.3-validation.instructions.spectec b/specification/wasm-latest/2.3-validation.instructions.spectec index 131926ba01..a893c85c13 100644 --- a/specification/wasm-latest/2.3-validation.instructions.spectec +++ b/specification/wasm-latest/2.3-validation.instructions.spectec @@ -379,7 +379,7 @@ rule Instr_ok/table.size: -- if C.TABLES[x] = at lim rt rule Instr_ok/table.grow: - C |- TABLE.GROW x : rt at -> I32 + C |- TABLE.GROW x : rt at -> at -- if C.TABLES[x] = at lim rt rule Instr_ok/table.fill: diff --git a/specification/wasm-latest/6.3-text.instructions.spectec b/specification/wasm-latest/6.3-text.instructions.spectec index 643fe47e22..2f7af9e9c5 100644 --- a/specification/wasm-latest/6.3-text.instructions.spectec +++ b/specification/wasm-latest/6.3-text.instructions.spectec @@ -516,8 +516,8 @@ grammar Tplaininstr_(I)/num-cvt-i32 : instr = ... | ... grammar Tplaininstr_(I)/num-cvt-i64 : instr = ... - | "i64.extend_i64_s" => CVTOP I64 I64 EXTEND S - | "i64.extend_i64_u" => CVTOP I64 I64 EXTEND U + | "i64.extend_i32_s" => CVTOP I64 I32 EXTEND S + | "i64.extend_i32_u" => CVTOP I64 I32 EXTEND U | "i64.trunc_f32_s" => CVTOP I64 F32 TRUNC S | "i64.trunc_f32_u" => CVTOP I64 F32 TRUNC U | "i64.trunc_f64_s" => CVTOP I64 F64 TRUNC S From a8de49f0734917c8e59d594c4b1271a8a3788d33 Mon Sep 17 00:00:00 2001 From: raoxiaojia Date: Fri, 13 Mar 2026 08:41:45 -0700 Subject: [PATCH 2/3] test expects --- spectec/test-frontend/TEST.md | 10 +++++----- spectec/test-latex/TEST.md | 8 ++++---- spectec/test-middlend/TEST.md | 30 +++++++++++++++--------------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/spectec/test-frontend/TEST.md b/spectec/test-frontend/TEST.md index fd20528ef7..4a3520d855 100644 --- a/spectec/test-frontend/TEST.md +++ b/spectec/test-frontend/TEST.md @@ -2370,8 +2370,8 @@ def $free_instr(instr : instr) : free def $free_instr(`REF.I31`_instr) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS [], TAGS []} ;; ../../../../specification/wasm-latest/1.3-syntax.instructions.spectec:516.1-516.33 def $free_instr{sx : sx}(`I31.GET`_instr(sx)) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS [], TAGS []} - ;; ../../../../specification/wasm-latest/1.3-syntax.instructions.spectec:518.1-518.41 - def $free_instr{typeidx : typeidx}(`STRUCT.NEW`_instr(typeidx)) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS [], TAGS []} + ;; ../../../../specification/wasm-latest/1.3-syntax.instructions.spectec:518.1-518.61 + def $free_instr{typeidx : typeidx}(`STRUCT.NEW`_instr(typeidx)) = $free_typeidx(typeidx) ;; ../../../../specification/wasm-latest/1.3-syntax.instructions.spectec:519.1-519.69 def $free_instr{typeidx : typeidx}(`STRUCT.NEW_DEFAULT`_instr(typeidx)) = $free_typeidx(typeidx) ;; ../../../../specification/wasm-latest/1.3-syntax.instructions.spectec:520.1-520.69 @@ -3723,7 +3723,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; ../../../../specification/wasm-latest/2.3-validation.instructions.spectec:381.1-383.32 rule `table.grow`{C : context, x : idx, rt : reftype, at : addrtype, lim : limits}: - `%|-%:%`(C, `TABLE.GROW`_instr(x), `%->_%%`_instrtype(`%`_resulttype([(rt : reftype <: valtype) (at : addrtype <: valtype)]), [], `%`_resulttype([I32_valtype]))) + `%|-%:%`(C, `TABLE.GROW`_instr(x), `%->_%%`_instrtype(`%`_resulttype([(rt : reftype <: valtype) (at : addrtype <: valtype)]), [], `%`_resulttype([(at : addrtype <: valtype)]))) -- if (C.TABLES_context[x!`%`_idx.0] = `%%%`_tabletype(at, lim, rt)) ;; ../../../../specification/wasm-latest/2.3-validation.instructions.spectec:385.1-387.32 @@ -10600,9 +10600,9 @@ grammar Tplaininstr_(I : I) : instr ;; ../../../../specification/wasm-latest/6.3-text.instructions.spectec prod "i32.trunc_sat_f64_u" => CVTOP_instr(I32_numtype, F64_numtype, TRUNC_SAT_cvtop__(U_sx)) ;; ../../../../specification/wasm-latest/6.3-text.instructions.spectec - prod "i64.extend_i64_s" => CVTOP_instr(I64_numtype, I64_numtype, EXTEND_cvtop__(S_sx)) + prod "i64.extend_i32_s" => CVTOP_instr(I64_numtype, I32_numtype, EXTEND_cvtop__(S_sx)) ;; ../../../../specification/wasm-latest/6.3-text.instructions.spectec - prod "i64.extend_i64_u" => CVTOP_instr(I64_numtype, I64_numtype, EXTEND_cvtop__(U_sx)) + prod "i64.extend_i32_u" => CVTOP_instr(I64_numtype, I32_numtype, EXTEND_cvtop__(U_sx)) ;; ../../../../specification/wasm-latest/6.3-text.instructions.spectec prod "i64.trunc_f32_s" => CVTOP_instr(I64_numtype, F32_numtype, TRUNC_cvtop__(S_sx)) ;; ../../../../specification/wasm-latest/6.3-text.instructions.spectec diff --git a/spectec/test-latex/TEST.md b/spectec/test-latex/TEST.md index aa7136b61d..04a3c71e95 100644 --- a/spectec/test-latex/TEST.md +++ b/spectec/test-latex/TEST.md @@ -4196,7 +4196,7 @@ $$ {\mathrm{free}}_{\mathit{instr}}(\mathsf{ref{.}func}~{\mathit{funcidx}}) & = & {\mathrm{free}}_{\mathit{funcidx}}({\mathit{funcidx}}) \\ {\mathrm{free}}_{\mathit{instr}}(\mathsf{ref{.}i{\scriptstyle 31}}) & = & \{ \} \\ {\mathrm{free}}_{\mathit{instr}}({\mathsf{i{\scriptstyle 31}{.}get}}{\mathsf{\_}}{{\mathit{sx}}}) & = & \{ \} \\ -{\mathrm{free}}_{\mathit{instr}}(\mathsf{struct{.}new}~{\mathit{typeidx}}) & = & \{ \} \\ +{\mathrm{free}}_{\mathit{instr}}(\mathsf{struct{.}new}~{\mathit{typeidx}}) & = & {\mathrm{free}}_{\mathit{typeidx}}({\mathit{typeidx}}) \\ {\mathrm{free}}_{\mathit{instr}}(\mathsf{struct{.}new\_default}~{\mathit{typeidx}}) & = & {\mathrm{free}}_{\mathit{typeidx}}({\mathit{typeidx}}) \\ {\mathrm{free}}_{\mathit{instr}}({\mathsf{struct{.}get}}{\mathsf{\_}}{{{\mathit{sx}}^?}}~{\mathit{typeidx}}~{\mathit{u{\kern-0.1em\scriptstyle 32}}}) & = & {\mathrm{free}}_{\mathit{typeidx}}({\mathit{typeidx}}) \\ {\mathrm{free}}_{\mathit{instr}}(\mathsf{struct{.}set}~{\mathit{typeidx}}~{\mathit{u{\kern-0.1em\scriptstyle 32}}}) & = & {\mathrm{free}}_{\mathit{typeidx}}({\mathit{typeidx}}) \\ @@ -6677,7 +6677,7 @@ $$ \frac{ C{.}\mathsf{tables}{}[x] = {\mathit{at}}~{\mathit{lim}}~{\mathit{rt}} }{ -C \vdash \mathsf{table{.}grow}~x : {\mathit{rt}}~{\mathit{at}} \rightarrow \mathsf{i{\scriptstyle 32}} +C \vdash \mathsf{table{.}grow}~x : {\mathit{rt}}~{\mathit{at}} \rightarrow {\mathit{at}} } \, {[\textsc{\scriptsize T{-}instr{-}table.grow}]} \qquad \end{array} @@ -13186,8 +13186,8 @@ $$ & & | & \mbox{‘\texttt{i32.trunc\_sat\_f32\_u}’} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 32}} {.} {{\mathsf{trunc\_sat}}{\mathsf{\_}}{\mathsf{u}}}{\mathsf{\_}}{\mathsf{f{\scriptstyle 32}}} \\ & & | & \mbox{‘\texttt{i32.trunc\_sat\_f64\_s}’} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 32}} {.} {{\mathsf{trunc\_sat}}{\mathsf{\_}}{\mathsf{s}}}{\mathsf{\_}}{\mathsf{f{\scriptstyle 64}}} \\ & & | & \mbox{‘\texttt{i32.trunc\_sat\_f64\_u}’} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 32}} {.} {{\mathsf{trunc\_sat}}{\mathsf{\_}}{\mathsf{u}}}{\mathsf{\_}}{\mathsf{f{\scriptstyle 64}}} \\ -& & | & \mbox{‘\texttt{i64.extend\_i64\_s}’} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 64}} {.} {{\mathsf{extend}}{\mathsf{\_}}{\mathsf{s}}}{\mathsf{\_}}{\mathsf{i{\scriptstyle 64}}} \\ -& & | & \mbox{‘\texttt{i64.extend\_i64\_u}’} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 64}} {.} {{\mathsf{extend}}{\mathsf{\_}}{\mathsf{u}}}{\mathsf{\_}}{\mathsf{i{\scriptstyle 64}}} \\ +& & | & \mbox{‘\texttt{i64.extend\_i32\_s}’} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 64}} {.} {{\mathsf{extend}}{\mathsf{\_}}{\mathsf{s}}}{\mathsf{\_}}{\mathsf{i{\scriptstyle 32}}} \\ +& & | & \mbox{‘\texttt{i64.extend\_i32\_u}’} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 64}} {.} {{\mathsf{extend}}{\mathsf{\_}}{\mathsf{u}}}{\mathsf{\_}}{\mathsf{i{\scriptstyle 32}}} \\ & & | & \mbox{‘\texttt{i64.trunc\_f32\_s}’} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 64}} {.} {{\mathsf{trunc}}{\mathsf{\_}}{\mathsf{s}}}{\mathsf{\_}}{\mathsf{f{\scriptstyle 32}}} \\ & & | & \mbox{‘\texttt{i64.trunc\_f32\_u}’} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 64}} {.} {{\mathsf{trunc}}{\mathsf{\_}}{\mathsf{u}}}{\mathsf{\_}}{\mathsf{f{\scriptstyle 32}}} \\ & & | & \mbox{‘\texttt{i64.trunc\_f64\_s}’} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 64}} {.} {{\mathsf{trunc}}{\mathsf{\_}}{\mathsf{s}}}{\mathsf{\_}}{\mathsf{f{\scriptstyle 64}}} \\ diff --git a/spectec/test-middlend/TEST.md b/spectec/test-middlend/TEST.md index 0a4552419a..006e630a18 100644 --- a/spectec/test-middlend/TEST.md +++ b/spectec/test-middlend/TEST.md @@ -2360,8 +2360,8 @@ def $free_instr(instr : instr) : free def $free_instr(`REF.I31`_instr) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS [], TAGS []} ;; ../../../../specification/wasm-latest/1.3-syntax.instructions.spectec:516.1-516.33 def $free_instr{sx : sx}(`I31.GET`_instr(sx)) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS [], TAGS []} - ;; ../../../../specification/wasm-latest/1.3-syntax.instructions.spectec:518.1-518.41 - def $free_instr{typeidx : typeidx}(`STRUCT.NEW`_instr(typeidx)) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS [], TAGS []} + ;; ../../../../specification/wasm-latest/1.3-syntax.instructions.spectec:518.1-518.61 + def $free_instr{typeidx : typeidx}(`STRUCT.NEW`_instr(typeidx)) = $free_typeidx(typeidx) ;; ../../../../specification/wasm-latest/1.3-syntax.instructions.spectec:519.1-519.69 def $free_instr{typeidx : typeidx}(`STRUCT.NEW_DEFAULT`_instr(typeidx)) = $free_typeidx(typeidx) ;; ../../../../specification/wasm-latest/1.3-syntax.instructions.spectec:520.1-520.69 @@ -3713,7 +3713,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; ../../../../specification/wasm-latest/2.3-validation.instructions.spectec:381.1-383.32 rule `table.grow`{C : context, x : idx, rt : reftype, at : addrtype, lim : limits}: - `%|-%:%`(C, `TABLE.GROW`_instr(x), `%->_%%`_instrtype(`%`_resulttype([(rt : reftype <: valtype) (at : addrtype <: valtype)]), [], `%`_resulttype([I32_valtype]))) + `%|-%:%`(C, `TABLE.GROW`_instr(x), `%->_%%`_instrtype(`%`_resulttype([(rt : reftype <: valtype) (at : addrtype <: valtype)]), [], `%`_resulttype([(at : addrtype <: valtype)]))) -- if (C.TABLES_context[x!`%`_idx.0] = `%%%`_tabletype(at, lim, rt)) ;; ../../../../specification/wasm-latest/2.3-validation.instructions.spectec:385.1-387.32 @@ -10590,9 +10590,9 @@ grammar Tplaininstr_(I : I) : instr ;; ../../../../specification/wasm-latest/6.3-text.instructions.spectec prod "i32.trunc_sat_f64_u" => CVTOP_instr(I32_numtype, F64_numtype, TRUNC_SAT_cvtop__(U_sx)) ;; ../../../../specification/wasm-latest/6.3-text.instructions.spectec - prod "i64.extend_i64_s" => CVTOP_instr(I64_numtype, I64_numtype, EXTEND_cvtop__(S_sx)) + prod "i64.extend_i32_s" => CVTOP_instr(I64_numtype, I32_numtype, EXTEND_cvtop__(S_sx)) ;; ../../../../specification/wasm-latest/6.3-text.instructions.spectec - prod "i64.extend_i64_u" => CVTOP_instr(I64_numtype, I64_numtype, EXTEND_cvtop__(U_sx)) + prod "i64.extend_i32_u" => CVTOP_instr(I64_numtype, I32_numtype, EXTEND_cvtop__(U_sx)) ;; ../../../../specification/wasm-latest/6.3-text.instructions.spectec prod "i64.trunc_f32_s" => CVTOP_instr(I64_numtype, F32_numtype, TRUNC_cvtop__(S_sx)) ;; ../../../../specification/wasm-latest/6.3-text.instructions.spectec @@ -13775,8 +13775,8 @@ def $free_instr(instr : instr) : free def $free_instr(`REF.I31`_instr) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS [], TAGS []} ;; ../../../../specification/wasm-latest/1.3-syntax.instructions.spectec:516.1-516.33 def $free_instr{sx : sx}(`I31.GET`_instr(sx)) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS [], TAGS []} - ;; ../../../../specification/wasm-latest/1.3-syntax.instructions.spectec:518.1-518.41 - def $free_instr{typeidx : typeidx}(`STRUCT.NEW`_instr(typeidx)) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS [], TAGS []} + ;; ../../../../specification/wasm-latest/1.3-syntax.instructions.spectec:518.1-518.61 + def $free_instr{typeidx : typeidx}(`STRUCT.NEW`_instr(typeidx)) = $free_typeidx(typeidx) ;; ../../../../specification/wasm-latest/1.3-syntax.instructions.spectec:519.1-519.69 def $free_instr{typeidx : typeidx}(`STRUCT.NEW_DEFAULT`_instr(typeidx)) = $free_typeidx(typeidx) ;; ../../../../specification/wasm-latest/1.3-syntax.instructions.spectec:520.1-520.69 @@ -15128,7 +15128,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; ../../../../specification/wasm-latest/2.3-validation.instructions.spectec:381.1-383.32 rule `table.grow`{C : context, x : idx, rt : reftype, at : addrtype, lim : limits}: - `%|-%:%`(C, `TABLE.GROW`_instr(x), `%->_%%`_instrtype(`%`_resulttype([(rt : reftype <: valtype) (at : addrtype <: valtype)]), [], `%`_resulttype([I32_valtype]))) + `%|-%:%`(C, `TABLE.GROW`_instr(x), `%->_%%`_instrtype(`%`_resulttype([(rt : reftype <: valtype) (at : addrtype <: valtype)]), [], `%`_resulttype([(at : addrtype <: valtype)]))) -- if (C.TABLES_context[x!`%`_idx.0] = `%%%`_tabletype(at, lim, rt)) ;; ../../../../specification/wasm-latest/2.3-validation.instructions.spectec:385.1-387.32 @@ -22007,9 +22007,9 @@ grammar Tplaininstr_(I : I) : instr ;; ../../../../specification/wasm-latest/6.3-text.instructions.spectec prod "i32.trunc_sat_f64_u" => CVTOP_instr(I32_numtype, F64_numtype, TRUNC_SAT_cvtop__(U_sx)) ;; ../../../../specification/wasm-latest/6.3-text.instructions.spectec - prod "i64.extend_i64_s" => CVTOP_instr(I64_numtype, I64_numtype, EXTEND_cvtop__(S_sx)) + prod "i64.extend_i32_s" => CVTOP_instr(I64_numtype, I32_numtype, EXTEND_cvtop__(S_sx)) ;; ../../../../specification/wasm-latest/6.3-text.instructions.spectec - prod "i64.extend_i64_u" => CVTOP_instr(I64_numtype, I64_numtype, EXTEND_cvtop__(U_sx)) + prod "i64.extend_i32_u" => CVTOP_instr(I64_numtype, I32_numtype, EXTEND_cvtop__(U_sx)) ;; ../../../../specification/wasm-latest/6.3-text.instructions.spectec prod "i64.trunc_f32_s" => CVTOP_instr(I64_numtype, F32_numtype, TRUNC_cvtop__(S_sx)) ;; ../../../../specification/wasm-latest/6.3-text.instructions.spectec @@ -25192,8 +25192,8 @@ def $free_instr(instr : instr) : free def $free_instr(`REF.I31`_instr) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS [], TAGS []} ;; ../../../../specification/wasm-latest/1.3-syntax.instructions.spectec:516.1-516.33 def $free_instr{sx : sx}(`I31.GET`_instr(sx)) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS [], TAGS []} - ;; ../../../../specification/wasm-latest/1.3-syntax.instructions.spectec:518.1-518.41 - def $free_instr{typeidx : typeidx}(`STRUCT.NEW`_instr(typeidx)) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS [], TAGS []} + ;; ../../../../specification/wasm-latest/1.3-syntax.instructions.spectec:518.1-518.61 + def $free_instr{typeidx : typeidx}(`STRUCT.NEW`_instr(typeidx)) = $free_typeidx(typeidx) ;; ../../../../specification/wasm-latest/1.3-syntax.instructions.spectec:519.1-519.69 def $free_instr{typeidx : typeidx}(`STRUCT.NEW_DEFAULT`_instr(typeidx)) = $free_typeidx(typeidx) ;; ../../../../specification/wasm-latest/1.3-syntax.instructions.spectec:520.1-520.69 @@ -26620,7 +26620,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; ../../../../specification/wasm-latest/2.3-validation.instructions.spectec:381.1-383.32 rule `table.grow`{C : context, x : idx, rt : reftype, at : addrtype, lim : limits}: - `%|-%:%`(C, `TABLE.GROW`_instr(x), `%->_%%`_instrtype(`%`_resulttype([(rt : reftype <: valtype) (at : addrtype <: valtype)]), [], `%`_resulttype([I32_valtype]))) + `%|-%:%`(C, `TABLE.GROW`_instr(x), `%->_%%`_instrtype(`%`_resulttype([(rt : reftype <: valtype) (at : addrtype <: valtype)]), [], `%`_resulttype([(at : addrtype <: valtype)]))) -- if (x!`%`_idx.0 < |C.TABLES_context|) -- if (C.TABLES_context[x!`%`_idx.0] = `%%%`_tabletype(at, lim, rt)) @@ -33604,9 +33604,9 @@ grammar Tplaininstr_(I : I) : instr ;; ../../../../specification/wasm-latest/6.3-text.instructions.spectec prod "i32.trunc_sat_f64_u" => CVTOP_instr(I32_numtype, F64_numtype, TRUNC_SAT_cvtop__(U_sx)) ;; ../../../../specification/wasm-latest/6.3-text.instructions.spectec - prod "i64.extend_i64_s" => CVTOP_instr(I64_numtype, I64_numtype, EXTEND_cvtop__(S_sx)) + prod "i64.extend_i32_s" => CVTOP_instr(I64_numtype, I32_numtype, EXTEND_cvtop__(S_sx)) ;; ../../../../specification/wasm-latest/6.3-text.instructions.spectec - prod "i64.extend_i64_u" => CVTOP_instr(I64_numtype, I64_numtype, EXTEND_cvtop__(U_sx)) + prod "i64.extend_i32_u" => CVTOP_instr(I64_numtype, I32_numtype, EXTEND_cvtop__(U_sx)) ;; ../../../../specification/wasm-latest/6.3-text.instructions.spectec prod "i64.trunc_f32_s" => CVTOP_instr(I64_numtype, F32_numtype, TRUNC_cvtop__(S_sx)) ;; ../../../../specification/wasm-latest/6.3-text.instructions.spectec From 65159704344c4e07e98a714f640e6e31227364f6 Mon Sep 17 00:00:00 2001 From: raoxiaojia Date: Fri, 13 Mar 2026 09:25:55 -0700 Subject: [PATCH 3/3] prose expects --- spectec/test-prose/TEST.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/spectec/test-prose/TEST.md b/spectec/test-prose/TEST.md index 7f19a5e8f6..729cace4c8 100644 --- a/spectec/test-prose/TEST.md +++ b/spectec/test-prose/TEST.md @@ -15935,7 +15935,7 @@ The instruction :math:`(\mathsf{table{.}size}~x)` is :ref:`valid ` wi -The instruction :math:`(\mathsf{table{.}grow}~x)` is :ref:`valid ` with the instruction type :math:`{\mathit{rt}}~{\mathit{at}}~\rightarrow~\mathsf{i{\scriptstyle 32}}` if: +The instruction :math:`(\mathsf{table{.}grow}~x)` is :ref:`valid ` with the instruction type :math:`{\mathit{rt}}~{\mathit{at}}~\rightarrow~{\mathit{at}}` if: * The table :math:`C{.}\mathsf{tables}{}[x]` exists. @@ -23191,7 +23191,9 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #. If :math:`{\mathit{instr}'}` is some :math:`\mathsf{struct{.}new}~{\mathit{typeidx}}`, then: - a. Return :math:`\{ \}`. + a. Let :math:`(\mathsf{struct{.}new}~{\mathit{typeidx}})` be the destructuring of :math:`{\mathit{instr}'}`. + + #. Return :math:`{\mathrm{free}}_{\mathit{typeidx}}({\mathit{typeidx}})`. #. If :math:`{\mathit{instr}'}` is some :math:`\mathsf{struct{.}new\_default}~{\mathit{typeidx}}`, then: @@ -27958,7 +27960,7 @@ Instr_ok/table.size - C.TABLES[x] is (at lim rt). Instr_ok/table.grow -- the instruction (TABLE.GROW x) is valid with the instruction type [rt, at] -> [I32] if: +- the instruction (TABLE.GROW x) is valid with the instruction type [rt, at] -> [at] if: - the table C.TABLES[x] exists. - C.TABLES[x] is (at lim rt). @@ -31459,7 +31461,8 @@ free_instr instr' 61. If instr' is some I31.GET, then: a. Return {}. 62. If instr' is some STRUCT.NEW, then: - a. Return {}. + a. Let (STRUCT.NEW typeidx) be instr'. + b. Return $free_typeidx(typeidx). 63. If instr' is some STRUCT.NEW_DEFAULT, then: a. Let (STRUCT.NEW_DEFAULT typeidx) be instr'. b. Return $free_typeidx(typeidx).