Skip to content

Commit be7e73b

Browse files
committed
Merge pull request ocaml#5 from AltGr/comparison_branch
Get GC stats (finally)
2 parents 5e86a31 + 8cac484 commit be7e73b

File tree

13 files changed

+60
-44
lines changed

13 files changed

+60
-44
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ bootstrap:
200200
$(MAKE) all
201201
$(MAKE) compare
202202

203-
LIBFILES=stdlib.cma std_exit.cmo *.cmi camlheader
203+
LIBFILES=stdlib.cma std_init.cmo std_exit.cmo *.cmi camlheader
204204

205205
# Start up the system from the distribution compiler
206206
coldstart:

Makefile.nt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ bootstrap:
165165
$(MAKEREC) all
166166
$(MAKEREC) compare
167167

168-
LIBFILES=stdlib.cma std_exit.cmo *.cmi camlheader
168+
LIBFILES=stdlib.cma std_init.cmo std_exit.cmo *.cmi camlheader
169169

170170
# Start up the system from the distribution compiler
171171
coldstart:

asmcomp/asmlink.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,14 @@ let call_linker file_list startup_file output_name =
303303
let link ppf objfiles output_name =
304304
let stdlib =
305305
if !Clflags.gprofile then "stdlib.p.cmxa" else "stdlib.cmxa" in
306+
let stdinit =
307+
if !Clflags.gprofile then "std_init.p.cmx" else "std_init.cmx" in
306308
let stdexit =
307309
if !Clflags.gprofile then "std_exit.p.cmx" else "std_exit.cmx" in
308310
let objfiles =
309311
if !Clflags.nopervasives then objfiles
310312
else if !Clflags.output_c_object then stdlib :: objfiles
311-
else stdlib :: (objfiles @ [stdexit]) in
313+
else stdlib :: stdinit :: (objfiles @ [stdexit]) in
312314
let units_tolink = List.fold_right scan_file objfiles [] in
313315
Array.iter remove_required Runtimedef.builtin_exceptions;
314316
begin match extract_missing_globals() with

bytecomp/bytelink.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ let link ppf objfiles output_name =
537537
let objfiles =
538538
if !Clflags.nopervasives then objfiles
539539
else if !Clflags.output_c_object then "stdlib.cma" :: objfiles
540-
else "stdlib.cma" :: (objfiles @ ["std_exit.cmo"]) in
540+
else "stdlib.cma" :: "std_init.cmo" :: (objfiles @ ["std_exit.cmo"]) in
541541
let tolink = List.fold_right scan_file objfiles [] in
542542
Clflags.ccobjs := !Clflags.ccobjs @ !lib_ccobjs; (* put user's libs last *)
543543
Clflags.all_ccopts := !lib_ccopts @ !Clflags.all_ccopts;

otherlibs/threads/pervasives.ml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -610,15 +610,11 @@ external sys_exit : int -> 'a = "caml_sys_exit"
610610

611611
let exit_function = ref flush_all
612612

613-
let last_exit_function = ref (fun () -> ())
614-
615613
let at_exit f =
616614
let g = !exit_function in
617615
exit_function := (fun () -> f(); g())
618616

619-
let do_at_exit () =
620-
(!exit_function) ();
621-
(!last_exit_function) ()
617+
let do_at_exit () = (!exit_function) ()
622618

623619
let exit retcode =
624620
do_at_exit ();

stdlib/.depend

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ sort.cmo : array.cmi sort.cmi
157157
sort.cmx : array.cmx sort.cmi
158158
stack.cmo : list.cmi stack.cmi
159159
stack.cmx : list.cmx stack.cmi
160+
std_init.cmo :
161+
std_init.cmx :
160162
std_exit.cmo :
161163
std_exit.cmx :
162164
stdLabels.cmo : stringLabels.cmi listLabels.cmi bytesLabels.cmi \
@@ -283,6 +285,8 @@ sort.cmo : array.cmi sort.cmi
283285
sort.p.cmx : array.p.cmx sort.cmi
284286
stack.cmo : list.cmi stack.cmi
285287
stack.p.cmx : list.p.cmx stack.cmi
288+
std_init.cmo :
289+
std_init.p.cmx :
286290
std_exit.cmo :
287291
std_exit.p.cmx :
288292
stdLabels.cmo : stringLabels.cmi listLabels.cmi bytesLabels.cmi \

stdlib/Makefile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,36 @@
1414
include Makefile.shared
1515

1616
allopt:
17-
$(MAKE) stdlib.cmxa std_exit.cmx
17+
$(MAKE) stdlib.cmxa std_init.cmx std_exit.cmx
1818
$(MAKE) allopt-$(PROFILING)
1919

2020
allopt-noprof:
2121

22-
allopt-prof: stdlib.p.cmxa std_exit.p.cmx
23-
rm -f std_exit.p.cmi
22+
allopt-prof: stdlib.p.cmxa std_init.p.cmx std_exit.p.cmx
23+
rm -f std_init.p.cmi std_exit.p.cmi
2424

2525
installopt: installopt-default installopt-$(PROFILING)
2626

2727
installopt-default:
28-
cp stdlib.cmxa stdlib.a std_exit.o *.cmx $(INSTALL_LIBDIR)
28+
cp stdlib.cmxa stdlib.a std_init.o std_exit.o *.cmx $(INSTALL_LIBDIR)
2929
cd $(INSTALL_LIBDIR); $(RANLIB) stdlib.a
3030

3131
installopt-noprof:
3232
rm -f $(INSTALL_LIBDIR)/stdlib.p.cmxa; \
3333
ln -s stdlib.cmxa $(INSTALL_LIBDIR)/stdlib.p.cmxa
3434
rm -f $(INSTALL_LIBDIR)/stdlib.p.a; \
3535
ln -s stdlib.a $(INSTALL_LIBDIR)/stdlib.p.a
36+
rm -f $(INSTALL_LIBDIR)/std_init.p.cmx; \
37+
ln -s std_init.cmx $(INSTALL_LIBDIR)/std_init.p.cmx
38+
rm -f $(INSTALL_LIBDIR)/std_init.p.o; \
39+
ln -s std_init.o $(INSTALL_LIBDIR)/std_init.p.o
3640
rm -f $(INSTALL_LIBDIR)/std_exit.p.cmx; \
3741
ln -s std_exit.cmx $(INSTALL_LIBDIR)/std_exit.p.cmx
3842
rm -f $(INSTALL_LIBDIR)/std_exit.p.o; \
3943
ln -s std_exit.o $(INSTALL_LIBDIR)/std_exit.p.o
4044

4145
installopt-prof:
42-
cp stdlib.p.cmxa stdlib.p.a std_exit.p.cmx std_exit.p.o $(INSTALL_LIBDIR)
46+
cp stdlib.p.cmxa stdlib.p.a std_init.p.cmx std_init.p.o std_exit.p.cmx std_exit.p.o $(INSTALL_LIBDIR)
4347
cd $(INSTALL_LIBDIR); $(RANLIB) stdlib.p.a
4448

4549
stdlib.p.cmxa: $(OBJS:.cmo=.p.cmx)

stdlib/Makefile.nt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
include Makefile.shared
1515

16-
allopt: stdlib.cmxa std_exit.cmx
16+
allopt: stdlib.cmxa std_init.cmx std_exit.cmx
1717

1818
installopt:
19-
cp stdlib.cmxa stdlib.$(A) std_exit.$(O) *.cmx $(INSTALL_LIBDIR)
19+
cp stdlib.cmxa stdlib.$(A) std_init.$(O) std_exit.$(O) *.cmx $(INSTALL_LIBDIR)
2020

2121
camlheader target_camlheader camlheader_ur: headernt.c ../config/Makefile
2222
$(BYTECC) $(BYTECCCOMPOPTS) -c -I../byterun \

stdlib/Makefile.shared

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ OTHERS=array.cmo list.cmo char.cmo bytes.cmo string.cmo sys.cmo \
4141
arrayLabels.cmo listLabels.cmo bytesLabels.cmo \
4242
stringLabels.cmo moreLabels.cmo stdLabels.cmo
4343

44-
all: stdlib.cma std_exit.cmo camlheader target_camlheader camlheader_ur
44+
all: stdlib.cma std_init.cmo std_exit.cmo camlheader target_camlheader camlheader_ur
4545

4646
INSTALL_LIBDIR=$(DESTDIR)$(LIBDIR)
4747

4848
install: install-$(RUNTIMED)
49-
cp stdlib.cma std_exit.cmo *.cmi *.cmt *.cmti *.mli *.ml \
49+
cp stdlib.cma std_init.cmo std_exit.cmo *.cmi *.cmt *.cmti *.mli *.ml \
5050
camlheader_ur \
5151
$(INSTALL_LIBDIR)
5252
cp target_camlheader $(INSTALL_LIBDIR)/camlheader
@@ -88,18 +88,18 @@ clean::
8888
$(CAMLOPT) $(COMPFLAGS) `./Compflags $@` -p -c -o $*.p.cmx $<
8989

9090
# Dependencies on the compiler
91-
$(OBJS) std_exit.cmo: $(COMPILER)
92-
$(OBJS:.cmo=.cmi) std_exit.cmi: $(COMPILER)
93-
$(OBJS:.cmo=.cmx) std_exit.cmx: $(OPTCOMPILER)
94-
$(OBJS:.cmo=.p.cmx) std_exit.p.cmx: $(OPTCOMPILER)
91+
$(OBJS) std_init.cmo std_exit.cmo: $(COMPILER)
92+
$(OBJS:.cmo=.cmi) std_init.cmi std_exit.cmi: $(COMPILER)
93+
$(OBJS:.cmo=.cmx) std_init.cmx std_exit.cmx: $(OPTCOMPILER)
94+
$(OBJS:.cmo=.p.cmx) std_init.p.cmx std_exit.p.cmx: $(OPTCOMPILER)
9595

9696
# Dependencies on Pervasives (not tracked by ocamldep)
97-
$(OTHERS) std_exit.cmo: pervasives.cmi
98-
$(OTHERS:.cmo=.cmi) std_exit.cmi: pervasives.cmi
99-
$(OBJS:.cmo=.cmx) std_exit.cmx: pervasives.cmi
100-
$(OBJS:.cmo=.p.cmx) std_exit.p.cmx: pervasives.cmi
101-
$(OTHERS:.cmo=.cmx) std_exit.cmx: pervasives.cmx
102-
$(OTHERS:.cmo=.p.cmx) std_exit.p.cmx: pervasives.cmx
97+
$(OTHERS) std_init.cmo std_exit.cmo: pervasives.cmi
98+
$(OTHERS:.cmo=.cmi) std_init.cmi std_exit.cmi: pervasives.cmi
99+
$(OBJS:.cmo=.cmx) std_init.cmx std_exit.cmx: pervasives.cmi
100+
$(OBJS:.cmo=.p.cmx) std_init.p.cmx std_exit.p.cmx: pervasives.cmi
101+
$(OTHERS:.cmo=.cmx) std_init.cmx std_exit.cmx: pervasives.cmx
102+
$(OTHERS:.cmo=.p.cmx) std_init.p.cmx std_exit.p.cmx: pervasives.cmx
103103

104104
clean::
105105
rm -f *.cm* *.$(O) *.$(A)

stdlib/gc.ml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,3 @@ let create_alarm f =
9898
;;
9999

100100
let delete_alarm a = a := false;;
101-
102-
let () =
103-
last_exit_function := (fun () ->
104-
try
105-
let fn = Sys.getenv "OCAML_GC_STATS" in
106-
let oc = open_out fn in
107-
print_stat oc;
108-
close_out oc
109-
with _ -> ())

0 commit comments

Comments
 (0)