Skip to content

Add Clflags.is_flambda2 #62

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

Merged
Merged
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
8 changes: 4 additions & 4 deletions ocaml/lambda/translmod.ml
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ let record_primitive = function
upstreamed. At that point this helper can move into that module. *)

let preallocate_letrec ~bindings ~body =
assert Config.flambda2;
assert (Clflags.is_flambda2 ());
let caml_update_dummy_prim =
Primitive.simple ~name:"caml_update_dummy" ~arity:2 ~alloc:true
in
Expand Down Expand Up @@ -727,7 +727,7 @@ and transl_structure ~scopes loc fields cc rootpath final_env = function
transl_structure ~scopes loc (List.rev_append ids fields)
cc rootpath final_env rem
in
if Config.flambda2 then
if Clflags.is_flambda2 () then
preallocate_letrec ~bindings:class_bindings ~body, size
else
let class_bindings =
Expand Down Expand Up @@ -1177,7 +1177,7 @@ let transl_store_structure ~scopes glob map prims aliases str =
let (ids, class_bindings) = transl_class_bindings ~scopes cl_list in
let body = store_idents Loc_unknown ids in
let lam =
if Config.flambda2 then
if Clflags.is_flambda2 () then
preallocate_letrec
~bindings:class_bindings
~body
Expand Down Expand Up @@ -1546,7 +1546,7 @@ let transl_toplevel_item ~scopes item =
let (ids, class_bindings) = transl_class_bindings ~scopes cl_list in
List.iter set_toplevel_unique_name ids;
let body = make_sequence toploop_setvalue_id ids in
if Config.flambda2 then
if Clflags.is_flambda2 () then
preallocate_letrec ~bindings:class_bindings ~body
else
let class_bindings =
Expand Down
3 changes: 3 additions & 0 deletions ocaml/utils/clflags.ml
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,9 @@ let should_start_from pass =
let cur = Compiler_pass.rank pass in
start = cur

let is_flambda2 () =
Config.flambda2 && !native_code

module String = Misc.Stdlib.String

let arg_spec = ref []
Expand Down
2 changes: 2 additions & 0 deletions ocaml/utils/clflags.mli
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ val should_save_ir_after : Compiler_pass.t -> bool
val start_from : Compiler_pass.t option ref
val should_start_from : Compiler_pass.t -> bool

val is_flambda2 : unit -> bool

val arg_spec : (string * Arg.spec * string) list ref

(* [add_arguments __LOC__ args] will add the arguments from [args] at
Expand Down