File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -244,20 +244,21 @@ let rec small_function ~live_vars ~env p ~enclosing_function info args =
244
244
with Exit -> true
245
245
246
246
and should_inline ~live_vars ~env p ~enclosing_function info args =
247
- (* Don't inline loops at toplevel *)
248
- (not (Option. is_none enclosing_function && contains_loop info p))
249
247
(* Don't inline function containing closures in JavaScript, except
250
248
in an enclosing scope, since this can results in memory leaks *)
251
- && (match Config. target () with
252
- | `Wasm -> true
253
- | `JavaScript -> (
254
- match enclosing_function with
255
- | Some f -> Var.Set. mem f info.scopes || closure_count info ~env p = 0
256
- | None -> true ))
249
+ (match Config. target () with
250
+ | `Wasm -> true
251
+ | `JavaScript -> (
252
+ match enclosing_function with
253
+ | Some f -> Var.Set. mem f info.scopes || closure_count info ~env p = 0
254
+ | None -> true ))
257
255
&& ((live_vars.(Var. idx info.f) = 1 && body_size info ~env p < 150 )
258
256
|| functor_like ~env p info
259
257
|| (body_size info ~env p < = 1 && closure_count info ~env p = 0 )
260
- || small_function ~live_vars ~env p ~enclosing_function info args)
258
+ || small_function ~live_vars ~env p ~enclosing_function info args
259
+ &&
260
+ (* Avoid inlining loops at toplevel *)
261
+ not (Option. is_none enclosing_function && contains_loop info p))
261
262
262
263
(* ***)
263
264
You can’t perform that action at this time.
0 commit comments