[m-rev.] diff: Fix compilation of thread.m with tabling.

Peter Wang novalazy at gmail.com
Tue Feb 27 11:12:33 AEDT 2024


The tabling transform aborted on a predicate in thread.m because
an argument has mode 'unused':

Software Error: predicate `transform_hlds.table_gen.get_input_output_vars'/7:
Unexpected: bad var

library/thread.m:
    Change the mode of the argument from 'unused' to 'in'.

diff --git a/library/thread.m b/library/thread.m
index 2c9e4bad4..f36107cac 100644
--- a/library/thread.m
+++ b/library/thread.m
@@ -411,11 +411,11 @@ spawn_native(Goal, Options, Res, !IO) :-
     ).
 
 :- pred spawn_native_2(pred(thread, io, io)::in(pred(in, di, uo) is cc_multi),
-    T::unused, uint::in, bool::out, thread_desc::out, string::out,
+    T::in, uint::in, bool::out, thread_desc::out, string::out,
     io::di, io::uo) is cc_multi.
 
 :- pragma foreign_proc("C",
-    spawn_native_2(Goal::in(pred(in, di, uo) is cc_multi), _T::unused,
+    spawn_native_2(Goal::in(pred(in, di, uo) is cc_multi), _T::in,
         MinStackSize::in, Success::out, ThreadDesc::out, ErrorMsg::out,
         _IO0::di, _IO::uo),
     [promise_pure, will_not_call_mercury, thread_safe, tabled_for_io,
@@ -437,7 +437,7 @@ spawn_native(Goal, Options, Res, !IO) :-
 ").
 
 :- pragma foreign_proc("C#",
-    spawn_native_2(Goal::in(pred(in, di, uo) is cc_multi), _T::unused,
+    spawn_native_2(Goal::in(pred(in, di, uo) is cc_multi), _T::in,
         _MinStackSize::in, Success::out, ThreadDesc::out, ErrorMsg::out,
         _IO0::di, _IO::uo),
     [promise_pure, will_not_call_mercury, thread_safe, tabled_for_io,
@@ -465,7 +465,7 @@ spawn_native(Goal, Options, Res, !IO) :-
 ").
 
 :- pragma foreign_proc("Java",
-    spawn_native_2(Goal::in(pred(in, di, uo) is cc_multi), _T::unused,
+    spawn_native_2(Goal::in(pred(in, di, uo) is cc_multi), _T::in,
         _MinStackSize::in, Success::out, ThreadDesc::out, ErrorMsg::out,
         _IO0::di, _IO::uo),
     [promise_pure, will_not_call_mercury, thread_safe, tabled_for_io,
-- 
2.43.0



More information about the reviews mailing list