[Avida-SVN] r2081 - in stable: source source/cpu support/config

brysonda at myxo.css.msu.edu brysonda at myxo.css.msu.edu
Sun Sep 9 08:49:43 PDT 2007


Author: brysonda
Date: 2007-09-09 11:49:43 -0400 (Sun, 09 Sep 2007)
New Revision: 2081

Modified:
   stable/source/cpu/cHardwareSMT.h
   stable/source/cpu/cHardwareTransSMT.h
   stable/source/cpu/cHeadCPU.cc
   stable/source/defs.h
   stable/support/config/avida.cfg
Log:
Backport cHeadCPU::Adjust performance enhancement into stable.

Modified: stable/source/cpu/cHardwareSMT.h
===================================================================
--- stable/source/cpu/cHardwareSMT.h	2007-09-09 15:40:20 UTC (rev 2080)
+++ stable/source/cpu/cHardwareSMT.h	2007-09-09 15:49:43 UTC (rev 2081)
@@ -358,9 +358,9 @@
 
 inline int cHardwareSMT::GetStack(int depth, int stack_id, int in_thread) const
 {
-  if(stack_id<0 || stack_id > NUM_STACKS) stack_id=0;
+  if (stack_id<0 || stack_id > NUM_STACKS) stack_id=0;
   
-  if(in_thread==-1)
+  if (in_thread==-1)
     in_thread=m_cur_thread;
   
   return Stack(stack_id, in_thread).Get(depth);
@@ -368,8 +368,8 @@
 
 inline cCPUStack& cHardwareSMT::Stack(int stack_id)
 {
-  if(stack_id >= NUM_STACKS) stack_id = 0;
-  if(stack_id < NUM_LOCAL_STACKS)
+  if (stack_id >= NUM_STACKS) stack_id = 0;
+  if (stack_id < NUM_LOCAL_STACKS)
     return m_threads[m_cur_thread].local_stacks[stack_id];
   else
     return m_global_stacks[stack_id % NUM_LOCAL_STACKS];
@@ -377,8 +377,8 @@
 
 inline const cCPUStack& cHardwareSMT::Stack(int stack_id) const 
 {
-  if(stack_id >= NUM_STACKS) stack_id = 0;
-  if(stack_id < NUM_LOCAL_STACKS)
+  if (stack_id >= NUM_STACKS) stack_id = 0;
+  if (stack_id < NUM_LOCAL_STACKS)
     return m_threads[m_cur_thread].local_stacks[stack_id];
   else
     return m_global_stacks[stack_id % NUM_LOCAL_STACKS];
@@ -386,10 +386,10 @@
 
 inline cCPUStack& cHardwareSMT::Stack(int stack_id, int in_thread) 
 {
-  if(stack_id >= NUM_STACKS || stack_id < 0) stack_id = 0;
-  if(in_thread >= m_threads.GetSize() || in_thread < 0) in_thread = m_cur_thread;
+  if (stack_id >= NUM_STACKS || stack_id < 0) stack_id = 0;
+  if (in_thread >= m_threads.GetSize() || in_thread < 0) in_thread = m_cur_thread;
 	
-  if(stack_id < NUM_LOCAL_STACKS)
+  if (stack_id < NUM_LOCAL_STACKS)
     return m_threads[in_thread].local_stacks[stack_id];
   else
     return m_global_stacks[stack_id % NUM_LOCAL_STACKS];
@@ -397,10 +397,10 @@
 
 inline const cCPUStack& cHardwareSMT::Stack(int stack_id, int in_thread) const 
 {
-  if(stack_id >= NUM_STACKS || stack_id < 0) stack_id = 0;
-  if(in_thread >= m_threads.GetSize() || in_thread < 0) in_thread = m_cur_thread;
+  if (stack_id >= NUM_STACKS || stack_id < 0) stack_id = 0;
+  if (in_thread >= m_threads.GetSize() || in_thread < 0) in_thread = m_cur_thread;
 	
-  if(stack_id < NUM_LOCAL_STACKS)
+  if (stack_id < NUM_LOCAL_STACKS)
     return m_threads[in_thread].local_stacks[stack_id];
   else
     return m_global_stacks[stack_id % NUM_LOCAL_STACKS];
@@ -408,8 +408,8 @@
 
 inline int cHardwareSMT::NormalizeMemSpace(int mem_space) const
 {
-  if(mem_space >= m_mem_array.GetSize())
-    mem_space %= m_mem_array.GetSize();
+  assert(mem_space >= 0);
+  if (mem_space >= m_mem_array.GetSize()) mem_space %= m_mem_array.GetSize();
   return mem_space;
 }
 

Modified: stable/source/cpu/cHardwareTransSMT.h
===================================================================
--- stable/source/cpu/cHardwareTransSMT.h	2007-09-09 15:40:20 UTC (rev 2080)
+++ stable/source/cpu/cHardwareTransSMT.h	2007-09-09 15:49:43 UTC (rev 2081)
@@ -358,9 +358,9 @@
 
 inline int cHardwareTransSMT::GetStack(int depth, int stack_id, int in_thread) const
 {
-  if(stack_id<0 || stack_id > NUM_STACKS) stack_id=0;
+  if (stack_id<0 || stack_id > NUM_STACKS) stack_id=0;
   
-  if(in_thread==-1)
+  if (in_thread==-1)
     in_thread=m_cur_thread;
   
   return Stack(stack_id, in_thread).Get(depth);
@@ -368,8 +368,8 @@
 
 inline cCPUStack& cHardwareTransSMT::Stack(int stack_id)
 {
-  if(stack_id >= NUM_STACKS) stack_id = 0;
-  if(stack_id < NUM_LOCAL_STACKS)
+  if (stack_id >= NUM_STACKS) stack_id = 0;
+  if (stack_id < NUM_LOCAL_STACKS)
     return m_threads[m_cur_thread].local_stacks[stack_id];
   else
     return m_global_stacks[stack_id % NUM_LOCAL_STACKS];
@@ -377,8 +377,8 @@
 
 inline const cCPUStack& cHardwareTransSMT::Stack(int stack_id) const 
 {
-  if(stack_id >= NUM_STACKS) stack_id = 0;
-  if(stack_id < NUM_LOCAL_STACKS)
+  if (stack_id >= NUM_STACKS) stack_id = 0;
+  if (stack_id < NUM_LOCAL_STACKS)
     return m_threads[m_cur_thread].local_stacks[stack_id];
   else
     return m_global_stacks[stack_id % NUM_LOCAL_STACKS];
@@ -386,10 +386,10 @@
 
 inline cCPUStack& cHardwareTransSMT::Stack(int stack_id, int in_thread) 
 {
-  if(stack_id >= NUM_STACKS || stack_id < 0) stack_id = 0;
-  if(in_thread >= m_threads.GetSize() || in_thread < 0) in_thread = m_cur_thread;
+  if (stack_id >= NUM_STACKS || stack_id < 0) stack_id = 0;
+  if (in_thread >= m_threads.GetSize() || in_thread < 0) in_thread = m_cur_thread;
 	
-  if(stack_id < NUM_LOCAL_STACKS)
+  if (stack_id < NUM_LOCAL_STACKS)
     return m_threads[in_thread].local_stacks[stack_id];
   else
     return m_global_stacks[stack_id % NUM_LOCAL_STACKS];
@@ -397,10 +397,10 @@
 
 inline const cCPUStack& cHardwareTransSMT::Stack(int stack_id, int in_thread) const 
 {
-  if(stack_id >= NUM_STACKS || stack_id < 0) stack_id = 0;
-  if(in_thread >= m_threads.GetSize() || in_thread < 0) in_thread = m_cur_thread;
+  if (stack_id >= NUM_STACKS || stack_id < 0) stack_id = 0;
+  if (in_thread >= m_threads.GetSize() || in_thread < 0) in_thread = m_cur_thread;
 	
-  if(stack_id < NUM_LOCAL_STACKS)
+  if (stack_id < NUM_LOCAL_STACKS)
     return m_threads[in_thread].local_stacks[stack_id];
   else
     return m_global_stacks[stack_id % NUM_LOCAL_STACKS];
@@ -408,8 +408,8 @@
 
 inline int cHardwareTransSMT::NormalizeMemSpace(int mem_space) const
 {
-  if(mem_space >= m_mem_array.GetSize())
-    mem_space %= m_mem_array.GetSize();
+  assert(mem_space >= 0);
+  if (mem_space >= m_mem_array.GetSize()) mem_space %= m_mem_array.GetSize();
   return mem_space;
 }
 

Modified: stable/source/cpu/cHeadCPU.cc
===================================================================
--- stable/source/cpu/cHeadCPU.cc	2007-09-09 15:40:20 UTC (rev 2080)
+++ stable/source/cpu/cHeadCPU.cc	2007-09-09 15:49:43 UTC (rev 2081)
@@ -35,8 +35,9 @@
 
 void cHeadCPU::Adjust()
 {
+  assert(m_mem_space >= 0);
   // Ensure that m_mem_space is valid
-  m_mem_space %= m_hardware->GetNumMemSpaces();
+  if (m_mem_space >= m_hardware->GetNumMemSpaces()) m_mem_space %= m_hardware->GetNumMemSpaces();
   
   const int mem_size = GetMemory().GetSize();
   

Modified: stable/source/defs.h
===================================================================
--- stable/source/defs.h	2007-09-09 15:40:20 UTC (rev 2080)
+++ stable/source/defs.h	2007-09-09 15:49:43 UTC (rev 2081)
@@ -26,7 +26,7 @@
 #ifndef defs_h
 #define defs_h
 
-#define VERSION "2.8.0"
+#define VERSION "2.8.1"
 #define VERSION_TAG "Jedi Knight"
 
 

Modified: stable/support/config/avida.cfg
===================================================================
--- stable/support/config/avida.cfg	2007-09-09 15:40:20 UTC (rev 2080)
+++ stable/support/config/avida.cfg	2007-09-09 15:49:43 UTC (rev 2081)
@@ -3,7 +3,7 @@
 # For more information, see doc/config.html
 #############################################################################
 
-VERSION_ID 2.8.0   # Do not change this value.
+VERSION_ID 2.8.1   # Do not change this value.
 
 ### GENERAL_GROUP ###
 # General Settings




More information about the Avida-cvs mailing list