Skip to content

Commit

Permalink
flambda-backend: Clarify the types used for static jump/catch (#1180)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gbury authored and mshinwell committed Mar 9, 2023
1 parent 273a40d commit 73e52b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions lambda/lambda.ml
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,8 @@ let equal_meth_kind x y =

type shared_code = (int * int) list

type static_label = int

type function_attribute = {
inline : inline_attribute;
specialise : specialise_attribute;
Expand Down Expand Up @@ -461,8 +463,8 @@ type lambda =
| Lswitch of lambda * lambda_switch * scoped_location * layout
| Lstringswitch of
lambda * (string * lambda) list * lambda option * scoped_location * layout
| Lstaticraise of int * lambda list
| Lstaticcatch of lambda * (int * (Ident.t * layout) list) * lambda * layout
| Lstaticraise of static_label * lambda list
| Lstaticcatch of lambda * (static_label * (Ident.t * layout) list) * lambda * layout
| Ltrywith of lambda * Ident.t * lambda * layout
| Lifthenelse of lambda * lambda * lambda * layout
| Lsequence of lambda * lambda
Expand Down
8 changes: 5 additions & 3 deletions lambda/lambda.mli
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ val equal_meth_kind : meth_kind -> meth_kind -> bool

type shared_code = (int * int) list (* stack size -> code label *)

type static_label = int

type function_attribute = {
inline : inline_attribute;
specialise : specialise_attribute;
Expand Down Expand Up @@ -369,8 +371,8 @@ type lambda =
strings are pairwise distinct *)
| Lstringswitch of
lambda * (string * lambda) list * lambda option * scoped_location * layout
| Lstaticraise of int * lambda list
| Lstaticcatch of lambda * (int * (Ident.t * layout) list) * lambda * layout
| Lstaticraise of static_label * lambda list
| Lstaticcatch of lambda * (static_label * (Ident.t * layout) list) * lambda * layout
| Ltrywith of lambda * Ident.t * lambda * layout
(* Lifthenelse (e, t, f, layout) evaluates t if e evaluates to 0, and evaluates f if
e evaluates to any other value; layout must be the layout of [t] and [f] *)
Expand Down Expand Up @@ -618,7 +620,7 @@ val primitive_may_allocate : primitive -> alloc_mode option
(***********************)

(* Get a new static failure ident *)
val next_raise_count : unit -> int
val next_raise_count : unit -> static_label

val staticfail : lambda (* Anticipated static failure *)

Expand Down

0 comments on commit 73e52b7

Please sign in to comment.