Skip to content

Commit 42ad0ab

Browse files
committed
specialize Pt_assertfalse
1 parent 77318c3 commit 42ad0ab

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

bytecomp/lambda.ml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,12 @@ and raise_kind =
252252
| Raise_notrace
253253

254254
type pointer_info =
255-
| Pt_constructor of {name : string; cstrs : int * int }
255+
| Pt_constructor of {name : string; const : int ; non_const : int }
256256
| Pt_variant of {name : string}
257257
| Pt_module_alias
258258
| Pt_builtin_boolean
259259
| Pt_shape_none
260+
| Pt_assertfalse
260261
| Pt_na
261262

262263

@@ -366,9 +367,9 @@ type program =
366367
not necessary "()", it can be used as a place holder for module
367368
alias etc.
368369
*)
369-
let const_unit = Const_pointer(0, Pt_constructor{name = "()"; cstrs = 1, 0})
370+
let const_unit = Const_pointer(0, Pt_constructor{name = "()"; const = 1; non_const = 0})
370371

371-
let lambda_assert_false = Lconst (Const_pointer(0, Pt_constructor {name = "assert false"; cstrs = (1,0)}))
372+
let lambda_assert_false = Lconst (Const_pointer(0, Pt_assertfalse))
372373

373374
let lambda_module_alias = Lconst (Const_pointer(0, Pt_module_alias))
374375

bytecomp/lambda.mli

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,12 @@ type is_safe =
136136
| Unsafe
137137

138138
type pointer_info =
139-
| Pt_constructor of {name : string; cstrs : int * int}
139+
| Pt_constructor of {name : string; const : int ; non_const : int}
140140
| Pt_variant of {name : string}
141141
| Pt_module_alias
142142
| Pt_builtin_boolean
143143
| Pt_shape_none
144+
| Pt_assertfalse
144145
| Pt_na
145146

146147

bytecomp/translcore.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1128,7 +1128,7 @@ and transl_exp0 e =
11281128
| Longident.Lident "None"
11291129
when Datarepr.constructor_has_optional_shape cstr
11301130
-> Pt_shape_none
1131-
| _ -> (Lambda.Pt_constructor {name = cstr.cstr_name; cstrs = cstr.cstr_consts,cstr.cstr_nonconsts})
1131+
| _ -> Pt_constructor {name = cstr.cstr_name; const = cstr.cstr_consts; non_const = cstr.cstr_nonconsts}
11321132
))
11331133
| Cstr_unboxed ->
11341134
(match ll with [v] -> v | _ -> assert false)

bytecomp/translmod.ml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ let undefined_location loc =
233233
[Const_base(Const_string (fname, None));
234234
Const_base(Const_int line);
235235
Const_base(Const_int char)]))
236-
let cstrs = (3,2)
236+
let cstr_const = 3
237+
let cstr_non_const = 2
237238
let init_shape modl =
238239
let add_name x id =
239240
if !Config.bs_only then
@@ -258,9 +259,9 @@ let init_shape modl =
258259
let init_v =
259260
match Ctype.expand_head env ty with
260261
{desc = Tarrow(_,_,_,_)} ->
261-
Const_pointer (0, Pt_constructor{name = "Function"; cstrs})
262+
Const_pointer (0, Pt_constructor{name = "Function"; const = cstr_const; non_const = cstr_non_const})
262263
| {desc = Tconstr(p, _, _)} when Path.same p Predef.path_lazy_t ->
263-
Const_pointer (1, Pt_constructor{name = "Lazy"; cstrs})
264+
Const_pointer (1, Pt_constructor{name = "Lazy"; const = cstr_const; non_const = cstr_non_const})
264265
| _ -> raise Not_found in
265266
(add_name init_v id) :: init_shape_struct env rem
266267
| Sig_value(_, {val_kind=Val_prim _}) :: rem ->
@@ -278,7 +279,7 @@ let init_shape modl =
278279
| Sig_modtype(id, minfo) :: rem ->
279280
init_shape_struct (Env.add_modtype id minfo env) rem
280281
| Sig_class (id,_,_) :: rem ->
281-
(add_name (Const_pointer (2, Pt_constructor{name = "Class";cstrs})) id)
282+
(add_name (Const_pointer (2, Pt_constructor{name = "Class";const = cstr_const; non_const = cstr_non_const})) id)
282283
:: init_shape_struct env rem
283284
| Sig_class_type _ :: rem ->
284285
init_shape_struct env rem

0 commit comments

Comments
 (0)