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

Method Inst_Copy

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

Source from the content-addressed store, hash-verified

3119
3120
3121bool cHardwareCPU::Inst_Copy(cAvidaContext& ctx)
3122{
3123 const int op1 = REG_BX;
3124 const int op2 = REG_AX;
3125
3126 const cHeadCPU from(this, GetRegister(op1));
3127 cHeadCPU to(this, GetRegister(op2) + GetRegister(op1));
3128
3129 //checkNoMutList is for head to head kaboom experiments
3130 if (m_organism->TestCopyMut(ctx) && !(checkNoMutList(from))) {
3131 to.SetInst(m_inst_set->GetRandomInst(ctx));
3132 to.SetFlagMutated(); // Mark this instruction as mutated...
3133 to.SetFlagCopyMut(); // Mark this instruction as copy mut...
3134 } else {
3135 to.SetInst(from.GetInst());
3136 to.ClearFlagMutated(); // UnMark
3137 to.ClearFlagCopyMut(); // UnMark
3138 }
3139
3140 to.SetFlagCopied(); // Set the copied flag.
3141 // cpu_stats.mut_stats.copies_exec++;
3142 return true;
3143}
3144
3145bool cHardwareCPU::Inst_ReadInst(cAvidaContext&)
3146{

Callers

nothing calls this directly

Calls 9

GetRandomInstMethod · 0.80
TestCopyMutMethod · 0.45
SetInstMethod · 0.45
SetFlagMutatedMethod · 0.45
SetFlagCopyMutMethod · 0.45
GetInstMethod · 0.45
ClearFlagMutatedMethod · 0.45
ClearFlagCopyMutMethod · 0.45
SetFlagCopiedMethod · 0.45

Tested by

no test coverage detected