[llvm-commits] [vmkit] r50350 - in /vmkit/trunk/lib/Mvm/GCMmap2: gccollector.cpp gccollector.h gcinit.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Mon Apr 28 09:09:13 PDT 2008
Author: geoffray
Date: Mon Apr 28 11:09:12 2008
New Revision: 50350
URL: http://llvm.org/viewvc/llvm-project?rev=50350&view=rev
Log:
In a service environment, the only distinction between GCs is the collection frequency.
Modified:
vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp
vmkit/trunk/lib/Mvm/GCMmap2/gccollector.h
vmkit/trunk/lib/Mvm/GCMmap2/gcinit.cpp
Modified: vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp?rev=50350&r1=50349&r2=50350&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp (original)
+++ vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp Mon Apr 28 11:09:12 2008
@@ -11,7 +11,7 @@
using namespace mvm;
-#ifndef MULTIPLE_GC
+#if !defined(MULTIPLE_GC) || defined(SERVICE_GC)
GCAllocator *GCCollector::allocator = 0;
#ifdef HAVE_PTHREAD
GCThread *GCCollector::threads;
@@ -19,13 +19,6 @@
GCCollector::markerFn GCCollector::_marker;
-int GCCollector::_collect_freq_auto;
-int GCCollector::_collect_freq_maybe;
-int GCCollector::_since_last_collection;
-
-bool GCCollector::_enable_auto;
-bool GCCollector::_enable_maybe;
-bool GCCollector::_enable_collection;
int GCCollector::status;
@@ -33,13 +26,24 @@
GCChunkNode *GCCollector::unused_nodes;
unsigned int GCCollector::current_mark;
-#else
+#endif
+
+#ifdef MULTIPLE_GC
GCCollector* GCCollector::bootstrapGC;
#endif
#ifdef SERVICE_GC
GCCollector* GCCollector::collectingGC;
-unsigned int GCCollector::current_mark;
+#endif
+
+#if !defined(SERVICE_GC) && !defined(MULTIPLE_GC)
+int GCCollector::_collect_freq_auto;
+int GCCollector::_collect_freq_maybe;
+int GCCollector::_since_last_collection;
+
+bool GCCollector::_enable_auto;
+bool GCCollector::_enable_maybe;
+bool GCCollector::_enable_collection;
#endif
void GCCollector::do_collect() {
Modified: vmkit/trunk/lib/Mvm/GCMmap2/gccollector.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gccollector.h?rev=50350&r1=50349&r2=50350&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/GCMmap2/gccollector.h (original)
+++ vmkit/trunk/lib/Mvm/GCMmap2/gccollector.h Mon Apr 28 11:09:12 2008
@@ -23,30 +23,38 @@
#define STATIC static
#endif
+#if defined(MULTIPLE_GC) && !defined(SERVICE_GC)
+#define STATIC_FIELD
+#else
+#define STATIC_FIELD static
+#endif
+
+#if defined(MULTIPLE_GC)
+#define STATIC_NO_SERVICE
+#else
+#define STATIC_NO_SERVICE static
+#endif
+
namespace mvm {
class GCCollector : public Collector {
#ifdef HAVE_PTHREAD
friend class GCThread;
#endif
- STATIC GCAllocator *allocator; /* The allocator */
-
+ STATIC_FIELD GCAllocator *allocator; /* The allocator */
- STATIC GCChunkNode *used_nodes; /* Used memory nodes */
- STATIC GCChunkNode *unused_nodes; /* Unused memory nodes */
-#ifdef SERVICE_GC
- static unsigned int current_mark;
-#else
- STATIC unsigned int current_mark;
-#endif
- STATIC int _collect_freq_auto; /* Collection frequency in gcmalloc/gcrealloc */
- STATIC int _collect_freq_maybe; /* Collection frequency in maybeCollect */
- STATIC int _since_last_collection; /* Bytes left since last collection */
- STATIC bool _enable_auto; /* Automatic collection? */
- STATIC bool _enable_maybe; /* Collection in maybeCollect()? */
- STATIC bool _enable_collection; /* collection authorized? */
- STATIC int status;
+ STATIC_FIELD GCChunkNode *used_nodes; /* Used memory nodes */
+ STATIC_FIELD GCChunkNode *unused_nodes; /* Unused memory nodes */
+ STATIC_FIELD unsigned int current_mark;
+
+ STATIC_NO_SERVICE int _collect_freq_auto; /* Collection frequency in gcmalloc/gcrealloc */
+ STATIC_NO_SERVICE int _collect_freq_maybe; /* Collection frequency in maybeCollect */
+ STATIC_NO_SERVICE int _since_last_collection; /* Bytes left since last collection */
+ STATIC_NO_SERVICE bool _enable_auto; /* Automatic collection? */
+ STATIC_NO_SERVICE bool _enable_maybe; /* Collection in maybeCollect()? */
+ STATIC_NO_SERVICE bool _enable_collection; /* collection authorized? */
+ STATIC_FIELD int status;
enum { stat_collect, stat_finalize, stat_alloc, stat_broken };
@@ -75,14 +83,14 @@
}
public:
- STATIC Collector::markerFn _marker; /* The function which traces roots */
+ STATIC_FIELD Collector::markerFn _marker; /* The function which traces roots */
#ifdef SERVICE_GC
static GCCollector* collectingGC;
#endif
#ifdef MULTIPLE_GC
static GCCollector* bootstrapGC;
#endif
- STATIC GCThread *threads; /* le gestionnaire de thread et de synchro */
+ STATIC_FIELD GCThread *threads; /* le gestionnaire de thread et de synchro */
static void (*internMemoryError)(unsigned int);
#ifdef HAVE_PTHREAD
Modified: vmkit/trunk/lib/Mvm/GCMmap2/gcinit.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gcinit.cpp?rev=50350&r1=50349&r2=50350&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/GCMmap2/gcinit.cpp (original)
+++ vmkit/trunk/lib/Mvm/GCMmap2/gcinit.cpp Mon Apr 28 11:09:12 2008
@@ -26,19 +26,15 @@
}
void GCCollector::initialise(Collector::markerFn marker) {
-
+
+#ifdef SERVICE_GC
+ if (this == bootstrapGC) {
+#endif
used_nodes = new GCChunkNode();
unused_nodes = new GCChunkNode();
#ifdef HAVE_PTHREAD
-#ifdef SERVICE_GC
- if (this != bootstrapGC)
- threads = bootstrapGC->threads;
- else
- threads = new GCThread();
-#else
threads = new GCThread();
#endif
-#endif
struct sigaction sa;
sigset_t mask;
@@ -60,10 +56,11 @@
used_nodes->alone();
+ current_mark = 0;
+ status = stat_alloc;
#ifdef SERVICE_GC
- if (this == bootstrapGC)
+ }
#endif
- current_mark = 0;
_collect_freq_auto = def_collect_freq_auto;
_collect_freq_maybe = def_collect_freq_maybe;
@@ -74,7 +71,6 @@
_enable_collection = 1;
_enable_maybe = 1;
- status = stat_alloc;
}
void GCCollector::destroy() {
More information about the llvm-commits
mailing list