@@ -122,6 +122,7 @@ macro_rules! impl_visit_operator {
122122 ( @@sign_extension $( $rest: tt) * ) => { } ;
123123 ( @@saturating_float_to_int $( $rest: tt) * ) => { } ;
124124 ( @@bulk_memory $( $rest: tt) * ) => { } ;
125+ ( @@tail_call $( $rest: tt) * ) => { } ;
125126 ( @@$proposal: ident $op: ident $( { $( $arg: ident: $argty: ty) ,* } ) ? => $visit: ident) => {
126127 #[ cold]
127128 fn $visit( & mut self $( $( , $arg: $argty) * ) ?) {
@@ -317,6 +318,14 @@ impl<'a, R: WasmModuleResources> wasmparser::VisitOperator<'a> for FunctionBuild
317318 visit_i64_trunc_sat_f64_u, Instruction :: I64TruncSatF64U
318319 }
319320
321+ fn visit_return_call ( & mut self , function_index : u32 ) -> Self :: Output {
322+ self . instructions . push ( Instruction :: ReturnCall ( function_index) ) ;
323+ }
324+
325+ fn visit_return_call_indirect ( & mut self , type_index : u32 , table_index : u32 ) -> Self :: Output {
326+ self . instructions . push ( Instruction :: ReturnCallIndirect ( type_index, table_index) ) ;
327+ }
328+
320329 fn visit_global_set ( & mut self , global_index : u32 ) -> Self :: Output {
321330 match self . validator . get_operand_type ( 0 ) {
322331 Some ( Some ( t) ) => self . instructions . push ( match t {
@@ -385,6 +394,30 @@ impl<'a, R: WasmModuleResources> wasmparser::VisitOperator<'a> for FunctionBuild
385394 return ;
386395 } ;
387396
397+ match self . instructions . last ( ) {
398+ Some ( Instruction :: LocalGet32 ( from) )
399+ | Some ( Instruction :: LocalGet64 ( from) )
400+ | Some ( Instruction :: LocalGet128 ( from) )
401+ | Some ( Instruction :: LocalGetRef ( from) ) => {
402+ let from = * from;
403+ self . instructions . pop ( ) ;
404+ // validation will ensure that the last instruction is the correct local.get
405+ match self . validator . get_operand_type ( 0 ) {
406+ Some ( Some ( t) ) => self . instructions . push ( match t {
407+ wasmparser:: ValType :: I32 => Instruction :: LocalCopy32 ( from, resolved_idx) ,
408+ wasmparser:: ValType :: F32 => Instruction :: LocalCopy32 ( from, resolved_idx) ,
409+ wasmparser:: ValType :: I64 => Instruction :: LocalCopy64 ( from, resolved_idx) ,
410+ wasmparser:: ValType :: F64 => Instruction :: LocalCopy64 ( from, resolved_idx) ,
411+ wasmparser:: ValType :: V128 => Instruction :: LocalCopy128 ( from, resolved_idx) ,
412+ wasmparser:: ValType :: Ref ( _) => Instruction :: LocalCopyRef ( from, resolved_idx) ,
413+ } ) ,
414+ _ => self . visit_unreachable ( ) ,
415+ }
416+ return ;
417+ }
418+ _ => { }
419+ }
420+
388421 match self . validator . get_operand_type ( 0 ) {
389422 Some ( Some ( t) ) => self . instructions . push ( match t {
390423 wasmparser:: ValType :: I32 => Instruction :: LocalSet32 ( resolved_idx) ,
0 commit comments