mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-22 12:11:55 +00:00
GP-4712 Simplified code putting prototype into map
This commit is contained in:
parent
35cbc81d59
commit
4ff585d8db
@ -375,16 +375,12 @@ public class SleighLanguage implements Language {
|
|||||||
new SleighInstructionPrototype(this, buf, context, contextcache, inDelaySlot, null);
|
new SleighInstructionPrototype(this, buf, context, contextcache, inDelaySlot, null);
|
||||||
Integer hashcode = newProto.hashCode();
|
Integer hashcode = newProto.hashCode();
|
||||||
|
|
||||||
// check proto map for already defined prototype
|
// get existing proto and use it
|
||||||
res = instructProtoMap.get(hashcode);
|
// if doesn't exist in map, cache info and store new proto
|
||||||
if (res == null) {
|
res = instructProtoMap.computeIfAbsent(hashcode, h -> {
|
||||||
newProto.cacheInfo(buf, context, true);
|
newProto.cacheInfo(buf, context, true);
|
||||||
res = instructProtoMap.putIfAbsent(hashcode, newProto);
|
return newProto;
|
||||||
// if there was no previous value, assume newProto inserted
|
});
|
||||||
if (res == null) {
|
|
||||||
res = newProto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (inDelaySlot && res.hasDelaySlots()) {
|
if (inDelaySlot && res.hasDelaySlots()) {
|
||||||
throw new NestedDelaySlotException();
|
throw new NestedDelaySlotException();
|
||||||
|
Loading…
Reference in New Issue
Block a user