File tree 3 files changed +21
-7
lines changed
testsuite/tests/typing-modes
3 files changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -1116,24 +1116,28 @@ and transl_exp0 ~in_new_scope ~scopes sort e =
1116
1116
let assume_zero_alloc = get_assume_zero_alloc ~scopes in
1117
1117
let scopes = enter_value_definition ~scopes ~assume_zero_alloc funcid in
1118
1118
lfunction
1119
- ~kind: (Curried {nlocal= 0 })
1119
+ (* We conservatively assume that all arguments are local. This doesn't
1120
+ hurt performance as probe handlers are always applied fully. *)
1121
+ ~kind: (Curried {nlocal= List. length param_idents})
1120
1122
(* CR layouts: Adjust param layouts when we allow other things in
1121
1123
probes. *)
1122
- ~params: (List. map (fun name -> { name; layout = layout_probe_arg; attributes = Lambda. default_param_attribute; mode = alloc_heap }) param_idents)
1124
+ ~params: (List. map (fun name -> { name; layout = layout_probe_arg; attributes = Lambda. default_param_attribute; mode = alloc_local }) param_idents)
1123
1125
~return: return_layout
1124
- ~body: (maybe_region_layout return_layout body)
1126
+ ~body: body
1125
1127
~loc: (of_location ~scopes exp.exp_loc)
1126
1128
~attr
1127
1129
~mode: alloc_heap
1128
- ~ret_mode: alloc_heap
1130
+ ~ret_mode: alloc_local
1131
+ (* CR zqian: the handler function doesn't have a region. However, the
1132
+ [region] field is currently broken. *)
1129
1133
~region: true
1130
1134
in
1131
1135
let app =
1132
1136
{ ap_func = Lvar funcid;
1133
1137
ap_args = List. map (fun id -> Lvar id) arg_idents;
1134
1138
ap_result_layout = return_layout;
1135
1139
ap_region_close = Rc_normal ;
1136
- ap_mode = alloc_heap ;
1140
+ ap_mode = alloc_local ;
1137
1141
ap_loc = of_location e.exp_loc ~scopes ;
1138
1142
ap_tailcall = Default_tailcall ;
1139
1143
ap_inlined = Never_inlined ;
Original file line number Diff line number Diff line change
1
+ (* TEST
2
+ flags += "-extension unique";
3
+ expect;
4
+ *)
5
+
6
+ (* probe can refer to local,nonportable,once values *)
7
+
8
+ let f (x @ local nonportable once ) =
9
+ [% probe " a" (let _ = x in () )]
10
+ [%% expect{|
11
+ val f : local_ once_ 'a -> unit = < fun>
12
+ |}]
Original file line number Diff line number Diff line change @@ -6296,8 +6296,6 @@ and type_expect_
6296
6296
| Error () -> raise (Error (loc, env, Probe_format ))
6297
6297
| Ok { name; name_loc; enabled_at_init; arg; } ->
6298
6298
check_probe_name name name_loc env;
6299
- let env = Env. add_escape_lock Probe env in
6300
- let env = Env. add_share_lock Probe env in
6301
6299
Env. add_probe name;
6302
6300
let exp = type_expect env mode_legacy arg
6303
6301
(mk_expected Predef. type_unit) in
You can’t perform that action at this time.
0 commit comments