diff options
author | Walter van Niftrik | 2010-02-06 19:41:55 +0000 |
---|---|---|
committer | Walter van Niftrik | 2010-02-06 19:41:55 +0000 |
commit | 1e67b56eee611a52f6c7fa9d3b5d17bda741c995 (patch) | |
tree | 5338dc4a23fee13053613024ee20bec870bd8603 /engines/sci/engine | |
parent | 4cae2b13e2acbd81e4b726f1e409c5615eda7967 (diff) | |
download | scummvm-rg350-1e67b56eee611a52f6c7fa9d3b5d17bda741c995.tar.gz scummvm-rg350-1e67b56eee611a52f6c7fa9d3b5d17bda741c995.tar.bz2 scummvm-rg350-1e67b56eee611a52f6c7fa9d3b5d17bda741c995.zip |
SCI: Revert r47925 and put fix inside GC instead.
svn-id: r47940
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/gc.cpp | 14 | ||||
-rw-r--r-- | engines/sci/engine/kmisc.cpp | 6 |
2 files changed, 13 insertions, 7 deletions
diff --git a/engines/sci/engine/gc.cpp b/engines/sci/engine/gc.cpp index bcc3ba34f6..c2f1c15776 100644 --- a/engines/sci/engine/gc.cpp +++ b/engines/sci/engine/gc.cpp @@ -76,14 +76,25 @@ reg_t_hash_map *find_all_used_references(EngineState *s) { 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 @@ reg_t_hash_map *find_all_used_references(EngineState *s) { 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; diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index 0c190d0e94..bd1cf587ea 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -159,11 +159,7 @@ reg_t kMemorySegment(EngineState *s, int argc, reg_t *argv) { } 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; } |