Skip to content

Commit aa87a06

Browse files
committed
remove Caml_sys completely
1 parent 26e30fc commit aa87a06

35 files changed

+40
-1314
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"

jscomp/ml/translcore.ml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,14 +323,10 @@ let primitives_table =
323323
("%sequand", Psequand);
324324
("%sequor", Psequor);
325325
("%boolnot", Pnot);
326-
("%big_endian", Pctconst Big_endian);
327326
("%backend_type", Pctconst Backend_type);
328327
("%word_size", Pctconst Word_size);
329328
("%int_size", Pctconst Int_size);
330329
("%max_wosize", Pctconst Max_wosize);
331-
("%ostype_unix", Pctconst Ostype_unix);
332-
("%ostype_win32", Pctconst Ostype_win32);
333-
("%ostype_cygwin", Pctconst Ostype_cygwin);
334330
("%negint", Pnegint);
335331
("%succint", Poffsetint 1);
336332
("%predint", Poffsetint (-1));

jscomp/runtime/caml_sys.res

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

jscomp/runtime/caml_sys.resi

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

jscomp/runtime/release.ninja

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ o runtime/caml_splice_call.cmj : cc_cmi runtime/caml_splice_call.res | runtime/c
4545
o runtime/caml_splice_call.cmi : cc runtime/caml_splice_call.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
4646
o runtime/caml_string.cmj : cc_cmi runtime/caml_string.res | runtime/caml_string.cmi runtime/caml_string_extern.cmj
4747
o runtime/caml_string.cmi : cc runtime/caml_string.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
48-
o runtime/caml_sys.cmj : cc_cmi runtime/caml_sys.res | runtime/caml_array_extern.cmj runtime/caml_sys.cmi runtime/caml_undefined_extern.cmj
49-
o runtime/caml_sys.cmi : cc runtime/caml_sys.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
5048
o runtime/caml_array_extern.cmi runtime/caml_array_extern.cmj : cc runtime/caml_array_extern.res | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
5149
o runtime/caml_bigint_extern.cmi runtime/caml_bigint_extern.cmj : cc runtime/caml_bigint_extern.res | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
5250
o runtime/caml_float_extern.cmi runtime/caml_float_extern.cmj : cc runtime/caml_float_extern.res | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
@@ -56,4 +54,4 @@ o runtime/caml_nativeint_extern.cmi runtime/caml_nativeint_extern.cmj : cc runti
5654
o runtime/caml_string_extern.cmi runtime/caml_string_extern.cmj : cc runtime/caml_string_extern.res | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
5755
o runtime/caml_undefined_extern.cmi runtime/caml_undefined_extern.cmj : cc runtime/caml_undefined_extern.res | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
5856
o runtime/curry.cmi runtime/curry.cmj : cc runtime/curry.res | runtime/bs_stdlib_mini.cmi runtime/caml_array.cmj runtime/caml_array_extern.cmj runtime/js.cmi runtime/js.cmj
59-
o runtime : phony runtime/bs_stdlib_mini.cmi runtime/js.cmj runtime/js.cmi runtime/caml.cmi runtime/caml.cmj runtime/caml_array.cmi runtime/caml_array.cmj runtime/caml_bigint.cmi runtime/caml_bigint.cmj runtime/caml_bytes.cmi runtime/caml_bytes.cmj runtime/caml_exceptions.cmi runtime/caml_exceptions.cmj runtime/caml_float.cmi runtime/caml_float.cmj runtime/caml_hash.cmi runtime/caml_hash.cmj runtime/caml_hash_primitive.cmi runtime/caml_hash_primitive.cmj runtime/caml_int32.cmi runtime/caml_int32.cmj runtime/caml_int64.cmi runtime/caml_int64.cmj runtime/caml_md5.cmi runtime/caml_md5.cmj runtime/caml_module.cmi runtime/caml_module.cmj runtime/caml_obj.cmi runtime/caml_obj.cmj runtime/caml_option.cmi runtime/caml_option.cmj runtime/caml_splice_call.cmi runtime/caml_splice_call.cmj runtime/caml_string.cmi runtime/caml_string.cmj runtime/caml_sys.cmi runtime/caml_sys.cmj runtime/caml_array_extern.cmi runtime/caml_array_extern.cmj runtime/caml_bigint_extern.cmi runtime/caml_bigint_extern.cmj runtime/caml_float_extern.cmi runtime/caml_float_extern.cmj runtime/caml_int64_extern.cmi runtime/caml_int64_extern.cmj runtime/caml_js_exceptions.cmi runtime/caml_js_exceptions.cmj runtime/caml_nativeint_extern.cmi runtime/caml_nativeint_extern.cmj runtime/caml_string_extern.cmi runtime/caml_string_extern.cmj runtime/caml_undefined_extern.cmi runtime/caml_undefined_extern.cmj runtime/curry.cmi runtime/curry.cmj
57+
o runtime : phony runtime/bs_stdlib_mini.cmi runtime/js.cmj runtime/js.cmi runtime/caml.cmi runtime/caml.cmj runtime/caml_array.cmi runtime/caml_array.cmj runtime/caml_bigint.cmi runtime/caml_bigint.cmj runtime/caml_bytes.cmi runtime/caml_bytes.cmj runtime/caml_exceptions.cmi runtime/caml_exceptions.cmj runtime/caml_float.cmi runtime/caml_float.cmj runtime/caml_hash.cmi runtime/caml_hash.cmj runtime/caml_hash_primitive.cmi runtime/caml_hash_primitive.cmj runtime/caml_int32.cmi runtime/caml_int32.cmj runtime/caml_int64.cmi runtime/caml_int64.cmj runtime/caml_md5.cmi runtime/caml_md5.cmj runtime/caml_module.cmi runtime/caml_module.cmj runtime/caml_obj.cmi runtime/caml_obj.cmj runtime/caml_option.cmi runtime/caml_option.cmj runtime/caml_splice_call.cmi runtime/caml_splice_call.cmj runtime/caml_string.cmi runtime/caml_string.cmj runtime/caml_array_extern.cmi runtime/caml_array_extern.cmj runtime/caml_bigint_extern.cmi runtime/caml_bigint_extern.cmj runtime/caml_float_extern.cmi runtime/caml_float_extern.cmj runtime/caml_int64_extern.cmi runtime/caml_int64_extern.cmj runtime/caml_js_exceptions.cmi runtime/caml_js_exceptions.cmj runtime/caml_nativeint_extern.cmi runtime/caml_nativeint_extern.cmj runtime/caml_string_extern.cmi runtime/caml_string_extern.cmj runtime/caml_undefined_extern.cmi runtime/caml_undefined_extern.cmj runtime/curry.cmi runtime/curry.cmj

jscomp/stdlib-406/pervasives.res

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -211,26 +211,4 @@ let rec \"@" = (l1, l2) =>
211211

212212
/* Miscellaneous */
213213

214-
external sys_exit: int => 'a = "?sys_exit"
215-
216-
let exit_function = ref(ignore)
217-
218-
let at_exit = f => {
219-
let g = exit_function.contents
220-
exit_function :=
221-
(
222-
() => {
223-
f()
224-
g()
225-
}
226-
)
227-
}
228-
229-
let do_at_exit = () => exit_function.contents()
230-
231-
let exit = retcode => {
232-
do_at_exit()
233-
sys_exit(retcode)
234-
}
235-
236214
type int32 = int

jscomp/stdlib-406/pervasives.resi

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -619,25 +619,3 @@ external incr: ref<int> => unit = "%incr"
619619
/** Decrement the integer contained in the given reference.
620620
Equivalent to [fun r -> r := pred !r]. */
621621
external decr: ref<int> => unit = "%decr"
622-
623-
/* {1 Program termination} */
624-
625-
/** Terminate the process, returning the given status code
626-
to the operating system: usually 0 to indicate no errors,
627-
and a small positive integer to indicate failure.
628-
All open output channels are flushed with [flush_all].
629-
An implicit [exit 0] is performed each time a program
630-
terminates normally. An implicit [exit 2] is performed if the program
631-
terminates early because of an uncaught exception. */
632-
let exit: int => 'a
633-
634-
/** Register the given function to be called at program termination
635-
time. The functions registered with [at_exit] will be called when
636-
the program does any of the following:
637-
- executes {!Pervasives.exit}
638-
- terminates, either normally or because of an uncaught
639-
exception
640-
- executes the C function [caml_shutdown].
641-
The functions are called in 'last in, first out' order: the
642-
function most recently added with [at_exit] is called first. */
643-
let at_exit: (unit => unit) => unit

0 commit comments

Comments
 (0)