diff options
author | Filippos Karapetis | 2010-06-29 09:02:59 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-06-29 09:02:59 +0000 |
commit | 0b470dde636f4706a9f56c13364d87a76dd9ec86 (patch) | |
tree | 10e1936c91d788c7633cc9b272d6d91e9b102bc9 | |
parent | 316e96df2b48b1986488bfd57db37b9708f3e4ca (diff) | |
download | scummvm-rg350-0b470dde636f4706a9f56c13364d87a76dd9ec86.tar.gz scummvm-rg350-0b470dde636f4706a9f56c13364d87a76dd9ec86.tar.bz2 scummvm-rg350-0b470dde636f4706a9f56c13364d87a76dd9ec86.zip |
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.
svn-id: r50486
-rw-r--r-- | engines/sci/engine/gc.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/engines/sci/engine/gc.cpp b/engines/sci/engine/gc.cpp index 3c8c1f17a8..3dd7acfa1c 100644 --- a/engines/sci/engine/gc.cpp +++ b/engines/sci/engine/gc.cpp @@ -45,7 +45,7 @@ struct WorklistManager { _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 @@ reg_t_hash_map *find_all_used_references(EngineState *s) { 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 @@ reg_t_hash_map *find_all_used_references(EngineState *s) { 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 @@ reg_t_hash_map *find_all_used_references(EngineState *s) { 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)); } } } |