gcstack-access
author Benjamin Smedberg <benjamin@smedbergs.us>
Sun, 20 Apr 2008 21:43:09 -0400
changeset 42 53c5098cb79e0223016b6901194a89d913f235fb
parent 28 70c871a7a5e6175cbd6996016b04339d09288922
permissions -rw-r--r--
Updates and imports

diff --git a/MMgc/GC.cpp b/MMgc/GC.cpp
--- a/MMgc/GC.cpp
+++ b/MMgc/GC.cpp
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
@@ -614,6 +615,8 @@ namespace MMgc
 		SAMPLE_CHECK();
 
 		GCStack<GCWorkItem> work;
+
+		m_currentQueue = &work;
 		{
 #ifdef GCHEAP_LOCK
 			GCAcquireSpinlock lock(m_rootListLock);
@@ -643,6 +646,8 @@ namespace MMgc
 			Mark(work);
 		}
 		
+		m_currentQueue = NULL;
+
 		SAMPLE_CHECK();
 	}
 #endif
@@ -2702,6 +2707,8 @@ bail:
 			return;
 		} 
 
+		m_currentQueue = &m_incrementalWork;
+
 #ifdef DEBUGGER
 		StartGCActivity();
 #endif
@@ -2735,6 +2742,8 @@ bail:
 
 		lastMarkTicks = GetPerformanceCounter();
 		markTicks += lastMarkTicks - start;
+
+		m_currentQueue = NULL;
 
 #ifdef DEBUGGER
 		if(GC::gcstats) {
diff --git a/MMgc/GC.h b/MMgc/GC.h
--- a/MMgc/GC.h
+++ b/MMgc/GC.h
@@ -678,6 +678,9 @@ namespace MMgc
 		 */
 		bool incremental;
 
+		// This member is only available during tracing
+		GCStack<GCWorkItem> *m_currentQueue;
+
 		// -- Interface
 		GC(GCHeap *heap);
 		virtual ~GC();
@@ -1177,8 +1180,7 @@ namespace MMgc
 
 		uintptr	GetStackTop() const;
 
-		// for deciding a tree of things should be scanned from presweep
-		void PushWorkItem(const GCWorkItem &item) { PushWorkItem(m_incrementalWork, item); }
+		void PushWorkItem(const GCWorkItem &item) { PushWorkItem(*m_currentQueue, item); }
 
 	private: