MCPcopy Create free account
hub / github.com/devosoft/avida / InheritState

Method InheritState

avida-core/source/cpu/cHardwareCPU.cc:2135–2146  ·  view source on GitHub ↗

Sets the current state of the hardware and also saves this state so that future Reset() calls will reset to that epigenetic state

Source from the content-addressed store, hash-verified

2133// Sets the current state of the hardware and also saves this state so
2134// that future Reset() calls will reset to that epigenetic state
2135void cHardwareCPU::InheritState(cHardwareBase& in_hardware)
2136{
2137 m_epigenetic_state = true;
2138 cHardwareCPU& in_h = (cHardwareCPU&)in_hardware;
2139 const cLocalThread& thread = in_h.GetThread(in_h.GetCurThread());
2140 for (int i=0; i<NUM_REGISTERS; i++) {
2141 m_epigenetic_saved_reg[i] = thread.reg[i];
2142 m_threads[m_cur_thread].reg[i] = m_epigenetic_saved_reg[i];
2143 }
2144 m_epigenetic_saved_stack = thread.stack;
2145 m_threads[m_cur_thread].stack = m_epigenetic_saved_stack;
2146}
2147
2148//////////////////////////
2149// And the instructions...

Callers 1

ActivateOffspringMethod · 0.45

Calls 1

GetCurThreadMethod · 0.45

Tested by

no test coverage detected