[m-rev.] diff: fix software rot in extras/concurrency

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Nov 22 21:32:13 AEDT 2001


Estimated hours taken: 0.5
Branches: main

Fix some software rot in extras/concurrency.
This was broken by Zoltan's changes to runtime/mercury_context.h and
runtime/mercury_engine.h, which were part of his deep profiling changes.

extras/concurrency/semaphore.m:
extras/concurrency/spawn.m:
	Add missing prefixes on struct field names
	for the MercuryEngine and MR_Context structs.

extras/concurrency/Mmakefile:
	Change the rule for `mmake check' so that it
	builds the example programs, rather doing nothing.

Workspace: /home/earth/fjh/ws-earth3/mercury
Index: extras/concurrency/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/concurrency/Mmakefile,v
retrieving revision 1.2
diff -u -d -u -r1.2 Mmakefile
--- Mmakefile	21 Nov 2000 23:52:27 -0000	1.2
+++ Mmakefile	22 Nov 2001 10:28:10 -0000
@@ -6,10 +6,11 @@
 
 -include ../Mmake.params
 
-default_target: philo
+default_target: tests
 
-depend:		philo.depend
+depend:		philo.depend philo2.depend midimon.depend
+tests:		philo philo2 midimon
 
 .PHONY: check
-check:
+check: tests
 		true
Index: extras/concurrency/semaphore.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/concurrency/semaphore.m,v
retrieving revision 1.9
diff -u -d -r1.9 semaphore.m
--- extras/concurrency/semaphore.m	25 Jun 2001 04:13:35 -0000	1.9
+++ extras/concurrency/semaphore.m	22 Nov 2001 10:18:55 -0000
@@ -151,12 +151,12 @@
 #ifndef MR_HIGHLEVEL_CODE
 	if (sem->count >= 0 && sem->suspended != NULL) {
 		ctxt = sem->suspended;
-		sem->suspended = ctxt->next;
+		sem->suspended = ctxt->MR_ctxt_next;
 		MR_UNLOCK(&(sem->lock), ""semaphore__signal"");
 		MR_schedule(ctxt);
 			/* yield() */
 		MR_save_context(MR_ENGINE(MR_eng_this_context));
-		MR_ENGINE(MR_eng_this_context)->resume =
+		MR_ENGINE(MR_eng_this_context)->MR_ctxt_resume =
 			&&signal_skip_to_the_end_1;
 		MR_schedule(MR_ENGINE(MR_eng_this_context));
 		MR_runnext();
@@ -166,7 +166,7 @@
 		MR_UNLOCK(&(sem->lock), ""semaphore__signal"");
 			/* yield() */
 		MR_save_context(MR_ENGINE(MR_eng_this_context));
-		MR_ENGINE(MR_eng_this_context)->resume =
+		MR_ENGINE(MR_eng_this_context)->MR_ctxt_resume =
 			&&signal_skip_to_the_end_2;
 		MR_schedule(MR_ENGINE(MR_eng_this_context));
 		MR_runnext();
@@ -202,9 +202,9 @@
 		MR_UNLOCK(&(sem->lock), ""semaphore__wait"");
 	} else {
 		MR_save_context(MR_ENGINE(MR_eng_this_context));
-		MR_ENGINE(MR_eng_this_context)->resume =
+		MR_ENGINE(MR_eng_this_context)->MR_ctxt_resume =
 			&&wait_skip_to_the_end;
-		MR_ENGINE(MR_eng_this_context)->next = sem->suspended;
+		MR_ENGINE(MR_eng_this_context)->MR_ctxt_next = sem->suspended;
 		sem->suspended = MR_ENGINE(MR_eng_this_context);
 		MR_UNLOCK(&(sem->lock), ""semaphore__wait"");
 		MR_runnext();
Index: extras/concurrency/spawn.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/concurrency/spawn.m,v
retrieving revision 1.7
diff -u -d -r1.7 spawn.m
--- extras/concurrency/spawn.m	27 Jun 2001 08:43:32 -0000	1.7
+++ extras/concurrency/spawn.m	22 Nov 2001 10:20:24 -0000
@@ -51,17 +51,17 @@
 #ifndef MR_HIGHLEVEL_CODE
 	MR_Context	*ctxt;
 	ctxt = MR_create_context();
-	ctxt->resume = &&spawn_call_back_to_mercury_cc_multi;
+	ctxt->MR_ctxt_resume = &&spawn_call_back_to_mercury_cc_multi;
 		/* Store the closure on the top of the new context's stack. */
-	*(ctxt->context_sp) = Goal;
-	ctxt->next = NULL;
+	*(ctxt->MR_ctxt_sp) = Goal;
+	ctxt->MR_ctxt_next = NULL;
 	MR_schedule(ctxt);
 	if (0) {
 spawn_call_back_to_mercury_cc_multi:
 		MR_save_registers();
 			/* Get the closure from the top of the stack */
 		call_back_to_mercury_cc_multi(*((MR_Word *)MR_sp));
-		MR_destroy_context(MR_ENGINE(this_context));
+		MR_destroy_context(MR_ENGINE(MR_eng_this_context));
 		MR_runnext();
 	}
 #else
@@ -75,9 +75,10 @@
 		[will_not_call_mercury, thread_safe], "{
 		/* yield() */
 #ifndef MR_HIGHLEVEL_CODE
-	MR_save_context(MR_ENGINE(this_context));
-	MR_ENGINE(this_context)->resume = &&yield_skip_to_the_end;
-	MR_schedule(MR_ENGINE(this_context));
+	MR_save_context(MR_ENGINE(MR_eng_this_context));
+	MR_ENGINE(MR_eng_this_context)->MR_ctxt_resume =
+		&&yield_skip_to_the_end;
+	MR_schedule(MR_ENGINE(MR_eng_this_context));
 	MR_runnext();
 yield_skip_to_the_end:
 #endif

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list