aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/gc.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2009-07-06 10:39:22 +0000
committerFilippos Karapetis2009-07-06 10:39:22 +0000
commit522b161becfc702350d84cf431b716b1330286db (patch)
tree9ba220b8c1b8eeb247c6b2d35d8bc5bf1943a234 /engines/sci/engine/gc.cpp
parent3ce15cb9b7c77560cd0f2b67e4407b9889ea0f9b (diff)
downloadscummvm-rg350-522b161becfc702350d84cf431b716b1330286db.tar.gz
scummvm-rg350-522b161becfc702350d84cf431b716b1330286db.tar.bz2
scummvm-rg350-522b161becfc702350d84cf431b716b1330286db.zip
Replaced sciprintf() calls with printf, DebugPrintf, warning and error calls
svn-id: r42167
Diffstat (limited to 'engines/sci/engine/gc.cpp')
-rw-r--r--engines/sci/engine/gc.cpp32
1 files changed, 12 insertions, 20 deletions
diff --git a/engines/sci/engine/gc.cpp b/engines/sci/engine/gc.cpp
index 1bfb66987e..63a20ddf25 100644
--- a/engines/sci/engine/gc.cpp
+++ b/engines/sci/engine/gc.cpp
@@ -29,7 +29,6 @@
namespace Sci {
//#define DEBUG_GC
-//#define DEBUG_GC_VERBOSE
struct WorklistManager {
Common::Array<reg_t> _worklist;
@@ -39,9 +38,7 @@ struct WorklistManager {
if (!reg.segment) // No numbers
return;
- #ifdef DEBUG_GC_VERBOSE
- sciprintf("[GC] Adding %04x:%04x\n", PRINT_REG(reg));
- #endif
+ debugC(2, kDebugLevelGC, "[GC] Adding %04x:%04x\n", PRINT_REG(reg));
if (_map.contains(reg))
return; // already dealt with it
@@ -92,9 +89,8 @@ reg_t_hash_map *find_all_used_references(EngineState *s) {
for (pos = s->stack_base; pos < xs.sp; pos++)
wm.push(*pos);
}
-#ifdef DEBUG_GC_VERBOSE
- sciprintf("[GC] -- Finished adding value stack");
-#endif
+
+ debugC(2, kDebugLevelGC, "[GC] -- Finished adding value stack");
// Init: Execution Stack
Common::List<ExecStack>::iterator iter;
@@ -109,9 +105,8 @@ reg_t_hash_map *find_all_used_references(EngineState *s) {
wm.push(*(es.getVarPointer(s)));
}
}
-#ifdef DEBUG_GC_VERBOSE
- sciprintf("[GC] -- Finished adding execution stack");
-#endif
+
+ debugC(2, kDebugLevelGC, "[GC] -- Finished adding execution stack");
// Init: Explicitly loaded scripts
for (i = 1; i < sm->_heap.size(); i++)
@@ -129,18 +124,15 @@ reg_t_hash_map *find_all_used_references(EngineState *s) {
}
}
}
-#ifdef DEBUG_GC_VERBOSE
- sciprintf("[GC] -- Finished explicitly loaded scripts, done with root set");
-#endif
+
+ debugC(2, kDebugLevelGC, "[GC] -- Finished explicitly loaded scripts, done with root set\n");
// Run Worklist Algorithm
while (!wm._worklist.empty()) {
reg_t reg = wm._worklist.back();
wm._worklist.pop_back();
if (reg.segment != s->stack_segment) { // No need to repeat this one
-#ifdef DEBUG_GC_VERBOSE
- sciprintf("[GC] Checking %04x:%04x\n", PRINT_REG(reg));
-#endif
+ debugC(2, kDebugLevelGC, "[GC] Checking %04x:%04x\n", PRINT_REG(reg));
if (reg.segment < sm->_heap.size() && sm->_heap[reg.segment])
sm->_heap[reg.segment]->listAllOutgoingReferences(s, reg, &wm, add_outgoing_refs);
}
@@ -170,7 +162,7 @@ void free_unless_used(void *refcon, reg_t addr) {
// Not found -> we can free it
deallocator->mobj->freeAtAddress(deallocator->segmgr, addr);
#ifdef DEBUG_GC
- sciprintf("[GC] Deallocating %04x:%04x\n", PRINT_REG(addr));
+ debugC(2, kDebugLevelGC, "[GC] Deallocating %04x:%04x\n", PRINT_REG(addr));
deallocator->segcount[deallocator->mobj->getType()]++;
#endif
}
@@ -183,7 +175,7 @@ void run_gc(EngineState *s) {
SegManager *sm = s->seg_manager;
#ifdef DEBUG_GC
- sciprintf("[GC] Running...\n");
+ debugC(2, kDebugLevelGC, "[GC] Running...\n");
memset(&(deallocator.segcount), 0, sizeof(int) * (MEM_OBJ_MAX + 1));
#endif
@@ -205,10 +197,10 @@ void run_gc(EngineState *s) {
#ifdef DEBUG_GC
{
int i;
- sciprintf("[GC] Summary:\n");
+ debugC(2, kDebugLevelGC, "[GC] Summary:\n");
for (i = 0; i <= MEM_OBJ_MAX; i++)
if (deallocator.segcount[i])
- sciprintf("\t%d\t* %s\n", deallocator.segcount[i], deallocator.segnames[i]);
+ debugC(2, kDebugLevelGC, "\t%d\t* %s\n", deallocator.segcount[i], deallocator.segnames[i]);
}
#endif
}