[vmkit-commits] [vmkit] r120963 - in /vmkit/branches/multi-vm: include/mvm/Threads/Thread.h lib/Mvm/CommonThread/ctthread.cpp lib/Mvm/Runtime/VMKit.cpp
Gael Thomas
gael.thomas at lip6.fr
Sun Dec 5 14:49:01 PST 2010
Author: gthomas
Date: Sun Dec 5 16:49:01 2010
New Revision: 120963
URL: http://llvm.org/viewvc/llvm-project?rev=120963&view=rev
Log:
delete all the vm thread data when the underlying mutator is released
Modified:
vmkit/branches/multi-vm/include/mvm/Threads/Thread.h
vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp
vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp
Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=120963&r1=120962&r2=120963&view=diff
==============================================================================
--- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original)
+++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Sun Dec 5 16:49:01 2010
@@ -133,6 +133,7 @@
class VMKit;
// WARNING: if you modify this class, you must also change mvm-runtime.ll
+// WARNING: when a VMThreadData is store in a thread (in allVmsData), you must never delete it yourself.
class VMThreadData {
public:
/// mut - The associated thread mutator
Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp?rev=120963&r1=120962&r2=120963&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp (original)
+++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp Sun Dec 5 16:49:01 2010
@@ -528,7 +528,7 @@
// Wait for the thread to die.
pthread_join((pthread_t)thread_id, NULL);
}
- // th->vmkit->unregisterPreparedThread(th);
+ th->vmkit->unregisterPreparedThread(th);
uintptr_t index = ((uintptr_t)th & Thread::IDMask);
index = (index & ~TheStackManager.baseAddr) >> 20;
TheStackManager.used[index] = 0;
Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp?rev=120963&r1=120962&r2=120963&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp (original)
+++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Sun Dec 5 16:49:01 2010
@@ -55,11 +55,10 @@
void VMKit::unregisterPreparedThread(mvm::Thread* th) {
vmkitLock();
- numberOfRunningThreads--;
th->remove();
- //for(int i=0; i<numberOfVms; i++)
- //if(th->allVmsData[i])
- // delete th->allVmsData[i]; -> Must make a choice for the destruction of threads...
+ for(size_t i=0; i<numberOfVms; i++)
+ if(th->allVmsData[i])
+ delete th->allVmsData[i];
delete th->allVmsData;
vmkitUnlock();
}
More information about the vmkit-commits
mailing list