[Scummvm-cvs-logs] SF.net SVN: scummvm:[50486] scummvm/trunk/engines/sci/engine/gc.cpp

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Tue Jun 29 11:02:59 CEST 2010


Revision: 50486
          http://scummvm.svn.sourceforge.net/scummvm/?rev=50486&view=rev
Author:   thebluegr
Date:     2010-06-29 09:02:59 +0000 (Tue, 29 Jun 2010)

Log Message:
-----------
SCI: Some cleanup of the GC code. 

The version of push() that pushes arrays inside WorklistManager has been renamed to pushArray(), so that it's more apparent where arrays are pushed.

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/gc.cpp

Modified: scummvm/trunk/engines/sci/engine/gc.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/gc.cpp	2010-06-29 09:01:17 UTC (rev 50485)
+++ scummvm/trunk/engines/sci/engine/gc.cpp	2010-06-29 09:02:59 UTC (rev 50486)
@@ -45,7 +45,7 @@
 		_worklist.push_back(reg);
 	}
 
-	void push(const Common::Array<reg_t> &tmp) {
+	void pushArray(const Common::Array<reg_t> &tmp) {
 		for (Common::Array<reg_t>::const_iterator it = tmp.begin(); it != tmp.end(); ++it)
 			push(*it);
 	}
@@ -82,22 +82,19 @@
 	wm.push(s->r_prev);
 	// Init: Value Stack
 	// We do this one by hand since the stack doesn't know the current execution stack
-	Common::List<ExecStack>::iterator iter;
-	{
-		iter = s->_executionStack.reverse_begin();
+	Common::List<ExecStack>::iterator iter = s->_executionStack.reverse_begin();
 
-		// Skip fake kernel stack frame if it's on top
-		if (((*iter).type == EXEC_STACK_TYPE_KERNEL))
-			--iter;
+	// Skip fake kernel stack frame if it's on top
+	if (((*iter).type == EXEC_STACK_TYPE_KERNEL))
+		--iter;
 
-		assert((iter != s->_executionStack.end()) && ((*iter).type != EXEC_STACK_TYPE_KERNEL));
+	assert((iter != s->_executionStack.end()) && ((*iter).type != EXEC_STACK_TYPE_KERNEL));
 
-		ExecStack &xs = *iter;
-		reg_t *pos;
+	ExecStack &xs = *iter;
+	reg_t *pos;
 
-		for (pos = s->stack_base; pos < xs.sp; pos++)
-			wm.push(*pos);
-	}
+	for (pos = s->stack_base; pos < xs.sp; pos++)
+		wm.push(*pos);
 
 	debugC(2, kDebugLevelGC, "[GC] -- Finished adding value stack");
 
@@ -117,15 +114,16 @@
 	debugC(2, kDebugLevelGC, "[GC] -- Finished adding execution stack");
 
 	// Init: Explicitly loaded scripts
-	for (i = 1; i < segMan->_heap.size(); i++)
+	for (i = 1; i < segMan->_heap.size(); i++) {
 		if (segMan->_heap[i]
 		        && segMan->_heap[i]->getType() == SEG_TYPE_SCRIPT) {
 			Script *script = (Script *)segMan->_heap[i];
 
 			if (script->getLockers()) { // Explicitly loaded?
-				wm.push(script->listObjectReferences());
+				wm.pushArray(script->listObjectReferences());
 			}
 		}
+	}
 
 	debugC(2, kDebugLevelGC, "[GC] -- Finished explicitly loaded scripts, done with root set");
 
@@ -138,7 +136,7 @@
 			debugC(2, kDebugLevelGC, "[GC] Checking %04x:%04x", PRINT_REG(reg));
 			if (reg.segment < segMan->_heap.size() && segMan->_heap[reg.segment]) {
 				// Valid heap object? Find its outgoing references!
-				wm.push(segMan->_heap[reg.segment]->listAllOutgoingReferences(reg));
+				wm.pushArray(segMan->_heap[reg.segment]->listAllOutgoingReferences(reg));
 			}
 		}
 	}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list