wala/WALA — pull request #59 by cos (2014-11-11 02:13:34+00:00)
Title: `SSAInstruction` equals based on its `iindex`

A small change fixing a lingering problem: #6.

In a nutshell, comparing `SSAInstruction`s based on object identity fails when comparing instructions created before a cache wipe with the corresponding instructions recreated after the wipe. Replacing the caching mechanism with a sturdier one which doesn't delete strongly-referenced objects would help, but we're not there yet.

In the meantime, we can simply compare instructions based on the new `iindex` field. The field was not available when issue #6 was raised, but we have it now, so we might as well use it. There was no significant difference in speed running the tests on my machine after applying the patch (it was 5 seconds faster for a test running for over 10 min 30 sec). The only issue would be if someone, for some reason, compares `SSAInstruction`s between `IR`s, but this wouldn't make much sense, and it is not that easy to fix.

The first commit is a test revealing the issue. The second is the fix.