@@ -187,6 +187,7 @@ impl wasmtime_environ::Compiler for Compiler {
187187 func_index : DefinedFuncIndex ,
188188 input : FunctionBodyData < ' _ > ,
189189 types : & ModuleTypesBuilder ,
190+ symbol : & str ,
190191 ) -> Result < CompiledFunctionBody , CompileError > {
191192 let isa = & * self . isa ;
192193 let module = & translation. module ;
@@ -275,10 +276,7 @@ impl wasmtime_environ::Compiler for Compiler {
275276 & mut func_env,
276277 ) ?;
277278
278- let func = compiler. finish_with_info (
279- Some ( ( & body, & self . tunables ) ) ,
280- & format ! ( "wasm_func_{}" , func_index. as_u32( ) ) ,
281- ) ?;
279+ let func = compiler. finish_with_info ( Some ( ( & body, & self . tunables ) ) , symbol) ?;
282280
283281 let timing = cranelift_codegen:: timing:: take_current ( ) ;
284282 log:: debug!( "{:?} translated in {:?}" , func_index, timing. total( ) ) ;
@@ -295,6 +293,7 @@ impl wasmtime_environ::Compiler for Compiler {
295293 translation : & ModuleTranslation < ' _ > ,
296294 types : & ModuleTypesBuilder ,
297295 def_func_index : DefinedFuncIndex ,
296+ symbol : & str ,
298297 ) -> Result < CompiledFunctionBody , CompileError > {
299298 let func_index = translation. module . func_index ( def_func_index) ;
300299 let sig = translation. module . functions [ func_index]
@@ -363,14 +362,15 @@ impl wasmtime_environ::Compiler for Compiler {
363362 builder. finalize ( ) ;
364363
365364 Ok ( CompiledFunctionBody {
366- code : Box :: new ( compiler. finish ( & format ! ( "array_to_wasm_{}" , func_index . as_u32 ( ) , ) ) ?) ,
365+ code : Box :: new ( compiler. finish ( symbol ) ?) ,
367366 needs_gc_heap : false ,
368367 } )
369368 }
370369
371370 fn compile_wasm_to_array_trampoline (
372371 & self ,
373372 wasm_func_ty : & WasmFuncType ,
373+ symbol : & str ,
374374 ) -> Result < CompiledFunctionBody , CompileError > {
375375 let isa = & * self . isa ;
376376 let pointer_type = isa. pointer_type ( ) ;
@@ -436,7 +436,7 @@ impl wasmtime_environ::Compiler for Compiler {
436436 builder. finalize ( ) ;
437437
438438 Ok ( CompiledFunctionBody {
439- code : Box :: new ( compiler. finish ( & format ! ( "wasm_to_array_trampoline_{wasm_func_ty}" ) ) ?) ,
439+ code : Box :: new ( compiler. finish ( & symbol ) ?) ,
440440 needs_gc_heap : false ,
441441 } )
442442 }
@@ -586,6 +586,7 @@ impl wasmtime_environ::Compiler for Compiler {
586586 fn compile_wasm_to_builtin (
587587 & self ,
588588 index : BuiltinFunctionIndex ,
589+ symbol : & str ,
589590 ) -> Result < CompiledFunctionBody , CompileError > {
590591 let isa = & * self . isa ;
591592 let ptr_size = isa. pointer_bytes ( ) ;
@@ -656,7 +657,7 @@ impl wasmtime_environ::Compiler for Compiler {
656657 builder. finalize ( ) ;
657658
658659 Ok ( CompiledFunctionBody {
659- code : Box :: new ( compiler. finish ( & format ! ( "wasm_to_builtin_{}" , index . name ( ) ) ) ?) ,
660+ code : Box :: new ( compiler. finish ( & symbol ) ?) ,
660661 needs_gc_heap : false ,
661662 } )
662663 }
@@ -974,14 +975,14 @@ impl FunctionCompiler<'_> {
974975 ( builder, block0)
975976 }
976977
977- fn finish ( self , clif_filename : & str ) -> Result < CompiledFunction , CompileError > {
978- self . finish_with_info ( None , clif_filename )
978+ fn finish ( self , symbol : & str ) -> Result < CompiledFunction , CompileError > {
979+ self . finish_with_info ( None , symbol )
979980 }
980981
981982 fn finish_with_info (
982983 mut self ,
983984 body_and_tunables : Option < ( & FunctionBody < ' _ > , & Tunables ) > ,
984- clif_filename : & str ,
985+ symbol : & str ,
985986 ) -> Result < CompiledFunction , CompileError > {
986987 let context = & mut self . cx . codegen_context ;
987988 let isa = & * self . compiler . isa ;
@@ -997,7 +998,7 @@ impl FunctionCompiler<'_> {
997998 if let Some ( path) = & self . compiler . clif_dir {
998999 use std:: io:: Write ;
9991000
1000- let mut path = path. join ( clif_filename ) ;
1001+ let mut path = path. join ( symbol . replace ( ":" , "-" ) ) ;
10011002 path. set_extension ( "clif" ) ;
10021003
10031004 let mut output = std:: fs:: File :: create ( path) . unwrap ( ) ;
0 commit comments