@@ -1394,9 +1394,10 @@ and close_functions { backend; fenv; cenv; mutable_vars } fun_defs =
1394
1394
let uncurried_defs =
1395
1395
List. map
1396
1396
(function
1397
- (id , Lfunction({kind; params; return; body; loc; mode; region}
1397
+ (id , Lfunction({kind; params; return; body; attr; loc; mode; region}
1398
1398
as funct )) ->
1399
1399
Lambda. check_lfunction funct;
1400
+ let attrib = attr.check in
1400
1401
let label = Compilenv. make_fun_symbol loc (V. unique_name id) in
1401
1402
let arity = List. length params in
1402
1403
let fundesc =
@@ -1407,20 +1408,20 @@ and close_functions { backend; fenv; cenv; mutable_vars } fun_defs =
1407
1408
fun_float_const_prop = ! Clflags. float_const_prop;
1408
1409
fun_region = region} in
1409
1410
let dbg = Debuginfo. from_location loc in
1410
- (id, params, return, body, mode, fundesc, dbg)
1411
+ (id, params, return, body, mode, attrib, fundesc, dbg)
1411
1412
| (_ , _ ) -> fatal_error " Closure.close_functions" )
1412
1413
fun_defs in
1413
1414
(* Build an approximate fenv for compiling the functions *)
1414
1415
let fenv_rec =
1415
1416
List. fold_right
1416
- (fun (id , _params , _return , _body , mode , fundesc , _dbg ) fenv ->
1417
+ (fun (id , _params , _return , _body , mode , _attrib , fundesc , _dbg ) fenv ->
1417
1418
V.Map. add id (Value_closure (mode, fundesc, Value_unknown )) fenv)
1418
1419
uncurried_defs fenv in
1419
1420
(* Determine the offsets of each function's closure in the shared block *)
1420
1421
let env_pos = ref (- 1 ) in
1421
1422
let clos_offsets =
1422
1423
List. map
1423
- (fun (_id , _params , _return , _body , _mode , fundesc , _dbg ) ->
1424
+ (fun (_id , _params , _return , _body , _mode , _attrib , fundesc , _dbg ) ->
1424
1425
let pos = ! env_pos + 1 in
1425
1426
env_pos := ! env_pos + 1 +
1426
1427
(match fundesc.fun_arity with (Curried _ , (0 |1 )) -> 2 | _ -> 3 );
@@ -1431,13 +1432,13 @@ and close_functions { backend; fenv; cenv; mutable_vars } fun_defs =
1431
1432
does not use its environment parameter is invalidated. *)
1432
1433
let useless_env = ref initially_closed in
1433
1434
(* Translate each function definition *)
1434
- let clos_fundef (id , params , return , body , mode , fundesc , dbg ) env_pos =
1435
+ let clos_fundef (id , params , return , body , mode , attrib , fundesc , dbg ) env_pos =
1435
1436
let env_param = V. create_local " env" in
1436
1437
let cenv_fv =
1437
1438
build_closure_env env_param (fv_pos - env_pos) fv in
1438
1439
let cenv_body =
1439
1440
List. fold_right2
1440
- (fun (id , _params , _return , _body , _mode , _fundesc , _dbg ) pos env ->
1441
+ (fun (id , _params , _return , _body , _mode , _attrib , _fundesc , _dbg ) pos env ->
1441
1442
V.Map. add id (Uoffset (Uvar env_param, pos - env_pos)) env)
1442
1443
uncurried_defs clos_offsets cenv_fv in
1443
1444
let (ubody, approx) =
@@ -1459,6 +1460,7 @@ and close_functions { backend; fenv; cenv; mutable_vars } fun_defs =
1459
1460
dbg;
1460
1461
env = Some env_param;
1461
1462
mode;
1463
+ attrib;
1462
1464
}
1463
1465
in
1464
1466
(* give more chance of function with default parameters (i.e.
@@ -1497,7 +1499,7 @@ and close_functions { backend; fenv; cenv; mutable_vars } fun_defs =
1497
1499
recompile *)
1498
1500
Compilenv. backtrack snap; (* PR#6337 *)
1499
1501
List. iter
1500
- (fun (_id , _params , _return , _body , _mode , fundesc , _dbg ) ->
1502
+ (fun (_id , _params , _return , _body , _mode , _attrib , fundesc , _dbg ) ->
1501
1503
fundesc.fun_closed < - false ;
1502
1504
fundesc.fun_inline < - None ;
1503
1505
)
0 commit comments