Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused raise_kind #6959

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jscomp/core/lam_convert.ml
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ let lam_prim ~primitive:(p : Lambda.primitive) ~args loc : Lam.t =
| Psetfield (id, info) -> prim ~primitive:(Psetfield (id, info)) ~args loc
| Pduprecord -> prim ~primitive:Pduprecord ~args loc
| Plazyforce -> prim ~primitive:Plazyforce ~args loc
| Praise _ -> prim ~primitive:Praise ~args loc
| Praise -> prim ~primitive:Praise ~args loc
| Psequand -> prim ~primitive:Psequand ~args loc
| Psequor -> prim ~primitive:Psequor ~args loc
| Pnot -> prim ~primitive:Pnot ~args loc
Expand Down
17 changes: 1 addition & 16 deletions jscomp/ml/lambda.ml
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,6 @@ type immediate_or_pointer =
| Immediate
| Pointer



type is_safe =
| Safe
| Unsafe
Expand All @@ -204,16 +202,13 @@ type primitive =
| Pmakeblock of tag_info
| Pfield of int * field_dbg_info
| Psetfield of int * set_field_dbg_info



| Pduprecord
(* Force lazy values *)
| Plazyforce
(* External call *)
| Pccall of Primitive.description
(* Exceptions *)
| Praise of raise_kind
| Praise
(* Boolean operations *)
| Psequand | Psequor | Pnot
(* Integer operations *)
Expand Down Expand Up @@ -279,11 +274,6 @@ and boxed_integer = Primitive.boxed_integer =
Pbigint | Pint32 | Pint64


and raise_kind =
| Raise_regular
| Raise_reraise
| Raise_notrace

type pointer_info =
| Pt_constructor of {name: string; const: int; non_const: int; attrs: Parsetree.attributes}
| Pt_variant of {name: string}
Expand Down Expand Up @@ -757,11 +747,6 @@ and negate_comparison = function
| Clt -> Cge | Cle -> Cgt
| Cgt -> Cle | Cge -> Clt

let raise_kind = function
| Raise_regular -> "raise"
| Raise_reraise -> "reraise"
| Raise_notrace -> "raise_notrace"

let lam_of_loc kind loc =
let loc_start = loc.Location.loc_start in
let (file, lnum, cnum) = Location.get_pos_info loc_start in
Expand Down
8 changes: 1 addition & 7 deletions jscomp/ml/lambda.mli
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ type primitive =
(* External call *)
| Pccall of Primitive.description
(* Exceptions *)
| Praise of raise_kind
| Praise
(* Boolean operations *)
| Psequand | Psequor | Pnot
(* Integer operations *)
Expand Down Expand Up @@ -246,11 +246,6 @@ and boxed_integer = Primitive.boxed_integer =
Pbigint | Pint32 | Pint64


and raise_kind =
| Raise_regular
| Raise_reraise
| Raise_notrace

type structured_constant =
Const_base of constant
| Const_pointer of int * pointer_info
Expand Down Expand Up @@ -402,7 +397,6 @@ val staticfail : lambda (* Anticipated static failure *)
val is_guarded: lambda -> bool
val patch_guarded : lambda -> lambda -> lambda

val raise_kind: raise_kind -> string
val lam_of_loc : loc_kind -> Location.t -> lambda


Expand Down
4 changes: 2 additions & 2 deletions jscomp/ml/matching.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2918,7 +2918,7 @@ let partial_function loc () =
let fname =
Filename.basename fname
in
Lprim(Praise Raise_regular, [Lprim(Pmakeblock(Blk_extension),
Lprim(Praise, [Lprim(Pmakeblock(Blk_extension),
[transl_normal_path Predef.path_match_failure;
Lconst(Const_block(Blk_tuple,
[Const_base(Const_string (fname, None));
Expand All @@ -2931,7 +2931,7 @@ let for_function loc repr param pat_act_list partial =
(* In the following two cases, exhaustiveness info is not available! *)
let for_trywith param pat_act_list =
compile_matching None
(fun () -> Lprim(Praise Raise_reraise, [param], Location.none))
(fun () -> Lprim(Praise, [param], Location.none))
param pat_act_list Partial

let simple_for_let loc param pat body =
Expand Down
4 changes: 2 additions & 2 deletions jscomp/ml/printlambda.ml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ let primitive ppf = function
| Pduprecord -> fprintf ppf "duprecord"
| Plazyforce -> fprintf ppf "force"
| Pccall p -> fprintf ppf "%s" p.prim_name
| Praise k -> fprintf ppf "%s" (Lambda.raise_kind k)
| Praise -> fprintf ppf "raise"
| Psequand -> fprintf ppf "&&"
| Psequor -> fprintf ppf "||"
| Pnot -> fprintf ppf "not"
Expand Down Expand Up @@ -265,7 +265,7 @@ let name_of_primitive = function
| Pduprecord -> "Pduprecord"
| Plazyforce -> "Plazyforce"
| Pccall _ -> "Pccall"
| Praise _ -> "Praise"
| Praise -> "Praise"
| Psequand -> "Psequand"
| Psequor -> "Psequor"
| Pnot -> "Pnot"
Expand Down
18 changes: 6 additions & 12 deletions jscomp/ml/translcore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,9 @@ let primitives_table =
("%obj_field", Parrayrefu);
("%obj_set_field", Parraysetu);
("%obj_is_int", Pisint);
("%raise", Praise Raise_regular);
("%reraise", Praise Raise_reraise);
("%raise_notrace", Praise Raise_notrace);
("%raise", Praise);
("%reraise", Praise);
("%raise_notrace", Praise);
Comment on lines +321 to +322
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also remove these two lines, but it'll be a breaking change.

Copy link
Member

@cknitt cknitt Aug 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only see those used in some tests, and %raise_notrace in Pervasives. I guess we can remove them there?

We'll need to clean up Pervasives anyway for v12.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I remove them?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say yes - do you agree @cristianoc?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

("%sequand", Psequand);
("%sequor", Psequor);
("%boolnot", Pnot);
Expand Down Expand Up @@ -682,7 +682,7 @@ let assert_failed exp =
in
let fname = Filename.basename fname in
Lprim
( Praise Raise_regular,
( Praise,
[
Lprim
( Pmakeblock Blk_extension,
Expand Down Expand Up @@ -781,15 +781,9 @@ and transl_exp0 (e : Typedtree.expression) : Lambda.lambda =
transl_primitive_application e.exp_loc p e.exp_env prim_type args
in
match (prim, args) with
| Praise k, [ _ ] ->
| Praise, [ _ ] ->
let targ = List.hd argl in
let k =
match (k, targ) with
| Raise_regular, Lvar id when Hashtbl.mem try_ids id ->
Raise_reraise
| _ -> k
in
wrap (Lprim (Praise k, [ targ ], e.exp_loc))
wrap (Lprim (Praise, [ targ ], e.exp_loc))
| Ploc kind, [] -> lam_of_loc kind e.exp_loc
| Ploc kind, [ arg1 ] ->
let lam = lam_of_loc kind arg1.exp_loc in
Expand Down
Loading