Skip to content

Commit 4d9ee4b

Browse files
committed
remove Caml compile time constants
1 parent 1c7e98e commit 4d9ee4b

15 files changed

+1
-185
lines changed

jscomp/core/lam_analysis.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ let rec no_side_effects (lam : Lam.t) : bool =
9191
| Pasrint64 | Pint64comp _
9292
(* Operations on big arrays: (unsafe, #dimensions, kind, layout) *)
9393
(* Compile time constants *)
94-
| Pctconst _ (* Integer to external pointer *)
9594
| Poffsetint _ | Pstringadd | Pjs_function_length | Pcaml_obj_length
9695
| Pwrap_exn
9796
| Praw_js_code

jscomp/core/lam_compat.ml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,6 @@ let cmp_int (cmp : comparison) (a : int) b : bool =
7777
| Clt -> a < b
7878
| Cge -> a >= b
7979

80-
type compile_time_constant =
81-
| Backend_type
82-
83-
(** relies on the fact that [compile_time_constant] is enum type *)
84-
let eq_compile_time_constant (p : compile_time_constant)
85-
(p1 : compile_time_constant) =
86-
p = p1
87-
8880
type let_kind = Lambda.let_kind = Strict | Alias | StrictOpt | Variable
8981

9082
type field_dbg_info = Lambda.field_dbg_info =

jscomp/core/lam_compat.mli

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ type boxed_integer = Lambda.boxed_integer = Pbigint | Pint32 | Pint64
2626

2727
type comparison = Lambda.comparison = Ceq | Cneq | Clt | Cgt | Cle | Cge
2828

29-
type compile_time_constant =
30-
| Backend_type
31-
3229
type let_kind = Lambda.let_kind = Strict | Alias | StrictOpt | Variable
3330

3431
type field_dbg_info = Lambda.field_dbg_info =
@@ -62,6 +59,3 @@ val cmp_int : comparison -> int -> int -> bool
6259
val eq_comparison : comparison -> comparison -> bool
6360

6461
val eq_boxed_integer : boxed_integer -> boxed_integer -> bool
65-
66-
val eq_compile_time_constant :
67-
compile_time_constant -> compile_time_constant -> bool

jscomp/core/lam_compile_primitive.ml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -370,12 +370,6 @@ let translate output_prefix loc (cxt : Lam_compile_context.t)
370370
(* FIXME, this can be removed later *)
371371
| Pisint -> E.is_type_number (Ext_list.singleton_exn args)
372372
| Pis_poly_var_block -> E.is_type_object (Ext_list.singleton_exn args)
373-
| Pctconst ct -> (
374-
match ct with
375-
| Backend_type ->
376-
E.make_block E.zero_int_literal
377-
(Blk_constructor { name = "Other"; num_nonconst = 1; tag = 0; attrs = [] })
378-
[ E.str "BS" ] Immutable)
379373
| Pduprecord -> Lam_dispatch_primitive.translate loc "?obj_dup" args
380374
| Plazyforce
381375
(* FIXME: we don't inline lazy force or at least

jscomp/core/lam_convert.ml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -336,13 +336,6 @@ let lam_prim ~primitive:(p : Lambda.primitive) ~args loc : Lam.t =
336336
match x with
337337
| Pbigint | Pint32 -> prim ~primitive:Pasrint ~args loc
338338
| Pint64 -> prim ~primitive:Pasrint64 ~args loc)
339-
| Pctconst x -> (
340-
match x with
341-
| Word_size | Int_size ->
342-
Lam.const (Const_int { i = 32l; comment = None })
343-
| Max_wosize ->
344-
Lam.const (Const_int { i = 2147483647l; comment = Some "Max_wosize" })
345-
| Backend_type -> prim ~primitive:(Pctconst Backend_type) ~args loc)
346339
| Pcvtbint (a, b) -> (
347340
match (a, b) with
348341
| (Pbigint | Pint32), (Pbigint | Pint32) | Pint64, Pint64 ->

jscomp/core/lam_primitive.ml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ type t =
136136
| Plslint64
137137
| Plsrint64
138138
| Pasrint64
139-
(* Compile time constants *)
140-
| Pctconst of Lam_compat.compile_time_constant (* Integer to external pointer *)
141139
| Pdebugger
142140
| Pjs_unsafe_downgrade of { name : string; setter : bool }
143141
| Pinit_mod
@@ -331,12 +329,6 @@ let eq_primitive_approx (lhs : t) (rhs : t) =
331329
| Pint64comp comparison1 ->
332330
Lam_compat.eq_comparison comparison comparison1
333331
| _ -> false)
334-
| Pctconst compile_time_constant -> (
335-
match rhs with
336-
| Pctconst compile_time_constant1 ->
337-
Lam_compat.eq_compile_time_constant compile_time_constant
338-
compile_time_constant1
339-
| _ -> false)
340332
| Pjs_unsafe_downgrade { name; setter } -> (
341333
match rhs with
342334
| Pjs_unsafe_downgrade rhs -> name = rhs.name && setter = rhs.setter

jscomp/core/lam_primitive.mli

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,6 @@ type t =
126126
| Plslint64
127127
| Plsrint64
128128
| Pasrint64
129-
(* Compile time constants *)
130-
| Pctconst of Lam_compat.compile_time_constant
131129
(* Integer to external pointer *)
132130
| Pdebugger
133131
| Pjs_unsafe_downgrade of { name : string; setter : bool }

jscomp/core/lam_print.ml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,6 @@ let primitive ppf (prim : Lam_primitive.t) =
172172
| Parraysetu -> fprintf ppf "array.unsafe_set"
173173
| Parrayrefs -> fprintf ppf "array.get"
174174
| Parraysets -> fprintf ppf "array.set"
175-
| Pctconst c ->
176-
let const_name =
177-
match c with
178-
| Backend_type -> "backend_type"
179-
in
180-
fprintf ppf "sys.constant_%s" const_name
181175
| Pisint -> fprintf ppf "isint"
182176
| Pis_poly_var_block -> fprintf ppf "#is_poly_var_block"
183177
| Pisout i -> fprintf ppf "isout %d" i

jscomp/ml/lambda.ml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,6 @@
1313
(* *)
1414
(**************************************************************************)
1515

16-
17-
18-
19-
20-
type compile_time_constant =
21-
| Word_size
22-
| Int_size
23-
| Max_wosize
24-
| Backend_type
25-
2616
type loc_kind =
2717
| Loc_FILE
2818
| Loc_LINE
@@ -181,8 +171,6 @@ type immediate_or_pointer =
181171
| Immediate
182172
| Pointer
183173

184-
185-
186174
type is_safe =
187175
| Safe
188176
| Unsafe
@@ -261,7 +249,6 @@ type primitive =
261249
| Plsrbint of boxed_integer
262250
| Pasrbint of boxed_integer
263251
| Pbintcomp of boxed_integer * comparison
264-
| Pctconst of compile_time_constant
265252
| Pcreate_extension of string
266253
and comparison =
267254
Ceq | Cneq | Clt | Cgt | Cle | Cge

jscomp/ml/lambda.mli

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@
1717

1818
open Asttypes
1919

20-
type compile_time_constant =
21-
| Word_size
22-
| Int_size
23-
| Max_wosize
24-
| Backend_type
25-
2620
type loc_kind =
2721
| Loc_FILE
2822
| Loc_LINE
@@ -228,7 +222,6 @@ type primitive =
228222
| Plsrbint of boxed_integer
229223
| Pasrbint of boxed_integer
230224
| Pbintcomp of boxed_integer * comparison
231-
| Pctconst of compile_time_constant
232225
| Pcreate_extension of string
233226
and comparison =
234227
Ceq | Cneq | Clt | Cgt | Cle | Cge

jscomp/ml/printlambda.ml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,6 @@ let primitive ppf = function
210210
| Parraysetu -> fprintf ppf "array.unsafe_set"
211211
| Parrayrefs -> fprintf ppf "array.get"
212212
| Parraysets -> fprintf ppf "array.set"
213-
| Pctconst c ->
214-
let const_name = match c with
215-
| Word_size -> "word_size"
216-
| Int_size -> "int_size"
217-
| Max_wosize -> "max_wosize"
218-
| Backend_type -> "backend_type" in
219-
fprintf ppf "sys.constant_%s" const_name
220213
| Pisint -> fprintf ppf "isint"
221214
| Pisout -> fprintf ppf "isout"
222215
| Pbintofint bi -> print_boxed_integer "of_int" ppf bi
@@ -316,7 +309,6 @@ let name_of_primitive = function
316309
| Parraysetu -> "Parraysetu"
317310
| Parrayrefs -> "Parrayrefs"
318311
| Parraysets -> "Parraysets"
319-
| Pctconst _ -> "Pctconst"
320312
| Pisint -> "Pisint"
321313
| Pisout -> "Pisout"
322314
| Pbintofint _ -> "Pbintofint"

jscomp/ml/translcore.ml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,10 +323,6 @@ let primitives_table =
323323
("%sequand", Psequand);
324324
("%sequor", Psequor);
325325
("%boolnot", Pnot);
326-
("%backend_type", Pctconst Backend_type);
327-
("%word_size", Pctconst Word_size);
328-
("%int_size", Pctconst Int_size);
329-
("%max_wosize", Pctconst Max_wosize);
330326
("%negint", Pnegint);
331327
("%succint", Poffsetint 1);
332328
("%predint", Poffsetint (-1));

jscomp/test/406_primitive_test.js

Lines changed: 0 additions & 71 deletions
This file was deleted.

jscomp/test/406_primitive_test.res

Lines changed: 0 additions & 36 deletions
This file was deleted.

jscomp/test/build.ninja

Lines changed: 1 addition & 2 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)