MemMMap: use modified_pages.discard instead of remove since pages may not be modified
authorJacob Lifshay <programmerjake@gmail.com>
Mon, 4 Dec 2023 10:13:52 +0000 (02:13 -0800)
committerJacob Lifshay <programmerjake@gmail.com>
Wed, 13 Dec 2023 00:59:12 +0000 (16:59 -0800)
src/openpower/decoder/isa/mem.py

index ddb3b886c9cb75e68d1d99665e1d995f73a6006d..4947e9b17cba14e40176e2e04af8d11f54109232 100644 (file)
@@ -651,7 +651,7 @@ class MemMMap(MemCommon):
         # mark pages as empty
         for page_idx in block.page_indexes:
             self.__page_flags.pop(page_idx)
-            self.modified_pages.remove(page_idx)
+            self.modified_pages.discard(page_idx)
         return retval
 
     def __mmap_emu_zero_block(self, block):
@@ -716,13 +716,13 @@ class MemMMap(MemCommon):
                 return None
             for page_idx in r:
                 self.__page_flags.pop(page_idx)
-                self.modified_pages.remove(page_idx)
+                self.modified_pages.discard(page_idx)
         else:
             # expanding -- map pages at end, they're cleared already
             r = range(block.page_indexes.stop, new_block.page_indexes.stop)
             for page_idx in r:
                 self.__page_flags[page_idx] = block.flags
-                self.modified_pages.remove(page_idx)  # cleared page
+                self.modified_pages.discard(page_idx)  # cleared page
         self.__mmap_emu_alloc_blocks.remove(block)
         self.__mmap_emu_alloc_blocks.add(new_block)
         return new_block