soot-oss / soot

Soot - A Java optimization framework
GNU Lesser General Public License v2.1
2.84k stars 708 forks source link

Fix the time consume problem in method `instructionAtAddress` #2060

Closed wangnianwu closed 4 months ago

wangnianwu commented 4 months ago

If the address is not continuous, it will visit all integers from the current to target address(The length exceeds the map size), it causes taking too much time to call retrieveActiveBody in SootMethod.

jpstotz commented 4 months ago

As you have changed the Map type from HashMap to TreeMap wouldn't it be easier to use the TreeMap specific functions like floorKey or ceilingKey to get the nearest instruction to an address instead of iterating through the whole TreeMap to find the address?

wangnianwu commented 4 months ago

@jpstotz updated it by your advise