Push some patches.
authorjorendorff@mozilla.com
Wed, 23 Jan 2008 14:57:45 -0600
changeset 36 90c061d30873
parent 34 ec1155ba48ec
child 37 da226d4db309
push id1
push userbsmedberg@mozilla.com
push dateMon, 21 Apr 2008 01:54:18 +0000
Push some patches.
mmgc-maybegc
mmgc-threadsafe-gctests
series
deleted file mode 100644
--- a/mmgc-maybegc
+++ /dev/null
@@ -1,70 +0,0 @@
-diff --git a/MMgc/GC.cpp b/MMgc/GC.cpp
---- a/MMgc/GC.cpp
-+++ b/MMgc/GC.cpp
-@@ -745,6 +745,42 @@ namespace MMgc
- 		return item;
- 	}
- 
-+	void GC::MaybeGC(bool callerHasActiveRequest)
-+	{
-+		if (greedy) {
-+			CollectWithBookkeeping(false, callerHasActiveRequest);
-+		} else if (marking) {
-+			IncrementalMark();
-+		} else {
-+#ifdef MMGC_THREADSAFE
-+			GCAutoLock _lock(m_lock);
-+#endif
-+
-+			// Burst logic to prevent collections from happening back to back.
-+			uint64 now = GetPerformanceCounter();
-+			if (now - lastSweepTicks <= kMarkSweepBurstTicks)
-+				return;
-+
-+			// Definitely start GC if the heap expanded due to FixedMalloc
-+			// allocations.  The same heuristic applies to incremental and
-+			// non-incremental.
-+			bool force = (heapSizeAtLastAlloc > collectThreshold &&
-+						  heapSizeAtLastAlloc < heap->GetTotalHeapSize());
-+
-+			if (incremental) {
-+				if (force || (totalGCPages > collectThreshold &&
-+							  allocsSinceCollect * kFreeSpaceDivisor >= totalGCPages)) {
-+					StartIncrementalMark();
-+				}
-+			} else {
-+				// Collect only if the heap is completely full (a conservative
-+				// heuristic).
-+				if (force || heap->GetFreeHeapSize() == 0)
-+					CollectWithBookkeeping(true, callerHasActiveRequest);
-+			}
-+		}
-+	}
-+
- 	void *GC::Calloc(size_t num, size_t elsize, int flags, int skip)
- 	{
- 		uint64 size = (uint64)num * (uint64)elsize;
-diff --git a/MMgc/GC.h b/MMgc/GC.h
---- a/MMgc/GC.h
-+++ b/MMgc/GC.h
-@@ -673,6 +673,20 @@ namespace MMgc
- 		void Collect();
- 
- 		/**
-+		 * Perform some GC-related work if needed.  Call this during
-+		 * application down time.
-+		 *
-+		 * In incremental mode, this may result in a call to
-+		 * StartIncrementalMark() or IncrementalMark(), which may in turn push
-+		 * the current GC cycle to completion.  In non-incremental mode, this
-+		 * heuristically decides whether to do a full Collect().
-+		 *
-+		 * @param callerHasActiveRequest
-+		 *     Must be true iff the calling thread is already in a request.
-+		 */
-+		void MaybeGC(bool callerHasActiveRequest=false);
-+
-+		/**
- 		* flags to be passed as second argument to alloc
- 		*/
- 		enum AllocFlags
deleted file mode 100644
--- a/mmgc-threadsafe-gctests
+++ /dev/null
@@ -1,75 +0,0 @@
-diff --git a/MMgc/GCTests.cpp b/MMgc/GCTests.cpp
---- a/MMgc/GCTests.cpp
-+++ b/MMgc/GCTests.cpp
-@@ -53,6 +53,15 @@ namespace MMgc
- {
- 	GC *gc;
- 
-+	void collect()
-+	{
-+#ifdef MMGC_THREADSAFE
-+		gc->CollectFromRequest();
-+#else
-+		gc->Collect();
-+#endif
-+	}
-+
- 	GCWeakRef* createWeakRef(int extra=0)
- 	{
- 		// Bogusly use up some extra stack.
-@@ -63,11 +72,11 @@ namespace MMgc
- 		// pointer there causes the temporary to be marked, and not collected,
- 		// which causes tests to fail with assertions.
- 		///
--		// The extra 32 bytes here causes the temporary to end up higher on
-+		// The extra 64 bytes here causes the temporary to end up higher on
- 		// the stack (numerically lesser address, on Intel at least) where
- 		// CleanStack will clobber it.
- 		//
--		char buf[32];
-+		char buf[64];
- 		sprintf(buf, "%d", extra);  // don't optimize away buf
- 
- 		return (new (gc, extra) GCObject())->GetWeakRef();
-@@ -76,9 +85,9 @@ namespace MMgc
- 	void weakRefSweepSmall()
- 	{
- 		GCWeakRef *ref = createWeakRef();
--		gc->Collect();
-+		collect();
- 		gc->CleanStack(true);
--		gc->Collect();
-+		collect();
- 		(void)ref;
- 		GCAssert(ref->get() == NULL);
- 	}
-@@ -86,9 +95,9 @@ namespace MMgc
- 	void weakRefSweepLarge()
- 	{
- 		GCWeakRef *ref = createWeakRef(5000);
--		gc->Collect();
-+		collect();
- 		gc->CleanStack(true);
--		gc->Collect();
-+		collect();
- 		(void)ref;
- 		GCAssert(ref->get() == NULL);
- 	}
-@@ -164,11 +173,17 @@ namespace MMgc
- 	void RunGCTests(GC *g)
- 	{
- 		gc = g;
-+#ifdef MMGC_THREADSAFE
-+		g->OnEnterRequest();
-+#endif
- 		weakRefSweepSmall();
- 		weakRefSweepLarge();
- 		weakRefFreeSmall();
- 		weakRefFreeLarge();
- 		drcApolloTest();
-+#ifdef MMGC_THREADSAFE
-+		g->OnLeaveRequest();
-+#endif
- 	}
- }
- 
--- a/series
+++ b/series
@@ -1,5 +1,3 @@
-mmgc-threadsafe-gctests
-mmgc-maybegc
 tweak-esc-main.sh
 mmgc-graphviz
 mmgc-bit-checks