[m-rev.] diff: more build system stuff for the erlang grade

Julien Fischer juliensf at csse.unimelb.edu.au
Wed Jan 19 18:00:44 AEDT 2011


Branches: main, 11.01

Further work on getting the Mercury system to compile in the erlang grade.

compiler/Makefile:
  	Don't introduce dependencies on archives (and main.o) in non-C
  	grades.

compiler/make.util.m:
compiler/pickle.m:
compiler/timestamp.m:
  	Add stub Erlang and default Mercury definitions where needed.

compiler/PROF_FLAGS.in:
  	Tell the compiler where the .hrl files for the standard library.

Julien.

Index: compiler/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/Mmakefile,v
retrieving revision 1.108
diff -u -r1.108 Mmakefile
--- compiler/Mmakefile	19 Jan 2011 01:47:59 -0000	1.108
+++ compiler/Mmakefile	19 Jan 2011 06:52:12 -0000
@@ -253,6 +253,7 @@
   # dependencies properly with --transitive-intermodule-optimization
   %.il: opts
   else
+ifeq ("$(filter csharp% java% erlang%,$(GRADE))","")
   $(MC_PROG): ../main.$O
   $(MC_PROG): $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
   $(MC_PROG): $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
@@ -265,6 +266,7 @@
   # if in .gc(.prof) grade
   $(MC_PROG): $(GCC_MAIN_LIBS)
   endif
+endif

   $(MC_PROG)_init.c: $(UTIL_DIR)/mkinit

Index: compiler/make.util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make.util.m,v
retrieving revision 1.84
diff -u -r1.84 make.util.m
--- compiler/make.util.m	19 Jan 2011 01:47:59 -0000	1.84
+++ compiler/make.util.m	19 Jan 2011 06:52:12 -0000
@@ -732,6 +732,7 @@
   :- pragma foreign_type("C", job_ctl, "MC_JobCtl *").
   :- pragma foreign_type("C#", job_ctl, "object"). % stub
   :- pragma foreign_type("Java", job_ctl, "java.lang.Object"). % stub
+:- pragma foreign_type("Erlang", job_ctl, ""). % stub

   :- pred have_job_ctl_ipc is semidet.

@@ -1850,6 +1851,9 @@
       IO = IO0;
   ").

+get_real_milliseconds(_, _, _) :-
+    sorry($file, $pred).
+
   %-----------------------------------------------------------------------------%
   %
   % Hash functions
Index: compiler/pickle.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/pickle.m,v
retrieving revision 1.4
diff -u -r1.4 pickle.m
--- compiler/pickle.m	19 Jan 2011 01:47:59 -0000	1.4
+++ compiler/pickle.m	19 Jan 2011 06:52:12 -0000
@@ -198,6 +198,13 @@
       B = A;
   ").

+:- pragma foreign_proc("Erlang",
+    pickler_inst_cast(A::in, B::out(pickler_pred)),
+    [will_not_call_mercury, thread_safe, promise_pure],
+"
+    B = A;
+").
+
   %-----------------------------------------------------------------------------%
   %
   % Unpickling
@@ -324,6 +331,13 @@
       B = A;
   ").

+:- pragma foreign_proc("Erlang",
+    unpickler_inst_cast(A::in, B::out(unpickler_pred)),
+    [will_not_call_mercury, thread_safe, promise_pure],
+"
+    B = A;
+").
+
   %-----------------------------------------------------------------------------%
   %
   % Basic types picklers/unpicklers
Index: compiler/timestamp.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/timestamp.m,v
retrieving revision 1.15
diff -u -r1.15 timestamp.m
--- compiler/timestamp.m	3 Jun 2009 07:07:41 -0000	1.15
+++ compiler/timestamp.m	19 Jan 2011 06:52:12 -0000
@@ -28,7 +28,7 @@
       % Converts the calendar time value `Time' into a timestamp.
       % Equivalent to `gm_time_to_timestamp(gmtime(Time))'.
       %
-:-func time_t_to_timestamp(time_t) = timestamp.
+:- func time_t_to_timestamp(time_t) = timestamp.

       % Converts a timestamp into a string with format "yyyy-mm-dd hh:mm:ss",
       % expressed as UTC.
@@ -55,6 +55,7 @@

   :- import_module int.
   :- import_module maybe.
+:- import_module require.
   :- import_module string.

   %-----------------------------------------------------------------------------%
@@ -135,6 +136,9 @@
       Result = sdf.format(date);
   ").

+gmtime_to_timestamp_2(_, _, _, _, _, _, _, _, _) = _ :-
+    sorry($file, $pred).
+
   :- func maybe_dst_to_int(maybe(dst)) = int.

   maybe_dst_to_int(M) = N :-
Index: profiler/PROF_FLAGS.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/profiler/PROF_FLAGS.in,v
retrieving revision 1.3
diff -u -r1.3 PROF_FLAGS.in
--- profiler/PROF_FLAGS.in	24 Oct 2007 09:21:17 -0000	1.3
+++ profiler/PROF_FLAGS.in	19 Jan 2011 06:52:12 -0000
@@ -19,4 +19,5 @@
   --c-include-directory ../ssdb
   --c-include-directory ../ssdb/Mercury/mihs
   --c-include-directory ../trace
+--erlang-include-directory ../library/Mercury/hrls
   --config-file ../scripts/Mercury.config.bootstrap
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list