00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef SIM_RECOVERER_RECOVERER_H
00033 #define SIM_RECOVERER_RECOVERER_H
00034
00035 #include "Sim/Foundation/Hook/HookDecl.h"
00036 #include "Sim/Foundation/Resource/ResourceNode.h"
00037 #include "Sim/Op/OpArray/OpArray.h"
00038 #include "Sim/Op/OpContainer/OpList.h"
00039 #include "Sim/ExecUnit/ExecUnitIF.h"
00040 #include "Sim/Core/DataPredTypes.h"
00041
00042 namespace Onikiri
00043 {
00044 class InorderList;
00045 class Core;
00046 class Thread;
00047 class Checkpoint;
00048 class CheckpointMaster;
00049
00050 class Recoverer : public PhysicalResourceNode
00051 {
00052 public:
00053 typedef DataPredMissRecovery Recovery;
00054
00055
00056 BEGIN_PARAM_MAP("")
00057
00058 BEGIN_PARAM_PATH( GetParamPath() )
00059 PARAM_ENTRY( "@BranchPredRecoveryLatency", m_brPredRecoveryLatency )
00060 PARAM_ENTRY( "@ExceptionRecoverylatency", m_exceptionRecoveryLatency )
00061 END_PARAM_PATH()
00062 BEGIN_PARAM_PATH( GetResultPath() )
00063 BEGIN_PARAM_PATH( "LatPredRecovery/" )
00064 PARAM_ENTRY( "@NumRecovery", m_latPredRecoveryCount )
00065 PARAM_ENTRY( "@NumOps", m_latPredRecoveryOps )
00066 END_PARAM_PATH()
00067 BEGIN_PARAM_PATH( "AddrPredRecovery/" )
00068 PARAM_ENTRY( "@NumRecovery", m_addrPredRecoveryCount )
00069 PARAM_ENTRY( "@NumOps", m_addrPredRecoveryOps )
00070 END_PARAM_PATH()
00071 BEGIN_PARAM_PATH( "ValuePredRecovery/" )
00072 PARAM_ENTRY( "@NumRecovery", m_valuePredRecoveryCount )
00073 PARAM_ENTRY( "@NumOps", m_valuePredRecoveryOps )
00074 END_PARAM_PATH()
00075 BEGIN_PARAM_PATH( "PartialLoadRecovery/" )
00076 PARAM_ENTRY( "@NumRecovery", m_partialReadRecoveryCount )
00077 PARAM_ENTRY( "@NumOps", m_partialReadRecoveryOps )
00078 END_PARAM_PATH()
00079 BEGIN_PARAM_PATH( "BracnchPredRecovery/" )
00080 PARAM_ENTRY( "@NumRecovery", m_brPredRecoveryCount )
00081 PARAM_ENTRY( "@NumOps", m_brPredRecoveryOps )
00082 END_PARAM_PATH()
00083 BEGIN_PARAM_PATH( "ExceptionRecovery/" )
00084 PARAM_ENTRY( "@NumRecovery", m_exceptionRecoveryCount )
00085 PARAM_ENTRY( "@NumOps", m_exceptionRecoveryOps )
00086 END_PARAM_PATH()
00087 END_PARAM_PATH()
00088
00089 END_PARAM_MAP()
00090
00091 BEGIN_RESOURCE_MAP()
00092 RESOURCE_ENTRY( Core, "core", m_core )
00093 RESOURCE_ENTRY( Thread, "thread", m_thread )
00094 RESOURCE_ENTRY( InorderList, "inorderList", m_inorderList )
00095 RESOURCE_ENTRY( CheckpointMaster, "checkpointMaster", m_checkpointMaster )
00096 END_RESOURCE_MAP()
00097
00098 Recoverer();
00099 virtual ~Recoverer();
00100
00101 virtual void Initialize( InitPhase phase );
00102 virtual void Finalize();
00103
00104
00105
00106
00107 void RecoverBPredMiss( OpIterator branch );
00108
00109
00110 void RecoverException( OpIterator causer );
00111
00112
00113
00114 int RecoverDataPredMiss(
00115 OpIterator producer,
00116 OpIterator consumer,
00117 DataPredMissRecovery::Type dataPredType
00118 );
00119
00120
00121
00122 int RecoverDataPredMiss(
00123 OpIterator producer,
00124 OpIterator consumer,
00125 const DataPredMissRecovery& recovery
00126 );
00127
00128
00129 int RecoverByRefetch( OpIterator missedOp, OpIterator startOp );
00130
00131
00132 int RecoverByRescheduleAll( OpIterator missedOp, OpIterator startOp );
00133
00134
00135 int RecoverByRescheduleNotFinished(OpIterator missedOp, OpIterator startOp);
00136
00137
00138 int RecoverByRescheduleSelective( OpIterator producerOp, Recovery::From from );
00139
00140
00141 protected:
00142
00143 Core* m_core;
00144 Thread* m_thread;
00145 InorderList* m_inorderList;
00146 CheckpointMaster* m_checkpointMaster;
00147
00148 s64 m_latPredRecoveryCount;
00149 s64 m_addrPredRecoveryCount;
00150 s64 m_valuePredRecoveryCount;
00151 s64 m_partialReadRecoveryCount;
00152
00153 s64 m_latPredRecoveryOps;
00154 s64 m_addrPredRecoveryOps;
00155 s64 m_valuePredRecoveryOps;
00156 s64 m_partialReadRecoveryOps;
00157
00158 s64 m_brPredRecoveryCount;
00159 s64 m_brPredRecoveryOps;
00160
00161 s64 m_exceptionRecoveryCount;
00162 s64 m_exceptionRecoveryOps;
00163
00164 int m_brPredRecoveryLatency;
00165 int m_exceptionRecoveryLatency;
00166
00167
00168 void RecoverCheckpoint( Checkpoint* checkpoint );
00169
00170
00171 void UpdateRecoveryStatistics(
00172 int recoveredInsns,
00173 Recovery::Type dataPredType
00174 );
00175
00176
00177
00178 int RescheduleConsumers( OpIterator producer );
00179
00180
00181 OpIterator GetRecoveryStartOp( OpIterator producer, OpIterator consumer, Recovery::From from );
00182 };
00183 }
00184
00185 #endif
00186