[llvm-commits] [vmkit] r52392 - in /vmkit/trunk: include/mvm/ include/mvm/GC/ lib/JnJVM/VMCore/ lib/Mvm/ lib/Mvm/BoehmGC/ lib/Mvm/GCMmap2/ lib/N3/VMCore/
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Tue Jun 17 02:46:35 PDT 2008
Author: geoffray
Date: Tue Jun 17 04:46:35 2008
New Revision: 52392
URL: http://llvm.org/viewvc/llvm-project?rev=52392&view=rev
Log:
Use C++ destructors to finalize a GC-allocated object.
Modified:
vmkit/trunk/include/mvm/GC/GC.h
vmkit/trunk/include/mvm/Object.h
vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h
vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.h
vmkit/trunk/lib/JnJVM/VMCore/JavaObject.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaObject.h
vmkit/trunk/lib/JnJVM/VMCore/JavaThread.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaThread.h
vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp
vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.h
vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h
vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp
vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.h
vmkit/trunk/lib/Mvm/BoehmGC/MvmGC.h
vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp
vmkit/trunk/lib/Mvm/VTOffset.cpp
vmkit/trunk/lib/N3/VMCore/VMThread.cpp
vmkit/trunk/lib/N3/VMCore/VMThread.h
vmkit/trunk/lib/N3/VMCore/VirtualMachine.cpp
vmkit/trunk/lib/N3/VMCore/VirtualMachine.h
Modified: vmkit/trunk/include/mvm/GC/GC.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/GC/GC.h?rev=52392&r1=52391&r2=52392&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/GC/GC.h (original)
+++ vmkit/trunk/include/mvm/GC/GC.h Tue Jun 17 04:46:35 2008
@@ -20,7 +20,6 @@
class gcRoot {
public:
virtual ~gcRoot() {}
- virtual void destroyer(size_t) {}
#ifdef MULTIPLE_GC
virtual void tracer(void* GC) {}
#else
@@ -28,10 +27,15 @@
#endif
};
+typedef void (*destructor_t)(void*);
+
class gc_header {
public:
VirtualTable *_XXX_vt;
inline gcRoot *_2gc() { return (gcRoot *)this; }
+ destructor_t getDestructor() {
+ return ((destructor_t*)(this->_XXX_vt))[0];
+ }
};
#endif
Modified: vmkit/trunk/include/mvm/Object.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/Object.h?rev=52392&r1=52391&r2=52392&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/Object.h (original)
+++ vmkit/trunk/include/mvm/Object.h Tue Jun 17 04:46:35 2008
@@ -19,12 +19,11 @@
#define VT_DESTRUCTOR_OFFSET 0
-#define VT_GC_DESTRUCTOR_OFFSET 1
-#define VT_DESTROYER_OFFSET 2
-#define VT_TRACER_OFFSET 3
-#define VT_PRINT_OFFSET 4
-#define VT_HASHCODE_OFFSET 5
-#define VT_SIZE 6 * sizeof(void*)
+#define VT_OPERATOR_DELETE_OFFSET 1
+#define VT_TRACER_OFFSET 2
+#define VT_PRINT_OFFSET 3
+#define VT_HASHCODE_OFFSET 4
+#define VT_SIZE 5 * sizeof(void*)
class PrintBuffer;
@@ -51,10 +50,6 @@
///
char *printString(void) const;
- /// destroyer - Default implementation of destroyer. Does nothing.
- ///
- virtual void destroyer(size_t) {}
-
/// tracer - Default implementation of tracer. Does nothing.
///
virtual void TRACER {}
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp?rev=52392&r1=52391&r2=52392&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp Tue Jun 17 04:46:35 2008
@@ -80,13 +80,22 @@
return 0;
}
-void CommonClass::destroyer(size_t sz) {
+CommonClass::~CommonClass() {
free(display);
- isolate->TheModule->removeClass(this);
+ if (isolate)
+ isolate->TheModule->removeClass(this);
}
-void Class::destroyer(size_t sz) {
- CommonClass::destroyer(sz);
+CommonClass::CommonClass() {
+ display = 0;
+ isolate = 0;
+}
+
+Class::Class() {
+ ctpInfo = 0;
+}
+
+Class::~Class() {
for (std::vector<Attribut*>::iterator i = attributs.begin(),
e = attributs.end(); i!= e; ++i) {
Attribut* cur = *i;
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h?rev=52392&r1=52391&r2=52392&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h Tue Jun 17 04:46:35 2008
@@ -265,17 +265,17 @@
}
CommonClass(Jnjvm* vm, const UTF8* name, bool isArray);
- /// Empty constructor for VT
- CommonClass() {}
static VirtualTable* VT;
static JavaObject* jnjvmClassLoader;
- virtual void destroyer(size_t sz);
+
+ ~CommonClass();
+ CommonClass();
+
};
class ClassPrimitive : public CommonClass {
public:
- static VirtualTable* VT;
ClassPrimitive(Jnjvm* vm, const UTF8* name);
};
@@ -297,7 +297,9 @@
JavaObject* doNew(Jnjvm* vm);
virtual void print(mvm::PrintBuffer *buf) const;
virtual void TRACER;
- virtual void destroyer(size_t sz);
+
+ ~Class();
+ Class();
JavaObject* operator()(Jnjvm* vm);
@@ -314,8 +316,6 @@
void createStaticInstance();
#endif
- /// Empty constructor for VT
- Class() {}
Class(Jnjvm* vm, const UTF8* name);
};
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp?rev=52392&r1=52391&r2=52392&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp Tue Jun 17 04:46:35 2008
@@ -539,7 +539,10 @@
return isolate;
}
-void JavaIsolate::destroyer(size_t sz) {
- Jnjvm::destroyer(sz);
+JavaIsolate::~JavaIsolate() {
delete threadSystem;
}
+
+JavaIsolate::JavaIsolate() {
+ threadSystem = 0;
+}
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.h?rev=52392&r1=52391&r2=52392&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.h Tue Jun 17 04:46:35 2008
@@ -53,7 +53,8 @@
virtual void print(mvm::PrintBuffer* buf) const;
virtual void TRACER;
- virtual void destroyer(size_t sz);
+ ~JavaIsolate();
+ JavaIsolate();
JavaObject* loadAppClassLoader();
void loadBootstrap();
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaObject.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaObject.cpp?rev=52392&r1=52391&r2=52392&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaObject.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaObject.cpp Tue Jun 17 04:46:35 2008
@@ -243,13 +243,18 @@
}
}
-void LockObj::destroyer(size_t sz) {
+LockObj::~LockObj() {
if (varcond) delete varcond;
delete lock;
}
+LockObj::LockObj() {
+ varcond = 0;
+ lock = 0;
+}
+
#ifdef USE_GC_BOEHM
-void JavaObject::destroyer(size_t sz) {
+JavaObject::~JavaObject() {
if (lockObj()) delete lockObj();
}
#endif
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaObject.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaObject.h?rev=52392&r1=52391&r2=52392&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaObject.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaObject.h Tue Jun 17 04:46:35 2008
@@ -112,7 +112,8 @@
static VirtualTable* VT;
virtual void print(mvm::PrintBuffer* buf) const;
virtual void TRACER;
- virtual void destroyer(size_t sz);
+ ~LockObj();
+ LockObj();
};
@@ -206,7 +207,10 @@
virtual void TRACER;
#ifdef USE_GC_BOEHM
- virtual void destroyer(size_t sz);
+ ~JavaObject();
+ JavaObject() {
+ lockObj = 0;
+ }
#endif
LockObj* lockObj() {
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaThread.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaThread.cpp?rev=52392&r1=52391&r2=52392&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaThread.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaThread.cpp Tue Jun 17 04:46:35 2008
@@ -30,7 +30,12 @@
javaThread->print(buf);
}
-void JavaThread::destroyer(size_t sz) {
+JavaThread::~JavaThread() {
delete lock;
delete varcond;
}
+
+JavaThread::JavaThread() {
+ lock = 0;
+ varcond = 0;
+}
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaThread.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaThread.h?rev=52392&r1=52391&r2=52392&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaThread.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaThread.h Tue Jun 17 04:46:35 2008
@@ -48,7 +48,8 @@
virtual void print(mvm::PrintBuffer *buf) const;
virtual void TRACER;
- virtual void destroyer(size_t sz);
+ ~JavaThread();
+ JavaThread();
void initialise(JavaObject* thread, Jnjvm* isolate) {
this->javaThread = thread;
Modified: vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp?rev=52392&r1=52391&r2=52392&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp Tue Jun 17 04:46:35 2008
@@ -804,7 +804,7 @@
}
#endif
-void Jnjvm::destroyer(size_t sz) {
+Jnjvm::~Jnjvm() {
#ifdef MULTIPLE_GC
GC->destroy();
delete GC;
@@ -816,4 +816,17 @@
delete globalRefsLock;
delete TheModuleProvider;
+ delete TheModule;
+}
+
+Jnjvm::Jnjvm() {
+#ifdef MULTIPLE_GC
+ GC = 0;
+#endif
+ hashUTF8 = 0;
+ hashStr = 0;
+ javaTypes = 0;
+ globalRefsLock = 0;
+ TheModuleProvider = 0;
+ TheModule = 0;
}
Modified: vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.h?rev=52392&r1=52391&r2=52392&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.h Tue Jun 17 04:46:35 2008
@@ -219,7 +219,8 @@
buf->write("Jnjvm<>");
}
- virtual void destroyer(size_t sz);
+ ~Jnjvm();
+ Jnjvm();
void addProperty(char* key, char* value);
Modified: vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h?rev=52392&r1=52391&r2=52392&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h Tue Jun 17 04:46:35 2008
@@ -142,7 +142,7 @@
lock = mvm::Lock::allocNormal();
}
- virtual void destroyer(size_t sz) {
+ ~ClassMap() {
delete lock;
}
@@ -230,7 +230,7 @@
virtual void TRACER;
- virtual void destroyer(size_t sz) {
+ ~StaticInstanceMap() {
for (iterator i = map.begin(), e = map.end(); i!= e; ++i) {
delete i->second;
}
@@ -247,7 +247,7 @@
lock = mvm::Lock::allocNormal();
}
- virtual void destroyer(size_t sz) {
+ ~DelegateeMap() {
delete lock;
}
Modified: vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp?rev=52392&r1=52391&r2=52392&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp Tue Jun 17 04:46:35 2008
@@ -30,8 +30,7 @@
JavaMethod* ServiceDomain::uninstallBundle;
-void ServiceDomain::destroyer(size_t sz) {
- Jnjvm::destroyer(sz);
+ServiceDomain::~ServiceDomain() {
delete lock;
}
Modified: vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.h?rev=52392&r1=52391&r2=52392&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.h Tue Jun 17 04:46:35 2008
@@ -35,7 +35,7 @@
virtual void print(mvm::PrintBuffer* buf) const;
virtual void TRACER;
- virtual void destroyer(size_t sz);
+ ~ServiceDomain();
static ServiceDomain* allocateService(JavaIsolate* callingVM);
static void serviceError(ServiceDomain* error, const char* str);
Modified: vmkit/trunk/lib/Mvm/BoehmGC/MvmGC.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/BoehmGC/MvmGC.h?rev=52392&r1=52391&r2=52392&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/BoehmGC/MvmGC.h (original)
+++ vmkit/trunk/lib/Mvm/BoehmGC/MvmGC.h Tue Jun 17 04:46:35 2008
@@ -38,18 +38,14 @@
return (GC_size(res) - sizeof(gc_header));
}
- static void my_destroyer(void * obj, void * unused){
- gc_header* res = (gc_header*)GC_base(obj);
- if(res){
- res->_2gc()->destroyer(GC_size(res));
- }
- }
-
void * operator new(size_t sz, VirtualTable *VT) {
gc_header * res = (gc_header*) GC_MALLOC(sz + sizeof(gc_header));
res -> _XXX_vt= VT;
-
- GC_register_finalizer_no_order(res, my_destroyer, NULL, NULL, NULL);
+
+ destructor_t dest = res->getDestructor();
+ if (dest)
+ GC_register_finalizer_no_order(res, (void (*)(void*, void*))dest, NULL,
+ NULL, NULL);
return res->_2gc();
}
@@ -64,7 +60,6 @@
void * realloc(size_t n) {
void * old = GC_base(this);
gc_header * res = (gc_header*) GC_REALLOC(old, n + sizeof(gc_header));
- GC_register_finalizer(old, NULL, NULL, NULL, NULL);
return res->_2gc();
}
Modified: vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp?rev=52392&r1=52391&r2=52392&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp (original)
+++ vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp Tue Jun 17 04:46:35 2008
@@ -46,6 +46,8 @@
bool GCCollector::_enable_collection;
#endif
+typedef void (*destructor_t)(void*);
+
void GCCollector::do_collect() {
//printf("----- do collect -----\n");
GCChunkNode *cur;
@@ -93,7 +95,9 @@
register gc_header *c = cur->chunk();
next = cur->next();
- c->_2gc()->destroyer(real_nbb(cur));
+ destructor_t dest = c->getDestructor();
+ if (dest)
+ dest(c);
//printf(" !!!! reject %p [%p]\n", cur->chunk()->_2gc(), cur);
allocator->reject_chunk(cur);
Modified: vmkit/trunk/lib/Mvm/VTOffset.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/VTOffset.cpp?rev=52392&r1=52391&r2=52392&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/VTOffset.cpp (original)
+++ vmkit/trunk/lib/Mvm/VTOffset.cpp Tue Jun 17 04:46:35 2008
@@ -16,7 +16,6 @@
#include "mvm/PrintBuffer.h"
#include "mvm/Threads/Thread.h"
#include "mvm/Sigsegv.h"
-#include "mvm/VMLet.h"
class Toto : public mvm::Object {
public:
@@ -38,38 +37,34 @@
printf("in destroy!\n");
}
- virtual ~Toto() {
+ ~Toto() {
printf("in delete Toto!\n");
}
};
-static void clearSignals(void) {
- sys_signal(SIGINT, SIG_DFL);
- sys_signal(SIGILL, SIG_DFL);
-#if !defined(WIN32)
- sys_signal(SIGIOT, SIG_DFL);
- sys_signal(SIGBUS, SIG_DFL);
-#endif
- sys_signal(SIGSEGV, SIG_DFL);
-}
-
+class Tata : public Toto {
+ public:
+ static VirtualTable* VT;
+ ~Tata() {
+ printf("in delete Tata!\n");
+ }
+};
VirtualTable* Toto::VT = 0;
typedef void (*toto_t)(Toto* t);
+VirtualTable* Tata::VT = 0;
+typedef void (*tata_t)(Tata* t);
+
int main(int argc, char **argv, char **envp) {
int base;
- mvm::VMLet::initialise();
- mvm::Object::initialise(&base);
-
- initialiseVT();
- initialiseStatics();
+ mvm::Object::initialise();
/*void* handle = sys_dlopen("libLisp.so", RTLD_LAZY | RTLD_GLOBAL);
boot func = (boot)sys_dlsym(handle, "boot");
func(argc, argv, envp);*/
-
+ {
Toto t;
Toto::VT =((void**)(void*)&t)[0];
toto_t* ptr = (toto_t*)Toto::VT;
@@ -80,8 +75,22 @@
ptr[3](&t);
ptr[4](&t);
ptr[5](&t);
-
- clearSignals();
+}
+{
+ Tata t;
+ Tata::VT =((void**)(void*)&t)[0];
+ tata_t* ptr = (tata_t*)Tata::VT;
+ printf("ptr[0] = %d, ptr[1]= %d, ptr[2] = %d ptr[3] = %d ptr[4] = %d ptr[5] = %d\n", ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5]);
+ printf("Call des\n");
+ ptr[0](&t);
+ printf("End\n");
+ //ptr[1](&t); // This should be ~gc
+ ptr[2](&t);
+ ptr[3](&t);
+ ptr[4](&t);
+ ptr[5](&t);
+}
+Tata* t = gc_new(Tata)();
mvm::Thread::exit(0);
return 0;
Modified: vmkit/trunk/lib/N3/VMCore/VMThread.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/VMThread.cpp?rev=52392&r1=52391&r2=52392&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/VMThread.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/VMThread.cpp Tue Jun 17 04:46:35 2008
@@ -35,10 +35,14 @@
vmThread->print(buf);
}
-void VMThread::destroyer(size_t sz) {
+VMThread::~VMThread() {
delete perFunctionPasses;
}
+VMThread::VMThread() {
+ perFunctionPasses = 0;
+}
+
VMThread* VMThread::get() {
return (VMThread*)threadKey->get();
}
Modified: vmkit/trunk/lib/N3/VMCore/VMThread.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/VMThread.h?rev=52392&r1=52391&r2=52392&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/VMThread.h (original)
+++ vmkit/trunk/lib/N3/VMCore/VMThread.h Tue Jun 17 04:46:35 2008
@@ -45,7 +45,8 @@
virtual void print(mvm::PrintBuffer *buf);
virtual void TRACER;
- virtual void destroyer(size_t sz);
+ ~VMThread();
+ VMThread();
static VMThread* get();
static VMThread* allocate(VMObject* thread, VirtualMachine* vm);
Modified: vmkit/trunk/lib/N3/VMCore/VirtualMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/VirtualMachine.cpp?rev=52392&r1=52391&r2=52392&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/VirtualMachine.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/VirtualMachine.cpp Tue Jun 17 04:46:35 2008
@@ -151,7 +151,12 @@
error(name, fmt, ap);
}
-void VirtualMachine::destroyer(size_t sz) {
+VirtualMachine::~VirtualMachine() {
delete module;
delete TheModuleProvider;
}
+
+VirtualMachine::VirtualMachine() {
+ module = 0;
+ TheModuleProvider = 0;
+}
Modified: vmkit/trunk/lib/N3/VMCore/VirtualMachine.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/VirtualMachine.h?rev=52392&r1=52391&r2=52392&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/VirtualMachine.h (original)
+++ vmkit/trunk/lib/N3/VMCore/VirtualMachine.h Tue Jun 17 04:46:35 2008
@@ -115,7 +115,8 @@
buf->write("Virtual Machine<>");
}
- virtual void destroyer(size_t sz);
+ ~VirtualMachine();
+ VirtualMachine();
mvm::Lock* protectModule;
FunctionMap* functions;
More information about the llvm-commits
mailing list