[Scummvm-cvs-logs] SF.net SVN: scummvm:[50553] scummvm/trunk/engines/sci
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Thu Jul 1 18:05:48 CEST 2010
Revision: 50553
http://scummvm.svn.sourceforge.net/scummvm/?rev=50553&view=rev
Author: fingolfin
Date: 2010-07-01 16:05:47 +0000 (Thu, 01 Jul 2010)
Log Message:
-----------
SCI: Rename some more stuff
Modified Paths:
--------------
scummvm/trunk/engines/sci/console.cpp
scummvm/trunk/engines/sci/engine/gc.cpp
scummvm/trunk/engines/sci/engine/gc.h
Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp 2010-07-01 16:05:29 UTC (rev 50552)
+++ scummvm/trunk/engines/sci/console.cpp 2010-07-01 16:05:47 UTC (rev 50553)
@@ -1757,10 +1757,10 @@
}
bool Console::cmdGCObjects(int argc, const char **argv) {
- reg_t_hash_map *use_map = find_all_used_references(_engine->_gamestate);
+ AddrSet *use_map = findAllActiveReferences(_engine->_gamestate);
DebugPrintf("Reachable object references (normalised):\n");
- for (reg_t_hash_map::iterator i = use_map->begin(); i != use_map->end(); ++i) {
+ for (AddrSet::iterator i = use_map->begin(); i != use_map->end(); ++i) {
DebugPrintf(" - %04x:%04x\n", PRINT_REG(i->_key));
}
Modified: scummvm/trunk/engines/sci/engine/gc.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/gc.cpp 2010-07-01 16:05:29 UTC (rev 50552)
+++ scummvm/trunk/engines/sci/engine/gc.cpp 2010-07-01 16:05:47 UTC (rev 50553)
@@ -30,7 +30,7 @@
struct WorklistManager {
Common::Array<reg_t> _worklist;
- reg_t_hash_map _map;
+ AddrSet _map;
void push(reg_t reg) {
if (!reg.segment) // No numbers
@@ -51,10 +51,10 @@
}
};
-static reg_t_hash_map *normalizeAddresses(SegManager *segMan, reg_t_hash_map &nonnormal_map) {
- reg_t_hash_map *normal_map = new reg_t_hash_map();
+static AddrSet *normalizeAddresses(SegManager *segMan, const AddrSet &nonnormal_map) {
+ AddrSet *normal_map = new AddrSet();
- for (reg_t_hash_map::iterator i = nonnormal_map.begin(); i != nonnormal_map.end(); ++i) {
+ for (AddrSet::const_iterator i = nonnormal_map.begin(); i != nonnormal_map.end(); ++i) {
reg_t reg = i->_key;
SegmentObj *mobj = segMan->getSegmentObj(reg.segment);
@@ -68,9 +68,9 @@
}
-reg_t_hash_map *find_all_used_references(EngineState *s) {
+AddrSet *findAllActiveReferences(EngineState *s) {
SegManager *segMan = s->_segMan;
- reg_t_hash_map *normal_map = NULL;
+ AddrSet *normal_map = NULL;
WorklistManager wm;
uint i;
@@ -159,7 +159,7 @@
memset(segcount, 0, sizeof(segcount));
// Compute the set of all segments references currently in use.
- reg_t_hash_map *activeRefs = find_all_used_references(s);
+ AddrSet *activeRefs = findAllActiveReferences(s);
// Iterate over all segments, and check for each whether it
// contains stuff that can be collected.
Modified: scummvm/trunk/engines/sci/engine/gc.h
===================================================================
--- scummvm/trunk/engines/sci/engine/gc.h 2010-07-01 16:05:29 UTC (rev 50552)
+++ scummvm/trunk/engines/sci/engine/gc.h 2010-07-01 16:05:47 UTC (rev 50553)
@@ -35,21 +35,22 @@
struct reg_t_Hash {
uint operator()(const reg_t& x) const {
- return (x.segment << 3) | x.offset;
+ return (x.segment << 3) ^ x.offset ^ (x.offset << 16);
}
};
/*
- * The reg_t_hash_map is actually really a hashset
+ * The AddrSet is a "set" of reg_t values.
+ * We don't have a HashSet type, so we abuse a HashMap for this.
*/
-typedef Common::HashMap<reg_t, bool, reg_t_Hash> reg_t_hash_map;
+typedef Common::HashMap<reg_t, bool, reg_t_Hash> AddrSet;
/**
* Finds all used references and normalises them to their memory addresses
* @param s The state to gather all information from
* @return A hash map containing entries for all used references
*/
-reg_t_hash_map *find_all_used_references(EngineState *s);
+AddrSet *findAllActiveReferences(EngineState *s);
/**
* Runs garbage collection on the current system state
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