Skip to content

Commit 182df9c

Browse files
committed
remove Caml_sys completely
1 parent b45dbed commit 182df9c

35 files changed

+40
-1318
lines changed

jscomp/core/lam_compat.ml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,6 @@ let cmp_int (cmp : comparison) (a : int) b : bool =
7878
| Cge -> a >= b
7979

8080
type compile_time_constant =
81-
| Big_endian
82-
| Ostype_unix
83-
| Ostype_win32
84-
| Ostype
8581
| Backend_type
8682

8783
(** relies on the fact that [compile_time_constant] is enum type *)

jscomp/core/lam_compat.mli

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ type boxed_integer = Lambda.boxed_integer = Pbigint | Pint32 | Pint64
2727
type comparison = Lambda.comparison = Ceq | Cneq | Clt | Cgt | Cle | Cge
2828

2929
type compile_time_constant =
30-
| Big_endian
31-
| Ostype_unix
32-
| Ostype_win32
33-
| Ostype
3430
| Backend_type
3531

3632
type let_kind = Lambda.let_kind = Strict | Alias | StrictOpt | Variable

jscomp/core/lam_compile_primitive.ml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -372,21 +372,6 @@ let translate output_prefix loc (cxt : Lam_compile_context.t)
372372
| Pis_poly_var_block -> E.is_type_object (Ext_list.singleton_exn args)
373373
| Pctconst ct -> (
374374
match ct with
375-
| Big_endian -> E.bool Sys.big_endian
376-
| Ostype -> E.runtime_call Js_runtime_modules.sys "os_type" args
377-
| Ostype_unix ->
378-
E.string_equal
379-
(E.runtime_call Js_runtime_modules.sys "os_type" args)
380-
(E.str "Unix")
381-
| Ostype_win32 ->
382-
E.string_equal
383-
(E.runtime_call Js_runtime_modules.sys "os_type" args)
384-
(E.str "Win32")
385-
(* | Max_wosize ->
386-
(* max_array_length*)
387-
E.int 2147483647l (* 2 ^ 31 - 1 *) *)
388-
(* 4_294_967_295l not representable*)
389-
(* 2 ^ 32 - 1*)
390375
| Backend_type ->
391376
E.make_block E.zero_int_literal
392377
(Blk_constructor { name = "Other"; num_nonconst = 1; tag = 0; attrs = [] })

jscomp/core/lam_convert.ml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,6 @@ let lam_prim ~primitive:(p : Lambda.primitive) ~args loc : Lam.t =
342342
Lam.const (Const_int { i = 32l; comment = None })
343343
| Max_wosize ->
344344
Lam.const (Const_int { i = 2147483647l; comment = Some "Max_wosize" })
345-
| Big_endian -> prim ~primitive:(Pctconst Big_endian) ~args loc
346-
| Ostype_unix -> prim ~primitive:(Pctconst Ostype_unix) ~args loc
347-
| Ostype_win32 -> prim ~primitive:(Pctconst Ostype_win32) ~args loc
348-
| Ostype_cygwin -> Lam.false_
349345
| Backend_type -> prim ~primitive:(Pctconst Backend_type) ~args loc)
350346
| Pcvtbint (a, b) -> (
351347
match (a, b) with
@@ -455,8 +451,6 @@ let convert (exports : Set_ident.t) (lam : Lambda.lambda) :
455451
(* ATT: Currently, the arity is one due to PPX *)
456452
prim ~primitive:Pdebugger ~args:[] loc
457453
| _ when s = "#null" -> Lam.const Const_js_null
458-
| _ when s = "#os_type" ->
459-
prim ~primitive:(Pctconst Ostype) ~args:[ unit ] loc
460454
| _ when s = "#undefined" -> Lam.const (Const_js_undefined {is_unit = false})
461455
| _ when s = "#init_mod" -> (
462456
let args = Ext_list.map args convert_aux in

jscomp/core/lam_dispatch_primitive.ml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,6 @@ let translate loc (prim_name : string) (args : J.expression list) : J.expression
205205
like normal one to set the identifier *)
206206
| "?exn_slot_name" | "?is_extension" -> call Js_runtime_modules.exceptions
207207
| "?as_js_exn" -> call Js_runtime_modules.caml_js_exceptions
208-
| "?sys_get_argv" | "?sys_file_exists" | "?sys_time" | "?sys_getenv"
209-
| "?sys_getcwd" (* check browser or nodejs *)
210-
| "?sys_is_directory" | "?sys_exit" ->
211-
call Js_runtime_modules.sys
212208
| "?make_float_vect"
213209
| "?floatarray_create" (* TODO: compile float array into TypedArray*) ->
214210
E.runtime_call Js_runtime_modules.array "make_float" args

jscomp/core/lam_print.ml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,6 @@ let primitive ppf (prim : Lam_primitive.t) =
175175
| Pctconst c ->
176176
let const_name =
177177
match c with
178-
| Big_endian -> "big_endian"
179-
| Ostype_unix -> "ostype_unix"
180-
| Ostype_win32 -> "ostype_win32"
181-
| Ostype -> "ostype"
182178
| Backend_type -> "backend_type"
183179
in
184180
fprintf ppf "sys.constant_%s" const_name

jscomp/ext/js_runtime_modules.ml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@
2424

2525
let exceptions = "Caml_exceptions"
2626

27-
let io = "Caml_io"
28-
29-
let sys = "Caml_sys"
30-
3127
let obj_runtime = "Caml_obj"
3228

3329
let array = "Caml_array"

jscomp/ml/lambda.ml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,9 @@
1818

1919

2020
type compile_time_constant =
21-
| Big_endian
2221
| Word_size
2322
| Int_size
2423
| Max_wosize
25-
| Ostype_unix
26-
| Ostype_win32
27-
| Ostype_cygwin
2824
| Backend_type
2925

3026
type loc_kind =

jscomp/ml/lambda.mli

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,9 @@
1818
open Asttypes
1919

2020
type compile_time_constant =
21-
| Big_endian
2221
| Word_size
2322
| Int_size
2423
| Max_wosize
25-
| Ostype_unix
26-
| Ostype_win32
27-
| Ostype_cygwin
2824
| Backend_type
2925

3026
type loc_kind =

jscomp/ml/printlambda.ml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,9 @@ let primitive ppf = function
212212
| Parraysets -> fprintf ppf "array.set"
213213
| Pctconst c ->
214214
let const_name = match c with
215-
| Big_endian -> "big_endian"
216215
| Word_size -> "word_size"
217216
| Int_size -> "int_size"
218217
| Max_wosize -> "max_wosize"
219-
| Ostype_unix -> "ostype_unix"
220-
| Ostype_win32 -> "ostype_win32"
221-
| Ostype_cygwin -> "ostype_cygwin"
222218
| Backend_type -> "backend_type" in
223219
fprintf ppf "sys.constant_%s" const_name
224220
| Pisint -> fprintf ppf "isint"

0 commit comments

Comments
 (0)