diff options
author | Filippos Karapetis | 2010-08-31 09:45:36 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-08-31 09:45:36 +0000 |
commit | 07e4fe9fdcb2a42f1c3d0de08aa9e92d0f98aba8 (patch) | |
tree | 6fbcd8f3f6d97ec317dbcfac61fd4e1e224f4657 /engines/sci | |
parent | ffb414d2655737a78fb192feb4a2828160dd99ad (diff) | |
download | scummvm-rg350-07e4fe9fdcb2a42f1c3d0de08aa9e92d0f98aba8.tar.gz scummvm-rg350-07e4fe9fdcb2a42f1c3d0de08aa9e92d0f98aba8.tar.bz2 scummvm-rg350-07e4fe9fdcb2a42f1c3d0de08aa9e92d0f98aba8.zip |
SCI: Disabled some debug related GC code, which effectively
wastes cycles if we're not debugging the GC
svn-id: r52465
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/engine/gc.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/engines/sci/engine/gc.cpp b/engines/sci/engine/gc.cpp index 936b83d760..c1939c6566 100644 --- a/engines/sci/engine/gc.cpp +++ b/engines/sci/engine/gc.cpp @@ -28,6 +28,8 @@ namespace Sci { +//#define GC_DEBUG_CODE + struct WorklistManager { Common::Array<reg_t> _worklist; AddrSet _map; @@ -153,10 +155,12 @@ void run_gc(EngineState *s) { // Some debug stuff debugC(2, kDebugLevelGC, "[GC] Running..."); +#ifdef GC_DEBUG_CODE const char *segnames[SEG_TYPE_MAX + 1]; int segcount[SEG_TYPE_MAX + 1]; memset(segnames, 0, sizeof(segnames)); memset(segcount, 0, sizeof(segcount)); +#endif // Compute the set of all segments references currently in use. AddrSet *activeRefs = findAllActiveReferences(s); @@ -166,10 +170,13 @@ void run_gc(EngineState *s) { const Common::Array<SegmentObj *> &heap = segMan->getSegments(); for (uint seg = 1; seg < heap.size(); seg++) { SegmentObj *mobj = heap[seg]; + if (mobj != NULL) { +#ifdef GC_DEBUG_CODE const SegmentType type = mobj->getType(); segnames[type] = SegmentObj::getSegmentTypeName(type); - +#endif + // Get a list of all deallocatable objects in this segment, // then free any which are not referenced from somewhere. const Common::Array<reg_t> tmp = mobj->listAllDeallocatable(seg); @@ -179,7 +186,9 @@ void run_gc(EngineState *s) { // Not found -> we can free it mobj->freeAtAddress(segMan, addr); debugC(2, kDebugLevelGC, "[GC] Deallocating %04x:%04x", PRINT_REG(addr)); +#ifdef GC_DEBUG_CODE segcount[type]++; +#endif } } @@ -188,11 +197,13 @@ void run_gc(EngineState *s) { delete activeRefs; +#ifdef GC_DEBUG_CODE // Output debug summary of garbage collection debugC(2, kDebugLevelGC, "[GC] Summary:"); for (int i = 0; i <= SEG_TYPE_MAX; i++) if (segcount[i]) debugC(2, kDebugLevelGC, "\t%d\t* %s", segcount[i], segnames[i]); +#endif } } // End of namespace Sci |