Skip to content

Commit 5f3dd58

Browse files
committed
slim bs_stdlib_mini
1 parent ed7db59 commit 5f3dd58

File tree

12 files changed

+45
-53
lines changed

12 files changed

+45
-53
lines changed

jscomp/runtime/bs_stdlib_mini.mli

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -165,17 +165,6 @@ end
165165

166166

167167

168-
169-
module Lexing : sig
170-
type lex_tables
171-
type lexbuf
172-
end
173-
174-
module Parsing : sig
175-
type parse_tables
176-
type parser_env
177-
end
178-
179168
module Int64 : sig
180169
external of_int : int -> int64 = "%int64_of_int"
181170
external of_nativeint : nativeint -> int64 = "%int64_of_nativeint"
@@ -192,29 +181,8 @@ module Oo : sig
192181
external id : < .. > -> int = "%field1"
193182
end
194183

195-
module Printexc : sig
196-
type raw_backtrace_slot
197-
type backtrace_slot
198-
end
199184

200-
module Gc : sig
201-
type stat
202-
type control
203-
end
204185

205-
module CamlinternalOO : sig
206-
type obj
207-
type closure
208-
end
209-
210-
module CamlinternalMod : sig
211-
type shape =
212-
| Function
213-
| Lazy
214-
| Class
215-
| Module of shape array
216-
| Value of Obj.t
217-
end
218186

219187
(* We should give it a name like FloatRT to avoid occasional shadowing *)
220188
module FloatRT : sig

jscomp/runtime/caml_gc.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525

2626

2727

28-
28+
type (*Gc.*)control
2929

3030
let caml_gc_counters : unit -> (float * float * float) = fun () -> (0.,0.,0.)
3131

3232

33-
let caml_gc_set : Gc.control -> unit = fun _ -> ();;
33+
let caml_gc_set : control -> unit = fun _ -> ();;
3434

3535
let caml_gc_minor : unit -> unit = fun _ -> ();;
3636

jscomp/runtime/caml_gc.mli

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@
2424

2525

2626

27+
type control
2728

2829
val caml_gc_counters : unit -> float * float * float
2930

30-
val caml_gc_set : Gc.control -> unit
31+
val caml_gc_set : control -> unit
3132
val caml_gc_minor : unit -> unit
3233
val caml_gc_major_slice : int -> int
3334
val caml_gc_major : unit -> unit

jscomp/runtime/caml_lexer.ml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525

2626

2727

28-
28+
type lex_tables
29+
type lexbuf
2930

3031
(** *)
3132

@@ -348,12 +349,12 @@ function $$caml_new_lex_engine(tbl, start_state, lexbuf) {
348349
}
349350
|}]
350351

351-
external caml_lex_engine : Lexing.lex_tables -> int -> Lexing.lexbuf -> int =
352+
external caml_lex_engine : lex_tables -> int -> lexbuf -> int =
352353
"$$caml_lex_engine"
353354
[@@bs.val ]
354355
(* [@@bs.local] *)
355356

356-
external caml_new_lex_engine : Lexing.lex_tables -> int -> Lexing.lexbuf -> int
357+
external caml_new_lex_engine : lex_tables -> int -> lexbuf -> int
357358
= "$$caml_new_lex_engine"
358359
[@@bs.val ]
359360
(* [@@bs.local] *)

jscomp/runtime/caml_lexer.mli

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,16 @@
2626

2727

2828

29-
(** *)
29+
30+
(* the same as Lexing *)
31+
type lex_tables
32+
type lexbuf
3033

3134
val fail : unit -> 'a
3235
(* export to avoid it getting shaked *)
3336
val caml_lex_engine :
34-
Lexing.lex_tables -> int -> Lexing.lexbuf -> int
37+
lex_tables -> int -> lexbuf -> int
3538

3639

3740
val caml_new_lex_engine :
38-
Lexing.lex_tables -> int -> Lexing.lexbuf -> int
41+
lex_tables -> int -> lexbuf -> int

jscomp/runtime/caml_module.ml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,20 @@
2222
* along with this program; if not, write to the Free Software
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
2424

25-
(** This module replaced camlinternalMod completely *)
25+
(** This module replaced camlinternalMod completely.
26+
Note we can replace {!CamlinternalMod} completely, but it is not replaced
27+
due to we believe this is an even low level dependency
28+
*)
29+
30+
31+
type shape =
32+
| Function
33+
| Lazy
34+
| Class
35+
| Module of shape array
36+
| Value of Obj.t
37+
(* ATTENTION: check across versions *)
2638

27-
type shape = CamlinternalMod.shape
2839
(** Note that we have to provide a drop in replacement, since compiler internally will
2940
spit out ("CamlinternalMod".[init_mod|update_mod] unless we intercept it
3041
in the lambda layer

jscomp/runtime/caml_oo.ml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131

3232

33+
type obj
34+
type closure
3335

3436
(** *)
3537

@@ -43,13 +45,13 @@
4345
let caml_methods_cache =
4446
Array.make 1000 0
4547

46-
external get_methods : CamlinternalOO.obj -> CamlinternalOO.closure array =
48+
external get_methods : obj -> closure array =
4749
"%field0"
4850

4951

5052
let caml_get_public_method
51-
(obj : CamlinternalOO.obj)
52-
(tag : int) (cacheid : int) : CamlinternalOO.closure =
53+
(obj : obj)
54+
(tag : int) (cacheid : int) : closure =
5355
let meths = get_methods obj in
5456
let offs = caml_methods_cache.(cacheid) in
5557
if (Bs_obj.magic meths.(offs) : int) = tag then meths.(offs - 1)

jscomp/runtime/caml_oo.mli

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,7 @@
2929

3030

3131
(** *)
32+
type obj
33+
type closure
3234

33-
val caml_get_public_method : CamlinternalOO.obj -> int -> int -> CamlinternalOO.closure
35+
val caml_get_public_method : obj -> int -> int -> closure

jscomp/runtime/caml_parser.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,10 +386,12 @@ function $$caml_set_parser_trace(v) {
386386
}
387387

388388
|}]
389+
type parse_tables
390+
type parser_env
389391

390392
external caml_parse_engine :
391-
Parsing.parse_tables ->
392-
Parsing.parser_env ->
393+
parse_tables ->
394+
parser_env ->
393395
(* Parsing.parser_input *) Obj.t ->
394396
Obj.t ->
395397
(* parser_output *) Obj.t = "$$caml_parse_engine"

jscomp/runtime/caml_parser.mli

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@
2626

2727

2828
(** *)
29+
type parse_tables
30+
type parser_env
2931

3032
val caml_parse_engine :
31-
Parsing.parse_tables -> Parsing.parser_env ->
33+
parse_tables -> parser_env ->
3234
Obj.t (* Parsing.parser_input *) -> Obj.t ->
3335
(* parser_output *) Obj.t
3436

0 commit comments

Comments
 (0)