summaryrefslogtreecommitdiff
path: root/driver/compile.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1998-04-27 15:16:48 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1998-04-27 15:16:48 +0000
commite991e9442f4bcc6eab90e78623866c4e39740038 (patch)
treeeea6a572487353bfb469e56cb608864edde6e3a4 /driver/compile.ml
parentf3dfb0b3f4819f993958056bb562e024454c9b14 (diff)
downloadocaml-e991e9442f4bcc6eab90e78623866c4e39740038.tar.gz
Composer les passes du compilateur avec ++ pour eviter de garder des pointeurs vers des structures inutilisees
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1938 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'driver/compile.ml')
-rw-r--r--driver/compile.ml35
1 files changed, 12 insertions, 23 deletions
diff --git a/driver/compile.ml b/driver/compile.ml
index d79101792b..0ca2efca1e 100644
--- a/driver/compile.ml
+++ b/driver/compile.ml
@@ -114,37 +114,26 @@ let print_if flag printer arg =
if !flag then begin printer arg; print_newline() end;
arg
+let (++) x f = f x
+
let implementation sourcefile =
init_path();
let prefixname = Filename.chop_extension sourcefile in
let modulename = String.capitalize(Filename.basename prefixname) in
let inputfile = preprocess sourcefile (prefixname ^ ".ppo") in
- let ast = parse_file inputfile Parse.implementation ast_impl_magic_number in
let objfile = prefixname ^ ".cmo" in
let oc = open_out_bin objfile in
+ let env = initial_env() in
try
- let (str, sg, finalenv) =
- Typemod.type_structure (initial_env()) ast in
- if !Clflags.print_types then (Printtyp.signature sg; print_newline());
- let coercion =
- if Sys.file_exists (prefixname ^ ".mli") then begin
- let intf_file =
- try find_in_path !load_path (prefixname ^ ".cmi")
- with Not_found -> prefixname ^ ".cmi" in
- let dclsig = Env.read_signature modulename intf_file in
- Includemod.compunit sourcefile sg intf_file dclsig
- end else begin
- Typemod.check_nongen_schemes finalenv str;
- Env.save_signature sg modulename (prefixname ^ ".cmi");
- Tcoerce_none
- end in
- Emitcode.to_file oc modulename
- (print_if Clflags.dump_instr Printinstr.instrlist
- (Bytegen.compile_implementation modulename
- (print_if Clflags.dump_lambda Printlambda.lambda
- (Simplif.simplify_lambda
- (print_if Clflags.dump_rawlambda Printlambda.lambda
- (Translmod.transl_implementation modulename str coercion))))));
+ parse_file inputfile Parse.implementation ast_impl_magic_number
+ ++ Typemod.type_implementation sourcefile prefixname modulename env
+ ++ Translmod.transl_implementation modulename
+ ++ print_if Clflags.dump_rawlambda Printlambda.lambda
+ ++ Simplif.simplify_lambda
+ ++ print_if Clflags.dump_lambda Printlambda.lambda
+ ++ Bytegen.compile_implementation modulename
+ ++ print_if Clflags.dump_instr Printinstr.instrlist
+ ++ Emitcode.to_file oc modulename;
remove_preprocessed inputfile;
close_out oc
with x ->