Commit 73e15672 authored by joreland@mysql.com's avatar joreland@mysql.com

Introduced system for automatic clearing of block global variables (VM_TRACE'd)

parent 3fdc2999
...@@ -104,6 +104,11 @@ SimulatedBlock::SimulatedBlock(BlockNumber blockNumber, ...@@ -104,6 +104,11 @@ SimulatedBlock::SimulatedBlock(BlockNumber blockNumber,
UpgradeStartup::installEXEC(this); UpgradeStartup::installEXEC(this);
CLEAR_ERROR_INSERT_VALUE; CLEAR_ERROR_INSERT_VALUE;
#ifdef VM_TRACE
m_global_variables = new Ptr<void> * [1];
m_global_variables[0] = 0;
#endif
} }
SimulatedBlock::~SimulatedBlock() SimulatedBlock::~SimulatedBlock()
...@@ -112,6 +117,10 @@ SimulatedBlock::~SimulatedBlock() ...@@ -112,6 +117,10 @@ SimulatedBlock::~SimulatedBlock()
#ifdef VM_TRACE_TIME #ifdef VM_TRACE_TIME
printTimes(stdout); printTimes(stdout);
#endif #endif
#ifdef VM_TRACE
delete [] m_global_variables;
#endif
} }
void void
...@@ -1771,3 +1780,25 @@ SimulatedBlock::execUPGRADE(Signal* signal){ ...@@ -1771,3 +1780,25 @@ SimulatedBlock::execUPGRADE(Signal* signal){
break; break;
} }
} }
#ifdef VM_TRACE
void
SimulatedBlock::clear_global_variables(){
Ptr<void> ** tmp = m_global_variables;
while(* tmp != 0){
(* tmp)->i = RNIL;
(* tmp)->p = 0;
tmp++;
}
}
void
SimulatedBlock::init_globals_list(void ** tmp, size_t cnt){
m_global_variables = new Ptr<void> * [cnt+1];
for(size_t i = 0; i<cnt; i++){
m_global_variables[i] = (Ptr<void>*)tmp[i];
}
m_global_variables[cnt] = 0;
}
#endif
...@@ -96,7 +96,7 @@ protected: ...@@ -96,7 +96,7 @@ protected:
* Handling of execFunctions * Handling of execFunctions
*/ */
typedef void (SimulatedBlock::* ExecFunction)(Signal* signal); typedef void (SimulatedBlock::* ExecFunction)(Signal* signal);
void addRecSignalImpl(GlobalSignalNumber g, ExecFunction fun, bool f = false); void addRecSignalImpl(GlobalSignalNumber g, ExecFunction fun, bool f =false);
void installSimulatedBlockFunctions(); void installSimulatedBlockFunctions();
ExecFunction theExecArray[MAX_GSN+1]; ExecFunction theExecArray[MAX_GSN+1];
public: public:
...@@ -447,6 +447,12 @@ public: ...@@ -447,6 +447,12 @@ public:
} m_timeTrace[MAX_GSN+1]; } m_timeTrace[MAX_GSN+1];
Uint32 m_currentGsn; Uint32 m_currentGsn;
#endif #endif
#ifdef VM_TRACE
Ptr<void> **m_global_variables;
void clear_global_variables();
void init_globals_list(void ** tmp, size_t cnt);
#endif
}; };
inline inline
...@@ -454,6 +460,9 @@ void ...@@ -454,6 +460,9 @@ void
SimulatedBlock::executeFunction(GlobalSignalNumber gsn, Signal* signal){ SimulatedBlock::executeFunction(GlobalSignalNumber gsn, Signal* signal){
ExecFunction f = theExecArray[gsn]; ExecFunction f = theExecArray[gsn];
if(gsn <= MAX_GSN && f != 0){ if(gsn <= MAX_GSN && f != 0){
#ifdef VM_TRACE
clear_global_variables();
#endif
(this->*f)(signal); (this->*f)(signal);
return; return;
} }
...@@ -679,6 +688,5 @@ BLOCK::addRecSignal(GlobalSignalNumber gsn, ExecSignalLocal f, bool force){ \ ...@@ -679,6 +688,5 @@ BLOCK::addRecSignal(GlobalSignalNumber gsn, ExecSignalLocal f, bool force){ \
addRecSignalImpl(gsn, (ExecFunction)f, force);\ addRecSignalImpl(gsn, (ExecFunction)f, force);\
} }
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment