[m-rev.] for review: opt-export fewer foreign procs

Peter Wang novalazy at gmail.com
Thu Aug 28 14:17:16 AEST 2008


Estimated hours taken: 0.5
Branches: main

library/construct.m:
library/dir.m:
library/io.m:
library/store.m:
library/string.m:
library/term_size_prof_builtin.m:
library/thread.m:
library/version_array.m:
	Add `may_not_duplicate' attributes on some "C" foreign_procs to prevent
	them being written to `.opt' files.

	It works around a problem with opt-exporting `thread.spawn' (which
	happens to be not worth opt-exporting).

Index: library/construct.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/construct.m,v
retrieving revision 1.41
diff -u -r1.41 construct.m
--- library/construct.m	25 Sep 2007 12:59:43 -0000	1.41
+++ library/construct.m	28 Aug 2008 03:00:50 -0000
@@ -198,7 +198,7 @@
 :- pragma foreign_proc("C",
     get_functor_internal(TypeDesc::in, FunctorNumber::in, FunctorName::out,
         Arity::out, PseudoTypeInfoList::out),
-    [will_not_call_mercury, thread_safe, promise_pure],
+    [will_not_call_mercury, thread_safe, promise_pure, may_not_duplicate],
 "{
     MR_TypeInfo         type_info;
     MR_Construct_Info   construct_info;
@@ -276,7 +276,7 @@
     get_functor_with_names_internal(TypeDesc::in, FunctorNumber::in,
         FunctorName::out, Arity::out, PseudoTypeInfoList::out,
         ArgNameList::out),
-    [will_not_call_mercury, thread_safe, promise_pure],
+    [will_not_call_mercury, thread_safe, promise_pure, may_not_duplicate],
 "{
     MR_TypeInfo         type_info;
     MR_Construct_Info   construct_info;
@@ -977,7 +977,7 @@
 
 :- pragma foreign_proc("C",
     construct_tuple_2(Args::in, ArgTypes::in, Arity::in) = (Term::out),
-    [will_not_call_mercury, thread_safe, promise_pure],
+    [will_not_call_mercury, thread_safe, promise_pure, may_not_duplicate],
 "{
     MR_TypeInfo type_info;
     MR_Word     new_data;
Index: library/dir.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/dir.m,v
retrieving revision 1.46
diff -u -r1.46 dir.m
--- library/dir.m	25 Jun 2008 04:44:28 -0000	1.46
+++ library/dir.m	28 Aug 2008 03:01:51 -0000
@@ -840,7 +840,8 @@
 
 :- pragma foreign_proc("C",
     dir.current_directory(Res::out, IO0::di, IO::uo),
-    [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates],
+    [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
+        may_not_duplicate],
 "
     /*
     ** Marked thread_safe because ML_make_io_res_1_error_string will acquire
@@ -1040,7 +1041,8 @@
     dir.make_single_directory_2(ErrorIfExists::in, DirName::in,
         Result::out, IO0::di, IO::uo),
     [may_call_mercury, promise_pure, tabled_for_io, thread_safe,
-        terminates, will_not_modify_trail, does_not_affect_liveness],
+        terminates, will_not_modify_trail, does_not_affect_liveness,
+        may_not_duplicate],
 "{
 #if defined(MR_WIN32)
     if (CreateDirectory(DirName, NULL)) {
Index: library/io.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.410
diff -u -r1.410 io.m
--- library/io.m	18 Aug 2008 02:14:59 -0000	1.410
+++ library/io.m	28 Aug 2008 03:03:13 -0000
@@ -9311,7 +9311,7 @@
 :- pragma foreign_proc("C",
     io.progname(DefaultProgname::in, PrognameOut::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, may_not_duplicate],
 "
     if (MR_progname) {
         MR_make_aligned_string(PrognameOut, MR_progname);
@@ -9324,7 +9324,8 @@
 :- pragma foreign_proc("C",
     io.command_line_arguments(Args::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
-        does_not_affect_liveness, no_sharing],
+        does_not_affect_liveness, may_not_duplicate,
+        no_sharing],
     % no_sharing is okay because the string elements can't reused.
 "{
     int i;
Index: library/store.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/store.m,v
retrieving revision 1.63
diff -u -r1.63 store.m
--- library/store.m	29 May 2008 04:52:58 -0000	1.63
+++ library/store.m	28 Aug 2008 03:05:39 -0000
@@ -581,7 +581,7 @@
 
 :- pragma foreign_proc("C",
     arg_ref(Ref::in, ArgNum::in, ArgRef::out, S0::di, S::uo),
-    [will_not_call_mercury, promise_pure],
+    [will_not_call_mercury, promise_pure, may_not_duplicate],
 "{
     MR_TypeInfo type_info;
     MR_TypeInfo arg_type_info;
@@ -626,7 +626,7 @@
 
 :- pragma foreign_proc("C",
     new_arg_ref(Val::di, ArgNum::in, ArgRef::out, S0::di, S::uo),
-    [will_not_call_mercury, promise_pure],
+    [will_not_call_mercury, promise_pure, may_not_duplicate],
 "{
     MR_TypeInfo type_info;
     MR_TypeInfo arg_type_info;
Index: library/string.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/string.m,v
retrieving revision 1.274
diff -u -r1.274 string.m
--- library/string.m	13 Aug 2008 03:34:01 -0000	1.274
+++ library/string.m	28 Aug 2008 03:09:12 -0000
@@ -1344,7 +1344,7 @@
 :- pragma foreign_proc("C",
     string.semidet_from_char_list(CharList::in, Str::uo),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness, no_sharing],
+        does_not_affect_liveness, may_not_duplicate, no_sharing],
 "{
     /* mode (uo, in) is det */
     MR_Word char_list_ptr;
@@ -1428,7 +1428,7 @@
 :- pragma foreign_proc("C",
     string.semidet_from_rev_char_list(Chars::in, Str::uo),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness, no_sharing],
+        does_not_affect_liveness, may_not_duplicate, no_sharing],
 "{
     MR_Word list_ptr;
     MR_Word size;
@@ -1575,7 +1575,7 @@
 :- pragma foreign_proc("C",
     string.append_list(Strs::in) = (Str::uo),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness, no_sharing],
+        does_not_affect_liveness, may_not_duplicate, no_sharing],
 "{
     MR_Word list = Strs;
     MR_Word tmp;
@@ -1616,7 +1616,7 @@
 :- pragma foreign_proc("C",
     string.join_list(Sep::in, Strs::in) = (Str::uo),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness, no_sharing],
+        does_not_affect_liveness, may_not_duplicate, no_sharing],
 "{
     MR_Word list;
     MR_Word tmp;
@@ -3976,7 +3976,7 @@
 :- pragma foreign_proc("C",
     string.append_ooi_3(S1Len::in, S3Len::in, S1::out, S2::out, S3::in),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness, no_sharing],
+        does_not_affect_liveness, may_not_duplicate, no_sharing],
 "{
     MR_allocate_aligned_string_msg(S1, S1Len, MR_PROC_LABEL);
     MR_memcpy(S1, S3, S1Len);
@@ -4037,7 +4037,7 @@
 :- pragma foreign_proc("C",
     string.substring(Str::in, Start::in, Count::in, SubString::uo),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness, no_sharing],
+        does_not_affect_liveness, may_not_duplicate, no_sharing],
 "{
     MR_Integer  len;
     MR_Word     tmp;
@@ -4117,7 +4117,7 @@
 :- pragma foreign_proc("C",
     string.split(Str::in, Count::in, Left::uo, Right::uo),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness, no_sharing],
+        does_not_affect_liveness, may_not_duplicate, no_sharing],
 "{
     MR_Integer  len;
     MR_Word     tmp;
Index: library/term_size_prof_builtin.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/term_size_prof_builtin.m,v
retrieving revision 1.10
diff -u -r1.10 term_size_prof_builtin.m
--- library/term_size_prof_builtin.m	23 Jan 2007 02:49:50 -0000	1.10
+++ library/term_size_prof_builtin.m	28 Aug 2008 03:10:09 -0000
@@ -96,7 +96,7 @@
 
 :- pragma foreign_proc("C",
     measure_size(Term::in, Size::out),
-    [thread_safe, promise_pure, will_not_call_mercury],
+    [thread_safe, promise_pure, will_not_call_mercury, may_not_duplicate],
 "{
 #ifdef MR_RECORD_TERM_SIZES
     MR_TypeInfo type_info;
@@ -123,7 +123,7 @@
 
 :- pragma foreign_proc("C",
     measure_size_acc(Term::in, Size0::in, Size::out),
-    [thread_safe, promise_pure, will_not_call_mercury],
+    [thread_safe, promise_pure, will_not_call_mercury, may_not_duplicate],
 "{
 #ifdef MR_RECORD_TERM_SIZES
     MR_TypeInfo type_info;
@@ -150,7 +150,7 @@
 
 :- pragma foreign_proc("C",
     increment_size(Term::in, Incr::in),
-    [thread_safe, will_not_call_mercury],
+    [thread_safe, will_not_call_mercury, may_not_duplicate],
 "{
 #ifdef MR_RECORD_TERM_SIZES
   #ifdef MR_DEBUG_TERM_SIZES
Index: library/thread.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/thread.m,v
retrieving revision 1.14
diff -u -r1.14 thread.m
--- library/thread.m	11 Dec 2007 06:31:12 -0000	1.14
+++ library/thread.m	28 Aug 2008 02:58:00 -0000
@@ -82,7 +82,7 @@
 
 :- pragma foreign_proc("C",
     can_spawn,
-    [will_not_call_mercury, promise_pure],
+    [will_not_call_mercury, promise_pure, may_not_duplicate],
 "
 #if !defined(MR_HIGHLEVEL_CODE)
     SUCCESS_INDICATOR = MR_TRUE;
@@ -99,7 +99,8 @@
 
 :- pragma foreign_proc("C",
     spawn(Goal::(pred(di, uo) is cc_multi), IO0::di, IO::uo),
-    [promise_pure, will_not_call_mercury, thread_safe, tabled_for_io],
+    [promise_pure, will_not_call_mercury, thread_safe, tabled_for_io,
+        may_not_duplicate],
 "
 #if !defined(MR_HIGHLEVEL_CODE)
     MR_Context  *ctxt;
@@ -135,7 +136,8 @@
 
 :- pragma foreign_proc("C#",
     spawn(Goal::(pred(di, uo) is cc_multi), _IO0::di, _IO::uo),
-    [promise_pure, will_not_call_mercury, thread_safe, tabled_for_io],
+    [promise_pure, will_not_call_mercury, thread_safe, tabled_for_io,
+        may_not_duplicate],
 "
     System.Threading.Thread t;
     MercuryThread mt = new MercuryThread(Goal);
@@ -148,7 +150,8 @@
 :- pragma no_inline(yield/2).
 :- pragma foreign_proc("C",
     yield(IO0::di, IO::uo),
-    [promise_pure, will_not_call_mercury, thread_safe, tabled_for_io],
+    [promise_pure, will_not_call_mercury, thread_safe, tabled_for_io,
+        may_not_duplicate],
 "
 #ifndef MR_HIGHLEVEL_CODE
     MR_save_context(MR_ENGINE(MR_eng_this_context));
Index: library/version_array.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/version_array.m,v
retrieving revision 1.16
diff -u -r1.16 version_array.m
--- library/version_array.m	23 Nov 2007 07:35:58 -0000	1.16
+++ library/version_array.m	28 Aug 2008 03:11:22 -0000
@@ -312,7 +312,7 @@
 :- pragma foreign_proc("C",
     version_array.new(N::in, X::in) = (VA::out),
     [will_not_call_mercury, promise_pure, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, may_not_duplicate],
 "
     MR_Integer  i;
 
@@ -330,7 +330,7 @@
 :- pragma foreign_proc("C",
     resize(VA0::in, N::in, X::in) = (VA::out),
     [will_not_call_mercury, promise_pure, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, may_not_duplicate],
 "
     MR_Integer  i;
     MR_Integer  size_VA0;


--------------------------------------------------------------------------
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