Skip to content

Commit e82a16f

Browse files
committed
remove unused code
1 parent 6a5b199 commit e82a16f

File tree

9 files changed

+9
-458
lines changed

9 files changed

+9
-458
lines changed

jscomp/core/js_block_runtime.ml

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -23,74 +23,16 @@
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
2424

2525

26-
let tag_is_zero (tag : J.expression) =
27-
match tag.expression_desc with
28-
| Number (Int {i = 0l; _}) -> true
29-
| _ -> false;;
30-
31-
let needChromeRuntime
32-
(tag : J.expression)
33-
(tag_info : J.tag_info) =
34-
match tag_info with
35-
| Blk_poly_var _
36-
| Blk_constructor _ -> true
37-
| Blk_record_inlined _ -> true
38-
| Blk_record _
39-
| Blk_module_export
40-
| Blk_module _ -> false
41-
| Blk_tuple
42-
| Blk_extension
43-
| Blk_class
44-
| Blk_array
45-
| Blk_record_ext _ -> false
46-
| Blk_na _ -> not (tag_is_zero tag )
47-
48-
let needBlockRuntime (tag : J.expression) (tag_info : J.tag_info) =
49-
match tag_info with
50-
| Blk_poly_var _
51-
| Blk_module _
52-
| Blk_module_export
53-
| Blk_record _
54-
| Blk_tuple
55-
| Blk_extension
56-
| Blk_class
57-
| Blk_array -> false
58-
| Blk_record_inlined {num_nonconst = 1}
59-
| Blk_constructor {num_nonconst = 1}
60-
| Blk_na _ -> not (tag_is_zero tag)
61-
| Blk_record_inlined _
62-
| Blk_constructor _ -> true
63-
| Blk_record_ext _
64-
-> false
65-
(* converted to [Pcreate_extension] in the beginning*)
66-
6726
let option_id =
6827
Ident.create_persistent Js_runtime_modules.option
6928
let curry_id =
7029
Ident.create_persistent Js_runtime_modules.curry
71-
let block_id =
72-
Ident.create_persistent Js_runtime_modules.block
73-
let caml_chrome_id =
74-
Ident.create_persistent Js_runtime_modules.caml_chrome_block
7530

76-
let check_additional_id (x : J.expression) =
31+
let check_additional_id (x : J.expression) : Ident.t option =
7732
match x.expression_desc with
7833
| Optional_block(_,false) ->
7934
Some option_id
8035
| Call(_, _, {arity = NA}) ->
8136
Some curry_id
82-
| Caml_block(_,_,tag,tag_info)
83-
->
84-
if not !Js_config.debug then
85-
if needBlockRuntime tag tag_info then
86-
Some block_id
87-
else None
88-
else
89-
if needChromeRuntime tag tag_info then
90-
(* This may depends on two modules, so in the runtime
91-
we let chrome depends on block
92-
*)
93-
Some caml_chrome_id
94-
else None
9537
| _ ->
9638
None

jscomp/core/js_block_runtime.mli

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,7 @@
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-
val tag_is_zero :
26-
J.expression -> bool
2725

28-
val needChromeRuntime:
29-
J.expression ->
30-
J.tag_info ->
31-
bool
32-
33-
val needBlockRuntime:
34-
J.expression ->
35-
J.tag_info ->
36-
bool
3726

3827
val check_additional_id :
3928
J.expression -> Ident.t option

jscomp/core/js_dump.ml

Lines changed: 5 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ module L = Js_dump_lit
5959

6060
(* There modules are dynamically inserted in the last stage
6161
{Caml_curry}
62-
{Caml_block}
6362
{Caml_option}
6463
6564
They can appear anywhere so even if you have a module
@@ -95,36 +94,6 @@ module Curry_gen = struct
9594
P.string f (Printf.sprintf "%d" len)
9695
end
9796

98-
let block_dot f =
99-
P.string f Js_runtime_modules.block;
100-
P.string f L.dot
101-
102-
let pp_block_create f =
103-
block_dot f ;
104-
P.string f L.caml_block_create
105-
106-
let dbg_block_dot f =
107-
P.string f Js_runtime_modules.caml_chrome_block;
108-
P.string f L.dot
109-
110-
let dbg_block_create f =
111-
dbg_block_dot f ;
112-
P.string f L.caml_block_create
113-
114-
115-
116-
let dbg_poly_var f =
117-
dbg_block_dot f;
118-
P.string f L.block_poly_var
119-
120-
let dbg_simple_variant f =
121-
dbg_block_dot f ;
122-
P.string f L.block_simple_variant
123-
124-
let dbg_variant f =
125-
dbg_block_dot f ;
126-
P.string f L.block_variant
127-
12897

12998

13099
let return_indent = String.length L.return / Ext_pp.indent_length
@@ -899,79 +868,12 @@ and expression_desc cxt ~(level:int) f x : cxt =
899868
if p.num_nonconst = 1 && not !Js_config.debug then
900869
pp_comment_option f (Some p.name);
901870
expression_desc cxt ~level f (Object objs)
902-
| Caml_block( el, mutable_flag, tag, tag_info)
871+
| Caml_block ( _, _, _, (Blk_module_export | Blk_na _ )) -> assert false
872+
| Caml_block( el, mutable_flag, _tag, (Blk_tuple | Blk_class | Blk_array as tag_info))
903873
->
904-
pp_comment_option f (Lam_compile_util.comment_of_tag_info tag_info);
905-
(* Note that, if we ignore more than tag [0] we loose some information
906-
with regard tag
907-
908-
TODO: for numbers like 248, 255 we can reverse engineer to make it
909-
[Obj.xx_flag], but we can not do this in runtime libraries
910-
911-
When it does not need block runtime, it means it will be compiled
912-
as an array, note exception or open variant it is outer-most is
913-
simply an array
914-
*)
915-
if not !Js_config.debug then begin
916-
if not (Js_block_runtime.needBlockRuntime tag tag_info) then
917-
expression_desc cxt ~level f (Array (el, mutable_flag))
918-
else
919-
begin
920-
pp_block_create f;
921-
P.paren_group f 1 (fun _ -> arguments cxt f [tag; E.array mutable_flag el])
922-
end
923-
end
924-
else
925-
if not (Js_block_runtime.needChromeRuntime tag tag_info) then
926-
expression_desc cxt ~level f (Array (el, mutable_flag))
927-
else
928-
(
929-
match tag_info with
930-
| Blk_record _
931-
| Blk_module _
932-
| Blk_module_export ->
933-
assert false
934-
(*
935-
This can not happen, see the pattern match on previous branch
936-
TODO: we still need clean up local module compilation
937-
to make it more obvious
938-
*)
939-
| Blk_poly_var name ->
940-
dbg_poly_var f;
941-
P.paren_group f 1 (fun _ -> arguments cxt f [
942-
E.str name;
943-
E.array mutable_flag el])
944-
| Blk_constructor{name; num_nonconst = number}
945-
946-
-> (* has to be debug mode *)
947-
if number = 1 && Js_block_runtime.tag_is_zero tag then
948-
begin
949-
dbg_simple_variant f;
950-
P.paren_group f 1 (fun _ ->
951-
arguments cxt f
952-
[E.str name; E.array mutable_flag el])
953-
end
954-
else begin
955-
dbg_variant f;
956-
P.paren_group f 1 (fun _ ->
957-
arguments cxt f
958-
[E.str name; tag; E.array mutable_flag el])
959-
end
960-
961-
962-
963-
| Blk_record_inlined _ (* TODO: No support for debug mode yet *)
964-
| Blk_tuple
965-
| Blk_extension
966-
| Blk_class
967-
| Blk_array
968-
| Blk_record_ext _
969-
| Blk_na _
970-
->
971-
dbg_block_create f;
972-
P.paren_group f 1 (fun _ -> arguments cxt f [tag; E.array mutable_flag el])
973-
)
974-
874+
pp_comment_option f (Lam_compile_util.comment_of_tag_info tag_info);
875+
expression_desc cxt ~level f (Array (el, mutable_flag))
876+
975877
| Caml_block_tag e ->
976878
P.group f 1 (fun _ ->
977879
let cxt = expression ~level:15 cxt f e in

jscomp/ext/js_runtime_modules.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ let int64 = "Caml_int64"
4545
let md5 = "Caml_md5"
4646
let gc = "Caml_gc"
4747
let int32 = "Caml_int32"
48-
let block = "Block"
49-
let caml_chrome_block = "Caml_chrome_debugger"
48+
49+
5050
let option = "Caml_option"
5151
let module_ = "Caml_module"
5252
let external_polyfill = "Caml_external_polyfill"

jscomp/runtime/block.ml

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

jscomp/runtime/block.mli

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

0 commit comments

Comments
 (0)