[m-rev.] for review: semaphores in deep profiling grades

Peter Wang novalazy at gmail.com
Tue Sep 11 11:02:16 AEST 2007


Branches: main

library/thread.semaphore.m:
	Make semaphore.signal and semaphore.wait work in the (non-parallel)
	deep profiling grades.  Due to the way these procedures are
	implemented, they would miss the exit port code inserted by the deep
	profiling transformation when leaving the procedure.


Index: library/thread.semaphore.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/thread.semaphore.m,v
retrieving revision 1.10
diff -u -r1.10 thread.semaphore.m
--- library/thread.semaphore.m	22 Aug 2007 08:19:21 -0000	1.10
+++ library/thread.semaphore.m	11 Sep 2007 00:54:37 -0000
@@ -374,7 +374,22 @@
 
     MR_define_entry(mercury__thread__semaphore__nop);
     {
+      #ifdef MR_DEEP_PROFILING
+
+        /*
+        ** Perform the actions that would have been taken if we had resumed
+        ** back in semaphore.signal and semaphore.wait and left the procedure
+        ** normally.
+        */
+        MR_succip_word = MR_sv(2);
+        MR_decr_sp(2);
+        MR_np_tailcall_ent(profiling_builtin__det_exit_port_code_sr_3_0);
+
+      #else  /* !MR_DEEP_PROFILING */
+
         MR_proceed();
+
+      #endif /* !MR_DEEP_PROFILING */ 
     }
     MR_END_MODULE
 

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