mozart (1.4.0-8) platform/emulator/libdp/glue_mediators.cc

Summary

 platform/emulator/libdp/glue_mediators.cc |  155 ++++++++++++------------------
 1 file changed, 66 insertions(+), 89 deletions(-)

    
download this patch

Patch contents

--- mozart-1.4.0.orig/platform/emulator/libdp/glue_mediators.cc
+++ mozart-1.4.0/platform/emulator/libdp/glue_mediators.cc
@@ -67,7 +67,6 @@
   case GLUE_VARIABLE:
   case GLUE_READONLY:
     return (1 << pn) & (1 << PN_TRANSIENT | 1 << PN_TRANSIENT_REMOTE);
-  case GLUE_UNUSABLE:
   case GLUE_CHUNK:
   case GLUE_CLASS:
   case GLUE_OBJECT:
@@ -75,6 +74,8 @@
     return (1 << pn) & (1 << PN_SIMPLE_CHANNEL | 1 << PN_IMMUTABLE_LAZY |
 			1 << PN_IMMUTABLE_EAGER | 1 << PN_IMMEDIATE |
 			1 << PN_SITED);
+  case GLUE_UNUSABLE:
+    return pn == PN_SITED;
   default:
     return false;
   }
@@ -386,7 +387,7 @@
 
 void
 Mediator::print(){
-  printf("%s mediator, id %d, proxy %x, ref %x, gc(eng:%d dss:%d), con %d\n",
+  printf("%s mediator, id %d, proxy %p, ref %x, gc(eng:%d dss:%d), con %d\n",
 	 getPrintType(), id, getCoordinatorAssistant(), entity,
 	 (int) collected, (int) dss_gc_status, (int) attached);
 }
@@ -421,22 +422,20 @@
   setEntity(e);
 }
 
-AOcallback
-PortMediator::callback_Write(DssThreadId*, DssOperationId*,
+void
+PortMediator::callback_Write(DssThreadId*,
 			     PstInContainerInterface* pstin)
 {
   TaggedRef arg = static_cast<PstInContainer*>(pstin)->a_term;
   doPortSend(static_cast<OzPort*>(getConst()), arg, NULL);
-  return AOCB_FINISH;
 }
 
-AOcallback
-PortMediator::callback_Read(DssThreadId*, DssOperationId*,
+void
+PortMediator::callback_Read(DssThreadId*,
 			    PstInContainerInterface*,
 			    PstOutContainerInterface*&)
 {
   Assert(0);
-  return AOCB_FINISH;
 }
 
 
@@ -450,8 +449,8 @@
   setEntity(e);
 }
 
-AOcallback 
-CellMediator::callback(DssThreadId*, DssOperationId*,
+void
+CellMediator::callback(DssThreadId*,
 		       PstInContainerInterface* pstin,
 		       PstOutContainerInterface*& answer)
 {
@@ -467,21 +466,20 @@
     Assert(ret == RAISE);
     answer = new PstOutContainer(glue_raise(am.getExceptionValue()));
   }
-  return AOCB_FINISH;
 }
 
-AOcallback
-CellMediator::callback_Write(DssThreadId* thr, DssOperationId* op,
+void
+CellMediator::callback_Write(DssThreadId* thr,
 			     PstInContainerInterface* pstin,
 			     PstOutContainerInterface*& pstout) {
-  return callback(thr, op, pstin, pstout);
+  callback(thr, pstin, pstout);
 }
 
-AOcallback
-CellMediator::callback_Read(DssThreadId* thr, DssOperationId* op,
+void
+CellMediator::callback_Read(DssThreadId* thr,
 			    PstInContainerInterface* pstin,
 			    PstOutContainerInterface*& pstout) {
-  return callback(thr, op, pstin, pstout);
+  callback(thr, pstin, pstout);
 }
 
 PstOutContainerInterface *
@@ -515,8 +513,8 @@
   setEntity(e);
 }
 
-AOcallback 
-LockMediator::callback_Write(DssThreadId*, DssOperationId*,
+void
+LockMediator::callback_Write(DssThreadId*,
 			     PstInContainerInterface* operation,
 			     PstOutContainerInterface*& answer)
 {
@@ -542,16 +540,14 @@
       answer = NULL;
     }
   }
-  return AOCB_FINISH;
 }
 
-AOcallback 
-LockMediator::callback_Read(DssThreadId*, DssOperationId*,
+void
+LockMediator::callback_Read(DssThreadId*,
 			    PstInContainerInterface*,
 			    PstOutContainerInterface*&)
 {
   Assert(0);
-  return AOCB_FINISH;
 }
 
 PstOutContainerInterface *
@@ -603,8 +599,8 @@
   setEntity(e);
 }
 
-AOcallback 
-ArrayMediator::callback(DssThreadId*, DssOperationId*,
+void
+ArrayMediator::callback(DssThreadId*,
 			PstInContainerInterface* pstin,
 			PstOutContainerInterface*& answer)
 {
@@ -620,21 +616,20 @@
     Assert(ret == RAISE);
     answer = new PstOutContainer(glue_raise(am.getExceptionValue()));
   }
-  return AOCB_FINISH;
 }
 
-AOcallback
-ArrayMediator::callback_Write(DssThreadId* thr, DssOperationId* op,
+void
+ArrayMediator::callback_Write(DssThreadId* thr,
 			      PstInContainerInterface* pstin,
 			      PstOutContainerInterface*& pstout) {
-  return callback(thr, op, pstin, pstout);
+  callback(thr, pstin, pstout);
 }
 
-AOcallback
-ArrayMediator::callback_Read(DssThreadId* thr, DssOperationId* op,
+void
+ArrayMediator::callback_Read(DssThreadId* thr,
 			     PstInContainerInterface* pstin,
 			     PstOutContainerInterface*& pstout) {
-  return callback(thr, op, pstin, pstout);
+  callback(thr, pstin, pstout);
 }
 
 PstOutContainerInterface*
@@ -686,8 +681,8 @@
   setEntity(e);
 }
 
-AOcallback 
-DictionaryMediator::callback(DssThreadId*, DssOperationId*,
+void
+DictionaryMediator::callback(DssThreadId*,
 			     PstInContainerInterface* pstin,
 			     PstOutContainerInterface*& answer)
 {
@@ -703,21 +698,20 @@
     Assert(ret == RAISE);
     answer = new PstOutContainer(glue_raise(am.getExceptionValue()));
   }
-  return AOCB_FINISH;
 }
 
-AOcallback
-DictionaryMediator::callback_Write(DssThreadId* thr, DssOperationId* op,
+void
+DictionaryMediator::callback_Write(DssThreadId* thr,
 				   PstInContainerInterface* pstin,
 				   PstOutContainerInterface*& pstout) {
-  return callback(thr, op, pstin, pstout);
+  callback(thr, pstin, pstout);
 }
 
-AOcallback
-DictionaryMediator::callback_Read(DssThreadId* thr, DssOperationId* op,
+void
+DictionaryMediator::callback_Read(DssThreadId* thr,
 				  PstInContainerInterface* pstin,
 				  PstOutContainerInterface*& pstout) {
-  return callback(thr, op, pstin, pstout);
+  callback(thr, pstin, pstout);
 }
 
 PstOutContainerInterface*
@@ -772,8 +766,8 @@
   }
 }
 
-AOcallback
-ObjectMediator::callback_Read(DssThreadId*, DssOperationId*,
+void
+ObjectMediator::callback_Read(DssThreadId*,
 			      PstInContainerInterface* operation,
 			      PstOutContainerInterface*& answer) {
   TaggedRef msg = static_cast<PstInContainer*>(operation)->a_term;
@@ -806,7 +800,6 @@
       answer = new PstOutContainer(glue_raise(am.getExceptionValue()));
     }
   }
-  return AOCB_FINISH;
 }
 
 PstOutContainerInterface*
@@ -835,8 +828,8 @@
   setEntity(e);
 }
 
-AOcallback 
-ObjectStateMediator::callback(DssThreadId*, DssOperationId*,
+void
+ObjectStateMediator::callback(DssThreadId*,
 			     PstInContainerInterface* pstin,
 			     PstOutContainerInterface*& answer)
 {
@@ -852,21 +845,20 @@
     Assert(ret == RAISE);
     answer = new PstOutContainer(glue_raise(am.getExceptionValue()));
   }
-  return AOCB_FINISH;
 }
 
-AOcallback
-ObjectStateMediator::callback_Write(DssThreadId* thr, DssOperationId* op,
+void
+ObjectStateMediator::callback_Write(DssThreadId* thr,
 				    PstInContainerInterface* pstin,
 				    PstOutContainerInterface*& pstout) {
-  return callback(thr, op, pstin, pstout);
+  callback(thr, pstin, pstout);
 }
 
-AOcallback
-ObjectStateMediator::callback_Read(DssThreadId* thr, DssOperationId* op,
+void
+ObjectStateMediator::callback_Read(DssThreadId* thr,
 				   PstInContainerInterface* pstin,
 				   PstOutContainerInterface*& pstout) {
-  return callback(thr, op, pstin, pstout);
+  callback(thr, pstin, pstout);
 }
 
 PstOutContainerInterface*
@@ -900,21 +892,17 @@
   setEntity(e);
 }
 
-AOcallback
-OzThreadMediator::callback_Write(DssThreadId*, DssOperationId*,
+void
+OzThreadMediator::callback_Write(DssThreadId*,
 				 PstInContainerInterface*,
 				 PstOutContainerInterface*&)
-{
-  return AOCB_FINISH;
-}
+{ }
 
-AOcallback
-OzThreadMediator::callback_Read(DssThreadId*, DssOperationId*,
+void
+OzThreadMediator::callback_Read(DssThreadId*,
 				PstInContainerInterface*,
 				PstOutContainerInterface*&)
-{
-  return AOCB_FINISH;
-}
+{ }
 
 PstOutContainerInterface*
 OzThreadMediator::retrieveEntityRepresentation(){
@@ -1038,19 +1026,16 @@
   }
 }
 
-AOcallback
-OzVariableMediator::callback_Bind(DssOperationId*,
-				  PstInContainerInterface* pstin) {
+void
+OzVariableMediator::callback_Bind(PstInContainerInterface* pstin) {
   Assert(active);
   // the variable must be bound on the coordinator's site, even if the
   // site has made it localFail.
   bind(static_cast<PstInContainer*>(pstin)->a_term);
-  return AOCB_FINISH;
 }
 
-AOcallback
-OzVariableMediator::callback_Append(DssOperationId*,
-				    PstInContainerInterface* pstin) {
+void
+OzVariableMediator::callback_Append(PstInContainerInterface* pstin) {
   // raph: The variable may have been bound at this point.  This can
   // happen when two operations Bind and Append are done concurrently
   // (a "feature" of the dss).  Therefore we check the type first.
@@ -1061,16 +1046,13 @@
     TaggedRef* ref = tagged2Ref(getEntity()); // points to the tagged ref
     oz_var_makeNeededLocal(ref);
   }
-  return AOCB_FINISH; 
 }
 
-AOcallback
-OzVariableMediator::callback_Changes(DssOperationId*,
-				     PstOutContainerInterface*& answer) {
+void
+OzVariableMediator::callback_Changes(PstOutContainerInterface*& answer) {
   // simply check whether the variable is needed
   answer = (active && oz_isNeeded(oz_deref(entity)) ?
 	    new PstOutContainer(oz_atom("needed")) : NULL);
-  return AOCB_FINISH; 
 }
 
 
@@ -1085,13 +1067,11 @@
   setAnnotation(Annotation(PN_SITED, AA_NO_ARCHITECTURE, RC_ALG_NONE));
 }
 
-AOcallback
-UnusableMediator::callback_Read(DssThreadId*, DssOperationId*,
+void
+UnusableMediator::callback_Read(DssThreadId*,
 				PstInContainerInterface*,
 				PstOutContainerInterface*&)
-{
-  return AOCB_FINISH;
-}
+{ }
 
 
 
@@ -1122,8 +1102,8 @@
   setEntity(e);
 }
 
-AOcallback
-ChunkMediator::callback_Read(DssThreadId*, DssOperationId*,
+void
+ChunkMediator::callback_Read(DssThreadId*,
 			     PstInContainerInterface* pstin,
 			     PstOutContainerInterface*& answer) {
   SChunk* chunk = static_cast<SChunk*>(getConst());
@@ -1138,7 +1118,6 @@
     Assert(ret == RAISE);
     answer = new PstOutContainer(glue_raise(am.getExceptionValue()));
   }
-  return AOCB_FINISH;
 }
 
 
@@ -1154,13 +1133,12 @@
     setAnnotation(Annotation(PN_SITED, AA_NO_ARCHITECTURE, RC_ALG_NONE));
 }
 
-AOcallback
-ClassMediator::callback_Read(DssThreadId*, DssOperationId*,
+void
+ClassMediator::callback_Read(DssThreadId*,
 			     PstInContainerInterface* pstin,
 			     PstOutContainerInterface*& answer) {
   // no distributed operation on stationary classes!
   Assert(0);
-  return AOCB_FINISH;
 }
 
 
@@ -1177,8 +1155,8 @@
     setAnnotation(Annotation(PN_SITED, AA_NO_ARCHITECTURE, RC_ALG_NONE));
 }
 
-AOcallback
-ProcedureMediator::callback_Read(DssThreadId*, DssOperationId*,
+void
+ProcedureMediator::callback_Read(DssThreadId*,
 				 PstInContainerInterface* operation,
 				 PstOutContainerInterface*& answer) {
   // the only read operation is: call
@@ -1198,5 +1176,4 @@
   if (thread->isSuspended()) oz_wakeupThread(thread);
   //
   answer = new PstOutContainer(glue_return(ret));
-  return AOCB_FINISH;
 }