mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
GP-1411: keying space cache by identity
This commit is contained in:
parent
3d46c4588c
commit
9d12f6c57a
3 changed files with 49 additions and 29 deletions
|
@ -22,9 +22,11 @@ import ghidra.program.model.address.Address;
|
|||
import ghidra.program.model.address.AddressSpace;
|
||||
import ghidra.trace.model.map.UnsignedUtils;
|
||||
import ghidra.util.database.spatial.rect.EuclideanSpace2D;
|
||||
import utilities.util.IDHashed;
|
||||
|
||||
public class TraceAddressSnapSpace implements EuclideanSpace2D<Address, Long> {
|
||||
private static final Map<AddressSpace, TraceAddressSnapSpace> SPACES = new HashMap<>();
|
||||
private static final Map<IDHashed<AddressSpace>, TraceAddressSnapSpace> SPACES =
|
||||
new HashMap<>();
|
||||
|
||||
/**
|
||||
* Get the trace-address-snap space for a given address space
|
||||
|
@ -38,7 +40,8 @@ public class TraceAddressSnapSpace implements EuclideanSpace2D<Address, Long> {
|
|||
*/
|
||||
public static TraceAddressSnapSpace forAddressSpace(AddressSpace space) {
|
||||
synchronized (SPACES) {
|
||||
return SPACES.computeIfAbsent(space, TraceAddressSnapSpace::new);
|
||||
return SPACES.computeIfAbsent(new IDHashed<>(space),
|
||||
s -> new TraceAddressSnapSpace(space));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue