mirror of
https://github.com/MariaDB/server.git
synced 2026-05-09 16:44:29 +02:00
Introduced system for automatic clearing of block global variables (VM_TRACE'd)
ndb/src/kernel/vm/SimulatedBlock.cpp: Introduced automatic clearing of block global variables ndb/src/kernel/vm/SimulatedBlock.hpp: Introduced automatic clearing of block global variables
This commit is contained in:
parent
fe61e5d2e4
commit
bf8cfd40e0
2 changed files with 41 additions and 2 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue