[llvm-commits] [vmkit] r48950 - in /vmkit/trunk: include/mvm/ include/mvm/GC/ lib/JnJVM/Classpath/ lib/JnJVM/VMCore/ lib/Mvm/ lib/Mvm/GCMmap2/ lib/N3/VMCore/
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Sun Mar 30 08:23:17 PDT 2008
Author: geoffray
Date: Sun Mar 30 10:23:15 2008
New Revision: 48950
URL: http://llvm.org/viewvc/llvm-project?rev=48950&view=rev
Log:
Use a cleaner interface between gc objects and the collector
Modified:
vmkit/trunk/include/mvm/CollectableArea.h
vmkit/trunk/include/mvm/GC/GC.h
vmkit/trunk/include/mvm/Object.h
vmkit/trunk/include/mvm/PrintBuffer.h
vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp
vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMStackWalker.cpp
vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp
vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaArray.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaBacktrace.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp
vmkit/trunk/lib/Mvm/CommandLine.cpp
vmkit/trunk/lib/Mvm/GCMmap2/gc.cc
vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cc
vmkit/trunk/lib/Mvm/GCMmap2/gccollector.h
vmkit/trunk/lib/Mvm/GCMmap2/gcinit.cc
vmkit/trunk/lib/Mvm/GCMmap2/main.cc
vmkit/trunk/lib/Mvm/MvmMemoryManager.cpp
vmkit/trunk/lib/Mvm/Object.cc
vmkit/trunk/lib/Mvm/Sigsegv.cc
vmkit/trunk/lib/N3/VMCore/BackTrace.cpp
vmkit/trunk/lib/N3/VMCore/CLIJit.cpp
vmkit/trunk/lib/N3/VMCore/N3Initialise.cpp
vmkit/trunk/lib/N3/VMCore/PNetLib.cpp
vmkit/trunk/lib/N3/VMCore/VMArray.cpp
vmkit/trunk/lib/N3/VMCore/VMClass.cpp
Modified: vmkit/trunk/include/mvm/CollectableArea.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/CollectableArea.h?rev=48950&r1=48949&r2=48950&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/CollectableArea.h (original)
+++ vmkit/trunk/include/mvm/CollectableArea.h Sun Mar 30 10:23:15 2008
@@ -34,7 +34,7 @@
static inline CollectableArea *alloc(size_t cap, size_t st, size_t e) {
CollectableArea *res =
- (CollectableArea *)Object::gcmalloc(sizeof(CollectableArea) + cap<<2, VT);
+ (CollectableArea *)gc::operator new(sizeof(CollectableArea) + cap<<2, VT);
res->firstIndex = st;
res->lastIndex = e;
res->capacity = cap;
Modified: vmkit/trunk/include/mvm/GC/GC.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/GC/GC.h?rev=48950&r1=48949&r2=48950&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/GC/GC.h (original)
+++ vmkit/trunk/include/mvm/GC/GC.h Sun Mar 30 10:23:15 2008
@@ -20,30 +20,33 @@
typedef void VirtualTable;
#define gc_new(Class) __gc_new(Class::VT) Class
+class gc {
+public:
+ virtual ~gc() {}
+ virtual void destroyer(size_t) {}
+ virtual void tracer(size_t) {}
+
+ void markAndTrace() const;
+ size_t objectSize() const;
+ void * operator new(size_t sz, VirtualTable *VT);
+ void operator delete(void *);
+ void * realloc(size_t n);
+
+};
+
class gc_header {
public:
VirtualTable *_XXX_vt;
inline gc *_2gc() { return (gc *)this; }
};
-class gc {
+class Collector {
public:
typedef void (*markerFn)(void);
- inline gc() {}
- virtual ~gc() {}
-
- static void initialise(markerFn mark, void *base_sp);
+
+ static void initialise(markerFn mark, void *base_sp);
static void destroy();
- void setVT(VirtualTable* VT) {
- ((void**)this)[0] = VT;
- }
-
- void markAndTrace() const;
- size_t objectSize() const;
- void * operator new(size_t sz, VirtualTable *VT);
- void operator delete(void *);
- void * realloc(size_t n);
static void die_if_sigsegv_occured_during_collection(void *addr);
static int isStable(gc_lock_recovery_fct_t, int, int, int, int,
@@ -65,9 +68,6 @@
static int getTotalMemory(void);
static void setMaxMemory(size_t);
static void setMinMemory(size_t);
-
- virtual void destroyer(size_t sz) {} ;
- virtual void tracer(size_t sz) {};
};
#define __gc_new new
Modified: vmkit/trunk/include/mvm/Object.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/Object.h?rev=48950&r1=48949&r2=48950&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/Object.h (original)
+++ vmkit/trunk/include/mvm/Object.h Sun Mar 30 10:23:15 2008
@@ -38,26 +38,25 @@
class Object : public gc {
public:
static VirtualTable* VT;
- bool isObject() const;
- Object *begOf() const;
- size_t objectSize() const;
- VirtualTable* getVirtualTable() {
+
+ VirtualTable* getVirtualTable() const {
return ((VirtualTable**)(this))[0];
}
+
+ void setVirtualTable(VirtualTable* VT) {
+ ((VirtualTable**)(this))[0] = VT;
+ }
char *printString(void) const;
- static char * printStatic(const Object *);
#if !defined(GC_GEN)
inline gc *gcset(void *ptr, gc *src) { return *((gc **)ptr) = src; }
#endif
-
-
- virtual void destroyer(size_t) {}
- virtual void tracer(size_t) {}
- virtual void print(PrintBuffer *buf) const;
- virtual intptr_t hashCode(){ return (intptr_t)this;}
+ virtual void destroyer(size_t) {}
+ virtual void tracer(size_t) {}
+ virtual void print(PrintBuffer *buf) const;
+ virtual intptr_t hashCode(){ return (intptr_t)this;}
protected:
static Object **rootTable;
@@ -88,7 +87,6 @@
}
static void markAndTraceRoots(void);
- static Object *gcmalloc(size_t sz, VirtualTable* VT);
static void initialise(void *sp);
};
Modified: vmkit/trunk/include/mvm/PrintBuffer.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/PrintBuffer.h?rev=48950&r1=48949&r2=48950&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/PrintBuffer.h (original)
+++ vmkit/trunk/include/mvm/PrintBuffer.h Sun Mar 30 10:23:15 2008
@@ -33,7 +33,7 @@
}
static inline NativeString *alloc(size_t len) {
- return (NativeString *)Object::gcmalloc(len, VT);
+ return (NativeString *)gc::operator new(len, VT);
}
inline NativeString *realloc(size_t len) {
Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp?rev=48950&r1=48949&r2=48950&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp Sun Mar 30 10:23:15 2008
@@ -88,7 +88,7 @@
jclass clazz,
#endif
) {
- gc::collect();
+ Collector::collect();
}
JNIEXPORT void JNICALL Java_java_lang_VMRuntime_runFinalization(
@@ -129,7 +129,7 @@
jclass clazz,
#endif
) {
- return (jlong)512*1000;//gc::getFreeMemory();
+ return (jlong)Collector::getFreeMemory();
}
JNIEXPORT jlong Java_java_lang_VMRuntime_totalMemory(
@@ -138,7 +138,7 @@
jclass clazz,
#endif
) {
- return (jlong)512*1000;//gc::getTotalMemory();
+ return (jlong)Collector::getTotalMemory();
}
JNIEXPORT jlong Java_java_lang_VMRuntime_maxMemory(
@@ -147,7 +147,7 @@
jclass clazz,
#endif
) {
- return (jlong)512*1000;//gc::getMaxMemory();
+ return (jlong)Collector::getMaxMemory();
}
}
Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMStackWalker.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMStackWalker.cpp?rev=48950&r1=48949&r2=48950&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMStackWalker.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMStackWalker.cpp Sun Mar 30 10:23:15 2008
@@ -31,7 +31,7 @@
ArrayObject* recGetClassContext(int** stack, uint32 size, uint32 first, uint32 rec) {
if (size != first) {
- int *begIp = (int*)gc::begOf(stack[first]);
+ int *begIp = (int*)Collector::begOf(stack[first]);
JavaMethod* meth = ip_to_meth(begIp);
if (meth) {
ArrayObject* res = recGetClassContext(stack, size, first + 1, rec + 1);
@@ -58,7 +58,7 @@
CommonClass* cl = Classpath::vmStackWalker;
while (i < real_size) {
- int *begIp = (int*)gc::begOf(ips[i++]);
+ int *begIp = (int*)Collector::begOf(ips[i++]);
JavaMethod* meth = ip_to_meth(begIp);
if (meth && meth->classDef == cl) {
first = i;
@@ -87,7 +87,7 @@
int i = 0;
while (i < real_size) {
- int *begIp = (int*)gc::begOf(ips[i++]);
+ int *begIp = (int*)Collector::begOf(ips[i++]);
JavaMethod* meth = ip_to_meth(begIp);
if (meth) {
++n;
@@ -105,7 +105,7 @@
int i = 0;
while (i < real_size) {
- int *begIp = (int*)gc::begOf(ips[i++]);
+ int *begIp = (int*)Collector::begOf(ips[i++]);
JavaMethod* meth = ip_to_meth(begIp);
if (meth) {
++n;
Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp?rev=48950&r1=48949&r2=48950&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp Sun Mar 30 10:23:15 2008
@@ -46,7 +46,7 @@
static void start(arg_thread_t* arg) {
int argc;
- gc::inject_my_thread(&argc);
+ Collector::inject_my_thread(&argc);
JavaObject* vmThread = arg->vmThread;
JavaThread* intern = arg->intern;
delete arg;
@@ -74,7 +74,7 @@
ts->nonDaemonVar->signal();
ts->nonDaemonLock->unlock();
}
- gc::remove_my_thread();
+ Collector::remove_my_thread();
}
JNIEXPORT void JNICALL Java_java_lang_VMThread_start(
Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp?rev=48950&r1=48949&r2=48950&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp Sun Mar 30 10:23:15 2008
@@ -78,7 +78,7 @@
ArrayObject* recGetStackTrace(int** stack, uint32 size, uint32 first, uint32 rec) {
if (size != first) {
- int *begIp = (int*)gc::begOf(stack[first]);
+ int *begIp = (int*)Collector::begOf(stack[first]);
JavaMethod* meth = ip_to_meth(begIp);
if (meth) {
ArrayObject* res = recGetStackTrace(stack, size, first + 1, rec + 1);
@@ -104,7 +104,7 @@
sint32 i = 0;
while (i < array->size) {
- int *begIp = (int*)gc::begOf((void*)stack[i++]);
+ int *begIp = (int*)Collector::begOf((void*)stack[i++]);
JavaMethod* meth = ip_to_meth(begIp);
if (meth && meth->classDef == cl) {
first = i;
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaArray.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaArray.cpp?rev=48950&r1=48949&r2=48950&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaArray.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaArray.cpp Sun Mar 30 10:23:15 2008
@@ -87,7 +87,7 @@
res->initialise(atype);
res->size = n;
memset(res->elements, 0, sizeof(JavaObject*) * n);
- res->setVT(ArrayObject::VT);
+ res->setVirtualTable(ArrayObject::VT);
return res;
}
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaBacktrace.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaBacktrace.cpp?rev=48950&r1=48949&r2=48950&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaBacktrace.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaBacktrace.cpp Sun Mar 30 10:23:15 2008
@@ -119,7 +119,7 @@
fp = debug_frame_caller_from_first_fp(fp);
while ((!frame_end(fp)) && (debug_frame_ip(fp) != 0)) {
int * ip = debug_frame_ip(fp);
- int *begIp = (int*)gc::begOf(ip);
+ int *begIp = (int*)Collector::begOf(ip);
if (begIp) {
const llvm::GlobalValue * glob =
mvm::jit::executionEngine->getGlobalValueAtAddress(begIp + 1);
@@ -146,7 +146,7 @@
int real_size = backtrace((void**)(void*)ips, 100);
int n = 0;
while (n < real_size) {
- int *begIp = (int*)gc::begOf(ips[n++]);
+ int *begIp = (int*)Collector::begOf(ips[n++]);
if (begIp) {
const llvm::GlobalValue * glob =
mvm::jit::executionEngine->getGlobalValueAtAddress(begIp + 1);
@@ -182,7 +182,7 @@
int n = 0;
int i = 0;
while (n < real_size) {
- int *begIp = (int*)gc::begOf(ips[n++]);
+ int *begIp = (int*)Collector::begOf(ips[n++]);
if (begIp) {
const llvm::GlobalValue * glob =
mvm::jit::executionEngine->getGlobalValueAtAddress(begIp + 1);
@@ -208,7 +208,7 @@
int n = 0;
int i = 0;
while (n < real_size) {
- int *begIp = (int*)gc::begOf(ips[n++]);
+ int *begIp = (int*)Collector::begOf(ips[n++]);
if (begIp) {
const llvm::GlobalValue * glob =
mvm::jit::executionEngine->getGlobalValueAtAddress(begIp + 1);
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp?rev=48950&r1=48949&r2=48950&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp Sun Mar 30 10:23:15 2008
@@ -212,7 +212,7 @@
}
// We can compile it, since if we're here, it's for a good reason
void* val = mvm::jit::executionEngine->getPointerToGlobal(methPtr);
- if (gc::isObject(val)) {
+ if (Collector::isObject(val)) {
mvm::Code* temp = (mvm::Code*)((unsigned*)val - 1);
temp->method()->definition(this);
}
@@ -520,7 +520,7 @@
cl->staticVT = VT;
if (cl->isolate != Jnjvm::bootstrapVM) {
#endif
- JavaObject* val = (JavaObject*)mvm::Object::gcmalloc(size, VT);
+ JavaObject* val = (JavaObject*)gc::operator new(size, VT);
cl->setStaticInstance(val);
val->initialise(cl);
for (std::vector<JavaField*>::iterator i = cl->staticFields.begin(),
@@ -561,12 +561,12 @@
uint64 size = mvm::jit::getTypeSize(cl->virtualType->getContainedType(0));
cl->virtualSize = size;
cl->virtualVT = VT;
- cl->virtualInstance = (JavaObject*)mvm::Object::gcmalloc(size, VT);
+ cl->virtualInstance = (JavaObject*)gc::operator new(size, VT);
cl->virtualInstance->initialise(cl);
for (std::vector<JavaField*>::iterator i = cl->virtualFields.begin(),
e = cl->virtualFields.end(); i!= e; ++i) {
- // Virtual fields apparenty do not have inititizalizers, which is good
+ // Virtual fields apparenty do not have initializers, which is good
// for isolates. I should not have to do this, but just to make sure.
(*i)->initField(cl->virtualInstance);
}
Modified: vmkit/trunk/lib/Mvm/CommandLine.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/CommandLine.cpp?rev=48950&r1=48949&r2=48950&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/CommandLine.cpp (original)
+++ vmkit/trunk/lib/Mvm/CommandLine.cpp Sun Mar 30 10:23:15 2008
@@ -105,10 +105,10 @@
char** argv = arg->argv;
vmlet_main_t func = arg->func;
free(arg);
- gc::inject_my_thread(&argc);
+ Collector::inject_my_thread(&argc);
func(argc, argv);
- gc::remove_my_thread();
- gc::collect();
+ Collector::remove_my_thread();
+ Collector::collect();
return 0;
}
@@ -150,7 +150,7 @@
Thread::start(&tid, (int (*)(void *))startApp, thread_arg);
#else
func(argc, argv);
- gc::collect();
+ Collector::collect();
#endif
}
}
Modified: vmkit/trunk/lib/Mvm/GCMmap2/gc.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gc.cc?rev=48950&r1=48949&r2=48950&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/GCMmap2/gc.cc (original)
+++ vmkit/trunk/lib/Mvm/GCMmap2/gc.cc Sun Mar 30 10:23:15 2008
@@ -38,23 +38,23 @@
return GCCollector::gcrealloc(this, n);
}
-unsigned int gc::enable(unsigned int n) {
+unsigned int Collector::enable(unsigned int n) {
return GCCollector::enable(n);
}
-int gc::isStable(gc_lock_recovery_fct_t fct, int a0, int a1, int a2, int a3, int a4, int a5, int a6, int a7) {
+int Collector::isStable(gc_lock_recovery_fct_t fct, int a0, int a1, int a2, int a3, int a4, int a5, int a6, int a7) {
return GCCollector::isStable(fct, a0, a1, a2, a3, a4, a5, a6, a7);
}
-void gc::die_if_sigsegv_occured_during_collection(void *addr) {
+void Collector::die_if_sigsegv_occured_during_collection(void *addr) {
GCCollector::die_if_sigsegv_occured_during_collection(addr);
}
-void gc::gcStats(size_t &no, size_t &nbb) {
+void Collector::gcStats(size_t &no, size_t &nbb) {
GCCollector::gcStats(&no, &nbb);
}
-void gc::initialise(markerFn marker, void *base_sp) {
+void Collector::initialise(markerFn marker, void *base_sp) {
#ifdef HAVE_PTHREAD
Thread::initialise();
#endif
@@ -64,64 +64,64 @@
#endif
}
-void gc::destroy() {
+void Collector::destroy() {
GCCollector::destroy();
}
-void gc::inject_my_thread(void *base_sp) {
+void Collector::inject_my_thread(void *base_sp) {
#ifdef HAVE_PTHREAD
GCCollector::inject_my_thread(base_sp);
#endif
}
-void gc::maybeCollect() {
+void Collector::maybeCollect() {
GCCollector::maybeCollect();
}
-void gc::collect(void) {
+void Collector::collect(void) {
GCCollector::collect();
}
-gc *gc::begOf(const void *obj) {
+gc *Collector::begOf(const void *obj) {
return GCCollector::begOf((void*)obj);
}
-int gc::byteOffset(void *obj) {
+int Collector::byteOffset(void *obj) {
int beg = (intptr_t)GCCollector::begOf(obj);
intptr_t off = (intptr_t)obj;
return (off-beg);
}
-void gc::applyFunc(void (*func)(gc *o, void *data), void *data){
+void Collector::applyFunc(void (*func)(gc *o, void *data), void *data){
return GCCollector::applyFunc(func, data);
}
-int gc::getMaxMemory(void){
+int Collector::getMaxMemory(void){
return 0;
}
-int gc::getFreeMemory(void){
+int Collector::getFreeMemory(void){
return 0;
}
-int gc::getTotalMemory(void){
+int Collector::getTotalMemory(void){
return 0;
}
-void gc::setMaxMemory(size_t sz){
+void Collector::setMaxMemory(size_t sz){
}
-void gc::setMinMemory(size_t sz){
+void Collector::setMinMemory(size_t sz){
}
-void gc::registerMemoryError(void (*func)(unsigned int)){
+void Collector::registerMemoryError(void (*func)(unsigned int)){
GCCollector::internMemoryError = func;
onMemoryError = &GCCollector::defaultMemoryError;
}
-void gc::remove_my_thread() {
+void Collector::remove_my_thread() {
#ifdef HAVE_PTHREAD
GCCollector::remove_thread(GCCollector::threads->myloc());
#endif
Modified: vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cc?rev=48950&r1=48949&r2=48950&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cc (original)
+++ vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cc Sun Mar 30 10:23:15 2008
@@ -17,7 +17,7 @@
GCThread *GCCollector::threads;
#endif
-gc::markerFn GCCollector::_marker;
+Collector::markerFn GCCollector::_marker;
int GCCollector::_collect_freq_auto;
int GCCollector::_collect_freq_maybe;
Modified: vmkit/trunk/lib/Mvm/GCMmap2/gccollector.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gccollector.h?rev=48950&r1=48949&r2=48950&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/GCMmap2/gccollector.h (original)
+++ vmkit/trunk/lib/Mvm/GCMmap2/gccollector.h Sun Mar 30 10:23:15 2008
@@ -26,7 +26,7 @@
#endif
static GCAllocator *allocator; /* la machine à allouer de la mémoire */
- static gc::markerFn _marker; /* la fonction qui marque les racines */
+ static Collector::markerFn _marker; /* la fonction qui marque les racines */
static GCChunkNode *used_nodes; /* les noeuds mémoires utilisés */
static GCChunkNode *unused_nodes; /* les noeuds inutilisés */
@@ -79,7 +79,7 @@
lock();
}
- static void initialise(gc::markerFn marker);
+ static void initialise(Collector::markerFn marker);
static void destroy();
static int siggc();
Modified: vmkit/trunk/lib/Mvm/GCMmap2/gcinit.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gcinit.cc?rev=48950&r1=48949&r2=48950&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/GCMmap2/gcinit.cc (original)
+++ vmkit/trunk/lib/Mvm/GCMmap2/gcinit.cc Sun Mar 30 10:23:15 2008
@@ -25,7 +25,7 @@
return SIGGC;
}
-void GCCollector::initialise(gc::markerFn marker) {
+void GCCollector::initialise(Collector::markerFn marker) {
used_nodes = new GCChunkNode();
unused_nodes = new GCChunkNode();
Modified: vmkit/trunk/lib/Mvm/GCMmap2/main.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/main.cc?rev=48950&r1=48949&r2=48950&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/GCMmap2/main.cc (original)
+++ vmkit/trunk/lib/Mvm/GCMmap2/main.cc Sun Mar 30 10:23:15 2008
@@ -23,9 +23,9 @@
}
int main(int argc, char **argv) {
- gc::initialise(marker, 0);
+ Collector::initialise(marker, 0);
- gc::destroy();
+ Collector::destroy();
return 0;
}
Modified: vmkit/trunk/lib/Mvm/MvmMemoryManager.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/MvmMemoryManager.cpp?rev=48950&r1=48949&r2=48950&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/MvmMemoryManager.cpp (original)
+++ vmkit/trunk/lib/Mvm/MvmMemoryManager.cpp Sun Mar 30 10:23:15 2008
@@ -20,7 +20,7 @@
unsigned char* MvmMemoryManager::startFunctionBody(const Function* F,
uintptr_t &ActualSize) {
size_t nbb = ((ActualSize - 1) & -4) + 4 + sizeof(Method *);
- Code *res = (Code *)Object::gcmalloc(nbb, Code::VT);
+ Code *res = (Code *)gc::operator new(nbb, Code::VT);
Method* meth = gc_new(Method)(res, ActualSize);
res->method(meth);
@@ -31,7 +31,7 @@
unsigned char *MvmMemoryManager::allocateStub(unsigned StubSize,
unsigned Alignment) {
size_t nbb = ((StubSize - 1) & -4) + 4 + sizeof(Method *);
- Code *res = (Code *)Object::gcmalloc(nbb, Code::VT);
+ Code *res = (Code *)gc::operator new(nbb, Code::VT);
Method* meth = gc_new(Method)(res, StubSize);
res->method(meth);
Object::pushRoot(meth);
@@ -59,7 +59,7 @@
unsigned char *MvmMemoryManager::startExceptionTable(const Function* F,
uintptr_t &ActualSize) {
- ExceptionTable *res = (ExceptionTable*)Object::gcmalloc(ActualSize + 4,
+ ExceptionTable *res = (ExceptionTable*)gc::operator new(ActualSize + 4,
ExceptionTable::VT);
currentMethod->exceptionTable(res);
return (unsigned char*)(res + 1);
Modified: vmkit/trunk/lib/Mvm/Object.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Object.cc?rev=48950&r1=48949&r2=48950&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Object.cc (original)
+++ vmkit/trunk/lib/Mvm/Object.cc Sun Mar 30 10:23:15 2008
@@ -9,21 +9,10 @@
#include <stdlib.h>
-#include "mvm/CollectableArea.h"
#include "mvm/Method.h"
#include "mvm/Object.h"
#include "mvm/PrintBuffer.h"
#include "mvm/GC/GC.h"
-#include "mvm/Threads/Cond.h"
-#include "mvm/Threads/Key.h"
-#include "mvm/Threads/Locks.h"
-#include "mvm/VMLet.h"
-
-
-#include "llvm/DerivedTypes.h"
-#include "llvm/Module.h"
-#include "llvm/Type.h"
-
using namespace mvm;
@@ -33,11 +22,6 @@
VirtualTable *ExceptionTable::VT = 0;
VirtualTable *NativeString::VT = 0;
VirtualTable *PrintBuffer::VT = 0;
-//VirtualTable *Lock::VT = 0;
-//VirtualTable *LockNormal::VT = 0;
-//VirtualTable *LockRecursive::VT = 0;
-//VirtualTable *ThreadKey::VT = 0;
-//VirtualTable *Cond::VT = 0;
Object **Object::rootTable= 0;
@@ -62,22 +46,6 @@
rootTable[i]->markAndTrace();
}
-size_t Object::objectSize(void) const {
- return gc::objectSize();
-}
-
-bool Object::isObject() const {
- return gc::isObject(this);
-}
-
-Object *Object::begOf() const {
- return (Object *)gc::begOf(this);
-}
-
-Object *Object::gcmalloc(size_t sz, VirtualTable* VT) {
- return (Object *)operator new(sz, VT);
-}
-
void Object::initialise(void *b_sp) {
# define INIT(X) { \
X fake; \
@@ -88,16 +56,11 @@
INIT(Code);
INIT(NativeString);
INIT(PrintBuffer);
- //INIT(Lock);
- //INIT(LockNormal);
- //INIT(LockRecursive);
- //INIT(ThreadKey);
- //INIT(Cond);
INIT(ExceptionTable);
#undef INIT
- gc::initialise(Object::markAndTraceRoots, b_sp);
+ Collector::initialise(Object::markAndTraceRoots, b_sp);
}
void Code::tracer(size_t sz) {
@@ -123,7 +86,7 @@
PrintBuffer *PrintBuffer::writeObj(const Object *obj) {
- Object *beg = obj->begOf();
+ Object *beg = (Object*)Collector::begOf(obj);
if(beg) {
if(beg == obj)
@@ -161,10 +124,6 @@
return buf->contents()->cString();
}
-char * Object::printStatic(const Object * obj) {
- return obj->printString();
-}
-
void Object::print(PrintBuffer *buf) const {
buf->write("<Object@");
buf->writePtr((void*)this);
@@ -212,4 +171,4 @@
buf->write("\"");
}
-NativeString *PrintBuffer::getContents() { return contents(); }
+NativeString *PrintBuffer::getContents() { return contents(); }
Modified: vmkit/trunk/lib/Mvm/Sigsegv.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Sigsegv.cc?rev=48950&r1=48949&r2=48950&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Sigsegv.cc (original)
+++ vmkit/trunk/lib/Mvm/Sigsegv.cc Sun Mar 30 10:23:15 2008
@@ -47,7 +47,7 @@
#endif
/* Free the GC if it sisgegv'd. No other collection is possible */
- gc::die_if_sigsegv_occured_during_collection(addr);
+ Collector::die_if_sigsegv_occured_during_collection(addr);
// sys_exit(0);
if(client_sigsegv_handler)
Modified: vmkit/trunk/lib/N3/VMCore/BackTrace.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/BackTrace.cpp?rev=48950&r1=48949&r2=48950&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/BackTrace.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/BackTrace.cpp Sun Mar 30 10:23:15 2008
@@ -35,7 +35,7 @@
int real_size = backtrace((void**)(void*)ips, 100);
int n = 0;
while (n < real_size) {
- int *begIp = (int*)gc::begOf(ips[n++]);
+ int *begIp = (int*)Collector::begOf(ips[n++]);
if (begIp) {
const llvm::GlobalValue * glob =
mvm::jit::executionEngine->getGlobalValueAtAddress(begIp + 1);
@@ -70,7 +70,7 @@
int n = 0;
int i = 0;
while (n < real_size) {
- int *begIp = (int*)gc::begOf(ips[n++]);
+ int *begIp = (int*)Collector::begOf(ips[n++]);
if (begIp) {
const llvm::GlobalValue * glob =
mvm::jit::executionEngine->getGlobalValueAtAddress(begIp + 1);
@@ -99,7 +99,7 @@
int n = 0;
int i = 0;
while (n < real_size) {
- int *begIp = (int*)gc::begOf(ips[n++]);
+ int *begIp = (int*)Collector::begOf(ips[n++]);
if (begIp) {
const llvm::GlobalValue * glob =
mvm::jit::executionEngine->getGlobalValueAtAddress(begIp + 1);
Modified: vmkit/trunk/lib/N3/VMCore/CLIJit.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/CLIJit.cpp?rev=48950&r1=48949&r2=48950&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/CLIJit.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/CLIJit.cpp Sun Mar 30 10:23:15 2008
@@ -1409,7 +1409,7 @@
extern "C" bool isInCode(void* value) {
- mvm::Object* obj = (mvm::Object*)gc::begOf(value);
+ mvm::Object* obj = (mvm::Object*)Collector::begOf(value);
if (obj && obj->getVirtualTable() == mvm::Code::VT) {
return true;
} else {
Modified: vmkit/trunk/lib/N3/VMCore/N3Initialise.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/N3Initialise.cpp?rev=48950&r1=48949&r2=48950&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/N3Initialise.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/N3Initialise.cpp Sun Mar 30 10:23:15 2008
@@ -226,7 +226,7 @@
uint64 size = mvm::jit::getTypeSize(type->virtualType->getContainedType(0)) + sizeof(const UTF8*) + sizeof(llvm::GlobalVariable*);
type->virtualInstance =
- (VMObject*)mvm::Object::gcmalloc(size, type->virtualInstance->getVirtualTable());
+ (VMObject*)gc::operator new(size, type->virtualInstance->getVirtualTable());
type->virtualInstance->initialise(type);
}
Modified: vmkit/trunk/lib/N3/VMCore/PNetLib.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/PNetLib.cpp?rev=48950&r1=48949&r2=48950&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/PNetLib.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/PNetLib.cpp Sun Mar 30 10:23:15 2008
@@ -1137,7 +1137,7 @@
}
extern "C" void System_GC_Collect() {
- gc::collect();
+ Collector::collect();
}
Modified: vmkit/trunk/lib/N3/VMCore/VMArray.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/VMArray.cpp?rev=48950&r1=48949&r2=48950&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/VMArray.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/VMArray.cpp Sun Mar 30 10:23:15 2008
@@ -27,9 +27,9 @@
else if (n > VMArray::MaxArraySize) \
VMThread::get()->vm->outOfMemoryError(n); \
name* res = (name*) \
- Object::gcmalloc(sizeof(name) + n * size, VMObject::VT); \
+ gc::operator new(sizeof(name) + n * size, VMObject::VT); \
res->initialise(atype, n); \
- res->setVT(name::VT); \
+ res->setVirtualTable(name::VT); \
return res; \
}
@@ -178,7 +178,7 @@
VMThread::get()->vm->negativeArraySizeException(n);
else if (n > VMArray::MaxArraySize)
VMThread::get()->vm->outOfMemoryError(n);
- UTF8* res = (UTF8*)Object::gcmalloc(sizeof(UTF8) + n * sizeof(uint16),
+ UTF8* res = (UTF8*)gc::operator new(sizeof(UTF8) + n * sizeof(uint16),
UTF8::VT);
res->initialise(atype, n);
return res;
Modified: vmkit/trunk/lib/N3/VMCore/VMClass.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/VMClass.cpp?rev=48950&r1=48949&r2=48950&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/VMClass.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/VMClass.cpp Sun Mar 30 10:23:15 2008
@@ -265,7 +265,7 @@
VirtualTable* VT = CLIJit::makeVT(cl, true);
uint64 size = mvm::jit::getTypeSize(cl->staticType->getContainedType(0));
- cl->staticInstance = (VMObject*)mvm::Object::gcmalloc(size, VT);
+ cl->staticInstance = (VMObject*)gc::operator new(size, VT);
cl->staticInstance->initialise(cl);
for (std::vector<VMField*>::iterator i = cl->staticFields.begin(),
@@ -366,7 +366,7 @@
VirtualTable* VT = CLIJit::makeVT(this, false);
uint64 size = mvm::jit::getTypeSize(cl->virtualType->getContainedType(0));
- cl->virtualInstance = (VMObject*)mvm::Object::gcmalloc(size, VT);
+ cl->virtualInstance = (VMObject*)gc::operator new(size, VT);
cl->virtualInstance->initialise(cl);
for (std::vector<VMField*>::iterator i = cl->virtualFields.begin(),
More information about the llvm-commits
mailing list