summaryrefslogtreecommitdiff
path: root/bytecomp
diff options
context:
space:
mode:
authorAlain Frisch <alain@frisch.fr>2008-07-24 05:35:22 +0000
committerAlain Frisch <alain@frisch.fr>2008-07-24 05:35:22 +0000
commit1ba87b442b1fe72577a71af4192f71d969d68f99 (patch)
treefa90437ecf931df76138af04383a9584508f4d65 /bytecomp
parent44d735799099e79041627ecfd280b2e28e260bf2 (diff)
downloadocaml-1ba87b442b1fe72577a71af4192f71d969d68f99.tar.gz
Output references to the native version of the primitives in ocamlopt
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@8930 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'bytecomp')
-rw-r--r--bytecomp/emitcode.ml2
-rw-r--r--bytecomp/translmod.ml19
-rw-r--r--bytecomp/translmod.mli2
3 files changed, 9 insertions, 14 deletions
diff --git a/bytecomp/emitcode.ml b/bytecomp/emitcode.ml
index d26fef75c7..db10dea647 100644
--- a/bytecomp/emitcode.ml
+++ b/bytecomp/emitcode.ml
@@ -373,7 +373,7 @@ let to_file outchan unit_name code =
cu_codesize = !out_position;
cu_reloc = List.rev !reloc_info;
cu_imports = Env.imported_units();
- cu_primitives = !Translmod.primitive_declarations;
+ cu_primitives = List.map Primitive.byte_name !Translmod.primitive_declarations;
cu_force_link = false;
cu_debug = pos_debug;
cu_debugsize = size_debug } in
diff --git a/bytecomp/translmod.ml b/bytecomp/translmod.ml
index fc7da7d1a0..17f291ade0 100644
--- a/bytecomp/translmod.ml
+++ b/bytecomp/translmod.ml
@@ -80,8 +80,11 @@ let rec compose_coercions c1 c2 =
(* Record the primitive declarations occuring in the module compiled *)
-let primitive_declarations = ref ([] : string list)
-
+let primitive_declarations = ref ([] : Primitive.description list)
+let record_primitive = function
+ | {val_kind=Val_prim p} -> primitive_declarations := p :: !primitive_declarations
+ | _ -> ()
+
(* Keep track of the root path (from the root of the namespace to the
currently compiled module expression). Useful for naming exceptions. *)
@@ -289,11 +292,7 @@ and transl_structure fields cc rootpath = function
transl_let rec_flag pat_expr_list
(transl_structure ext_fields cc rootpath rem)
| Tstr_primitive(id, descr) :: rem ->
- begin match descr.val_kind with
- Val_prim p -> primitive_declarations :=
- p.Primitive.prim_name :: !primitive_declarations
- | _ -> ()
- end;
+ record_primitive descr;
transl_structure fields cc rootpath rem
| Tstr_type(decls) :: rem ->
transl_structure fields cc rootpath rem
@@ -386,11 +385,7 @@ let transl_store_structure glob map prims str =
Lsequence(subst_lambda subst lam,
transl_store (add_idents false ids subst) rem)
| Tstr_primitive(id, descr) :: rem ->
- begin match descr.val_kind with
- Val_prim p -> primitive_declarations :=
- p.Primitive.prim_name :: !primitive_declarations
- | _ -> ()
- end;
+ record_primitive descr;
transl_store subst rem
| Tstr_type(decls) :: rem ->
transl_store subst rem
diff --git a/bytecomp/translmod.mli b/bytecomp/translmod.mli
index b7cf6d5dd7..bec880b2f9 100644
--- a/bytecomp/translmod.mli
+++ b/bytecomp/translmod.mli
@@ -31,7 +31,7 @@ val transl_store_package:
val toplevel_name: Ident.t -> string
val nat_toplevel_name: Ident.t -> Ident.t * int
-val primitive_declarations: string list ref
+val primitive_declarations: Primitive.description list ref
type error =
Circular_dependency of Ident.t