@@ -122,14 +122,12 @@ impl ValueStack {
122122 T :: replace_top ( self , func)
123123 }
124124
125- pub ( crate ) fn pop_params ( & mut self , val_types : & [ ValType ] ) -> Vec < WasmValue > {
126- val_types. iter ( ) . map ( |val_type| self . pop_wasmvalue ( * val_type) ) . collect :: < Vec < _ > > ( )
127- }
128-
129- pub ( crate ) fn pop_results ( & mut self , val_types : & [ ValType ] ) -> Vec < WasmValue > {
130- let mut results = val_types. iter ( ) . rev ( ) . map ( |val_type| self . pop_wasmvalue ( * val_type) ) . collect :: < Vec < _ > > ( ) ;
131- results. reverse ( ) ;
132- results
125+ #[ inline]
126+ pub ( crate ) fn pop_types < ' a > (
127+ & ' a mut self ,
128+ val_types : impl IntoIterator < Item = & ' a ValType > ,
129+ ) -> impl core:: iter:: Iterator < Item = WasmValue > {
130+ val_types. into_iter ( ) . map ( |val_type| self . pop_wasmvalue ( * val_type) )
133131 }
134132
135133 #[ inline]
@@ -168,7 +166,7 @@ impl ValueStack {
168166
169167 pub ( crate ) fn truncate_keep ( & mut self , to : StackLocation , keep : StackHeight ) {
170168 #[ inline( always) ]
171- fn truncate_keep < T : Copy + Default > ( data : & mut Vec < T > , n : u32 , end_keep : u32 ) {
169+ fn truncate_keep < T > ( data : & mut Vec < T > , n : u32 , end_keep : u32 ) {
172170 let len = data. len ( ) as u32 ;
173171 if len <= n {
174172 return ; // No need to truncate if the current size is already less than or equal to total_to_keep
@@ -205,7 +203,15 @@ impl ValueStack {
205203
206204 pub ( crate ) fn extend_from_wasmvalues ( & mut self , values : & [ WasmValue ] ) {
207205 for value in values {
208- self . push_dyn ( value. into ( ) ) ;
206+ match value {
207+ WasmValue :: I32 ( v) => self . stack_32 . push ( * v as u32 ) ,
208+ WasmValue :: I64 ( v) => self . stack_64 . push ( * v as u64 ) ,
209+ WasmValue :: F32 ( v) => self . stack_32 . push ( v. to_bits ( ) ) ,
210+ WasmValue :: F64 ( v) => self . stack_64 . push ( v. to_bits ( ) ) ,
211+ WasmValue :: RefExtern ( v) => self . stack_ref . push ( v. addr ( ) ) ,
212+ WasmValue :: RefFunc ( v) => self . stack_ref . push ( v. addr ( ) ) ,
213+ WasmValue :: V128 ( v) => self . stack_128 . push ( ( * v) . into ( ) ) ,
214+ }
209215 }
210216 }
211217}
0 commit comments