@@ -10,7 +10,7 @@ use cranelift_codegen::{
1010} ;
1111use cranelift_entity:: packed_option:: ReservedValue ;
1212use cranelift_frontend:: FunctionBuilder ;
13- use smallvec:: SmallVec ;
13+ use smallvec:: { SmallVec , smallvec } ;
1414use wasmtime_environ:: {
1515 Collector , GcArrayLayout , GcLayout , GcStructLayout , I31_DISCRIMINANT , ModuleInternedTypeIndex ,
1616 PtrSize , TagIndex , TypeIndex , VMGcKind , WasmCompositeInnerType , WasmHeapTopType , WasmHeapType ,
@@ -414,7 +414,7 @@ pub fn translate_exn_unbox(
414414 builder : & mut FunctionBuilder < ' _ > ,
415415 tag_index : TagIndex ,
416416 exn_ref : ir:: Value ,
417- ) -> WasmResult < Vec < ir:: Value > > {
417+ ) -> WasmResult < SmallVec < [ ir:: Value ; 4 ] > > {
418418 log:: trace!( "translate_exn_unbox({tag_index:?} {exn_ref:?})" ) ;
419419
420420 // We know that the `exn_ref` is not null because we reach this
@@ -433,12 +433,12 @@ pub fn translate_exn_unbox(
433433 // Gather accesses first because these require a borrow on
434434 // `func_env`, which we later mutate below via
435435 // `prepare_gc_ref_access()`.
436- let mut accesses = vec ! [ ] ;
436+ let mut accesses: SmallVec < [ _ ; 4 ] > = smallvec ! [ ] ;
437437 for ( field_ty, field_layout) in exception_ty. fields . iter ( ) . zip ( exn_layout. fields . iter ( ) ) {
438438 accesses. push ( ( field_layout. offset , field_ty. element_type ) ) ;
439439 }
440440
441- let mut result = vec ! [ ] ;
441+ let mut result = smallvec ! [ ] ;
442442 for ( field_offset, field_ty) in accesses {
443443 let field_size = wasmtime_environ:: byte_size_of_wasm_ty_in_gc_heap ( & field_ty) ;
444444 assert ! ( field_offset + field_size <= exn_size) ;
0 commit comments