Skip to content

Commit 2c816aa

Browse files
committed
remove generic hashtbl completely, clean up
1 parent f1e213b commit 2c816aa

28 files changed

+1111
-839
lines changed

jscomp/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ ext/int_hashtbl.ml: ext/hashtbl.cppo.ml
8181
cppo -D TYPE_INT $< -o $@
8282
ext/ident_hashtbl.ml: ext/hashtbl.cppo.ml
8383
cppo -D TYPE_IDENT $< -o $@
84+
ext/hashtbl_make.ml: ext/hashtbl.cppo.ml
85+
cppo -D TYPE_FUNCTOR $< -o $@
8486
## Stubs
8587
.c.o:
8688
$(NATIVE) -ccopt -o -ccopt $@ -c $<
@@ -144,7 +146,6 @@ EXT_SRCS = ext_util\
144146
map_make\
145147
ext_file_pp ext_format \
146148
hashtbl_gen \
147-
ext_hashtbl \
148149
ext_string \
149150
string_hashtbl\
150151
ext_list \
@@ -160,6 +161,7 @@ EXT_SRCS = ext_util\
160161
ext_ident\
161162
ident_map\
162163
ident_set\
164+
hashtbl_make\
163165
ordered_hash_map_local_ident\
164166
int_map\
165167
literals \

jscomp/all.depend

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ ext/map_make.cmx : ext/map_gen.cmx ext/map_make.cmi
1616
ext/ext_file_pp.cmx : ext/ext_file_pp.cmi
1717
ext/ext_format.cmx : ext/ext_format.cmi
1818
ext/hashtbl_gen.cmx : ext/ext_util.cmx
19-
ext/ext_hashtbl.cmx : ext/ext_hashtbl.cmi
2019
ext/ext_string.cmx : ext/ext_bytes.cmx ext/ext_string.cmi
2120
ext/string_hashtbl.cmx : ext/hashtbl_gen.cmx ext/ext_string.cmx \
2221
stubs/bs_hash_stubs.cmx ext/string_hashtbl.cmi
@@ -45,6 +44,7 @@ ext/ext_ident.cmx : ext/string_hashtbl.cmx ext/string_hash_set.cmx \
4544
ext/ext_string.cmx ext/ext_ident.cmi
4645
ext/ident_map.cmx : ext/map_gen.cmx ext/ext_ident.cmx ext/ident_map.cmi
4746
ext/ident_set.cmx : ext/set_gen.cmx ext/ident_set.cmi
47+
ext/hashtbl_make.cmx : ext/hashtbl_gen.cmx ext/hashtbl_make.cmi
4848
ext/ordered_hash_map_local_ident.cmx : ext/ordered_hash_map_gen.cmx \
4949
ext/ext_ident.cmx stubs/bs_hash_stubs.cmx \
5050
ext/ordered_hash_map_local_ident.cmi
@@ -79,7 +79,6 @@ ext/int_vec_vec.cmi : ext/vec_gen.cmx ext/int_vec.cmi
7979
ext/map_make.cmi : ext/map_gen.cmx
8080
ext/ext_file_pp.cmi :
8181
ext/ext_format.cmi :
82-
ext/ext_hashtbl.cmi :
8382
ext/ext_string.cmi :
8483
ext/string_hashtbl.cmi : ext/hashtbl_gen.cmx
8584
ext/ext_list.cmi :
@@ -98,6 +97,7 @@ ext/union_find.cmi :
9897
ext/ext_ident.cmi :
9998
ext/ident_map.cmi : ext/map_gen.cmx
10099
ext/ident_set.cmi : ext/set_gen.cmx
100+
ext/hashtbl_make.cmi : ext/hashtbl_gen.cmx
101101
ext/ordered_hash_map_local_ident.cmi : ext/ordered_hash_map_gen.cmx
102102
ext/int_map.cmi : ext/map_gen.cmx
103103
ext/literals.cmi :
@@ -203,9 +203,10 @@ depends/depends_post_process.cmx : ext/string_map.cmx ext/literals.cmx \
203203
ext/ext_string.cmx ext/ext_pervasives.cmx common/binary_cache.cmx \
204204
depends/depends_post_process.cmi
205205
depends/bs_exception.cmx : depends/bs_exception.cmi
206-
depends/ast_extract.cmx : ext/string_map.cmx common/js_config.cmx \
207-
ext/ext_string.cmx ext/ext_list.cmx ext/ext_format.cmx \
208-
ext/ext_filename.cmx depends/bs_exception.cmx depends/ast_extract.cmi
206+
depends/ast_extract.cmx : ext/string_map.cmx ext/string_hashtbl.cmx \
207+
common/js_config.cmx ext/ext_string.cmx ext/ext_list.cmx \
208+
ext/ext_format.cmx ext/ext_filename.cmx depends/bs_exception.cmx \
209+
depends/ast_extract.cmi
209210
depends/binary_ast.cmx : depends/ast_extract.cmx depends/binary_ast.cmi
210211
core/type_util.cmi :
211212
core/bs_conditional_initial.cmi :
@@ -224,7 +225,8 @@ core/js_closure.cmi : ext/ident_set.cmi
224225
core/js_number.cmi :
225226
core/js_cmj_datasets.cmi : ext/string_map.cmi core/js_cmj_format.cmi
226227
core/lam_exit_code.cmi : core/lam.cmi
227-
core/lam_module_ident.cmi : core/js_op.cmx common/js_config.cmi core/j.cmx
228+
core/lam_module_ident.cmi : core/js_op.cmx common/js_config.cmi core/j.cmx \
229+
ext/hashtbl_gen.cmx
228230
core/lam_compile_util.cmi : core/js_op.cmx
229231
core/lam_stats.cmi : core/lam_module_ident.cmi core/lam.cmi \
230232
ext/int_hash_set.cmi ext/ident_set.cmi ext/ident_hashtbl.cmi
@@ -320,6 +322,7 @@ core/lam_exit_code.cmx : core/lam.cmx core/lam_exit_code.cmi
320322
core/j.cmx : core/js_op.cmx core/js_fun_env.cmx core/js_closure.cmx \
321323
core/js_call_info.cmx ext/ident_set.cmx
322324
core/lam_module_ident.cmx : core/js_op.cmx common/js_config.cmx core/j.cmx \
325+
ext/hashtbl_make.cmx ext/ext_ident.cmx stubs/bs_hash_stubs.cmx \
323326
core/lam_module_ident.cmi
324327
core/lam_compile_util.cmx : core/js_op.cmx core/lam_compile_util.cmi
325328
core/lam_stats.cmx : core/lam_module_ident.cmx core/lam.cmx \
@@ -421,7 +424,8 @@ core/lam_pass_collect.cmx : core/lam_util.cmx core/lam_stats_util.cmx \
421424
core/js_program_loader.cmx : core/lam_module_ident.cmx \
422425
core/lam_compile_env.cmx core/js_stmt_make.cmx core/js_exp_make.cmx \
423426
common/js_config.cmx core/j.cmx ext/ident_set.cmx ext/ext_pervasives.cmx \
424-
ext/ext_filename.cmx core/config_util.cmx core/js_program_loader.cmi
427+
ext/ext_filename.cmx core/config_util.cmx depends/bs_exception.cmx \
428+
core/js_program_loader.cmi
425429
core/js_dump.cmx : ext/literals.cmx core/lam_module_ident.cmx \
426430
core/js_stmt_make.cmx core/js_program_loader.cmx core/js_op_util.cmx \
427431
core/js_op.cmx core/js_number.cmx core/js_fun_env.cmx \
@@ -604,7 +608,8 @@ bsb/bsb_main.cmx : ext/string_vec.cmx ext/literals.cmx ext/ext_string.cmx \
604608
bsb/bsb_ninja.cmx : ext/string_set.cmx ext/string_map.cmx ext/literals.cmx \
605609
ext/ext_filename.cmx bsb/bsb_config.cmx bsb/bsb_build_util.cmx \
606610
bsb/bsb_build_ui.cmx common/binary_cache.cmx bsb/bsb_ninja.cmi
607-
bsb/sexp_eval.cmx : bsb/sexp_lexer.cmx ext/ext_list.cmx
611+
bsb/sexp_eval.cmx : ext/string_hashtbl.cmx bsb/sexp_lexer.cmx \
612+
ext/ext_list.cmx
608613
bsb/sexp_lexer.cmx : bsb/sexp_lexer.cmi
609614
bsb/bsb_build_ui.cmi : ext/string_set.cmi ext/string_map.cmi \
610615
ext/ext_file_pp.cmi bsb/bsb_json.cmi common/binary_cache.cmi

jscomp/bin/all_ounit_tests.ml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4600,7 +4600,7 @@ let key_index (h : _ t ) (key : key) =
46004600
(Bs_hash_stubs.hash_string key ) land (Array.length h.data - 1)
46014601
let eq_key = Ext_string.equal
46024602

4603-
# 24
4603+
# 33
46044604
type ('a, 'b) bucketlist = ('a,'b) Hashtbl_gen.bucketlist
46054605
let create = Hashtbl_gen.create
46064606
let clear = Hashtbl_gen.clear
@@ -4712,6 +4712,7 @@ let of_list2 ks vs =
47124712
List.iter2 (fun k v -> add map k v) ks vs ;
47134713
map
47144714

4715+
47154716
end
47164717
module Ounit_hashtbl_tests
47174718
= struct
@@ -7934,11 +7935,15 @@ let normalize_absolute_path x =
79347935

79357936

79367937
let get_extension x =
7938+
let pos = Ext_string.rindex_neg x '.' in
7939+
if pos < 0 then ""
7940+
else Ext_string.tail_from x pos
7941+
(*
79377942
try
79387943
let pos = String.rindex x '.' in
79397944
Ext_string.tail_from x pos
79407945
with Not_found -> ""
7941-
7946+
*)
79427947

79437948

79447949
end

jscomp/bin/bsb.ml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1391,11 +1391,15 @@ let normalize_absolute_path x =
13911391

13921392

13931393
let get_extension x =
1394+
let pos = Ext_string.rindex_neg x '.' in
1395+
if pos < 0 then ""
1396+
else Ext_string.tail_from x pos
1397+
(*
13941398
try
13951399
let pos = String.rindex x '.' in
13961400
Ext_string.tail_from x pos
13971401
with Not_found -> ""
1398-
1402+
*)
13991403

14001404

14011405
end

jscomp/bin/bsb_helper.ml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1357,11 +1357,15 @@ let normalize_absolute_path x =
13571357

13581358

13591359
let get_extension x =
1360+
let pos = Ext_string.rindex_neg x '.' in
1361+
if pos < 0 then ""
1362+
else Ext_string.tail_from x pos
1363+
(*
13601364
try
13611365
let pos = String.rindex x '.' in
13621366
Ext_string.tail_from x pos
13631367
with Not_found -> ""
1364-
1368+
*)
13651369

13661370

13671371
end

jscomp/bin/bsdep.ml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26575,11 +26575,15 @@ let normalize_absolute_path x =
2657526575

2657626576

2657726577
let get_extension x =
26578+
let pos = Ext_string.rindex_neg x '.' in
26579+
if pos < 0 then ""
26580+
else Ext_string.tail_from x pos
26581+
(*
2657826582
try
2657926583
let pos = String.rindex x '.' in
2658026584
Ext_string.tail_from x pos
2658126585
with Not_found -> ""
26582-
26586+
*)
2658326587

2658426588

2658526589
end

jscomp/bin/bsppx.ml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8433,11 +8433,15 @@ let normalize_absolute_path x =
84338433

84348434

84358435
let get_extension x =
8436+
let pos = Ext_string.rindex_neg x '.' in
8437+
if pos < 0 then ""
8438+
else Ext_string.tail_from x pos
8439+
(*
84368440
try
84378441
let pos = String.rindex x '.' in
84388442
Ext_string.tail_from x pos
84398443
with Not_found -> ""
8440-
8444+
*)
84418445

84428446

84438447
end

jscomp/bin/whole_compiler.d

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ bin/whole_compiler.ml : ext/ext_format.ml
5252
bin/whole_compiler.ml : ext/ext_format.mli
5353
bin/whole_compiler.ml : ext/ext_list.ml
5454
bin/whole_compiler.ml : ext/ext_list.mli
55+
bin/whole_compiler.ml : stubs/bs_hash_stubs.ml
56+
bin/whole_compiler.ml : ext/ext_util.ml
57+
bin/whole_compiler.ml : ext/ext_util.mli
58+
bin/whole_compiler.ml : ext/hashtbl_gen.ml
59+
bin/whole_compiler.ml : ext/string_hashtbl.ml
60+
bin/whole_compiler.ml : ext/string_hashtbl.mli
5561
bin/whole_compiler.ml : ext/map_gen.ml
5662
bin/whole_compiler.ml : ext/string_map.ml
5763
bin/whole_compiler.ml : ext/string_map.mli
@@ -130,15 +136,9 @@ bin/whole_compiler.ml : ../ocaml/driver/compmisc.ml
130136
bin/whole_compiler.ml : ../ocaml/driver/compmisc.mli
131137
bin/whole_compiler.ml : common/ext_log.ml
132138
bin/whole_compiler.ml : common/ext_log.mli
133-
bin/whole_compiler.ml : stubs/bs_hash_stubs.ml
134-
bin/whole_compiler.ml : ext/ext_util.ml
135-
bin/whole_compiler.ml : ext/ext_util.mli
136139
bin/whole_compiler.ml : ext/hash_set_gen.ml
137140
bin/whole_compiler.ml : ext/string_hash_set.ml
138141
bin/whole_compiler.ml : ext/string_hash_set.mli
139-
bin/whole_compiler.ml : ext/hashtbl_gen.ml
140-
bin/whole_compiler.ml : ext/string_hashtbl.ml
141-
bin/whole_compiler.ml : ext/string_hashtbl.mli
142142
bin/whole_compiler.ml : ext/ext_ident.ml
143143
bin/whole_compiler.ml : ext/ext_ident.mli
144144
bin/whole_compiler.ml : ext/ident_map.ml
@@ -200,6 +200,7 @@ bin/whole_compiler.ml : ext/ident_hashtbl.ml
200200
bin/whole_compiler.ml : ext/ident_hashtbl.mli
201201
bin/whole_compiler.ml : core/lam_analysis.ml
202202
bin/whole_compiler.ml : core/lam_analysis.mli
203+
bin/whole_compiler.ml : ext/hashtbl_make.ml
203204
bin/whole_compiler.ml : core/lam_module_ident.ml
204205
bin/whole_compiler.ml : core/lam_module_ident.mli
205206
bin/whole_compiler.ml : core/lam_print.ml

0 commit comments

Comments
 (0)