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,
UpgradeStartup::installEXEC(this);
CLEAR_ERROR_INSERT_VALUE;
#ifdef VM_TRACE
m_global_variables = new Ptr<void> * [1];
m_global_variables[0] = 0;
#endif
}
SimulatedBlock::~SimulatedBlock()
......@@ -112,6 +117,10 @@ SimulatedBlock::~SimulatedBlock()
#ifdef VM_TRACE_TIME
printTimes(stdout);
#endif
#ifdef VM_TRACE
delete [] m_global_variables;
#endif
}
void
......@@ -1771,3 +1780,25 @@ SimulatedBlock::execUPGRADE(Signal* signal){
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:
* Handling of execFunctions
*/
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();
ExecFunction theExecArray[MAX_GSN+1];
public:
......@@ -447,6 +447,12 @@ public:
} m_timeTrace[MAX_GSN+1];
Uint32 m_currentGsn;
#endif
#ifdef VM_TRACE
Ptr<void> **m_global_variables;
void clear_global_variables();
void init_globals_list(void ** tmp, size_t cnt);
#endif
};
inline
......@@ -454,6 +460,9 @@ void
SimulatedBlock::executeFunction(GlobalSignalNumber gsn, Signal* signal){
ExecFunction f = theExecArray[gsn];
if(gsn <= MAX_GSN && f != 0){
#ifdef VM_TRACE
clear_global_variables();
#endif
(this->*f)(signal);
return;
}
......@@ -679,6 +688,5 @@ BLOCK::addRecSignal(GlobalSignalNumber gsn, ExecSignalLocal f, bool force){ \
addRecSignalImpl(gsn, (ExecFunction)f, force);\
}
#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