Thanks, Andreas. By your hint, I find what I want. Also, I draw the call route as following:
ArmISA::decode(pcState) calls ArmISA::decodeInst(machInst) (its definition is in build/ARM/arch/arm/generated/decoder.cc) ArmISA::decodeInst(machInst) new a class xx_xxx_xxx_xxx (it stands for the class declared in build/ARM/arch/arm/generated/decoder.hh) and return its pointer (which is StaticInstPtr type) class xx_xxx_xxx_xxx derived from StaticInst class, so its pointer is StaticInstPtr type, and it includes the method execute(AtomicSimpleCPU*, ArmISA::InstRecords) (which is defined in build/ARM/arch/arm/generated/atomic_simple_cpu_exec.cc) So, "curStaticInst->execute(this, traceData);" can refer to correct method The above description is not used strict variable name and exact route, just provides a general explanation. Meng On Fri, Apr 12, 2013 at 3:53 AM, Andreas Hansson <[email protected]>wrote: > Hi Meng, > > Have a look in e.g. build/ARM/arch/arm/generated/decoder.hh and > atomic_simple_cpu_exec.cc > > Andreas > > On 12/04/2013 03:17, "Meng Wang" <[email protected]> wrote: > > >Hi, all > >I am reading atomic cpu's code and find a piece of code hard to > >understand. It's in src/cpu/simple/atomic.cc file: > >void > >AtomicSimpleCPU::tick() > >{ > > Š... > > preExecute(); > > > > if (curStaticInst) { > > fault = curStaticInst->execute(this, traceData); > > > > // keep an instruction count > > if (fault == NoFault) > > countInst(); > > else if (traceData && !DTRACE(ExecFaulting)) { > > delete traceData; > > traceData = NULL; > > } > > > > postExecute(); > > } > > ŠŠ > >} > > > >I can't understand this code: " fault = curStaticInst->execute(this, > >traceData);". According the context, I know curStaticInst belongs to > >StaticInstPtr class whose behaviors are similar to a pointer. It > >overloads operator "->" and makes it dereference to a method of another > >class: StaticInst. However, I cannot find the execute(AtomicSimpleCPU*, > >Trace::InstRecord*) definition or declaration in it and all classes > >inherited by it, except that I found a comment in src/cpu/static_inst.hh > >said "The execute() signatures are auto-generated by scons based on the > >set of CPU models we are compiling in today." My question is how the > >execute method is found without declaration of this method. > > > >Thank you very much. > > > >Meng > > > >_______________________________________________ > >gem5-dev mailing list > >[email protected] > >http://m5sim.org/mailman/listinfo/gem5-dev > > > > > -- IMPORTANT NOTICE: The contents of this email and any attachments are > confidential and may also be privileged. If you are not the intended > recipient, please notify the sender immediately and do not disclose the > contents to any other person, use it for any purpose, or store or copy the > information in any medium. Thank you. > > _______________________________________________ > gem5-dev mailing list > [email protected] > http://m5sim.org/mailman/listinfo/gem5-dev > _______________________________________________ gem5-dev mailing list [email protected] http://m5sim.org/mailman/listinfo/gem5-dev
