[Avida-SVN] r1548 - in development: source/cpu support/config

barrick at myxo.css.msu.edu barrick at myxo.css.msu.edu
Sun May 13 18:28:07 PDT 2007


Author: barrick
Date: 2007-05-13 21:28:06 -0400 (Sun, 13 May 2007)
New Revision: 1548

Modified:
   development/source/cpu/cHardwareGX.cc
   development/support/config/default-gx.org
   development/support/config/instset-gx.cfg
Log:
bind2 could cause write and read head to be on same programid, causing p-divide to choke. Now p-divide just fails if that is the case. Minor tweaks to inst-set and default org. 8000+ updates running and evolving tasks, looks like we finally have a stable version!



Modified: development/source/cpu/cHardwareGX.cc
===================================================================
--- development/source/cpu/cHardwareGX.cc	2007-05-13 01:25:09 UTC (rev 1547)
+++ development/source/cpu/cHardwareGX.cc	2007-05-14 01:28:06 UTC (rev 1548)
@@ -3078,13 +3078,12 @@
 (1) It does nothing if the read and write head are not on OTHER programids
 (2) It dissociates the read head if it encounters the complement of the label that was used in the
     match instruction that put the read head on its current target
-    
-    \todo Implement indel mutations.
 */
 bool cHardwareGX::Inst_ProgramidCopy(cAvidaContext& ctx)
 {
   cHeadProgramid& write = GetHead(nHardware::HEAD_WRITE);
   cHeadProgramid& read = GetHead(nHardware::HEAD_READ);
+  read.Adjust(); // Strange things can happen (like we're reading from a programid that was being written).
   
   // Don't copy if this programid's write or read head is on itself
   if(read.GetMemSpace() == m_current->GetID()) return false;
@@ -3152,7 +3151,7 @@
       // Divide_DoMutations(ctx, mut_multiplier);
       // But that operates on m_child_genome, currently
       
-      return false;
+      return true;
     }
   }
    
@@ -3178,9 +3177,14 @@
   // If either of these heads are on m_current, this instruction fails.
   if(read.GetMemSpace() == m_current->GetID()) return false;
   if(write.GetMemSpace() == m_current->GetID()) return false;
+
   // It should never be the case that the read and write heads are on the same programid.
-  assert(read.GetMemSpace() != write.GetMemSpace());
+  //assert(read.GetMemSpace() != write.GetMemSpace());
+  // Actually, it can happen with bind2 @JEB
   
+  // If the read and write heads are on the same programid, then fail
+  if (read.GetMemSpace() == write.GetMemSpace()) return false;
+  
   // If we're not bound to two bindable programids, this instruction fails.
   if(!m_programids[read.GetMemSpace()]->GetBindable()) return false;
   if(!m_programids[write.GetMemSpace()]->GetBindable()) return false;
@@ -3227,7 +3231,7 @@
       }
     }
   }
-  
+    
   ///// Failure conditions (custom divide_check_viable)
   // It is possible that the divide kills the child and the parent
   // Each must have genomic programids of some minimum length
@@ -3265,20 +3269,20 @@
   // offspring's programids from m_programids.
   cCPUMemory& child_genome = organism->ChildGenome();
   child_genome.Resize(1);
-  std::cout << "-=OFFSPRING=-" << endl;
+  if (m_world->GetVerbosity() >= VERBOSE_DETAILS) std::cout << "-=OFFSPRING=-" << endl;
   for(programid_list::iterator i=offspring.begin(); i!=offspring.end(); ++i) {
     (*i)->AppendLinearGenome(child_genome);
-    (*i)->PrintGenome(std::cout);
+    if (m_world->GetVerbosity() >= VERBOSE_DETAILS) (*i)->PrintGenome(std::cout);
     delete *i;
     *i = 0;
   }
   
   // Now clean up the parent.
   m_programids.clear();
-  std::cout << "-=PARENT=-" << endl;
+  if (m_world->GetVerbosity() >= VERBOSE_DETAILS) std::cout << "-=PARENT=-" << endl;
   for(programid_list::iterator i=parent.begin(); i!=parent.end(); ++i) {
     AddProgramid(*i);
-    (*i)->PrintGenome(std::cout);
+    if (m_world->GetVerbosity() >= VERBOSE_DETAILS) (*i)->PrintGenome(std::cout);
   }  
   
   // And delete the fragments.

Modified: development/support/config/default-gx.org
===================================================================
--- development/support/config/default-gx.org	2007-05-13 01:25:09 UTC (rev 1547)
+++ development/support/config/default-gx.org	2007-05-14 01:28:06 UTC (rev 1548)
@@ -59,7 +59,7 @@
 bind2	# and then triggering the divide process.
 nop-B
 nop-C
-if-not-0
+if-n-equ
   p-divide
 site
 nop-C	# End of P2.

Modified: development/support/config/instset-gx.cfg
===================================================================
--- development/support/config/instset-gx.cfg	2007-05-13 01:25:09 UTC (rev 1547)
+++ development/support/config/instset-gx.cfg	2007-05-14 01:28:06 UTC (rev 1548)
@@ -3,7 +3,6 @@
 nop-C      1   # c
 if-n-equ   1   # d
 if-less    1   # e
-if-not-0   1
 pop        1   # f
 push       1   # g
 swap-stk   1   # h
@@ -15,20 +14,21 @@
 add        1   # n
 sub        1   # o
 nand       1   # p
-IO         1   # q   Puts current contents of register and gets new.
+IO         1   # q 
 
 site       1   # r
 bind       1   # s
-if-bind    1   # t
-num-sites   1  # u
+bind2      1   # t
+if-bind    1   # u
 g-alloc    1   # v
 p-alloc    1   # w
 p-copy     1   # x
 p-divide   1   # y
 goto       1   # z
 label      1   # A
+      
 
-PROGRAMID 0    # B
+PROGRAMID  0   # B
 EXECUTABLE 0   # C
 BINDABLE   0   # D
 READABLE   0   # E




More information about the Avida-cvs mailing list