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

waltervn at users.sourceforge.net waltervn at users.sourceforge.net
Sat Feb 6 20:41:56 CET 2010


Revision: 47940
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47940&view=rev
Author:   waltervn
Date:     2010-02-06 19:41:55 +0000 (Sat, 06 Feb 2010)

Log Message:
-----------
SCI: Revert r47925 and put fix inside GC instead.

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

Modified: scummvm/trunk/engines/sci/engine/gc.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/gc.cpp	2010-02-06 19:35:51 UTC (rev 47939)
+++ scummvm/trunk/engines/sci/engine/gc.cpp	2010-02-06 19:41:55 UTC (rev 47940)
@@ -76,14 +76,25 @@
 	WorklistManager wm;
 	uint i;
 
+	assert(!s->_executionStack.empty());
+
 	// Initialise
 	// Init: Registers
 	wm.push(s->r_acc);
 	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;
 	{
-		ExecStack &xs = s->_executionStack.back();
+		iter = s->_executionStack.reverse_begin();
+
+		// 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));
+
+		ExecStack &xs = *iter;
 		reg_t *pos;
 
 		for (pos = s->stack_base; pos < xs.sp; pos++)
@@ -93,7 +104,6 @@
 	debugC(2, kDebugLevelGC, "[GC] -- Finished adding value stack");
 
 	// Init: Execution Stack
-	Common::List<ExecStack>::iterator iter;
 	for (iter = s->_executionStack.begin();
 	     iter != s->_executionStack.end(); ++iter) {
 		ExecStack &es = *iter;

Modified: scummvm/trunk/engines/sci/engine/kmisc.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmisc.cpp	2010-02-06 19:35:51 UTC (rev 47939)
+++ scummvm/trunk/engines/sci/engine/kmisc.cpp	2010-02-06 19:41:55 UTC (rev 47940)
@@ -159,11 +159,7 @@
 }
 
 reg_t kFlushResources(EngineState *s, int argc, reg_t *argv) {
-	// We used to call run_gc() directly from here. This is no longer safe
-	// as we now always add our fake "kernel" stack frame for debugging
-	// purposes. Instead of calling run_gc(), we set gc_countdown to 1
-	// to make the garbage collector run before the next kernel function.
-	s->gc_countdown = 1;
+	run_gc(s);
 	debugC(2, kDebugLevelRoom, "Entering room number %d", argv[0].toUint16());
 	return s->r_acc;
 }


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