gcstack-access
author benjamin@smedbergs.us
Wed, 12 Dec 2007 11:54:22 -0500
changeset 22 0ca31a2285356f7802d7a2ecda77ba7591f833cc
parent 5 399ff94b3d77e32c0b43ba646ea5ebc54f86589d
child 28 70c871a7a5e6175cbd6996016b04339d09288922
permissions -rw-r--r--
Merge changes from jorendorff

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
  *
@@ -458,6 +459,8 @@ namespace MMgc
 		SAMPLE_CHECK();
 
 		GCStack<GCWorkItem> work;
+
+		m_currentQueue = &work;
 		{
 #ifdef GCHEAP_LOCK
 			GCAcquireSpinlock lock(m_rootListLock);
@@ -484,6 +487,8 @@ namespace MMgc
 			Mark(work);
 		}
 		
+		m_currentQueue = NULL;
+
 		SAMPLE_CHECK();
 	}
 
@@ -2376,6 +2381,8 @@ bail:
 			return;
 		} 
 
+		m_currentQueue = &m_incrementalWork;
+
 #ifdef DEBUGGER
 		StartGCActivity();
 #endif
@@ -2409,6 +2416,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
@@ -548,6 +548,9 @@ namespace MMgc
 
 		bool incremental;
 
+		// This member is only available during tracing
+		GCStack<GCWorkItem> *m_currentQueue;
+
 		// -- Interface
 		GC(GCHeap *heap);
 		virtual ~GC();
@@ -901,7 +904,7 @@ namespace MMgc
 
 		uintptr	GetStackTop() const;		
 		
-		void PushWorkItem(const GCWorkItem &item) { PushWorkItem(m_incrementalWork, item); }
+		void PushWorkItem(const GCWorkItem &item) { PushWorkItem(*m_currentQueue, item); }
 
 	private: