def _del_insn(self, ir_addr): insn = self._find(ir_addr) if insn is not None: # remove item from collection self.collection.remove(self._get_key(ir_addr)) # remove item from cache try: del self.cache[ir_addr] except KeyError: pass else: raise REIL.StorageError(*ir_addr)
def _get_insn(self, ir_addr): # get item from cache try: return self.cache[ir_addr] except KeyError: pass # get item from collection insn = self._find(ir_addr) if insn is not None: insn = self._insn_from_item(insn) # update cache self.cache[ir_addr] = insn return insn else: raise REIL.StorageError(*ir_addr)