[m-rev.] diff: add some no_sharing foreign_proc annotations

Peter Wang novalazy at gmail.com
Mon Apr 28 15:11:33 AEST 2008


Branches: main

library/exception.m:
library/io.m:
library/string.m:
library/type_desc.m:
	Add `no_sharing' annotations to some C foreign_procs.

Index: library/exception.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/exception.m,v
retrieving revision 1.133
diff -u -r1.133 exception.m
--- library/exception.m	17 Sep 2007 09:03:02 -0000	1.133
+++ library/exception.m	28 Apr 2008 05:04:54 -0000
@@ -441,7 +441,7 @@
 
 :- pragma foreign_proc("C",
     use(_T::in),
-    [will_not_call_mercury, thread_safe],
+    [will_not_call_mercury, thread_safe, no_sharing],
     ";").
 :- pragma foreign_proc("C#",
     use(_T::in),
@@ -677,7 +677,8 @@
 
 :- impure pred make_io_state(io::uo) is det.
 :- pragma foreign_proc("C", make_io_state(_IO::uo),
-    [will_not_call_mercury, thread_safe, will_not_modify_trail], "").
+    [will_not_call_mercury, thread_safe, will_not_modify_trail, no_sharing],
+    "").
 :- pragma foreign_proc("C#", make_io_state(_IO::uo),
     [will_not_call_mercury, thread_safe], "").
 :- pragma foreign_proc("Java", make_io_state(_IO::uo),
@@ -688,7 +689,7 @@
 :- impure pred consume_io_state(io::di) is det.
 :- pragma foreign_proc("C",
     consume_io_state(_IO::di),
-    [will_not_call_mercury, thread_safe], "").
+    [will_not_call_mercury, thread_safe, no_sharing], "").
 :- pragma foreign_proc("C#",
     consume_io_state(_IO::di),
     [will_not_call_mercury, thread_safe], "").
@@ -2724,7 +2725,7 @@
 
 :- pragma foreign_proc("C",
     now_near_stack_limits,
-    [will_not_call_mercury],
+    [will_not_call_mercury, no_sharing],
 "
 #ifdef  MR_HIGHLEVEL_CODE
     /*
Index: library/io.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.407
diff -u -r1.407 io.m
--- library/io.m	10 Dec 2007 14:55:27 -0000	1.407
+++ library/io.m	28 Apr 2008 05:04:55 -0000
@@ -2161,7 +2161,7 @@
     io.read_line_as_string_2(Stream::in, _Bool::in, Res :: out,
         RetString::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
 #define ML_IO_READ_LINE_GROW(n) ((n) * 3 / 2)
 #define ML_IO_BYTES_TO_WORDS(n) (((n) + sizeof(MR_Word) - 1) / sizeof(MR_Word))
@@ -2448,7 +2448,7 @@
 :- pragma foreign_proc("C",
     io.clear_err(Stream::in, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     if (MR_IS_FILE_STREAM(*Stream)) {
         clearerr(MR_file(*Stream));
@@ -2505,7 +2505,7 @@
 :- pragma foreign_proc("C",
     ferror(Stream::in, RetVal::out, RetStr::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     if (MR_IS_FILE_STREAM(*Stream)) {
         RetVal = ferror(MR_file(*Stream));
@@ -2554,7 +2554,7 @@
 :- pragma foreign_proc("C",
     io.get_system_error(Error::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "{
     /*
     ** XXX If the Mercury context that called the failing C function is now
@@ -2595,7 +2595,7 @@
 :- pragma foreign_proc("C",
     make_err_msg(Error::in, Msg0::in, Msg::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     ML_maybe_make_err_msg(MR_TRUE, Error, Msg0, MR_PROC_LABEL, MR_FALSE, Msg);
     MR_update_io(IO0, IO);
@@ -2636,7 +2636,7 @@
 :- pragma foreign_proc("C",
     have_win32,
     [will_not_call_mercury, promise_pure, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
 #ifdef MR_WIN32
     SUCCESS_INDICATOR = MR_TRUE;
@@ -2650,7 +2650,7 @@
 :- pragma foreign_proc("C",
     have_cygwin,
     [will_not_call_mercury, promise_pure, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
 #ifdef __CYGWIN__
     SUCCESS_INDICATOR = MR_TRUE;
@@ -2684,7 +2684,7 @@
 :- pragma foreign_proc("C",
     make_win32_err_msg(Error::in, Msg0::in, Msg::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     ML_maybe_make_win32_err_msg(MR_TRUE, Error, Msg0, MR_PROC_LABEL, Msg);
     MR_update_io(IO0, IO);
@@ -2737,7 +2737,7 @@
 :- pragma foreign_proc("C",
     io.stream_file_size(Stream::in, Size::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
 #if defined(MR_HAVE_FSTAT) && \
         (defined(MR_HAVE_FILENO) || defined(fileno)) && defined(S_ISREG)
@@ -2804,7 +2804,7 @@
     io.file_modification_time_2(FileName::in, Status::out, Msg::out,
         Time::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
 #ifdef MR_HAVE_STAT
     struct stat s;
@@ -2908,7 +2908,7 @@
 :- pragma foreign_proc("C",
     file_type_implemented,
     [will_not_call_mercury, promise_pure, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
 #ifdef MR_HAVE_STAT
     SUCCESS_INDICATOR = MR_TRUE;
@@ -2942,7 +2942,7 @@
     io.file_type_2(FollowSymLinks::in, FileName::in, Result::out,
         IO0::di, IO::uo),
     [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
 #ifdef MR_HAVE_STAT
     struct stat s;
@@ -3261,7 +3261,7 @@
     io.check_file_accessibility_2(FileName::in, AccessTypes::in, Result::out,
         IO0::di, IO::uo),
     [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
 #if defined(MR_HAVE_ACCESS)
   #ifdef F_OK
@@ -3699,7 +3699,7 @@
 :- pragma foreign_proc("C",
     compare_file_id_2(Res::out, FileId1::in, FileId2::in),
     [will_not_call_mercury, promise_pure, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     int device_cmp;
     int inode_cmp;
@@ -3773,7 +3773,7 @@
     io.file_id_2(FileName::in, Status::out, Msg::out,
         FileId::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "{
 #ifdef MR_HAVE_STAT
     struct stat s;
@@ -3832,7 +3832,7 @@
 :- pragma foreign_proc("C",
     have_file_ids,
     [promise_pure, will_not_call_mercury, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
 #if defined(MR_BROKEN_STAT_ST_INO) || !defined(MR_HAVE_STAT)
     /* Win32 returns junk in the st_ino field of `struct stat'. */
@@ -3874,7 +3874,7 @@
 :- pragma foreign_proc("C",
     io.alloc_buffer(Size::in, Buffer::buffer_uo),
     [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "{
     MR_Word buf;
     MR_offset_incr_hp_atomic_msg(buf, 0,
@@ -4899,7 +4899,7 @@
 :- pragma foreign_proc("C",
     io.set_stream_db(StreamDb::in, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     ML_io_stream_db = StreamDb;
     MR_update_io(IO0, IO);
@@ -4909,7 +4909,8 @@
 
 :- pragma foreign_proc("C",
     io.lock_stream_db(IO0::di, IO::uo),
-    [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io],
+    [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io,
+        no_sharing],
 "
     MR_LOCK(&ML_io_stream_db_lock, MR_PROC_LABEL);
     IO = IO0;
@@ -4921,7 +4922,8 @@
 
 :- pragma foreign_proc("C",
     io.unlock_stream_db(IO0::di, IO::uo),
-    [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io],
+    [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io,
+        no_sharing],
 "
     MR_UNLOCK(&ML_io_stream_db_lock, MR_PROC_LABEL);
     IO = IO0;
@@ -5033,7 +5035,7 @@
 :- pragma foreign_proc("C",
     io.may_delete_stream_info(MayDelete::out, IO0::di, IO::uo),
     [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     MayDelete = !MR_debug_ever_enabled;
     IO = IO0;
@@ -5086,7 +5088,7 @@
 :- pragma foreign_proc("C",
     io.lock_globals(IO0::di, IO::uo),
     [promise_pure, will_not_call_mercury, thread_safe, tabled_for_io,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     #ifdef MR_THREAD_SAFE
         MR_LOCK(&ML_io_user_globals_lock, \"io.lock_globals/2\");
@@ -5103,7 +5105,7 @@
 :- pragma foreign_proc("C",
     io.unlock_globals(IO0::di, IO::uo),
     [promise_pure, will_not_call_mercury, thread_safe, tabled_for_io,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     #ifdef MR_THREAD_SAFE
         MR_UNLOCK(&ML_io_user_globals_lock, \"io.unlock_globals/2\");
@@ -5120,7 +5122,7 @@
 :- pragma foreign_proc("C",
     io.unlock_globals,
     [will_not_call_mercury, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     #ifdef MR_THREAD_SAFE
         MR_UNLOCK(&ML_io_user_globals_lock, \"io.unlock_globals/2\");
@@ -5150,7 +5152,7 @@
 :- pragma foreign_proc("C",
     io.unsafe_set_globals(Globals::in, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     /* XXX need to globalize the memory */
     ML_io_user_globals = Globals;
@@ -5209,7 +5211,8 @@
 
 :- pragma foreign_proc("C",
     io.get_stream_id(Stream::in) = (Id::out),
-    [will_not_call_mercury, promise_pure, does_not_affect_liveness],
+    [will_not_call_mercury, promise_pure, does_not_affect_liveness,
+        no_sharing],
 "
 #ifndef MR_NATIVE_GC
     /*
@@ -5394,7 +5397,7 @@
 :- pragma foreign_proc("C",
     io.gc_init(StreamDbType::in, UserGlobalsType::in, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     /* for Windows DLLs, we need to call GC_INIT() from each DLL */
 #ifdef MR_CONSERVATIVE_GC
@@ -7274,7 +7277,7 @@
 :- pragma foreign_proc("C",
     io.read_char_code_2(Stream::in, CharCode::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     CharCode = mercury_getc(Stream);
     MR_update_io(IO0, IO);
@@ -7288,7 +7291,7 @@
 :- pragma foreign_proc("C",
     io.read_byte_val_2(Stream::in, ByteVal::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     ByteVal = mercury_getc(Stream);
     MR_update_io(IO0, IO);
@@ -7301,7 +7304,7 @@
 :- pragma foreign_proc("C",
     io.putback_char_2(Stream::in, Character::in, IO0::di, IO::uo),
     [may_call_mercury, promise_pure, tabled_for_io, terminates,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     MercuryFilePtr mf = Stream;
     if (Character == '\\n') {
@@ -7321,7 +7324,7 @@
 :- pragma foreign_proc("C",
     io.putback_byte_2(Stream::in, Character::in, IO0::di, IO::uo),
     [may_call_mercury, promise_pure, tabled_for_io, terminates,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     MercuryFilePtr mf = Stream;
     /* XXX should work even if ungetc() fails */
@@ -7438,7 +7441,7 @@
 :- pragma foreign_proc("C",
     io.write_string(Message::in, IO0::di, IO::uo),
     [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     mercury_print_string(mercury_current_text_output(), Message);
     MR_update_io(IO0, IO);
@@ -7447,7 +7450,7 @@
 :- pragma foreign_proc("C",
     io.write_char(Character::in, IO0::di, IO::uo),
     [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     MercuryFilePtr out = mercury_current_text_output();
     if (MR_PUTCH(*out, Character) < 0) {
@@ -7462,7 +7465,7 @@
 :- pragma foreign_proc("C",
     io.write_int(Val::in, IO0::di, IO::uo),
     [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     MercuryFilePtr out = mercury_current_text_output();
     if (ML_fprintf(out, ""%ld"", (long) Val) < 0) {
@@ -7474,7 +7477,7 @@
 :- pragma foreign_proc("C",
     io.write_float(Val::in, IO0::di, IO::uo),
     [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     char buf[MR_SPRINTF_FLOAT_BUF_SIZE];
     MercuryFilePtr out;
@@ -7490,7 +7493,7 @@
 :- pragma foreign_proc("C",
     io.write_byte(Byte::in, IO0::di, IO::uo),
     [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     /* call putc with a strictly non-negative byte-sized integer */
     if (MR_PUTCH(*mercury_current_binary_output(),
@@ -7504,7 +7507,7 @@
 :- pragma foreign_proc("C",
     io.write_bytes(Message::in, IO0::di, IO::uo),
     [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "{
     mercury_print_binary_string(mercury_current_binary_output(), Message);
     MR_update_io(IO0, IO);
@@ -7522,7 +7525,7 @@
 :- pragma foreign_proc("C",
     io.flush_output(IO0::di, IO::uo),
     [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     MercuryFilePtr out = mercury_current_text_output();
     if (MR_FLUSH(*out) < 0) {
@@ -7534,7 +7537,7 @@
 :- pragma foreign_proc("C",
     io.flush_binary_output(IO0::di, IO::uo),
     [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     MercuryFilePtr out = mercury_current_binary_output();
     if (MR_FLUSH(*out) < 0) {
@@ -7769,7 +7772,7 @@
 :- pragma foreign_proc("C",
     io.seek_binary_2(Stream::in, Flag::in, Off::in, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     static const int seek_flags[] = { SEEK_SET, SEEK_CUR, SEEK_END };
 
@@ -7798,7 +7801,7 @@
 :- pragma foreign_proc("C",
     io.binary_stream_offset_2(Stream::in, Offset::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     /* XXX should check for failure */
     /* XXX should check if the stream is tellable */
@@ -7823,7 +7826,7 @@
 :- pragma foreign_proc("C",
     io.write_string_2(Stream::in, Message::in, IO0::di, IO::uo),
     [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     mercury_print_string(Stream, Message);
     MR_update_io(IO0, IO);
@@ -7836,7 +7839,7 @@
 :- pragma foreign_proc("C",
     io.write_char_2(Stream::in, Character::in, IO0::di, IO::uo),
     [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     if (MR_PUTCH(*Stream, Character) < 0) {
         mercury_output_error(Stream);
@@ -7854,7 +7857,7 @@
 :- pragma foreign_proc("C",
     io.write_int_2(Stream::in, Val::in, IO0::di, IO::uo),
     [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     if (ML_fprintf(Stream, ""%ld"", (long) Val) < 0) {
         mercury_output_error(Stream);
@@ -7869,7 +7872,7 @@
 :- pragma foreign_proc("C",
     io.write_float_2(Stream::in, Val::in, IO0::di, IO::uo),
     [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     char buf[MR_SPRINTF_FLOAT_BUF_SIZE];
     MR_sprintf_float(buf, Val);
@@ -7886,7 +7889,7 @@
 :- pragma foreign_proc("C",
     io.write_byte_2(Stream::in, Byte::in, IO0::di, IO::uo),
     [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     /* call putc with a strictly non-negative byte-sized integer */
     if (MR_PUTCH(*Stream, (int) ((unsigned char) Byte)) < 0) {
@@ -7902,7 +7905,7 @@
 :- pragma foreign_proc("C",
     io.write_bytes_2(Stream::in, Message::in, IO0::di, IO::uo),
     [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     mercury_print_binary_string(Stream, Message);
     MR_update_io(IO0, IO);
@@ -7944,7 +7947,8 @@
 :- pragma foreign_proc("C",
     io.do_write_bitmap(Stream::in, Bitmap::in, Start::in, Length::in,
             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,
+        no_sharing],
 "{
     MR_WRITE(*Stream, Bitmap->elements + Start, Length);
     MR_update_io(IO0, IO);
@@ -7958,7 +7962,7 @@
 :- pragma foreign_proc("C",
     io.flush_output_2(Stream::in, IO0::di, IO::uo),
     [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     if (MR_FLUSH(*Stream) < 0) {
         mercury_output_error(Stream);
@@ -7973,7 +7977,7 @@
 :- pragma foreign_proc("C",
     io.flush_binary_output_2(Stream::in, IO0::di, IO::uo),
     [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     if (MR_FLUSH(*Stream) < 0) {
         mercury_output_error(Stream);
@@ -8224,7 +8228,9 @@
 :- func io.stdin_stream_2 = io.stream.
 :- pragma foreign_proc("C",
     io.stdin_stream_2 = (Stream::out),
-    [will_not_call_mercury, promise_pure, thread_safe, does_not_affect_liveness],
+    [will_not_call_mercury, promise_pure, thread_safe, does_not_affect_liveness,
+        no_sharing],
+    % no_sharing is okay as io.stream is a foreign type so can't be reused. 
 "
     Stream = &mercury_stdin;
 ").
@@ -8243,7 +8249,8 @@
 :- pragma foreign_proc("C",
     io.stdin_stream_2(Stream::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
+    % no_sharing is okay as io.stream is a foreign type so can't be reused. 
 "
     Stream = &mercury_stdin;
     MR_update_io(IO0, IO);
@@ -8254,7 +8261,9 @@
 :- func io.stdout_stream_2 = io.stream.
 :- pragma foreign_proc("C",
     io.stdout_stream_2 = (Stream::out),
-    [will_not_call_mercury, promise_pure, thread_safe, does_not_affect_liveness],
+    [will_not_call_mercury, promise_pure, thread_safe, does_not_affect_liveness,
+        no_sharing],
+    % no_sharing is okay as io.stream is a foreign type so can't be reused. 
 "
     Stream = &mercury_stdout;
 ").
@@ -8272,7 +8281,9 @@
 :- pred io.stdout_stream_2(io.stream::out, io::di, io::uo) is det.
 :- pragma foreign_proc("C",
     io.stdout_stream_2(Stream::out, IO0::di, IO::uo),
-    [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe],
+    [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
+        no_sharing],
+    % no_sharing is okay as io.stream is a foreign type so can't be reused. 
 "
     Stream = &mercury_stdout;
     MR_update_io(IO0, IO);
@@ -8283,7 +8294,9 @@
 :- func io.stderr_stream_2 = io.stream.
 :- pragma foreign_proc("C",
     io.stderr_stream_2 = (Stream::out),
-    [will_not_call_mercury, promise_pure, thread_safe, does_not_affect_liveness],
+    [will_not_call_mercury, promise_pure, thread_safe, does_not_affect_liveness,
+        no_sharing],
+    % no_sharing is okay as io.stream is a foreign type so can't be reused. 
 "
     Stream = &mercury_stderr;
 ").
@@ -8302,7 +8315,8 @@
 :- pragma foreign_proc("C",
     io.stderr_stream_2(Stream::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
+    % no_sharing is okay as io.stream is a foreign type so can't be reused. 
 "
     Stream = &mercury_stderr;
     MR_update_io(IO0, IO);
@@ -8315,7 +8329,8 @@
 :- pragma foreign_proc("C",
     io.stdin_binary_stream_2(Stream::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
+    % no_sharing is okay as io.stream is a foreign type so can't be reused. 
 "
     Stream = &mercury_stdin_binary;
     MR_update_io(IO0, IO);
@@ -8328,7 +8343,8 @@
 :- pragma foreign_proc("C",
     io.stdout_binary_stream_2(Stream::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
+    % no_sharing is okay as io.stream is a foreign type so can't be reused. 
 "
     Stream = &mercury_stdout_binary;
     MR_update_io(IO0, IO);
@@ -8341,7 +8357,8 @@
 :- pragma foreign_proc("C",
     io.input_stream_2(Stream::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
+    % no_sharing is okay as io.stream is a foreign type so can't be reused. 
 "
     Stream = mercury_current_text_input();
     MR_update_io(IO0, IO);
@@ -8354,7 +8371,8 @@
 :- pragma foreign_proc("C",
     io.output_stream_2(Stream::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
+    % no_sharing is okay as io.stream is a foreign type so can't be reused. 
 "
     Stream = mercury_current_text_output();
     MR_update_io(IO0, IO);
@@ -8367,7 +8385,8 @@
 :- pragma foreign_proc("C",
     io.binary_input_stream_2(Stream::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
+    % no_sharing is okay as io.stream is a foreign type so can't be reused. 
 "
     Stream = mercury_current_binary_input();
     MR_update_io(IO0, IO);
@@ -8380,7 +8399,8 @@
 :- pragma foreign_proc("C",
     io.binary_output_stream_2(Stream::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
+    % no_sharing is okay as io.stream is a foreign type so can't be reused. 
 "
     Stream = mercury_current_binary_output();
     MR_update_io(IO0, IO);
@@ -8389,7 +8409,7 @@
 :- pragma foreign_proc("C",
     io.get_line_number(LineNum::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     LineNum = MR_line_number(*mercury_current_text_input());
     MR_update_io(IO0, IO);
@@ -8403,7 +8423,7 @@
 :- pragma foreign_proc("C",
     io.get_line_number_2(Stream::in, LineNum::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     LineNum = MR_line_number(*Stream);
     MR_update_io(IO0, IO);
@@ -8412,7 +8432,7 @@
 :- pragma foreign_proc("C",
     io.set_line_number(LineNum::in, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     MR_line_number(*mercury_current_text_input()) = LineNum;
     MR_update_io(IO0, IO);
@@ -8427,7 +8447,7 @@
 :- pragma foreign_proc("C",
     io.set_line_number_2(Stream::in, LineNum::in, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     MR_line_number(*Stream) = LineNum;
     MR_update_io(IO0, IO);
@@ -8436,7 +8456,7 @@
 :- pragma foreign_proc("C",
     io.get_output_line_number(LineNum::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     LineNum = MR_line_number(*mercury_current_text_output());
     MR_update_io(IO0, IO);
@@ -8451,7 +8471,7 @@
 :- pragma foreign_proc("C",
     io.get_output_line_number_2(Stream::in, LineNum::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     LineNum = MR_line_number(*Stream);
     MR_update_io(IO0, IO);
@@ -8460,7 +8480,7 @@
 :- pragma foreign_proc("C",
     io.set_output_line_number(LineNum::in, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     MR_line_number(*mercury_current_text_output()) = LineNum;
     MR_update_io(IO0, IO);
@@ -8474,7 +8494,7 @@
 :- pragma foreign_proc("C",
     io.set_output_line_number_2(Stream::in, LineNum::in, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     MR_line_number(*Stream) = LineNum;
     MR_update_io(IO0, IO);
@@ -8488,7 +8508,8 @@
 :- pragma foreign_proc("C",
     io.set_input_stream_2(NewStream::in, OutStream::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
+    % no_sharing is okay as io.stream is a foreign type so can't be reused. 
 "
     OutStream = mercury_current_text_input();
     MR_set_thread_local_mutable(MercuryFilePtr, NewStream,
@@ -8506,7 +8527,8 @@
 :- pragma foreign_proc("C",
     io.set_output_stream_2(NewStream::in, OutStream::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
+    % no_sharing is okay as io.stream is a foreign type so can't be reused. 
 "
     OutStream = mercury_current_text_output();
     MR_set_thread_local_mutable(MercuryFilePtr, NewStream,
@@ -8524,7 +8546,8 @@
     io.set_binary_input_stream_2(NewStream::in, OutStream::out,
         IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
+    % no_sharing is okay as io.stream is a foreign type so can't be reused. 
 "
     OutStream = mercury_current_binary_input();
     MR_set_thread_local_mutable(MercuryFilePtr, NewStream,
@@ -8542,7 +8565,8 @@
     io.set_binary_output_stream_2(NewStream::in, OutStream::out,
         IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
+    % no_sharing is okay as io.stream is a foreign type so can't be reused. 
 "
     OutStream = mercury_current_binary_output();
     MR_set_thread_local_mutable(MercuryFilePtr, NewStream,
@@ -9059,7 +9083,7 @@
     io.do_open_text(FileName::in, Mode::in, ResultCode::out,
         StreamId::out, Stream::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     Stream = mercury_open(FileName, Mode);
     if (Stream != NULL) {
@@ -9076,7 +9100,7 @@
     io.do_open_binary(FileName::in, Mode::in, ResultCode::out,
         StreamId::out, Stream::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     Stream = mercury_open(FileName, Mode);
     if (Stream != NULL) {
@@ -9232,7 +9256,7 @@
 :- pragma foreign_proc("C",
     io.close_stream(Stream::in, IO0::di, IO::uo),
     [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     mercury_close(Stream);
     MR_update_io(IO0, IO);
@@ -9278,7 +9302,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],
+        does_not_affect_liveness, no_sharing],
+    % no_sharing is okay because the string elements can't reused.
 "{
     int i;
 
@@ -9297,7 +9322,7 @@
 :- pragma foreign_proc("C",
     io.get_exit_status(ExitStatus::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     ExitStatus = mercury_exit_status;
     MR_update_io(IO0, IO);
@@ -9306,7 +9331,7 @@
 :- pragma foreign_proc("C",
     io.set_exit_status(ExitStatus::in, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     mercury_exit_status = ExitStatus;
     MR_update_io(IO0, IO);
@@ -9334,7 +9359,7 @@
     io.call_system_code(Command::in, Status::out, Msg::out,
         IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     /*
     ** In multithreaded grades, try to use posix_spawn() instead of system().
@@ -9475,7 +9500,8 @@
 
 :- pragma foreign_proc("C",
     io.handle_system_command_exit_code(Status0::in) = (Status::out),
-    [will_not_call_mercury, thread_safe, promise_pure, does_not_affect_liveness],
+    [will_not_call_mercury, thread_safe, promise_pure, does_not_affect_liveness,
+        no_sharing],
 "
     #if defined (WIFEXITED) && defined (WEXITSTATUS) && \
             defined (WIFSIGNALED) && defined (WTERMSIG)
@@ -9703,7 +9729,7 @@
 
 :- pragma foreign_proc("C",
     io.getenv(Var::in, Value::out),
-    [will_not_call_mercury, tabled_for_io, does_not_affect_liveness],
+    [will_not_call_mercury, tabled_for_io, does_not_affect_liveness, no_sharing],
 "{
     Value = getenv(Var);
     SUCCESS_INDICATOR = (Value != 0);
@@ -9765,7 +9791,7 @@
 
 :- pragma foreign_proc("C",
     io.putenv(VarAndValue::in),
-    [will_not_call_mercury, tabled_for_io, does_not_affect_liveness],
+    [will_not_call_mercury, tabled_for_io, does_not_affect_liveness, no_sharing],
 "
     SUCCESS_INDICATOR = (putenv(VarAndValue) == 0);
 ").
@@ -10230,7 +10256,7 @@
     io.remove_file_2(FileName::in, RetVal::out, RetStr::out,
         IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "{
     RetVal = remove(FileName);
     ML_maybe_make_err_msg(RetVal != 0, errno, ""remove failed: "",
@@ -10368,7 +10394,7 @@
     io.rename_file_2(OldFileName::in, NewFileName::in, RetVal::out,
         RetStr::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "{
     RetVal = rename(OldFileName, NewFileName);
     ML_maybe_make_err_msg(RetVal != 0, errno, ""rename failed: "",
@@ -10446,7 +10472,7 @@
 :- pragma foreign_proc("C",
     io.have_symlinks,
     [will_not_call_mercury, promise_pure, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
 #if defined(MR_HAVE_SYMLINK) && defined(MR_HAVE_READLINK)
     SUCCESS_INDICATOR = MR_TRUE;
@@ -10485,7 +10511,7 @@
     io.make_symlink_2(FileName::in, LinkFileName::in, Status::out,
         IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "{
 #ifdef MR_HAVE_SYMLINK
     Status = (symlink(FileName, LinkFileName) == 0);
@@ -10533,7 +10559,7 @@
     io.read_symlink_2(FileName::in, TargetFileName::out,
         Status::out, Error::out, IO0::di, IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "{
 #ifdef MR_HAVE_READLINK
   #ifndef PATH_MAX
Index: library/string.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/string.m,v
retrieving revision 1.271
diff -u -r1.271 string.m
--- library/string.m	4 Mar 2008 03:11:51 -0000	1.271
+++ library/string.m	28 Apr 2008 05:04:56 -0000
@@ -1296,7 +1296,7 @@
 :- pragma foreign_proc("C",
     string.to_char_list_2(Str::in, CharList::out),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "{
     MR_ConstString p = Str + strlen(Str);
     CharList = MR_list_empty_msg(MR_PROC_LABEL);
@@ -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],
+        does_not_affect_liveness, 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],
+        does_not_affect_liveness, 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],
+        does_not_affect_liveness, 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],
+        does_not_affect_liveness, no_sharing],
 "{
     MR_Word list;
     MR_Word tmp;
@@ -1715,7 +1715,7 @@
     sub_string_search_start(WholeString::in, Pattern::in, BeginAt::in,
         Index::out),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "{
     char *match;
     match = strstr(WholeString + BeginAt, Pattern);
@@ -2232,7 +2232,7 @@
 
 :- pragma foreign_proc("C", using_sprintf,
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     SUCCESS_INDICATOR = MR_TRUE;
 ").
@@ -2315,7 +2315,7 @@
 :- pragma foreign_proc("C",
     int_length_modifer = (LengthModifier::out),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "{
     MR_make_aligned_string(LengthModifier, MR_INTEGER_LENGTH_MODIFIER);
 }").
@@ -2334,7 +2334,7 @@
 :- pragma foreign_proc("C",
     native_format_float(FormatStr::in, Val::in) = (Str::out),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "{
     MR_save_transient_hp();
     Str = MR_make_string(MR_PROC_LABEL, FormatStr, (double) Val);
@@ -2354,7 +2354,7 @@
 :- pragma foreign_proc("C",
     native_format_int(FormatStr::in, Val::in) = (Str::out),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "{
     MR_save_transient_hp();
     Str = MR_make_string(MR_PROC_LABEL, FormatStr, Val);
@@ -2374,7 +2374,7 @@
 :- pragma foreign_proc("C",
     native_format_string(FormatStr::in, Val::in) = (Str::out),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "{
     MR_save_transient_hp();
     Str = MR_make_string(MR_PROC_LABEL, FormatStr, Val);
@@ -2394,7 +2394,7 @@
 :- pragma foreign_proc("C",
     native_format_char(FormatStr::in, Val::in) = (Str::out),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "{
     MR_save_transient_hp();
     Str = MR_make_string(MR_PROC_LABEL, FormatStr, Val);
@@ -3229,7 +3229,7 @@
 :- pragma foreign_proc("C",
     string.float_to_string(Flt::in, Str::uo),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "{
     /*
     ** For efficiency reasons we duplicate the C implementation
@@ -3289,7 +3289,7 @@
 :- pragma foreign_proc("C",
     string.lowlevel_float_to_string(Flt::in, Str::uo),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "{
     /*
     ** Note any changes here will require the same changes in
@@ -3338,7 +3338,7 @@
 :- pragma foreign_proc("C",
     string.to_float(FloatString::in, FloatVal::out),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "{
     /*
     ** The %c checks for any erroneous characters appearing after the float;
@@ -3475,7 +3475,7 @@
 :- pragma foreign_proc("C",
     string.contains_char(Str::in, Ch::in),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     SUCCESS_INDICATOR = (strchr(Str, Ch) != NULL) && Ch != '\\0';
 ").
@@ -3524,7 +3524,7 @@
 :- pragma foreign_proc("C",
     string.index_check(Index::in, Length::in),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     /*
     ** We do not test for negative values of Index because (a) MR_Unsigned
@@ -3550,7 +3550,7 @@
 :- pragma foreign_proc("C",
     string.unsafe_index(Str::in, Index::in, Ch::uo),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     Ch = Str[Index];
 ").
@@ -3764,7 +3764,7 @@
 :- pragma foreign_proc("C",
     string.length(Str::in, Length::uo),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     Length = strlen(Str);
 ").
@@ -3790,7 +3790,7 @@
 :- pragma foreign_proc("C",
     string.length(Str::ui, Length::uo),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     Length = strlen(Str);
 ").
@@ -3845,7 +3845,7 @@
 :- pragma foreign_proc("C",
     string.append_iii(S1::in, S2::in, S3::in),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "{
     size_t len_1 = strlen(S1);
     SUCCESS_INDICATOR = (
@@ -3884,7 +3884,7 @@
 :- pragma foreign_proc("C",
     string.append_ioi(S1::in, S2::uo, S3::in),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "{
     size_t len_1, len_2, len_3;
 
@@ -3923,7 +3923,7 @@
 :- pragma foreign_proc("C",
     string.append_iio(S1::in, S2::in, S3::uo),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "{
     size_t len_1, len_2;
     len_1 = strlen(S1);
@@ -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],
+        does_not_affect_liveness, 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],
+        does_not_affect_liveness, no_sharing],
 "{
     MR_Integer  len;
     MR_Word     tmp;
@@ -4087,7 +4087,7 @@
 :- pragma foreign_proc("C",
     string.unsafe_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],
+        does_not_affect_liveness, no_sharing],
 "{
     MR_Integer len;
 
@@ -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],
+        does_not_affect_liveness, no_sharing],
 "{
     MR_Integer  len;
     MR_Word     tmp;
@@ -4203,7 +4203,7 @@
 :- pragma foreign_proc("C",
     string.first_char(Str::in, First::in, Rest::in),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     SUCCESS_INDICATOR = (
         Str[0] == First &&
@@ -4245,7 +4245,7 @@
 :- pragma foreign_proc("C",
     string.first_char(Str::in, First::uo, Rest::in),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "
     First = Str[0];
     SUCCESS_INDICATOR = (First != '\\0' && strcmp(Str + 1, Rest) == 0);
@@ -4291,7 +4291,7 @@
 :- pragma foreign_proc("C",
     string.first_char(Str::in, First::in, Rest::uo),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "{
     if (Str[0] != First || First == '\\0') {
         SUCCESS_INDICATOR = MR_FALSE;
@@ -4349,7 +4349,7 @@
 :- pragma foreign_proc("C",
     string.first_char(Str::in, First::uo, Rest::uo),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "{
     First = Str[0];
     if (First == '\\0') {
@@ -4408,7 +4408,7 @@
 :- pragma foreign_proc("C",
     string.first_char(Str::uo, First::in, Rest::in),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
+        does_not_affect_liveness, no_sharing],
 "{
     size_t len = strlen(Rest) + 1;
     MR_allocate_aligned_string_msg(Str, len, MR_PROC_LABEL);
Index: library/type_desc.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/type_desc.m,v
retrieving revision 1.55
diff -u -r1.55 type_desc.m
--- library/type_desc.m	25 Sep 2007 12:59:43 -0000	1.55
+++ library/type_desc.m	28 Apr 2008 05:04:56 -0000
@@ -325,7 +325,8 @@
 
 :- pragma foreign_proc("C",
     is_univ_pseudo_type_desc(PseudoTypeDesc::in, TypeVarNum::out),
-    [will_not_call_mercury, thread_safe, promise_pure, will_not_modify_trail],
+    [will_not_call_mercury, thread_safe, promise_pure, will_not_modify_trail,
+        no_sharing],
 "
     MR_PseudoTypeInfo   pseudo_type_info;
 
@@ -347,7 +348,8 @@
 
 :- pragma foreign_proc("C",
     is_exist_pseudo_type_desc(PseudoTypeDesc::in, TypeVarNum::out),
-    [will_not_call_mercury, thread_safe, promise_pure, will_not_modify_trail],
+    [will_not_call_mercury, thread_safe, promise_pure, will_not_modify_trail,
+        no_sharing],
 "
     MR_PseudoTypeInfo   pseudo_type_info;
 
@@ -400,7 +402,8 @@
 
 :- pragma foreign_proc("C",
     type_of(_Value::unused) = (TypeInfo::out),
-    [will_not_call_mercury, thread_safe, promise_pure, will_not_modify_trail],
+    [will_not_call_mercury, thread_safe, promise_pure, will_not_modify_trail,
+        no_sharing],
 "{
     TypeInfo = TypeInfo_for_T;
 
@@ -442,7 +445,7 @@
 
 :- pragma foreign_proc("C",
     has_type(_Arg::unused, TypeInfo::in),
-    [will_not_call_mercury, thread_safe, promise_pure],
+    [will_not_call_mercury, thread_safe, promise_pure, no_sharing],
 "
     TypeInfo_for_T = TypeInfo;
 ").


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