[vmkit-commits] [vmkit] r73029 - in /vmkit/trunk: include/mvm/GC/GC.h lib/Mvm/Allocator/gcchunk.h lib/Mvm/GCMmap2/MvmGC.h lib/Mvm/GCMmap2/gcthread.cpp lib/Mvm/GCMmap2/gcthread.h lib/Mvm/Runtime/Object.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Sun Jun 7 07:27:46 PDT 2009
Author: geoffray
Date: Sun Jun 7 09:27:46 2009
New Revision: 73029
URL: http://llvm.org/viewvc/llvm-project?rev=73029&view=rev
Log:
More code cleanup.
Modified:
vmkit/trunk/include/mvm/GC/GC.h
vmkit/trunk/lib/Mvm/Allocator/gcchunk.h
vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h
vmkit/trunk/lib/Mvm/GCMmap2/gcthread.cpp
vmkit/trunk/lib/Mvm/GCMmap2/gcthread.h
vmkit/trunk/lib/Mvm/Runtime/Object.cpp
Modified: vmkit/trunk/include/mvm/GC/GC.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/GC/GC.h?rev=73029&r1=73028&r2=73029&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/GC/GC.h (original)
+++ vmkit/trunk/include/mvm/GC/GC.h Sun Jun 7 09:27:46 2009
@@ -13,8 +13,6 @@
#include <stdint.h>
-typedef void (*gc_lock_recovery_fct_t)(int, int, int, int, int, int, int, int);
-
struct VirtualTable {
uintptr_t destructor;
uintptr_t operatorDelete;
@@ -38,11 +36,7 @@
class gcRoot {
public:
virtual ~gcRoot() {}
-#ifdef MULTIPLE_GC
- virtual void tracer(void* GC) {}
-#else
virtual void tracer(void) {}
-#endif
/// getVirtualTable - Returns the virtual table of this object.
///
@@ -57,18 +51,4 @@
}
};
-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->destructor;
- }
- destructor_t getDelete() {
- return (destructor_t)this->_XXX_vt->operatorDelete;
- }
-};
-
#endif
Modified: vmkit/trunk/lib/Mvm/Allocator/gcchunk.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Allocator/gcchunk.h?rev=73029&r1=73028&r2=73029&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Allocator/gcchunk.h (original)
+++ vmkit/trunk/lib/Mvm/Allocator/gcchunk.h Sun Jun 7 09:27:46 2009
@@ -15,15 +15,14 @@
#include "gcmapper.h"
#include "types.h"
-class gc; /* object collectable */
-class gc_header; /* entete locale */
+class gcRoot; /* object collectable */
/* description d'un bout de mémoire */
class GCChunkNode {
GCChunkNode *_prev; /* bit 0-1: l'age, les autres: le previous */
GCChunkNode *_next;
void * _chunk;
- uintptr_t _nbb_mark; /* nbb = 0 <=> ce chunk est libre */
+ uintptr_t _nbb_mark; /* nbb = 0 <=> ce chunk est libre */
/* bit 0-2: la marque */
/* bit 3: est-on collectable */
public:
@@ -36,7 +35,7 @@
inline GCChunkNode() {}
inline ~GCChunkNode() {}
- inline gc_header * chunk() { return (gc_header *)_chunk; }
+ inline gcRoot * chunk() { return (gcRoot*)_chunk; }
inline GCChunkNode * next() { return _next; }
inline void next(GCChunkNode *n) { _next = n; }
@@ -144,7 +143,7 @@
? res : 0;
}
- inline gc_header *o2header(void *ptr, signed int mask) {
+ inline gcRoot *o2header(void *ptr, signed int mask) {
register uintptr_t entry = ((uintptr_t)ptr - (uintptr_t)area())/_chunk_nbb;
register GCChunkNode *res = _headers + entry;
return ((uintptr_t)ptr - (uintptr_t)res->chunk() < res->nbb())
Modified: vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h?rev=73029&r1=73028&r2=73029&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h (original)
+++ vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h Sun Jun 7 09:27:46 2009
@@ -79,7 +79,7 @@
}
static inline size_t real_nbb(GCChunkNode *n) {
- return n->nbb() - sizeof(gc_header);
+ return n->nbb() - sizeof(gcRoot);
}
public:
@@ -114,7 +114,7 @@
static inline void *begOf(const void *p) {
GCChunkNode *node = o2node(p);
if(node)
- return node->chunk()->_2gc();
+ return node->chunk();
else
return 0;
}
@@ -193,19 +193,17 @@
}
#endif
header->append(used_nodes);
- //printf("Allocate %d bytes at %p [%p] %d %d\n", n, header->chunk()->_2gc(),
- // header, header->nbb(), real_nbb(header));
- register struct gc_header *p = header->chunk();
- p->_XXX_vt = vt;
+ register struct gcRoot *p = header->chunk();
+ p->setVirtualTable(vt);
unlock();
if (vt->destructor) {
- mvm::Thread::get()->MyVM->addFinalizationCandidate((gc*)p->_2gc());
+ mvm::Thread::get()->MyVM->addFinalizationCandidate((gc*)p);
}
- return p->_2gc();
+ return p;
#endif
}
@@ -271,10 +269,10 @@
mark(res);
}
- gc_header *obj = res->chunk();
+ gcRoot *obj = res->chunk();
unlock();
- return obj->_2gc();
+ return obj;
#endif
}
@@ -293,8 +291,8 @@
}
static inline void trace(GCChunkNode *node) {
- gc_header *o = node->chunk();
- o->_2gc()->tracer();
+ gcRoot *o = node->chunk();
+ o->tracer();
}
static inline void markAndTrace(void *ptr) {
Modified: vmkit/trunk/lib/Mvm/GCMmap2/gcthread.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gcthread.cpp?rev=73029&r1=73028&r2=73029&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/GCMmap2/gcthread.cpp (original)
+++ vmkit/trunk/lib/Mvm/GCMmap2/gcthread.cpp Sun Jun 7 09:27:46 2009
@@ -35,14 +35,3 @@
waitStacks();
}
-
-int GCLockRecovery::verify_recall(gc_lock_recovery_fct_t fct, int a0, int a1,
- int a2, int a3, int a4, int a5, int a6,
- int a7) {
- if(selfOwner()) {
- _fct = fct; _args[0] = a0; _args[1] = a1; _args[2] = a2; _args[3] = a3;
- _args[4] = a4; _args[5] = a5; _args[6] = a6; _args[7] = a7;
- return 0;
- } else
- return 1;
-}
Modified: vmkit/trunk/lib/Mvm/GCMmap2/gcthread.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gcthread.h?rev=73029&r1=73028&r2=73029&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/GCMmap2/gcthread.h (original)
+++ vmkit/trunk/lib/Mvm/GCMmap2/gcthread.h Sun Jun 7 09:27:46 2009
@@ -16,39 +16,9 @@
namespace mvm {
-class GCLockRecovery : public LockNormal {
- gc_lock_recovery_fct_t _fct;
- int _args[8];
-
-public:
- inline GCLockRecovery() { _fct = 0; }
-
- int verify_recall(gc_lock_recovery_fct_t fct, int a0, int a1, int a2, int a3,
- int a4, int a5, int a6, int a7);
-
- inline void unlock_dont_recovery() {
- if(selfOwner()) {
- LockNormal::unlock();
- }
- }
-
- inline void unlock() {
- if(_fct) {
- gc_lock_recovery_fct_t tmp = _fct;
- int l[8];
- l[0] = _args[0]; l[1] = _args[1]; l[2] = _args[2]; l[3] = _args[3];
- l[4] = _args[4]; l[5] = _args[5]; l[6] = _args[6]; l[7] = _args[7];
- _fct = 0;
- LockNormal::unlock();
- tmp(l[0], l[1], l[2], l[3], l[4], l[5], l[6], l[7]);
- } else
- LockNormal::unlock();
- }
-};
-
class GCThread {
/// _globalLock - Global lock for gcmalloc.
- GCLockRecovery _globalLock;
+ LockNormal _globalLock;
/// _stackLock - Stack lock for synchronization.
LockNormal _stackLock;
@@ -85,11 +55,6 @@
}
inline void lock() { _globalLock.lock(); }
inline void unlock() { _globalLock.unlock(); }
- inline void unlock_dont_recovery() { _globalLock.unlock_dont_recovery(); }
- inline int isStable(gc_lock_recovery_fct_t fct, int a0, int a1, int a2,
- int a3, int a4, int a5, int a6, int a7) {
- return _globalLock.verify_recall(fct, a0, a1, a2, a3, a4, a5, a6, a7);
- }
inline void stackLock() { _stackLock.lock(); }
inline void stackUnlock() { _stackLock.unlock(); }
Modified: vmkit/trunk/lib/Mvm/Runtime/Object.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Runtime/Object.cpp?rev=73029&r1=73028&r2=73029&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Runtime/Object.cpp (original)
+++ vmkit/trunk/lib/Mvm/Runtime/Object.cpp Sun Jun 7 09:27:46 2009
@@ -114,7 +114,7 @@
buf->write("\"");
}
-
+typedef void (*destructor_t)(void*);
void VirtualMachine::finalizerStart(mvm::Thread* th) {
More information about the vmkit-commits
mailing list