Skip to content

Commit c8551a6

Browse files
committed
[compiler]continue enhancing pointer info/module_alias_info
1 parent e186330 commit c8551a6

File tree

6 files changed

+18
-12
lines changed

6 files changed

+18
-12
lines changed

bytecomp/lambda.ml

+4-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ type field_dbg_info =
7878
| Fld_record_inline of string
7979
| Fld_record_extension of string
8080
| Fld_tuple
81-
81+
| Fld_poly_var_tag
82+
| Fld_poly_var_content
83+
8284
let fld_record = ref (fun (lbl : Types.label_description) ->
8385
Fld_record {name = lbl.lbl_name; mutable_flag = Mutable})
8486

@@ -366,6 +368,7 @@ let const_unit = Const_pointer(0, Pt_na)
366368

367369
let lambda_assert_false = Lconst (Const_pointer(0, Pt_constructor {name = "assert false"; cstrs = (1,0)}))
368370

371+
let lambda_module_alias = Lconst (Const_pointer(0, Pt_module_alias))
369372

370373
let lambda_unit = Lconst const_unit
371374

bytecomp/lambda.mli

+4-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ type field_dbg_info =
9494
| Fld_record_inline of string
9595
| Fld_record_extension of string
9696
| Fld_tuple
97-
97+
| Fld_poly_var_tag
98+
| Fld_poly_var_content
99+
98100
val fld_record :
99101
(Types.label_description ->
100102
field_dbg_info) ref
@@ -414,6 +416,7 @@ val make_key: lambda -> lambda option
414416
val const_unit: structured_constant
415417
val lambda_assert_false: lambda
416418
val lambda_unit: lambda
419+
val lambda_module_alias : lambda
417420
val name_lambda: let_kind -> lambda -> (Ident.t -> lambda) -> lambda
418421
val name_lambda_list: lambda list -> (lambda list -> lambda) -> lambda
419422

bytecomp/matching.ml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1405,7 +1405,7 @@ let make_variant_matching_nonconst p lab def ctx = function
14051405
let def = make_default (matcher_variant_nonconst lab) def
14061406
and ctx = filter_ctx p ctx in
14071407
{pm=
1408-
{cases = []; args = (Lprim(Pfield (1, Fld_na), [arg], p.pat_loc), Alias) :: argl;
1408+
{cases = []; args = (Lprim(Pfield (1, Fld_poly_var_content), [arg], p.pat_loc), Alias) :: argl;
14091409
default=def} ;
14101410
ctx=ctx ;
14111411
pat = normalize_pat p}
@@ -1609,7 +1609,7 @@ let make_tuple_matching loc arity def = function
16091609
let rec make_args pos =
16101610
if pos >= arity
16111611
then argl
1612-
else (Lprim(Pfield (pos, Fld_na (* TODO: tuple *)), [arg], loc), Alias) :: make_args (pos + 1) in
1612+
else (Lprim(Pfield (pos, Fld_tuple), [arg], loc), Alias) :: make_args (pos + 1) in
16131613
{cases = []; args = make_args 0 ;
16141614
default=make_default (matcher_tuple arity) def}
16151615

@@ -2445,7 +2445,7 @@ let call_switcher_variant_constant loc fail arg int_lambda_list names =
24452445

24462446
let call_switcher_variant_constr loc fail arg int_lambda_list names =
24472447
let v = Ident.create "variant" in
2448-
Llet(Alias, Pgenval, v, Lprim(Pfield (0, Fld_na), [arg], loc),
2448+
Llet(Alias, Pgenval, v, Lprim(Pfield (0, Fld_poly_var_tag), [arg], loc),
24492449
call_switcher loc
24502450
fail (Lvar v) min_int max_int int_lambda_list names)
24512451

bytecomp/translclass.ml

+5-5
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ let lfield v i = Lprim(Pfield (i, Fld_na), [Lvar v], Location.none)
6161
let transl_label l = share (Const_immstring l)
6262

6363
let transl_meth_list lst =
64-
if lst = [] then Lconst (Const_pointer (0, Lambda.Pt_na)) else
64+
if lst = [] then Lconst (Const_pointer (0, Pt_na)) else
6565
share (Const_block
6666
(0, Lambda.Blk_array, List.map (fun lab -> Const_immstring lab) lst))
6767

@@ -272,8 +272,8 @@ let rec build_class_init cla cstr super inh_init cl_init msubst top cl =
272272
let lpath = transl_class_path ~loc:cl.cl_loc cl.cl_env path in
273273
(inh_init,
274274
Llet (Strict, Pgenval, obj_init,
275-
mkappl(Lprim(Pfield (1, Fld_na), [lpath], Location.none), Lvar cla ::
276-
if top then [Lprim(Pfield (3, Fld_na), [lpath], Location.none)]
275+
mkappl(Lprim(Pfield (1, Fld_tuple), [lpath], Location.none), Lvar cla ::
276+
if top then [Lprim(Pfield (3, Fld_tuple), [lpath], Location.none)]
277277
else []),
278278
bind_super cla super cl_init))
279279
| _ ->
@@ -529,7 +529,7 @@ let rec builtin_meths self env env2 body =
529529
| Lprim(Parrayrefu _, [Lvar s; Lvar n], _) when List.mem s self ->
530530
"var", [Lvar n]
531531
| Lprim(Pfield (n,_), [Lvar e], _) when Ident.same e env ->
532-
"env", [Lvar env2; Lconst(Const_pointer (n, Lambda.Pt_na))]
532+
"env", [Lvar env2; Lconst(Const_pointer (n, Pt_na))]
533533
| Lsend(Self, met, Lvar s, [], _) when List.mem s self ->
534534
"meth", [met]
535535
| _ -> raise Not_found
@@ -600,7 +600,7 @@ module M = struct
600600
| "send_env" -> SendEnv
601601
| "send_meth" -> SendMeth
602602
| _ -> assert false
603-
in Lconst(Const_pointer(Obj.magic tag, Lambda.Pt_na)) :: args
603+
in Lconst(Const_pointer(Obj.magic tag, Pt_na)) :: args
604604
end
605605
open M
606606

bytecomp/translcore.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,7 @@ and transl_exp0 e =
11351135
| Texp_new (cl, {Location.loc=loc}, _) ->
11361136
Lapply{ap_should_be_tailcall=false;
11371137
ap_loc=loc;
1138-
ap_func=Lprim(Pfield (0, Fld_na), [transl_class_path ~loc e.exp_env cl], loc);
1138+
ap_func=Lprim(Pfield (0, Fld_tuple), [transl_class_path ~loc e.exp_env cl], loc);
11391139
ap_args=[lambda_unit];
11401140
ap_inlined=Default_inline;
11411141
ap_specialised=Default_specialise}

bytecomp/translmod.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ and transl_module cc rootpath mexp =
464464
mexp.mod_attributes;
465465
let loc = mexp.mod_loc in
466466
match mexp.mod_type with
467-
Mty_alias (Mta_absent, _) -> apply_coercion loc Alias cc lambda_unit
467+
Mty_alias (Mta_absent, _) -> apply_coercion loc Alias cc lambda_module_alias
468468
| _ ->
469469
match mexp.mod_desc with
470470
Tmod_ident (path,_) ->

0 commit comments

Comments
 (0)