[m-rev.] diff: trivial C# foreign procs

Peter Wang novalazy at gmail.com
Fri Oct 8 12:46:51 AEDT 2010


Branches: main

library/private_builtin.m:
        Add C# foreign procs for `imp', `semip',
        `trace_evaluate_runtime_condition'.

library/store.m:
        Add C# foreign proc for `unsafe_new_uninitialized_mutvar'.

diff --git a/library/private_builtin.m b/library/private_builtin.m
index 9bd6167..e9d00ef 100644
--- a/library/private_builtin.m
+++ b/library/private_builtin.m
@@ -1620,7 +1620,11 @@ no_clauses(PredName) :-
     imp,
     [will_not_call_mercury, thread_safe, will_not_modify_trail],
 "").
-:- pragma foreign_proc(il,  
+:- pragma foreign_proc("IL",
+    imp,
+    [will_not_call_mercury, thread_safe, max_stack_size(0)],
+"").
+:- pragma foreign_proc("C#",
     imp,
     [will_not_call_mercury, thread_safe, max_stack_size(0)],
 "").
@@ -1638,10 +1642,14 @@ no_clauses(PredName) :-
     [will_not_call_mercury, thread_safe, promise_semipure,
         will_not_modify_trail],
 "").
-:- pragma foreign_proc(il,  
+:- pragma foreign_proc("IL",
     semip,
     [will_not_call_mercury, thread_safe, promise_semipure, max_stack_size(0)],
 "").
+:- pragma foreign_proc("C#",
+    semip,
+    [will_not_call_mercury, thread_safe, promise_semipure],
+"").
 :- pragma foreign_proc("Java",
     semip,
     [will_not_call_mercury, thread_safe, promise_semipure],
@@ -1967,6 +1975,16 @@ no_clauses(PredName) :-
     SUCCESS_INDICATOR = false
 ").
 
+:- pragma foreign_proc("C#",
+    trace_evaluate_runtime_condition,
+    [will_not_call_mercury, thread_safe, promise_semipure,
+        does_not_affect_liveness],
+"
+    // All uses of this predicate should override the body.
+    throw new System.Exception(
+        ""trace_evaluate_runtime_condition called"");
+").
+
 :- pragma foreign_proc("Java",
     trace_evaluate_runtime_condition,
     [will_not_call_mercury, thread_safe, promise_semipure,
diff --git a/library/store.m b/library/store.m
index e85da4b..6c9ed0a 100644
--- a/library/store.m
+++ b/library/store.m
@@ -436,6 +436,13 @@ copy_mutvar(Mutvar, Copy, !S) :-
     S = S0;
 ").
 
+:- pragma foreign_proc("C#",
+    unsafe_new_uninitialized_mutvar(Mutvar::out, _S0::di, _S::uo),
+    [will_not_call_mercury, promise_pure],
+"
+    Mutvar = new object[1];
+").
+
 :- pragma foreign_proc("Java",
     unsafe_new_uninitialized_mutvar(Mutvar::out, _S0::di, _S::uo),
     [will_not_call_mercury, promise_pure],

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