@@ -24,7 +24,7 @@ pub struct PeepholeMutationAnalysis {
2424 /// function idx to type idx
2525 function_map : Vec < u32 > ,
2626 /// table index to the type of element it has
27- table_types : Vec < PrimitiveTypeInfo > ,
27+ table_types : Vec < wasmparser :: TableType > ,
2828 memory_types : Vec < wasmparser:: MemoryType > ,
2929}
3030
@@ -36,7 +36,7 @@ impl PeepholeMutationAnalysis {
3636 global_types : info. global_types . clone ( ) ,
3737 types_map : info. types_map . clone ( ) ,
3838 function_map : info. function_map . clone ( ) ,
39- table_types : info. table_elem_types . clone ( ) ,
39+ table_types : info. table_types . clone ( ) ,
4040 memory_types : info. memory_types . clone ( ) ,
4141 }
4242 }
@@ -267,16 +267,30 @@ impl PeepholeMutationAnalysis {
267267 Lang :: DataDrop ( _) => Ok ( PrimitiveTypeInfo :: Empty ) ,
268268 Lang :: MemoryCopy { .. } => Ok ( PrimitiveTypeInfo :: Empty ) ,
269269 Lang :: MemoryFill { .. } => Ok ( PrimitiveTypeInfo :: Empty ) ,
270- Lang :: TableGrow { .. } => Ok ( PrimitiveTypeInfo :: I32 ) ,
271- Lang :: TableSize { .. } => Ok ( PrimitiveTypeInfo :: I32 ) ,
270+ Lang :: TableGrow ( table, _) => {
271+ let ty = self . table_types [ * table as usize ] ;
272+ if ty. table64 {
273+ Ok ( PrimitiveTypeInfo :: I64 )
274+ } else {
275+ Ok ( PrimitiveTypeInfo :: I32 )
276+ }
277+ }
278+ Lang :: TableSize ( table) => {
279+ let ty = self . table_types [ * table as usize ] ;
280+ if ty. table64 {
281+ Ok ( PrimitiveTypeInfo :: I64 )
282+ } else {
283+ Ok ( PrimitiveTypeInfo :: I32 )
284+ }
285+ }
272286 Lang :: TableInit { .. } => Ok ( PrimitiveTypeInfo :: Empty ) ,
273287 Lang :: ElemDrop ( _) => Ok ( PrimitiveTypeInfo :: Empty ) ,
274288 Lang :: TableCopy { .. } => Ok ( PrimitiveTypeInfo :: Empty ) ,
275289 Lang :: TableFill { .. } => Ok ( PrimitiveTypeInfo :: Empty ) ,
276290 Lang :: TableSet ( ..) => Ok ( PrimitiveTypeInfo :: Empty ) ,
277291 Lang :: TableGet ( idx, _) => {
278292 let ty = self . table_types [ * idx as usize ] . clone ( ) ;
279- Ok ( ty)
293+ Ok ( ty. element_type . into ( ) )
280294 }
281295 Lang :: I32UseGlobal ( _) => Ok ( PrimitiveTypeInfo :: I32 ) ,
282296 Lang :: I64UseGlobal ( _) => Ok ( PrimitiveTypeInfo :: I64 ) ,
0 commit comments