File tree Expand file tree Collapse file tree 6 files changed +69
-3
lines changed
Expand file tree Collapse file tree 6 files changed +69
-3
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,10 @@ impl CompilerBuilder for Builder {
102102 Ok ( ( ) )
103103 }
104104
105+ fn tunables ( & self ) -> Option < & Tunables > {
106+ self . tunables . as_ref ( )
107+ }
108+
105109 fn build ( & self ) -> Result < Box < dyn wasmtime_environ:: Compiler > > {
106110 let isa = self . inner . build ( ) ?;
107111 Ok ( Box :: new ( crate :: compiler:: Compiler :: new (
Original file line number Diff line number Diff line change @@ -128,6 +128,9 @@ pub trait CompilerBuilder: Send + Sync + fmt::Debug {
128128 /// Set the tunables for this compiler.
129129 fn set_tunables ( & mut self , tunables : Tunables ) -> Result < ( ) > ;
130130
131+ /// Get the tunables used by this compiler.
132+ fn tunables ( & self ) -> Option < & Tunables > ;
133+
131134 /// Builds a new [`Compiler`] object from this configuration.
132135 fn build ( & self ) -> Result < Box < dyn Compiler > > ;
133136
Original file line number Diff line number Diff line change @@ -2396,7 +2396,7 @@ impl Config {
23962396 #[ cfg( any( feature = "cranelift" , feature = "winch" ) ) ]
23972397 pub ( crate ) fn build_compiler (
23982398 mut self ,
2399- tunables : & Tunables ,
2399+ tunables : & mut Tunables ,
24002400 features : WasmFeatures ,
24012401 ) -> Result < ( Self , Box < dyn wasmtime_environ:: Compiler > ) > {
24022402 let target = self . compiler_target ( ) ;
@@ -2535,6 +2535,7 @@ impl Config {
25352535 for flag in self . compiler_config . flags . iter ( ) {
25362536 compiler. enable ( flag) ?;
25372537 }
2538+ * tunables = compiler. tunables ( ) . cloned ( ) . unwrap ( ) ;
25382539
25392540 #[ cfg( all( feature = "incremental-cache" , feature = "cranelift" ) ) ]
25402541 if let Some ( cache_store) = & self . compiler_config . cache_store {
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ impl Engine {
9696 /// disable these two compiler settings will cause errors.
9797 pub fn new ( config : & Config ) -> Result < Engine > {
9898 let config = config. clone ( ) ;
99- let ( tunables, features) = config. validate ( ) ?;
99+ let ( mut tunables, features) = config. validate ( ) ?;
100100
101101 #[ cfg( feature = "runtime" ) ]
102102 if tunables. signals_based_traps {
@@ -113,7 +113,9 @@ impl Engine {
113113 }
114114
115115 #[ cfg( any( feature = "cranelift" , feature = "winch" ) ) ]
116- let ( config, compiler) = config. build_compiler ( & tunables, features) ?;
116+ let ( config, compiler) = config. build_compiler ( & mut tunables, features) ?;
117+ #[ cfg( not( any( feature = "cranelift" , feature = "winch" ) ) ) ]
118+ let _ = & mut tunables;
117119
118120 Ok ( Engine {
119121 inner : Arc :: new ( EngineInner {
Original file line number Diff line number Diff line change @@ -72,6 +72,10 @@ impl CompilerBuilder for Builder {
7272 Ok ( ( ) )
7373 }
7474
75+ fn tunables ( & self ) -> Option < & Tunables > {
76+ self . cranelift . tunables ( )
77+ }
78+
7579 fn build ( & self ) -> Result < Box < dyn wasmtime_environ:: Compiler > > {
7680 let isa = self . inner . build ( ) ?;
7781 let cranelift = self . cranelift . build ( ) ?;
Original file line number Diff line number Diff line change 1+ ;; ! target = "x86_64"
2+ ;; ! test = "optimize"
3+ ;; ! filter = "wasm[0]--function"
4+ ;; ! flags = "-C inlining=y -C cranelift-wasmtime_inlining_intra_module=y"
5+
6+ (module
7+ (func (result i32 )
8+ (i32.const 42 ))
9+ (func (result i32 )
10+ (call 0 )))
11+
12+ ;; function u0:0(i64 vmctx, i64) -> i32 tail {
13+ ;; gv0 = vmctx
14+ ;; gv1 = load.i64 notrap aligned readonly gv0+8
15+ ;; gv2 = load.i64 notrap aligned gv1+16
16+ ;; stack_limit = gv2
17+ ;;
18+ ;; block0(v0: i64, v1: i64):
19+ ;; @001b jump block1
20+ ;;
21+ ;; block1:
22+ ;; @0019 v3 = iconst.i32 42
23+ ;; @001b return v3 ; v3 = 42
24+ ;; }
25+ ;;
26+ ;; function u0:1(i64 vmctx, i64) -> i32 tail {
27+ ;; gv0 = vmctx
28+ ;; gv1 = load.i64 notrap aligned readonly gv0+8
29+ ;; gv2 = load.i64 notrap aligned gv1+16
30+ ;; gv3 = vmctx
31+ ;; gv4 = load.i64 notrap aligned readonly gv3+8
32+ ;; gv5 = load.i64 notrap aligned gv4+16
33+ ;; sig0 = (i64 vmctx, i64) -> i32 tail
34+ ;; fn0 = colocated u0:0 sig0
35+ ;; stack_limit = gv2
36+ ;;
37+ ;; block0(v0: i64, v1: i64):
38+ ;; @001e jump block2
39+ ;;
40+ ;; block2:
41+ ;; jump block3
42+ ;;
43+ ;; block3:
44+ ;; jump block4
45+ ;;
46+ ;; block4:
47+ ;; @0020 jump block1
48+ ;;
49+ ;; block1:
50+ ;; v6 = iconst.i32 42
51+ ;; @0020 return v6 ; v6 = 42
52+ ;; }
You can’t perform that action at this time.
0 commit comments