@@ -27,10 +27,10 @@ use std::path;
2727use std:: sync:: { Arc , Mutex } ;
2828use wasmparser:: { FuncValidatorAllocations , FunctionBody } ;
2929use wasmtime_environ:: {
30- AddressMapSection , BuiltinFunctionIndex , CacheStore , CompileError , DefinedFuncIndex , FlagValue ,
31- FunctionBodyData , FunctionLoc , HostCall , ModuleTranslation , ModuleTypesBuilder , PtrSize ,
32- RelocationTarget , StackMapSection , StaticModuleIndex , TrapEncodingBuilder , TrapSentinel ,
33- TripleExt , Tunables , VMOffsets , WasmFuncType , WasmValType ,
30+ AddressMapSection , BuiltinFunctionIndex , CacheStore , CompileError , CompiledFunctionBody ,
31+ DefinedFuncIndex , FlagValue , FunctionBodyData , FunctionLoc , HostCall , ModuleTranslation ,
32+ ModuleTypesBuilder , PtrSize , RelocationTarget , StackMapSection , StaticModuleIndex ,
33+ TrapEncodingBuilder , TrapSentinel , TripleExt , Tunables , VMOffsets , WasmFuncType , WasmValType ,
3434} ;
3535
3636#[ cfg( feature = "component-model" ) ]
@@ -187,7 +187,7 @@ impl wasmtime_environ::Compiler for Compiler {
187187 func_index : DefinedFuncIndex ,
188188 input : FunctionBodyData < ' _ > ,
189189 types : & ModuleTypesBuilder ,
190- ) -> Result < Box < dyn Any + Send > , CompileError > {
190+ ) -> Result < CompiledFunctionBody , CompileError > {
191191 let isa = & * self . isa ;
192192 let module = & translation. module ;
193193 let func_index = module. func_index ( func_index) ;
@@ -284,15 +284,18 @@ impl wasmtime_environ::Compiler for Compiler {
284284 log:: debug!( "{:?} translated in {:?}" , func_index, timing. total( ) ) ;
285285 log:: trace!( "{:?} timing info\n {}" , func_index, timing) ;
286286
287- Ok ( Box :: new ( func) )
287+ Ok ( CompiledFunctionBody {
288+ code : Box :: new ( func) ,
289+ needs_gc_heap : func_env. needs_gc_heap ( ) ,
290+ } )
288291 }
289292
290293 fn compile_array_to_wasm_trampoline (
291294 & self ,
292295 translation : & ModuleTranslation < ' _ > ,
293296 types : & ModuleTypesBuilder ,
294297 def_func_index : DefinedFuncIndex ,
295- ) -> Result < Box < dyn Any + Send > , CompileError > {
298+ ) -> Result < CompiledFunctionBody , CompileError > {
296299 let func_index = translation. module . func_index ( def_func_index) ;
297300 let sig = translation. module . functions [ func_index]
298301 . signature
@@ -359,16 +362,16 @@ impl wasmtime_environ::Compiler for Compiler {
359362 builder. ins ( ) . return_ ( & [ true_return] ) ;
360363 builder. finalize ( ) ;
361364
362- Ok ( Box :: new ( compiler . finish ( & format ! (
363- "array_to_wasm_{}" ,
364- func_index . as_u32 ( ) ,
365- ) ) ? ) )
365+ Ok ( CompiledFunctionBody {
366+ code : Box :: new ( compiler . finish ( & format ! ( "array_to_wasm_{}" , func_index . as_u32 ( ) , ) ) ? ) ,
367+ needs_gc_heap : false ,
368+ } )
366369 }
367370
368371 fn compile_wasm_to_array_trampoline (
369372 & self ,
370373 wasm_func_ty : & WasmFuncType ,
371- ) -> Result < Box < dyn Any + Send > , CompileError > {
374+ ) -> Result < CompiledFunctionBody , CompileError > {
372375 let isa = & * self . isa ;
373376 let pointer_type = isa. pointer_type ( ) ;
374377 let wasm_call_sig = wasm_call_signature ( isa, wasm_func_ty, & self . tunables ) ;
@@ -432,9 +435,10 @@ impl wasmtime_environ::Compiler for Compiler {
432435 builder. ins ( ) . return_ ( & results) ;
433436 builder. finalize ( ) ;
434437
435- Ok ( Box :: new ( compiler. finish ( & format ! (
436- "wasm_to_array_trampoline_{wasm_func_ty}"
437- ) ) ?) )
438+ Ok ( CompiledFunctionBody {
439+ code : Box :: new ( compiler. finish ( & format ! ( "wasm_to_array_trampoline_{wasm_func_ty}" ) ) ?) ,
440+ needs_gc_heap : false ,
441+ } )
438442 }
439443
440444 fn append_code (
@@ -582,7 +586,7 @@ impl wasmtime_environ::Compiler for Compiler {
582586 fn compile_wasm_to_builtin (
583587 & self ,
584588 index : BuiltinFunctionIndex ,
585- ) -> Result < Box < dyn Any + Send > , CompileError > {
589+ ) -> Result < CompiledFunctionBody , CompileError > {
586590 let isa = & * self . isa ;
587591 let ptr_size = isa. pointer_bytes ( ) ;
588592 let pointer_type = isa. pointer_type ( ) ;
@@ -651,9 +655,10 @@ impl wasmtime_environ::Compiler for Compiler {
651655 builder. ins ( ) . return_ ( & results) ;
652656 builder. finalize ( ) ;
653657
654- Ok ( Box :: new (
655- compiler. finish ( & format ! ( "wasm_to_builtin_{}" , index. name( ) ) ) ?,
656- ) )
658+ Ok ( CompiledFunctionBody {
659+ code : Box :: new ( compiler. finish ( & format ! ( "wasm_to_builtin_{}" , index. name( ) ) ) ?) ,
660+ needs_gc_heap : false ,
661+ } )
657662 }
658663
659664 fn compiled_function_relocation_targets < ' a > (
0 commit comments