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 {
102
102
Ok ( ( ) )
103
103
}
104
104
105
+ fn tunables ( & self ) -> Option < & Tunables > {
106
+ self . tunables . as_ref ( )
107
+ }
108
+
105
109
fn build ( & self ) -> Result < Box < dyn wasmtime_environ:: Compiler > > {
106
110
let isa = self . inner . build ( ) ?;
107
111
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 {
128
128
/// Set the tunables for this compiler.
129
129
fn set_tunables ( & mut self , tunables : Tunables ) -> Result < ( ) > ;
130
130
131
+ /// Get the tunables used by this compiler.
132
+ fn tunables ( & self ) -> Option < & Tunables > ;
133
+
131
134
/// Builds a new [`Compiler`] object from this configuration.
132
135
fn build ( & self ) -> Result < Box < dyn Compiler > > ;
133
136
Original file line number Diff line number Diff line change @@ -2396,7 +2396,7 @@ impl Config {
2396
2396
#[ cfg( any( feature = "cranelift" , feature = "winch" ) ) ]
2397
2397
pub ( crate ) fn build_compiler (
2398
2398
mut self ,
2399
- tunables : & Tunables ,
2399
+ tunables : & mut Tunables ,
2400
2400
features : WasmFeatures ,
2401
2401
) -> Result < ( Self , Box < dyn wasmtime_environ:: Compiler > ) > {
2402
2402
let target = self . compiler_target ( ) ;
@@ -2535,6 +2535,7 @@ impl Config {
2535
2535
for flag in self . compiler_config . flags . iter ( ) {
2536
2536
compiler. enable ( flag) ?;
2537
2537
}
2538
+ * tunables = compiler. tunables ( ) . cloned ( ) . unwrap ( ) ;
2538
2539
2539
2540
#[ cfg( all( feature = "incremental-cache" , feature = "cranelift" ) ) ]
2540
2541
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 {
96
96
/// disable these two compiler settings will cause errors.
97
97
pub fn new ( config : & Config ) -> Result < Engine > {
98
98
let config = config. clone ( ) ;
99
- let ( tunables, features) = config. validate ( ) ?;
99
+ let ( mut tunables, features) = config. validate ( ) ?;
100
100
101
101
#[ cfg( feature = "runtime" ) ]
102
102
if tunables. signals_based_traps {
@@ -113,7 +113,9 @@ impl Engine {
113
113
}
114
114
115
115
#[ 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;
117
119
118
120
Ok ( Engine {
119
121
inner : Arc :: new ( EngineInner {
Original file line number Diff line number Diff line change @@ -72,6 +72,10 @@ impl CompilerBuilder for Builder {
72
72
Ok ( ( ) )
73
73
}
74
74
75
+ fn tunables ( & self ) -> Option < & Tunables > {
76
+ self . cranelift . tunables ( )
77
+ }
78
+
75
79
fn build ( & self ) -> Result < Box < dyn wasmtime_environ:: Compiler > > {
76
80
let isa = self . inner . build ( ) ?;
77
81
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