Commits

Anonymous committed e3103e8

Remplacement de Cset par Set

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@20f963ae5c-01c2-4b8c-9fe0-0dff7051ff02

Comments (0)

Files changed (20)

 bytecomp/emitcode.cmi: typing/ident.cmi bytecomp/lambda.cmi \
     bytecomp/instruct.cmi utils/config.cmi 
 bytecomp/instruct.cmi: typing/ident.cmi bytecomp/lambda.cmi 
-bytecomp/lambda.cmi: typing/ident.cmi utils/misc.cmi typing/path.cmi \
-    parsing/asttypes.cmi 
+bytecomp/lambda.cmi: typing/ident.cmi typing/path.cmi parsing/asttypes.cmi 
 bytecomp/librarian.cmi: utils/config.cmi 
 bytecomp/linker.cmi: bytecomp/symtable.cmi bytecomp/emitcode.cmi 
 bytecomp/matching.cmi: typing/ident.cmi bytecomp/lambda.cmi \
 bytecomp/translcore.cmi: typing/ident.cmi bytecomp/lambda.cmi \
     typing/typedtree.cmi parsing/location.cmi parsing/asttypes.cmi 
 bytecomp/translmod.cmi: bytecomp/lambda.cmi typing/typedtree.cmi 
+codegen/selection.cmi: typing/ident.cmi 
+compiler/cmm.cmi: typing/ident.cmi 
 driver/compile.cmi: typing/env.cmi 
+essais/approx.cmi: typing/ident.cmi utils/tbl.cmi 
+essais/cfa.cmi: typing/ident.cmi utils/tbl.cmi 
+essais/xlambda.cmi: typing/ident.cmi utils/misc.cmi bytecomp/lambda.cmi \
+    parsing/asttypes.cmi 
+lex/lexer.cmi: parsing/parser.cmi 
 parsing/lexer.cmi: parsing/parser.cmi 
-parsing/location.cmi: utils/misc.cmi 
 parsing/parse.cmi: parsing/parsetree.cmi 
 parsing/parser.cmi: parsing/parsetree.cmi 
-parsing/parsetree.cmi: utils/misc.cmi parsing/location.cmi \
-    parsing/longident.cmi parsing/asttypes.cmi 
+parsing/parsetree.cmi: parsing/location.cmi parsing/longident.cmi \
+    parsing/asttypes.cmi 
 toplevel/printval.cmi: typing/path.cmi typing/typedtree.cmi typing/env.cmi 
 toplevel/topdirs.cmi: parsing/longident.cmi 
 toplevel/toploop.cmi: parsing/parsetree.cmi typing/env.cmi \
     parsing/asttypes.cmi 
 typing/typedecl.cmi: typing/ident.cmi parsing/parsetree.cmi \
     typing/typedtree.cmi parsing/location.cmi typing/env.cmi 
-typing/typedtree.cmi: typing/ident.cmi utils/misc.cmi typing/path.cmi \
-    parsing/location.cmi parsing/asttypes.cmi 
+typing/typedtree.cmi: typing/ident.cmi typing/path.cmi parsing/location.cmi \
+    parsing/asttypes.cmi 
 typing/typemod.cmi: parsing/parsetree.cmi typing/includemod.cmi \
     typing/typedtree.cmi parsing/location.cmi typing/env.cmi \
     parsing/longident.cmi 
     parsing/asttypes.cmi bytecomp/opcodes.cmo 
 bytecomp/instruct.cmo: bytecomp/instruct.cmi typing/ident.cmi \
     bytecomp/lambda.cmi 
-bytecomp/lambda.cmo: bytecomp/lambda.cmi typing/ident.cmi utils/misc.cmi \
-    utils/cset.cmi typing/path.cmi parsing/asttypes.cmi 
+bytecomp/lambda.cmo: bytecomp/lambda.cmi typing/ident.cmi typing/path.cmi \
+    parsing/asttypes.cmi 
 bytecomp/librarian.cmo: bytecomp/librarian.cmi utils/misc.cmi \
     bytecomp/emitcode.cmi utils/config.cmi 
-bytecomp/linker.cmo: bytecomp/linker.cmi utils/cset.cmi utils/config.cmi \
-    utils/misc.cmi typing/ident.cmi utils/clflags.cmo bytecomp/symtable.cmi \
+bytecomp/linker.cmo: bytecomp/linker.cmi utils/config.cmi utils/misc.cmi \
+    typing/ident.cmi utils/clflags.cmo bytecomp/symtable.cmi \
     bytecomp/emitcode.cmi bytecomp/opcodes.cmo 
 bytecomp/matching.cmo: bytecomp/matching.cmi typing/predef.cmi \
     bytecomp/lambda.cmi typing/typedtree.cmi parsing/location.cmi \
-    typing/ctype.cmi parsing/asttypes.cmi 
+    utils/config.cmi typing/ctype.cmi parsing/asttypes.cmi 
 bytecomp/printinstr.cmo: bytecomp/printinstr.cmi bytecomp/printlambda.cmi \
     typing/ident.cmi bytecomp/lambda.cmi bytecomp/instruct.cmi 
 bytecomp/printlambda.cmo: bytecomp/printlambda.cmi bytecomp/lambda.cmi \
-    typing/ident.cmi utils/misc.cmi parsing/asttypes.cmi 
+    typing/ident.cmi parsing/asttypes.cmi 
 bytecomp/runtimedef.cmo: bytecomp/runtimedef.cmi 
 bytecomp/symtable.cmo: bytecomp/symtable.cmi typing/predef.cmi \
     utils/meta.cmi bytecomp/runtimedef.cmi bytecomp/lambda.cmi \
 bytecomp/translmod.cmo: bytecomp/translmod.cmi bytecomp/translmod.cmi \
     typing/ident.cmi utils/misc.cmi bytecomp/translcore.cmi \
     bytecomp/lambda.cmi typing/typedtree.cmi 
+codegen/coloring.cmo: codegen/coloring.cmi 
+codegen/interf.cmo: codegen/interf.cmi 
+codegen/liveness.cmo: codegen/liveness.cmi 
+codegen/mach.cmo: codegen/mach.cmi 
+codegen/printmach.cmo: codegen/printmach.cmi 
+codegen/proc_i386.cmo: utils/misc.cmi 
+codegen/reg.cmo: codegen/reg.cmi 
+codegen/reload.cmo: codegen/reload.cmi utils/misc.cmi 
+codegen/selection.cmo: codegen/selection.cmi typing/ident.cmi 
+codegen/sequence.cmo: codegen/sequence.cmi utils/tbl.cmi utils/misc.cmi \
+    typing/ident.cmi 
+codegen/spill.cmo: codegen/spill.cmi 
+codegen/split.cmo: codegen/split.cmi 
 driver/compile.cmo: driver/compile.cmi typing/typemod.cmi \
     typing/printtyp.cmi bytecomp/codegen.cmi typing/typedtree.cmi \
     utils/config.cmi bytecomp/translmod.cmi utils/misc.cmi \
     typing/typecore.cmi typing/typetexp.cmi 
 driver/main.cmo: utils/clflags.cmo driver/errors.cmi bytecomp/linker.cmi \
     driver/compile.cmi bytecomp/librarian.cmi utils/config.cmi 
-lex/grammar.cmo: lex/grammar.cmi 
+essais/all.cmo: bytecomp/lambda.cmi 
+essais/analyze.cmo: bytecomp/lambda.cmi 
+essais/approx.cmo: essais/approx.cmi typing/ident.cmi utils/misc.cmi \
+    bytecomp/lambda.cmi utils/tbl.cmi 
+essais/cfa.cmo: essais/cfa.cmi typing/ident.cmi utils/misc.cmi \
+    bytecomp/lambda.cmi utils/tbl.cmi 
+essais/readlambda.cmo: essais/readlambda.cmi typing/ident.cmi \
+    bytecomp/lambda.cmi utils/tbl.cmi 
+essais/xlambda.cmo: essais/xlambda.cmi bytecomp/lambda.cmi utils/misc.cmi \
+    typing/ident.cmi parsing/asttypes.cmi 
+lex/lexer.cmo: lex/lexer.cmi parsing/parser.cmi 
+lex/main.cmo: parsing/parser.cmi parsing/lexer.cmi 
+lex/parser.cmo: lex/parser.cmi 
 parsing/lexer.cmo: parsing/lexer.cmi utils/misc.cmi parsing/parser.cmi 
-parsing/location.cmo: parsing/location.cmi utils/misc.cmi \
-    utils/terminfo.cmi 
+parsing/location.cmo: parsing/location.cmi utils/terminfo.cmi 
 parsing/parse.cmo: parsing/parse.cmi parsing/parser.cmi parsing/lexer.cmi \
     parsing/location.cmi 
-parsing/parser.cmo: parsing/parser.cmi parsing/parsetree.cmi \
-    parsing/location.cmi utils/misc.cmi utils/clflags.cmo \
-    parsing/longident.cmi parsing/asttypes.cmi 
+parsing/parser.cmo: parsing/parser.cmi utils/clflags.cmo \
+    parsing/parsetree.cmi parsing/location.cmi parsing/longident.cmi \
+    parsing/asttypes.cmi 
 stdlib/arg.cmo: stdlib/arg.cmi 
 stdlib/array.cmo: stdlib/array.cmi 
-stdlib/baltree.cmo: stdlib/baltree.cmi 
 stdlib/char.cmo: stdlib/char.cmi 
 stdlib/filename.cmo: stdlib/filename.cmi 
 stdlib/format.cmo: stdlib/format.cmi 
 stdlib/hashtbl.cmo: stdlib/hashtbl.cmi 
 stdlib/lexing.cmo: stdlib/lexing.cmi 
 stdlib/list.cmo: stdlib/list.cmi 
+stdlib/map.cmo: stdlib/map.cmi 
 stdlib/obj.cmo: stdlib/obj.cmi 
 stdlib/parsing.cmo: stdlib/parsing.cmi 
 stdlib/pervasives.cmo: stdlib/pervasives.cmi 
 stdlib/stack.cmo: stdlib/stack.cmi 
 stdlib/string.cmo: stdlib/string.cmi 
 stdlib/sys.cmo: stdlib/sys.cmi 
+test/bar.cmo: foo.cmo 
 tools/dumpobj.cmo: bytecomp/runtimedef.cmi bytecomp/lambda.cmi \
     utils/tbl.cmi utils/config.cmi typing/ident.cmi bytecomp/emitcode.cmi \
     parsing/asttypes.cmi bytecomp/opcodes.cmo 
-toplevel/expunge.cmo: utils/cset.cmi bytecomp/runtimedef.cmi \
-    utils/config.cmi utils/misc.cmi typing/ident.cmi bytecomp/symtable.cmi 
+toplevel/expunge.cmo: bytecomp/runtimedef.cmi utils/config.cmi \
+    utils/misc.cmi typing/ident.cmi bytecomp/symtable.cmi 
 toplevel/printval.cmo: toplevel/printval.cmi typing/predef.cmi \
     typing/printtyp.cmi typing/typedtree.cmi typing/ident.cmi \
     typing/ctype.cmi typing/path.cmi typing/env.cmi parsing/longident.cmi 
     utils/tbl.cmi utils/config.cmi utils/misc.cmi typing/ident.cmi \
     typing/path.cmi typing/subst.cmi typing/env.cmi parsing/longident.cmi \
     parsing/asttypes.cmi 
-typing/ident.cmo: typing/ident.cmi utils/misc.cmi 
+typing/ident.cmo: typing/ident.cmi 
 typing/includecore.cmo: typing/includecore.cmi utils/misc.cmi \
     typing/ctype.cmi typing/path.cmi typing/typedtree.cmi 
 typing/includemod.cmo: typing/includemod.cmi typing/includecore.cmi \
     parsing/location.cmi typing/parmatch.cmi utils/misc.cmi \
     typing/ctype.cmi parsing/asttypes.cmi 
 typing/path.cmo: typing/path.cmi typing/ident.cmi 
-typing/predef.cmo: typing/predef.cmi typing/ident.cmi utils/misc.cmi \
-    typing/ctype.cmi typing/path.cmi typing/typedtree.cmi 
+typing/predef.cmo: typing/predef.cmi typing/ident.cmi typing/ctype.cmi \
+    typing/path.cmi typing/typedtree.cmi 
 typing/printtyp.cmo: typing/printtyp.cmi typing/typedtree.cmi \
-    utils/misc.cmi typing/ident.cmi typing/path.cmi parsing/longident.cmi \
+    typing/ident.cmi typing/path.cmi parsing/longident.cmi \
     parsing/asttypes.cmi 
-typing/subst.cmo: typing/subst.cmi typing/ident.cmi utils/misc.cmi \
-    typing/path.cmi typing/typedtree.cmi 
+typing/subst.cmo: typing/subst.cmi typing/ident.cmi typing/path.cmi \
+    typing/typedtree.cmi 
 typing/typecore.cmo: typing/typecore.cmi typing/predef.cmi \
     typing/printtyp.cmi parsing/parsetree.cmi typing/typedtree.cmi \
     parsing/location.cmi typing/parmatch.cmi typing/ident.cmi \
-    utils/misc.cmi typing/path.cmi typing/ctype.cmi typing/env.cmi \
-    parsing/longident.cmi typing/typetexp.cmi parsing/asttypes.cmi 
-typing/typedecl.cmo: typing/typedecl.cmi utils/cset.cmi \
-    parsing/parsetree.cmi typing/typedtree.cmi parsing/location.cmi \
-    typing/ctype.cmi typing/env.cmi typing/typetexp.cmi 
+    typing/path.cmi typing/ctype.cmi typing/env.cmi parsing/longident.cmi \
+    typing/typetexp.cmi parsing/asttypes.cmi 
+typing/typedecl.cmo: typing/typedecl.cmi typing/ctype.cmi \
+    parsing/parsetree.cmi typing/typedtree.cmi typing/env.cmi \
+    parsing/location.cmi utils/config.cmi typing/typetexp.cmi 
 typing/typedtree.cmo: typing/typedtree.cmi typing/ident.cmi utils/misc.cmi \
     typing/path.cmi parsing/location.cmi parsing/asttypes.cmi 
 typing/typemod.cmo: typing/typemod.cmi typing/printtyp.cmi \
     utils/tbl.cmi typing/ctype.cmi typing/env.cmi parsing/longident.cmi 
 utils/config.cmo: utils/config.cmi 
 utils/crc.cmo: utils/crc.cmi utils/crc.cmi 
-utils/cset.cmo: utils/cset.cmi utils/cset.cmi 
 utils/meta.cmo: utils/meta.cmi 
 utils/misc.cmo: utils/misc.cmi 
 utils/tbl.cmo: utils/tbl.cmi 
 
 INCLUDES=-I utils -I parsing -I typing -I bytecomp -I driver -I toplevel
 
-UTILS=utils/misc.cmo utils/tbl.cmo utils/cset.cmo utils/config.cmo \
+UTILS=utils/misc.cmo utils/tbl.cmo utils/config.cmo \
   utils/clflags.cmo utils/meta.cmo utils/terminfo.cmo utils/crc.cmo
 
 PARSING=parsing/location.cmo parsing/parser.cmo parsing/lexer.cmo parsing/parse.cmo
 
 TOPOBJS=$(UTILS) $(PARSING) $(TYPING) $(BYTECOMP) $(TOPLEVEL)
 
-EXPUNGEOBJS=utils/misc.cmo utils/cset.cmo utils/tbl.cmo \
+EXPUNGEOBJS=utils/misc.cmo utils/tbl.cmo \
   utils/config.cmo utils/clflags.cmo \
   typing/ident.cmo typing/predef.cmo \
   bytecomp/runtimedef.cmo bytecomp/symtable.cmo \
   toplevel/expunge.cmo
 
-PERVASIVES=arg array baltree char filename format hashtbl lexing list \
+PERVASIVES=arg array char filename format hashtbl lexing list map \
   obj parsing pervasives printexc printf queue set sort stack string sys
 
 # Recompile the system using the bootstrap compiler

bytecomp/lambda.ml

-open Misc
 open Path
 
 open Asttypes
     Lvar id -> fn id
   | _ -> let id = Ident.new "let" in Llet(id, arg, fn id)
 
+module IdentSet =
+  Set.Make(struct
+    type t = Ident.t
+    let compare = compare
+  end)
+
 let free_variables l =
-  let fv = ref Cset.empty in
+  let fv = ref IdentSet.empty in
   let rec freevars = function
     Lvar id ->
-      fv := Cset.add id !fv
+      fv := IdentSet.add id !fv
   | Lconst sc -> ()
   | Lapply(fn, args) ->
       freevars fn; List.iter freevars args
   | Lfunction(param, body) ->
-      freevars body; fv := Cset.remove param !fv
+      freevars body; fv := IdentSet.remove param !fv
   | Llet(id, arg, body) ->
-      freevars arg; freevars body; fv := Cset.remove id !fv
+      freevars arg; freevars body; fv := IdentSet.remove id !fv
   | Lletrec(decl, body) ->
       freevars body;
       List.iter (fun (id, exp, sz) -> freevars exp) decl;
-      List.iter (fun (id, exp, sz) -> fv := Cset.remove id !fv) decl
+      List.iter (fun (id, exp, sz) -> fv := IdentSet.remove id !fv) decl
   | Lprim(p, args) ->
       List.iter freevars args
   | Lswitch(arg, lo, hi, cases) ->
   | Lcatch(e1, e2) ->
       freevars e1; freevars e2
   | Ltrywith(e1, exn, e2) ->
-      freevars e1; freevars e2; fv := Cset.remove exn !fv
+      freevars e1; freevars e2; fv := IdentSet.remove exn !fv
   | Lifthenelse(e1, e2, e3) ->
       freevars e1; freevars e2; freevars e3
   | Lsequence(e1, e2) ->
   | Lwhile(e1, e2) ->
       freevars e1; freevars e2
   | Lfor(v, e1, e2, dir, e3) -> 
-      freevars e1; freevars e2; freevars e3; fv := Cset.remove v !fv
+      freevars e1; freevars e2; freevars e3; fv := IdentSet.remove v !fv
   | Lshared(e, lblref) ->
       freevars e
-  in freevars l; Cset.elements !fv
+  in freevars l; IdentSet.elements !fv
 
 (* Check if an action has a "when" guard *)
 

bytecomp/lambda.mli

 (* The "lambda" intermediate code *)
 
-open Misc
 open Asttypes
 
 type primitive =

bytecomp/linker.ml

 
 (* First pass: determine which units are needed *)
 
-let missing_globals = ref (Cset.empty : Ident.t Cset.t)
+module IdentSet =
+  Set.Make(struct
+    type t = Ident.t
+    let compare = compare
+  end)
+
+let missing_globals = ref IdentSet.empty
 
 let is_required (rel, pos) =
   match rel with
-    Reloc_setglobal id -> Cset.mem id !missing_globals
+    Reloc_setglobal id ->
+      IdentSet.mem id !missing_globals
   | _ -> false
 
 let add_required (rel, pos) =
   match rel with
-    Reloc_getglobal id -> missing_globals := Cset.add id !missing_globals
+    Reloc_getglobal id ->
+      missing_globals := IdentSet.add id !missing_globals
   | _ -> ()
 
 let remove_required (rel, pos) =
   match rel with
-    Reloc_setglobal id -> missing_globals := Cset.remove id !missing_globals
+    Reloc_setglobal id ->
+      missing_globals := IdentSet.remove id !missing_globals
   | _ -> ()
 
 let scan_file tolink obj_name =

bytecomp/printlambda.ml

 open Format
-open Misc
 open Asttypes
 open Lambda
 

parsing/location.ml

 open Lexing
-open Misc
-
 
 type t =
   { loc_start: int; loc_end: int }

parsing/location.mli

 (* Source code locations, used in parsetree *)
 
-open Misc
-
 type t =
   { loc_start: int; loc_end: int }
 

parsing/parser.mly

 /* The parser definition */
 
 %{
-open Misc
 open Location
 open Asttypes
 open Longident

parsing/parsetree.mli

 (* Abstract syntax tree produced by parsing *)
 
-open Misc
 open Asttypes
 
 (* Type expressions for the core language *)

toplevel/expunge.ml

 open Sys
 open Misc
 
-let to_keep = ref (Cset.empty: string Cset.t)
+module StringSet =
+  Set.Make(struct
+    type t = string
+    let compare = compare
+  end)
+
+let to_keep = ref StringSet.empty
 
 let expunge_map tbl =
   Symtable.filter_global_map
-    (fun id -> Cset.mem (Ident.name id) !to_keep)
+    (fun id -> StringSet.mem (Ident.name id) !to_keep)
     tbl
 
 let main () =
   let input_name = Sys.argv.(1) in
   let output_name = Sys.argv.(2) in
   Array.iter
-    (fun exn -> to_keep := Cset.add exn !to_keep)
+    (fun exn -> to_keep := StringSet.add exn !to_keep)
     Runtimedef.builtin_exceptions;
   for i = 3 to Array.length Sys.argv - 1 do
-    to_keep := Cset.add (capitalize Sys.argv.(i)) !to_keep
+    to_keep := StringSet.add (capitalize Sys.argv.(i)) !to_keep
   done;
   let ic = open_in_bin input_name in
   let pos_trailer =
-open Misc
 open Format
 
 type t = { mutable stamp: int; name: string; mutable global: bool }
 (* Predefined type constructors (with special typing rules in typecore) *)
 
-open Misc
 open Path
 open Typedtree
 

typing/printtyp.ml

 (* Printing functions *)
 
 open Format
-open Misc
 open Longident
 open Path
 open Asttypes
 (* Substitutions *)
 
-open Misc
 open Path
 open Typedtree
 

typing/typecore.ml

 (* Typechecking for the core language *)
 
-open Misc
 open Asttypes
 open Parsetree
 open Typedtree

typing/typedecl.ml

 
 (* Translate one type declaration *)
 
+module StringSet =
+  Set.Make(struct
+    type t = string
+    let compare = compare
+  end)
+
 let transl_declaration env (name, sdecl) id =
   Ctype.begin_def();
   reset_type_variables();
     | Ptype_manifest sty ->
         Type_manifest(transl_simple_type env true sty)
     | Ptype_variant cstrs ->
-        let all_constrs = ref Cset.empty in
+        let all_constrs = ref StringSet.empty in
         List.iter
           (fun (name, args) ->
-            if Cset.mem name !all_constrs then
+            if StringSet.mem name !all_constrs then
               raise(Error(sdecl.ptype_loc, Duplicate_constructor name));
-            all_constrs := Cset.add name !all_constrs)
+            all_constrs := StringSet.add name !all_constrs)
           cstrs;
         if List.length cstrs > Config.max_tag then
           raise(Error(sdecl.ptype_loc, Too_many_constructors));
                   (name, List.map (transl_simple_type env true) args))
           cstrs)
     | Ptype_record lbls ->
-        let all_labels = ref Cset.empty in
+        let all_labels = ref StringSet.empty in
         List.iter
           (fun (name, mut, arg) ->
-            if Cset.mem name !all_labels then
+            if StringSet.mem name !all_labels then
               raise(Error(sdecl.ptype_loc, Duplicate_label name));
-            all_labels := Cset.add name !all_labels)
+            all_labels := StringSet.add name !all_labels)
           lbls;
         Type_record(List.map
           (fun (name, mut, arg) ->

typing/typedtree.mli

 (* Abstract syntax tree after typing *)
 
-open Misc
 open Asttypes
 
 (* Type expressions for the core language *)
 (* Errors *)
 
-type 'a option = None | Some of 'a
-
 exception Fatal_error
 
 let fatal_error msg =
 (* Miscellaneous useful types and functions *)
 
-type 'a option = None | Some of 'a
-
 val fatal_error: string -> 'a
 exception Fatal_error