[Scummvm-cvs-logs] SF.net SVN: scummvm:[42265] tools/branches/gsoc2009-decompiler/decompiler
kjdf at users.sourceforge.net
kjdf at users.sourceforge.net
Wed Jul 8 16:36:23 CEST 2009
Revision: 42265
http://scummvm.svn.sourceforge.net/scummvm/?rev=42265&view=rev
Author: kjdf
Date: 2009-07-08 14:36:23 +0000 (Wed, 08 Jul 2009)
Log Message:
-----------
decompiler: fixed dominator algorithm bug
Modified Paths:
--------------
tools/branches/gsoc2009-decompiler/decompiler/decompiler.cpp
tools/branches/gsoc2009-decompiler/decompiler/graph.cpp
Modified: tools/branches/gsoc2009-decompiler/decompiler/decompiler.cpp
===================================================================
--- tools/branches/gsoc2009-decompiler/decompiler/decompiler.cpp 2009-07-08 14:35:31 UTC (rev 42264)
+++ tools/branches/gsoc2009-decompiler/decompiler/decompiler.cpp 2009-07-08 14:36:23 UTC (rev 42265)
@@ -52,6 +52,7 @@
}
ControlFlowGraph cfg;
cfg.addBlocksFromScript(script._instructions.begin(), script._instructions.end());
+ // TODO won't work with empty script
cfg.setEntry(script._instructions.front()->_addr);
if (vars.count("blocks")) {
foreach (Block *block, cfg._blocks)
Modified: tools/branches/gsoc2009-decompiler/decompiler/graph.cpp
===================================================================
--- tools/branches/gsoc2009-decompiler/decompiler/graph.cpp 2009-07-08 14:35:31 UTC (rev 42264)
+++ tools/branches/gsoc2009-decompiler/decompiler/graph.cpp 2009-07-08 14:36:23 UTC (rev 42265)
@@ -37,7 +37,9 @@
changed = false;
foreach (Block *u, blocks) {
std::list<Block*>::iterator it = u->_in.begin();
- Block *dom = *it++;
+ while (!(*it)->_dominator)
+ it++;
+ Block *dom = *it++; // first processed predecessor
for (; it != u->_in.end(); it++)
if ((*it)->_dominator)
dom = dominatorIntersect(*it, dom);
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