[Avida-cvs] [avida-svn] r619 - in development: source/cpu support/config
brysonda@myxo.css.msu.edu
brysonda at myxo.css.msu.edu
Mon Apr 17 13:06:46 PDT 2006
Author: brysonda
Date: 2006-04-17 16:06:46 -0400 (Mon, 17 Apr 2006)
New Revision: 619
Modified:
development/source/cpu/cHardwareSMT.cc
development/source/cpu/cHardwareSMT.h
development/support/config/organism.smt
Log:
Fix various SMT thread related problems. Revert organism for consistency tests.
Modified: development/source/cpu/cHardwareSMT.cc
===================================================================
--- development/source/cpu/cHardwareSMT.cc 2006-04-17 14:17:28 UTC (rev 618)
+++ development/source/cpu/cHardwareSMT.cc 2006-04-17 20:06:46 UTC (rev 619)
@@ -346,6 +346,7 @@
void cHardwareSMT::PrintStatus(ostream& fp)
{
fp << organism->GetPhenotype().GetTimeUsed() << " "
+ << "THREAD: " << m_cur_thread << ", " << m_threads.GetSize() << " "
<< "IP:(" << IP().GetMemSpace() << ", " << IP().GetPosition() << ") "
<< "AX:" << Stack(STACK_AX).Top() << " "
@@ -807,7 +808,7 @@
m_thread_lbls.Add(hash_key, thread_id);
// Setup this thread into the current selected memory space (Flow Head)
- m_threads[thread_id].Reset(this, GetHead(nHardware::HEAD_FLOW).GetMemSpace());
+ m_threads[thread_id].Reset(this, mem_space);
return thread_id;
}
@@ -1019,20 +1020,17 @@
}
-bool cHardwareSMT::Divide_Main(cAvidaContext& ctx, int mem_space_used, double mut_multiplier)
+bool cHardwareSMT::Divide_Main(cAvidaContext& ctx, double mut_multiplier)
{
- int write_head_pos = GetHead(nHardware::HEAD_WRITE).GetPosition();
+ const int mem_space_used = GetHead(nHardware::HEAD_WRITE).GetMemSpace();
+ const int write_head_pos = GetHead(nHardware::HEAD_WRITE).GetPosition();
- // We're going to disallow division calls from memory spaces other than zero for right now @law
- // @DMB - change to allow ???
- if(IP().GetMemSpace() != 0) return false;
-
// Make sure the memory space we're using exists
if (m_mem_array.GetSize() <= mem_space_used) return false;
// Make sure this divide will produce a viable offspring.
m_cur_child = mem_space_used; // save current child memory space for use by dependent functions (e.g. GetCopiedSize())
- if (!Divide_CheckViable(ctx, m_mem_array[IP().GetMemSpace()].GetSize(), write_head_pos)) return false;
+ if (!Divide_CheckViable(ctx, m_mem_array[0].GetSize(), write_head_pos)) return false;
// Since the divide will now succeed, set up the information to be sent to the new organism
m_mem_array[mem_space_used].Resize(write_head_pos);
@@ -1280,10 +1278,7 @@
//17
bool cHardwareSMT::Inst_Divide(cAvidaContext& ctx)
{
- int mem_space_used = GetHead(nHardware::HEAD_WRITE).GetMemSpace();
- int mut_multiplier = 1;
-
- return Divide_Main(ctx, mem_space_used, mut_multiplier);
+ return Divide_Main(ctx);
}
//18
@@ -1556,7 +1551,7 @@
//34
bool cHardwareSMT::Inst_ThreadCreate(cAvidaContext& ctx)
{
- ReadLabel();
+ ReadLabel(MAX_THREAD_LABEL);
bool success = ThreadCreate(GetLabel(), GetHead(nHardware::HEAD_FLOW).GetMemSpace());
if (!success) organism->Fault(FAULT_LOC_THREAD_FORK, FAULT_TYPE_FORK_TH);
return success;
@@ -1573,7 +1568,7 @@
//36
bool cHardwareSMT::Inst_ThreadKill(cAvidaContext& ctx)
{
- ReadLabel();
+ ReadLabel(MAX_THREAD_LABEL);
bool success = ThreadKill(GetLabel());
if (!success) organism->Fault(FAULT_LOC_THREAD_KILL, FAULT_TYPE_KILL_TH);
return success;
Modified: development/source/cpu/cHardwareSMT.h
===================================================================
--- development/source/cpu/cHardwareSMT.h 2006-04-17 14:17:28 UTC (rev 618)
+++ development/source/cpu/cHardwareSMT.h 2006-04-17 20:06:46 UTC (rev 619)
@@ -173,7 +173,7 @@
int GetCopiedSize(const int parent_size, const int child_size);
- bool Divide_Main(cAvidaContext& ctx, const int mem_space_used, double mut_multiplier = 1.0);
+ bool Divide_Main(cAvidaContext& ctx, double mut_multiplier = 1.0);
void Inject_DoMutations(cAvidaContext& ctx, double mut_multiplier, cCPUMemory& injected_code);
bool InjectParasite(cAvidaContext& ctx, double mut_multiplier);
Modified: development/support/config/organism.smt
===================================================================
--- development/support/config/organism.smt 2006-04-17 14:17:28 UTC (rev 618)
+++ development/support/config/organism.smt 2006-04-17 20:06:46 UTC (rev 619)
@@ -88,6 +88,9 @@
Nop-C # 8:
Nop-C # 8:
Nop-C # 8:
+Nop-C # 8:
+Nop-C # 8:
+Nop-C # 8:
Search # 9: Drop flow head at start of copy loop
Inst-Read # 10:
Inst-Write # 11:
More information about the Avida-cvs
mailing list