GP-4712 Code review cachec lookup changes

This commit is contained in:
emteere 2024-07-29 18:07:18 -04:00
parent 19cf2fba3c
commit 35cbc81d59

View file

@ -375,13 +375,15 @@ public class SleighLanguage implements Language {
new SleighInstructionPrototype(this, buf, context, contextcache, inDelaySlot, null);
Integer hashcode = newProto.hashCode();
if (!instructProtoMap.containsKey(hashcode)) {
newProto.cacheInfo(buf, context, true);
}
res = instructProtoMap.putIfAbsent(hashcode, newProto);
// if there was no previous value, assume newProto inserted
// check proto map for already defined prototype
res = instructProtoMap.get(hashcode);
if (res == null) {
res = newProto;
newProto.cacheInfo(buf, context, true);
res = instructProtoMap.putIfAbsent(hashcode, newProto);
// if there was no previous value, assume newProto inserted
if (res == null) {
res = newProto;
}
}
if (inDelaySlot && res.hasDelaySlots()) {