Skip to content

Commit 7d0d382

Browse files
committed
remove lazy_tag
1 parent c0910c3 commit 7d0d382

File tree

4 files changed

+6
-39
lines changed

4 files changed

+6
-39
lines changed

Diff for: jscomp/ext/config.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ let interface_suffix = ref ".mli"
2222
(* This is normally the same as in obj.ml, but we have to define it
2323
separately because it can differ when we're in the middle of a
2424
bootstrapping phase. *)
25-
let lazy_tag = 246
2625

2726

2827

28+
let default_uncurry = ref false
2929

3030
let print_config oc =
3131
let p name valu = Printf.fprintf oc "%s: %s\n" name valu in

Diff for: jscomp/ext/config.mli

+1-4
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,8 @@ val ast_impl_magic_number: string
4343
val cmt_magic_number: string
4444
(* Magic number for compiled interface files *)
4545

46-
val lazy_tag : int
47-
(* Normally the same as Obj.lazy_tag. Separate definition because
48-
of technical reasons for bootstrapping. *)
49-
5046

47+
val default_uncurry : bool ref
5148
val print_config : out_channel -> unit;;
5249

5350

Diff for: jscomp/main/rescript_compiler_main.ml

+2-1
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,8 @@ let buckle_script_flags : (string * Bsc_args.spec * string) array =
433433

434434
"-nopervasives", set Clflags.nopervasives,
435435
"*internal*";
436-
436+
"-bs-uncurry", set Config.default_uncurry,
437+
"*internal" ;
437438
"-v", unit_call print_version_string,
438439
"Print compiler version and location of standard library and exit";
439440

Diff for: jscomp/ml/translcore.ml

+2-33
Original file line numberDiff line numberDiff line change
@@ -872,39 +872,8 @@ and transl_exp0 e =
872872
(* when e needs no computation (constants, identifiers, ...), we
873873
optimize the translation just as Lazy.lazy_from_val would
874874
do *)
875-
if !Config.bs_only then
876-
Lprim(Pmakeblock(Config.lazy_tag, Blk_lazy_general, Mutable, None), [transl_exp e], e.exp_loc)
877-
else
878-
begin match Typeopt.classify_lazy_argument e with
879-
| `Constant_or_function ->
880-
(* a constant expr of type <> float gets compiled as itself *)
881-
transl_exp e
882-
| `Float ->
883-
(* We don't need to wrap with Popaque: this forward
884-
block will never be shortcutted since it points to a float. *)
885-
Lprim(Pmakeblock(Obj.forward_tag, Lambda.default_tag_info (*IIRELEVANT*), Immutable, None),
886-
[transl_exp e], e.exp_loc)
887-
| `Identifier `Forward_value ->
888-
(* CR-someday mshinwell: Consider adding a new primitive
889-
that expresses the construction of forward_tag blocks.
890-
We need to use [Popaque] here to prevent unsound
891-
optimisation in Flambda, but the concept of a mutable
892-
block doesn't really match what is going on here. This
893-
value may subsequently turn into an immediate... *)
894-
Lprim (Popaque,
895-
[Lprim(Pmakeblock(Obj.forward_tag, Lambda.default_tag_info (*IIRELEVANT*), Immutable, None),
896-
[transl_exp e], e.exp_loc)],
897-
e.exp_loc)
898-
| `Identifier `Other ->
899-
transl_exp e
900-
| `Other ->
901-
(* other cases compile to a lazy block holding a function *)
902-
let fn = Lfunction {kind = Curried; params = [Ident.create "param"];
903-
attr = default_function_attribute;
904-
loc = e.exp_loc;
905-
body = transl_exp e} in
906-
Lprim(Pmakeblock(Config.lazy_tag, Lambda.default_tag_info (*IIRELEVANT*), Mutable, None), [fn], e.exp_loc)
907-
end
875+
Lprim(Pmakeblock(0, Blk_lazy_general, Mutable, None), [transl_exp e], e.exp_loc)
876+
908877
| Texp_object () ->
909878
assert false
910879
| Texp_unreachable ->

0 commit comments

Comments
 (0)